@commercetools-uikit/async-select-input 0.0.0-canary-20220120105417 → 0.0.0-canary-20220124124455

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,66 @@ 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` | `ReactSelectProps['aria-label']` | | | Aria label (for assistive tech)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
68
+ | `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) |
69
+ | `isAutofocussed` | `boolean` | | | Focus the control when it is mounted |
70
+ | `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) |
71
+ | `components` | `ReactSelectProps['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` | `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) |
73
+ | `id` | `ReactSelectProps['inputId']` | | | The id of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
74
+ | `inputValue` | `ReactSelectProps['inputValue']` | | | The value of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
75
+ | `containerId` | `ReactSelectProps['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` | `ReactSelectProps['isClearable']` | | | Is the select value clearable&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
77
+ | `isDisabled` | `ReactSelectProps['isDisabled']` | | | Is the select disabled&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
78
+ | `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) |
79
+ | `isMulti` | `ReactSelectProps['isMulti']` | | | Support multiple selected options&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
80
+ | `isSearchable` | `ReactSelectProps['isSearchable']` | | `true` | Whether to enable search functionality&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
81
+ | `maxMenuHeight` | `ReactSelectProps['maxMenuHeight']` | | | Maximum height of the menu before scrolling&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
82
+ | `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) |
83
+ | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
84
+ | `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) |
85
+ | `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) |
86
+ | `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 }`. `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) |
87
+ | `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
88
+ | `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`. |
89
+ | `onFocus` | `ReactSelectProps['onFocus']` | | | Handle focus events on the control&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
90
+ | `onInputChange` | `ReactSelectProps['onInputChange']` | | | Handle change events on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
91
+ | `placeholder` | `ReactSelectProps['placeholder']` | | | Placeholder text for the select value&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
92
+ | `loadingMessage` | `union`<br/>Possible values:<br/>`string , (() => string)` | | | loading message shown while the options are being loaded |
93
+ | `tabIndex` | `ReactSelectProps['tabIndex']` | | | Sets the tabIndex attribute on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
94
+ | `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) |
95
+ | `value` | `PropsValue` | | `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) |
96
+ | `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) |
97
+ | `loadOptions` | `Function`<br/>[See signature.](#signature-loadOptions) | ✅ | | Function that returns a promise, which is the set of options to be used once the promise resolves. |
98
+ | `cacheOptions` | `unknown` | | | If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value. |
99
+ | `showOptionGroupDivider` | `boolean` | | | Determines if option groups will be separated by a divider |
100
+ | `iconLeft` | `ReactNode` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when `isMulti` is enabled. |
101
+
102
+ ## Signatures
103
+
104
+ ### Signature `onBlur`
105
+
106
+ ```ts
107
+ (event: TEvent) => void
108
+ ```
109
+
110
+ ### Signature `onChange`
111
+
112
+ ```ts
113
+ (event: TEvent, info: ActionMeta<unknown>) => void
114
+ ```
115
+
116
+ ### Signature `loadOptions`
117
+
118
+ ```ts
119
+ () => void
120
+ ```
103
121
 
104
122
  This input is built on top of [`react-select`](https://github.com/JedWatson/react-select) v2.
105
123
  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,8 +33,7 @@ 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);
@@ -43,7 +41,7 @@ var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
43
41
 
44
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; }
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 source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), true)).call(_context, 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 _context2; _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
@@ -137,10 +141,9 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
137
141
  return "".concat(props.name, ".0");
138
142
  }()
139
143
  },
140
- // eslint-disable-next-line @typescript-eslint/no-empty-function
141
144
  persist: function persist() {}
142
145
  };
143
- props.onBlur(event);
146
+ props.onBlur && props.onBlur(event);
144
147
  } : undefined,
145
148
  onChange: function onChange(value, info) {
146
149
  var newValue = value;
@@ -154,7 +157,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
154
157
  name: props.name,
155
158
  value: newValue
156
159
  },
157
- // eslint-disable-next-line @typescript-eslint/no-empty-function
158
160
  persist: function persist() {}
159
161
  }, info);
160
162
  },
@@ -167,7 +169,8 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
167
169
  ,
168
170
  defaultOptions: props.defaultOptions,
169
171
  loadOptions: props.loadOptions,
170
- cacheOptions: props.cacheOptions,
172
+ cacheOptions: props.cacheOptions // @ts-ignore
173
+ ,
171
174
  iconLeft: props.iconLeft
172
175
  })
173
176
  }))
@@ -178,231 +181,30 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
178
181
  // a signal of the field having been touched.
179
182
 
180
183
 
184
+ AsyncSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
185
+ horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
186
+ hasError: _pt__default["default"].bool,
187
+ hasWarning: _pt__default["default"].bool,
188
+ isReadOnly: _pt__default["default"].bool,
189
+ isAutofocussed: _pt__default["default"].bool,
190
+ menuPortalZIndex: _pt__default["default"].number.isRequired,
191
+ onBlur: _pt__default["default"].func,
192
+ onChange: _pt__default["default"].func.isRequired,
193
+ loadingMessage: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].func]),
194
+ value: _pt__default["default"].any,
195
+ defaultOptions: _pt__default["default"].oneOfType([_pt__default["default"].any, _pt__default["default"].bool]),
196
+ loadOptions: _pt__default["default"].func.isRequired,
197
+ cacheOptions: _pt__default["default"].any,
198
+ showOptionGroupDivider: _pt__default["default"].bool,
199
+ iconLeft: _pt__default["default"].node
200
+ } : {};
201
+
181
202
  AsyncSelectInput.isTouched = function (touched) {
182
203
  return Boolean(touched);
183
204
  };
184
205
 
185
206
  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
- } : {};
207
+ AsyncSelectInput.defaultProps = defaultProps;
406
208
  utils.addStaticFields(AsyncSelectInput, _objectSpread(_objectSpread(_objectSpread({}, reactSelect.components), customizedComponents), {}, {
407
209
  isTouched: AsyncSelectInput.isTouched
408
210
  }));
@@ -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');
@@ -41,7 +40,7 @@ var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
41
40
 
42
41
  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; }
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 source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), true)).call(_context, 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 _context2; _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
@@ -135,10 +140,9 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
135
140
  return "".concat(props.name, ".0");
136
141
  }()
137
142
  },
138
- // eslint-disable-next-line @typescript-eslint/no-empty-function
139
143
  persist: function persist() {}
140
144
  };
141
- props.onBlur(event);
145
+ props.onBlur && props.onBlur(event);
142
146
  } : undefined,
143
147
  onChange: function onChange(value, info) {
144
148
  var newValue = value;
@@ -152,7 +156,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
152
156
  name: props.name,
153
157
  value: newValue
154
158
  },
155
- // eslint-disable-next-line @typescript-eslint/no-empty-function
156
159
  persist: function persist() {}
157
160
  }, info);
158
161
  },
@@ -165,7 +168,8 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
165
168
  ,
166
169
  defaultOptions: props.defaultOptions,
167
170
  loadOptions: props.loadOptions,
168
- cacheOptions: props.cacheOptions,
171
+ cacheOptions: props.cacheOptions // @ts-ignore
172
+ ,
169
173
  iconLeft: props.iconLeft
170
174
  })
171
175
  }))
@@ -176,19 +180,14 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
176
180
  // a signal of the field having been touched.
177
181
 
178
182
 
183
+ AsyncSelectInput.propTypes = {};
184
+
179
185
  AsyncSelectInput.isTouched = function (touched) {
180
186
  return Boolean(touched);
181
187
  };
182
188
 
183
189
  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 = {};
190
+ AsyncSelectInput.defaultProps = defaultProps;
192
191
  utils.addStaticFields(AsyncSelectInput, _objectSpread(_objectSpread(_objectSpread({}, reactSelect.components), customizedComponents), {}, {
193
192
  isTouched: AsyncSelectInput.isTouched
194
193
  }));
@@ -7,14 +7,13 @@ 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';
@@ -22,7 +21,7 @@ import { jsx } from '@emotion/react/jsx-runtime';
22
21
 
23
22
  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; }
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 source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _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
@@ -116,10 +121,9 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
116
121
  return "".concat(props.name, ".0");
117
122
  }()
118
123
  },
119
- // eslint-disable-next-line @typescript-eslint/no-empty-function
120
124
  persist: function persist() {}
121
125
  };
122
- props.onBlur(event);
126
+ props.onBlur && props.onBlur(event);
123
127
  } : undefined,
124
128
  onChange: function onChange(value, info) {
125
129
  var newValue = value;
@@ -133,7 +137,6 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
133
137
  name: props.name,
134
138
  value: newValue
135
139
  },
136
- // eslint-disable-next-line @typescript-eslint/no-empty-function
137
140
  persist: function persist() {}
138
141
  }, info);
139
142
  },
@@ -146,7 +149,8 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
146
149
  ,
147
150
  defaultOptions: props.defaultOptions,
148
151
  loadOptions: props.loadOptions,
149
- cacheOptions: props.cacheOptions,
152
+ cacheOptions: props.cacheOptions // @ts-ignore
153
+ ,
150
154
  iconLeft: props.iconLeft
151
155
  })
152
156
  }))
@@ -157,231 +161,30 @@ var AsyncSelectInput = function AsyncSelectInput(props) {
157
161
  // a signal of the field having been touched.
158
162
 
159
163
 
164
+ AsyncSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
165
+ horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
166
+ hasError: _pt.bool,
167
+ hasWarning: _pt.bool,
168
+ isReadOnly: _pt.bool,
169
+ isAutofocussed: _pt.bool,
170
+ menuPortalZIndex: _pt.number.isRequired,
171
+ onBlur: _pt.func,
172
+ onChange: _pt.func.isRequired,
173
+ loadingMessage: _pt.oneOfType([_pt.string, _pt.func]),
174
+ value: _pt.any,
175
+ defaultOptions: _pt.oneOfType([_pt.any, _pt.bool]),
176
+ loadOptions: _pt.func.isRequired,
177
+ cacheOptions: _pt.any,
178
+ showOptionGroupDivider: _pt.bool,
179
+ iconLeft: _pt.node
180
+ } : {};
181
+
160
182
  AsyncSelectInput.isTouched = function (touched) {
161
183
  return Boolean(touched);
162
184
  };
163
185
 
164
186
  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
- } : {};
187
+ AsyncSelectInput.defaultProps = defaultProps;
385
188
  addStaticFields(AsyncSelectInput, _objectSpread(_objectSpread(_objectSpread({}, components), customizedComponents), {}, {
386
189
  isTouched: AsyncSelectInput.isTouched
387
190
  }));
@@ -0,0 +1,59 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ActionMeta, type GroupBase, type OptionsOrGroups, type Props as ReactSelectProps, type PropsValue } from 'react-select';
3
+ declare type TValue = {
4
+ value: string;
5
+ };
6
+ declare type TEvent = {
7
+ target: {
8
+ name?: string;
9
+ value?: unknown;
10
+ };
11
+ persist: () => void;
12
+ };
13
+ declare type TAsyncSelectInputProps = {
14
+ horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
15
+ hasError?: boolean;
16
+ hasWarning?: boolean;
17
+ isReadOnly?: boolean;
18
+ 'aria-label'?: ReactSelectProps['aria-label'];
19
+ 'aria-labelledby'?: ReactSelectProps['aria-labelledby'];
20
+ isAutofocussed?: boolean;
21
+ backspaceRemovesValue?: ReactSelectProps['backspaceRemovesValue'];
22
+ components?: ReactSelectProps['components'];
23
+ filterOption?: ReactSelectProps['filterOption'];
24
+ id?: ReactSelectProps['inputId'];
25
+ inputValue?: ReactSelectProps['inputValue'];
26
+ containerId?: ReactSelectProps['id'];
27
+ isClearable?: ReactSelectProps['isClearable'];
28
+ isDisabled?: ReactSelectProps['isDisabled'];
29
+ isOptionDisabled?: ReactSelectProps['isOptionDisabled'];
30
+ isMulti?: ReactSelectProps['isMulti'];
31
+ isSearchable?: ReactSelectProps['isSearchable'];
32
+ maxMenuHeight?: ReactSelectProps['maxMenuHeight'];
33
+ menuPortalTarget?: ReactSelectProps['menuPortalTarget'];
34
+ menuPortalZIndex: number;
35
+ menuShouldBlockScroll?: ReactSelectProps['menuShouldBlockScroll'];
36
+ name?: ReactSelectProps['name'];
37
+ noOptionsMessage?: ReactSelectProps['noOptionsMessage'];
38
+ onBlur?: (event: TEvent) => void;
39
+ onChange: (event: TEvent, info: ActionMeta<unknown>) => void;
40
+ onFocus?: ReactSelectProps['onFocus'];
41
+ onInputChange?: ReactSelectProps['onInputChange'];
42
+ placeholder?: ReactSelectProps['placeholder'];
43
+ loadingMessage?: string | (() => string);
44
+ tabIndex?: ReactSelectProps['tabIndex'];
45
+ tabSelectsValue?: ReactSelectProps['tabSelectsValue'];
46
+ value?: PropsValue<TValue>;
47
+ defaultOptions?: OptionsOrGroups<unknown, GroupBase<unknown>> | boolean;
48
+ loadOptions: () => void;
49
+ cacheOptions?: unknown;
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": "0.0.0-canary-20220120105417",
4
+ "version": "0.0.0-canary-20220124124455",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,25 +27,25 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@babel/runtime": "7.16.7",
30
- "@babel/runtime-corejs3": "7.16.7",
31
- "@commercetools-uikit/constraints": "0.0.0-canary-20220120105417",
32
- "@commercetools-uikit/design-system": "0.0.0-canary-20220120105417",
33
- "@commercetools-uikit/icons": "0.0.0-canary-20220120105417",
34
- "@commercetools-uikit/loading-spinner": "0.0.0-canary-20220120105417",
35
- "@commercetools-uikit/select-utils": "0.0.0-canary-20220120105417",
36
- "@commercetools-uikit/spacings": "0.0.0-canary-20220120105417",
37
- "@commercetools-uikit/text": "0.0.0-canary-20220120105417",
30
+ "@babel/runtime-corejs3": "7.16.8",
31
+ "@commercetools-uikit/constraints": "0.0.0-canary-20220124124455",
32
+ "@commercetools-uikit/design-system": "0.0.0-canary-20220124124455",
33
+ "@commercetools-uikit/icons": "0.0.0-canary-20220124124455",
34
+ "@commercetools-uikit/loading-spinner": "0.0.0-canary-20220124124455",
35
+ "@commercetools-uikit/select-utils": "0.0.0-canary-20220124124455",
36
+ "@commercetools-uikit/spacings": "0.0.0-canary-20220124124455",
37
+ "@commercetools-uikit/text": "0.0.0-canary-20220124124455",
38
38
  "@commercetools-uikit/utils": "12.2.9",
39
39
  "@emotion/react": "^11.4.0",
40
40
  "@emotion/styled": "^11.3.0",
41
41
  "lodash": "4.17.21",
42
42
  "prop-types": "15.8.1",
43
- "react-select": "5.2.1"
43
+ "react-select": "5.2.2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "react": "17.0.2",
47
47
  "react-dom": "17.0.2",
48
- "react-intl": "5.24.1"
48
+ "react-intl": "5.24.3"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "17.x",