Skip to content

Commit fa94a73

Browse files
Merge pull request #1399 from vtex/feature/select-for-mobile
Feature/select for mobile
2 parents f641de1 + 1df0153 commit fa94a73

File tree

5 files changed

+40
-2
lines changed

5 files changed

+40
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [9.145.0] - 2021-07-12
11+
12+
### Added
13+
14+
- **EXPERIMENTAL_Select** `searchable` option so it can be better used on mobile.
15+
1016
## [9.144.0] - 2021-06-29
1117

1218
### Added

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"vendor": "vtex",
33
"name": "styleguide",
44
"title": "VTEX Styleguide",
5-
"version": "9.144.0",
5+
"version": "9.145.0",
66
"description": "The VTEX Styleguide components for the Render framework",
77
"builders": {
88
"react": "3.x"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vtex/styleguide",
3-
"version": "9.144.0",
3+
"version": "9.145.0",
44
"scripts": {
55
"lint": "eslint react --ext js,jsx,ts,tsx",
66
"test": "node config/test.js",

react/components/EXPERIMENTAL_Select/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,33 @@ const options = [
272272
</div>
273273
```
274274

275+
Without search input (good for mobile experience)
276+
277+
```js
278+
const options = [
279+
{
280+
value: 'first-option',
281+
label: 'First Option',
282+
},
283+
{
284+
value: 'second-option',
285+
label: 'Second Option',
286+
},
287+
]
288+
289+
;<div>
290+
<Select
291+
label="Label"
292+
options={options}
293+
multi={false}
294+
searchable={false}
295+
onChange={values => {
296+
console.log(`[Select] Selected: ${JSON.stringify(values, null, 2)}`)
297+
}}
298+
/>
299+
</div>
300+
```
301+
275302
Loading state
276303

277304
```js

react/components/EXPERIMENTAL_Select/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class Select extends Component {
4141
formatCreateLabel,
4242
label,
4343
loading,
44+
searchable,
4445
multi,
4546
noOptionsMessage,
4647
onChange,
@@ -80,6 +81,7 @@ class Select extends Component {
8081
isClearable: clearable,
8182
isDisabled: disabled,
8283
isLoading: loading,
84+
isSearchable: searchable,
8385
isMulti: multi,
8486
noOptionsMessage,
8587
inputId: this.inputId,
@@ -204,6 +206,7 @@ class Select extends Component {
204206

205207
Select.defaultProps = {
206208
multi: true,
209+
searchable: true,
207210
placeholder: 'Select...',
208211
size: 'regular',
209212
clearable: true,
@@ -255,6 +258,8 @@ Select.propTypes = {
255258
loading: PropTypes.bool,
256259
/** Text to display when loading options */
257260
loadingMessage: PropTypes.string,
261+
/** Support disabling search input and only allow select to change values. */
262+
searchable: PropTypes.bool,
258263
/** Support multiple selected options. */
259264
multi: PropTypes.bool,
260265
/** Text to display when there are no options. ({inputValue}) => string | null */

0 commit comments

Comments
 (0)