@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 | Required | Default | Description |
62
- | -------------------------- | ----------------------------------------------------------------------------------------------------- | :------: | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
63
- | `appearance` | `union`<br/>Possible values:<br/>`'default' , 'quiet'` | | `'default'` | Indicates the appearance of the input.&#xA;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)&#xA;<br>&#xA;[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)&#xA;<br>&#xA;[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.&#xA;<br>&#xA;[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.&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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.&#xA;This forwarded as react-select's "inputId"&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
79
- | `inputValue` | `ReactSelectProps['inputValue']` | | | The value of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
80
- | `containerId` | `ReactSelectProps['id']` | | | The id to set on the SelectContainer component&#xA;This is forwarded as react-select's "id"&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
81
- | `isClearable` | `ReactSelectProps['isClearable']` | | | Is the select value clearable&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
82
- | `isDisabled` | `ReactSelectProps['isDisabled']` | | | Is the select disabled&#xA;<br>&#xA;[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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
84
- | `isMulti` | `ReactSelectProps['isMulti']` | | | Support multiple selected options&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
85
- | `isSearchable` | `ReactSelectProps['isSearchable']` | | | Whether to enable search functionality&#xA;<br>&#xA;[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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
87
- | `maxMenuHeight` | `ReactSelectProps['maxMenuHeight']` | | `220` | Maximum height of the menu before scrolling&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
88
- | `menuPortalTarget` | `ReactSelectProps['menuPortalTarget']` | | | Dom element to portal the select menu to&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
89
- | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal&#xA;<br>&#xA;Use in conjunction with `menuPortalTarget` |
90
- | `menuShouldBlockScroll` | `ReactSelectProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open&#xA;<br>&#xA;[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`.&#xA;<br>&#xA;[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)&#xA;<br>&#xA;[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 }.&#xA;<br />&#xA;`inputValue` will be an empty string when no search text is present.&#xA;<br>&#xA;[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.&#xA;<br/>&#xA;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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
97
- | `onInputChange` | `ReactSelectProps['onInputChange']` | | | Handle change events on the input&#xA;<br>&#xA;[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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
101
- | `tabIndex` | `ReactSelectProps['tabIndex']` | | | Sets the tabIndex attribute on the input&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
61
+ | Props | Type | Required | Default | Description |
62
+ | -------------------------- | -------------------------------------------------------------------------------------------------------- | :------: | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
63
+ | `appearance` | `union`<br/>Possible values:<br/>`'default' , 'quiet'` | | `'default'` | Indicates the appearance of the input.&#xA;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)&#xA;<br>&#xA;[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)&#xA;<br>&#xA;[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.&#xA;<br>&#xA;[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.&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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.&#xA;This forwarded as react-select's "inputId"&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
79
+ | `inputValue` | `ReactSelectProps['inputValue']` | | | The value of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
80
+ | `containerId` | `ReactSelectProps['id']` | | | The id to set on the SelectContainer component&#xA;This is forwarded as react-select's "id"&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
81
+ | `isClearable` | `ReactSelectProps['isClearable']` | | | Is the select value clearable&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
82
+ | `isDisabled` | `ReactSelectProps['isDisabled']` | | | Is the select disabled&#xA;<br>&#xA;[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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
84
+ | `isMulti` | `ReactSelectProps['isMulti']` | | | Support multiple selected options&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
85
+ | `isSearchable` | `ReactSelectProps['isSearchable']` | | | Whether to enable search functionality&#xA;<br>&#xA;[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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
87
+ | `maxMenuHeight` | `ReactSelectProps['maxMenuHeight']` | | `220` | Maximum height of the menu before scrolling&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
88
+ | `menuPortalTarget` | `ReactSelectProps['menuPortalTarget']` | | | Dom element to portal the select menu to&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
89
+ | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal&#xA;<br>&#xA;Use in conjunction with `menuPortalTarget` |
90
+ | `menuShouldBlockScroll` | `ReactSelectProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open&#xA;<br>&#xA;[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`.&#xA;<br>&#xA;[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)&#xA;<br>&#xA;[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 }.&#xA;<br />&#xA;`inputValue` will be an empty string when no search text is present.&#xA;<br>&#xA;[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.&#xA;<br/>&#xA;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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
97
+ | `onInputChange` | `ReactSelectProps['onInputChange']` | | | Handle change events on the input&#xA;<br>&#xA;[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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
101
+ | `tabIndex` | `ReactSelectProps['tabIndex']` | | | Sets the tabIndex attribute on the input&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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&#xA;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&#xA;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 = "16.12.1";
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 = "16.12.1";
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 = "16.12.1";
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": "16.12.1",
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": "16.12.1",
25
- "@commercetools-uikit/design-system": "16.12.1",
26
- "@commercetools-uikit/icons": "16.12.1",
27
- "@commercetools-uikit/select-utils": "16.12.1",
28
- "@commercetools-uikit/utils": "16.12.1",
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",