@commercetools-uikit/async-creatable-select-field 12.2.6 → 13.0.1
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 +79 -61
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.d.ts +2 -0
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.dev.js +37 -326
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.prod.js +11 -7
- package/dist/commercetools-uikit-async-creatable-select-field.esm.js +37 -326
- package/dist/declarations/src/async-creatable-select-field.d.ts +79 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/package.json +11 -11
|
@@ -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';
|
|
@@ -27,9 +27,9 @@ import AsyncCreatableSelectInput from '@commercetools-uikit/async-creatable-sele
|
|
|
27
27
|
import FieldErrors from '@commercetools-uikit/field-errors';
|
|
28
28
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
29
29
|
|
|
30
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object);
|
|
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 source = arguments[i]
|
|
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
|
|
|
@@ -71,6 +71,16 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
71
71
|
key: "render",
|
|
72
72
|
value: function render() {
|
|
73
73
|
var hasError = AsyncCreatableSelectInput.isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
74
|
+
|
|
75
|
+
if (this.props.hintIcon) {
|
|
76
|
+
process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'TextField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (this.props.isMulti) {
|
|
80
|
+
process.env.NODE_ENV !== "production" ? warning(_Array$isArray(this.props.value), 'AsyncCreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
81
|
+
process.env.NODE_ENV !== "production" ? warning(_Array$isArray(this.props.touched), 'AsyncCreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
74
84
|
return jsx(Constraints.Horizontal, {
|
|
75
85
|
max: this.props.horizontalConstraint,
|
|
76
86
|
children: jsxs(Spacings.Stack, {
|
|
@@ -105,14 +115,13 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
105
115
|
maxMenuHeight: this.props.maxMenuHeight,
|
|
106
116
|
menuPortalTarget: this.props.menuPortalTarget,
|
|
107
117
|
menuPortalZIndex: this.props.menuPortalZIndex,
|
|
108
|
-
|
|
118
|
+
menuShouldBlockScroll: this.props.menuShouldBlockScroll,
|
|
109
119
|
name: this.props.name,
|
|
110
120
|
noOptionsMessage: this.props.noOptionsMessage,
|
|
111
121
|
onBlur: this.props.onBlur,
|
|
112
122
|
onChange: this.props.onChange,
|
|
113
123
|
onFocus: this.props.onFocus,
|
|
114
124
|
onInputChange: this.props.onInputChange,
|
|
115
|
-
options: this.props.options,
|
|
116
125
|
placeholder: this.props.placeholder,
|
|
117
126
|
tabIndex: this.props.tabIndex,
|
|
118
127
|
tabSelectsValue: this.props.tabSelectsValue,
|
|
@@ -154,326 +163,28 @@ AsyncCreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
154
163
|
};
|
|
155
164
|
};
|
|
156
165
|
AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}),
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* 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.
|
|
180
|
-
* <br />
|
|
181
|
-
* Signature: `(key, error) => React.node`
|
|
182
|
-
*/
|
|
183
|
-
renderError: PropTypes.func,
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
187
|
-
*/
|
|
188
|
-
isRequired: PropTypes.bool,
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
192
|
-
*/
|
|
193
|
-
touched: function touched(props) {
|
|
194
|
-
var _context3, _context4, _context5;
|
|
195
|
-
|
|
196
|
-
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
197
|
-
rest[_key2 - 1] = arguments[_key2];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
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));
|
|
201
|
-
},
|
|
202
|
-
// AsyncCreatableSelectInput
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Aria label (for assistive tech)
|
|
206
|
-
*/
|
|
207
|
-
'aria-label': PropTypes.string,
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
211
|
-
*/
|
|
212
|
-
'aria-labelledby': PropTypes.string,
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Focus the control when it is mounted
|
|
216
|
-
*/
|
|
217
|
-
isAutofocussed: PropTypes.bool,
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Remove the currently focused option when the user presses backspace
|
|
221
|
-
*/
|
|
222
|
-
backspaceRemovesValue: PropTypes.bool,
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
226
|
-
*/
|
|
227
|
-
components: PropTypes.objectOf(PropTypes.func),
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Custom method to filter whether an option should be displayed in the menu
|
|
231
|
-
*/
|
|
232
|
-
filterOption: PropTypes.func,
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* The id to set on the SelectContainer component
|
|
236
|
-
*/
|
|
237
|
-
containerId: PropTypes.string,
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Is the select value clearable
|
|
241
|
-
*/
|
|
242
|
-
isClearable: PropTypes.bool,
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Is the select disabled
|
|
246
|
-
*/
|
|
247
|
-
isDisabled: PropTypes.bool,
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Is the select read-only
|
|
251
|
-
*/
|
|
252
|
-
isReadOnly: PropTypes.bool,
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Override the built-in logic to detect whether an option is disabled
|
|
256
|
-
* <br />
|
|
257
|
-
* Signature: `(option, options) => boolean`
|
|
258
|
-
*/
|
|
259
|
-
isOptionDisabled: PropTypes.func,
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Support multiple selected options
|
|
263
|
-
*/
|
|
264
|
-
isMulti: PropTypes.bool,
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Whether to enable search functionality
|
|
268
|
-
*/
|
|
269
|
-
isSearchable: PropTypes.bool,
|
|
270
|
-
hasWarning: PropTypes.bool,
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Maximum height of the menu before scrolling
|
|
274
|
-
*/
|
|
275
|
-
maxMenuHeight: PropTypes.number,
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Dom element to portal the select menu to
|
|
279
|
-
*/
|
|
280
|
-
menuPortalTarget: PropTypes.instanceOf(SafeHTMLElement),
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* z-index value for the menu portal
|
|
284
|
-
*/
|
|
285
|
-
menuPortalZIndex: PropTypes.number,
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* whether the menu should block scroll while open
|
|
289
|
-
*/
|
|
290
|
-
menuShouldBlockScroll: PropTypes.bool,
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
294
|
-
*/
|
|
295
|
-
name: PropTypes.string,
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* 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).
|
|
299
|
-
* <br/>
|
|
300
|
-
* Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
|
|
301
|
-
* <br />
|
|
302
|
-
* Signature: `({ inputValue }) => string`
|
|
303
|
-
*/
|
|
304
|
-
noOptionsMessage: PropTypes.func,
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Handle blur events on the control
|
|
308
|
-
*/
|
|
309
|
-
onBlur: PropTypes.func,
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Called with a fake event when value changes.
|
|
313
|
-
* <br />
|
|
314
|
-
* 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`.
|
|
315
|
-
* <br />
|
|
316
|
-
* Signature: `(event) => void`
|
|
317
|
-
*/
|
|
318
|
-
onChange: PropTypes.func,
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Handle focus events on the control
|
|
322
|
-
*/
|
|
323
|
-
onFocus: PropTypes.func,
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Handle change events on the input
|
|
327
|
-
*/
|
|
328
|
-
onInputChange: PropTypes.func,
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Array of options that populate the select menu
|
|
332
|
-
*/
|
|
333
|
-
options: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
|
|
334
|
-
value: PropTypes.string.isRequired
|
|
335
|
-
}), PropTypes.shape({
|
|
336
|
-
options: PropTypes.arrayOf(PropTypes.shape({
|
|
337
|
-
value: PropTypes.string.isRequired
|
|
338
|
-
}))
|
|
339
|
-
})])),
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Placeholder text for the select value
|
|
343
|
-
*/
|
|
344
|
-
placeholder: PropTypes.string,
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Sets the tabIndex attribute on the input
|
|
348
|
-
*/
|
|
349
|
-
tabIndex: PropTypes.string,
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Select the currently focused option when the user presses tab
|
|
353
|
-
*/
|
|
354
|
-
tabSelectsValue: PropTypes.bool,
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* The value of the select; reflected by the selected option
|
|
358
|
-
*/
|
|
359
|
-
value: function value(props) {
|
|
360
|
-
var _context6, _context7;
|
|
361
|
-
|
|
362
|
-
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
363
|
-
rest[_key3 - 1] = arguments[_key3];
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return props.isMulti ? PropTypes.arrayOf(PropTypes.shape({
|
|
367
|
-
value: PropTypes.string.isRequired
|
|
368
|
-
})).apply(void 0, _concatInstanceProperty(_context6 = [props]).call(_context6, rest)) : PropTypes.shape({
|
|
369
|
-
value: PropTypes.string.isRequired
|
|
370
|
-
}).apply(void 0, _concatInstanceProperty(_context7 = [props]).call(_context7, rest));
|
|
371
|
-
},
|
|
372
|
-
showOptionGroupDivider: PropTypes.bool,
|
|
373
|
-
// Async props
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* The default set of options to show before the user starts searching.
|
|
377
|
-
* <br/>
|
|
378
|
-
* When set to `true`, the results for `loadOptions('')` will be autoloaded.
|
|
379
|
-
*/
|
|
380
|
-
defaultOptions: PropTypes.oneOfType([PropTypes.bool, PropTypes.arrayOf(PropTypes.shape({
|
|
381
|
-
value: PropTypes.string.isRequired
|
|
382
|
-
}))]),
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Function that returns a promise, which is the set of options to be used once the promise resolves.
|
|
386
|
-
* <br />
|
|
387
|
-
* Signature: `(inputValue, callback) => void)) => Promise | void`
|
|
388
|
-
* <br />
|
|
389
|
-
* `callback` can be called with `options`
|
|
390
|
-
*/
|
|
391
|
-
loadOptions: PropTypes.func.isRequired,
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
|
|
395
|
-
*/
|
|
396
|
-
cacheOptions: PropTypes.any,
|
|
397
|
-
// Creatable props
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Allow options to be created while the isLoading prop is true. Useful to prevent the "create new ..." option being displayed while async results are still being loaded.
|
|
401
|
-
*/
|
|
402
|
-
allowCreateWhileLoading: PropTypes.bool,
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* Gets the label for the "create new ..." option in the menu. Is given the current input value.
|
|
406
|
-
*/
|
|
407
|
-
formatCreateLabel: PropTypes.func,
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
|
|
411
|
-
*/
|
|
412
|
-
isValidNewOption: PropTypes.func,
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
|
|
416
|
-
*/
|
|
417
|
-
getNewOptionData: PropTypes.func,
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created.
|
|
421
|
-
*/
|
|
422
|
-
onCreateOption: PropTypes.func,
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Sets the position of the createOption element in your options list.
|
|
426
|
-
*/
|
|
427
|
-
createOptionPosition: PropTypes.string,
|
|
428
|
-
// LabelField
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Title of the label
|
|
432
|
-
*/
|
|
433
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* 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`.
|
|
437
|
-
*/
|
|
438
|
-
hint: requiredIf(PropTypes.oneOfType([PropTypes.string, PropTypes.node]), function (props) {
|
|
439
|
-
return props.hintIcon;
|
|
440
|
-
}),
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Provides a description for the title.
|
|
444
|
-
*/
|
|
445
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Function called when info button is pressed.
|
|
449
|
-
* <br />
|
|
450
|
-
* Info button will only be visible when this prop is passed.
|
|
451
|
-
* <br />
|
|
452
|
-
* Signature: `(event) => void`
|
|
453
|
-
*/
|
|
454
|
-
onInfoButtonClick: PropTypes.func,
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Icon to be displayed beside the hint text.
|
|
458
|
-
* <br />
|
|
459
|
-
* Will only get rendered when `hint` is passed as well.
|
|
460
|
-
*/
|
|
461
|
-
hintIcon: PropTypes.node,
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Badge to be displayed beside the label.
|
|
465
|
-
* <br />
|
|
466
|
-
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
467
|
-
*/
|
|
468
|
-
badge: PropTypes.node,
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
472
|
-
*/
|
|
473
|
-
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.bool,
|
|
173
|
+
hasWarning: _pt.bool,
|
|
174
|
+
menuPortalZIndex: _pt.number,
|
|
175
|
+
onBlur: _pt.func,
|
|
176
|
+
onChange: _pt.func.isRequired,
|
|
177
|
+
showOptionGroupDivider: _pt.bool,
|
|
178
|
+
title: _pt.oneOfType([_pt.string, _pt.node]).isRequired,
|
|
179
|
+
hint: _pt.oneOfType([_pt.string, _pt.node]),
|
|
180
|
+
description: _pt.oneOfType([_pt.string, _pt.node]),
|
|
181
|
+
onInfoButtonClick: _pt.func,
|
|
182
|
+
hintIcon: _pt.element,
|
|
183
|
+
badge: _pt.node,
|
|
184
|
+
iconLeft: _pt.node
|
|
474
185
|
} : {};
|
|
475
186
|
|
|
476
187
|
// NOTE: This string will be replaced on build time with the package version.
|
|
477
|
-
var version = "
|
|
188
|
+
var version = "13.0.1";
|
|
478
189
|
|
|
479
190
|
export { AsyncCreatableSelectField as default, version };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Component, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { GroupBase, ActionMeta } from 'react-select';
|
|
3
|
+
import type { AsyncCreatableProps } from 'react-select/async-creatable';
|
|
4
|
+
declare type ReactSelectAsyncCreatableProps = AsyncCreatableProps<unknown, boolean, GroupBase<unknown>>;
|
|
5
|
+
declare type TFieldErrors = Record<string, boolean>;
|
|
6
|
+
declare type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
7
|
+
declare type TEvent = {
|
|
8
|
+
target: {
|
|
9
|
+
name?: string;
|
|
10
|
+
value?: unknown;
|
|
11
|
+
};
|
|
12
|
+
persist: () => void;
|
|
13
|
+
};
|
|
14
|
+
declare type TAsyncCreatableSelectFieldProps = {
|
|
15
|
+
id?: ReactSelectAsyncCreatableProps['inputId'];
|
|
16
|
+
horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
17
|
+
errors?: TFieldErrors;
|
|
18
|
+
renderError?: TErrorRenderer;
|
|
19
|
+
isRequired?: boolean;
|
|
20
|
+
touched?: boolean[] | boolean;
|
|
21
|
+
'aria-label'?: ReactSelectAsyncCreatableProps['aria-label'];
|
|
22
|
+
'aria-labelledby'?: ReactSelectAsyncCreatableProps['aria-labelledby'];
|
|
23
|
+
isAutofocussed?: boolean;
|
|
24
|
+
backspaceRemovesValue?: ReactSelectAsyncCreatableProps['backspaceRemovesValue'];
|
|
25
|
+
components?: ReactSelectAsyncCreatableProps['components'];
|
|
26
|
+
filterOption?: ReactSelectAsyncCreatableProps['filterOption'];
|
|
27
|
+
containerId?: ReactSelectAsyncCreatableProps['id'];
|
|
28
|
+
isClearable?: ReactSelectAsyncCreatableProps['isClearable'];
|
|
29
|
+
isDisabled?: ReactSelectAsyncCreatableProps['isDisabled'];
|
|
30
|
+
isReadOnly?: boolean;
|
|
31
|
+
isOptionDisabled?: ReactSelectAsyncCreatableProps['isOptionDisabled'];
|
|
32
|
+
isMulti?: ReactSelectAsyncCreatableProps['isMulti'];
|
|
33
|
+
isSearchable?: ReactSelectAsyncCreatableProps['isSearchable'];
|
|
34
|
+
hasWarning?: boolean;
|
|
35
|
+
maxMenuHeight?: ReactSelectAsyncCreatableProps['maxMenuHeight'];
|
|
36
|
+
menuPortalTarget?: ReactSelectAsyncCreatableProps['menuPortalTarget'];
|
|
37
|
+
menuPortalZIndex?: number;
|
|
38
|
+
menuShouldBlockScroll?: ReactSelectAsyncCreatableProps['menuShouldBlockScroll'];
|
|
39
|
+
name?: ReactSelectAsyncCreatableProps['name'];
|
|
40
|
+
noOptionsMessage?: ReactSelectAsyncCreatableProps['noOptionsMessage'];
|
|
41
|
+
onBlur?: (event: TEvent) => void;
|
|
42
|
+
onChange: (event: TEvent, info: ActionMeta<unknown>) => void;
|
|
43
|
+
onFocus?: ReactSelectAsyncCreatableProps['onFocus'];
|
|
44
|
+
onInputChange?: ReactSelectAsyncCreatableProps['onInputChange'];
|
|
45
|
+
placeholder?: ReactSelectAsyncCreatableProps['placeholder'];
|
|
46
|
+
tabIndex?: ReactSelectAsyncCreatableProps['tabIndex'];
|
|
47
|
+
tabSelectsValue?: ReactSelectAsyncCreatableProps['tabSelectsValue'];
|
|
48
|
+
value?: ReactSelectAsyncCreatableProps['value'];
|
|
49
|
+
showOptionGroupDivider?: boolean;
|
|
50
|
+
defaultOptions?: ReactSelectAsyncCreatableProps['defaultOptions'];
|
|
51
|
+
loadOptions: ReactSelectAsyncCreatableProps['loadOptions'];
|
|
52
|
+
cacheOptions?: ReactSelectAsyncCreatableProps['cacheOptions'];
|
|
53
|
+
allowCreateWhileLoading?: ReactSelectAsyncCreatableProps['allowCreateWhileLoading'];
|
|
54
|
+
formatCreateLabel?: ReactSelectAsyncCreatableProps['formatCreateLabel'];
|
|
55
|
+
isValidNewOption?: ReactSelectAsyncCreatableProps['isValidNewOption'];
|
|
56
|
+
getNewOptionData?: ReactSelectAsyncCreatableProps['getNewOptionData'];
|
|
57
|
+
onCreateOption?: ReactSelectAsyncCreatableProps['onCreateOption'];
|
|
58
|
+
createOptionPosition?: ReactSelectAsyncCreatableProps['createOptionPosition'];
|
|
59
|
+
title: string | ReactNode;
|
|
60
|
+
hint?: string | ReactNode;
|
|
61
|
+
description?: string | ReactNode;
|
|
62
|
+
onInfoButtonClick?: () => void;
|
|
63
|
+
hintIcon?: ReactElement;
|
|
64
|
+
badge?: ReactNode;
|
|
65
|
+
iconLeft?: ReactNode;
|
|
66
|
+
};
|
|
67
|
+
declare type TAsyncCreatableSelectFieldState = Pick<TAsyncCreatableSelectFieldProps, 'id'>;
|
|
68
|
+
export default class AsyncCreatableSelectField extends Component<TAsyncCreatableSelectFieldProps, TAsyncCreatableSelectFieldState> {
|
|
69
|
+
static displayName: string;
|
|
70
|
+
static defaultProps: Pick<TAsyncCreatableSelectFieldProps, 'horizontalConstraint'>;
|
|
71
|
+
state: {
|
|
72
|
+
id: string | undefined;
|
|
73
|
+
};
|
|
74
|
+
static getDerivedStateFromProps: (props: TAsyncCreatableSelectFieldProps, state: TAsyncCreatableSelectFieldState) => {
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
77
|
+
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
78
|
+
}
|
|
79
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/async-creatable-select-field",
|
|
3
3
|
"description": "An input component with validation states and a label getting a selection from an asynchronously loaded list from the user, and where options can be created by the user.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "13.0.1",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"module": "dist/commercetools-uikit-async-creatable-select-field.esm.js",
|
|
20
20
|
"files": ["dist"],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@babel/runtime": "7.
|
|
23
|
-
"@babel/runtime-corejs3": "7.
|
|
24
|
-
"@commercetools-uikit/async-creatable-select-input": "
|
|
25
|
-
"@commercetools-uikit/constraints": "
|
|
26
|
-
"@commercetools-uikit/design-system": "
|
|
27
|
-
"@commercetools-uikit/field-errors": "
|
|
28
|
-
"@commercetools-uikit/field-label": "
|
|
29
|
-
"@commercetools-uikit/spacings": "
|
|
30
|
-
"@commercetools-uikit/utils": "12.2.
|
|
22
|
+
"@babel/runtime": "7.17.2",
|
|
23
|
+
"@babel/runtime-corejs3": "7.17.2",
|
|
24
|
+
"@commercetools-uikit/async-creatable-select-input": "13.0.1",
|
|
25
|
+
"@commercetools-uikit/constraints": "13.0.0",
|
|
26
|
+
"@commercetools-uikit/design-system": "13.0.0",
|
|
27
|
+
"@commercetools-uikit/field-errors": "13.0.0",
|
|
28
|
+
"@commercetools-uikit/field-label": "13.0.1",
|
|
29
|
+
"@commercetools-uikit/spacings": "13.0.1",
|
|
30
|
+
"@commercetools-uikit/utils": "12.2.9",
|
|
31
31
|
"@emotion/react": "^11.4.0",
|
|
32
32
|
"@emotion/styled": "^11.3.0",
|
|
33
|
-
"prop-types": "15.
|
|
33
|
+
"prop-types": "15.8.1",
|
|
34
34
|
"react-required-if": "1.0.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|