@commercetools-uikit/select-input 16.12.1 → 17.0.0
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,49 +58,51 @@ export default Example;
|
|
|
58
58
|
|
|
59
59
|
## Properties
|
|
60
60
|
|
|
61
|
-
| Props | Type
|
|
62
|
-
| -------------------------- |
|
|
63
|
-
| `appearance` | `union`<br/>Possible values:<br/>`'default' , 'quiet'`
|
|
64
|
-
| `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'`
|
|
65
|
-
| `hasError` | `boolean`
|
|
66
|
-
| `isReadOnly` | `boolean`
|
|
67
|
-
| `hasWarning` | `boolean`
|
|
68
|
-
| `iconLeft` | `ReactNode`
|
|
69
|
-
| `aria-label` | `ReactSelectProps['aria-label']`
|
|
70
|
-
| `aria-labelledby` | `ReactSelectProps['aria-labelledby']`
|
|
71
|
-
| `aria-invalid` | `ReactSelectProps['aria-invalid']`
|
|
72
|
-
| `aria-errormessage` | `ReactSelectProps['aria-errormessage']`
|
|
73
|
-
| `isAutofocussed` | `boolean`
|
|
74
|
-
| `backspaceRemovesValue` | `ReactSelectProps['backspaceRemovesValue']`
|
|
75
|
-
| `components` | `ReactSelectProps['components']`
|
|
76
|
-
| `controlShouldRenderValue` | `ReactSelectProps['controlShouldRenderValue']`
|
|
77
|
-
| `filterOption` | `ReactSelectProps['filterOption']`
|
|
78
|
-
| `id` | `ReactSelectProps['inputId']`
|
|
79
|
-
| `inputValue` | `ReactSelectProps['inputValue']`
|
|
80
|
-
| `containerId` | `ReactSelectProps['id']`
|
|
81
|
-
| `isClearable` | `ReactSelectProps['isClearable']`
|
|
82
|
-
| `isDisabled` | `ReactSelectProps['isDisabled']`
|
|
83
|
-
| `isOptionDisabled` | `ReactSelectProps['isOptionDisabled']`
|
|
84
|
-
| `isMulti` | `ReactSelectProps['isMulti']`
|
|
85
|
-
| `isSearchable` | `ReactSelectProps['isSearchable']`
|
|
86
|
-
| `menuIsOpen` | `ReactSelectProps['menuIsOpen']`
|
|
87
|
-
| `maxMenuHeight` | `ReactSelectProps['maxMenuHeight']`
|
|
88
|
-
| `menuPortalTarget` | `ReactSelectProps['menuPortalTarget']`
|
|
89
|
-
| `menuPortalZIndex` | `number`
|
|
90
|
-
| `menuShouldBlockScroll` | `ReactSelectProps['menuShouldBlockScroll']`
|
|
91
|
-
| `closeMenuOnSelect` | `ReactSelectProps['closeMenuOnSelect']`
|
|
92
|
-
| `name` | `ReactSelectProps['name']`
|
|
93
|
-
| `noOptionsMessage` | `ReactSelectProps['noOptionsMessage']`
|
|
94
|
-
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur)
|
|
95
|
-
| `onChange` | `Function`<br/>[See signature.](#signature-onChange)
|
|
96
|
-
| `onFocus` | `ReactSelectProps['onFocus']`
|
|
97
|
-
| `onInputChange` | `ReactSelectProps['onInputChange']`
|
|
98
|
-
| `options` | `union`<br/>Possible values:<br/>`TOption[] , TOptionObject[]`
|
|
99
|
-
| `showOptionGroupDivider` | `boolean`
|
|
100
|
-
| `placeholder` | `ReactSelectProps['placeholder']`
|
|
101
|
-
| `tabIndex` | `ReactSelectProps['tabIndex']`
|
|
102
|
-
| `tabSelectsValue` | `ReactSelectProps['tabSelectsValue']`
|
|
103
|
-
| `value` | `ReactSelectProps['value']`
|
|
61
|
+
| Props | Type | Required | Default | Description |
|
|
62
|
+
| -------------------------- | -------------------------------------------------------------------------------------------------------- | :------: | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `appearance` | `union`<br/>Possible values:<br/>`'default' , 'quiet'` | | `'default'` | Indicates the appearance of the input.
Quiet appearance is meant to be used with the `horizontalConstraint="auto"`. |
|
|
64
|
+
| `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | | |
|
|
65
|
+
| `hasError` | `boolean` | | | Indicates that input has errors |
|
|
66
|
+
| `isReadOnly` | `boolean` | | | Is the select read-only |
|
|
67
|
+
| `hasWarning` | `boolean` | | | Control to indicate on the input if there are selected values that are potentially invalid |
|
|
68
|
+
| `iconLeft` | `ReactNode` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled. |
|
|
69
|
+
| `aria-label` | `ReactSelectProps['aria-label']` | | | Aria label (for assistive tech)
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
70
|
+
| `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) |
|
|
71
|
+
| `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) |
|
|
72
|
+
| `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) |
|
|
73
|
+
| `isAutofocussed` | `boolean` | | | Focus the control when it is mounted |
|
|
74
|
+
| `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) |
|
|
75
|
+
| `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) |
|
|
76
|
+
| `controlShouldRenderValue` | `ReactSelectProps['controlShouldRenderValue']` | | | Control whether the selected values should be rendered in the control
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
77
|
+
| `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) |
|
|
78
|
+
| `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) |
|
|
79
|
+
| `inputValue` | `ReactSelectProps['inputValue']` | | | The value of the search input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
80
|
+
| `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) |
|
|
81
|
+
| `isClearable` | `ReactSelectProps['isClearable']` | | | Is the select value clearable
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
82
|
+
| `isDisabled` | `ReactSelectProps['isDisabled']` | | | Is the select disabled
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
83
|
+
| `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) |
|
|
84
|
+
| `isMulti` | `ReactSelectProps['isMulti']` | | | Support multiple selected options
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
85
|
+
| `isSearchable` | `ReactSelectProps['isSearchable']` | | | Whether to enable search functionality
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
86
|
+
| `menuIsOpen` | `ReactSelectProps['menuIsOpen']` | | | Can be used to enforce the select input to be opened
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
87
|
+
| `maxMenuHeight` | `ReactSelectProps['maxMenuHeight']` | | `220` | Maximum height of the menu before scrolling
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
88
|
+
| `menuPortalTarget` | `ReactSelectProps['menuPortalTarget']` | | | Dom element to portal the select menu to
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
89
|
+
| `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal
<br>
Use in conjunction with `menuPortalTarget` |
|
|
90
|
+
| `menuShouldBlockScroll` | `ReactSelectProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
91
|
+
| `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) |
|
|
92
|
+
| `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) |
|
|
93
|
+
| `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) |
|
|
94
|
+
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
|
|
95
|
+
| `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. |
|
|
96
|
+
| `onFocus` | `ReactSelectProps['onFocus']` | | | Handle focus events on the control
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
97
|
+
| `onInputChange` | `ReactSelectProps['onInputChange']` | | | Handle change events on the input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
98
|
+
| `options` | `union`<br/>Possible values:<br/>`TOption[] , TOptionObject[]` | | `[]` | Array of options that populate the select menu |
|
|
99
|
+
| `showOptionGroupDivider` | `boolean` | | | |
|
|
100
|
+
| `placeholder` | `ReactSelectProps['placeholder']` | | | Placeholder text for the select value
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
101
|
+
| `tabIndex` | `ReactSelectProps['tabIndex']` | | | Sets the tabIndex attribute on the input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
102
|
+
| `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) |
|
|
103
|
+
| `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) |
|
|
104
|
+
| `minMenuWidth` | `union`<br/>Possible values:<br/>`, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | | The min width (a range of values from the horizontalConrtaint set of values) for which the select-input menu
is allowed to shrink. If unset, the menu will shrink to a default value. |
|
|
105
|
+
| `maxMenuWidth` | `union`<br/>Possible values:<br/>`, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | | The max width (a range of values from the horizontalConrtaint set of values) for which the select-input menu
is allowed to grow. If unset, the menu will grow horrizontally to fill its parent. |
|
|
104
106
|
|
|
105
107
|
## Signatures
|
|
106
108
|
|
|
@@ -112,7 +112,9 @@ const SelectInput = props => {
|
|
|
112
112
|
isMulti: props.isMulti,
|
|
113
113
|
hasValue: !isEmpty__default["default"](selectedOptions),
|
|
114
114
|
controlShouldRenderValue: props.controlShouldRenderValue,
|
|
115
|
-
horizontalConstraint: props.horizontalConstraint
|
|
115
|
+
horizontalConstraint: props.horizontalConstraint,
|
|
116
|
+
minMenuWidth: props.minMenuWidth,
|
|
117
|
+
maxMenuWidth: props.maxMenuWidth
|
|
116
118
|
}),
|
|
117
119
|
filterOption: props.filterOption
|
|
118
120
|
// react-select uses "id" (for the container) and "inputId" (for the input),
|
|
@@ -216,7 +218,9 @@ SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
216
218
|
label: _pt__default["default"].node
|
|
217
219
|
})).isRequired
|
|
218
220
|
}))]).isRequired,
|
|
219
|
-
showOptionGroupDivider: _pt__default["default"].bool
|
|
221
|
+
showOptionGroupDivider: _pt__default["default"].bool,
|
|
222
|
+
minMenuWidth: _pt__default["default"].oneOf([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
223
|
+
maxMenuWidth: _pt__default["default"].oneOf([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
|
|
220
224
|
} : {};
|
|
221
225
|
SelectInput.displayName = 'SelectInput';
|
|
222
226
|
SelectInput.defaultProps = defaultProps;
|
|
@@ -260,7 +264,7 @@ SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
|
260
264
|
var SelectInput$1 = SelectInput;
|
|
261
265
|
|
|
262
266
|
// NOTE: This string will be replaced on build time with the package version.
|
|
263
|
-
var version = "
|
|
267
|
+
var version = "17.0.0";
|
|
264
268
|
|
|
265
269
|
exports["default"] = SelectInput$1;
|
|
266
270
|
exports.version = version;
|
|
@@ -111,7 +111,9 @@ const SelectInput = props => {
|
|
|
111
111
|
isMulti: props.isMulti,
|
|
112
112
|
hasValue: !isEmpty__default["default"](selectedOptions),
|
|
113
113
|
controlShouldRenderValue: props.controlShouldRenderValue,
|
|
114
|
-
horizontalConstraint: props.horizontalConstraint
|
|
114
|
+
horizontalConstraint: props.horizontalConstraint,
|
|
115
|
+
minMenuWidth: props.minMenuWidth,
|
|
116
|
+
maxMenuWidth: props.maxMenuWidth
|
|
115
117
|
}),
|
|
116
118
|
filterOption: props.filterOption
|
|
117
119
|
// react-select uses "id" (for the container) and "inputId" (for the input),
|
|
@@ -238,7 +240,7 @@ SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
|
238
240
|
var SelectInput$1 = SelectInput;
|
|
239
241
|
|
|
240
242
|
// NOTE: This string will be replaced on build time with the package version.
|
|
241
|
-
var version = "
|
|
243
|
+
var version = "17.0.0";
|
|
242
244
|
|
|
243
245
|
exports["default"] = SelectInput$1;
|
|
244
246
|
exports.version = version;
|
|
@@ -89,7 +89,9 @@ const SelectInput = props => {
|
|
|
89
89
|
isMulti: props.isMulti,
|
|
90
90
|
hasValue: !isEmpty(selectedOptions),
|
|
91
91
|
controlShouldRenderValue: props.controlShouldRenderValue,
|
|
92
|
-
horizontalConstraint: props.horizontalConstraint
|
|
92
|
+
horizontalConstraint: props.horizontalConstraint,
|
|
93
|
+
minMenuWidth: props.minMenuWidth,
|
|
94
|
+
maxMenuWidth: props.maxMenuWidth
|
|
93
95
|
}),
|
|
94
96
|
filterOption: props.filterOption
|
|
95
97
|
// react-select uses "id" (for the container) and "inputId" (for the input),
|
|
@@ -193,7 +195,9 @@ SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
193
195
|
label: _pt.node
|
|
194
196
|
})).isRequired
|
|
195
197
|
}))]).isRequired,
|
|
196
|
-
showOptionGroupDivider: _pt.bool
|
|
198
|
+
showOptionGroupDivider: _pt.bool,
|
|
199
|
+
minMenuWidth: _pt.oneOf([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
200
|
+
maxMenuWidth: _pt.oneOf([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
|
|
197
201
|
} : {};
|
|
198
202
|
SelectInput.displayName = 'SelectInput';
|
|
199
203
|
SelectInput.defaultProps = defaultProps;
|
|
@@ -237,6 +241,6 @@ SelectInput.ValueContainer = components.ValueContainer;
|
|
|
237
241
|
var SelectInput$1 = SelectInput;
|
|
238
242
|
|
|
239
243
|
// NOTE: This string will be replaced on build time with the package version.
|
|
240
|
-
var version = "
|
|
244
|
+
var version = "17.0.0";
|
|
241
245
|
|
|
242
246
|
export { SelectInput$1 as default, version };
|
|
@@ -58,6 +58,8 @@ export type TSelectInputProps = {
|
|
|
58
58
|
tabIndex?: ReactSelectProps['tabIndex'];
|
|
59
59
|
tabSelectsValue?: ReactSelectProps['tabSelectsValue'];
|
|
60
60
|
value?: ReactSelectProps['value'];
|
|
61
|
+
minMenuWidth?: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
62
|
+
maxMenuWidth?: 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
61
63
|
};
|
|
62
64
|
declare const SelectInput: {
|
|
63
65
|
(props: TSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
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": "
|
|
4
|
+
"version": "17.0.0",
|
|
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.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "
|
|
25
|
-
"@commercetools-uikit/design-system": "
|
|
26
|
-
"@commercetools-uikit/icons": "
|
|
27
|
-
"@commercetools-uikit/select-utils": "
|
|
28
|
-
"@commercetools-uikit/utils": "
|
|
24
|
+
"@commercetools-uikit/constraints": "17.0.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "17.0.0",
|
|
26
|
+
"@commercetools-uikit/icons": "17.0.0",
|
|
27
|
+
"@commercetools-uikit/select-utils": "17.0.0",
|
|
28
|
+
"@commercetools-uikit/utils": "17.0.0",
|
|
29
29
|
"@emotion/is-prop-valid": "1.2.1",
|
|
30
30
|
"@emotion/react": "^11.10.5",
|
|
31
31
|
"@emotion/styled": "^11.10.5",
|