@commercetools-uikit/async-select-input 12.2.9 → 13.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,48 +58,61 @@ export default Example;
58
58
 
59
59
  ## Properties
60
60
 
61
- | Props | Type | Required | Default | Description |
62
- | --------------------------------- | -------------------------------------------------------------------------------------------------- | :------: | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
63
- | `horizontalConstraint` | `enum`<br/>Possible values:<br/>`3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | | Horizontal size limit of the input fields. |
64
- | `hasError` | `bool` | | | Indicates the input field has an error |
65
- | `hasWarning` | `bool` | | | Indicates the input field has a warning |
66
- | `isReadOnly` | `bool` | | | Indicates that the field is displaying read-only content |
67
- | `aria-label` | `string` | | | Aria label (for assistive tech) |
68
- | `aria-labelledby` | `string` | | | HTML ID of an element that should be used as the label (for assistive tech) |
69
- | `isAutofocussed` | `bool` | | | Focus the control when it is mounted |
70
- | `backspaceRemovesValue` | `bool` | | | Remove the currently focused option when the user presses backspace |
71
- | `components` | `objectOf(func)` | | | Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components) |
72
- | `filterOption` | `func` | | | Custom method to filter whether an option should be displayed in the menu |
73
- | `id` | `string` | | | The id of the search input |
74
- | `inputValue` | `string` | | | |
75
- | `containerId` | `string` | | | The id to set on the SelectContainer component |
76
- | `isClearable` | `bool` | | | Is the select value clearable |
77
- | `isDisabled` | `bool` | | | Is the select disabled |
78
- | `isOptionDisabled` | `func` | | | Override the built-in logic to detect whether an option is disabled |
79
- | `isMulti` | `bool` | | | Support multiple selected options |
80
- | `isSearchable` | `bool` | | `true` | Whether to enable search functionality |
81
- | `maxMenuHeight` | `number` | | | Maximum height of the menu before scrolling |
82
- | `menuPortalTarget` | `SafeHTMLElement` | | | Dom element to portal the select menu to |
83
- | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
84
- | `menuShouldBlockScroll` | `bool` | | | whether the menu should block scroll while open |
85
- | `name` | `string` | | | Name of the HTML Input (optional - without this, no input will be rendered) |
86
- | `noOptionsMessage` | `func` | | | 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 }`. `inputValue` will be an empty string when no search text is present. |
87
- | `onBlur` | `func` | | | Handle blur events on the control |
88
- | `onChange` | `func` || | 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. The value will be the selected option, or an array of options in case `isMulti` is `true`. |
89
- | `onFocus` | `func` | | | Handle focus events on the control |
90
- | `onInputChange` | `func` | | | Handle change events on the input |
91
- | `placeholder` | `string` | | | Placeholder text for the select value |
92
- | `loadingMessage` | `<string, func>` | | | loading message shown while the options are being loaded |
93
- | `tabIndex` | `string` | | | Sets the tabIndex attribute on the input |
94
- | `tabSelectsValue` | `bool` | | | Select the currently focused option when the user presses tab |
95
- | `value` | `custom` | | `null` | The value of the select; reflected by the selected option |
96
- | `defaultOptions` | `<bool, arrayOf>` | | | The default set of options to show before the user starts searching. When set to true, the results for loadOptions('') will be autoloaded. |
97
- | `defaultOptions<arrayOf>` | `array` | | | |
98
- | `defaultOptions<arrayOf>[].value` | `string` | ✅ | | |
99
- | `loadOptions` | `func` || | Function that returns a promise, which is the set of options to be used once the promise resolves. |
100
- | `cacheOptions` | `any` | | | If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value. |
101
- | `showOptionGroupDivider` | `bool` | | | Determines if option groups will be separated by a divider |
102
- | `iconLeft` | `node` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when `isMulti` is enabled. |
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'` | | | Horizontal size limit of the input fields. |
64
+ | `hasError` | `boolean` | | | Indicates the input field has an error |
65
+ | `hasWarning` | `boolean` | | | Indicates the input field has a warning |
66
+ | `isReadOnly` | `boolean` | | | Indicates that the field is displaying read-only content |
67
+ | `aria-label` | `AsyncProps['aria-label']` | | | Aria label (for assistive tech)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
68
+ | `aria-labelledby` | `AsyncProps['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) |
69
+ | `isAutofocussed` | `boolean` | | | Focus the control when it is mounted |
70
+ | `backspaceRemovesValue` | `AsyncProps['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) |
71
+ | `components` | `AsyncProps['components']` | | | Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
72
+ | `filterOption` | `AsyncProps['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) |
73
+ | `id` | `AsyncProps['inputId']` | | | The id of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
74
+ | `inputValue` | `AsyncProps['inputValue']` | | | The value of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
75
+ | `containerId` | `AsyncProps['id']` | | | The id to set on the SelectContainer component&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
76
+ | `isClearable` | `AsyncProps['isClearable']` | | | Is the select value clearable&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
77
+ | `isDisabled` | `AsyncProps['isDisabled']` | | | Is the select disabled&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
78
+ | `isOptionDisabled` | `AsyncProps['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) |
79
+ | `isMulti` | `AsyncProps['isMulti']` | | | Support multiple selected options&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
80
+ | `isSearchable` | `AsyncProps['isSearchable']` | | `true` | Whether to enable search functionality&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
81
+ | `maxMenuHeight` | `AsyncProps['maxMenuHeight']` | | | Maximum height of the menu before scrolling&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
82
+ | `menuPortalTarget` | `AsyncProps['menuPortalTarget']` | | | Dom element to portal the select menu to&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
83
+ | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
84
+ | `menuShouldBlockScroll` | `AsyncProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
85
+ | `closeMenuOnSelect` | `AsyncProps['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) |
86
+ | `name` | `AsyncProps['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) |
87
+ | `noOptionsMessage` | `AsyncProps['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 }`. `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) |
88
+ | `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
89
+ | `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. The value will be the selected option, or an array of options in case `isMulti` is `true`. |
90
+ | `onFocus` | `AsyncProps['onFocus']` | | | Handle focus events on the control&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
91
+ | `onInputChange` | `AsyncProps['onInputChange']` | | | Handle change events on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
92
+ | `placeholder` | `AsyncProps['placeholder']` | | | Placeholder text for the select value&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
93
+ | `loadingMessage` | `union`<br/>Possible values:<br/>`string , (() => string)` | | | loading message shown while the options are being loaded |
94
+ | `tabIndex` | `AsyncProps['tabIndex']` | | | Sets the tabIndex attribute on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
95
+ | `tabSelectsValue` | `AsyncProps['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) |
96
+ | `value` | `AsyncProps['value']` | | `null` | The value of the select; reflected by the selected option&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
97
+ | `defaultOptions` | `union`<br/>Possible values:<br/>`OptionsOrGroups<unknown, GroupBase<unknown>> , boolean` | | | The default set of options to show before the user starts searching. When set to true, the results for loadOptions('') will be autoloaded.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
98
+ | `loadOptions` | `AsyncProps['loadOptions']` | ✅ | | Function that returns a promise, which is the set of options to be used once the promise resolves. |
99
+ | `cacheOptions` | `AsyncProps['cacheOptions']` | | | If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value. |
100
+ | `showOptionGroupDivider` | `boolean` | | | Determines if option groups will be separated by a divider |
101
+ | `iconLeft` | `ReactNode` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when `isMulti` is enabled. |
102
+
103
+ ## Signatures
104
+
105
+ ### Signature `onBlur`
106
+
107
+ ```ts
108
+ (event: TEvent) => void
109
+ ```
110
+
111
+ ### Signature `onChange`
112
+
113
+ ```ts
114
+ (event: TEvent, info: ActionMeta<unknown>) => void
115
+ ```
103
116
 
104
117
  This input is built on top of [`react-select`](https://github.com/JedWatson/react-select) v2.
105
118
  It supports mostly same properties as `react-select`. Behavior for some props was changed, and support for others was dropped.
@@ -0,0 +1,2 @@
1
+ export * from "./declarations/src/index";
2
+ export { default } from "./declarations/src/index";
@@ -11,8 +11,7 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
11
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
15
- var PropTypes = require('prop-types');
14
+ var _pt = require('prop-types');
16
15
  var reactIntl = require('react-intl');
17
16
  var isEmpty = require('lodash/isEmpty');
18
17
  var react = require('@emotion/react');
@@ -34,16 +33,15 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
34
33
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
35
34
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
36
35
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
37
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
38
- var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
36
+ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
39
37
  var isEmpty__default = /*#__PURE__*/_interopDefault(isEmpty);
40
38
  var AsyncSelect__default = /*#__PURE__*/_interopDefault(AsyncSelect);
41
39
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
42
40
  var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
43
41
 
44
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
42
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
45
43
 
46
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context4; _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
44
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
47
45
 
48
46
  var LoadingIndicator = function LoadingIndicator() {
49
47
  return jsxRuntime.jsx(LoadingSpinner__default["default"], {
@@ -58,6 +56,13 @@ var customizedComponents = {
58
56
  LoadingIndicator: LoadingIndicator,
59
57
  MultiValueRemove: selectUtils.TagRemove
60
58
  };
59
+ var defaultProps = {
60
+ // Using "null" will ensure that the currently selected value disappears in
61
+ // case "undefined" gets passed as the next value
62
+ value: null,
63
+ isSearchable: true,
64
+ menuPortalZIndex: 1
65
+ };
61
66
 
62
67
  var AsyncSelectInput = function AsyncSelectInput(props) {
63
68
  var theme = react.useTheme();
@@ -81,7 +86,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
81
86
  autoFocus: props.isAutofocussed,
82
87
  backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
83
88
  components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
84
- // eslint-disable-next-line react/display-name
85
89
  Input: function Input(ownProps) {
86
90
  return jsxRuntime.jsx(reactSelect.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
87
91
  readOnly: true
@@ -116,6 +120,7 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
116
120
  maxMenuHeight: props.maxMenuHeight,
117
121
  menuPortalTarget: props.menuPortalTarget,
118
122
  menuShouldBlockScroll: props.menuShouldBlockScroll,
123
+ closeMenuOnSelect: props.closeMenuOnSelect,
119
124
  name: props.name,
120
125
  loadingMessage: loadingMessage,
121
126
  noOptionsMessage: props.noOptionsMessage || function (_ref) {
@@ -137,10 +142,9 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
137
142
  return "".concat(props.name, ".0");
138
143
  }()
139
144
  },
140
- // eslint-disable-next-line @typescript-eslint/no-empty-function
141
145
  persist: function persist() {}
142
146
  };
143
- props.onBlur(event);
147
+ props.onBlur && props.onBlur(event);
144
148
  } : undefined,
145
149
  onChange: function onChange(value, info) {
146
150
  var newValue = value;
@@ -154,7 +158,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
154
158
  name: props.name,
155
159
  value: newValue
156
160
  },
157
- // eslint-disable-next-line @typescript-eslint/no-empty-function
158
161
  persist: function persist() {}
159
162
  }, info);
160
163
  },
@@ -167,7 +170,8 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
167
170
  ,
168
171
  defaultOptions: props.defaultOptions,
169
172
  loadOptions: props.loadOptions,
170
- cacheOptions: props.cacheOptions,
173
+ cacheOptions: props.cacheOptions // @ts-ignore
174
+ ,
171
175
  iconLeft: props.iconLeft
172
176
  })
173
177
  }))
@@ -178,238 +182,34 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
178
182
  // a signal of the field having been touched.
179
183
 
180
184
 
185
+ AsyncSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
186
+ horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
187
+ hasError: _pt__default["default"].bool,
188
+ hasWarning: _pt__default["default"].bool,
189
+ isReadOnly: _pt__default["default"].bool,
190
+ isAutofocussed: _pt__default["default"].bool,
191
+ menuPortalZIndex: _pt__default["default"].number.isRequired,
192
+ onBlur: _pt__default["default"].func,
193
+ onChange: _pt__default["default"].func.isRequired,
194
+ loadingMessage: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].func]),
195
+ defaultOptions: _pt__default["default"].oneOfType([_pt__default["default"].any, _pt__default["default"].bool]),
196
+ showOptionGroupDivider: _pt__default["default"].bool,
197
+ iconLeft: _pt__default["default"].node
198
+ } : {};
199
+
181
200
  AsyncSelectInput.isTouched = function (touched) {
182
201
  return Boolean(touched);
183
202
  };
184
203
 
185
204
  AsyncSelectInput.displayName = 'AsyncSelectInput';
186
- AsyncSelectInput.defaultProps = {
187
- // Using "null" will ensure that the currently selected value disappears in
188
- // case "undefined" gets passed as the next value
189
- value: null,
190
- isSearchable: true,
191
- menuPortalZIndex: 1
192
- };
193
- AsyncSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
194
- /**
195
- * Horizontal size limit of the input fields.
196
- */
197
- horizontalConstraint: PropTypes__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
198
-
199
- /**
200
- * Indicates the input field has an error
201
- */
202
- hasError: PropTypes__default["default"].bool,
203
-
204
- /**
205
- * Indicates the input field has a warning
206
- */
207
- hasWarning: PropTypes__default["default"].bool,
208
-
209
- /**
210
- * Indicates that the field is displaying read-only content
211
- */
212
- isReadOnly: PropTypes__default["default"].bool,
213
- // react-select base props
214
- //
215
- // Currently unsupported props are commented out. In case you need one of
216
- // these props when using UI Kit, you can submit a PR and enable the
217
- // prop. Don't forget to add it to the story, docs and other select input
218
- // components as well!
219
- //
220
- // See https://react-select.com/props#select-props
221
-
222
- /**
223
- * Aria label (for assistive tech)
224
- */
225
- 'aria-label': PropTypes__default["default"].string,
226
-
227
- /**
228
- * HTML ID of an element that should be used as the label (for assistive tech)
229
- */
230
- 'aria-labelledby': PropTypes__default["default"].string,
231
- // renamed autoFocus of react-select
232
-
233
- /**
234
- * Focus the control when it is mounted
235
- */
236
- isAutofocussed: PropTypes__default["default"].bool,
237
-
238
- /**
239
- * Remove the currently focused option when the user presses backspace
240
- */
241
- backspaceRemovesValue: PropTypes__default["default"].bool,
242
-
243
- /**
244
- * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
245
- */
246
- components: PropTypes__default["default"].objectOf(PropTypes__default["default"].func),
247
-
248
- /**
249
- * Custom method to filter whether an option should be displayed in the menu
250
- */
251
- filterOption: PropTypes__default["default"].func,
252
- // This forwarded as react-select's "inputId"
253
-
254
- /**
255
- * The id of the search input
256
- */
257
- id: PropTypes__default["default"].string,
258
- inputValue: PropTypes__default["default"].string,
259
- // This is forwarded as react-select's "id"
260
-
261
- /**
262
- * The id to set on the SelectContainer component
263
- */
264
- containerId: PropTypes__default["default"].string,
265
-
266
- /**
267
- * Is the select value clearable
268
- */
269
- isClearable: PropTypes__default["default"].bool,
270
-
271
- /**
272
- * Is the select disabled
273
- */
274
- isDisabled: PropTypes__default["default"].bool,
275
-
276
- /**
277
- * Override the built-in logic to detect whether an option is disabled
278
- */
279
- isOptionDisabled: PropTypes__default["default"].func,
280
-
281
- /**
282
- * Support multiple selected options
283
- */
284
- isMulti: PropTypes__default["default"].bool,
285
-
286
- /**
287
- * Whether to enable search functionality
288
- */
289
- isSearchable: PropTypes__default["default"].bool,
290
-
291
- /**
292
- * Maximum height of the menu before scrolling
293
- */
294
- maxMenuHeight: PropTypes__default["default"].number,
295
-
296
- /**
297
- * Dom element to portal the select menu to
298
- */
299
- menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
300
-
301
- /**
302
- * z-index value for the menu portal
303
- */
304
- menuPortalZIndex: PropTypes__default["default"].number.isRequired,
305
-
306
- /**
307
- * whether the menu should block scroll while open
308
- */
309
- menuShouldBlockScroll: PropTypes__default["default"].bool,
310
-
311
- /**
312
- * Name of the HTML Input (optional - without this, no input will be rendered)
313
- */
314
- name: PropTypes__default["default"].string,
315
-
316
- /**
317
- * 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 }`. `inputValue` will be an empty string when no search text is present.
318
- */
319
- noOptionsMessage: PropTypes__default["default"].func,
320
-
321
- /**
322
- * Handle blur events on the control
323
- */
324
- onBlur: PropTypes__default["default"].func,
325
-
326
- /**
327
- * 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. The value will be the selected option, or an array of options in case `isMulti` is `true`.
328
- */
329
- onChange: PropTypes__default["default"].func.isRequired,
330
-
331
- /**
332
- * Handle focus events on the control
333
- */
334
- onFocus: PropTypes__default["default"].func,
335
-
336
- /**
337
- * Handle change events on the input
338
- */
339
- onInputChange: PropTypes__default["default"].func,
340
-
341
- /**
342
- * Placeholder text for the select value
343
- */
344
- placeholder: PropTypes__default["default"].string,
345
-
346
- /**
347
- * loading message shown while the options are being loaded
348
- */
349
- loadingMessage: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
350
-
351
- /**
352
- * Sets the tabIndex attribute on the input
353
- */
354
- tabIndex: PropTypes__default["default"].string,
355
-
356
- /**
357
- * Select the currently focused option when the user presses tab
358
- */
359
- tabSelectsValue: PropTypes__default["default"].bool,
360
-
361
- /**
362
- * The value of the select; reflected by the selected option
363
- */
364
- value: function value(props) {
365
- var _context, _context2;
366
-
367
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
368
- rest[_key - 1] = arguments[_key];
369
- }
370
-
371
- return props.isMulti ? PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
372
- value: PropTypes__default["default"].string.isRequired
373
- })).apply(void 0, _concatInstanceProperty__default["default"](_context = [props]).call(_context, rest)) : PropTypes__default["default"].shape({
374
- value: PropTypes__default["default"].string.isRequired
375
- }).apply(void 0, _concatInstanceProperty__default["default"](_context2 = [props]).call(_context2, rest));
376
- },
377
- // Async props
378
-
379
- /**
380
- * The default set of options to show before the user starts searching. When set to true, the results for loadOptions('') will be autoloaded.
381
- */
382
- defaultOptions: PropTypes__default["default"].oneOfType([PropTypes__default["default"].bool, PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
383
- value: PropTypes__default["default"].string.isRequired
384
- }))]),
385
-
386
- /**
387
- * Function that returns a promise, which is the set of options to be used once the promise resolves.
388
- */
389
- loadOptions: PropTypes__default["default"].func.isRequired,
390
-
391
- /**
392
- * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
393
- */
394
- cacheOptions: PropTypes__default["default"].any,
395
-
396
- /**
397
- * Determines if option groups will be separated by a divider
398
- */
399
- showOptionGroupDivider: PropTypes__default["default"].bool,
400
-
401
- /**
402
- * Icon to display on the left of the placeholder text and selected value. Has no effect when `isMulti` is enabled.
403
- */
404
- iconLeft: PropTypes__default["default"].node
405
- } : {};
205
+ AsyncSelectInput.defaultProps = defaultProps;
406
206
  utils.addStaticFields(AsyncSelectInput, _objectSpread(_objectSpread(_objectSpread({}, reactSelect.components), customizedComponents), {}, {
407
207
  isTouched: AsyncSelectInput.isTouched
408
208
  }));
409
209
  var AsyncSelectInput$1 = AsyncSelectInput;
410
210
 
411
211
  // NOTE: This string will be replaced on build time with the package version.
412
- var version = "12.2.9";
212
+ var version = "13.0.0";
413
213
 
414
214
  exports["default"] = AsyncSelectInput$1;
415
215
  exports.version = version;
@@ -11,7 +11,6 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
11
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
- require('@babel/runtime-corejs3/core-js-stable/instance/concat');
15
14
  require('prop-types');
16
15
  var reactIntl = require('react-intl');
17
16
  var isEmpty = require('lodash/isEmpty');
@@ -39,9 +38,9 @@ var AsyncSelect__default = /*#__PURE__*/_interopDefault(AsyncSelect);
39
38
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
40
39
  var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
41
40
 
42
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
41
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
43
42
 
44
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context4; _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
43
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
45
44
 
46
45
  var LoadingIndicator = function LoadingIndicator() {
47
46
  return jsxRuntime.jsx(LoadingSpinner__default["default"], {
@@ -56,6 +55,13 @@ var customizedComponents = {
56
55
  LoadingIndicator: LoadingIndicator,
57
56
  MultiValueRemove: selectUtils.TagRemove
58
57
  };
58
+ var defaultProps = {
59
+ // Using "null" will ensure that the currently selected value disappears in
60
+ // case "undefined" gets passed as the next value
61
+ value: null,
62
+ isSearchable: true,
63
+ menuPortalZIndex: 1
64
+ };
59
65
 
60
66
  var AsyncSelectInput = function AsyncSelectInput(props) {
61
67
  var theme = react.useTheme();
@@ -79,7 +85,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
79
85
  autoFocus: props.isAutofocussed,
80
86
  backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
81
87
  components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
82
- // eslint-disable-next-line react/display-name
83
88
  Input: function Input(ownProps) {
84
89
  return jsxRuntime.jsx(reactSelect.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
85
90
  readOnly: true
@@ -114,6 +119,7 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
114
119
  maxMenuHeight: props.maxMenuHeight,
115
120
  menuPortalTarget: props.menuPortalTarget,
116
121
  menuShouldBlockScroll: props.menuShouldBlockScroll,
122
+ closeMenuOnSelect: props.closeMenuOnSelect,
117
123
  name: props.name,
118
124
  loadingMessage: loadingMessage,
119
125
  noOptionsMessage: props.noOptionsMessage || function (_ref) {
@@ -135,10 +141,9 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
135
141
  return "".concat(props.name, ".0");
136
142
  }()
137
143
  },
138
- // eslint-disable-next-line @typescript-eslint/no-empty-function
139
144
  persist: function persist() {}
140
145
  };
141
- props.onBlur(event);
146
+ props.onBlur && props.onBlur(event);
142
147
  } : undefined,
143
148
  onChange: function onChange(value, info) {
144
149
  var newValue = value;
@@ -152,7 +157,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
152
157
  name: props.name,
153
158
  value: newValue
154
159
  },
155
- // eslint-disable-next-line @typescript-eslint/no-empty-function
156
160
  persist: function persist() {}
157
161
  }, info);
158
162
  },
@@ -165,7 +169,8 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
165
169
  ,
166
170
  defaultOptions: props.defaultOptions,
167
171
  loadOptions: props.loadOptions,
168
- cacheOptions: props.cacheOptions,
172
+ cacheOptions: props.cacheOptions // @ts-ignore
173
+ ,
169
174
  iconLeft: props.iconLeft
170
175
  })
171
176
  }))
@@ -176,26 +181,21 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
176
181
  // a signal of the field having been touched.
177
182
 
178
183
 
184
+ AsyncSelectInput.propTypes = {};
185
+
179
186
  AsyncSelectInput.isTouched = function (touched) {
180
187
  return Boolean(touched);
181
188
  };
182
189
 
183
190
  AsyncSelectInput.displayName = 'AsyncSelectInput';
184
- AsyncSelectInput.defaultProps = {
185
- // Using "null" will ensure that the currently selected value disappears in
186
- // case "undefined" gets passed as the next value
187
- value: null,
188
- isSearchable: true,
189
- menuPortalZIndex: 1
190
- };
191
- AsyncSelectInput.propTypes = {};
191
+ AsyncSelectInput.defaultProps = defaultProps;
192
192
  utils.addStaticFields(AsyncSelectInput, _objectSpread(_objectSpread(_objectSpread({}, reactSelect.components), customizedComponents), {}, {
193
193
  isTouched: AsyncSelectInput.isTouched
194
194
  }));
195
195
  var AsyncSelectInput$1 = AsyncSelectInput;
196
196
 
197
197
  // NOTE: This string will be replaced on build time with the package version.
198
- var version = "12.2.9";
198
+ var version = "13.0.0";
199
199
 
200
200
  exports["default"] = AsyncSelectInput$1;
201
201
  exports.version = version;
@@ -7,22 +7,21 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
7
7
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
8
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
11
- import PropTypes from 'prop-types';
10
+ import _pt from 'prop-types';
12
11
  import { useIntl } from 'react-intl';
13
12
  import isEmpty from 'lodash/isEmpty';
14
13
  import { useTheme } from '@emotion/react';
15
14
  import { components } from 'react-select';
16
15
  import AsyncSelect from 'react-select/async';
17
- import { filterDataAttributes, SafeHTMLElement, addStaticFields } from '@commercetools-uikit/utils';
16
+ import { filterDataAttributes, addStaticFields } from '@commercetools-uikit/utils';
18
17
  import Constraints from '@commercetools-uikit/constraints';
19
18
  import LoadingSpinner from '@commercetools-uikit/loading-spinner';
20
19
  import { messages, customComponentsWithIcons, createSelectStyles, DropdownIndicator, ClearIndicator, TagRemove } from '@commercetools-uikit/select-utils';
21
20
  import { jsx } from '@emotion/react/jsx-runtime';
22
21
 
23
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
22
+ 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; }
24
23
 
25
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty(_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context4; _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
26
25
 
27
26
  var LoadingIndicator = function LoadingIndicator() {
28
27
  return jsx(LoadingSpinner, {
@@ -37,6 +36,13 @@ var customizedComponents = {
37
36
  LoadingIndicator: LoadingIndicator,
38
37
  MultiValueRemove: TagRemove
39
38
  };
39
+ var defaultProps = {
40
+ // Using "null" will ensure that the currently selected value disappears in
41
+ // case "undefined" gets passed as the next value
42
+ value: null,
43
+ isSearchable: true,
44
+ menuPortalZIndex: 1
45
+ };
40
46
 
41
47
  var AsyncSelectInput = function AsyncSelectInput(props) {
42
48
  var theme = useTheme();
@@ -60,7 +66,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
60
66
  autoFocus: props.isAutofocussed,
61
67
  backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
62
68
  components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? customComponentsWithIcons : {}), props.isReadOnly ? {
63
- // eslint-disable-next-line react/display-name
64
69
  Input: function Input(ownProps) {
65
70
  return jsx(components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
66
71
  readOnly: true
@@ -95,6 +100,7 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
95
100
  maxMenuHeight: props.maxMenuHeight,
96
101
  menuPortalTarget: props.menuPortalTarget,
97
102
  menuShouldBlockScroll: props.menuShouldBlockScroll,
103
+ closeMenuOnSelect: props.closeMenuOnSelect,
98
104
  name: props.name,
99
105
  loadingMessage: loadingMessage,
100
106
  noOptionsMessage: props.noOptionsMessage || function (_ref) {
@@ -116,10 +122,9 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
116
122
  return "".concat(props.name, ".0");
117
123
  }()
118
124
  },
119
- // eslint-disable-next-line @typescript-eslint/no-empty-function
120
125
  persist: function persist() {}
121
126
  };
122
- props.onBlur(event);
127
+ props.onBlur && props.onBlur(event);
123
128
  } : undefined,
124
129
  onChange: function onChange(value, info) {
125
130
  var newValue = value;
@@ -133,7 +138,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
133
138
  name: props.name,
134
139
  value: newValue
135
140
  },
136
- // eslint-disable-next-line @typescript-eslint/no-empty-function
137
141
  persist: function persist() {}
138
142
  }, info);
139
143
  },
@@ -146,7 +150,8 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
146
150
  ,
147
151
  defaultOptions: props.defaultOptions,
148
152
  loadOptions: props.loadOptions,
149
- cacheOptions: props.cacheOptions,
153
+ cacheOptions: props.cacheOptions // @ts-ignore
154
+ ,
150
155
  iconLeft: props.iconLeft
151
156
  })
152
157
  }))
@@ -157,237 +162,33 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
157
162
  // a signal of the field having been touched.
158
163
 
159
164
 
165
+ AsyncSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
166
+ horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
167
+ hasError: _pt.bool,
168
+ hasWarning: _pt.bool,
169
+ isReadOnly: _pt.bool,
170
+ isAutofocussed: _pt.bool,
171
+ menuPortalZIndex: _pt.number.isRequired,
172
+ onBlur: _pt.func,
173
+ onChange: _pt.func.isRequired,
174
+ loadingMessage: _pt.oneOfType([_pt.string, _pt.func]),
175
+ defaultOptions: _pt.oneOfType([_pt.any, _pt.bool]),
176
+ showOptionGroupDivider: _pt.bool,
177
+ iconLeft: _pt.node
178
+ } : {};
179
+
160
180
  AsyncSelectInput.isTouched = function (touched) {
161
181
  return Boolean(touched);
162
182
  };
163
183
 
164
184
  AsyncSelectInput.displayName = 'AsyncSelectInput';
165
- AsyncSelectInput.defaultProps = {
166
- // Using "null" will ensure that the currently selected value disappears in
167
- // case "undefined" gets passed as the next value
168
- value: null,
169
- isSearchable: true,
170
- menuPortalZIndex: 1
171
- };
172
- AsyncSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
173
- /**
174
- * Horizontal size limit of the input fields.
175
- */
176
- horizontalConstraint: PropTypes.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
177
-
178
- /**
179
- * Indicates the input field has an error
180
- */
181
- hasError: PropTypes.bool,
182
-
183
- /**
184
- * Indicates the input field has a warning
185
- */
186
- hasWarning: PropTypes.bool,
187
-
188
- /**
189
- * Indicates that the field is displaying read-only content
190
- */
191
- isReadOnly: PropTypes.bool,
192
- // react-select base props
193
- //
194
- // Currently unsupported props are commented out. In case you need one of
195
- // these props when using UI Kit, you can submit a PR and enable the
196
- // prop. Don't forget to add it to the story, docs and other select input
197
- // components as well!
198
- //
199
- // See https://react-select.com/props#select-props
200
-
201
- /**
202
- * Aria label (for assistive tech)
203
- */
204
- 'aria-label': PropTypes.string,
205
-
206
- /**
207
- * HTML ID of an element that should be used as the label (for assistive tech)
208
- */
209
- 'aria-labelledby': PropTypes.string,
210
- // renamed autoFocus of react-select
211
-
212
- /**
213
- * Focus the control when it is mounted
214
- */
215
- isAutofocussed: PropTypes.bool,
216
-
217
- /**
218
- * Remove the currently focused option when the user presses backspace
219
- */
220
- backspaceRemovesValue: PropTypes.bool,
221
-
222
- /**
223
- * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
224
- */
225
- components: PropTypes.objectOf(PropTypes.func),
226
-
227
- /**
228
- * Custom method to filter whether an option should be displayed in the menu
229
- */
230
- filterOption: PropTypes.func,
231
- // This forwarded as react-select's "inputId"
232
-
233
- /**
234
- * The id of the search input
235
- */
236
- id: PropTypes.string,
237
- inputValue: PropTypes.string,
238
- // This is forwarded as react-select's "id"
239
-
240
- /**
241
- * The id to set on the SelectContainer component
242
- */
243
- containerId: PropTypes.string,
244
-
245
- /**
246
- * Is the select value clearable
247
- */
248
- isClearable: PropTypes.bool,
249
-
250
- /**
251
- * Is the select disabled
252
- */
253
- isDisabled: PropTypes.bool,
254
-
255
- /**
256
- * Override the built-in logic to detect whether an option is disabled
257
- */
258
- isOptionDisabled: PropTypes.func,
259
-
260
- /**
261
- * Support multiple selected options
262
- */
263
- isMulti: PropTypes.bool,
264
-
265
- /**
266
- * Whether to enable search functionality
267
- */
268
- isSearchable: PropTypes.bool,
269
-
270
- /**
271
- * Maximum height of the menu before scrolling
272
- */
273
- maxMenuHeight: PropTypes.number,
274
-
275
- /**
276
- * Dom element to portal the select menu to
277
- */
278
- menuPortalTarget: PropTypes.instanceOf(SafeHTMLElement),
279
-
280
- /**
281
- * z-index value for the menu portal
282
- */
283
- menuPortalZIndex: PropTypes.number.isRequired,
284
-
285
- /**
286
- * whether the menu should block scroll while open
287
- */
288
- menuShouldBlockScroll: PropTypes.bool,
289
-
290
- /**
291
- * Name of the HTML Input (optional - without this, no input will be rendered)
292
- */
293
- name: PropTypes.string,
294
-
295
- /**
296
- * 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 }`. `inputValue` will be an empty string when no search text is present.
297
- */
298
- noOptionsMessage: PropTypes.func,
299
-
300
- /**
301
- * Handle blur events on the control
302
- */
303
- onBlur: PropTypes.func,
304
-
305
- /**
306
- * 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. The value will be the selected option, or an array of options in case `isMulti` is `true`.
307
- */
308
- onChange: PropTypes.func.isRequired,
309
-
310
- /**
311
- * Handle focus events on the control
312
- */
313
- onFocus: PropTypes.func,
314
-
315
- /**
316
- * Handle change events on the input
317
- */
318
- onInputChange: PropTypes.func,
319
-
320
- /**
321
- * Placeholder text for the select value
322
- */
323
- placeholder: PropTypes.string,
324
-
325
- /**
326
- * loading message shown while the options are being loaded
327
- */
328
- loadingMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
329
-
330
- /**
331
- * Sets the tabIndex attribute on the input
332
- */
333
- tabIndex: PropTypes.string,
334
-
335
- /**
336
- * Select the currently focused option when the user presses tab
337
- */
338
- tabSelectsValue: PropTypes.bool,
339
-
340
- /**
341
- * The value of the select; reflected by the selected option
342
- */
343
- value: function value(props) {
344
- var _context, _context2;
345
-
346
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
347
- rest[_key - 1] = arguments[_key];
348
- }
349
-
350
- return props.isMulti ? PropTypes.arrayOf(PropTypes.shape({
351
- value: PropTypes.string.isRequired
352
- })).apply(void 0, _concatInstanceProperty(_context = [props]).call(_context, rest)) : PropTypes.shape({
353
- value: PropTypes.string.isRequired
354
- }).apply(void 0, _concatInstanceProperty(_context2 = [props]).call(_context2, rest));
355
- },
356
- // Async props
357
-
358
- /**
359
- * The default set of options to show before the user starts searching. When set to true, the results for loadOptions('') will be autoloaded.
360
- */
361
- defaultOptions: PropTypes.oneOfType([PropTypes.bool, PropTypes.arrayOf(PropTypes.shape({
362
- value: PropTypes.string.isRequired
363
- }))]),
364
-
365
- /**
366
- * Function that returns a promise, which is the set of options to be used once the promise resolves.
367
- */
368
- loadOptions: PropTypes.func.isRequired,
369
-
370
- /**
371
- * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
372
- */
373
- cacheOptions: PropTypes.any,
374
-
375
- /**
376
- * Determines if option groups will be separated by a divider
377
- */
378
- showOptionGroupDivider: PropTypes.bool,
379
-
380
- /**
381
- * Icon to display on the left of the placeholder text and selected value. Has no effect when `isMulti` is enabled.
382
- */
383
- iconLeft: PropTypes.node
384
- } : {};
185
+ AsyncSelectInput.defaultProps = defaultProps;
385
186
  addStaticFields(AsyncSelectInput, _objectSpread(_objectSpread(_objectSpread({}, components), customizedComponents), {}, {
386
187
  isTouched: AsyncSelectInput.isTouched
387
188
  }));
388
189
  var AsyncSelectInput$1 = AsyncSelectInput;
389
190
 
390
191
  // NOTE: This string will be replaced on build time with the package version.
391
- var version = "12.2.9";
192
+ var version = "13.0.0";
392
193
 
393
194
  export { AsyncSelectInput$1 as default, version };
@@ -0,0 +1,59 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type ActionMeta, type GroupBase, type OptionsOrGroups } from 'react-select';
3
+ import { type AsyncProps } from 'react-select/async';
4
+ declare type TEvent = {
5
+ target: {
6
+ name?: string;
7
+ value?: unknown;
8
+ };
9
+ persist: () => void;
10
+ };
11
+ declare type ReactSelectAsyncProps = AsyncProps<unknown, boolean, GroupBase<unknown>>;
12
+ declare type TAsyncSelectInputProps = {
13
+ horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
14
+ hasError?: boolean;
15
+ hasWarning?: boolean;
16
+ isReadOnly?: boolean;
17
+ 'aria-label'?: ReactSelectAsyncProps['aria-label'];
18
+ 'aria-labelledby'?: ReactSelectAsyncProps['aria-labelledby'];
19
+ isAutofocussed?: boolean;
20
+ backspaceRemovesValue?: ReactSelectAsyncProps['backspaceRemovesValue'];
21
+ components?: ReactSelectAsyncProps['components'];
22
+ filterOption?: ReactSelectAsyncProps['filterOption'];
23
+ id?: ReactSelectAsyncProps['inputId'];
24
+ inputValue?: ReactSelectAsyncProps['inputValue'];
25
+ containerId?: ReactSelectAsyncProps['id'];
26
+ isClearable?: ReactSelectAsyncProps['isClearable'];
27
+ isDisabled?: ReactSelectAsyncProps['isDisabled'];
28
+ isOptionDisabled?: ReactSelectAsyncProps['isOptionDisabled'];
29
+ isMulti?: ReactSelectAsyncProps['isMulti'];
30
+ isSearchable?: ReactSelectAsyncProps['isSearchable'];
31
+ maxMenuHeight?: ReactSelectAsyncProps['maxMenuHeight'];
32
+ menuPortalTarget?: ReactSelectAsyncProps['menuPortalTarget'];
33
+ menuPortalZIndex: number;
34
+ menuShouldBlockScroll?: ReactSelectAsyncProps['menuShouldBlockScroll'];
35
+ closeMenuOnSelect?: ReactSelectAsyncProps['closeMenuOnSelect'];
36
+ name?: ReactSelectAsyncProps['name'];
37
+ noOptionsMessage?: ReactSelectAsyncProps['noOptionsMessage'];
38
+ onBlur?: (event: TEvent) => void;
39
+ onChange: (event: TEvent, info: ActionMeta<unknown>) => void;
40
+ onFocus?: ReactSelectAsyncProps['onFocus'];
41
+ onInputChange?: ReactSelectAsyncProps['onInputChange'];
42
+ placeholder?: ReactSelectAsyncProps['placeholder'];
43
+ loadingMessage?: string | (() => string);
44
+ tabIndex?: ReactSelectAsyncProps['tabIndex'];
45
+ tabSelectsValue?: ReactSelectAsyncProps['tabSelectsValue'];
46
+ value?: ReactSelectAsyncProps['value'];
47
+ defaultOptions?: OptionsOrGroups<unknown, GroupBase<unknown>> | boolean;
48
+ loadOptions: ReactSelectAsyncProps['loadOptions'];
49
+ cacheOptions?: ReactSelectAsyncProps['cacheOptions'];
50
+ showOptionGroupDivider?: boolean;
51
+ iconLeft?: ReactNode;
52
+ };
53
+ declare const AsyncSelectInput: {
54
+ (props: TAsyncSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
55
+ isTouched(touched: unknown): boolean;
56
+ displayName: string;
57
+ defaultProps: Pick<TAsyncSelectInputProps, "value" | "isSearchable" | "menuPortalZIndex">;
58
+ };
59
+ export default AsyncSelectInput;
@@ -0,0 +1,2 @@
1
+ export { default } from './async-select-input';
2
+ export { default as version } from './version';
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/async-select-input",
3
3
  "description": "An input component getting a selection from an asynchronously loaded list from the user.",
4
- "version": "12.2.9",
4
+ "version": "13.0.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -19,26 +19,26 @@
19
19
  "module": "dist/commercetools-uikit-async-select-input.esm.js",
20
20
  "files": ["dist"],
21
21
  "dependencies": {
22
- "@babel/runtime": "7.16.5",
23
- "@babel/runtime-corejs3": "7.16.5",
24
- "@commercetools-uikit/constraints": "12.2.9",
25
- "@commercetools-uikit/design-system": "12.2.9",
26
- "@commercetools-uikit/icons": "12.2.9",
27
- "@commercetools-uikit/loading-spinner": "12.2.9",
28
- "@commercetools-uikit/select-utils": "12.2.9",
29
- "@commercetools-uikit/spacings": "12.2.9",
30
- "@commercetools-uikit/text": "12.2.9",
22
+ "@babel/runtime": "7.17.2",
23
+ "@babel/runtime-corejs3": "7.17.2",
24
+ "@commercetools-uikit/constraints": "13.0.0",
25
+ "@commercetools-uikit/design-system": "13.0.0",
26
+ "@commercetools-uikit/icons": "13.0.0",
27
+ "@commercetools-uikit/loading-spinner": "13.0.0",
28
+ "@commercetools-uikit/select-utils": "13.0.0",
29
+ "@commercetools-uikit/spacings": "13.0.0",
30
+ "@commercetools-uikit/text": "13.0.0",
31
31
  "@commercetools-uikit/utils": "12.2.9",
32
32
  "@emotion/react": "^11.4.0",
33
33
  "@emotion/styled": "^11.3.0",
34
34
  "lodash": "4.17.21",
35
- "prop-types": "15.7.2",
36
- "react-select": "5.2.1"
35
+ "prop-types": "15.8.1",
36
+ "react-select": "5.2.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "react": "17.0.2",
40
40
  "react-dom": "17.0.2",
41
- "react-intl": "5.23.0"
41
+ "react-intl": "5.24.6"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": "17.x",