@commercetools-uikit/select-input 14.0.0 → 14.0.6
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
|
|
@@ -128,8 +128,7 @@ The options support a `isDisabled` property which will render the option with a
|
|
|
128
128
|
|
|
129
129
|
### `isTouched(touched)`
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
Returns `true` when truthy.
|
|
131
|
+
Returns truthy value for the Formik `touched` value of this input field.
|
|
133
132
|
|
|
134
133
|
## Components
|
|
135
134
|
|
|
@@ -140,24 +139,24 @@ Components available as static exports are:
|
|
|
140
139
|
|
|
141
140
|
- `ClearIndicator`
|
|
142
141
|
- `Control`
|
|
143
|
-
- `DropdownIndicator`
|
|
144
|
-
- `DownChevron`
|
|
145
142
|
- `CrossIcon`
|
|
143
|
+
- `DownChevron`
|
|
144
|
+
- `DropdownIndicator`
|
|
146
145
|
- `Group`
|
|
147
146
|
- `GroupHeading`
|
|
148
147
|
- `IndicatorsContainer`
|
|
149
148
|
- `IndicatorSeparator`
|
|
150
149
|
- `Input`
|
|
151
150
|
- `LoadingIndicator`
|
|
151
|
+
- `LoadingMessage`
|
|
152
152
|
- `Menu`
|
|
153
153
|
- `MenuList`
|
|
154
154
|
- `MenuPortal`
|
|
155
|
-
- `LoadingMessage`
|
|
156
|
-
- `NoOptionsMessage`
|
|
157
155
|
- `MultiValue`
|
|
158
156
|
- `MultiValueContainer`
|
|
159
157
|
- `MultiValueLabel`
|
|
160
158
|
- `MultiValueRemove`
|
|
159
|
+
- `NoOptionsMessage`
|
|
161
160
|
- `Option`
|
|
162
161
|
- `Placeholder`
|
|
163
162
|
- `SelectContainer`
|
|
@@ -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
|
}))
|
|
@@ -214,21 +215,50 @@ SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
214
215
|
}))]),
|
|
215
216
|
showOptionGroupDivider: _pt__default["default"].bool
|
|
216
217
|
} : {};
|
|
217
|
-
SelectInput.displayName = 'SelectInput';
|
|
218
|
-
|
|
218
|
+
SelectInput.displayName = 'SelectInput';
|
|
219
|
+
SelectInput.defaultProps = defaultProps;
|
|
220
|
+
/**
|
|
221
|
+
* Expose static helper methods.
|
|
222
|
+
*/
|
|
223
|
+
// Both "true" and an empty array [] represent a touched state.
|
|
219
224
|
|
|
220
225
|
SelectInput.isTouched = function (touched) {
|
|
221
226
|
return Boolean(touched);
|
|
222
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* Expose react-select components for customization purposes.
|
|
230
|
+
*/
|
|
223
231
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
|
|
233
|
+
SelectInput.ClearIndicator = customizedComponents.ClearIndicator;
|
|
234
|
+
SelectInput.Control = Select.components.Control;
|
|
235
|
+
SelectInput.CrossIcon = Select.components.CrossIcon;
|
|
236
|
+
SelectInput.DownChevron = Select.components.DownChevron;
|
|
237
|
+
SelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
|
|
238
|
+
SelectInput.Group = Select.components.Group;
|
|
239
|
+
SelectInput.GroupHeading = Select.components.GroupHeading;
|
|
240
|
+
SelectInput.IndicatorSeparator = Select.components.IndicatorSeparator;
|
|
241
|
+
SelectInput.IndicatorsContainer = Select.components.IndicatorsContainer;
|
|
242
|
+
SelectInput.Input = Select.components.Input;
|
|
243
|
+
SelectInput.LoadingIndicator = Select.components.LoadingIndicator;
|
|
244
|
+
SelectInput.LoadingMessage = Select.components.LoadingMessage;
|
|
245
|
+
SelectInput.Menu = Select.components.Menu;
|
|
246
|
+
SelectInput.MenuList = Select.components.MenuList;
|
|
247
|
+
SelectInput.MenuPortal = Select.components.MenuPortal;
|
|
248
|
+
SelectInput.MultiValue = Select.components.MultiValue;
|
|
249
|
+
SelectInput.MultiValueContainer = Select.components.MultiValueContainer;
|
|
250
|
+
SelectInput.MultiValueLabel = Select.components.MultiValueLabel;
|
|
251
|
+
SelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
|
|
252
|
+
SelectInput.NoOptionsMessage = Select.components.NoOptionsMessage;
|
|
253
|
+
SelectInput.Option = Select.components.Option;
|
|
254
|
+
SelectInput.Placeholder = Select.components.Placeholder;
|
|
255
|
+
SelectInput.SelectContainer = Select.components.SelectContainer;
|
|
256
|
+
SelectInput.SingleValue = Select.components.SingleValue;
|
|
257
|
+
SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
228
258
|
var SelectInput$1 = SelectInput;
|
|
229
259
|
|
|
230
260
|
// NOTE: This string will be replaced on build time with the package version.
|
|
231
|
-
var version = "14.0.
|
|
261
|
+
var version = "14.0.6";
|
|
232
262
|
|
|
233
263
|
exports["default"] = SelectInput$1;
|
|
234
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
|
}))
|
|
@@ -195,21 +196,50 @@ var SelectInput = function SelectInput(props) {
|
|
|
195
196
|
};
|
|
196
197
|
|
|
197
198
|
SelectInput.propTypes = {};
|
|
198
|
-
SelectInput.displayName = 'SelectInput';
|
|
199
|
-
|
|
199
|
+
SelectInput.displayName = 'SelectInput';
|
|
200
|
+
SelectInput.defaultProps = defaultProps;
|
|
201
|
+
/**
|
|
202
|
+
* Expose static helper methods.
|
|
203
|
+
*/
|
|
204
|
+
// Both "true" and an empty array [] represent a touched state.
|
|
200
205
|
|
|
201
206
|
SelectInput.isTouched = function (touched) {
|
|
202
207
|
return Boolean(touched);
|
|
203
208
|
};
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Expose react-select components for customization purposes.
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
SelectInput.ClearIndicator = customizedComponents.ClearIndicator;
|
|
215
|
+
SelectInput.Control = Select.components.Control;
|
|
216
|
+
SelectInput.CrossIcon = Select.components.CrossIcon;
|
|
217
|
+
SelectInput.DownChevron = Select.components.DownChevron;
|
|
218
|
+
SelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
|
|
219
|
+
SelectInput.Group = Select.components.Group;
|
|
220
|
+
SelectInput.GroupHeading = Select.components.GroupHeading;
|
|
221
|
+
SelectInput.IndicatorSeparator = Select.components.IndicatorSeparator;
|
|
222
|
+
SelectInput.IndicatorsContainer = Select.components.IndicatorsContainer;
|
|
223
|
+
SelectInput.Input = Select.components.Input;
|
|
224
|
+
SelectInput.LoadingIndicator = Select.components.LoadingIndicator;
|
|
225
|
+
SelectInput.LoadingMessage = Select.components.LoadingMessage;
|
|
226
|
+
SelectInput.Menu = Select.components.Menu;
|
|
227
|
+
SelectInput.MenuList = Select.components.MenuList;
|
|
228
|
+
SelectInput.MenuPortal = Select.components.MenuPortal;
|
|
229
|
+
SelectInput.MultiValue = Select.components.MultiValue;
|
|
230
|
+
SelectInput.MultiValueContainer = Select.components.MultiValueContainer;
|
|
231
|
+
SelectInput.MultiValueLabel = Select.components.MultiValueLabel;
|
|
232
|
+
SelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
|
|
233
|
+
SelectInput.NoOptionsMessage = Select.components.NoOptionsMessage;
|
|
234
|
+
SelectInput.Option = Select.components.Option;
|
|
235
|
+
SelectInput.Placeholder = Select.components.Placeholder;
|
|
236
|
+
SelectInput.SelectContainer = Select.components.SelectContainer;
|
|
237
|
+
SelectInput.SingleValue = Select.components.SingleValue;
|
|
238
|
+
SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
209
239
|
var SelectInput$1 = SelectInput;
|
|
210
240
|
|
|
211
241
|
// NOTE: This string will be replaced on build time with the package version.
|
|
212
|
-
var version = "14.0.
|
|
242
|
+
var version = "14.0.6";
|
|
213
243
|
|
|
214
244
|
exports["default"] = SelectInput$1;
|
|
215
245
|
exports.version = version;
|
|
@@ -18,7 +18,7 @@ import flatMap from 'lodash/flatMap';
|
|
|
18
18
|
import Select, { components } from 'react-select';
|
|
19
19
|
import Constraints from '@commercetools-uikit/constraints';
|
|
20
20
|
import { messages, customComponentsWithIcons, createSelectStyles, DropdownIndicator, ClearIndicator, TagRemove } from '@commercetools-uikit/select-utils';
|
|
21
|
-
import { filterDataAttributes
|
|
21
|
+
import { filterDataAttributes } from '@commercetools-uikit/utils';
|
|
22
22
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
23
23
|
|
|
24
24
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -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
|
}))
|
|
@@ -191,20 +192,49 @@ SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
191
192
|
}))]),
|
|
192
193
|
showOptionGroupDivider: _pt.bool
|
|
193
194
|
} : {};
|
|
194
|
-
SelectInput.displayName = 'SelectInput';
|
|
195
|
-
|
|
195
|
+
SelectInput.displayName = 'SelectInput';
|
|
196
|
+
SelectInput.defaultProps = defaultProps;
|
|
197
|
+
/**
|
|
198
|
+
* Expose static helper methods.
|
|
199
|
+
*/
|
|
200
|
+
// Both "true" and an empty array [] represent a touched state.
|
|
196
201
|
|
|
197
202
|
SelectInput.isTouched = function (touched) {
|
|
198
203
|
return Boolean(touched);
|
|
199
204
|
};
|
|
205
|
+
/**
|
|
206
|
+
* Expose react-select components for customization purposes.
|
|
207
|
+
*/
|
|
200
208
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
|
|
210
|
+
SelectInput.ClearIndicator = customizedComponents.ClearIndicator;
|
|
211
|
+
SelectInput.Control = components.Control;
|
|
212
|
+
SelectInput.CrossIcon = components.CrossIcon;
|
|
213
|
+
SelectInput.DownChevron = components.DownChevron;
|
|
214
|
+
SelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
|
|
215
|
+
SelectInput.Group = components.Group;
|
|
216
|
+
SelectInput.GroupHeading = components.GroupHeading;
|
|
217
|
+
SelectInput.IndicatorSeparator = components.IndicatorSeparator;
|
|
218
|
+
SelectInput.IndicatorsContainer = components.IndicatorsContainer;
|
|
219
|
+
SelectInput.Input = components.Input;
|
|
220
|
+
SelectInput.LoadingIndicator = components.LoadingIndicator;
|
|
221
|
+
SelectInput.LoadingMessage = components.LoadingMessage;
|
|
222
|
+
SelectInput.Menu = components.Menu;
|
|
223
|
+
SelectInput.MenuList = components.MenuList;
|
|
224
|
+
SelectInput.MenuPortal = components.MenuPortal;
|
|
225
|
+
SelectInput.MultiValue = components.MultiValue;
|
|
226
|
+
SelectInput.MultiValueContainer = components.MultiValueContainer;
|
|
227
|
+
SelectInput.MultiValueLabel = components.MultiValueLabel;
|
|
228
|
+
SelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
|
|
229
|
+
SelectInput.NoOptionsMessage = components.NoOptionsMessage;
|
|
230
|
+
SelectInput.Option = components.Option;
|
|
231
|
+
SelectInput.Placeholder = components.Placeholder;
|
|
232
|
+
SelectInput.SelectContainer = components.SelectContainer;
|
|
233
|
+
SelectInput.SingleValue = components.SingleValue;
|
|
234
|
+
SelectInput.ValueContainer = components.ValueContainer;
|
|
205
235
|
var SelectInput$1 = SelectInput;
|
|
206
236
|
|
|
207
237
|
// NOTE: This string will be replaced on build time with the package version.
|
|
208
|
-
var version = "14.0.
|
|
238
|
+
var version = "14.0.6";
|
|
209
239
|
|
|
210
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;
|
|
@@ -57,7 +58,64 @@ declare type TSelectInputProps = {
|
|
|
57
58
|
declare const SelectInput: {
|
|
58
59
|
(props: TSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
59
60
|
displayName: string;
|
|
60
|
-
isTouched(touched: boolean | unknown[]): boolean;
|
|
61
61
|
defaultProps: Pick<TSelectInputProps, "maxMenuHeight" | "menuPortalZIndex">;
|
|
62
|
+
isTouched(touched: boolean | unknown[]): boolean;
|
|
63
|
+
ClearIndicator: {
|
|
64
|
+
(props: {
|
|
65
|
+
innerProps: {
|
|
66
|
+
ref: import("react").LegacyRef<HTMLButtonElement>;
|
|
67
|
+
} & import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>;
|
|
68
|
+
} & import("react-select").ClearIndicatorProps<unknown, boolean, import("react-select").GroupBase<unknown>>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
69
|
+
displayName: string;
|
|
70
|
+
};
|
|
71
|
+
Control: <Option_1, IsMulti_1 extends boolean, Group_1 extends import("react-select").GroupBase<Option_1>>(props: import("react-select").ControlProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
72
|
+
CrossIcon: (props: import("react-select/dist/declarations/src/components/indicators").CrossIconProps) => import("@emotion/react").jsx.JSX.Element;
|
|
73
|
+
DownChevron: (props: import("react-select/dist/declarations/src/components/indicators").DownChevronProps) => import("@emotion/react").jsx.JSX.Element;
|
|
74
|
+
DropdownIndicator: {
|
|
75
|
+
(props: import("react-select").DropdownIndicatorProps<unknown, boolean, import("react-select").GroupBase<unknown>>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
76
|
+
displayName: string;
|
|
77
|
+
};
|
|
78
|
+
Group: <Option_3, IsMulti_3 extends boolean, Group_3 extends import("react-select").GroupBase<Option_3>>(props: import("react-select").GroupProps<Option_3, IsMulti_3, Group_3>) => import("@emotion/react").jsx.JSX.Element;
|
|
79
|
+
GroupHeading: <Option_4, IsMulti_4 extends boolean, Group_4 extends import("react-select").GroupBase<Option_4>>(props: import("react-select").GroupHeadingProps<Option_4, IsMulti_4, Group_4>) => import("@emotion/react").jsx.JSX.Element;
|
|
80
|
+
IndicatorSeparator: <Option_6, IsMulti_6 extends boolean, Group_6 extends import("react-select").GroupBase<Option_6>>(props: import("react-select").IndicatorSeparatorProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
|
|
81
|
+
IndicatorsContainer: <Option_5, IsMulti_5 extends boolean, Group_5 extends import("react-select").GroupBase<Option_5>>(props: import("react-select").IndicatorsContainerProps<Option_5, IsMulti_5, Group_5>) => import("@emotion/react").jsx.JSX.Element;
|
|
82
|
+
Input: <Option_7, IsMulti_7 extends boolean, Group_7 extends import("react-select").GroupBase<Option_7>>(props: import("react-select").InputProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
|
|
83
|
+
LoadingIndicator: {
|
|
84
|
+
<Option_8, IsMulti_8 extends boolean, Group_8 extends import("react-select").GroupBase<Option_8>>(props: import("react-select").LoadingIndicatorProps<Option_8, IsMulti_8, Group_8>): import("@emotion/react").jsx.JSX.Element;
|
|
85
|
+
defaultProps: {
|
|
86
|
+
size: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
LoadingMessage: {
|
|
90
|
+
<Option_11, IsMulti_11 extends boolean, Group_11 extends import("react-select").GroupBase<Option_11>>(props: import("react-select").NoticeProps<Option_11, IsMulti_11, Group_11>): import("@emotion/react").jsx.JSX.Element;
|
|
91
|
+
defaultProps: {
|
|
92
|
+
children: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
Menu: <Option_9, IsMulti_9 extends boolean, Group_9 extends import("react-select").GroupBase<Option_9>>(props: import("react-select").MenuProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
|
|
96
|
+
MenuList: <Option_10, IsMulti_10 extends boolean, Group_10 extends import("react-select").GroupBase<Option_10>>(props: import("react-select").MenuListProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
|
|
97
|
+
MenuPortal: typeof import("react-select/dist/declarations/src/components/Menu").MenuPortal;
|
|
98
|
+
MultiValue: <Option_13, IsMulti_13 extends boolean, Group_13 extends import("react-select").GroupBase<Option_13>>(props: import("react-select").MultiValueProps<Option_13, IsMulti_13, Group_13>) => import("@emotion/react").jsx.JSX.Element;
|
|
99
|
+
MultiValueContainer: <Option_14, IsMulti_14 extends boolean, Group_14 extends import("react-select").GroupBase<Option_14>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14, IsMulti_14, Group_14>) => import("@emotion/react").jsx.JSX.Element;
|
|
100
|
+
MultiValueLabel: <Option_14_1, IsMulti_14_1 extends boolean, Group_14_1 extends import("react-select").GroupBase<Option_14_1>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14_1, IsMulti_14_1, Group_14_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
101
|
+
MultiValueRemove: {
|
|
102
|
+
(props: {
|
|
103
|
+
selectProps: {
|
|
104
|
+
isReadOnly: boolean;
|
|
105
|
+
} & import("react-select/dist/declarations/src/Select").Props<unknown, boolean, import("react-select").GroupBase<unknown>>;
|
|
106
|
+
} & import("react-select").MultiValueGenericProps<unknown, boolean, import("react-select").GroupBase<unknown>>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
107
|
+
displayName: string;
|
|
108
|
+
};
|
|
109
|
+
NoOptionsMessage: {
|
|
110
|
+
<Option_12, IsMulti_12 extends boolean, Group_12 extends import("react-select").GroupBase<Option_12>>(props: import("react-select").NoticeProps<Option_12, IsMulti_12, Group_12>): import("@emotion/react").jsx.JSX.Element;
|
|
111
|
+
defaultProps: {
|
|
112
|
+
children: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
Option: <Option_15, IsMulti_15 extends boolean, Group_15 extends import("react-select").GroupBase<Option_15>>(props: import("react-select").OptionProps<Option_15, IsMulti_15, Group_15>) => import("@emotion/react").jsx.JSX.Element;
|
|
116
|
+
Placeholder: <Option_16, IsMulti_16 extends boolean, Group_16 extends import("react-select").GroupBase<Option_16>>(props: import("react-select").PlaceholderProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
|
|
117
|
+
SelectContainer: <Option_17, IsMulti_17 extends boolean, Group_17 extends import("react-select").GroupBase<Option_17>>(props: import("react-select").ContainerProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
|
|
118
|
+
SingleValue: <Option_18, IsMulti_18 extends boolean, Group_18 extends import("react-select").GroupBase<Option_18>>(props: import("react-select").SingleValueProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
|
|
119
|
+
ValueContainer: <Option_19, IsMulti_19 extends boolean, Group_19 extends import("react-select").GroupBase<Option_19>>(props: import("react-select").ValueContainerProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
|
|
62
120
|
};
|
|
63
121
|
export default SelectInput;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/select-input",
|
|
3
3
|
"description": "An input component getting a selection from the user.",
|
|
4
|
-
"version": "14.0.
|
|
4
|
+
"version": "14.0.6",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.17.2",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.17.2",
|
|
24
|
-
"@commercetools-uikit/constraints": "14.0.
|
|
24
|
+
"@commercetools-uikit/constraints": "14.0.1",
|
|
25
25
|
"@commercetools-uikit/design-system": "14.0.0",
|
|
26
|
-
"@commercetools-uikit/icons": "14.0.
|
|
27
|
-
"@commercetools-uikit/select-utils": "14.0.
|
|
28
|
-
"@commercetools-uikit/utils": "14.0.
|
|
26
|
+
"@commercetools-uikit/icons": "14.0.1",
|
|
27
|
+
"@commercetools-uikit/select-utils": "14.0.6",
|
|
28
|
+
"@commercetools-uikit/utils": "14.0.1",
|
|
29
29
|
"@emotion/is-prop-valid": "1.1.2",
|
|
30
30
|
"@emotion/react": "^11.4.0",
|
|
31
31
|
"@emotion/styled": "^11.3.0",
|