@commercetools-uikit/async-creatable-select-field 12.2.6 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -61
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.d.ts +2 -0
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.dev.js +37 -326
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.prod.js +11 -7
- package/dist/commercetools-uikit-async-creatable-select-field.esm.js +37 -326
- package/dist/declarations/src/async-creatable-select-field.d.ts +79 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/package.json +11 -11
|
@@ -17,12 +17,12 @@ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
|
17
17
|
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
18
18
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
19
19
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
20
|
+
var _pt = require('prop-types');
|
|
20
21
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
21
22
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
22
23
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
24
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
23
25
|
var react = require('react');
|
|
24
|
-
var PropTypes = require('prop-types');
|
|
25
|
-
var requiredIf = require('react-required-if');
|
|
26
26
|
var utils = require('@commercetools-uikit/utils');
|
|
27
27
|
var Constraints = require('@commercetools-uikit/constraints');
|
|
28
28
|
var Spacings = require('@commercetools-uikit/spacings');
|
|
@@ -42,20 +42,20 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
42
42
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
43
43
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
44
44
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
45
|
+
var _pt__default = /*#__PURE__*/_interopDefault(_pt);
|
|
45
46
|
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
46
47
|
var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
|
|
47
48
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
48
|
-
var
|
|
49
|
-
var requiredIf__default = /*#__PURE__*/_interopDefault(requiredIf);
|
|
49
|
+
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
50
50
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
51
51
|
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
52
52
|
var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
|
|
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["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object);
|
|
56
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
57
57
|
|
|
58
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
58
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
59
59
|
|
|
60
60
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
61
61
|
|
|
@@ -97,6 +97,16 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
97
97
|
key: "render",
|
|
98
98
|
value: function render() {
|
|
99
99
|
var hasError = AsyncCreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
100
|
+
|
|
101
|
+
if (this.props.hintIcon) {
|
|
102
|
+
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'TextField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.props.isMulti) {
|
|
106
|
+
process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](this.props.value), 'AsyncCreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
107
|
+
process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](this.props.touched), 'AsyncCreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
100
110
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
101
111
|
max: this.props.horizontalConstraint,
|
|
102
112
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
@@ -131,14 +141,13 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
131
141
|
maxMenuHeight: this.props.maxMenuHeight,
|
|
132
142
|
menuPortalTarget: this.props.menuPortalTarget,
|
|
133
143
|
menuPortalZIndex: this.props.menuPortalZIndex,
|
|
134
|
-
|
|
144
|
+
menuShouldBlockScroll: this.props.menuShouldBlockScroll,
|
|
135
145
|
name: this.props.name,
|
|
136
146
|
noOptionsMessage: this.props.noOptionsMessage,
|
|
137
147
|
onBlur: this.props.onBlur,
|
|
138
148
|
onChange: this.props.onChange,
|
|
139
149
|
onFocus: this.props.onFocus,
|
|
140
150
|
onInputChange: this.props.onInputChange,
|
|
141
|
-
options: this.props.options,
|
|
142
151
|
placeholder: this.props.placeholder,
|
|
143
152
|
tabIndex: this.props.tabIndex,
|
|
144
153
|
tabSelectsValue: this.props.tabSelectsValue,
|
|
@@ -180,327 +189,29 @@ AsyncCreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
180
189
|
};
|
|
181
190
|
};
|
|
182
191
|
AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}),
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error.
|
|
206
|
-
* <br />
|
|
207
|
-
* Signature: `(key, error) => React.node`
|
|
208
|
-
*/
|
|
209
|
-
renderError: PropTypes__default["default"].func,
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
213
|
-
*/
|
|
214
|
-
isRequired: PropTypes__default["default"].bool,
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
218
|
-
*/
|
|
219
|
-
touched: function touched(props) {
|
|
220
|
-
var _context3, _context4, _context5;
|
|
221
|
-
|
|
222
|
-
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
223
|
-
rest[_key2 - 1] = arguments[_key2];
|
|
224
|
-
}
|
|
225
|
-
|
|
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
|
-
},
|
|
228
|
-
// AsyncCreatableSelectInput
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Aria label (for assistive tech)
|
|
232
|
-
*/
|
|
233
|
-
'aria-label': PropTypes__default["default"].string,
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
237
|
-
*/
|
|
238
|
-
'aria-labelledby': PropTypes__default["default"].string,
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Focus the control when it is mounted
|
|
242
|
-
*/
|
|
243
|
-
isAutofocussed: PropTypes__default["default"].bool,
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Remove the currently focused option when the user presses backspace
|
|
247
|
-
*/
|
|
248
|
-
backspaceRemovesValue: PropTypes__default["default"].bool,
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
252
|
-
*/
|
|
253
|
-
components: PropTypes__default["default"].objectOf(PropTypes__default["default"].func),
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Custom method to filter whether an option should be displayed in the menu
|
|
257
|
-
*/
|
|
258
|
-
filterOption: PropTypes__default["default"].func,
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* The id to set on the SelectContainer component
|
|
262
|
-
*/
|
|
263
|
-
containerId: PropTypes__default["default"].string,
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Is the select value clearable
|
|
267
|
-
*/
|
|
268
|
-
isClearable: PropTypes__default["default"].bool,
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Is the select disabled
|
|
272
|
-
*/
|
|
273
|
-
isDisabled: PropTypes__default["default"].bool,
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Is the select read-only
|
|
277
|
-
*/
|
|
278
|
-
isReadOnly: PropTypes__default["default"].bool,
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Override the built-in logic to detect whether an option is disabled
|
|
282
|
-
* <br />
|
|
283
|
-
* Signature: `(option, options) => boolean`
|
|
284
|
-
*/
|
|
285
|
-
isOptionDisabled: PropTypes__default["default"].func,
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Support multiple selected options
|
|
289
|
-
*/
|
|
290
|
-
isMulti: PropTypes__default["default"].bool,
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Whether to enable search functionality
|
|
294
|
-
*/
|
|
295
|
-
isSearchable: PropTypes__default["default"].bool,
|
|
296
|
-
hasWarning: PropTypes__default["default"].bool,
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Maximum height of the menu before scrolling
|
|
300
|
-
*/
|
|
301
|
-
maxMenuHeight: PropTypes__default["default"].number,
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Dom element to portal the select menu to
|
|
305
|
-
*/
|
|
306
|
-
menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* z-index value for the menu portal
|
|
310
|
-
*/
|
|
311
|
-
menuPortalZIndex: PropTypes__default["default"].number,
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* whether the menu should block scroll while open
|
|
315
|
-
*/
|
|
316
|
-
menuShouldBlockScroll: PropTypes__default["default"].bool,
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
320
|
-
*/
|
|
321
|
-
name: PropTypes__default["default"].string,
|
|
322
|
-
|
|
323
|
-
/**
|
|
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).
|
|
325
|
-
* <br/>
|
|
326
|
-
* Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
|
|
327
|
-
* <br />
|
|
328
|
-
* Signature: `({ inputValue }) => string`
|
|
329
|
-
*/
|
|
330
|
-
noOptionsMessage: PropTypes__default["default"].func,
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Handle blur events on the control
|
|
334
|
-
*/
|
|
335
|
-
onBlur: PropTypes__default["default"].func,
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Called with a fake event when value changes.
|
|
339
|
-
* <br />
|
|
340
|
-
* The event's `target.name` will be the name supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.
|
|
341
|
-
* <br />
|
|
342
|
-
* Signature: `(event) => void`
|
|
343
|
-
*/
|
|
344
|
-
onChange: PropTypes__default["default"].func,
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Handle focus events on the control
|
|
348
|
-
*/
|
|
349
|
-
onFocus: PropTypes__default["default"].func,
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Handle change events on the input
|
|
353
|
-
*/
|
|
354
|
-
onInputChange: PropTypes__default["default"].func,
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Array of options that populate the select menu
|
|
358
|
-
*/
|
|
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
|
-
}))
|
|
365
|
-
})])),
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Placeholder text for the select value
|
|
369
|
-
*/
|
|
370
|
-
placeholder: PropTypes__default["default"].string,
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Sets the tabIndex attribute on the input
|
|
374
|
-
*/
|
|
375
|
-
tabIndex: PropTypes__default["default"].string,
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Select the currently focused option when the user presses tab
|
|
379
|
-
*/
|
|
380
|
-
tabSelectsValue: PropTypes__default["default"].bool,
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* The value of the select; reflected by the selected option
|
|
384
|
-
*/
|
|
385
|
-
value: function value(props) {
|
|
386
|
-
var _context6, _context7;
|
|
387
|
-
|
|
388
|
-
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
389
|
-
rest[_key3 - 1] = arguments[_key3];
|
|
390
|
-
}
|
|
391
|
-
|
|
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
|
-
},
|
|
398
|
-
showOptionGroupDivider: PropTypes__default["default"].bool,
|
|
399
|
-
// Async props
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* The default set of options to show before the user starts searching.
|
|
403
|
-
* <br/>
|
|
404
|
-
* When set to `true`, the results for `loadOptions('')` will be autoloaded.
|
|
405
|
-
*/
|
|
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
|
-
}))]),
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Function that returns a promise, which is the set of options to be used once the promise resolves.
|
|
412
|
-
* <br />
|
|
413
|
-
* Signature: `(inputValue, callback) => void)) => Promise | void`
|
|
414
|
-
* <br />
|
|
415
|
-
* `callback` can be called with `options`
|
|
416
|
-
*/
|
|
417
|
-
loadOptions: PropTypes__default["default"].func.isRequired,
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
|
|
421
|
-
*/
|
|
422
|
-
cacheOptions: PropTypes__default["default"].any,
|
|
423
|
-
// Creatable props
|
|
424
|
-
|
|
425
|
-
/**
|
|
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
|
-
*/
|
|
428
|
-
allowCreateWhileLoading: PropTypes__default["default"].bool,
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Gets the label for the "create new ..." option in the menu. Is given the current input value.
|
|
432
|
-
*/
|
|
433
|
-
formatCreateLabel: PropTypes__default["default"].func,
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
|
|
437
|
-
*/
|
|
438
|
-
isValidNewOption: PropTypes__default["default"].func,
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
|
|
442
|
-
*/
|
|
443
|
-
getNewOptionData: PropTypes__default["default"].func,
|
|
444
|
-
|
|
445
|
-
/**
|
|
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
|
-
*/
|
|
448
|
-
onCreateOption: PropTypes__default["default"].func,
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Sets the position of the createOption element in your options list.
|
|
452
|
-
*/
|
|
453
|
-
createOptionPosition: PropTypes__default["default"].string,
|
|
454
|
-
// LabelField
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Title of the label
|
|
458
|
-
*/
|
|
459
|
-
title: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]).isRequired,
|
|
460
|
-
|
|
461
|
-
/**
|
|
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
|
-
*/
|
|
464
|
-
hint: requiredIf__default["default"](PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]), function (props) {
|
|
465
|
-
return props.hintIcon;
|
|
466
|
-
}),
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Provides a description for the title.
|
|
470
|
-
*/
|
|
471
|
-
description: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]),
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* Function called when info button is pressed.
|
|
475
|
-
* <br />
|
|
476
|
-
* Info button will only be visible when this prop is passed.
|
|
477
|
-
* <br />
|
|
478
|
-
* Signature: `(event) => void`
|
|
479
|
-
*/
|
|
480
|
-
onInfoButtonClick: PropTypes__default["default"].func,
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* Icon to be displayed beside the hint text.
|
|
484
|
-
* <br />
|
|
485
|
-
* Will only get rendered when `hint` is passed as well.
|
|
486
|
-
*/
|
|
487
|
-
hintIcon: PropTypes__default["default"].node,
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Badge to be displayed beside the label.
|
|
491
|
-
* <br />
|
|
492
|
-
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
493
|
-
*/
|
|
494
|
-
badge: PropTypes__default["default"].node,
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
498
|
-
*/
|
|
499
|
-
iconLeft: PropTypes__default["default"].node
|
|
192
|
+
horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
193
|
+
errors: _pt__default["default"].objectOf(_pt__default["default"].bool),
|
|
194
|
+
renderError: _pt__default["default"].func,
|
|
195
|
+
isRequired: _pt__default["default"].bool,
|
|
196
|
+
touched: _pt__default["default"].oneOfType([_pt__default["default"].arrayOf(_pt__default["default"].bool), _pt__default["default"].bool]),
|
|
197
|
+
isAutofocussed: _pt__default["default"].bool,
|
|
198
|
+
isReadOnly: _pt__default["default"].bool,
|
|
199
|
+
hasWarning: _pt__default["default"].bool,
|
|
200
|
+
menuPortalZIndex: _pt__default["default"].number,
|
|
201
|
+
onBlur: _pt__default["default"].func,
|
|
202
|
+
onChange: _pt__default["default"].func.isRequired,
|
|
203
|
+
showOptionGroupDivider: _pt__default["default"].bool,
|
|
204
|
+
title: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]).isRequired,
|
|
205
|
+
hint: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
|
|
206
|
+
description: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
|
|
207
|
+
onInfoButtonClick: _pt__default["default"].func,
|
|
208
|
+
hintIcon: _pt__default["default"].element,
|
|
209
|
+
badge: _pt__default["default"].node,
|
|
210
|
+
iconLeft: _pt__default["default"].node
|
|
500
211
|
} : {};
|
|
501
212
|
|
|
502
213
|
// NOTE: This string will be replaced on build time with the package version.
|
|
503
|
-
var version = "
|
|
214
|
+
var version = "13.0.1";
|
|
504
215
|
|
|
505
216
|
exports["default"] = AsyncCreatableSelectField;
|
|
506
217
|
exports.version = version;
|
|
@@ -17,12 +17,12 @@ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
|
17
17
|
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
18
18
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
19
19
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
20
|
+
require('prop-types');
|
|
20
21
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
21
22
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
22
23
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
23
25
|
var react = require('react');
|
|
24
|
-
require('prop-types');
|
|
25
|
-
require('react-required-if');
|
|
26
26
|
var utils = require('@commercetools-uikit/utils');
|
|
27
27
|
var Constraints = require('@commercetools-uikit/constraints');
|
|
28
28
|
var Spacings = require('@commercetools-uikit/spacings');
|
|
@@ -51,9 +51,9 @@ 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["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object);
|
|
54
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
55
55
|
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
56
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
57
57
|
|
|
58
58
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
59
59
|
|
|
@@ -95,6 +95,11 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
95
95
|
key: "render",
|
|
96
96
|
value: function render() {
|
|
97
97
|
var hasError = AsyncCreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
98
|
+
|
|
99
|
+
if (this.props.hintIcon) ;
|
|
100
|
+
|
|
101
|
+
if (this.props.isMulti) ;
|
|
102
|
+
|
|
98
103
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
99
104
|
max: this.props.horizontalConstraint,
|
|
100
105
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
@@ -129,14 +134,13 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
129
134
|
maxMenuHeight: this.props.maxMenuHeight,
|
|
130
135
|
menuPortalTarget: this.props.menuPortalTarget,
|
|
131
136
|
menuPortalZIndex: this.props.menuPortalZIndex,
|
|
132
|
-
|
|
137
|
+
menuShouldBlockScroll: this.props.menuShouldBlockScroll,
|
|
133
138
|
name: this.props.name,
|
|
134
139
|
noOptionsMessage: this.props.noOptionsMessage,
|
|
135
140
|
onBlur: this.props.onBlur,
|
|
136
141
|
onChange: this.props.onChange,
|
|
137
142
|
onFocus: this.props.onFocus,
|
|
138
143
|
onInputChange: this.props.onInputChange,
|
|
139
|
-
options: this.props.options,
|
|
140
144
|
placeholder: this.props.placeholder,
|
|
141
145
|
tabIndex: this.props.tabIndex,
|
|
142
146
|
tabSelectsValue: this.props.tabSelectsValue,
|
|
@@ -180,7 +184,7 @@ AsyncCreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
180
184
|
AsyncCreatableSelectField.propTypes = {};
|
|
181
185
|
|
|
182
186
|
// NOTE: This string will be replaced on build time with the package version.
|
|
183
|
-
var version = "
|
|
187
|
+
var version = "13.0.1";
|
|
184
188
|
|
|
185
189
|
exports["default"] = AsyncCreatableSelectField;
|
|
186
190
|
exports.version = version;
|