@commercetools-uikit/select-input 16.10.0 → 16.11.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
|
@@ -20,11 +20,11 @@ npm --save install @commercetools-uikit/select-input
|
|
|
20
20
|
Additionally install the peer dependencies (if not present)
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
yarn add react react-intl
|
|
23
|
+
yarn add react react-dom react-intl
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
```
|
|
27
|
-
npm --save install react react-intl
|
|
27
|
+
npm --save install react react-dom react-intl
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
@@ -58,47 +58,49 @@ export default Example;
|
|
|
58
58
|
|
|
59
59
|
## Properties
|
|
60
60
|
|
|
61
|
-
| Props | Type | Required | Default
|
|
62
|
-
| -------------------------- | ----------------------------------------------------------------------------------------------------- | :------: |
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `aria-
|
|
70
|
-
| `aria-
|
|
71
|
-
| `aria-
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
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) |
|
|
102
104
|
|
|
103
105
|
## Signatures
|
|
104
106
|
|
|
@@ -51,6 +51,7 @@ const customizedComponents = {
|
|
|
51
51
|
MultiValueRemove: selectUtils.TagRemove
|
|
52
52
|
};
|
|
53
53
|
const defaultProps = {
|
|
54
|
+
appearance: 'default',
|
|
54
55
|
maxMenuHeight: 220,
|
|
55
56
|
menuPortalZIndex: 1,
|
|
56
57
|
options: []
|
|
@@ -98,12 +99,13 @@ const SelectInput = props => {
|
|
|
98
99
|
readOnly: true
|
|
99
100
|
}))
|
|
100
101
|
} : {}), props.components),
|
|
101
|
-
menuIsOpen: props.isReadOnly ? false :
|
|
102
|
+
menuIsOpen: props.isReadOnly ? false : props.menuIsOpen,
|
|
102
103
|
styles: selectUtils.createSelectStyles({
|
|
103
104
|
hasWarning: props.hasWarning,
|
|
104
105
|
hasError: props.hasError,
|
|
105
106
|
showOptionGroupDivider: props.showOptionGroupDivider,
|
|
106
107
|
menuPortalZIndex: props.menuPortalZIndex,
|
|
108
|
+
appearance: props.appearance,
|
|
107
109
|
isDisabled: props.isDisabled,
|
|
108
110
|
isReadOnly: props.isReadOnly,
|
|
109
111
|
iconLeft: props.iconLeft,
|
|
@@ -195,6 +197,7 @@ const SelectInput = props => {
|
|
|
195
197
|
});
|
|
196
198
|
};
|
|
197
199
|
SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
200
|
+
appearance: _pt__default["default"].oneOf(['default', 'quiet']),
|
|
198
201
|
horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
199
202
|
hasError: _pt__default["default"].bool,
|
|
200
203
|
isReadOnly: _pt__default["default"].bool,
|
|
@@ -257,7 +260,7 @@ SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
|
257
260
|
var SelectInput$1 = SelectInput;
|
|
258
261
|
|
|
259
262
|
// NOTE: This string will be replaced on build time with the package version.
|
|
260
|
-
var version = "16.
|
|
263
|
+
var version = "16.11.0";
|
|
261
264
|
|
|
262
265
|
exports["default"] = SelectInput$1;
|
|
263
266
|
exports.version = version;
|
|
@@ -50,6 +50,7 @@ const customizedComponents = {
|
|
|
50
50
|
MultiValueRemove: selectUtils.TagRemove
|
|
51
51
|
};
|
|
52
52
|
const defaultProps = {
|
|
53
|
+
appearance: 'default',
|
|
53
54
|
maxMenuHeight: 220,
|
|
54
55
|
menuPortalZIndex: 1,
|
|
55
56
|
options: []
|
|
@@ -97,12 +98,13 @@ const SelectInput = props => {
|
|
|
97
98
|
readOnly: true
|
|
98
99
|
}))
|
|
99
100
|
} : {}), props.components),
|
|
100
|
-
menuIsOpen: props.isReadOnly ? false :
|
|
101
|
+
menuIsOpen: props.isReadOnly ? false : props.menuIsOpen,
|
|
101
102
|
styles: selectUtils.createSelectStyles({
|
|
102
103
|
hasWarning: props.hasWarning,
|
|
103
104
|
hasError: props.hasError,
|
|
104
105
|
showOptionGroupDivider: props.showOptionGroupDivider,
|
|
105
106
|
menuPortalZIndex: props.menuPortalZIndex,
|
|
107
|
+
appearance: props.appearance,
|
|
106
108
|
isDisabled: props.isDisabled,
|
|
107
109
|
isReadOnly: props.isReadOnly,
|
|
108
110
|
iconLeft: props.iconLeft,
|
|
@@ -236,7 +238,7 @@ SelectInput.ValueContainer = Select.components.ValueContainer;
|
|
|
236
238
|
var SelectInput$1 = SelectInput;
|
|
237
239
|
|
|
238
240
|
// NOTE: This string will be replaced on build time with the package version.
|
|
239
|
-
var version = "16.
|
|
241
|
+
var version = "16.11.0";
|
|
240
242
|
|
|
241
243
|
exports["default"] = SelectInput$1;
|
|
242
244
|
exports.version = version;
|
|
@@ -28,6 +28,7 @@ const customizedComponents = {
|
|
|
28
28
|
MultiValueRemove: TagRemove
|
|
29
29
|
};
|
|
30
30
|
const defaultProps = {
|
|
31
|
+
appearance: 'default',
|
|
31
32
|
maxMenuHeight: 220,
|
|
32
33
|
menuPortalZIndex: 1,
|
|
33
34
|
options: []
|
|
@@ -75,12 +76,13 @@ const SelectInput = props => {
|
|
|
75
76
|
readOnly: true
|
|
76
77
|
}))
|
|
77
78
|
} : {}), props.components),
|
|
78
|
-
menuIsOpen: props.isReadOnly ? false :
|
|
79
|
+
menuIsOpen: props.isReadOnly ? false : props.menuIsOpen,
|
|
79
80
|
styles: createSelectStyles({
|
|
80
81
|
hasWarning: props.hasWarning,
|
|
81
82
|
hasError: props.hasError,
|
|
82
83
|
showOptionGroupDivider: props.showOptionGroupDivider,
|
|
83
84
|
menuPortalZIndex: props.menuPortalZIndex,
|
|
85
|
+
appearance: props.appearance,
|
|
84
86
|
isDisabled: props.isDisabled,
|
|
85
87
|
isReadOnly: props.isReadOnly,
|
|
86
88
|
iconLeft: props.iconLeft,
|
|
@@ -172,6 +174,7 @@ const SelectInput = props => {
|
|
|
172
174
|
});
|
|
173
175
|
};
|
|
174
176
|
SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
177
|
+
appearance: _pt.oneOf(['default', 'quiet']),
|
|
175
178
|
horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
176
179
|
hasError: _pt.bool,
|
|
177
180
|
isReadOnly: _pt.bool,
|
|
@@ -234,6 +237,6 @@ SelectInput.ValueContainer = components.ValueContainer;
|
|
|
234
237
|
var SelectInput$1 = SelectInput;
|
|
235
238
|
|
|
236
239
|
// NOTE: This string will be replaced on build time with the package version.
|
|
237
|
-
var version = "16.
|
|
240
|
+
var version = "16.11.0";
|
|
238
241
|
|
|
239
242
|
export { SelectInput$1 as default, version };
|
|
@@ -17,6 +17,7 @@ export type TCustomEvent = {
|
|
|
17
17
|
persist: () => void;
|
|
18
18
|
};
|
|
19
19
|
export type TSelectInputProps = {
|
|
20
|
+
appearance?: 'default' | 'quiet';
|
|
20
21
|
horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
21
22
|
hasError?: boolean;
|
|
22
23
|
isReadOnly?: boolean;
|
|
@@ -39,6 +40,7 @@ export type TSelectInputProps = {
|
|
|
39
40
|
isOptionDisabled?: ReactSelectProps['isOptionDisabled'];
|
|
40
41
|
isMulti?: ReactSelectProps['isMulti'];
|
|
41
42
|
isSearchable?: ReactSelectProps['isSearchable'];
|
|
43
|
+
menuIsOpen?: ReactSelectProps['menuIsOpen'];
|
|
42
44
|
maxMenuHeight?: ReactSelectProps['maxMenuHeight'];
|
|
43
45
|
menuPortalTarget?: ReactSelectProps['menuPortalTarget'];
|
|
44
46
|
menuPortalZIndex?: number;
|
|
@@ -60,7 +62,7 @@ export type TSelectInputProps = {
|
|
|
60
62
|
declare const SelectInput: {
|
|
61
63
|
(props: TSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
62
64
|
displayName: string;
|
|
63
|
-
defaultProps: Pick<TSelectInputProps, "maxMenuHeight" | "options" | "menuPortalZIndex">;
|
|
65
|
+
defaultProps: Pick<TSelectInputProps, "appearance" | "maxMenuHeight" | "options" | "menuPortalZIndex">;
|
|
64
66
|
isTouched(touched: boolean | unknown[]): boolean;
|
|
65
67
|
ClearIndicator: {
|
|
66
68
|
(props: import("@commercetools-uikit/select-utils").TClearIndicatorProps): 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": "16.
|
|
4
|
+
"version": "16.11.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": "16.
|
|
25
|
-
"@commercetools-uikit/design-system": "16.
|
|
26
|
-
"@commercetools-uikit/icons": "16.
|
|
27
|
-
"@commercetools-uikit/select-utils": "16.
|
|
28
|
-
"@commercetools-uikit/utils": "16.
|
|
24
|
+
"@commercetools-uikit/constraints": "16.11.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "16.11.0",
|
|
26
|
+
"@commercetools-uikit/icons": "16.11.0",
|
|
27
|
+
"@commercetools-uikit/select-utils": "16.11.0",
|
|
28
|
+
"@commercetools-uikit/utils": "16.11.0",
|
|
29
29
|
"@emotion/is-prop-valid": "1.2.1",
|
|
30
30
|
"@emotion/react": "^11.10.5",
|
|
31
31
|
"@emotion/styled": "^11.10.5",
|