@commercetools-uikit/creatable-select-field 13.0.0 → 13.0.4
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 +77 -56
- package/dist/commercetools-uikit-creatable-select-field.cjs.d.ts +2 -0
- package/dist/commercetools-uikit-creatable-select-field.cjs.dev.js +46 -298
- package/dist/commercetools-uikit-creatable-select-field.cjs.prod.js +13 -4
- package/dist/commercetools-uikit-creatable-select-field.esm.js +46 -298
- package/dist/declarations/src/creatable-select-field.d.ts +85 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -49,62 +49,83 @@ export default Example;
|
|
|
49
49
|
|
|
50
50
|
## Properties
|
|
51
51
|
|
|
52
|
-
| Props
|
|
53
|
-
|
|
|
54
|
-
| `id`
|
|
55
|
-
| `horizontalConstraint`
|
|
56
|
-
| `errors`
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `aria-
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
52
|
+
| Props | Type | Required | Default | Description |
|
|
53
|
+
| ------------------------- | ----------------------------------------------------------------------------------------------------- | :------: | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
54
|
+
| `id` | `CreatableProps['inputId']` | | | Used as HTML id property. An id is auto-generated when it is not specified.
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
55
|
+
| `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | `'scale'` | Horizontal size limit of the input fields. |
|
|
56
|
+
| `errors` | `Record` | | | A map of errors. Error messages for known errors are rendered automatically.
<br>
Unknown errors will be forwarded to `renderError` |
|
|
57
|
+
| `renderError` | `Function`<br/>[See signature.](#signature-renderError) | | | Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error. |
|
|
58
|
+
| `isRequired` | `boolean` | | | Indicates if the value is required. Shows an the "required asterisk" if so. |
|
|
59
|
+
| `touched` | `union`<br/>Possible values:<br/>`boolean[] , boolean` | | | Indicates whether the field was touched. Errors will only be shown when the field was touched. |
|
|
60
|
+
| `aria-label` | `CreatableProps['aria-label']` | | | Aria label (for assistive tech)
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
61
|
+
| `aria-labelledby` | `CreatableProps['aria-label']` | | | 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) |
|
|
62
|
+
| `isAutofocussed` | `boolean` | | | Focus the control when it is mounted |
|
|
63
|
+
| `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) |
|
|
64
|
+
| `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) |
|
|
65
|
+
| `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) |
|
|
66
|
+
| `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) |
|
|
67
|
+
| `isClearable` | `CreatableProps['isClearable']` | | | Is the select value clearable
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
68
|
+
| `isDisabled` | `CreatableProps['isDisabled']` | | | Is the select disabled
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
69
|
+
| `isReadOnly` | `ConstrainBooleanParameters` | | | Is the select read-only |
|
|
70
|
+
| `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) |
|
|
71
|
+
| `isMulti` | `CreatableProps['isMulti']` | | | Support multiple selected options
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
72
|
+
| `isSearchable` | `CreatableProps['isSearchable']` | | | Whether to enable search functionality
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
73
|
+
| `hasWarning` | `boolean` | | | Indicates the input field has an error |
|
|
74
|
+
| `maxMenuHeight` | `CreatableProps['maxMenuHeight']` | | | Maximum height of the menu before scrolling
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
75
|
+
| `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) |
|
|
76
|
+
| `menuPortalZIndex` | `number` | | | z-index value for the menu portal |
|
|
77
|
+
| `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) |
|
|
78
|
+
| `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) |
|
|
79
|
+
| `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).
<br>
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) |
|
|
80
|
+
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
|
|
81
|
+
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) | ✅ | | Called with a fake event when value changes.
<br>
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`. |
|
|
82
|
+
| `onFocus` | `CreatableProps['onFocus']` | | | Handle focus events on the control
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
83
|
+
| `onInputChange` | `CreatableProps['onInputChange']` | | | Handle change events on the input
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
84
|
+
| `options` | `union`<br/>Possible values:<br/>`TValue[] , { options: TValue[] }[]` | | | Array of options that populate the select menu |
|
|
85
|
+
| `placeholder` | `CreatableProps['placeholder']` | | | Placeholder text for the select value
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
86
|
+
| `tabIndex` | `CreatableProps['tabIndex']` | | | Sets the tabIndex attribute on the input
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
87
|
+
| `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) |
|
|
88
|
+
| `value` | `CreatableProps['value']` | | | The value of the select; reflected by the selected option
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
89
|
+
| `showOptionGroupDivider` | `boolean` | | | Determines if option groups will be separated by a divider |
|
|
90
|
+
| `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) |
|
|
91
|
+
| `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) |
|
|
92
|
+
| `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) |
|
|
93
|
+
| `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) |
|
|
94
|
+
| `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) |
|
|
95
|
+
| `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) |
|
|
96
|
+
| `title` | `union`<br/>Possible values:<br/>`string , ReactNode` | ✅ | | Title of the label |
|
|
97
|
+
| `hint` | `union`<br/>Possible values:<br/>`string , ReactNode` | | | Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`. |
|
|
98
|
+
| `description` | `union`<br/>Possible values:<br/>`string , ReactNode` | | | Provides a description for the title. |
|
|
99
|
+
| `onInfoButtonClick` | `Function`<br/>[See signature.](#signature-onInfoButtonClick) | | | Function called when info button is pressed.
<br>
Info button will only be visible when this prop is passed. |
|
|
100
|
+
| `hintIcon` | `ReactElement` | | | Icon to be displayed beside the hint text.
<br>
Will only get rendered when `hint` is passed as well. |
|
|
101
|
+
| `badge` | `ReactNode` | | | Badge to be displayed beside the label.
<br>
Might be used to display additional information about the content of the field (E.g verified email) |
|
|
102
|
+
| `iconLeft` | `ReactNode` | | | Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled. |
|
|
103
|
+
|
|
104
|
+
## Signatures
|
|
105
|
+
|
|
106
|
+
### Signature `renderError`
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
(key: string, error?: boolean) => ReactNode;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Signature `onBlur`
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
(event: TEvent) => void
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Signature `onChange`
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
(event: TEvent, info: ActionMeta<unknown>) => void
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Signature `onInfoButtonClick`
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
() => void
|
|
128
|
+
```
|
|
108
129
|
|
|
109
130
|
## `data-*` props
|
|
110
131
|
|
|
@@ -17,12 +17,12 @@ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
|
17
17
|
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
18
18
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
19
19
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
20
|
+
var _pt = require('prop-types');
|
|
20
21
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
21
22
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
22
23
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
24
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
23
25
|
var react = require('react');
|
|
24
|
-
var PropTypes = require('prop-types');
|
|
25
|
-
var requiredIf = require('react-required-if');
|
|
26
26
|
var utils = require('@commercetools-uikit/utils');
|
|
27
27
|
var Constraints = require('@commercetools-uikit/constraints');
|
|
28
28
|
var Spacings = require('@commercetools-uikit/spacings');
|
|
@@ -42,11 +42,11 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
42
42
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
43
43
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
44
44
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
45
|
+
var _pt__default = /*#__PURE__*/_interopDefault(_pt);
|
|
45
46
|
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
46
47
|
var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
|
|
47
48
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
48
|
-
var
|
|
49
|
-
var requiredIf__default = /*#__PURE__*/_interopDefault(requiredIf);
|
|
49
|
+
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
50
50
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
51
51
|
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
52
52
|
var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
|
|
@@ -55,12 +55,13 @@ var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
|
|
|
55
55
|
|
|
56
56
|
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; }
|
|
57
57
|
|
|
58
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
58
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
59
59
|
|
|
60
60
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
61
61
|
|
|
62
62
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
63
63
|
var sequentialId = utils.createSequentialId('creatable-select-field-');
|
|
64
|
+
var sequentialErrorsId = utils.createSequentialId('creatable-select-field-error-')();
|
|
64
65
|
|
|
65
66
|
var hasErrors = function hasErrors(errors) {
|
|
66
67
|
var _context;
|
|
@@ -97,6 +98,16 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
97
98
|
key: "render",
|
|
98
99
|
value: function render() {
|
|
99
100
|
var hasError = CreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
101
|
+
|
|
102
|
+
if (this.props.hintIcon) {
|
|
103
|
+
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'CreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (this.props.isMulti) {
|
|
107
|
+
process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](this.props.value), 'CreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
108
|
+
process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](this.props.touched), 'CreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
100
111
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
101
112
|
max: this.props.horizontalConstraint,
|
|
102
113
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
@@ -115,6 +126,8 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
115
126
|
hasError: hasError,
|
|
116
127
|
"aria-label": this.props['aria-label'],
|
|
117
128
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
129
|
+
"aria-invalid": hasError,
|
|
130
|
+
"aria-errormessage": sequentialErrorsId,
|
|
118
131
|
isAutofocussed: this.props.isAutofocussed,
|
|
119
132
|
backspaceRemovesValue: this.props.backspaceRemovesValue,
|
|
120
133
|
components: this.props.components,
|
|
@@ -152,6 +165,7 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
152
165
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
153
166
|
iconLeft: this.props.iconLeft
|
|
154
167
|
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
168
|
+
id: sequentialErrorsId,
|
|
155
169
|
errors: this.props.errors,
|
|
156
170
|
isVisible: hasError,
|
|
157
171
|
renderError: this.props.renderError
|
|
@@ -175,302 +189,36 @@ CreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
175
189
|
};
|
|
176
190
|
};
|
|
177
191
|
CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
renderError: PropTypes__default["default"].func,
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
208
|
-
*/
|
|
209
|
-
isRequired: PropTypes__default["default"].bool,
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
213
|
-
*/
|
|
214
|
-
touched: function touched(props) {
|
|
215
|
-
var _context3, _context4, _context5;
|
|
216
|
-
|
|
217
|
-
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
218
|
-
rest[_key2 - 1] = arguments[_key2];
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return props.isMulti ? PropTypes__default["default"].arrayOf.apply(PropTypes__default["default"], _concatInstanceProperty__default["default"](_context3 = [PropTypes__default["default"].bool]).call(_context3, rest)).apply(void 0, _concatInstanceProperty__default["default"](_context4 = [props]).call(_context4, rest)) : PropTypes__default["default"].bool.apply(PropTypes__default["default"], _concatInstanceProperty__default["default"](_context5 = [props]).call(_context5, rest));
|
|
222
|
-
},
|
|
223
|
-
// CreatableSelectInput
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Aria label (for assistive tech)
|
|
227
|
-
*/
|
|
228
|
-
'aria-label': PropTypes__default["default"].string,
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
232
|
-
*/
|
|
233
|
-
'aria-labelledby': PropTypes__default["default"].string,
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Focus the control when it is mounted
|
|
237
|
-
*/
|
|
238
|
-
isAutofocussed: PropTypes__default["default"].bool,
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Remove the currently focused option when the user presses backspace
|
|
242
|
-
*/
|
|
243
|
-
backspaceRemovesValue: PropTypes__default["default"].bool,
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
247
|
-
*/
|
|
248
|
-
components: PropTypes__default["default"].objectOf(PropTypes__default["default"].func),
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Custom method to filter whether an option should be displayed in the menu
|
|
252
|
-
*/
|
|
253
|
-
filterOption: PropTypes__default["default"].func,
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* The id to set on the SelectContainer component
|
|
257
|
-
*/
|
|
258
|
-
containerId: PropTypes__default["default"].string,
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Is the select value clearable
|
|
262
|
-
*/
|
|
263
|
-
isClearable: PropTypes__default["default"].bool,
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Is the select disabled
|
|
267
|
-
*/
|
|
268
|
-
isDisabled: PropTypes__default["default"].bool,
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Is the select read-only
|
|
272
|
-
*/
|
|
273
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
274
|
-
isReadOnly: PropTypes__default["default"].bool,
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Override the built-in logic to detect whether an option is disabled
|
|
278
|
-
*/
|
|
279
|
-
isOptionDisabled: PropTypes__default["default"].func,
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Support multiple selected options
|
|
283
|
-
*/
|
|
284
|
-
isMulti: PropTypes__default["default"].bool,
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Whether to enable search functionality
|
|
288
|
-
*/
|
|
289
|
-
isSearchable: PropTypes__default["default"].bool,
|
|
290
|
-
hasWarning: PropTypes__default["default"].bool,
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Maximum height of the menu before scrolling
|
|
294
|
-
*/
|
|
295
|
-
maxMenuHeight: PropTypes__default["default"].number,
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Dom element to portal the select menu to
|
|
299
|
-
*/
|
|
300
|
-
menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* z-index value for the menu portal
|
|
304
|
-
*/
|
|
305
|
-
menuPortalZIndex: PropTypes__default["default"].number,
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* whether the menu should block scroll while open
|
|
309
|
-
*/
|
|
310
|
-
menuShouldBlockScroll: PropTypes__default["default"].bool,
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
314
|
-
*/
|
|
315
|
-
name: PropTypes__default["default"].string,
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* 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).
|
|
319
|
-
* <br/>
|
|
320
|
-
* Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
|
|
321
|
-
* <br />
|
|
322
|
-
* Signature: `({ inputValue }) => string`
|
|
323
|
-
*/
|
|
324
|
-
noOptionsMessage: PropTypes__default["default"].func,
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Handle blur events on the control
|
|
328
|
-
*/
|
|
329
|
-
onBlur: PropTypes__default["default"].func,
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Called with a fake event when value changes.
|
|
333
|
-
* <br />
|
|
334
|
-
* 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
|
-
* <br />
|
|
336
|
-
* Signature: `(event) => void`
|
|
337
|
-
*/
|
|
338
|
-
onChange: PropTypes__default["default"].func,
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Handle focus events on the control
|
|
342
|
-
*/
|
|
343
|
-
onFocus: PropTypes__default["default"].func,
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Handle change events on the input
|
|
347
|
-
*/
|
|
348
|
-
onInputChange: PropTypes__default["default"].func,
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Array of options that populate the select menu
|
|
352
|
-
*/
|
|
353
|
-
options: PropTypes__default["default"].arrayOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].shape({
|
|
354
|
-
value: PropTypes__default["default"].string.isRequired
|
|
355
|
-
}), PropTypes__default["default"].shape({
|
|
356
|
-
options: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
357
|
-
value: PropTypes__default["default"].string.isRequired
|
|
358
|
-
}))
|
|
359
|
-
})])),
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Placeholder text for the select value
|
|
363
|
-
*/
|
|
364
|
-
placeholder: PropTypes__default["default"].string,
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Sets the tabIndex attribute on the input
|
|
368
|
-
*/
|
|
369
|
-
tabIndex: PropTypes__default["default"].string,
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Select the currently focused option when the user presses tab
|
|
373
|
-
*/
|
|
374
|
-
tabSelectsValue: PropTypes__default["default"].bool,
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* The value of the select; reflected by the selected option
|
|
378
|
-
*/
|
|
379
|
-
value: function value(props) {
|
|
380
|
-
var _context6, _context7;
|
|
381
|
-
|
|
382
|
-
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
383
|
-
rest[_key3 - 1] = arguments[_key3];
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
return props.isMulti ? PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
387
|
-
value: PropTypes__default["default"].string.isRequired
|
|
388
|
-
})).apply(void 0, _concatInstanceProperty__default["default"](_context6 = [props]).call(_context6, rest)) : PropTypes__default["default"].shape({
|
|
389
|
-
value: PropTypes__default["default"].string.isRequired
|
|
390
|
-
}).apply(void 0, _concatInstanceProperty__default["default"](_context7 = [props]).call(_context7, rest));
|
|
391
|
-
},
|
|
392
|
-
showOptionGroupDivider: PropTypes__default["default"].bool,
|
|
393
|
-
// Creatable props
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* 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.
|
|
397
|
-
*/
|
|
398
|
-
allowCreateWhileLoading: PropTypes__default["default"].bool,
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Gets the label for the "create new ..." option in the menu. Is given the current input value.
|
|
402
|
-
*/
|
|
403
|
-
formatCreateLabel: PropTypes__default["default"].func,
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
|
|
407
|
-
*/
|
|
408
|
-
isValidNewOption: PropTypes__default["default"].func,
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
|
|
412
|
-
*/
|
|
413
|
-
getNewOptionData: PropTypes__default["default"].func,
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* 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.
|
|
417
|
-
*/
|
|
418
|
-
onCreateOption: PropTypes__default["default"].func,
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Sets the position of the createOption element in your options list.
|
|
422
|
-
*/
|
|
423
|
-
createOptionPosition: PropTypes__default["default"].string,
|
|
424
|
-
// LabelField
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Title of the label
|
|
428
|
-
*/
|
|
429
|
-
title: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]).isRequired,
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`.
|
|
433
|
-
*/
|
|
434
|
-
hint: requiredIf__default["default"](PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]), function (props) {
|
|
435
|
-
return props.hintIcon;
|
|
436
|
-
}),
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Provides a description for the title.
|
|
440
|
-
*/
|
|
441
|
-
description: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]),
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Function called when info button is pressed.
|
|
445
|
-
* <br />
|
|
446
|
-
* Info button will only be visible when this prop is passed.
|
|
447
|
-
* <br />
|
|
448
|
-
* Signature: `(event) => void`
|
|
449
|
-
*/
|
|
450
|
-
onInfoButtonClick: PropTypes__default["default"].func,
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Icon to be displayed beside the hint text.
|
|
454
|
-
* <br />
|
|
455
|
-
* Will only get rendered when `hint` is passed as well.
|
|
456
|
-
*/
|
|
457
|
-
hintIcon: PropTypes__default["default"].node,
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Badge to be displayed beside the label.
|
|
461
|
-
* <br />
|
|
462
|
-
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
463
|
-
*/
|
|
464
|
-
badge: PropTypes__default["default"].node,
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
468
|
-
*/
|
|
469
|
-
iconLeft: PropTypes__default["default"].node
|
|
192
|
+
horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
193
|
+
errors: _pt__default["default"].objectOf(_pt__default["default"].bool),
|
|
194
|
+
renderError: _pt__default["default"].func,
|
|
195
|
+
isRequired: _pt__default["default"].bool,
|
|
196
|
+
touched: _pt__default["default"].oneOfType([_pt__default["default"].arrayOf(_pt__default["default"].bool), _pt__default["default"].bool]),
|
|
197
|
+
isAutofocussed: _pt__default["default"].bool,
|
|
198
|
+
isReadOnly: _pt__default["default"].any,
|
|
199
|
+
hasWarning: _pt__default["default"].bool,
|
|
200
|
+
menuPortalZIndex: _pt__default["default"].number,
|
|
201
|
+
onBlur: _pt__default["default"].func,
|
|
202
|
+
onChange: _pt__default["default"].func.isRequired,
|
|
203
|
+
options: _pt__default["default"].oneOfType([_pt__default["default"].arrayOf(_pt__default["default"].shape({
|
|
204
|
+
value: _pt__default["default"].string.isRequired
|
|
205
|
+
})), _pt__default["default"].arrayOf(_pt__default["default"].shape({
|
|
206
|
+
options: _pt__default["default"].arrayOf(_pt__default["default"].shape({
|
|
207
|
+
value: _pt__default["default"].string.isRequired
|
|
208
|
+
})).isRequired
|
|
209
|
+
}))]),
|
|
210
|
+
showOptionGroupDivider: _pt__default["default"].bool,
|
|
211
|
+
title: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]).isRequired,
|
|
212
|
+
hint: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
|
|
213
|
+
description: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
|
|
214
|
+
onInfoButtonClick: _pt__default["default"].func,
|
|
215
|
+
hintIcon: _pt__default["default"].element,
|
|
216
|
+
badge: _pt__default["default"].node,
|
|
217
|
+
iconLeft: _pt__default["default"].node
|
|
470
218
|
} : {};
|
|
471
219
|
|
|
472
220
|
// NOTE: This string will be replaced on build time with the package version.
|
|
473
|
-
var version = "13.0.
|
|
221
|
+
var version = "13.0.4";
|
|
474
222
|
|
|
475
223
|
exports["default"] = CreatableSelectField;
|
|
476
224
|
exports.version = version;
|
|
@@ -17,12 +17,12 @@ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
|
17
17
|
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
18
18
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
19
19
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
20
|
+
require('prop-types');
|
|
20
21
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
21
22
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
22
23
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
23
25
|
var react = require('react');
|
|
24
|
-
require('prop-types');
|
|
25
|
-
require('react-required-if');
|
|
26
26
|
var utils = require('@commercetools-uikit/utils');
|
|
27
27
|
var Constraints = require('@commercetools-uikit/constraints');
|
|
28
28
|
var Spacings = require('@commercetools-uikit/spacings');
|
|
@@ -53,12 +53,13 @@ var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
|
|
|
53
53
|
|
|
54
54
|
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; }
|
|
55
55
|
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
56
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
57
57
|
|
|
58
58
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
59
59
|
|
|
60
60
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
61
|
var sequentialId = utils.createSequentialId('creatable-select-field-');
|
|
62
|
+
var sequentialErrorsId = utils.createSequentialId('creatable-select-field-error-')();
|
|
62
63
|
|
|
63
64
|
var hasErrors = function hasErrors(errors) {
|
|
64
65
|
var _context;
|
|
@@ -95,6 +96,11 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
95
96
|
key: "render",
|
|
96
97
|
value: function render() {
|
|
97
98
|
var hasError = CreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
99
|
+
|
|
100
|
+
if (this.props.hintIcon) ;
|
|
101
|
+
|
|
102
|
+
if (this.props.isMulti) ;
|
|
103
|
+
|
|
98
104
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
99
105
|
max: this.props.horizontalConstraint,
|
|
100
106
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
@@ -113,6 +119,8 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
113
119
|
hasError: hasError,
|
|
114
120
|
"aria-label": this.props['aria-label'],
|
|
115
121
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
122
|
+
"aria-invalid": hasError,
|
|
123
|
+
"aria-errormessage": sequentialErrorsId,
|
|
116
124
|
isAutofocussed: this.props.isAutofocussed,
|
|
117
125
|
backspaceRemovesValue: this.props.backspaceRemovesValue,
|
|
118
126
|
components: this.props.components,
|
|
@@ -150,6 +158,7 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
150
158
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
151
159
|
iconLeft: this.props.iconLeft
|
|
152
160
|
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
161
|
+
id: sequentialErrorsId,
|
|
153
162
|
errors: this.props.errors,
|
|
154
163
|
isVisible: hasError,
|
|
155
164
|
renderError: this.props.renderError
|
|
@@ -175,7 +184,7 @@ CreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
175
184
|
CreatableSelectField.propTypes = {};
|
|
176
185
|
|
|
177
186
|
// NOTE: This string will be replaced on build time with the package version.
|
|
178
|
-
var version = "13.0.
|
|
187
|
+
var version = "13.0.4";
|
|
179
188
|
|
|
180
189
|
exports["default"] = CreatableSelectField;
|
|
181
190
|
exports.version = version;
|
|
@@ -13,13 +13,13 @@ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
|
13
13
|
import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
14
14
|
import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
|
|
15
15
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
16
|
+
import _pt from 'prop-types';
|
|
16
17
|
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
17
18
|
import _Object$values from '@babel/runtime-corejs3/core-js-stable/object/values';
|
|
18
19
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { createSequentialId, filterDataAttributes, getFieldId, SafeHTMLElement } from '@commercetools-uikit/utils';
|
|
20
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
21
|
+
import { isValidElement, Component } from 'react';
|
|
22
|
+
import { createSequentialId, warning, filterDataAttributes, getFieldId } from '@commercetools-uikit/utils';
|
|
23
23
|
import Constraints from '@commercetools-uikit/constraints';
|
|
24
24
|
import Spacings from '@commercetools-uikit/spacings';
|
|
25
25
|
import FieldLabel from '@commercetools-uikit/field-label';
|
|
@@ -29,12 +29,13 @@ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
33
|
|
|
34
34
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
35
|
|
|
36
36
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
37
|
var sequentialId = createSequentialId('creatable-select-field-');
|
|
38
|
+
var sequentialErrorsId = createSequentialId('creatable-select-field-error-')();
|
|
38
39
|
|
|
39
40
|
var hasErrors = function hasErrors(errors) {
|
|
40
41
|
var _context;
|
|
@@ -71,6 +72,16 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
71
72
|
key: "render",
|
|
72
73
|
value: function render() {
|
|
73
74
|
var hasError = CreatableSelectInput.isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
75
|
+
|
|
76
|
+
if (this.props.hintIcon) {
|
|
77
|
+
process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'CreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this.props.isMulti) {
|
|
81
|
+
process.env.NODE_ENV !== "production" ? warning(_Array$isArray(this.props.value), 'CreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
82
|
+
process.env.NODE_ENV !== "production" ? warning(_Array$isArray(this.props.touched), 'CreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
74
85
|
return jsx(Constraints.Horizontal, {
|
|
75
86
|
max: this.props.horizontalConstraint,
|
|
76
87
|
children: jsxs(Spacings.Stack, {
|
|
@@ -89,6 +100,8 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
89
100
|
hasError: hasError,
|
|
90
101
|
"aria-label": this.props['aria-label'],
|
|
91
102
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
103
|
+
"aria-invalid": hasError,
|
|
104
|
+
"aria-errormessage": sequentialErrorsId,
|
|
92
105
|
isAutofocussed: this.props.isAutofocussed,
|
|
93
106
|
backspaceRemovesValue: this.props.backspaceRemovesValue,
|
|
94
107
|
components: this.props.components,
|
|
@@ -126,6 +139,7 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
126
139
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
127
140
|
iconLeft: this.props.iconLeft
|
|
128
141
|
}, filterDataAttributes(this.props))), jsx(FieldErrors, {
|
|
142
|
+
id: sequentialErrorsId,
|
|
129
143
|
errors: this.props.errors,
|
|
130
144
|
isVisible: hasError,
|
|
131
145
|
renderError: this.props.renderError
|
|
@@ -149,301 +163,35 @@ CreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
149
163
|
};
|
|
150
164
|
};
|
|
151
165
|
CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
renderError: PropTypes.func,
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
182
|
-
*/
|
|
183
|
-
isRequired: PropTypes.bool,
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
187
|
-
*/
|
|
188
|
-
touched: function touched(props) {
|
|
189
|
-
var _context3, _context4, _context5;
|
|
190
|
-
|
|
191
|
-
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
192
|
-
rest[_key2 - 1] = arguments[_key2];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return props.isMulti ? PropTypes.arrayOf.apply(PropTypes, _concatInstanceProperty(_context3 = [PropTypes.bool]).call(_context3, rest)).apply(void 0, _concatInstanceProperty(_context4 = [props]).call(_context4, rest)) : PropTypes.bool.apply(PropTypes, _concatInstanceProperty(_context5 = [props]).call(_context5, rest));
|
|
196
|
-
},
|
|
197
|
-
// CreatableSelectInput
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Aria label (for assistive tech)
|
|
201
|
-
*/
|
|
202
|
-
'aria-label': PropTypes.string,
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
206
|
-
*/
|
|
207
|
-
'aria-labelledby': PropTypes.string,
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Focus the control when it is mounted
|
|
211
|
-
*/
|
|
212
|
-
isAutofocussed: PropTypes.bool,
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Remove the currently focused option when the user presses backspace
|
|
216
|
-
*/
|
|
217
|
-
backspaceRemovesValue: PropTypes.bool,
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
221
|
-
*/
|
|
222
|
-
components: PropTypes.objectOf(PropTypes.func),
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Custom method to filter whether an option should be displayed in the menu
|
|
226
|
-
*/
|
|
227
|
-
filterOption: PropTypes.func,
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* The id to set on the SelectContainer component
|
|
231
|
-
*/
|
|
232
|
-
containerId: PropTypes.string,
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Is the select value clearable
|
|
236
|
-
*/
|
|
237
|
-
isClearable: PropTypes.bool,
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Is the select disabled
|
|
241
|
-
*/
|
|
242
|
-
isDisabled: PropTypes.bool,
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Is the select read-only
|
|
246
|
-
*/
|
|
247
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
248
|
-
isReadOnly: PropTypes.bool,
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Override the built-in logic to detect whether an option is disabled
|
|
252
|
-
*/
|
|
253
|
-
isOptionDisabled: PropTypes.func,
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Support multiple selected options
|
|
257
|
-
*/
|
|
258
|
-
isMulti: PropTypes.bool,
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Whether to enable search functionality
|
|
262
|
-
*/
|
|
263
|
-
isSearchable: PropTypes.bool,
|
|
264
|
-
hasWarning: PropTypes.bool,
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Maximum height of the menu before scrolling
|
|
268
|
-
*/
|
|
269
|
-
maxMenuHeight: PropTypes.number,
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Dom element to portal the select menu to
|
|
273
|
-
*/
|
|
274
|
-
menuPortalTarget: PropTypes.instanceOf(SafeHTMLElement),
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* z-index value for the menu portal
|
|
278
|
-
*/
|
|
279
|
-
menuPortalZIndex: PropTypes.number,
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* whether the menu should block scroll while open
|
|
283
|
-
*/
|
|
284
|
-
menuShouldBlockScroll: PropTypes.bool,
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
288
|
-
*/
|
|
289
|
-
name: PropTypes.string,
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* 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).
|
|
293
|
-
* <br/>
|
|
294
|
-
* Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
|
|
295
|
-
* <br />
|
|
296
|
-
* Signature: `({ inputValue }) => string`
|
|
297
|
-
*/
|
|
298
|
-
noOptionsMessage: PropTypes.func,
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Handle blur events on the control
|
|
302
|
-
*/
|
|
303
|
-
onBlur: PropTypes.func,
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* Called with a fake event when value changes.
|
|
307
|
-
* <br />
|
|
308
|
-
* 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`.
|
|
309
|
-
* <br />
|
|
310
|
-
* Signature: `(event) => void`
|
|
311
|
-
*/
|
|
312
|
-
onChange: PropTypes.func,
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Handle focus events on the control
|
|
316
|
-
*/
|
|
317
|
-
onFocus: PropTypes.func,
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Handle change events on the input
|
|
321
|
-
*/
|
|
322
|
-
onInputChange: PropTypes.func,
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Array of options that populate the select menu
|
|
326
|
-
*/
|
|
327
|
-
options: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
|
|
328
|
-
value: PropTypes.string.isRequired
|
|
329
|
-
}), PropTypes.shape({
|
|
330
|
-
options: PropTypes.arrayOf(PropTypes.shape({
|
|
331
|
-
value: PropTypes.string.isRequired
|
|
332
|
-
}))
|
|
333
|
-
})])),
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Placeholder text for the select value
|
|
337
|
-
*/
|
|
338
|
-
placeholder: PropTypes.string,
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Sets the tabIndex attribute on the input
|
|
342
|
-
*/
|
|
343
|
-
tabIndex: PropTypes.string,
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Select the currently focused option when the user presses tab
|
|
347
|
-
*/
|
|
348
|
-
tabSelectsValue: PropTypes.bool,
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* The value of the select; reflected by the selected option
|
|
352
|
-
*/
|
|
353
|
-
value: function value(props) {
|
|
354
|
-
var _context6, _context7;
|
|
355
|
-
|
|
356
|
-
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
357
|
-
rest[_key3 - 1] = arguments[_key3];
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return props.isMulti ? PropTypes.arrayOf(PropTypes.shape({
|
|
361
|
-
value: PropTypes.string.isRequired
|
|
362
|
-
})).apply(void 0, _concatInstanceProperty(_context6 = [props]).call(_context6, rest)) : PropTypes.shape({
|
|
363
|
-
value: PropTypes.string.isRequired
|
|
364
|
-
}).apply(void 0, _concatInstanceProperty(_context7 = [props]).call(_context7, rest));
|
|
365
|
-
},
|
|
366
|
-
showOptionGroupDivider: PropTypes.bool,
|
|
367
|
-
// Creatable props
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* 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.
|
|
371
|
-
*/
|
|
372
|
-
allowCreateWhileLoading: PropTypes.bool,
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Gets the label for the "create new ..." option in the menu. Is given the current input value.
|
|
376
|
-
*/
|
|
377
|
-
formatCreateLabel: PropTypes.func,
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
|
|
381
|
-
*/
|
|
382
|
-
isValidNewOption: PropTypes.func,
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
|
|
386
|
-
*/
|
|
387
|
-
getNewOptionData: PropTypes.func,
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* 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.
|
|
391
|
-
*/
|
|
392
|
-
onCreateOption: PropTypes.func,
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Sets the position of the createOption element in your options list.
|
|
396
|
-
*/
|
|
397
|
-
createOptionPosition: PropTypes.string,
|
|
398
|
-
// LabelField
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Title of the label
|
|
402
|
-
*/
|
|
403
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`.
|
|
407
|
-
*/
|
|
408
|
-
hint: requiredIf(PropTypes.oneOfType([PropTypes.string, PropTypes.node]), function (props) {
|
|
409
|
-
return props.hintIcon;
|
|
410
|
-
}),
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Provides a description for the title.
|
|
414
|
-
*/
|
|
415
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Function called when info button is pressed.
|
|
419
|
-
* <br />
|
|
420
|
-
* Info button will only be visible when this prop is passed.
|
|
421
|
-
* <br />
|
|
422
|
-
* Signature: `(event) => void`
|
|
423
|
-
*/
|
|
424
|
-
onInfoButtonClick: PropTypes.func,
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Icon to be displayed beside the hint text.
|
|
428
|
-
* <br />
|
|
429
|
-
* Will only get rendered when `hint` is passed as well.
|
|
430
|
-
*/
|
|
431
|
-
hintIcon: PropTypes.node,
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Badge to be displayed beside the label.
|
|
435
|
-
* <br />
|
|
436
|
-
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
437
|
-
*/
|
|
438
|
-
badge: PropTypes.node,
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
442
|
-
*/
|
|
443
|
-
iconLeft: PropTypes.node
|
|
166
|
+
horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
167
|
+
errors: _pt.objectOf(_pt.bool),
|
|
168
|
+
renderError: _pt.func,
|
|
169
|
+
isRequired: _pt.bool,
|
|
170
|
+
touched: _pt.oneOfType([_pt.arrayOf(_pt.bool), _pt.bool]),
|
|
171
|
+
isAutofocussed: _pt.bool,
|
|
172
|
+
isReadOnly: _pt.any,
|
|
173
|
+
hasWarning: _pt.bool,
|
|
174
|
+
menuPortalZIndex: _pt.number,
|
|
175
|
+
onBlur: _pt.func,
|
|
176
|
+
onChange: _pt.func.isRequired,
|
|
177
|
+
options: _pt.oneOfType([_pt.arrayOf(_pt.shape({
|
|
178
|
+
value: _pt.string.isRequired
|
|
179
|
+
})), _pt.arrayOf(_pt.shape({
|
|
180
|
+
options: _pt.arrayOf(_pt.shape({
|
|
181
|
+
value: _pt.string.isRequired
|
|
182
|
+
})).isRequired
|
|
183
|
+
}))]),
|
|
184
|
+
showOptionGroupDivider: _pt.bool,
|
|
185
|
+
title: _pt.oneOfType([_pt.string, _pt.node]).isRequired,
|
|
186
|
+
hint: _pt.oneOfType([_pt.string, _pt.node]),
|
|
187
|
+
description: _pt.oneOfType([_pt.string, _pt.node]),
|
|
188
|
+
onInfoButtonClick: _pt.func,
|
|
189
|
+
hintIcon: _pt.element,
|
|
190
|
+
badge: _pt.node,
|
|
191
|
+
iconLeft: _pt.node
|
|
444
192
|
} : {};
|
|
445
193
|
|
|
446
194
|
// NOTE: This string will be replaced on build time with the package version.
|
|
447
|
-
var version = "13.0.
|
|
195
|
+
var version = "13.0.4";
|
|
448
196
|
|
|
449
197
|
export { CreatableSelectField as default, version };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Component, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { GroupBase, ActionMeta } from 'react-select';
|
|
3
|
+
import type { CreatableProps } from 'react-select/creatable';
|
|
4
|
+
declare type ReactSelectCreatableProps = CreatableProps<unknown, boolean, GroupBase<unknown>>;
|
|
5
|
+
declare type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
6
|
+
declare type TFieldErrors = Record<string, boolean>;
|
|
7
|
+
declare type TValue = {
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
declare type TOptions = TValue[] | {
|
|
11
|
+
options: TValue[];
|
|
12
|
+
}[];
|
|
13
|
+
declare type TEvent = {
|
|
14
|
+
target: {
|
|
15
|
+
name?: string;
|
|
16
|
+
value?: unknown;
|
|
17
|
+
};
|
|
18
|
+
persist?: () => void;
|
|
19
|
+
};
|
|
20
|
+
declare type TCreatableSelectFieldProps = {
|
|
21
|
+
id?: ReactSelectCreatableProps['inputId'];
|
|
22
|
+
horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
23
|
+
errors?: TFieldErrors;
|
|
24
|
+
renderError?: TErrorRenderer;
|
|
25
|
+
isRequired?: boolean;
|
|
26
|
+
touched?: boolean[] | boolean;
|
|
27
|
+
'aria-label'?: ReactSelectCreatableProps['aria-label'];
|
|
28
|
+
'aria-labelledby'?: ReactSelectCreatableProps['aria-label'];
|
|
29
|
+
isAutofocussed?: boolean;
|
|
30
|
+
backspaceRemovesValue?: ReactSelectCreatableProps['backspaceRemovesValue'];
|
|
31
|
+
components?: ReactSelectCreatableProps['components'];
|
|
32
|
+
filterOption?: ReactSelectCreatableProps['filterOption'];
|
|
33
|
+
containerId?: ReactSelectCreatableProps['id'];
|
|
34
|
+
isClearable?: ReactSelectCreatableProps['isClearable'];
|
|
35
|
+
isDisabled?: ReactSelectCreatableProps['isDisabled'];
|
|
36
|
+
isReadOnly?: ConstrainBooleanParameters;
|
|
37
|
+
isOptionDisabled?: ReactSelectCreatableProps['isOptionDisabled'];
|
|
38
|
+
isMulti?: ReactSelectCreatableProps['isMulti'];
|
|
39
|
+
isSearchable?: ReactSelectCreatableProps['isSearchable'];
|
|
40
|
+
hasWarning?: boolean;
|
|
41
|
+
maxMenuHeight?: ReactSelectCreatableProps['maxMenuHeight'];
|
|
42
|
+
menuPortalTarget?: ReactSelectCreatableProps['menuPortalTarget'];
|
|
43
|
+
menuPortalZIndex?: number;
|
|
44
|
+
menuShouldBlockScroll?: ReactSelectCreatableProps['menuShouldBlockScroll'];
|
|
45
|
+
name?: ReactSelectCreatableProps['name'];
|
|
46
|
+
noOptionsMessage?: ReactSelectCreatableProps['noOptionsMessage'];
|
|
47
|
+
onBlur?: (event: TEvent) => void;
|
|
48
|
+
onChange: (event: TEvent, info: ActionMeta<unknown>) => void;
|
|
49
|
+
onFocus?: ReactSelectCreatableProps['onFocus'];
|
|
50
|
+
onInputChange?: ReactSelectCreatableProps['onInputChange'];
|
|
51
|
+
options?: TOptions;
|
|
52
|
+
placeholder?: ReactSelectCreatableProps['placeholder'];
|
|
53
|
+
tabIndex?: ReactSelectCreatableProps['tabIndex'];
|
|
54
|
+
tabSelectsValue?: ReactSelectCreatableProps['tabSelectsValue'];
|
|
55
|
+
value?: ReactSelectCreatableProps['value'];
|
|
56
|
+
showOptionGroupDivider?: boolean;
|
|
57
|
+
allowCreateWhileLoading?: ReactSelectCreatableProps['allowCreateWhileLoading'];
|
|
58
|
+
formatCreateLabel?: ReactSelectCreatableProps['formatCreateLabel'];
|
|
59
|
+
isValidNewOption?: ReactSelectCreatableProps['isValidNewOption'];
|
|
60
|
+
getNewOptionData?: ReactSelectCreatableProps['getNewOptionData'];
|
|
61
|
+
onCreateOption?: ReactSelectCreatableProps['onCreateOption'];
|
|
62
|
+
createOptionPosition?: ReactSelectCreatableProps['createOptionPosition'];
|
|
63
|
+
title: string | ReactNode;
|
|
64
|
+
hint?: string | ReactNode;
|
|
65
|
+
description?: string | ReactNode;
|
|
66
|
+
onInfoButtonClick?: () => void;
|
|
67
|
+
hintIcon?: ReactElement;
|
|
68
|
+
badge?: ReactNode;
|
|
69
|
+
iconLeft?: ReactNode;
|
|
70
|
+
};
|
|
71
|
+
declare type TCreatableSelectFieldState = Pick<TCreatableSelectFieldProps, 'id'>;
|
|
72
|
+
export default class CreatableSelectField extends Component<TCreatableSelectFieldProps, TCreatableSelectFieldState> {
|
|
73
|
+
static displayName: string;
|
|
74
|
+
static defaultProps: {
|
|
75
|
+
horizontalConstraint: string;
|
|
76
|
+
};
|
|
77
|
+
state: {
|
|
78
|
+
id: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
static getDerivedStateFromProps: (props: TCreatableSelectFieldProps, state: TCreatableSelectFieldState) => {
|
|
81
|
+
id: string;
|
|
82
|
+
};
|
|
83
|
+
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/creatable-select-field",
|
|
3
3
|
"description": "A controlled input component with validation states and a label getting a selection from the user, and where options can also be created by the user.",
|
|
4
|
-
"version": "13.0.
|
|
4
|
+
"version": "13.0.4",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "7.17.2",
|
|
23
23
|
"@babel/runtime-corejs3": "7.17.2",
|
|
24
|
-
"@commercetools-uikit/constraints": "13.0.
|
|
25
|
-
"@commercetools-uikit/creatable-select-input": "13.0.
|
|
24
|
+
"@commercetools-uikit/constraints": "13.0.2",
|
|
25
|
+
"@commercetools-uikit/creatable-select-input": "13.0.4",
|
|
26
26
|
"@commercetools-uikit/design-system": "13.0.0",
|
|
27
|
-
"@commercetools-uikit/field-errors": "13.0.
|
|
28
|
-
"@commercetools-uikit/field-label": "13.0.
|
|
29
|
-
"@commercetools-uikit/spacings": "13.0.
|
|
30
|
-
"@commercetools-uikit/utils": "
|
|
27
|
+
"@commercetools-uikit/field-errors": "13.0.4",
|
|
28
|
+
"@commercetools-uikit/field-label": "13.0.4",
|
|
29
|
+
"@commercetools-uikit/spacings": "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
|
"prop-types": "15.8.1",
|
|
34
|
-
"react-
|
|
34
|
+
"react-intl": "^5.24.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"react": "17.0.2"
|