@commercetools-uikit/select-input 14.0.1 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -58,59 +58,59 @@ export default Example;
|
|
|
58
58
|
|
|
59
59
|
## Properties
|
|
60
60
|
|
|
61
|
-
| Props | Type | Required | Default | Description
|
|
62
|
-
| ------------------------ | ----------------------------------------------------------------------------------------------------- | :------: | ------- |
|
|
63
|
-
| `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | |
|
|
64
|
-
| `hasError` | `boolean` | | | Indicates that input has errors
|
|
65
|
-
| `isReadOnly` | `boolean` | | | Is the select read-only
|
|
66
|
-
| `hasWarning` | `boolean` | | | Control to indicate on the input if there are selected values that are potentially invalid
|
|
67
|
-
| `iconLeft` | `ReactNode` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
68
|
-
| `aria-label` | `ReactSelectProps['aria-label']` | | | Aria label (for assistive tech)
<br>
[Props from React select was used](https://react-select.com/props)
|
|
69
|
-
| `aria-labelledby` | `ReactSelectProps['aria-labelledby']` | | | HTML ID of an element that should be used as the label (for assistive tech)
<br>
[Props from React select was used](https://react-select.com/props)
|
|
70
|
-
| `aria-invalid` | `ReactSelectProps['aria-invalid']` | | | Indicate if the value entered in the input is invalid.
<br>
[Props from React select was used](https://react-select.com/props)
|
|
71
|
-
| `aria-errormessage` | `ReactSelectProps['aria-errormessage']` | | | HTML ID of an element containing an error message related to the input.
<br>
[Props from React select was used](https://react-select.com/props)
|
|
72
|
-
| `isAutofocussed` | `boolean` | | | Focus the control when it is mounted
|
|
73
|
-
| `backspaceRemovesValue` | `ReactSelectProps['backspaceRemovesValue']` | | | Remove the currently focused option when the user presses backspace
<br>
[Props from React select was used](https://react-select.com/props)
|
|
74
|
-
| `components` | `ReactSelectProps['components']` | | | Map of components to overwrite the default ones, see what components you can override
<br>
[Props from React select was used](https://react-select.com/props)
|
|
75
|
-
| `filterOption` | `ReactSelectProps['filterOption']` | | | Custom method to filter whether an option should be displayed in the menu
<br
|
|
76
|
-
| `id` | `ReactSelectProps['inputId']` | | | Used as HTML id property. An id is generated automatically when not provided.
This forwarded as react-select's "inputId"
<br>
[Props from React select was used](https://react-select.com/props)
|
|
77
|
-
| `inputValue` | `ReactSelectProps['inputValue']` | | | The value of the search input
<br>
[Props from React select was used](https://react-select.com/props)
|
|
78
|
-
| `containerId` | `ReactSelectProps['id']` | | | The id to set on the SelectContainer component
This is forwarded as react-select's "id"
<br>
[Props from React select was used](https://react-select.com/props)
|
|
79
|
-
| `isClearable` | `ReactSelectProps['isClearable']` | | | Is the select value clearable
<br>
[Props from React select was used](https://react-select.com/props)
|
|
80
|
-
| `isDisabled` | `ReactSelectProps['isDisabled']` | | | Is the select disabled
<br>
[Props from React select was used](https://react-select.com/props)
|
|
81
|
-
| `isOptionDisabled` | `ReactSelectProps['isOptionDisabled']` | | | Override the built-in logic to detect whether an option is disabled
<br>
[Props from React select was used](https://react-select.com/props)
|
|
82
|
-
| `isMulti` | `ReactSelectProps['isMulti']` | | | Support multiple selected options
<br>
[Props from React select was used](https://react-select.com/props)
|
|
83
|
-
| `isSearchable` | `ReactSelectProps['isSearchable']` | | | Whether to enable search functionality
<br>
[Props from React select was used](https://react-select.com/props)
|
|
84
|
-
| `maxMenuHeight` | `ReactSelectProps['maxMenuHeight']` | | `220` | Maximum height of the menu before scrolling
<br>
[Props from React select was used](https://react-select.com/props)
|
|
85
|
-
| `menuPortalTarget` | `ReactSelectProps['menuPortalTarget']` | | | Dom element to portal the select menu to
<br>
[Props from React select was used](https://react-select.com/props)
|
|
86
|
-
| `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal
|
|
87
|
-
| `menuShouldBlockScroll` | `ReactSelectProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open
<br>
[Props from React select was used](https://react-select.com/props)
|
|
88
|
-
| `closeMenuOnSelect` | `ReactSelectProps['closeMenuOnSelect']` | | | Whether the menu should close after a value is selected. Defaults to `true`.
<br>
[Props from React select was used](https://react-select.com/props)
|
|
89
|
-
| `name` | `ReactSelectProps['name']` | | | Name of the HTML Input (optional - without this, no input will be rendered)
<br>
[Props from React select was used](https://react-select.com/props)
|
|
90
|
-
| `noOptionsMessage` | `ReactSelectProps['noOptionsMessage']` | | | Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with { inputValue: String }.
<br />
`inputValue` will be an empty string when no search text is present.
<br
|
|
91
|
-
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control
|
|
92
|
-
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) | | | Called with a fake event when value changes. The event's target.name will be the name supplied in props. The event's target.value will hold the value.
<br/>
The value will be the selected option, or an array of options in case isMulti is true
|
|
93
|
-
| `onFocus` | `ReactSelectProps['onFocus']` | | | Handle focus events on the control
<br
|
|
94
|
-
| `onInputChange` | `ReactSelectProps['onInputChange']` | | | Handle change events on the input
<br
|
|
95
|
-
| `options` | `union`<br/>Possible values:<br/>`TOption[] , TOptionObject[]` | | | Array of options that populate the select menu
|
|
96
|
-
| `showOptionGroupDivider` | `boolean` | | |
|
|
97
|
-
| `placeholder` | `ReactSelectProps['placeholder']` | | | Placeholder text for the select value
<br>
[Props from React select was used](https://react-select.com/props)
|
|
98
|
-
| `tabIndex` | `ReactSelectProps['tabIndex']` | | | Sets the tabIndex attribute on the input
<br>
[Props from React select was used](https://react-select.com/props)
|
|
99
|
-
| `tabSelectsValue` | `ReactSelectProps['tabSelectsValue']` | | | Select the currently focused option when the user presses tab
<br>
[Props from React select was used](https://react-select.com/props)
|
|
100
|
-
| `value` | `ReactSelectProps['value']` | | | The value of the select; reflected by the selected option
<br>
[Props from React select was used](https://react-select.com/props)
|
|
61
|
+
| Props | Type | Required | Default | Description |
|
|
62
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------- | :------: | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | | |
|
|
64
|
+
| `hasError` | `boolean` | | | Indicates that input has errors |
|
|
65
|
+
| `isReadOnly` | `boolean` | | | Is the select read-only |
|
|
66
|
+
| `hasWarning` | `boolean` | | | Control to indicate on the input if there are selected values that are potentially invalid |
|
|
67
|
+
| `iconLeft` | `ReactNode` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled. |
|
|
68
|
+
| `aria-label` | `ReactSelectProps['aria-label']` | | | Aria label (for assistive tech)
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
69
|
+
| `aria-labelledby` | `ReactSelectProps['aria-labelledby']` | | | HTML ID of an element that should be used as the label (for assistive tech)
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
70
|
+
| `aria-invalid` | `ReactSelectProps['aria-invalid']` | | | Indicate if the value entered in the input is invalid.
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
71
|
+
| `aria-errormessage` | `ReactSelectProps['aria-errormessage']` | | | HTML ID of an element containing an error message related to the input.
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
72
|
+
| `isAutofocussed` | `boolean` | | | Focus the control when it is mounted |
|
|
73
|
+
| `backspaceRemovesValue` | `ReactSelectProps['backspaceRemovesValue']` | | | Remove the currently focused option when the user presses backspace
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
74
|
+
| `components` | `ReactSelectProps['components']` | | | Map of components to overwrite the default ones, see what components you can override
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
75
|
+
| `filterOption` | `ReactSelectProps['filterOption']` | | | Custom method to filter whether an option should be displayed in the menu
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
76
|
+
| `id` | `ReactSelectProps['inputId']` | | | Used as HTML id property. An id is generated automatically when not provided.
This forwarded as react-select's "inputId"
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
77
|
+
| `inputValue` | `ReactSelectProps['inputValue']` | | | The value of the search input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
78
|
+
| `containerId` | `ReactSelectProps['id']` | | | The id to set on the SelectContainer component
This is forwarded as react-select's "id"
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
79
|
+
| `isClearable` | `ReactSelectProps['isClearable']` | | | Is the select value clearable
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
80
|
+
| `isDisabled` | `ReactSelectProps['isDisabled']` | | | Is the select disabled
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
81
|
+
| `isOptionDisabled` | `ReactSelectProps['isOptionDisabled']` | | | Override the built-in logic to detect whether an option is disabled
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
82
|
+
| `isMulti` | `ReactSelectProps['isMulti']` | | | Support multiple selected options
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
83
|
+
| `isSearchable` | `ReactSelectProps['isSearchable']` | | | Whether to enable search functionality
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
84
|
+
| `maxMenuHeight` | `ReactSelectProps['maxMenuHeight']` | | `220` | Maximum height of the menu before scrolling
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
85
|
+
| `menuPortalTarget` | `ReactSelectProps['menuPortalTarget']` | | | Dom element to portal the select menu to
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
86
|
+
| `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
|
|
87
|
+
| `menuShouldBlockScroll` | `ReactSelectProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
88
|
+
| `closeMenuOnSelect` | `ReactSelectProps['closeMenuOnSelect']` | | | Whether the menu should close after a value is selected. Defaults to `true`.
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
89
|
+
| `name` | `ReactSelectProps['name']` | | | Name of the HTML Input (optional - without this, no input will be rendered)
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
90
|
+
| `noOptionsMessage` | `ReactSelectProps['noOptionsMessage']` | | | Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with { inputValue: String }.
<br />
`inputValue` will be an empty string when no search text is present.
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
91
|
+
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
|
|
92
|
+
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) | | | Called with a fake event when value changes. The event's target.name will be the name supplied in props. The event's target.value will hold the value.
<br/>
The value will be the selected option, or an array of options in case isMulti is true. |
|
|
93
|
+
| `onFocus` | `ReactSelectProps['onFocus']` | | | Handle focus events on the control
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
94
|
+
| `onInputChange` | `ReactSelectProps['onInputChange']` | | | Handle change events on the input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
95
|
+
| `options` | `union`<br/>Possible values:<br/>`TOption[] , TOptionObject[]` | | | Array of options that populate the select menu |
|
|
96
|
+
| `showOptionGroupDivider` | `boolean` | | | |
|
|
97
|
+
| `placeholder` | `ReactSelectProps['placeholder']` | | | Placeholder text for the select value
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
98
|
+
| `tabIndex` | `ReactSelectProps['tabIndex']` | | | Sets the tabIndex attribute on the input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
99
|
+
| `tabSelectsValue` | `ReactSelectProps['tabSelectsValue']` | | | Select the currently focused option when the user presses tab
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
100
|
+
| `value` | `ReactSelectProps['value']` | | | The value of the select; reflected by the selected option
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
101
101
|
|
|
102
102
|
## Signatures
|
|
103
103
|
|
|
104
104
|
### Signature `onBlur`
|
|
105
105
|
|
|
106
106
|
```ts
|
|
107
|
-
(event:
|
|
107
|
+
(event: TCustomEvent) => void
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
### Signature `onChange`
|
|
111
111
|
|
|
112
112
|
```ts
|
|
113
|
-
(event:
|
|
113
|
+
(event: TCustomEvent) => void
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
## `react-select` under the hood
|
|
@@ -141,6 +141,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
141
141
|
onBlur: typeof props.onBlur === 'function' ? function () {
|
|
142
142
|
var event = {
|
|
143
143
|
target: {
|
|
144
|
+
id: props.id,
|
|
144
145
|
name: function () {
|
|
145
146
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
146
147
|
// state as an array instead of a boolean only.
|
|
@@ -175,6 +176,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
175
176
|
|
|
176
177
|
props.onChange && props.onChange({
|
|
177
178
|
target: {
|
|
179
|
+
id: props.id,
|
|
178
180
|
name: props.name,
|
|
179
181
|
value: value
|
|
180
182
|
},
|
|
@@ -187,8 +189,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
187
189
|
placeholder: placeholder,
|
|
188
190
|
tabIndex: props.tabIndex,
|
|
189
191
|
tabSelectsValue: props.tabSelectsValue,
|
|
190
|
-
value: selectedOptions
|
|
191
|
-
,
|
|
192
|
+
value: selectedOptions,
|
|
192
193
|
iconLeft: props.iconLeft
|
|
193
194
|
})
|
|
194
195
|
}))
|
|
@@ -257,7 +258,7 @@ SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
|
257
258
|
var SelectInput$1 = SelectInput;
|
|
258
259
|
|
|
259
260
|
// NOTE: This string will be replaced on build time with the package version.
|
|
260
|
-
var version = "14.0.
|
|
261
|
+
var version = "14.0.2";
|
|
261
262
|
|
|
262
263
|
exports["default"] = SelectInput$1;
|
|
263
264
|
exports.version = version;
|
|
@@ -140,6 +140,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
140
140
|
onBlur: typeof props.onBlur === 'function' ? function () {
|
|
141
141
|
var event = {
|
|
142
142
|
target: {
|
|
143
|
+
id: props.id,
|
|
143
144
|
name: function () {
|
|
144
145
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
145
146
|
// state as an array instead of a boolean only.
|
|
@@ -174,6 +175,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
174
175
|
|
|
175
176
|
props.onChange && props.onChange({
|
|
176
177
|
target: {
|
|
178
|
+
id: props.id,
|
|
177
179
|
name: props.name,
|
|
178
180
|
value: value
|
|
179
181
|
},
|
|
@@ -186,8 +188,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
186
188
|
placeholder: placeholder,
|
|
187
189
|
tabIndex: props.tabIndex,
|
|
188
190
|
tabSelectsValue: props.tabSelectsValue,
|
|
189
|
-
value: selectedOptions
|
|
190
|
-
,
|
|
191
|
+
value: selectedOptions,
|
|
191
192
|
iconLeft: props.iconLeft
|
|
192
193
|
})
|
|
193
194
|
}))
|
|
@@ -238,7 +239,7 @@ SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
|
238
239
|
var SelectInput$1 = SelectInput;
|
|
239
240
|
|
|
240
241
|
// NOTE: This string will be replaced on build time with the package version.
|
|
241
|
-
var version = "14.0.
|
|
242
|
+
var version = "14.0.2";
|
|
242
243
|
|
|
243
244
|
exports["default"] = SelectInput$1;
|
|
244
245
|
exports.version = version;
|
|
@@ -118,6 +118,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
118
118
|
onBlur: typeof props.onBlur === 'function' ? function () {
|
|
119
119
|
var event = {
|
|
120
120
|
target: {
|
|
121
|
+
id: props.id,
|
|
121
122
|
name: function () {
|
|
122
123
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
123
124
|
// state as an array instead of a boolean only.
|
|
@@ -152,6 +153,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
152
153
|
|
|
153
154
|
props.onChange && props.onChange({
|
|
154
155
|
target: {
|
|
156
|
+
id: props.id,
|
|
155
157
|
name: props.name,
|
|
156
158
|
value: value
|
|
157
159
|
},
|
|
@@ -164,8 +166,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
164
166
|
placeholder: placeholder,
|
|
165
167
|
tabIndex: props.tabIndex,
|
|
166
168
|
tabSelectsValue: props.tabSelectsValue,
|
|
167
|
-
value: selectedOptions
|
|
168
|
-
,
|
|
169
|
+
value: selectedOptions,
|
|
169
170
|
iconLeft: props.iconLeft
|
|
170
171
|
})
|
|
171
172
|
}))
|
|
@@ -234,6 +235,6 @@ SelectInput.ValueContainer = components.ValueContainer;
|
|
|
234
235
|
var SelectInput$1 = SelectInput;
|
|
235
236
|
|
|
236
237
|
// NOTE: This string will be replaced on build time with the package version.
|
|
237
|
-
var version = "14.0.
|
|
238
|
+
var version = "14.0.2";
|
|
238
239
|
|
|
239
240
|
export { SelectInput$1 as default, version };
|
|
@@ -7,9 +7,10 @@ declare type TOptionObject = {
|
|
|
7
7
|
options: TOption[];
|
|
8
8
|
};
|
|
9
9
|
declare type TOptions = TOption[] | TOptionObject[];
|
|
10
|
-
declare type
|
|
10
|
+
declare type TCustomEvent = {
|
|
11
11
|
target: {
|
|
12
|
-
|
|
12
|
+
id?: ReactSelectProps['inputId'];
|
|
13
|
+
name?: ReactSelectProps['name'];
|
|
13
14
|
value?: string | string[] | null;
|
|
14
15
|
};
|
|
15
16
|
persist: () => void;
|
|
@@ -43,8 +44,8 @@ declare type TSelectInputProps = {
|
|
|
43
44
|
closeMenuOnSelect?: ReactSelectProps['closeMenuOnSelect'];
|
|
44
45
|
name?: ReactSelectProps['name'];
|
|
45
46
|
noOptionsMessage?: ReactSelectProps['noOptionsMessage'];
|
|
46
|
-
onBlur?: (event:
|
|
47
|
-
onChange?: (event:
|
|
47
|
+
onBlur?: (event: TCustomEvent) => void;
|
|
48
|
+
onChange?: (event: TCustomEvent) => void;
|
|
48
49
|
onFocus?: ReactSelectProps['onFocus'];
|
|
49
50
|
onInputChange?: ReactSelectProps['onInputChange'];
|
|
50
51
|
options?: TOptions;
|
package/package.json
CHANGED