@commercetools-uikit/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 CreatableSelectInput__default = /*#__PURE__*/_interopDefault(CreatableSelectInput);
|
|
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('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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
@@ -84,7 +84,7 @@ var CreatableSelectField = /*#__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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
96
96
|
_createClass(CreatableSelectField, [{
|
|
97
97
|
key: "render",
|
|
98
98
|
value: function render() {
|
|
99
|
-
var hasError = CreatableSelectInput__default[
|
|
100
|
-
return jsxRuntime.jsx(Constraints__default[
|
|
99
|
+
var hasError = CreatableSelectInput__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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
110
110
|
badge: this.props.badge,
|
|
111
111
|
hasRequiredIndicator: this.props.isRequired,
|
|
112
112
|
htmlFor: this.state.id
|
|
113
|
-
}), jsxRuntime.jsx(CreatableSelectInput__default[
|
|
113
|
+
}), jsxRuntime.jsx(CreatableSelectInput__default["default"], _objectSpread({
|
|
114
114
|
horizontalConstraint: "scale",
|
|
115
115
|
hasError: hasError,
|
|
116
116
|
"aria-label": this.props['aria-label'],
|
|
@@ -151,7 +151,7 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
151
151
|
createOptionPosition: this.props.createOptionPosition,
|
|
152
152
|
showOptionGroupDivider: this.props.showOptionGroupDivider,
|
|
153
153
|
iconLeft: this.props.iconLeft
|
|
154
|
-
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default[
|
|
154
|
+
}, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
155
155
|
errors: this.props.errors,
|
|
156
156
|
isVisible: hasError,
|
|
157
157
|
renderError: this.props.renderError
|
|
@@ -180,20 +180,20 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
180
180
|
/**
|
|
181
181
|
* Used as HTML id property. An id is auto-generated when it is not specified.
|
|
182
182
|
*/
|
|
183
|
-
id: PropTypes__default[
|
|
183
|
+
id: PropTypes__default["default"].string,
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
186
|
* Horizontal size limit of the input fields.
|
|
187
187
|
*/
|
|
188
|
-
horizontalConstraint: PropTypes__default[
|
|
188
|
+
horizontalConstraint: PropTypes__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* A map of errors. Error messages for known errors are rendered automatically.
|
|
192
192
|
* <br />
|
|
193
193
|
* Unknown errors will be forwarded to `renderError`
|
|
194
194
|
*/
|
|
195
|
-
errors: PropTypes__default[
|
|
196
|
-
missing: PropTypes__default[
|
|
195
|
+
errors: PropTypes__default["default"].shape({
|
|
196
|
+
missing: PropTypes__default["default"].bool
|
|
197
197
|
}),
|
|
198
198
|
|
|
199
199
|
/**
|
|
@@ -201,12 +201,12 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
201
201
|
* <br />
|
|
202
202
|
* Signature: `(key, error) => React.node`
|
|
203
203
|
*/
|
|
204
|
-
renderError: PropTypes__default[
|
|
204
|
+
renderError: PropTypes__default["default"].func,
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
207
|
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
208
208
|
*/
|
|
209
|
-
isRequired: PropTypes__default[
|
|
209
|
+
isRequired: PropTypes__default["default"].bool,
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
@@ -218,101 +218,101 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
218
218
|
rest[_key2 - 1] = arguments[_key2];
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
return props.isMulti ? PropTypes__default[
|
|
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
222
|
},
|
|
223
223
|
// CreatableSelectInput
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Aria label (for assistive tech)
|
|
227
227
|
*/
|
|
228
|
-
'aria-label': PropTypes__default[
|
|
228
|
+
'aria-label': PropTypes__default["default"].string,
|
|
229
229
|
|
|
230
230
|
/**
|
|
231
231
|
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
232
232
|
*/
|
|
233
|
-
'aria-labelledby': PropTypes__default[
|
|
233
|
+
'aria-labelledby': PropTypes__default["default"].string,
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* Focus the control when it is mounted
|
|
237
237
|
*/
|
|
238
|
-
isAutofocussed: PropTypes__default[
|
|
238
|
+
isAutofocussed: PropTypes__default["default"].bool,
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* Remove the currently focused option when the user presses backspace
|
|
242
242
|
*/
|
|
243
|
-
backspaceRemovesValue: PropTypes__default[
|
|
243
|
+
backspaceRemovesValue: PropTypes__default["default"].bool,
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
246
|
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
247
247
|
*/
|
|
248
|
-
components: PropTypes__default[
|
|
248
|
+
components: PropTypes__default["default"].objectOf(PropTypes__default["default"].func),
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
251
|
* Custom method to filter whether an option should be displayed in the menu
|
|
252
252
|
*/
|
|
253
|
-
filterOption: PropTypes__default[
|
|
253
|
+
filterOption: PropTypes__default["default"].func,
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
256
|
* The id to set on the SelectContainer component
|
|
257
257
|
*/
|
|
258
|
-
containerId: PropTypes__default[
|
|
258
|
+
containerId: PropTypes__default["default"].string,
|
|
259
259
|
|
|
260
260
|
/**
|
|
261
261
|
* Is the select value clearable
|
|
262
262
|
*/
|
|
263
|
-
isClearable: PropTypes__default[
|
|
263
|
+
isClearable: PropTypes__default["default"].bool,
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
266
|
* Is the select disabled
|
|
267
267
|
*/
|
|
268
|
-
isDisabled: PropTypes__default[
|
|
268
|
+
isDisabled: PropTypes__default["default"].bool,
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* Is the select read-only
|
|
272
272
|
*/
|
|
273
273
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
274
|
-
isReadOnly: PropTypes__default[
|
|
274
|
+
isReadOnly: PropTypes__default["default"].bool,
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* Override the built-in logic to detect whether an option is disabled
|
|
278
278
|
*/
|
|
279
|
-
isOptionDisabled: PropTypes__default[
|
|
279
|
+
isOptionDisabled: PropTypes__default["default"].func,
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
282
|
* Support multiple selected options
|
|
283
283
|
*/
|
|
284
|
-
isMulti: PropTypes__default[
|
|
284
|
+
isMulti: PropTypes__default["default"].bool,
|
|
285
285
|
|
|
286
286
|
/**
|
|
287
287
|
* Whether to enable search functionality
|
|
288
288
|
*/
|
|
289
|
-
isSearchable: PropTypes__default[
|
|
290
|
-
hasWarning: PropTypes__default[
|
|
289
|
+
isSearchable: PropTypes__default["default"].bool,
|
|
290
|
+
hasWarning: PropTypes__default["default"].bool,
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
293
|
* Maximum height of the menu before scrolling
|
|
294
294
|
*/
|
|
295
|
-
maxMenuHeight: PropTypes__default[
|
|
295
|
+
maxMenuHeight: PropTypes__default["default"].number,
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
298
|
* Dom element to portal the select menu to
|
|
299
299
|
*/
|
|
300
|
-
menuPortalTarget: PropTypes__default[
|
|
300
|
+
menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
303
|
* z-index value for the menu portal
|
|
304
304
|
*/
|
|
305
|
-
menuPortalZIndex: PropTypes__default[
|
|
305
|
+
menuPortalZIndex: PropTypes__default["default"].number,
|
|
306
306
|
|
|
307
307
|
/**
|
|
308
308
|
* whether the menu should block scroll while open
|
|
309
309
|
*/
|
|
310
|
-
menuShouldBlockScroll: PropTypes__default[
|
|
310
|
+
menuShouldBlockScroll: PropTypes__default["default"].bool,
|
|
311
311
|
|
|
312
312
|
/**
|
|
313
313
|
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
314
314
|
*/
|
|
315
|
-
name: PropTypes__default[
|
|
315
|
+
name: PropTypes__default["default"].string,
|
|
316
316
|
|
|
317
317
|
/**
|
|
318
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).
|
|
@@ -321,12 +321,12 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
321
321
|
* <br />
|
|
322
322
|
* Signature: `({ inputValue }) => string`
|
|
323
323
|
*/
|
|
324
|
-
noOptionsMessage: PropTypes__default[
|
|
324
|
+
noOptionsMessage: PropTypes__default["default"].func,
|
|
325
325
|
|
|
326
326
|
/**
|
|
327
327
|
* Handle blur events on the control
|
|
328
328
|
*/
|
|
329
|
-
onBlur: PropTypes__default[
|
|
329
|
+
onBlur: PropTypes__default["default"].func,
|
|
330
330
|
|
|
331
331
|
/**
|
|
332
332
|
* Called with a fake event when value changes.
|
|
@@ -335,43 +335,43 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
335
335
|
* <br />
|
|
336
336
|
* Signature: `(event) => void`
|
|
337
337
|
*/
|
|
338
|
-
onChange: PropTypes__default[
|
|
338
|
+
onChange: PropTypes__default["default"].func,
|
|
339
339
|
|
|
340
340
|
/**
|
|
341
341
|
* Handle focus events on the control
|
|
342
342
|
*/
|
|
343
|
-
onFocus: PropTypes__default[
|
|
343
|
+
onFocus: PropTypes__default["default"].func,
|
|
344
344
|
|
|
345
345
|
/**
|
|
346
346
|
* Handle change events on the input
|
|
347
347
|
*/
|
|
348
|
-
onInputChange: PropTypes__default[
|
|
348
|
+
onInputChange: PropTypes__default["default"].func,
|
|
349
349
|
|
|
350
350
|
/**
|
|
351
351
|
* Array of options that populate the select menu
|
|
352
352
|
*/
|
|
353
|
-
options: PropTypes__default[
|
|
354
|
-
value: PropTypes__default[
|
|
355
|
-
}), PropTypes__default[
|
|
356
|
-
options: PropTypes__default[
|
|
357
|
-
value: PropTypes__default[
|
|
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
358
|
}))
|
|
359
359
|
})])),
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
362
|
* Placeholder text for the select value
|
|
363
363
|
*/
|
|
364
|
-
placeholder: PropTypes__default[
|
|
364
|
+
placeholder: PropTypes__default["default"].string,
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
367
|
* Sets the tabIndex attribute on the input
|
|
368
368
|
*/
|
|
369
|
-
tabIndex: PropTypes__default[
|
|
369
|
+
tabIndex: PropTypes__default["default"].string,
|
|
370
370
|
|
|
371
371
|
/**
|
|
372
372
|
* Select the currently focused option when the user presses tab
|
|
373
373
|
*/
|
|
374
|
-
tabSelectsValue: PropTypes__default[
|
|
374
|
+
tabSelectsValue: PropTypes__default["default"].bool,
|
|
375
375
|
|
|
376
376
|
/**
|
|
377
377
|
* The value of the select; reflected by the selected option
|
|
@@ -383,62 +383,62 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
383
383
|
rest[_key3 - 1] = arguments[_key3];
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
return props.isMulti ? PropTypes__default[
|
|
387
|
-
value: PropTypes__default[
|
|
388
|
-
})).apply(void 0, _concatInstanceProperty__default[
|
|
389
|
-
value: PropTypes__default[
|
|
390
|
-
}).apply(void 0, _concatInstanceProperty__default[
|
|
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
391
|
},
|
|
392
|
-
showOptionGroupDivider: PropTypes__default[
|
|
392
|
+
showOptionGroupDivider: PropTypes__default["default"].bool,
|
|
393
393
|
// Creatable props
|
|
394
394
|
|
|
395
395
|
/**
|
|
396
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
397
|
*/
|
|
398
|
-
allowCreateWhileLoading: PropTypes__default[
|
|
398
|
+
allowCreateWhileLoading: PropTypes__default["default"].bool,
|
|
399
399
|
|
|
400
400
|
/**
|
|
401
401
|
* Gets the label for the "create new ..." option in the menu. Is given the current input value.
|
|
402
402
|
*/
|
|
403
|
-
formatCreateLabel: PropTypes__default[
|
|
403
|
+
formatCreateLabel: PropTypes__default["default"].func,
|
|
404
404
|
|
|
405
405
|
/**
|
|
406
406
|
* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
|
|
407
407
|
*/
|
|
408
|
-
isValidNewOption: PropTypes__default[
|
|
408
|
+
isValidNewOption: PropTypes__default["default"].func,
|
|
409
409
|
|
|
410
410
|
/**
|
|
411
411
|
* Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
|
|
412
412
|
*/
|
|
413
|
-
getNewOptionData: PropTypes__default[
|
|
413
|
+
getNewOptionData: PropTypes__default["default"].func,
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
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
417
|
*/
|
|
418
|
-
onCreateOption: PropTypes__default[
|
|
418
|
+
onCreateOption: PropTypes__default["default"].func,
|
|
419
419
|
|
|
420
420
|
/**
|
|
421
421
|
* Sets the position of the createOption element in your options list.
|
|
422
422
|
*/
|
|
423
|
-
createOptionPosition: PropTypes__default[
|
|
423
|
+
createOptionPosition: PropTypes__default["default"].string,
|
|
424
424
|
// LabelField
|
|
425
425
|
|
|
426
426
|
/**
|
|
427
427
|
* Title of the label
|
|
428
428
|
*/
|
|
429
|
-
title: PropTypes__default[
|
|
429
|
+
title: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]).isRequired,
|
|
430
430
|
|
|
431
431
|
/**
|
|
432
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
433
|
*/
|
|
434
|
-
hint: requiredIf__default[
|
|
434
|
+
hint: requiredIf__default["default"](PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]), function (props) {
|
|
435
435
|
return props.hintIcon;
|
|
436
436
|
}),
|
|
437
437
|
|
|
438
438
|
/**
|
|
439
439
|
* Provides a description for the title.
|
|
440
440
|
*/
|
|
441
|
-
description: PropTypes__default[
|
|
441
|
+
description: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]),
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
444
|
* Function called when info button is pressed.
|
|
@@ -447,30 +447,30 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
447
447
|
* <br />
|
|
448
448
|
* Signature: `(event) => void`
|
|
449
449
|
*/
|
|
450
|
-
onInfoButtonClick: PropTypes__default[
|
|
450
|
+
onInfoButtonClick: PropTypes__default["default"].func,
|
|
451
451
|
|
|
452
452
|
/**
|
|
453
453
|
* Icon to be displayed beside the hint text.
|
|
454
454
|
* <br />
|
|
455
455
|
* Will only get rendered when `hint` is passed as well.
|
|
456
456
|
*/
|
|
457
|
-
hintIcon: PropTypes__default[
|
|
457
|
+
hintIcon: PropTypes__default["default"].node,
|
|
458
458
|
|
|
459
459
|
/**
|
|
460
460
|
* Badge to be displayed beside the label.
|
|
461
461
|
* <br />
|
|
462
462
|
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
463
463
|
*/
|
|
464
|
-
badge: PropTypes__default[
|
|
464
|
+
badge: PropTypes__default["default"].node,
|
|
465
465
|
|
|
466
466
|
/**
|
|
467
467
|
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
468
468
|
*/
|
|
469
|
-
iconLeft: PropTypes__default[
|
|
469
|
+
iconLeft: PropTypes__default["default"].node
|
|
470
470
|
} : {};
|
|
471
471
|
|
|
472
|
-
// NOTE: This string will be replaced
|
|
473
|
-
var version =
|
|
472
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
473
|
+
var version = "12.2.7";
|
|
474
474
|
|
|
475
|
-
exports[
|
|
475
|
+
exports["default"] = CreatableSelectField;
|
|
476
476
|
exports.version = version;
|
|
@@ -51,19 +51,19 @@ var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
|
|
|
51
51
|
var CreatableSelectInput__default = /*#__PURE__*/_interopDefault(CreatableSelectInput);
|
|
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('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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
@@ -82,7 +82,7 @@ var CreatableSelectField = /*#__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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
94
94
|
_createClass(CreatableSelectField, [{
|
|
95
95
|
key: "render",
|
|
96
96
|
value: function render() {
|
|
97
|
-
var hasError = CreatableSelectInput__default[
|
|
98
|
-
return jsxRuntime.jsx(Constraints__default[
|
|
97
|
+
var hasError = CreatableSelectInput__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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
108
108
|
badge: this.props.badge,
|
|
109
109
|
hasRequiredIndicator: this.props.isRequired,
|
|
110
110
|
htmlFor: this.state.id
|
|
111
|
-
}), jsxRuntime.jsx(CreatableSelectInput__default[
|
|
111
|
+
}), jsxRuntime.jsx(CreatableSelectInput__default["default"], _objectSpread({
|
|
112
112
|
horizontalConstraint: "scale",
|
|
113
113
|
hasError: hasError,
|
|
114
114
|
"aria-label": this.props['aria-label'],
|
|
@@ -149,7 +149,7 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
149
149
|
createOptionPosition: this.props.createOptionPosition,
|
|
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
|
|
@@ -174,8 +174,8 @@ CreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
174
174
|
};
|
|
175
175
|
CreatableSelectField.propTypes = {};
|
|
176
176
|
|
|
177
|
-
// NOTE: This string will be replaced
|
|
178
|
-
var version =
|
|
177
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
178
|
+
var version = "12.2.7";
|
|
179
179
|
|
|
180
|
-
exports[
|
|
180
|
+
exports["default"] = CreatableSelectField;
|
|
181
181
|
exports.version = version;
|
|
@@ -443,7 +443,7 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
443
443
|
iconLeft: PropTypes.node
|
|
444
444
|
} : {};
|
|
445
445
|
|
|
446
|
-
// NOTE: This string will be replaced
|
|
447
|
-
var version =
|
|
446
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
447
|
+
var version = "12.2.7";
|
|
448
448
|
|
|
449
449
|
export { CreatableSelectField as default, version };
|
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": "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-creatable-select-field.cjs.js",
|
|
20
19
|
"module": "dist/commercetools-uikit-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/constraints": "12.2.
|
|
29
|
-
"@commercetools-uikit/creatable-select-input": "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/constraints": "12.2.5",
|
|
25
|
+
"@commercetools-uikit/creatable-select-input": "12.2.7",
|
|
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",
|