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