@rjsf/chakra-ui 5.0.0-beta.11 → 5.0.0-beta.13

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.
@@ -41,39 +41,32 @@ function _extends() {
41
41
  _extends = Object.assign ? Object.assign.bind() : function (target) {
42
42
  for (var i = 1; i < arguments.length; i++) {
43
43
  var source = arguments[i];
44
-
45
44
  for (var key in source) {
46
45
  if (Object.prototype.hasOwnProperty.call(source, key)) {
47
46
  target[key] = source[key];
48
47
  }
49
48
  }
50
49
  }
51
-
52
50
  return target;
53
51
  };
54
52
  return _extends.apply(this, arguments);
55
53
  }
56
-
57
54
  function _objectWithoutPropertiesLoose(source, excluded) {
58
55
  if (source == null) return {};
59
56
  var target = {};
60
57
  var sourceKeys = Object.keys(source);
61
58
  var key, i;
62
-
63
59
  for (i = 0; i < sourceKeys.length; i++) {
64
60
  key = sourceKeys[i];
65
61
  if (excluded.indexOf(key) >= 0) continue;
66
62
  target[key] = source[key];
67
63
  }
68
-
69
64
  return target;
70
65
  }
71
66
 
72
67
  var _excluded$2 = ["uiSchema"];
73
-
74
68
  var AddButton = function AddButton(_ref) {
75
69
  var props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
76
-
77
70
  return React__default["default"].createElement(react.Button, _extends({
78
71
  leftIcon: React__default["default"].createElement(icons.AddIcon, null)
79
72
  }, props), "Add Item");
@@ -81,21 +74,21 @@ var AddButton = function AddButton(_ref) {
81
74
 
82
75
  var ArrayFieldItemTemplate = function ArrayFieldItemTemplate(props) {
83
76
  var children = props.children,
84
- disabled = props.disabled,
85
- hasToolbar = props.hasToolbar,
86
- hasMoveDown = props.hasMoveDown,
87
- hasMoveUp = props.hasMoveUp,
88
- hasRemove = props.hasRemove,
89
- index = props.index,
90
- onDropIndexClick = props.onDropIndexClick,
91
- onReorderClick = props.onReorderClick,
92
- readonly = props.readonly,
93
- uiSchema = props.uiSchema,
94
- registry = props.registry;
77
+ disabled = props.disabled,
78
+ hasToolbar = props.hasToolbar,
79
+ hasMoveDown = props.hasMoveDown,
80
+ hasMoveUp = props.hasMoveUp,
81
+ hasRemove = props.hasRemove,
82
+ index = props.index,
83
+ onDropIndexClick = props.onDropIndexClick,
84
+ onReorderClick = props.onReorderClick,
85
+ readonly = props.readonly,
86
+ uiSchema = props.uiSchema,
87
+ registry = props.registry;
95
88
  var _registry$templates$B = registry.templates.ButtonTemplates,
96
- MoveDownButton = _registry$templates$B.MoveDownButton,
97
- MoveUpButton = _registry$templates$B.MoveUpButton,
98
- RemoveButton = _registry$templates$B.RemoveButton;
89
+ MoveDownButton = _registry$templates$B.MoveDownButton,
90
+ MoveUpButton = _registry$templates$B.MoveUpButton,
91
+ RemoveButton = _registry$templates$B.RemoveButton;
99
92
  var onRemoveClick = React.useMemo(function () {
100
93
  return onDropIndexClick(index);
101
94
  }, [index, onDropIndexClick]);
@@ -129,24 +122,23 @@ var ArrayFieldItemTemplate = function ArrayFieldItemTemplate(props) {
129
122
  };
130
123
 
131
124
  var _excluded$1 = ["key"];
132
-
133
125
  var ArrayFieldTemplate = function ArrayFieldTemplate(props) {
134
126
  var canAdd = props.canAdd,
135
- disabled = props.disabled,
136
- idSchema = props.idSchema,
137
- uiSchema = props.uiSchema,
138
- items = props.items,
139
- onAddClick = props.onAddClick,
140
- readonly = props.readonly,
141
- registry = props.registry,
142
- required = props.required,
143
- schema = props.schema,
144
- title = props.title;
127
+ disabled = props.disabled,
128
+ idSchema = props.idSchema,
129
+ uiSchema = props.uiSchema,
130
+ items = props.items,
131
+ onAddClick = props.onAddClick,
132
+ readonly = props.readonly,
133
+ registry = props.registry,
134
+ required = props.required,
135
+ schema = props.schema,
136
+ title = props.title;
145
137
  var uiOptions = utils.getUiOptions(uiSchema);
146
138
  var ArrayFieldDescriptionTemplate = utils.getTemplate("ArrayFieldDescriptionTemplate", registry, uiOptions);
147
139
  var ArrayFieldItemTemplate = utils.getTemplate("ArrayFieldItemTemplate", registry, uiOptions);
148
- var ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
149
-
140
+ var ArrayFieldTitleTemplate = utils.getTemplate("ArrayFieldTitleTemplate", registry, uiOptions);
141
+ // Button templates are not overridden in the uiSchema
150
142
  var AddButton = registry.templates.ButtonTemplates.AddButton;
151
143
  return React__default["default"].createElement(react.Box, null, React__default["default"].createElement(ArrayFieldTitleTemplate, {
152
144
  idSchema: idSchema,
@@ -165,8 +157,7 @@ var ArrayFieldTemplate = function ArrayFieldTemplate(props) {
165
157
  key: "array-item-list-" + idSchema.$id
166
158
  }, React__default["default"].createElement(react.GridItem, null, items.length > 0 && items.map(function (_ref) {
167
159
  var key = _ref.key,
168
- itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
169
-
160
+ itemProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
170
161
  return React__default["default"].createElement(ArrayFieldItemTemplate, _extends({
171
162
  key: key
172
163
  }, itemProps));
@@ -184,7 +175,7 @@ var ArrayFieldTemplate = function ArrayFieldTemplate(props) {
184
175
 
185
176
  function getChakra(_ref) {
186
177
  var _ref$uiSchema = _ref.uiSchema,
187
- uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
178
+ uiSchema = _ref$uiSchema === void 0 ? {} : _ref$uiSchema;
188
179
  var chakraProps = uiSchema["ui:options"] && uiSchema["ui:options"].chakra || {};
189
180
  Object.keys(chakraProps).forEach(function (key) {
190
181
  /**
@@ -203,43 +194,39 @@ function getChakra(_ref) {
203
194
 
204
195
  var BaseInputTemplate = function BaseInputTemplate(props) {
205
196
  var id = props.id,
206
- type = props.type,
207
- value = props.value,
208
- label = props.label,
209
- schema = props.schema,
210
- uiSchema = props.uiSchema,
211
- onChange = props.onChange,
212
- onBlur = props.onBlur,
213
- onFocus = props.onFocus,
214
- options = props.options,
215
- required = props.required,
216
- readonly = props.readonly,
217
- rawErrors = props.rawErrors,
218
- autofocus = props.autofocus,
219
- placeholder = props.placeholder,
220
- disabled = props.disabled,
221
- registry = props.registry;
197
+ type = props.type,
198
+ value = props.value,
199
+ label = props.label,
200
+ schema = props.schema,
201
+ uiSchema = props.uiSchema,
202
+ onChange = props.onChange,
203
+ onBlur = props.onBlur,
204
+ onFocus = props.onFocus,
205
+ options = props.options,
206
+ required = props.required,
207
+ readonly = props.readonly,
208
+ rawErrors = props.rawErrors,
209
+ autofocus = props.autofocus,
210
+ placeholder = props.placeholder,
211
+ disabled = props.disabled,
212
+ registry = props.registry;
222
213
  var inputProps = utils.getInputProps(schema, type, options);
223
214
  var chakraProps = getChakra({
224
215
  uiSchema: uiSchema
225
216
  });
226
217
  var schemaUtils = registry.schemaUtils;
227
-
228
218
  var _onChange = function _onChange(_ref) {
229
219
  var value = _ref.target.value;
230
220
  return onChange(value === "" ? options.emptyValue : value);
231
221
  };
232
-
233
222
  var _onBlur = function _onBlur(_ref2) {
234
223
  var value = _ref2.target.value;
235
224
  return onBlur(id, value);
236
225
  };
237
-
238
226
  var _onFocus = function _onFocus(_ref3) {
239
227
  var value = _ref3.target.value;
240
228
  return onFocus(id, value);
241
229
  };
242
-
243
230
  var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
244
231
  return React__namespace.createElement(react.FormControl, _extends({
245
232
  mb: 1
@@ -274,12 +261,10 @@ var BaseInputTemplate = function BaseInputTemplate(props) {
274
261
 
275
262
  var DescriptionField = function DescriptionField(_ref) {
276
263
  var description = _ref.description,
277
- id = _ref.id;
278
-
264
+ id = _ref.id;
279
265
  if (!description) {
280
266
  return null;
281
267
  }
282
-
283
268
  if (typeof description === "string") {
284
269
  return React__default["default"].createElement(react.Text, {
285
270
  id: id,
@@ -287,7 +272,6 @@ var DescriptionField = function DescriptionField(_ref) {
287
272
  mb: 4
288
273
  }, description);
289
274
  }
290
-
291
275
  return React__default["default"].createElement(React__default["default"].Fragment, null, description);
292
276
  };
293
277
 
@@ -313,11 +297,9 @@ var _excluded = ["icon", "iconType", "uiSchema"];
313
297
  * props used in Template:
314
298
  * icon, tabIndex, disabled, onClick
315
299
  */
316
-
317
300
  var ChakraIconButton = /*#__PURE__*/React.memo(function (props) {
318
301
  var icon = props.icon,
319
- otherProps = _objectWithoutPropertiesLoose(props, _excluded);
320
-
302
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
321
303
  return React__default["default"].createElement(react.IconButton, _extends({
322
304
  "aria-label": props.title
323
305
  }, otherProps, {
@@ -351,16 +333,13 @@ function RemoveButton(props) {
351
333
  *
352
334
  * @param props - The `FieldErrorProps` for the errors being rendered
353
335
  */
354
-
355
336
  function FieldErrorTemplate(props) {
356
337
  var _props$errors = props.errors,
357
- errors = _props$errors === void 0 ? [] : _props$errors,
358
- idSchema = props.idSchema;
359
-
338
+ errors = _props$errors === void 0 ? [] : _props$errors,
339
+ idSchema = props.idSchema;
360
340
  if (errors.length === 0) {
361
341
  return null;
362
342
  }
363
-
364
343
  var id = idSchema.$id + "__error";
365
344
  return React__default["default"].createElement(react.List, null, errors.map(function (error, i) {
366
345
  return React__default["default"].createElement(react.ListItem, {
@@ -375,15 +354,12 @@ function FieldErrorTemplate(props) {
375
354
  *
376
355
  * @param props - The `FieldHelpProps` to be rendered
377
356
  */
378
-
379
357
  function FieldHelpTemplate(props) {
380
358
  var idSchema = props.idSchema,
381
- help = props.help;
382
-
359
+ help = props.help;
383
360
  if (!help) {
384
361
  return null;
385
362
  }
386
-
387
363
  var id = idSchema.$id + "__help";
388
364
  return React__default["default"].createElement(react.FormHelperText, {
389
365
  id: id
@@ -392,27 +368,26 @@ function FieldHelpTemplate(props) {
392
368
 
393
369
  var FieldTemplate = function FieldTemplate(props) {
394
370
  var id = props.id,
395
- children = props.children,
396
- classNames = props.classNames,
397
- disabled = props.disabled,
398
- displayLabel = props.displayLabel,
399
- hidden = props.hidden,
400
- label = props.label,
401
- onDropPropertyClick = props.onDropPropertyClick,
402
- onKeyChange = props.onKeyChange,
403
- readonly = props.readonly,
404
- registry = props.registry,
405
- required = props.required,
406
- _props$rawErrors = props.rawErrors,
407
- rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
408
- errors = props.errors,
409
- help = props.help,
410
- rawDescription = props.rawDescription,
411
- schema = props.schema,
412
- uiSchema = props.uiSchema;
371
+ children = props.children,
372
+ classNames = props.classNames,
373
+ disabled = props.disabled,
374
+ displayLabel = props.displayLabel,
375
+ hidden = props.hidden,
376
+ label = props.label,
377
+ onDropPropertyClick = props.onDropPropertyClick,
378
+ onKeyChange = props.onKeyChange,
379
+ readonly = props.readonly,
380
+ registry = props.registry,
381
+ required = props.required,
382
+ _props$rawErrors = props.rawErrors,
383
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
384
+ errors = props.errors,
385
+ help = props.help,
386
+ rawDescription = props.rawDescription,
387
+ schema = props.schema,
388
+ uiSchema = props.uiSchema;
413
389
  var uiOptions = utils.getUiOptions(uiSchema);
414
390
  var WrapIfAdditionalTemplate = utils.getTemplate("WrapIfAdditionalTemplate", registry, uiOptions);
415
-
416
391
  if (hidden) {
417
392
  return React__default["default"].createElement("div", {
418
393
  style: {
@@ -420,7 +395,6 @@ var FieldTemplate = function FieldTemplate(props) {
420
395
  }
421
396
  }, children);
422
397
  }
423
-
424
398
  return React__default["default"].createElement(WrapIfAdditionalTemplate, {
425
399
  classNames: classNames,
426
400
  disabled: disabled,
@@ -443,21 +417,21 @@ var FieldTemplate = function FieldTemplate(props) {
443
417
 
444
418
  var ObjectFieldTemplate = function ObjectFieldTemplate(props) {
445
419
  var description = props.description,
446
- title = props.title,
447
- properties = props.properties,
448
- required = props.required,
449
- disabled = props.disabled,
450
- readonly = props.readonly,
451
- uiSchema = props.uiSchema,
452
- idSchema = props.idSchema,
453
- schema = props.schema,
454
- formData = props.formData,
455
- onAddClick = props.onAddClick,
456
- registry = props.registry;
420
+ title = props.title,
421
+ properties = props.properties,
422
+ required = props.required,
423
+ disabled = props.disabled,
424
+ readonly = props.readonly,
425
+ uiSchema = props.uiSchema,
426
+ idSchema = props.idSchema,
427
+ schema = props.schema,
428
+ formData = props.formData,
429
+ onAddClick = props.onAddClick,
430
+ registry = props.registry;
457
431
  var uiOptions = utils.getUiOptions(uiSchema);
458
432
  var TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
459
- var DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions); // Button templates are not overridden in the uiSchema
460
-
433
+ var DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, uiOptions);
434
+ // Button templates are not overridden in the uiSchema
461
435
  var AddButton = registry.templates.ButtonTemplates.AddButton;
462
436
  return React__default["default"].createElement(React__default["default"].Fragment, null, (uiOptions.title || title) && React__default["default"].createElement(TitleFieldTemplate, {
463
437
  id: idSchema.$id + "-title",
@@ -491,16 +465,13 @@ var ObjectFieldTemplate = function ObjectFieldTemplate(props) {
491
465
 
492
466
  var SubmitButton = function SubmitButton(_ref) {
493
467
  var uiSchema = _ref.uiSchema;
494
-
495
468
  var _getSubmitButtonOptio = utils.getSubmitButtonOptions(uiSchema),
496
- submitText = _getSubmitButtonOptio.submitText,
497
- norender = _getSubmitButtonOptio.norender,
498
- submitButtonProps = _getSubmitButtonOptio.props;
499
-
469
+ submitText = _getSubmitButtonOptio.submitText,
470
+ norender = _getSubmitButtonOptio.norender,
471
+ submitButtonProps = _getSubmitButtonOptio.props;
500
472
  if (norender) {
501
473
  return null;
502
474
  }
503
-
504
475
  return React__default["default"].createElement(react.Box, {
505
476
  marginTop: 3
506
477
  }, React__default["default"].createElement(react.Button, _extends({
@@ -511,7 +482,7 @@ var SubmitButton = function SubmitButton(_ref) {
511
482
 
512
483
  var TitleField = function TitleField(_ref) {
513
484
  var id = _ref.id,
514
- title = _ref.title;
485
+ title = _ref.title;
515
486
  return React__default["default"].createElement(react.Box, {
516
487
  id: id,
517
488
  mt: 1,
@@ -523,34 +494,30 @@ var TitleField = function TitleField(_ref) {
523
494
 
524
495
  var WrapIfAdditionalTemplate = function WrapIfAdditionalTemplate(props) {
525
496
  var children = props.children,
526
- classNames = props.classNames,
527
- disabled = props.disabled,
528
- id = props.id,
529
- label = props.label,
530
- onDropPropertyClick = props.onDropPropertyClick,
531
- onKeyChange = props.onKeyChange,
532
- readonly = props.readonly,
533
- registry = props.registry,
534
- required = props.required,
535
- schema = props.schema,
536
- uiSchema = props.uiSchema; // Button templates are not overridden in the uiSchema
537
-
497
+ classNames = props.classNames,
498
+ disabled = props.disabled,
499
+ id = props.id,
500
+ label = props.label,
501
+ onDropPropertyClick = props.onDropPropertyClick,
502
+ onKeyChange = props.onKeyChange,
503
+ readonly = props.readonly,
504
+ registry = props.registry,
505
+ required = props.required,
506
+ schema = props.schema,
507
+ uiSchema = props.uiSchema;
508
+ // Button templates are not overridden in the uiSchema
538
509
  var RemoveButton = registry.templates.ButtonTemplates.RemoveButton;
539
510
  var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
540
-
541
511
  if (!additional) {
542
512
  return React__default["default"].createElement("div", {
543
513
  className: classNames
544
514
  }, children);
545
515
  }
546
-
547
516
  var keyLabel = label + " Key";
548
-
549
517
  var handleBlur = function handleBlur(_ref) {
550
518
  var target = _ref.target;
551
519
  return onKeyChange(target.value);
552
520
  };
553
-
554
521
  return React__default["default"].createElement(react.Grid, {
555
522
  key: id + "-key",
556
523
  className: classNames,
@@ -599,85 +566,69 @@ var Templates = {
599
566
 
600
567
  var rangeOptions = function rangeOptions(start, stop) {
601
568
  var options = [];
602
-
603
569
  for (var i = start; i <= stop; i++) {
604
570
  options.push({
605
571
  value: i,
606
572
  label: utils.pad(i, 2)
607
573
  });
608
574
  }
609
-
610
575
  return options;
611
576
  };
612
-
613
577
  var readyForChange = function readyForChange(state) {
614
578
  return Object.keys(state).every(function (key) {
615
579
  return typeof state[key] !== "undefined" && state[key] !== -1;
616
580
  });
617
581
  };
618
-
619
582
  var AltDateWidget = function AltDateWidget(props) {
620
583
  var autofocus = props.autofocus,
621
- disabled = props.disabled,
622
- id = props.id,
623
- onBlur = props.onBlur,
624
- onChange = props.onChange,
625
- onFocus = props.onFocus,
626
- options = props.options,
627
- readonly = props.readonly,
628
- registry = props.registry,
629
- showTime = props.showTime,
630
- value = props.value;
584
+ disabled = props.disabled,
585
+ id = props.id,
586
+ onBlur = props.onBlur,
587
+ onChange = props.onChange,
588
+ onFocus = props.onFocus,
589
+ options = props.options,
590
+ readonly = props.readonly,
591
+ registry = props.registry,
592
+ showTime = props.showTime,
593
+ value = props.value;
631
594
  var SelectWidget = registry.widgets.SelectWidget;
632
-
633
595
  var _useState = React.useState(utils.parseDateString(value, showTime)),
634
- state = _useState[0],
635
- setState = _useState[1];
636
-
596
+ state = _useState[0],
597
+ setState = _useState[1];
637
598
  React.useEffect(function () {
638
599
  setState(utils.parseDateString(value, showTime));
639
600
  }, [showTime, value]);
640
-
641
601
  var handleChange = function handleChange(property, nextValue) {
642
602
  var _extends2;
643
-
644
603
  var nextState = _extends({}, state, (_extends2 = {}, _extends2[property] = typeof nextValue === "undefined" ? -1 : nextValue, _extends2));
645
-
646
604
  if (readyForChange(nextState)) {
647
605
  onChange(utils.toDateString(nextState, showTime));
648
606
  } else {
649
607
  setState(nextState);
650
608
  }
651
609
  };
652
-
653
610
  var handleNow = function handleNow(event) {
654
611
  event.preventDefault();
655
-
656
612
  if (disabled || readonly) {
657
613
  return;
658
614
  }
659
-
660
615
  var nextState = utils.parseDateString(new Date().toJSON(), showTime);
661
616
  onChange(utils.toDateString(nextState, showTime));
662
617
  };
663
-
664
618
  var handleClear = function handleClear(event) {
665
619
  event.preventDefault();
666
-
667
620
  if (disabled || readonly) {
668
621
  return;
669
622
  }
670
-
671
623
  onChange(undefined);
672
624
  };
673
-
674
625
  var dateElementProps = function dateElementProps() {
675
626
  var year = state.year,
676
- month = state.month,
677
- day = state.day,
678
- hour = state.hour,
679
- minute = state.minute,
680
- second = state.second;
627
+ month = state.month,
628
+ day = state.day,
629
+ hour = state.hour,
630
+ minute = state.minute,
631
+ second = state.second;
681
632
  var data = [{
682
633
  type: "year",
683
634
  range: options.yearsRange,
@@ -691,7 +642,6 @@ var AltDateWidget = function AltDateWidget(props) {
691
642
  range: [1, 31],
692
643
  value: day
693
644
  }];
694
-
695
645
  if (showTime) {
696
646
  data.push({
697
647
  type: "hour",
@@ -707,10 +657,8 @@ var AltDateWidget = function AltDateWidget(props) {
707
657
  value: second
708
658
  });
709
659
  }
710
-
711
660
  return data;
712
661
  };
713
-
714
662
  var renderDateElement = function renderDateElement(elemProps) {
715
663
  var value = elemProps.value ? elemProps.value : undefined;
716
664
  return React__default["default"].createElement(SelectWidget, _extends({}, elemProps, {
@@ -729,7 +677,6 @@ var AltDateWidget = function AltDateWidget(props) {
729
677
  value: value
730
678
  }));
731
679
  };
732
-
733
680
  return React__default["default"].createElement(react.Box, null, React__default["default"].createElement(react.Box, {
734
681
  display: "flex",
735
682
  flexWrap: "wrap",
@@ -766,7 +713,6 @@ var AltDateWidget = function AltDateWidget(props) {
766
713
  }
767
714
  }, "Clear")));
768
715
  };
769
-
770
716
  AltDateWidget.defaultProps = {
771
717
  autofocus: false,
772
718
  disabled: false,
@@ -783,41 +729,36 @@ var AltDateTimeWidget = function AltDateTimeWidget(props) {
783
729
  showTime: true
784
730
  }));
785
731
  };
786
-
787
732
  AltDateTimeWidget.defaultProps = /*#__PURE__*/_extends({}, AltDateWidget.defaultProps, {
788
733
  showTime: true
789
734
  });
790
735
 
791
736
  var CheckboxWidget = function CheckboxWidget(props) {
792
737
  var id = props.id,
793
- value = props.value,
794
- disabled = props.disabled,
795
- readonly = props.readonly,
796
- onChange = props.onChange,
797
- onBlur = props.onBlur,
798
- onFocus = props.onFocus,
799
- required = props.required,
800
- label = props.label,
801
- uiSchema = props.uiSchema;
738
+ value = props.value,
739
+ disabled = props.disabled,
740
+ readonly = props.readonly,
741
+ onChange = props.onChange,
742
+ onBlur = props.onBlur,
743
+ onFocus = props.onFocus,
744
+ required = props.required,
745
+ label = props.label,
746
+ uiSchema = props.uiSchema;
802
747
  var chakraProps = getChakra({
803
748
  uiSchema: uiSchema
804
749
  });
805
-
806
750
  var _onChange = function _onChange(_ref) {
807
751
  var checked = _ref.target.checked;
808
752
  return onChange(checked);
809
753
  };
810
-
811
754
  var _onBlur = function _onBlur(_ref2) {
812
755
  var value = _ref2.target.value;
813
756
  return onBlur(id, value);
814
757
  };
815
-
816
758
  var _onFocus = function _onFocus(_ref3) {
817
759
  var value = _ref3.target.value;
818
760
  return onFocus(id, value);
819
761
  };
820
-
821
762
  return React__default["default"].createElement(react.FormControl, _extends({
822
763
  mb: 1
823
764
  }, chakraProps, {
@@ -833,6 +774,7 @@ var CheckboxWidget = function CheckboxWidget(props) {
833
774
  }, label && React__default["default"].createElement(react.Text, null, label)));
834
775
  };
835
776
 
777
+ // const selectValue = (value, selected, all) => {
836
778
  // const at = all.indexOf(value);
837
779
  // const updated = selected.slice(0, at).concat(value, selected.slice(at));
838
780
  // // As inserting values at predefined index positions doesn't work with empty
@@ -842,27 +784,27 @@ var CheckboxWidget = function CheckboxWidget(props) {
842
784
  // const deselectValue = (value, selected) => {
843
785
  // return selected.filter((v) => v !== value);
844
786
  // };
845
-
846
787
  var CheckboxesWidget = function CheckboxesWidget(props) {
847
788
  var id = props.id,
848
- disabled = props.disabled,
849
- options = props.options,
850
- value = props.value,
851
- readonly = props.readonly,
852
- _onChange = props.onChange,
853
- onBlur = props.onBlur,
854
- onFocus = props.onFocus,
855
- required = props.required,
856
- label = props.label,
857
- uiSchema = props.uiSchema,
858
- _props$rawErrors = props.rawErrors,
859
- rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
860
- schema = props.schema;
789
+ disabled = props.disabled,
790
+ options = props.options,
791
+ value = props.value,
792
+ readonly = props.readonly,
793
+ _onChange = props.onChange,
794
+ onBlur = props.onBlur,
795
+ onFocus = props.onFocus,
796
+ required = props.required,
797
+ label = props.label,
798
+ uiSchema = props.uiSchema,
799
+ _props$rawErrors = props.rawErrors,
800
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
801
+ schema = props.schema;
861
802
  var enumOptions = options.enumOptions,
862
- enumDisabled = options.enumDisabled;
803
+ enumDisabled = options.enumDisabled;
863
804
  var chakraProps = getChakra({
864
805
  uiSchema: uiSchema
865
- }); // const _onChange = option => ({ target: { checked } }) => {
806
+ });
807
+ // const _onChange = option => ({ target: { checked } }) => {
866
808
  // const all = enumOptions.map(({ value }) => value)
867
809
  // if (checked) {
868
810
  // onChange(selectValue(option.value, value, all))
@@ -870,17 +812,14 @@ var CheckboxesWidget = function CheckboxesWidget(props) {
870
812
  // onChange(deselectValue(option.value, value))
871
813
  // }
872
814
  // }
873
-
874
815
  var _onBlur = function _onBlur(_ref) {
875
816
  var value = _ref.target.value;
876
817
  return onBlur(id, value);
877
818
  };
878
-
879
819
  var _onFocus = function _onFocus(_ref2) {
880
820
  var value = _ref2.target.value;
881
821
  return onFocus(id, value);
882
822
  };
883
-
884
823
  var row = options ? options.inline : false;
885
824
  return React__default["default"].createElement(react.FormControl, _extends({
886
825
  mb: 1
@@ -917,33 +856,30 @@ var CheckboxesWidget = function CheckboxesWidget(props) {
917
856
 
918
857
  var RadioWidget = function RadioWidget(_ref) {
919
858
  var id = _ref.id,
920
- schema = _ref.schema,
921
- options = _ref.options,
922
- value = _ref.value,
923
- required = _ref.required,
924
- disabled = _ref.disabled,
925
- readonly = _ref.readonly,
926
- label = _ref.label,
927
- onChange = _ref.onChange,
928
- onBlur = _ref.onBlur,
929
- onFocus = _ref.onFocus,
930
- uiSchema = _ref.uiSchema;
859
+ schema = _ref.schema,
860
+ options = _ref.options,
861
+ value = _ref.value,
862
+ required = _ref.required,
863
+ disabled = _ref.disabled,
864
+ readonly = _ref.readonly,
865
+ label = _ref.label,
866
+ onChange = _ref.onChange,
867
+ onBlur = _ref.onBlur,
868
+ onFocus = _ref.onFocus,
869
+ uiSchema = _ref.uiSchema;
931
870
  var enumOptions = options.enumOptions,
932
- enumDisabled = options.enumDisabled;
871
+ enumDisabled = options.enumDisabled;
933
872
  var chakraProps = getChakra({
934
873
  uiSchema: uiSchema
935
874
  });
936
-
937
875
  var _onBlur = function _onBlur(_ref2) {
938
876
  var value = _ref2.target.value;
939
877
  return onBlur(id, value);
940
878
  };
941
-
942
879
  var _onFocus = function _onFocus(_ref3) {
943
880
  var value = _ref3.target.value;
944
881
  return onFocus(id, value);
945
882
  };
946
-
947
883
  var row = options ? options.inline : false;
948
884
  return React__default["default"].createElement(react.FormControl, _extends({
949
885
  mb: 1
@@ -975,44 +911,38 @@ var RadioWidget = function RadioWidget(_ref) {
975
911
 
976
912
  var RangeWidget = function RangeWidget(_ref) {
977
913
  var value = _ref.value,
978
- readonly = _ref.readonly,
979
- disabled = _ref.disabled,
980
- onBlur = _ref.onBlur,
981
- onFocus = _ref.onFocus,
982
- options = _ref.options,
983
- schema = _ref.schema,
984
- uiSchema = _ref.uiSchema,
985
- onChange = _ref.onChange,
986
- label = _ref.label,
987
- id = _ref.id,
988
- registry = _ref.registry;
914
+ readonly = _ref.readonly,
915
+ disabled = _ref.disabled,
916
+ onBlur = _ref.onBlur,
917
+ onFocus = _ref.onFocus,
918
+ options = _ref.options,
919
+ schema = _ref.schema,
920
+ uiSchema = _ref.uiSchema,
921
+ onChange = _ref.onChange,
922
+ label = _ref.label,
923
+ id = _ref.id,
924
+ registry = _ref.registry;
989
925
  var schemaUtils = registry.schemaUtils;
990
926
  var chakraProps = getChakra({
991
927
  uiSchema: uiSchema
992
928
  });
993
-
994
929
  var sliderWidgetProps = _extends({
995
930
  value: value,
996
931
  label: label,
997
932
  id: id
998
933
  }, utils.rangeSpec(schema));
999
-
1000
934
  var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
1001
-
1002
935
  var _onChange = function _onChange(value) {
1003
936
  return onChange(value === undefined ? options.emptyValue : value);
1004
937
  };
1005
-
1006
938
  var _onBlur = function _onBlur(_ref2) {
1007
939
  var value = _ref2.target.value;
1008
940
  return onBlur(id, value);
1009
941
  };
1010
-
1011
942
  var _onFocus = function _onFocus(_ref3) {
1012
943
  var value = _ref3.target.value;
1013
944
  return onFocus(id, value);
1014
945
  };
1015
-
1016
946
  return React__default["default"].createElement(react.FormControl, _extends({
1017
947
  mb: 1
1018
948
  }, chakraProps), displayLabel ? React__default["default"].createElement(react.FormLabel, {
@@ -1029,52 +959,47 @@ var RangeWidget = function RangeWidget(_ref) {
1029
959
 
1030
960
  var SelectWidget = function SelectWidget(props) {
1031
961
  var schema = props.schema,
1032
- id = props.id,
1033
- options = props.options,
1034
- label = props.label,
1035
- placeholder = props.placeholder,
1036
- multiple = props.multiple,
1037
- required = props.required,
1038
- disabled = props.disabled,
1039
- readonly = props.readonly,
1040
- value = props.value,
1041
- autofocus = props.autofocus,
1042
- onChange = props.onChange,
1043
- onBlur = props.onBlur,
1044
- onFocus = props.onFocus,
1045
- _props$rawErrors = props.rawErrors,
1046
- rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
1047
- uiSchema = props.uiSchema;
962
+ id = props.id,
963
+ options = props.options,
964
+ label = props.label,
965
+ placeholder = props.placeholder,
966
+ multiple = props.multiple,
967
+ required = props.required,
968
+ disabled = props.disabled,
969
+ readonly = props.readonly,
970
+ value = props.value,
971
+ autofocus = props.autofocus,
972
+ onChange = props.onChange,
973
+ onBlur = props.onBlur,
974
+ onFocus = props.onFocus,
975
+ _props$rawErrors = props.rawErrors,
976
+ rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors,
977
+ uiSchema = props.uiSchema;
1048
978
  var enumOptions = options.enumOptions,
1049
- enumDisabled = options.enumDisabled;
979
+ enumDisabled = options.enumDisabled;
1050
980
  var chakraProps = getChakra({
1051
981
  uiSchema: uiSchema
1052
982
  });
1053
-
1054
983
  var _onMultiChange = function _onMultiChange(e) {
1055
984
  return onChange(utils.processSelectValue(schema, e.map(function (v) {
1056
985
  return v.value;
1057
986
  }), options));
1058
987
  };
1059
-
1060
988
  var _onChange = function _onChange(e) {
1061
989
  return onChange(utils.processSelectValue(schema, e.value, options));
1062
990
  };
1063
-
1064
991
  var _onBlur = function _onBlur(_ref) {
1065
992
  var value = _ref.target.value;
1066
993
  return onBlur(id, utils.processSelectValue(schema, value, options));
1067
994
  };
1068
-
1069
995
  var _onFocus = function _onFocus(_ref2) {
1070
996
  var value = _ref2.target.value;
1071
997
  return onFocus(id, utils.processSelectValue(schema, value, options));
1072
998
  };
1073
-
1074
999
  var _valueLabelMap = {};
1075
1000
  enumOptions.map(function (option) {
1076
1001
  var value = option.value,
1077
- label = option.label;
1002
+ label = option.label;
1078
1003
  _valueLabelMap[value] = label;
1079
1004
  option["isDisabled"] = enumDisabled && enumDisabled.indexOf(value) != -1;
1080
1005
  });
@@ -1103,7 +1028,7 @@ var SelectWidget = function SelectWidget(props) {
1103
1028
  isMulti: isMultiple,
1104
1029
  options: enumOptions,
1105
1030
  placeholder: placeholder,
1106
- closeMenuOnSelect: false,
1031
+ closeMenuOnSelect: !isMultiple,
1107
1032
  onBlur: _onBlur,
1108
1033
  onChange: isMultiple ? _onMultiChange : _onChange,
1109
1034
  onFocus: _onFocus,
@@ -1114,42 +1039,38 @@ var SelectWidget = function SelectWidget(props) {
1114
1039
 
1115
1040
  var TextareaWidget = function TextareaWidget(_ref) {
1116
1041
  var id = _ref.id,
1117
- placeholder = _ref.placeholder,
1118
- value = _ref.value,
1119
- label = _ref.label,
1120
- disabled = _ref.disabled,
1121
- autofocus = _ref.autofocus,
1122
- readonly = _ref.readonly,
1123
- onBlur = _ref.onBlur,
1124
- onFocus = _ref.onFocus,
1125
- onChange = _ref.onChange,
1126
- options = _ref.options,
1127
- schema = _ref.schema,
1128
- uiSchema = _ref.uiSchema,
1129
- required = _ref.required,
1130
- rawErrors = _ref.rawErrors,
1131
- registry = _ref.registry;
1042
+ placeholder = _ref.placeholder,
1043
+ value = _ref.value,
1044
+ label = _ref.label,
1045
+ disabled = _ref.disabled,
1046
+ autofocus = _ref.autofocus,
1047
+ readonly = _ref.readonly,
1048
+ onBlur = _ref.onBlur,
1049
+ onFocus = _ref.onFocus,
1050
+ onChange = _ref.onChange,
1051
+ options = _ref.options,
1052
+ schema = _ref.schema,
1053
+ uiSchema = _ref.uiSchema,
1054
+ required = _ref.required,
1055
+ rawErrors = _ref.rawErrors,
1056
+ registry = _ref.registry;
1132
1057
  var chakraProps = getChakra({
1133
1058
  uiSchema: uiSchema
1134
1059
  });
1135
1060
  var schemaUtils = registry.schemaUtils;
1136
1061
  var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
1137
-
1138
1062
  var _onChange = function _onChange(_ref2) {
1139
1063
  var value = _ref2.target.value;
1140
1064
  return onChange(value === "" ? options.emptyValue : value);
1141
1065
  };
1142
-
1143
1066
  var _onBlur = function _onBlur(_ref3) {
1144
1067
  var value = _ref3.target.value;
1145
1068
  return onBlur(id, value);
1146
1069
  };
1147
-
1148
1070
  var _onFocus = function _onFocus(_ref4) {
1149
1071
  var value = _ref4.target.value;
1150
1072
  return onFocus(id, value);
1151
1073
  };
1152
-
1153
1074
  return React__default["default"].createElement(react.FormControl, _extends({
1154
1075
  mb: 1
1155
1076
  }, chakraProps, {
@@ -1173,38 +1094,34 @@ var TextareaWidget = function TextareaWidget(_ref) {
1173
1094
 
1174
1095
  var UpDownWidget = function UpDownWidget(props) {
1175
1096
  var id = props.id,
1176
- schema = props.schema,
1177
- uiSchema = props.uiSchema,
1178
- readonly = props.readonly,
1179
- disabled = props.disabled,
1180
- label = props.label,
1181
- value = props.value,
1182
- onChange = props.onChange,
1183
- onBlur = props.onBlur,
1184
- onFocus = props.onFocus,
1185
- rawErrors = props.rawErrors,
1186
- required = props.required,
1187
- registry = props.registry;
1097
+ schema = props.schema,
1098
+ uiSchema = props.uiSchema,
1099
+ readonly = props.readonly,
1100
+ disabled = props.disabled,
1101
+ label = props.label,
1102
+ value = props.value,
1103
+ onChange = props.onChange,
1104
+ onBlur = props.onBlur,
1105
+ onFocus = props.onFocus,
1106
+ rawErrors = props.rawErrors,
1107
+ required = props.required,
1108
+ registry = props.registry;
1188
1109
  var schemaUtils = registry.schemaUtils;
1189
1110
  var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
1190
1111
  var chakraProps = getChakra({
1191
1112
  uiSchema: uiSchema
1192
1113
  });
1193
-
1194
1114
  var _onChange = function _onChange(value) {
1195
1115
  return onChange(value);
1196
1116
  };
1197
-
1198
1117
  var _onBlur = function _onBlur(_ref) {
1199
1118
  var value = _ref.target.value;
1200
1119
  return onBlur(id, value);
1201
1120
  };
1202
-
1203
1121
  var _onFocus = function _onFocus(_ref2) {
1204
1122
  var value = _ref2.target.value;
1205
1123
  return onFocus(id, value);
1206
1124
  };
1207
-
1208
1125
  return React__default["default"].createElement(react.FormControl, _extends({
1209
1126
  mb: 1
1210
1127
  }, chakraProps, {
@@ -1265,7 +1182,6 @@ var Form = /*#__PURE__*/core.withTheme(Theme);
1265
1182
 
1266
1183
  It is located at the bottom of the styles string.
1267
1184
  */
1268
-
1269
1185
  var CSSReset = function CSSReset() {
1270
1186
  return React__namespace.createElement(react$1.Global, {
1271
1187
  styles: "\n html {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n font-family: system-ui, sans-serif;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n touch-action: manipulation;\n }\n body {\n position: relative;\n min-height: 100%;\n font-feature-settings: 'kern';\n }\n *,\n *::before,\n *::after {\n border-width: 0;\n border-style: solid;\n box-sizing: border-box;\n }\n main {\n display: block;\n }\n hr {\n border-top-width: 1px;\n box-sizing: content-box;\n height: 0;\n overflow: visible;\n }\n pre,\n code,\n kbd,\n samp {\n font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 1em;\n }\n a {\n background-color: transparent;\n color: inherit;\n text-decoration: inherit;\n }\n abbr[title] {\n border-bottom: none;\n text-decoration: underline;\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n b,\n strong {\n font-weight: bold;\n }\n small {\n font-size: 80%;\n }\n sub,\n sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n img {\n border-style: none;\n }\n button,\n input,\n optgroup,\n select,\n textarea {\n font-family: inherit;\n font-size: 100%;\n line-height: 1.15;\n margin: 0;\n }\n button,\n input {\n overflow: visible;\n }\n button,\n select {\n text-transform: none;\n }\n button::-moz-focus-inner,\n [type=\"button\"]::-moz-focus-inner,\n [type=\"reset\"]::-moz-focus-inner,\n [type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n fieldset {\n padding: 0.35em 0.75em 0.625em;\n }\n legend {\n box-sizing: border-box;\n color: inherit;\n display: table;\n max-width: 100%;\n padding: 0;\n white-space: normal;\n }\n progress {\n vertical-align: baseline;\n }\n textarea {\n overflow: auto;\n }\n [type=\"checkbox\"],\n [type=\"radio\"] {\n box-sizing: border-box;\n padding: 0;\n }\n [type=\"number\"]::-webkit-inner-spin-button,\n [type=\"number\"]::-webkit-outer-spin-button {\n -webkit-appearance: none !important;\n }\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n [type=\"search\"] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n }\n [type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none !important;\n }\n ::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n }\n details {\n display: block;\n }\n summary {\n display: list-item;\n }\n template {\n display: none;\n }\n [hidden] {\n display: none !important;\n }\n body,\n blockquote,\n dl,\n dd,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n hr,\n figure,\n p,\n pre {\n margin: 0;\n }\n button {\n background: transparent;\n padding: 0;\n }\n fieldset {\n margin: 0;\n padding: 0;\n }\n ol,\n ul {\n margin: 0;\n padding: 0;\n }\n textarea {\n resize: vertical;\n }\n button,\n [role=\"button\"] {\n cursor: pointer;\n }\n button::-moz-focus-inner {\n border: 0 !important;\n }\n table {\n border-collapse: collapse;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n button,\n input,\n optgroup,\n select,\n textarea {\n padding: 0;\n line-height: inherit;\n color: inherit;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n }\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n [data-js-focus-visible] :focus:not([data-focus-visible-added]) {\n outline: none;\n box-shadow: none;\n }\n select::-ms-expand {\n display: none;\n }\n input {\n border-width: revert;\n border-color: revert;\n border-style: revert;\n }\n .array-item > hr {\n margin-top: 16px;\n margin-bottom: 16px;\n }\n "
@@ -1286,7 +1202,6 @@ var CSSReset = function CSSReset() {
1286
1202
  * From: https://codesandbox.io/s/p98y9o7jz0?file=/src/frame-provider.js:0-650
1287
1203
  * Also see: https://github.com/emotion-js/emotion/issues/760#issuecomment-404353706
1288
1204
  */
1289
-
1290
1205
  var memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize__default["default"](function (container) {
1291
1206
  var newCache = createCache__default["default"]({
1292
1207
  container: container,