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