@commercetools-uikit/async-creatable-select-input 12.2.5 → 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,53 +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` | | | Is the select read-only |
67
- | `iconLeft` | `node` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled. |
68
- | `aria-label` | `string` | | | Aria label (for assistive tech) |
69
- | `aria-labelledby` | `string` | | | HTML ID of an element that should be used as the label (for assistive tech) |
70
- | `isAutofocussed` | `bool` | | | Focus the control when it is mounted |
71
- | `backspaceRemovesValue` | `bool` | | | Remove the currently focused option when the user presses backspace |
72
- | `components` | `objectOf(func)` | | | Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components) |
73
- | `filterOption` | `func` | | | Custom method to filter whether an option should be displayed in the menu |
74
- | `id` | `string` | | | The id of the search input |
75
- | `inputValue` | `string` | | | |
76
- | `containerId` | `string` | | | The id to set on the SelectContainer component |
77
- | `isClearable` | `bool` | | | Is the select value clearable |
78
- | `isDisabled` | `bool` | | | Is the select disabled |
79
- | `isOptionDisabled` | `func` | | | Override the built-in logic to detect whether an option is disabled |
80
- | `isMulti` | `bool` | | | Support multiple selected options |
81
- | `isSearchable` | `bool` | | `true` | Whether to enable search functionality |
82
- | `maxMenuHeight` | `number` | | | Maximum height of the menu before scrolling |
83
- | `menuPortalTarget` | `SafeHTMLElement` | | | Dom element to portal the select menu to |
84
- | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
85
- | `menuShouldBlockScroll` | `bool` | | | whether the menu should block scroll while open |
86
- | `name` | `string` | | | Name of the HTML Input (optional - without this, no input will be rendered) |
87
- | `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. |
88
- | `onBlur` | `func` | | | Handle blur events on the control |
89
- | `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`. |
90
- | `onFocus` | `func` | | | Handle focus events on the control |
91
- | `onInputChange` | `func` | | | Handle change events on the input |
92
- | `placeholder` | `string` | | | Placeholder text for the select value |
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
- | `allowCreateWhileLoading` | `bool` | | | Allow options to be created while the isLoading prop is true. Useful to prevent the "create new ..." option being displayed while async results are still being loaded. |
102
- | `formatCreateLabel` | `func` | | | Gets the label for the "create new ..." option in the menu. Is given the current input value. |
103
- | `isValidNewOption` | `func` | | | Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array. |
104
- | `getNewOptionData` | `func` | | | Returns the data for the new option when it is created. Used to display the value, and is passed to onChange. |
105
- | `onCreateOption` | `func` | | | If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created. |
106
- | `createOptionPosition` | `string` | | | Sets the position of the createOption element in your options list. |
107
- | `showOptionGroupDivider` | `bool` | | | Determines if option groups will be separated by a divider |
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` | | | Is the select read-only |
67
+ | `iconLeft` | `ReactNode` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled. |
68
+ | `aria-label` | `AsyncCreatableProps['aria-label']` | | | Aria label (for assistive tech)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
69
+ | `aria-labelledby` | `AsyncCreatableProps['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) |
70
+ | `isAutofocussed` | `boolean` | | | Focus the control when it is mounted |
71
+ | `backspaceRemovesValue` | `AsyncCreatableProps['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) |
72
+ | `components` | `AsyncCreatableProps['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) |
73
+ | `filterOption` | `AsyncCreatableProps['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) |
74
+ | `id` | `AsyncCreatableProps['inputId']` | | | The id of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
75
+ | `inputValue` | `AsyncCreatableProps['inputValue']` | | | The value of the search input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
76
+ | `containerId` | `AsyncCreatableProps['id']` | | | The id to set on the SelectContainer component&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
77
+ | `isClearable` | `AsyncCreatableProps['isClearable']` | | | Is the select value clearable&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
78
+ | `isDisabled` | `AsyncCreatableProps['isDisabled']` | | | Is the select disabled&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
79
+ | `isOptionDisabled` | `AsyncCreatableProps['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) |
80
+ | `isMulti` | `AsyncCreatableProps['isMulti']` | | | Support multiple selected options&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
81
+ | `isSearchable` | `AsyncCreatableProps['isSearchable']` | | `true` | Whether to enable search functionality&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
82
+ | `maxMenuHeight` | `AsyncCreatableProps['maxMenuHeight']` | | | Maximum height of the menu before scrolling&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
83
+ | `menuPortalTarget` | `AsyncCreatableProps['menuPortalTarget']` | | | Dom element to portal the select menu to&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
84
+ | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
85
+ | `menuShouldBlockScroll` | `AsyncCreatableProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
86
+ | `closeMenuOnSelect` | `AsyncCreatableProps['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) |
87
+ | `name` | `AsyncCreatableProps['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) |
88
+ | `noOptionsMessage` | `AsyncCreatableProps['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) |
89
+ | `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
90
+ | `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`. |
91
+ | `onFocus` | `AsyncCreatableProps['onFocus']` | | | Handle focus events on the control&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
92
+ | `onInputChange` | `AsyncCreatableProps['onInputChange']` | | | Handle change events on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
93
+ | `placeholder` | `AsyncCreatableProps['placeholder']` | | | Placeholder text for the select value&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
94
+ | `tabIndex` | `AsyncCreatableProps['tabIndex']` | | | Sets the tabIndex attribute on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
95
+ | `tabSelectsValue` | `AsyncCreatableProps['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` | `AsyncCreatableProps['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` | `AsyncCreatableProps['defaultOptions']` | | | 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` | `AsyncCreatableProps['loadOptions']` | ✅ | | Function that returns a promise, which is the set of options to be used once the promise resolves.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
99
+ | `cacheOptions` | `AsyncCreatableProps['cacheOptions']` | | | If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
100
+ | `allowCreateWhileLoading` | `AsyncCreatableProps['allowCreateWhileLoading']` | | | Allow options to be created while the isLoading prop is true. Useful to prevent the "create new ..." option being displayed while async results are still being loaded.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
101
+ | `formatCreateLabel` | `AsyncCreatableProps['formatCreateLabel']` | | | Gets the label for the "create new ..." option in the menu. Is given the current input value.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
102
+ | `isValidNewOption` | `AsyncCreatableProps['isValidNewOption']` | | | Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
103
+ | `getNewOptionData` | `AsyncCreatableProps['getNewOptionData']` | | | Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
104
+ | `onCreateOption` | `AsyncCreatableProps['onCreateOption']` | | | If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
105
+ | `createOptionPosition` | `AsyncCreatableProps['createOptionPosition']` | | | Sets the position of the createOption element in your options list.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
106
+ | `showOptionGroupDivider` | `boolean` | | | Determines if option groups will be separated by a divider |
107
+
108
+ ## Signatures
109
+
110
+ ### Signature `onBlur`
111
+
112
+ ```ts
113
+ (event: TEvent) => void
114
+ ```
115
+
116
+ ### Signature `onChange`
117
+
118
+ ```ts
119
+ (event: TEvent, info: ActionMeta<unknown>) => void
120
+ ```
108
121
 
109
122
  This input is built on top of [`react-select`](https://github.com/JedWatson/react-select) v2.
110
123
  It supports mostly same properties as `react-select`. Behaviour 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";
@@ -2,6 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _pt = require('prop-types');
7
+ var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
5
8
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
9
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
10
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
@@ -10,10 +13,8 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
10
13
  var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
14
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
15
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
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');
16
16
  var reactIntl = require('react-intl');
17
+ var isEmpty = require('lodash/isEmpty');
17
18
  var react = require('@emotion/react');
18
19
  var reactSelect = require('react-select');
19
20
  var AsyncCreatableSelect = require('react-select/async-creatable');
@@ -25,6 +26,8 @@ var jsxRuntime = require('@emotion/react/jsx-runtime');
25
26
 
26
27
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
27
28
 
29
+ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
30
+ var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
28
31
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
29
32
  var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
30
33
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
@@ -33,15 +36,14 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
33
36
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
34
37
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
35
38
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
36
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
37
- var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
39
+ var isEmpty__default = /*#__PURE__*/_interopDefault(isEmpty);
38
40
  var AsyncCreatableSelect__default = /*#__PURE__*/_interopDefault(AsyncCreatableSelect);
39
41
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
40
42
  var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
41
43
 
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; }
44
+ 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
45
 
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; }
46
+ 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
47
 
46
48
  var LoadingIndicator = function LoadingIndicator() {
47
49
  return jsxRuntime.jsx(LoadingSpinner__default["default"], {
@@ -56,11 +58,23 @@ var customizedComponents = {
56
58
  LoadingIndicator: LoadingIndicator,
57
59
  MultiValueRemove: selectUtils.TagRemove
58
60
  };
61
+ var defaultProps = {
62
+ // Using "null" will ensure that the currently selected value disappears in
63
+ // case "undefined" gets passed as the next value
64
+ value: null,
65
+ isSearchable: true,
66
+ menuPortalZIndex: 1
67
+ };
59
68
 
60
69
  var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
61
70
  var intl = reactIntl.useIntl();
62
71
  var theme = react.useTheme();
63
72
  var placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
73
+
74
+ if (props.isMulti) {
75
+ process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](props.value), 'AsyncCreatableSelectInput: `value` is expected to be an array when isMulti is true') : void 0;
76
+ }
77
+
64
78
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
65
79
  max: props.horizontalConstraint,
66
80
  children: jsxRuntime.jsx("div", _objectSpread(_objectSpread({}, utils.filterDataAttributes(props)), {}, {
@@ -70,7 +84,6 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
70
84
  autoFocus: props.isAutofocussed,
71
85
  backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
72
86
  components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
73
- // eslint-disable-next-line react/display-name
74
87
  Input: function Input(ownProps) {
75
88
  return jsxRuntime.jsx(reactSelect.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
76
89
  readOnly: true
@@ -84,7 +97,10 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
84
97
  showOptionGroupDivider: props.showOptionGroupDivider,
85
98
  menuPortalZIndex: props.menuPortalZIndex,
86
99
  isDisabled: props.isDisabled,
87
- isReadOnly: props.isReadOnly
100
+ isReadOnly: props.isReadOnly,
101
+ iconLeft: props.iconLeft,
102
+ isMulti: props.isMulti,
103
+ hasValue: !isEmpty__default["default"](props.value)
88
104
  }, theme),
89
105
  filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
90
106
  // but we use "id" (for the input) and "containerId" (for the container)
@@ -102,6 +118,7 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
102
118
  maxMenuHeight: props.maxMenuHeight,
103
119
  menuPortalTarget: props.menuPortalTarget,
104
120
  menuShouldBlockScroll: props.menuShouldBlockScroll,
121
+ closeMenuOnScroll: props.closeMenuOnSelect,
105
122
  name: props.name,
106
123
  noOptionsMessage: props.noOptionsMessage || function (_ref) {
107
124
  var inputValue = _ref.inputValue;
@@ -122,10 +139,9 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
122
139
  return "".concat(props.name, ".0");
123
140
  }()
124
141
  },
125
- // eslint-disable-next-line @typescript-eslint/no-empty-function
126
142
  persist: function persist() {}
127
143
  };
128
- props.onBlur(event);
144
+ props.onBlur && props.onBlur(event);
129
145
  } : undefined,
130
146
  onChange: function onChange(value, info) {
131
147
  // wrapping breaking changes made in react-select v3
@@ -140,7 +156,6 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
140
156
  name: props.name,
141
157
  value: newValue
142
158
  },
143
- // eslint-disable-next-line @typescript-eslint/no-empty-function
144
159
  persist: function persist() {}
145
160
  }, info);
146
161
  },
@@ -164,7 +179,8 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
164
179
  isValidNewOption: props.isValidNewOption,
165
180
  getNewOptionData: props.getNewOptionData,
166
181
  onCreateOption: props.onCreateOption,
167
- createOptionPosition: props.createOptionPosition,
182
+ createOptionPosition: props.createOptionPosition // @ts-ignore
183
+ ,
168
184
  iconLeft: props.iconLeft
169
185
  })
170
186
  }))
@@ -175,264 +191,32 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
175
191
  // a signal of the field having been touched.
176
192
 
177
193
 
194
+ AsyncCreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
195
+ horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
196
+ hasError: _pt__default["default"].bool,
197
+ hasWarning: _pt__default["default"].bool,
198
+ isReadOnly: _pt__default["default"].bool,
199
+ iconLeft: _pt__default["default"].node,
200
+ isAutofocussed: _pt__default["default"].bool,
201
+ menuPortalZIndex: _pt__default["default"].number.isRequired,
202
+ onBlur: _pt__default["default"].func,
203
+ onChange: _pt__default["default"].func.isRequired,
204
+ showOptionGroupDivider: _pt__default["default"].bool
205
+ } : {};
206
+
178
207
  AsyncCreatableSelectInput.isTouched = function (touched) {
179
208
  return Boolean(touched);
180
209
  };
181
210
 
182
211
  AsyncCreatableSelectInput.displayName = 'AsyncCreatableSelectInput';
183
- AsyncCreatableSelectInput.defaultProps = {
184
- // Using "null" will ensure that the currently selected value disappears in
185
- // case "undefined" gets passed as the next value
186
- value: null,
187
- isSearchable: true,
188
- menuPortalZIndex: 1
189
- };
190
- AsyncCreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
191
- /**
192
- * Horizontal size limit of the input fields.
193
- */
194
- horizontalConstraint: PropTypes__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
195
-
196
- /**
197
- * Indicates the input field has an error
198
- */
199
- hasError: PropTypes__default["default"].bool,
200
-
201
- /**
202
- * Indicates the input field has a warning
203
- */
204
- hasWarning: PropTypes__default["default"].bool,
205
-
206
- /**
207
- * Is the select read-only
208
- */
209
- isReadOnly: PropTypes__default["default"].bool,
210
-
211
- /**
212
- * Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
213
- */
214
- iconLeft: PropTypes__default["default"].node,
215
- // react-select base props
216
- //
217
- // Currently unsupported props are commented out. In case you need one of
218
- // these props when using UI Kit, you can submit a PR and enable the
219
- // prop. Don't forget to add it to the story, docs and other select input
220
- // components as well!
221
- //
222
- // See https://react-select.com/props#select-props
223
-
224
- /**
225
- * Aria label (for assistive tech)
226
- */
227
- 'aria-label': PropTypes__default["default"].string,
228
-
229
- /**
230
- * HTML ID of an element that should be used as the label (for assistive tech)
231
- */
232
- 'aria-labelledby': PropTypes__default["default"].string,
233
-
234
- /**
235
- * Focus the control when it is mounted
236
- */
237
- isAutofocussed: PropTypes__default["default"].bool,
238
- // original: autoFocus
239
-
240
- /**
241
- * Remove the currently focused option when the user presses backspace
242
- */
243
- backspaceRemovesValue: PropTypes__default["default"].bool,
244
-
245
- /**
246
- * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
247
- */
248
- components: PropTypes__default["default"].objectOf(PropTypes__default["default"].func),
249
-
250
- /**
251
- * Custom method to filter whether an option should be displayed in the menu
252
- */
253
- filterOption: PropTypes__default["default"].func,
254
- // This forwarded as react-select's "inputId"
255
-
256
- /**
257
- * The id of the search input
258
- */
259
- id: PropTypes__default["default"].string,
260
- // This is forwarded as react-select's "id"
261
- inputValue: PropTypes__default["default"].string,
262
-
263
- /**
264
- * The id to set on the SelectContainer component
265
- */
266
- containerId: PropTypes__default["default"].string,
267
-
268
- /**
269
- * Is the select value clearable
270
- */
271
- isClearable: PropTypes__default["default"].bool,
272
-
273
- /**
274
- * Is the select disabled
275
- */
276
- isDisabled: PropTypes__default["default"].bool,
277
-
278
- /**
279
- * Override the built-in logic to detect whether an option is disabled
280
- */
281
- isOptionDisabled: PropTypes__default["default"].func,
282
-
283
- /**
284
- * Support multiple selected options
285
- */
286
- isMulti: PropTypes__default["default"].bool,
287
-
288
- /**
289
- * Whether to enable search functionality
290
- */
291
- isSearchable: PropTypes__default["default"].bool,
292
-
293
- /**
294
- * Maximum height of the menu before scrolling
295
- */
296
- maxMenuHeight: PropTypes__default["default"].number,
297
-
298
- /**
299
- * Dom element to portal the select menu to
300
- */
301
- menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
302
-
303
- /**
304
- * z-index value for the menu portal
305
- */
306
- menuPortalZIndex: PropTypes__default["default"].number.isRequired,
307
-
308
- /**
309
- * whether the menu should block scroll while open
310
- */
311
- menuShouldBlockScroll: PropTypes__default["default"].bool,
312
-
313
- /**
314
- * Name of the HTML Input (optional - without this, no input will be rendered)
315
- */
316
- name: PropTypes__default["default"].string,
317
-
318
- /**
319
- * 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.
320
- */
321
- noOptionsMessage: PropTypes__default["default"].func,
322
-
323
- /**
324
- * Handle blur events on the control
325
- */
326
- onBlur: PropTypes__default["default"].func,
327
-
328
- /**
329
- * 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`.
330
- */
331
- onChange: PropTypes__default["default"].func.isRequired,
332
-
333
- /**
334
- * Handle focus events on the control
335
- */
336
- onFocus: PropTypes__default["default"].func,
337
-
338
- /**
339
- * Handle change events on the input
340
- */
341
- onInputChange: PropTypes__default["default"].func,
342
-
343
- /**
344
- * Placeholder text for the select value
345
- */
346
- placeholder: PropTypes__default["default"].string,
347
-
348
- /**
349
- * Sets the tabIndex attribute on the input
350
- */
351
- tabIndex: PropTypes__default["default"].string,
352
-
353
- /**
354
- * Select the currently focused option when the user presses tab
355
- */
356
- tabSelectsValue: PropTypes__default["default"].bool,
357
-
358
- /**
359
- * The value of the select; reflected by the selected option
360
- */
361
- value: function value(props) {
362
- var _context, _context2;
363
-
364
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
365
- rest[_key - 1] = arguments[_key];
366
- }
367
-
368
- return props.isMulti ? PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
369
- value: PropTypes__default["default"].string.isRequired
370
- })).apply(void 0, _concatInstanceProperty__default["default"](_context = [props]).call(_context, rest)) : PropTypes__default["default"].shape({
371
- value: PropTypes__default["default"].string.isRequired
372
- }).apply(void 0, _concatInstanceProperty__default["default"](_context2 = [props]).call(_context2, rest));
373
- },
374
- // Async props
375
-
376
- /**
377
- * The default set of options to show before the user starts searching. When set to true, the results for loadOptions('') will be autoloaded.
378
- */
379
- defaultOptions: PropTypes__default["default"].oneOfType([PropTypes__default["default"].bool, PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
380
- value: PropTypes__default["default"].string.isRequired
381
- }))]),
382
-
383
- /**
384
- * Function that returns a promise, which is the set of options to be used once the promise resolves.
385
- */
386
- loadOptions: PropTypes__default["default"].func.isRequired,
387
-
388
- /**
389
- * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
390
- */
391
- cacheOptions: PropTypes__default["default"].any,
392
- // Creatable props
393
-
394
- /**
395
- * Allow options to be created while the isLoading prop is true. Useful to prevent the "create new ..." option being displayed while async results are still being loaded.
396
- */
397
- allowCreateWhileLoading: PropTypes__default["default"].bool,
398
-
399
- /**
400
- * Gets the label for the "create new ..." option in the menu. Is given the current input value.
401
- */
402
- formatCreateLabel: PropTypes__default["default"].func,
403
-
404
- /**
405
- * Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
406
- */
407
- isValidNewOption: PropTypes__default["default"].func,
408
-
409
- /**
410
- * Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
411
- */
412
- getNewOptionData: PropTypes__default["default"].func,
413
-
414
- /**
415
- * If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created.
416
- */
417
- onCreateOption: PropTypes__default["default"].func,
418
-
419
- /**
420
- * Sets the position of the createOption element in your options list.
421
- */
422
- createOptionPosition: PropTypes__default["default"].string,
423
-
424
- /**
425
- * Determines if option groups will be separated by a divider
426
- */
427
- showOptionGroupDivider: PropTypes__default["default"].bool
428
- } : {};
212
+ AsyncCreatableSelectInput.defaultProps = defaultProps;
429
213
  utils.addStaticFields(AsyncCreatableSelectInput, _objectSpread(_objectSpread(_objectSpread({}, reactSelect.components), customizedComponents), {}, {
430
214
  isTouched: AsyncCreatableSelectInput.isTouched
431
215
  }));
432
216
  var AsyncCreatableSelectInput$1 = AsyncCreatableSelectInput;
433
217
 
434
218
  // NOTE: This string will be replaced on build time with the package version.
435
- var version = "12.2.5";
219
+ var version = "13.0.0";
436
220
 
437
221
  exports["default"] = AsyncCreatableSelectInput$1;
438
222
  exports.version = version;