@commercetools-uikit/async-select-field 12.2.3 → 12.2.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.
|
@@ -53,19 +53,19 @@ var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
|
|
|
53
53
|
var AsyncSelectInput__default = /*#__PURE__*/_interopDefault(AsyncSelectInput);
|
|
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-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 AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
@@ -84,7 +84,7 @@ var AsyncSelectField = /*#__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 AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
96
96
|
_createClass(AsyncSelectField, [{
|
|
97
97
|
key: "render",
|
|
98
98
|
value: function render() {
|
|
99
|
-
var hasError = AsyncSelectInput__default[
|
|
100
|
-
return jsxRuntime.jsx(Constraints__default[
|
|
99
|
+
var hasError = AsyncSelectInput__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 AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
110
110
|
badge: this.props.badge,
|
|
111
111
|
hasRequiredIndicator: this.props.isRequired,
|
|
112
112
|
htmlFor: this.state.id
|
|
113
|
-
}), jsxRuntime.jsx(AsyncSelectInput__default[
|
|
113
|
+
}), jsxRuntime.jsx(AsyncSelectInput__default["default"], _objectSpread({
|
|
114
114
|
horizontalConstraint: "scale",
|
|
115
115
|
hasError: hasError,
|
|
116
116
|
"aria-label": this.props['aria-label'],
|
|
@@ -149,7 +149,7 @@ var AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
149
149
|
cacheOptions: this.props.cacheOptions,
|
|
150
150
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
151
151
|
iconLeft: this.props.iconLeft
|
|
152
|
-
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default[
|
|
152
|
+
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
153
153
|
errors: this.props.errors,
|
|
154
154
|
isVisible: hasError,
|
|
155
155
|
renderError: this.props.renderError
|
|
@@ -178,20 +178,20 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
178
178
|
/**
|
|
179
179
|
* Used as HTML id property. An id is auto-generated when it is not specified.
|
|
180
180
|
*/
|
|
181
|
-
id: PropTypes__default[
|
|
181
|
+
id: PropTypes__default["default"].string,
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* Horizontal size limit of the input fields.
|
|
185
185
|
*/
|
|
186
|
-
horizontalConstraint: PropTypes__default[
|
|
186
|
+
horizontalConstraint: PropTypes__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
189
|
* A map of errors. Error messages for known errors are rendered automatically.
|
|
190
190
|
* <br />
|
|
191
191
|
* Unknown errors will be forwarded to `renderError`
|
|
192
192
|
*/
|
|
193
|
-
errors: PropTypes__default[
|
|
194
|
-
missing: PropTypes__default[
|
|
193
|
+
errors: PropTypes__default["default"].shape({
|
|
194
|
+
missing: PropTypes__default["default"].bool
|
|
195
195
|
}),
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -199,12 +199,12 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
199
199
|
* <br />
|
|
200
200
|
* Signature: `(key, error) => React.node`
|
|
201
201
|
*/
|
|
202
|
-
renderError: PropTypes__default[
|
|
202
|
+
renderError: PropTypes__default["default"].func,
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
206
206
|
*/
|
|
207
|
-
isRequired: PropTypes__default[
|
|
207
|
+
isRequired: PropTypes__default["default"].bool,
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
210
|
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
@@ -216,102 +216,102 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
216
216
|
rest[_key2 - 1] = arguments[_key2];
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
return props.isMulti ? PropTypes__default[
|
|
219
|
+
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));
|
|
220
220
|
},
|
|
221
221
|
// AsyncSelectInput
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
224
|
* Aria label (for assistive tech)
|
|
225
225
|
*/
|
|
226
|
-
'aria-label': PropTypes__default[
|
|
226
|
+
'aria-label': PropTypes__default["default"].string,
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
229
|
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
230
230
|
*/
|
|
231
|
-
'aria-labelledby': PropTypes__default[
|
|
231
|
+
'aria-labelledby': PropTypes__default["default"].string,
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
234
|
* Focus the control when it is mounted
|
|
235
235
|
*/
|
|
236
|
-
isAutofocussed: PropTypes__default[
|
|
236
|
+
isAutofocussed: PropTypes__default["default"].bool,
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
239
|
* Remove the currently focused option when the user presses backspace
|
|
240
240
|
*/
|
|
241
|
-
backspaceRemovesValue: PropTypes__default[
|
|
241
|
+
backspaceRemovesValue: PropTypes__default["default"].bool,
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
244
|
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
245
245
|
*/
|
|
246
|
-
components: PropTypes__default[
|
|
246
|
+
components: PropTypes__default["default"].objectOf(PropTypes__default["default"].func),
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
249
|
* Custom method to filter whether an option should be displayed in the menu
|
|
250
250
|
*/
|
|
251
|
-
filterOption: PropTypes__default[
|
|
251
|
+
filterOption: PropTypes__default["default"].func,
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
254
|
* The id to set on the SelectContainer component
|
|
255
255
|
*/
|
|
256
|
-
containerId: PropTypes__default[
|
|
256
|
+
containerId: PropTypes__default["default"].string,
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
259
|
* Is the select value clearable
|
|
260
260
|
*/
|
|
261
|
-
isClearable: PropTypes__default[
|
|
261
|
+
isClearable: PropTypes__default["default"].bool,
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
264
|
* Is the select disabled
|
|
265
265
|
*/
|
|
266
|
-
isDisabled: PropTypes__default[
|
|
266
|
+
isDisabled: PropTypes__default["default"].bool,
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
269
|
* Is the select read-only
|
|
270
270
|
*/
|
|
271
|
-
isReadOnly: PropTypes__default[
|
|
271
|
+
isReadOnly: PropTypes__default["default"].bool,
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
274
|
* Override the built-in logic to detect whether an option is disabled
|
|
275
275
|
* <br />
|
|
276
276
|
* Signature: `(option, options) => boolean`
|
|
277
277
|
*/
|
|
278
|
-
isOptionDisabled: PropTypes__default[
|
|
278
|
+
isOptionDisabled: PropTypes__default["default"].func,
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
281
|
* Support multiple selected options
|
|
282
282
|
*/
|
|
283
|
-
isMulti: PropTypes__default[
|
|
283
|
+
isMulti: PropTypes__default["default"].bool,
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
286
|
* Whether to enable search functionality
|
|
287
287
|
*/
|
|
288
|
-
isSearchable: PropTypes__default[
|
|
289
|
-
hasWarning: PropTypes__default[
|
|
288
|
+
isSearchable: PropTypes__default["default"].bool,
|
|
289
|
+
hasWarning: PropTypes__default["default"].bool,
|
|
290
290
|
|
|
291
291
|
/**
|
|
292
292
|
* Maximum height of the menu before scrolling
|
|
293
293
|
*/
|
|
294
|
-
maxMenuHeight: PropTypes__default[
|
|
294
|
+
maxMenuHeight: PropTypes__default["default"].number,
|
|
295
295
|
|
|
296
296
|
/**
|
|
297
297
|
* Dom element to portal the select menu to
|
|
298
298
|
*/
|
|
299
|
-
menuPortalTarget: PropTypes__default[
|
|
299
|
+
menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
302
|
* z-index value for the menu portal
|
|
303
303
|
*/
|
|
304
|
-
menuPortalZIndex: PropTypes__default[
|
|
304
|
+
menuPortalZIndex: PropTypes__default["default"].number,
|
|
305
305
|
|
|
306
306
|
/**
|
|
307
307
|
* whether the menu should block scroll while open
|
|
308
308
|
*/
|
|
309
|
-
menuShouldBlockScroll: PropTypes__default[
|
|
309
|
+
menuShouldBlockScroll: PropTypes__default["default"].bool,
|
|
310
310
|
|
|
311
311
|
/**
|
|
312
312
|
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
313
313
|
*/
|
|
314
|
-
name: PropTypes__default[
|
|
314
|
+
name: PropTypes__default["default"].string,
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* 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,12 +319,12 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
319
319
|
* Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
|
|
320
320
|
* Signature: `({ inputValue }) => React.node `
|
|
321
321
|
*/
|
|
322
|
-
noOptionsMessage: PropTypes__default[
|
|
322
|
+
noOptionsMessage: PropTypes__default["default"].func,
|
|
323
323
|
|
|
324
324
|
/**
|
|
325
325
|
* Handle blur events on the control
|
|
326
326
|
*/
|
|
327
|
-
onBlur: PropTypes__default[
|
|
327
|
+
onBlur: PropTypes__default["default"].func,
|
|
328
328
|
|
|
329
329
|
/**
|
|
330
330
|
* Called with a fake event when value changes.
|
|
@@ -333,37 +333,37 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
333
333
|
* <br />
|
|
334
334
|
* Signature: `(event) => void`
|
|
335
335
|
*/
|
|
336
|
-
onChange: PropTypes__default[
|
|
336
|
+
onChange: PropTypes__default["default"].func,
|
|
337
337
|
|
|
338
338
|
/**
|
|
339
339
|
* Handle focus events on the control
|
|
340
340
|
*/
|
|
341
|
-
onFocus: PropTypes__default[
|
|
341
|
+
onFocus: PropTypes__default["default"].func,
|
|
342
342
|
|
|
343
343
|
/**
|
|
344
344
|
* Handle change events on the input
|
|
345
345
|
*/
|
|
346
|
-
onInputChange: PropTypes__default[
|
|
346
|
+
onInputChange: PropTypes__default["default"].func,
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
349
|
* Placeholder text for the select value
|
|
350
350
|
*/
|
|
351
|
-
placeholder: PropTypes__default[
|
|
351
|
+
placeholder: PropTypes__default["default"].string,
|
|
352
352
|
|
|
353
353
|
/**
|
|
354
354
|
* loading message shown while the options are being loaded
|
|
355
355
|
*/
|
|
356
|
-
loadingMessage: PropTypes__default[
|
|
356
|
+
loadingMessage: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
359
|
* Sets the tabIndex attribute on the input
|
|
360
360
|
*/
|
|
361
|
-
tabIndex: PropTypes__default[
|
|
361
|
+
tabIndex: PropTypes__default["default"].string,
|
|
362
362
|
|
|
363
363
|
/**
|
|
364
364
|
* Select the currently focused option when the user presses tab
|
|
365
365
|
*/
|
|
366
|
-
tabSelectsValue: PropTypes__default[
|
|
366
|
+
tabSelectsValue: PropTypes__default["default"].bool,
|
|
367
367
|
|
|
368
368
|
/**
|
|
369
369
|
* The value of the select; reflected by the selected option
|
|
@@ -375,13 +375,13 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
375
375
|
rest[_key3 - 1] = arguments[_key3];
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
return props.isMulti ? PropTypes__default[
|
|
379
|
-
value: PropTypes__default[
|
|
380
|
-
})).apply(void 0, _concatInstanceProperty__default[
|
|
381
|
-
value: PropTypes__default[
|
|
382
|
-
}).apply(void 0, _concatInstanceProperty__default[
|
|
378
|
+
return props.isMulti ? PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
379
|
+
value: PropTypes__default["default"].string.isRequired
|
|
380
|
+
})).apply(void 0, _concatInstanceProperty__default["default"](_context6 = [props]).call(_context6, rest)) : PropTypes__default["default"].shape({
|
|
381
|
+
value: PropTypes__default["default"].string.isRequired
|
|
382
|
+
}).apply(void 0, _concatInstanceProperty__default["default"](_context7 = [props]).call(_context7, rest));
|
|
383
383
|
},
|
|
384
|
-
showOptionGroupDivider: PropTypes__default[
|
|
384
|
+
showOptionGroupDivider: PropTypes__default["default"].bool,
|
|
385
385
|
// Async props
|
|
386
386
|
|
|
387
387
|
/**
|
|
@@ -389,37 +389,37 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
389
389
|
* <br />
|
|
390
390
|
* When set to `true`, the results for `loadOptions('')` will be autoloaded.
|
|
391
391
|
*/
|
|
392
|
-
defaultOptions: PropTypes__default[
|
|
393
|
-
value: PropTypes__default[
|
|
392
|
+
defaultOptions: PropTypes__default["default"].oneOfType([PropTypes__default["default"].bool, PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
393
|
+
value: PropTypes__default["default"].string.isRequired
|
|
394
394
|
}))]),
|
|
395
395
|
|
|
396
396
|
/**
|
|
397
397
|
* Function that returns a promise, which is the set of options to be used once the promise resolves.
|
|
398
398
|
*/
|
|
399
|
-
loadOptions: PropTypes__default[
|
|
399
|
+
loadOptions: PropTypes__default["default"].func.isRequired,
|
|
400
400
|
|
|
401
401
|
/**
|
|
402
402
|
* If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
|
|
403
403
|
*/
|
|
404
|
-
cacheOptions: PropTypes__default[
|
|
404
|
+
cacheOptions: PropTypes__default["default"].any,
|
|
405
405
|
// LabelField
|
|
406
406
|
|
|
407
407
|
/**
|
|
408
408
|
* Title of the label
|
|
409
409
|
*/
|
|
410
|
-
title: PropTypes__default[
|
|
410
|
+
title: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]).isRequired,
|
|
411
411
|
|
|
412
412
|
/**
|
|
413
413
|
* 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`.
|
|
414
414
|
*/
|
|
415
|
-
hint: requiredIf__default[
|
|
415
|
+
hint: requiredIf__default["default"](PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]), function (props) {
|
|
416
416
|
return props.hintIcon;
|
|
417
417
|
}),
|
|
418
418
|
|
|
419
419
|
/**
|
|
420
420
|
* Provides a description for the title.
|
|
421
421
|
*/
|
|
422
|
-
description: PropTypes__default[
|
|
422
|
+
description: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]),
|
|
423
423
|
|
|
424
424
|
/**
|
|
425
425
|
* Function called when info button is pressed.
|
|
@@ -428,30 +428,30 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
428
428
|
* <br />
|
|
429
429
|
* Signature: `(event) => void`
|
|
430
430
|
*/
|
|
431
|
-
onInfoButtonClick: PropTypes__default[
|
|
431
|
+
onInfoButtonClick: PropTypes__default["default"].func,
|
|
432
432
|
|
|
433
433
|
/**
|
|
434
434
|
* Icon to be displayed beside the hint text.
|
|
435
435
|
* <br />
|
|
436
436
|
* Will only get rendered when `hint` is passed as well.
|
|
437
437
|
*/
|
|
438
|
-
hintIcon: PropTypes__default[
|
|
438
|
+
hintIcon: PropTypes__default["default"].node,
|
|
439
439
|
|
|
440
440
|
/**
|
|
441
441
|
* Badge to be displayed beside the label.
|
|
442
442
|
* <br />
|
|
443
443
|
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
444
444
|
*/
|
|
445
|
-
badge: PropTypes__default[
|
|
445
|
+
badge: PropTypes__default["default"].node,
|
|
446
446
|
|
|
447
447
|
/**
|
|
448
448
|
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
449
449
|
*/
|
|
450
|
-
iconLeft: PropTypes__default[
|
|
450
|
+
iconLeft: PropTypes__default["default"].node
|
|
451
451
|
} : {};
|
|
452
452
|
|
|
453
453
|
// NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
|
|
454
|
-
var version = '12.2.
|
|
454
|
+
var version = '12.2.4';
|
|
455
455
|
|
|
456
|
-
exports[
|
|
456
|
+
exports["default"] = AsyncSelectField;
|
|
457
457
|
exports.version = version;
|
|
@@ -51,19 +51,19 @@ var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
|
|
|
51
51
|
var AsyncSelectInput__default = /*#__PURE__*/_interopDefault(AsyncSelectInput);
|
|
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-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 AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
@@ -82,7 +82,7 @@ var AsyncSelectField = /*#__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 AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
94
94
|
_createClass(AsyncSelectField, [{
|
|
95
95
|
key: "render",
|
|
96
96
|
value: function render() {
|
|
97
|
-
var hasError = AsyncSelectInput__default[
|
|
98
|
-
return jsxRuntime.jsx(Constraints__default[
|
|
97
|
+
var hasError = AsyncSelectInput__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 AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
108
108
|
badge: this.props.badge,
|
|
109
109
|
hasRequiredIndicator: this.props.isRequired,
|
|
110
110
|
htmlFor: this.state.id
|
|
111
|
-
}), jsxRuntime.jsx(AsyncSelectInput__default[
|
|
111
|
+
}), jsxRuntime.jsx(AsyncSelectInput__default["default"], _objectSpread({
|
|
112
112
|
horizontalConstraint: "scale",
|
|
113
113
|
hasError: hasError,
|
|
114
114
|
"aria-label": this.props['aria-label'],
|
|
@@ -147,7 +147,7 @@ var AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
147
147
|
cacheOptions: this.props.cacheOptions,
|
|
148
148
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
149
149
|
iconLeft: this.props.iconLeft
|
|
150
|
-
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default[
|
|
150
|
+
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
151
151
|
errors: this.props.errors,
|
|
152
152
|
isVisible: hasError,
|
|
153
153
|
renderError: this.props.renderError
|
|
@@ -173,7 +173,7 @@ AsyncSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
173
173
|
AsyncSelectField.propTypes = {};
|
|
174
174
|
|
|
175
175
|
// NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
|
|
176
|
-
var version = '12.2.
|
|
176
|
+
var version = '12.2.4';
|
|
177
177
|
|
|
178
|
-
exports[
|
|
178
|
+
exports["default"] = AsyncSelectField;
|
|
179
179
|
exports.version = version;
|
|
@@ -425,6 +425,6 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
425
425
|
} : {};
|
|
426
426
|
|
|
427
427
|
// NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
|
|
428
|
-
var version = '12.2.
|
|
428
|
+
var version = '12.2.4';
|
|
429
429
|
|
|
430
430
|
export { AsyncSelectField as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/async-select-field",
|
|
3
3
|
"description": "A controlled input component with validation states and a label getting a selection from an asynchronously loaded list from the user.",
|
|
4
|
-
"version": "12.2.
|
|
4
|
+
"version": "12.2.4",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"prepare": "../../../../scripts/version.js replace"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@babel/runtime": "7.
|
|
27
|
-
"@babel/runtime-corejs3": "7.
|
|
28
|
-
"@commercetools-uikit/async-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.
|
|
26
|
+
"@babel/runtime": "7.15.4",
|
|
27
|
+
"@babel/runtime-corejs3": "7.15.4",
|
|
28
|
+
"@commercetools-uikit/async-select-input": "12.2.4",
|
|
29
|
+
"@commercetools-uikit/constraints": "12.2.4",
|
|
30
|
+
"@commercetools-uikit/design-system": "12.2.4",
|
|
31
|
+
"@commercetools-uikit/field-errors": "12.2.4",
|
|
32
|
+
"@commercetools-uikit/field-label": "12.2.4",
|
|
33
|
+
"@commercetools-uikit/spacings": "12.2.4",
|
|
34
34
|
"@commercetools-uikit/utils": "12.2.0",
|
|
35
35
|
"@emotion/react": "^11.4.0",
|
|
36
36
|
"@emotion/styled": "^11.3.0",
|