@commercetools-uikit/async-creatable-select-field 12.2.3 → 12.2.7
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.
|
@@ -53,19 +53,19 @@ var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
|
|
|
53
53
|
var AsyncCreatableSelectInput__default = /*#__PURE__*/_interopDefault(AsyncCreatableSelectInput);
|
|
54
54
|
var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
|
|
55
55
|
|
|
56
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
56
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
57
57
|
|
|
58
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context8; _forEachInstanceProperty__default[
|
|
58
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context8; _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(source), true)).call(_context8, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context9; _forEachInstanceProperty__default["default"](_context9 = ownKeys(Object(source))).call(_context9, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
59
59
|
|
|
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[
|
|
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
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default[
|
|
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('async-creatable-select-field-');
|
|
64
64
|
|
|
65
65
|
var hasErrors = function hasErrors(errors) {
|
|
66
66
|
var _context;
|
|
67
67
|
|
|
68
|
-
return errors && _someInstanceProperty__default[
|
|
68
|
+
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
@@ -84,7 +84,7 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
84
84
|
args[_key] = arguments[_key];
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
_this = _super.call.apply(_super, _concatInstanceProperty__default[
|
|
87
|
+
_this = _super.call.apply(_super, _concatInstanceProperty__default["default"](_context2 = [this]).call(_context2, args));
|
|
88
88
|
_this.state = {
|
|
89
89
|
// We generate an id in case no id is provided by the parent to attach the
|
|
90
90
|
// label to the input component.
|
|
@@ -96,12 +96,12 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
96
96
|
_createClass(AsyncCreatableSelectField, [{
|
|
97
97
|
key: "render",
|
|
98
98
|
value: function render() {
|
|
99
|
-
var hasError = AsyncCreatableSelectInput__default[
|
|
100
|
-
return jsxRuntime.jsx(Constraints__default[
|
|
99
|
+
var hasError = AsyncCreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
100
|
+
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
101
101
|
max: this.props.horizontalConstraint,
|
|
102
|
-
children: jsxRuntime.jsxs(Spacings__default[
|
|
102
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
103
103
|
scale: "xs",
|
|
104
|
-
children: [jsxRuntime.jsx(FieldLabel__default[
|
|
104
|
+
children: [jsxRuntime.jsx(FieldLabel__default["default"], {
|
|
105
105
|
title: this.props.title,
|
|
106
106
|
hint: this.props.hint,
|
|
107
107
|
description: this.props.description,
|
|
@@ -110,7 +110,7 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
110
110
|
badge: this.props.badge,
|
|
111
111
|
hasRequiredIndicator: this.props.isRequired,
|
|
112
112
|
htmlFor: this.state.id
|
|
113
|
-
}), jsxRuntime.jsx(AsyncCreatableSelectInput__default[
|
|
113
|
+
}), jsxRuntime.jsx(AsyncCreatableSelectInput__default["default"], _objectSpread({
|
|
114
114
|
horizontalConstraint: "scale",
|
|
115
115
|
hasError: hasError,
|
|
116
116
|
"aria-label": this.props['aria-label'],
|
|
@@ -156,7 +156,7 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
156
156
|
createOptionPosition: this.props.createOptionPosition,
|
|
157
157
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
158
158
|
iconLeft: this.props.iconLeft
|
|
159
|
-
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default[
|
|
159
|
+
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
160
160
|
errors: this.props.errors,
|
|
161
161
|
isVisible: hasError,
|
|
162
162
|
renderError: this.props.renderError
|
|
@@ -185,20 +185,20 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
185
185
|
/**
|
|
186
186
|
* Used as HTML id property. An id is auto-generated when it is not specified.
|
|
187
187
|
*/
|
|
188
|
-
id: PropTypes__default[
|
|
188
|
+
id: PropTypes__default["default"].string,
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* Horizontal size limit of the input fields.
|
|
192
192
|
*/
|
|
193
|
-
horizontalConstraint: PropTypes__default[
|
|
193
|
+
horizontalConstraint: PropTypes__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* A map of errors. Error messages for known errors are rendered automatically.
|
|
197
197
|
* <br />
|
|
198
198
|
* Unknown errors will be forwarded to `renderError`
|
|
199
199
|
*/
|
|
200
|
-
errors: PropTypes__default[
|
|
201
|
-
missing: PropTypes__default[
|
|
200
|
+
errors: PropTypes__default["default"].shape({
|
|
201
|
+
missing: PropTypes__default["default"].bool
|
|
202
202
|
}),
|
|
203
203
|
|
|
204
204
|
/**
|
|
@@ -206,12 +206,12 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
206
206
|
* <br />
|
|
207
207
|
* Signature: `(key, error) => React.node`
|
|
208
208
|
*/
|
|
209
|
-
renderError: PropTypes__default[
|
|
209
|
+
renderError: PropTypes__default["default"].func,
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
213
213
|
*/
|
|
214
|
-
isRequired: PropTypes__default[
|
|
214
|
+
isRequired: PropTypes__default["default"].bool,
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
217
|
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
@@ -223,102 +223,102 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
223
223
|
rest[_key2 - 1] = arguments[_key2];
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
return props.isMulti ? PropTypes__default[
|
|
226
|
+
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));
|
|
227
227
|
},
|
|
228
228
|
// AsyncCreatableSelectInput
|
|
229
229
|
|
|
230
230
|
/**
|
|
231
231
|
* Aria label (for assistive tech)
|
|
232
232
|
*/
|
|
233
|
-
'aria-label': PropTypes__default[
|
|
233
|
+
'aria-label': PropTypes__default["default"].string,
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
237
237
|
*/
|
|
238
|
-
'aria-labelledby': PropTypes__default[
|
|
238
|
+
'aria-labelledby': PropTypes__default["default"].string,
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* Focus the control when it is mounted
|
|
242
242
|
*/
|
|
243
|
-
isAutofocussed: PropTypes__default[
|
|
243
|
+
isAutofocussed: PropTypes__default["default"].bool,
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
246
|
* Remove the currently focused option when the user presses backspace
|
|
247
247
|
*/
|
|
248
|
-
backspaceRemovesValue: PropTypes__default[
|
|
248
|
+
backspaceRemovesValue: PropTypes__default["default"].bool,
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
251
|
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
252
252
|
*/
|
|
253
|
-
components: PropTypes__default[
|
|
253
|
+
components: PropTypes__default["default"].objectOf(PropTypes__default["default"].func),
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
256
|
* Custom method to filter whether an option should be displayed in the menu
|
|
257
257
|
*/
|
|
258
|
-
filterOption: PropTypes__default[
|
|
258
|
+
filterOption: PropTypes__default["default"].func,
|
|
259
259
|
|
|
260
260
|
/**
|
|
261
261
|
* The id to set on the SelectContainer component
|
|
262
262
|
*/
|
|
263
|
-
containerId: PropTypes__default[
|
|
263
|
+
containerId: PropTypes__default["default"].string,
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
266
|
* Is the select value clearable
|
|
267
267
|
*/
|
|
268
|
-
isClearable: PropTypes__default[
|
|
268
|
+
isClearable: PropTypes__default["default"].bool,
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* Is the select disabled
|
|
272
272
|
*/
|
|
273
|
-
isDisabled: PropTypes__default[
|
|
273
|
+
isDisabled: PropTypes__default["default"].bool,
|
|
274
274
|
|
|
275
275
|
/**
|
|
276
276
|
* Is the select read-only
|
|
277
277
|
*/
|
|
278
|
-
isReadOnly: PropTypes__default[
|
|
278
|
+
isReadOnly: PropTypes__default["default"].bool,
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
281
|
* Override the built-in logic to detect whether an option is disabled
|
|
282
282
|
* <br />
|
|
283
283
|
* Signature: `(option, options) => boolean`
|
|
284
284
|
*/
|
|
285
|
-
isOptionDisabled: PropTypes__default[
|
|
285
|
+
isOptionDisabled: PropTypes__default["default"].func,
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
288
|
* Support multiple selected options
|
|
289
289
|
*/
|
|
290
|
-
isMulti: PropTypes__default[
|
|
290
|
+
isMulti: PropTypes__default["default"].bool,
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* Whether to enable search functionality
|
|
294
294
|
*/
|
|
295
|
-
isSearchable: PropTypes__default[
|
|
296
|
-
hasWarning: PropTypes__default[
|
|
295
|
+
isSearchable: PropTypes__default["default"].bool,
|
|
296
|
+
hasWarning: PropTypes__default["default"].bool,
|
|
297
297
|
|
|
298
298
|
/**
|
|
299
299
|
* Maximum height of the menu before scrolling
|
|
300
300
|
*/
|
|
301
|
-
maxMenuHeight: PropTypes__default[
|
|
301
|
+
maxMenuHeight: PropTypes__default["default"].number,
|
|
302
302
|
|
|
303
303
|
/**
|
|
304
304
|
* Dom element to portal the select menu to
|
|
305
305
|
*/
|
|
306
|
-
menuPortalTarget: PropTypes__default[
|
|
306
|
+
menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
|
|
307
307
|
|
|
308
308
|
/**
|
|
309
309
|
* z-index value for the menu portal
|
|
310
310
|
*/
|
|
311
|
-
menuPortalZIndex: PropTypes__default[
|
|
311
|
+
menuPortalZIndex: PropTypes__default["default"].number,
|
|
312
312
|
|
|
313
313
|
/**
|
|
314
314
|
* whether the menu should block scroll while open
|
|
315
315
|
*/
|
|
316
|
-
menuShouldBlockScroll: PropTypes__default[
|
|
316
|
+
menuShouldBlockScroll: PropTypes__default["default"].bool,
|
|
317
317
|
|
|
318
318
|
/**
|
|
319
319
|
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
320
320
|
*/
|
|
321
|
-
name: PropTypes__default[
|
|
321
|
+
name: PropTypes__default["default"].string,
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
324
|
* Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place).
|
|
@@ -327,12 +327,12 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
327
327
|
* <br />
|
|
328
328
|
* Signature: `({ inputValue }) => string`
|
|
329
329
|
*/
|
|
330
|
-
noOptionsMessage: PropTypes__default[
|
|
330
|
+
noOptionsMessage: PropTypes__default["default"].func,
|
|
331
331
|
|
|
332
332
|
/**
|
|
333
333
|
* Handle blur events on the control
|
|
334
334
|
*/
|
|
335
|
-
onBlur: PropTypes__default[
|
|
335
|
+
onBlur: PropTypes__default["default"].func,
|
|
336
336
|
|
|
337
337
|
/**
|
|
338
338
|
* Called with a fake event when value changes.
|
|
@@ -341,43 +341,43 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
341
341
|
* <br />
|
|
342
342
|
* Signature: `(event) => void`
|
|
343
343
|
*/
|
|
344
|
-
onChange: PropTypes__default[
|
|
344
|
+
onChange: PropTypes__default["default"].func,
|
|
345
345
|
|
|
346
346
|
/**
|
|
347
347
|
* Handle focus events on the control
|
|
348
348
|
*/
|
|
349
|
-
onFocus: PropTypes__default[
|
|
349
|
+
onFocus: PropTypes__default["default"].func,
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
352
|
* Handle change events on the input
|
|
353
353
|
*/
|
|
354
|
-
onInputChange: PropTypes__default[
|
|
354
|
+
onInputChange: PropTypes__default["default"].func,
|
|
355
355
|
|
|
356
356
|
/**
|
|
357
357
|
* Array of options that populate the select menu
|
|
358
358
|
*/
|
|
359
|
-
options: PropTypes__default[
|
|
360
|
-
value: PropTypes__default[
|
|
361
|
-
}), PropTypes__default[
|
|
362
|
-
options: PropTypes__default[
|
|
363
|
-
value: PropTypes__default[
|
|
359
|
+
options: PropTypes__default["default"].arrayOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].shape({
|
|
360
|
+
value: PropTypes__default["default"].string.isRequired
|
|
361
|
+
}), PropTypes__default["default"].shape({
|
|
362
|
+
options: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
363
|
+
value: PropTypes__default["default"].string.isRequired
|
|
364
364
|
}))
|
|
365
365
|
})])),
|
|
366
366
|
|
|
367
367
|
/**
|
|
368
368
|
* Placeholder text for the select value
|
|
369
369
|
*/
|
|
370
|
-
placeholder: PropTypes__default[
|
|
370
|
+
placeholder: PropTypes__default["default"].string,
|
|
371
371
|
|
|
372
372
|
/**
|
|
373
373
|
* Sets the tabIndex attribute on the input
|
|
374
374
|
*/
|
|
375
|
-
tabIndex: PropTypes__default[
|
|
375
|
+
tabIndex: PropTypes__default["default"].string,
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
378
|
* Select the currently focused option when the user presses tab
|
|
379
379
|
*/
|
|
380
|
-
tabSelectsValue: PropTypes__default[
|
|
380
|
+
tabSelectsValue: PropTypes__default["default"].bool,
|
|
381
381
|
|
|
382
382
|
/**
|
|
383
383
|
* The value of the select; reflected by the selected option
|
|
@@ -389,13 +389,13 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
389
389
|
rest[_key3 - 1] = arguments[_key3];
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
return props.isMulti ? PropTypes__default[
|
|
393
|
-
value: PropTypes__default[
|
|
394
|
-
})).apply(void 0, _concatInstanceProperty__default[
|
|
395
|
-
value: PropTypes__default[
|
|
396
|
-
}).apply(void 0, _concatInstanceProperty__default[
|
|
392
|
+
return props.isMulti ? PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
393
|
+
value: PropTypes__default["default"].string.isRequired
|
|
394
|
+
})).apply(void 0, _concatInstanceProperty__default["default"](_context6 = [props]).call(_context6, rest)) : PropTypes__default["default"].shape({
|
|
395
|
+
value: PropTypes__default["default"].string.isRequired
|
|
396
|
+
}).apply(void 0, _concatInstanceProperty__default["default"](_context7 = [props]).call(_context7, rest));
|
|
397
397
|
},
|
|
398
|
-
showOptionGroupDivider: PropTypes__default[
|
|
398
|
+
showOptionGroupDivider: PropTypes__default["default"].bool,
|
|
399
399
|
// Async props
|
|
400
400
|
|
|
401
401
|
/**
|
|
@@ -403,8 +403,8 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
403
403
|
* <br/>
|
|
404
404
|
* When set to `true`, the results for `loadOptions('')` will be autoloaded.
|
|
405
405
|
*/
|
|
406
|
-
defaultOptions: PropTypes__default[
|
|
407
|
-
value: PropTypes__default[
|
|
406
|
+
defaultOptions: PropTypes__default["default"].oneOfType([PropTypes__default["default"].bool, PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
407
|
+
value: PropTypes__default["default"].string.isRequired
|
|
408
408
|
}))]),
|
|
409
409
|
|
|
410
410
|
/**
|
|
@@ -414,61 +414,61 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
414
414
|
* <br />
|
|
415
415
|
* `callback` can be called with `options`
|
|
416
416
|
*/
|
|
417
|
-
loadOptions: PropTypes__default[
|
|
417
|
+
loadOptions: PropTypes__default["default"].func.isRequired,
|
|
418
418
|
|
|
419
419
|
/**
|
|
420
420
|
* If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
|
|
421
421
|
*/
|
|
422
|
-
cacheOptions: PropTypes__default[
|
|
422
|
+
cacheOptions: PropTypes__default["default"].any,
|
|
423
423
|
// Creatable props
|
|
424
424
|
|
|
425
425
|
/**
|
|
426
426
|
* 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.
|
|
427
427
|
*/
|
|
428
|
-
allowCreateWhileLoading: PropTypes__default[
|
|
428
|
+
allowCreateWhileLoading: PropTypes__default["default"].bool,
|
|
429
429
|
|
|
430
430
|
/**
|
|
431
431
|
* Gets the label for the "create new ..." option in the menu. Is given the current input value.
|
|
432
432
|
*/
|
|
433
|
-
formatCreateLabel: PropTypes__default[
|
|
433
|
+
formatCreateLabel: PropTypes__default["default"].func,
|
|
434
434
|
|
|
435
435
|
/**
|
|
436
436
|
* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
|
|
437
437
|
*/
|
|
438
|
-
isValidNewOption: PropTypes__default[
|
|
438
|
+
isValidNewOption: PropTypes__default["default"].func,
|
|
439
439
|
|
|
440
440
|
/**
|
|
441
441
|
* Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
|
|
442
442
|
*/
|
|
443
|
-
getNewOptionData: PropTypes__default[
|
|
443
|
+
getNewOptionData: PropTypes__default["default"].func,
|
|
444
444
|
|
|
445
445
|
/**
|
|
446
446
|
* 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.
|
|
447
447
|
*/
|
|
448
|
-
onCreateOption: PropTypes__default[
|
|
448
|
+
onCreateOption: PropTypes__default["default"].func,
|
|
449
449
|
|
|
450
450
|
/**
|
|
451
451
|
* Sets the position of the createOption element in your options list.
|
|
452
452
|
*/
|
|
453
|
-
createOptionPosition: PropTypes__default[
|
|
453
|
+
createOptionPosition: PropTypes__default["default"].string,
|
|
454
454
|
// LabelField
|
|
455
455
|
|
|
456
456
|
/**
|
|
457
457
|
* Title of the label
|
|
458
458
|
*/
|
|
459
|
-
title: PropTypes__default[
|
|
459
|
+
title: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]).isRequired,
|
|
460
460
|
|
|
461
461
|
/**
|
|
462
462
|
* 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`.
|
|
463
463
|
*/
|
|
464
|
-
hint: requiredIf__default[
|
|
464
|
+
hint: requiredIf__default["default"](PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]), function (props) {
|
|
465
465
|
return props.hintIcon;
|
|
466
466
|
}),
|
|
467
467
|
|
|
468
468
|
/**
|
|
469
469
|
* Provides a description for the title.
|
|
470
470
|
*/
|
|
471
|
-
description: PropTypes__default[
|
|
471
|
+
description: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]),
|
|
472
472
|
|
|
473
473
|
/**
|
|
474
474
|
* Function called when info button is pressed.
|
|
@@ -477,30 +477,30 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
477
477
|
* <br />
|
|
478
478
|
* Signature: `(event) => void`
|
|
479
479
|
*/
|
|
480
|
-
onInfoButtonClick: PropTypes__default[
|
|
480
|
+
onInfoButtonClick: PropTypes__default["default"].func,
|
|
481
481
|
|
|
482
482
|
/**
|
|
483
483
|
* Icon to be displayed beside the hint text.
|
|
484
484
|
* <br />
|
|
485
485
|
* Will only get rendered when `hint` is passed as well.
|
|
486
486
|
*/
|
|
487
|
-
hintIcon: PropTypes__default[
|
|
487
|
+
hintIcon: PropTypes__default["default"].node,
|
|
488
488
|
|
|
489
489
|
/**
|
|
490
490
|
* Badge to be displayed beside the label.
|
|
491
491
|
* <br />
|
|
492
492
|
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
493
493
|
*/
|
|
494
|
-
badge: PropTypes__default[
|
|
494
|
+
badge: PropTypes__default["default"].node,
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
497
|
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
498
498
|
*/
|
|
499
|
-
iconLeft: PropTypes__default[
|
|
499
|
+
iconLeft: PropTypes__default["default"].node
|
|
500
500
|
} : {};
|
|
501
501
|
|
|
502
|
-
// NOTE: This string will be replaced
|
|
503
|
-
var version =
|
|
502
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
503
|
+
var version = "12.2.7";
|
|
504
504
|
|
|
505
|
-
exports[
|
|
505
|
+
exports["default"] = AsyncCreatableSelectField;
|
|
506
506
|
exports.version = version;
|
|
@@ -51,19 +51,19 @@ var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
|
|
|
51
51
|
var AsyncCreatableSelectInput__default = /*#__PURE__*/_interopDefault(AsyncCreatableSelectInput);
|
|
52
52
|
var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
|
|
53
53
|
|
|
54
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
54
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
55
55
|
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context8; _forEachInstanceProperty__default[
|
|
56
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context8; _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(source), true)).call(_context8, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context9; _forEachInstanceProperty__default["default"](_context9 = ownKeys(Object(source))).call(_context9, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
57
57
|
|
|
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[
|
|
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
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default[
|
|
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('async-creatable-select-field-');
|
|
62
62
|
|
|
63
63
|
var hasErrors = function hasErrors(errors) {
|
|
64
64
|
var _context;
|
|
65
65
|
|
|
66
|
-
return errors && _someInstanceProperty__default[
|
|
66
|
+
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
@@ -82,7 +82,7 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
82
82
|
args[_key] = arguments[_key];
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
_this = _super.call.apply(_super, _concatInstanceProperty__default[
|
|
85
|
+
_this = _super.call.apply(_super, _concatInstanceProperty__default["default"](_context2 = [this]).call(_context2, args));
|
|
86
86
|
_this.state = {
|
|
87
87
|
// We generate an id in case no id is provided by the parent to attach the
|
|
88
88
|
// label to the input component.
|
|
@@ -94,12 +94,12 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
94
94
|
_createClass(AsyncCreatableSelectField, [{
|
|
95
95
|
key: "render",
|
|
96
96
|
value: function render() {
|
|
97
|
-
var hasError = AsyncCreatableSelectInput__default[
|
|
98
|
-
return jsxRuntime.jsx(Constraints__default[
|
|
97
|
+
var hasError = AsyncCreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
98
|
+
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
99
99
|
max: this.props.horizontalConstraint,
|
|
100
|
-
children: jsxRuntime.jsxs(Spacings__default[
|
|
100
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
101
101
|
scale: "xs",
|
|
102
|
-
children: [jsxRuntime.jsx(FieldLabel__default[
|
|
102
|
+
children: [jsxRuntime.jsx(FieldLabel__default["default"], {
|
|
103
103
|
title: this.props.title,
|
|
104
104
|
hint: this.props.hint,
|
|
105
105
|
description: this.props.description,
|
|
@@ -108,7 +108,7 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
108
108
|
badge: this.props.badge,
|
|
109
109
|
hasRequiredIndicator: this.props.isRequired,
|
|
110
110
|
htmlFor: this.state.id
|
|
111
|
-
}), jsxRuntime.jsx(AsyncCreatableSelectInput__default[
|
|
111
|
+
}), jsxRuntime.jsx(AsyncCreatableSelectInput__default["default"], _objectSpread({
|
|
112
112
|
horizontalConstraint: "scale",
|
|
113
113
|
hasError: hasError,
|
|
114
114
|
"aria-label": this.props['aria-label'],
|
|
@@ -154,7 +154,7 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
154
154
|
createOptionPosition: this.props.createOptionPosition,
|
|
155
155
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
156
156
|
iconLeft: this.props.iconLeft
|
|
157
|
-
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default[
|
|
157
|
+
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
158
158
|
errors: this.props.errors,
|
|
159
159
|
isVisible: hasError,
|
|
160
160
|
renderError: this.props.renderError
|
|
@@ -179,8 +179,8 @@ AsyncCreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
179
179
|
};
|
|
180
180
|
AsyncCreatableSelectField.propTypes = {};
|
|
181
181
|
|
|
182
|
-
// NOTE: This string will be replaced
|
|
183
|
-
var version =
|
|
182
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
183
|
+
var version = "12.2.7";
|
|
184
184
|
|
|
185
|
-
exports[
|
|
185
|
+
exports["default"] = AsyncCreatableSelectField;
|
|
186
186
|
exports.version = version;
|
|
@@ -473,7 +473,7 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
473
473
|
iconLeft: PropTypes.node
|
|
474
474
|
} : {};
|
|
475
475
|
|
|
476
|
-
// NOTE: This string will be replaced
|
|
477
|
-
var version =
|
|
476
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
477
|
+
var version = "12.2.7";
|
|
478
478
|
|
|
479
479
|
export { AsyncCreatableSelectField as default, version };
|
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": "12.2.
|
|
4
|
+
"version": "12.2.7",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"homepage": "https://uikit.commercetools.com",
|
|
12
12
|
"keywords": ["javascript", "design system", "react", "uikit"],
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"private": false,
|
|
15
14
|
"publishConfig": {
|
|
16
15
|
"access": "public"
|
|
17
16
|
},
|
|
@@ -19,19 +18,16 @@
|
|
|
19
18
|
"main": "dist/commercetools-uikit-async-creatable-select-field.cjs.js",
|
|
20
19
|
"module": "dist/commercetools-uikit-async-creatable-select-field.esm.js",
|
|
21
20
|
"files": ["dist"],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"prepare": "../../../../scripts/version.js replace"
|
|
24
|
-
},
|
|
25
21
|
"dependencies": {
|
|
26
|
-
"@babel/runtime": "7.
|
|
27
|
-
"@babel/runtime-corejs3": "7.
|
|
28
|
-
"@commercetools-uikit/async-creatable-select-input": "12.2.
|
|
29
|
-
"@commercetools-uikit/constraints": "12.2.
|
|
30
|
-
"@commercetools-uikit/design-system": "12.2.
|
|
31
|
-
"@commercetools-uikit/field-errors": "12.2.
|
|
32
|
-
"@commercetools-uikit/field-label": "12.2.
|
|
33
|
-
"@commercetools-uikit/spacings": "12.2.
|
|
34
|
-
"@commercetools-uikit/utils": "12.2.
|
|
22
|
+
"@babel/runtime": "7.16.3",
|
|
23
|
+
"@babel/runtime-corejs3": "7.16.3",
|
|
24
|
+
"@commercetools-uikit/async-creatable-select-input": "12.2.7",
|
|
25
|
+
"@commercetools-uikit/constraints": "12.2.5",
|
|
26
|
+
"@commercetools-uikit/design-system": "12.2.5",
|
|
27
|
+
"@commercetools-uikit/field-errors": "12.2.5",
|
|
28
|
+
"@commercetools-uikit/field-label": "12.2.7",
|
|
29
|
+
"@commercetools-uikit/spacings": "12.2.5",
|
|
30
|
+
"@commercetools-uikit/utils": "12.2.5",
|
|
35
31
|
"@emotion/react": "^11.4.0",
|
|
36
32
|
"@emotion/styled": "^11.3.0",
|
|
37
33
|
"prop-types": "15.7.2",
|