@rjsf/core 5.0.0-beta.16 → 5.0.0-beta.18

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.
@@ -1,20 +1,20 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/unset'), require('lodash-es/has'), require('lodash-es/omit')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/unset', 'lodash-es/has', 'lodash-es/omit'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.React, global.utils, global.get, global._isEmpty, global._pick, global.isObject, global.set, global.nanoid, global.unset, global.has, global.omit));
5
- })(this, (function (exports, React, utils, get, _isEmpty, _pick, isObject, set, nanoid, unset, has, omit) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash-es/get'), require('lodash-es/isEmpty'), require('lodash-es/pick'), require('lodash-es/isObject'), require('lodash-es/set'), require('nanoid'), require('lodash-es/omit'), require('lodash-es/has'), require('lodash-es/unset')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash-es/get', 'lodash-es/isEmpty', 'lodash-es/pick', 'lodash-es/isObject', 'lodash-es/set', 'nanoid', 'lodash-es/omit', 'lodash-es/has', 'lodash-es/unset'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.React, global.utils, global.get, global.isEmpty, global._pick, global.isObject, global.set, global.nanoid, global.omit, global.has, global.unset));
5
+ })(this, (function (exports, React, utils, get, isEmpty, _pick, isObject, set, nanoid, omit, has, unset) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
10
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
11
- var _isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(_isEmpty);
11
+ var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
12
12
  var _pick__default = /*#__PURE__*/_interopDefaultLegacy(_pick);
13
13
  var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
14
14
  var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
15
- var unset__default = /*#__PURE__*/_interopDefaultLegacy(unset);
16
- var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
17
15
  var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
16
+ var has__default = /*#__PURE__*/_interopDefaultLegacy(has);
17
+ var unset__default = /*#__PURE__*/_interopDefaultLegacy(unset);
18
18
 
19
19
  function _defineProperties(target, props) {
20
20
  for (var i = 0; i < props.length; i++) {
@@ -22,7 +22,7 @@
22
22
  descriptor.enumerable = descriptor.enumerable || false;
23
23
  descriptor.configurable = true;
24
24
  if ("value" in descriptor) descriptor.writable = true;
25
- Object.defineProperty(target, descriptor.key, descriptor);
25
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
26
26
  }
27
27
  }
28
28
  function _createClass(Constructor, protoProps, staticProps) {
@@ -71,36 +71,19 @@
71
71
  }
72
72
  return target;
73
73
  }
74
- function _unsupportedIterableToArray(o, minLen) {
75
- if (!o) return;
76
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
77
- var n = Object.prototype.toString.call(o).slice(8, -1);
78
- if (n === "Object" && o.constructor) n = o.constructor.name;
79
- if (n === "Map" || n === "Set") return Array.from(o);
80
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
81
- }
82
- function _arrayLikeToArray(arr, len) {
83
- if (len == null || len > arr.length) len = arr.length;
84
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
85
- return arr2;
86
- }
87
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
88
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
89
- if (it) return (it = it.call(o)).next.bind(it);
90
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
91
- if (it) o = it;
92
- var i = 0;
93
- return function () {
94
- if (i >= o.length) return {
95
- done: true
96
- };
97
- return {
98
- done: false,
99
- value: o[i++]
100
- };
101
- };
74
+ function _toPrimitive(input, hint) {
75
+ if (typeof input !== "object" || input === null) return input;
76
+ var prim = input[Symbol.toPrimitive];
77
+ if (prim !== undefined) {
78
+ var res = prim.call(input, hint || "default");
79
+ if (typeof res !== "object") return res;
80
+ throw new TypeError("@@toPrimitive must return a primitive value.");
102
81
  }
103
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
82
+ return (hint === "string" ? String : Number)(input);
83
+ }
84
+ function _toPropertyKey(arg) {
85
+ var key = _toPrimitive(arg, "string");
86
+ return typeof key === "symbol" ? key : String(key);
104
87
  }
105
88
 
106
89
  var _excluded$9 = ["widget"],
@@ -528,7 +511,7 @@
528
511
  options = _objectWithoutPropertiesLoose(_getUiOptions2, _excluded$9);
529
512
  var Widget = utils.getWidget(schema, widget, widgets);
530
513
  return /*#__PURE__*/React__default["default"].createElement(Widget, {
531
- id: idSchema && idSchema.$id,
514
+ id: idSchema.$id,
532
515
  multiple: true,
533
516
  onChange: this.onSelectChange,
534
517
  onBlur: onBlur,
@@ -584,7 +567,7 @@
584
567
  options = _objectWithoutPropertiesLoose(_getUiOptions3, _excluded2);
585
568
  var Widget = utils.getWidget(schema, widget, widgets);
586
569
  return /*#__PURE__*/React__default["default"].createElement(Widget, {
587
- id: idSchema && idSchema.$id,
570
+ id: idSchema.$id,
588
571
  multiple: true,
589
572
  onChange: this.onSelectChange,
590
573
  onBlur: onBlur,
@@ -638,7 +621,7 @@
638
621
  var Widget = utils.getWidget(schema, widget, widgets);
639
622
  return /*#__PURE__*/React__default["default"].createElement(Widget, {
640
623
  options: options,
641
- id: idSchema && idSchema.$id,
624
+ id: idSchema.$id,
642
625
  multiple: true,
643
626
  onChange: this.onSelectChange,
644
627
  onBlur: onBlur,
@@ -931,7 +914,7 @@
931
914
  }),
932
915
  schema: schema,
933
916
  uiSchema: uiSchema,
934
- id: idSchema && idSchema.$id,
917
+ id: idSchema.$id,
935
918
  onChange: onChange,
936
919
  onFocus: onFocus,
937
920
  onBlur: onBlur,
@@ -947,7 +930,7 @@
947
930
  });
948
931
  }
949
932
 
950
- var _excluded$7 = ["widget"];
933
+ var _excluded$7 = ["widget", "placeholder", "autofocus", "autocomplete"];
951
934
  /** The `AnyOfField` component is used to render a field in the schema that is an `anyOf`, `allOf` or `oneOf`. It tracks
952
935
  * the currently selected option and cleans up any irrelevant data in `formData`.
953
936
  *
@@ -963,38 +946,28 @@
963
946
  var _this;
964
947
  _this = _Component.call(this, props) || this;
965
948
  _this.onOptionChange = function (option) {
966
- var selectedOption = parseInt(option, 10);
949
+ var selectedOption = _this.state.selectedOption;
967
950
  var _this$props = _this.props,
968
951
  formData = _this$props.formData,
969
952
  onChange = _this$props.onChange,
970
953
  options = _this$props.options,
971
954
  registry = _this$props.registry;
972
955
  var schemaUtils = registry.schemaUtils;
973
- var newOption = schemaUtils.retrieveSchema(options[selectedOption], formData);
974
- // If the new option is of type object and the current data is an object,
975
- // discard properties added using the old option.
976
- var newFormData = undefined;
977
- if (utils.guessType(formData) === "object" && (newOption.type === "object" || newOption.properties)) {
978
- newFormData = Object.assign({}, formData);
979
- var optionsToDiscard = options.slice();
980
- optionsToDiscard.splice(selectedOption, 1);
981
- // Discard any data added using other options
982
- for (var _iterator = _createForOfIteratorHelperLoose(optionsToDiscard), _step; !(_step = _iterator()).done;) {
983
- var _option = _step.value;
984
- if (_option.properties) {
985
- for (var key in _option.properties) {
986
- if (key in newFormData) {
987
- unset__default["default"](newFormData, key);
988
- }
989
- }
990
- }
991
- }
956
+ var intOption = option !== undefined ? parseInt(option, 10) : -1;
957
+ if (intOption === selectedOption) {
958
+ return;
992
959
  }
993
- // Call getDefaultFormState to make sure defaults are populated on change. Pass "excludeObjectChildren"
994
- // so that only the root objects themselves are created without adding undefined children properties
995
- onChange(schemaUtils.getDefaultFormState(options[selectedOption], newFormData, "excludeObjectChildren"), undefined, _this.getFieldId());
960
+ var newOption = intOption >= 0 ? schemaUtils.retrieveSchema(options[intOption], formData) : undefined;
961
+ var oldOption = selectedOption >= 0 ? schemaUtils.retrieveSchema(options[selectedOption], formData) : undefined;
962
+ var newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
963
+ if (newFormData && newOption) {
964
+ // Call getDefaultFormState to make sure defaults are populated on change. Pass "excludeObjectChildren"
965
+ // so that only the root objects themselves are created without adding undefined children properties
966
+ newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
967
+ }
968
+ onChange(newFormData, undefined, _this.getFieldId());
996
969
  _this.setState({
997
- selectedOption: parseInt(option, 10)
970
+ selectedOption: intOption
998
971
  });
999
972
  };
1000
973
  var _this$props2 = _this.props,
@@ -1036,8 +1009,8 @@
1036
1009
  */;
1037
1010
  _proto.getMatchingOption = function getMatchingOption(selectedOption, formData, options) {
1038
1011
  var schemaUtils = this.props.registry.schemaUtils;
1039
- var option = schemaUtils.getMatchingOption(formData, options);
1040
- if (option !== 0) {
1012
+ var option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption);
1013
+ if (option > 0) {
1041
1014
  return option;
1042
1015
  }
1043
1016
  // If the form data matches none of the options, use the currently selected
@@ -1060,23 +1033,13 @@
1060
1033
  */;
1061
1034
  _proto.render = function render() {
1062
1035
  var _this$props5 = this.props,
1063
- name = _this$props5.name,
1064
1036
  baseType = _this$props5.baseType,
1065
1037
  _this$props5$disabled = _this$props5.disabled,
1066
1038
  disabled = _this$props5$disabled === void 0 ? false : _this$props5$disabled,
1067
- _this$props5$readonly = _this$props5.readonly,
1068
- readonly = _this$props5$readonly === void 0 ? false : _this$props5$readonly,
1069
- _this$props5$hideErro = _this$props5.hideError,
1070
- hideError = _this$props5$hideErro === void 0 ? false : _this$props5$hideErro,
1071
1039
  _this$props5$errorSch = _this$props5.errorSchema,
1072
1040
  errorSchema = _this$props5$errorSch === void 0 ? {} : _this$props5$errorSch,
1073
- formData = _this$props5.formData,
1074
1041
  formContext = _this$props5.formContext,
1075
- idPrefix = _this$props5.idPrefix,
1076
- idSeparator = _this$props5.idSeparator,
1077
- idSchema = _this$props5.idSchema,
1078
1042
  onBlur = _this$props5.onBlur,
1079
- onChange = _this$props5.onChange,
1080
1043
  onFocus = _this$props5.onFocus,
1081
1044
  options = _this$props5.options,
1082
1045
  registry = _this$props5.registry,
@@ -1088,10 +1051,15 @@
1088
1051
  var _getUiOptions = utils.getUiOptions(uiSchema),
1089
1052
  _getUiOptions$widget = _getUiOptions.widget,
1090
1053
  widget = _getUiOptions$widget === void 0 ? "select" : _getUiOptions$widget,
1054
+ placeholder = _getUiOptions.placeholder,
1055
+ autofocus = _getUiOptions.autofocus,
1056
+ autocomplete = _getUiOptions.autocomplete,
1091
1057
  uiOptions = _objectWithoutPropertiesLoose(_getUiOptions, _excluded$7);
1092
1058
  var Widget = utils.getWidget({
1093
1059
  type: "number"
1094
1060
  }, widget, widgets);
1061
+ var rawErrors = get__default["default"](errorSchema, utils.ERRORS_KEY, []);
1062
+ var fieldErrorSchema = omit__default["default"](errorSchema, [utils.ERRORS_KEY]);
1095
1063
  var option = options[selectedOption] || null;
1096
1064
  var optionSchema;
1097
1065
  if (option) {
@@ -1111,7 +1079,7 @@
1111
1079
  className: "panel panel-default panel-body"
1112
1080
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1113
1081
  className: "form-group"
1114
- }, /*#__PURE__*/React__default["default"].createElement(Widget, _extends({
1082
+ }, /*#__PURE__*/React__default["default"].createElement(Widget, {
1115
1083
  id: this.getFieldId(),
1116
1084
  schema: {
1117
1085
  type: "number",
@@ -1120,32 +1088,23 @@
1120
1088
  onChange: this.onOptionChange,
1121
1089
  onBlur: onBlur,
1122
1090
  onFocus: onFocus,
1091
+ disabled: disabled || isEmpty__default["default"](enumOptions),
1092
+ multiple: false,
1093
+ rawErrors: rawErrors,
1094
+ errorSchema: fieldErrorSchema,
1123
1095
  value: selectedOption,
1124
- options: {
1096
+ options: _extends({
1125
1097
  enumOptions: enumOptions
1126
- },
1098
+ }, uiOptions),
1127
1099
  registry: registry,
1128
- formContext: formContext
1129
- }, uiOptions, {
1130
- label: ""
1131
- }))), option !== null && /*#__PURE__*/React__default["default"].createElement(_SchemaField, {
1132
- name: name,
1133
- schema: optionSchema,
1134
- uiSchema: uiSchema,
1135
- errorSchema: errorSchema,
1136
- idSchema: idSchema,
1137
- idPrefix: idPrefix,
1138
- idSeparator: idSeparator,
1139
- formData: formData,
1140
1100
  formContext: formContext,
1141
- onChange: onChange,
1142
- onBlur: onBlur,
1143
- onFocus: onFocus,
1144
- registry: registry,
1145
- disabled: disabled,
1146
- readonly: readonly,
1147
- hideError: hideError
1148
- }));
1101
+ placeholder: placeholder,
1102
+ autocomplete: autocomplete,
1103
+ autofocus: autofocus,
1104
+ label: ""
1105
+ })), option !== null && /*#__PURE__*/React__default["default"].createElement(_SchemaField, _extends({}, this.props, {
1106
+ schema: optionSchema
1107
+ })));
1149
1108
  };
1150
1109
  return AnyOfField;
1151
1110
  }(React.Component);
@@ -1281,7 +1240,7 @@
1281
1240
  duplicateKeySuffixSeparator = _getUiOptions$duplica === void 0 ? "-" : _getUiOptions$duplica;
1282
1241
  var index = 0;
1283
1242
  var newKey = preferredKey;
1284
- while (newKey in formData) {
1243
+ while (has__default["default"](formData, newKey)) {
1285
1244
  newKey = "" + preferredKey + duplicateKeySuffixSeparator + ++index;
1286
1245
  }
1287
1246
  return newKey;
@@ -1324,12 +1283,16 @@
1324
1283
  var type = undefined;
1325
1284
  if (isObject__default["default"](schema.additionalProperties)) {
1326
1285
  type = schema.additionalProperties.type;
1327
- if (utils.REF_KEY in schema.additionalProperties) {
1286
+ var apSchema = schema.additionalProperties;
1287
+ if (utils.REF_KEY in apSchema) {
1328
1288
  var schemaUtils = registry.schemaUtils;
1329
- var refSchema = schemaUtils.retrieveSchema({
1330
- $ref: schema.additionalProperties[utils.REF_KEY]
1289
+ apSchema = schemaUtils.retrieveSchema({
1290
+ $ref: apSchema[utils.REF_KEY]
1331
1291
  }, formData);
1332
- type = refSchema.type;
1292
+ type = apSchema.type;
1293
+ }
1294
+ if (!type && (utils.ANY_OF_KEY in apSchema || utils.ONE_OF_KEY in apSchema)) {
1295
+ type = "object";
1333
1296
  }
1334
1297
  }
1335
1298
  var newKey = _this.getAvailableKey("newKey", newFormData);
@@ -1592,10 +1555,10 @@
1592
1555
  var _ref = errorSchema || {},
1593
1556
  __errors = _ref.__errors,
1594
1557
  fieldErrorSchema = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1595
- // See #439: uiSchema: Don't pass consumed class names to child components
1596
- var fieldUiSchema = omit__default["default"](uiSchema, ["ui:classNames", "classNames"]);
1597
- if ("ui:options" in fieldUiSchema) {
1598
- fieldUiSchema["ui:options"] = omit__default["default"](fieldUiSchema["ui:options"], ["classNames"]);
1558
+ // See #439: uiSchema: Don't pass consumed class names or style to child components
1559
+ var fieldUiSchema = omit__default["default"](uiSchema, ["ui:classNames", "classNames", "ui:style"]);
1560
+ if (utils.UI_OPTIONS_KEY in fieldUiSchema) {
1561
+ fieldUiSchema[utils.UI_OPTIONS_KEY] = omit__default["default"](fieldUiSchema[utils.UI_OPTIONS_KEY], ["classNames", "style"]);
1599
1562
  }
1600
1563
  var field = /*#__PURE__*/React__default["default"].createElement(FieldComponent, _extends({}, props, {
1601
1564
  onChange: handleFieldComponentChange,
@@ -1652,7 +1615,7 @@
1652
1615
  });
1653
1616
  var fieldProps = {
1654
1617
  description: /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
1655
- id: id + "__description",
1618
+ id: utils.descriptionId(id),
1656
1619
  description: description,
1657
1620
  schema: schema,
1658
1621
  uiSchema: uiSchema,
@@ -1675,6 +1638,7 @@
1675
1638
  hideError: hideError,
1676
1639
  displayLabel: displayLabel,
1677
1640
  classNames: classNames.join(" ").trim(),
1641
+ style: uiOptions.style,
1678
1642
  formContext: formContext,
1679
1643
  formData: formData,
1680
1644
  schema: schema,
@@ -1791,7 +1755,7 @@
1791
1755
  }),
1792
1756
  schema: schema,
1793
1757
  uiSchema: uiSchema,
1794
- id: idSchema && idSchema.$id,
1758
+ id: idSchema.$id,
1795
1759
  label: title === undefined ? name : title,
1796
1760
  value: formData,
1797
1761
  onChange: onChange,
@@ -1857,9 +1821,8 @@
1857
1821
  return null;
1858
1822
  }
1859
1823
  var DescriptionFieldTemplate = utils.getTemplate("DescriptionFieldTemplate", registry, options);
1860
- var id = idSchema.$id + "__description";
1861
1824
  return /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
1862
- id: id,
1825
+ id: utils.descriptionId(idSchema),
1863
1826
  description: description,
1864
1827
  schema: schema,
1865
1828
  uiSchema: uiSchema,
@@ -2004,9 +1967,8 @@
2004
1967
  return null;
2005
1968
  }
2006
1969
  var TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, options);
2007
- var id = idSchema.$id + "__title";
2008
1970
  return /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
2009
- id: id,
1971
+ id: utils.titleId(idSchema),
2010
1972
  title: title,
2011
1973
  required: required,
2012
1974
  schema: schema,
@@ -2069,13 +2031,14 @@
2069
2031
  autoFocus: autofocus,
2070
2032
  value: inputValue
2071
2033
  }, inputProps, {
2072
- list: schema.examples ? "examples_" + id : undefined,
2034
+ list: schema.examples ? utils.examplesId(id) : undefined,
2073
2035
  onChange: _onChange,
2074
2036
  onBlur: _onBlur,
2075
- onFocus: _onFocus
2037
+ onFocus: _onFocus,
2038
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
2076
2039
  })), Array.isArray(schema.examples) && /*#__PURE__*/React__default["default"].createElement("datalist", {
2077
2040
  key: "datalist_" + id,
2078
- id: "examples_" + id
2041
+ id: utils.examplesId(id)
2079
2042
  }, [].concat(new Set(schema.examples.concat(schema["default"] ? [schema["default"]] : []))).map(function (example) {
2080
2043
  return /*#__PURE__*/React__default["default"].createElement("option", {
2081
2044
  key: example,
@@ -2282,7 +2245,7 @@
2282
2245
  if (errors.length === 0) {
2283
2246
  return null;
2284
2247
  }
2285
- var id = idSchema.$id + "__error";
2248
+ var id = utils.errorId(idSchema);
2286
2249
  return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("ul", {
2287
2250
  id: id,
2288
2251
  className: "error-detail bs-callout bs-callout-info"
@@ -2306,7 +2269,7 @@
2306
2269
  if (!help) {
2307
2270
  return null;
2308
2271
  }
2309
- var id = idSchema.$id + "__help";
2272
+ var id = utils.helpId(idSchema);
2310
2273
  if (typeof help === "string") {
2311
2274
  return /*#__PURE__*/React__default["default"].createElement("p", {
2312
2275
  id: id,
@@ -2346,14 +2309,14 @@
2346
2309
  return /*#__PURE__*/React__default["default"].createElement("fieldset", {
2347
2310
  id: idSchema.$id
2348
2311
  }, (options.title || title) && /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
2349
- id: idSchema.$id + "__title",
2312
+ id: utils.titleId(idSchema),
2350
2313
  title: options.title || title,
2351
2314
  required: required,
2352
2315
  schema: schema,
2353
2316
  uiSchema: uiSchema,
2354
2317
  registry: registry
2355
2318
  }), (options.description || description) && /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
2356
- id: idSchema.$id + "__description",
2319
+ id: utils.descriptionId(idSchema),
2357
2320
  description: options.description || description,
2358
2321
  schema: schema,
2359
2322
  uiSchema: uiSchema,
@@ -2407,6 +2370,7 @@
2407
2370
  function WrapIfAdditionalTemplate(props) {
2408
2371
  var id = props.id,
2409
2372
  classNames = props.classNames,
2373
+ style = props.style,
2410
2374
  disabled = props.disabled,
2411
2375
  label = props.label,
2412
2376
  onKeyChange = props.onKeyChange,
@@ -2423,11 +2387,13 @@
2423
2387
  var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
2424
2388
  if (!additional) {
2425
2389
  return /*#__PURE__*/React__default["default"].createElement("div", {
2426
- className: classNames
2390
+ className: classNames,
2391
+ style: style
2427
2392
  }, children);
2428
2393
  }
2429
2394
  return /*#__PURE__*/React__default["default"].createElement("div", {
2430
- className: classNames
2395
+ className: classNames,
2396
+ style: style
2431
2397
  }, /*#__PURE__*/React__default["default"].createElement("div", {
2432
2398
  className: "row"
2433
2399
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -2571,7 +2537,8 @@
2571
2537
  onBlur: onBlur,
2572
2538
  onFocus: onFocus,
2573
2539
  registry: registry,
2574
- label: ""
2540
+ label: "",
2541
+ "aria-describedby": utils.ariaDescribedByIds(rootId)
2575
2542
  });
2576
2543
  }
2577
2544
  /** The `AltDateWidget` is an alternative widget for rendering date properties.
@@ -2709,7 +2676,7 @@
2709
2676
  return /*#__PURE__*/React__default["default"].createElement("div", {
2710
2677
  className: "checkbox " + (disabled || readonly ? "disabled" : "")
2711
2678
  }, schema.description && /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
2712
- id: id + "__description",
2679
+ id: utils.descriptionId(id),
2713
2680
  description: schema.description,
2714
2681
  schema: schema,
2715
2682
  uiSchema: uiSchema,
@@ -2724,24 +2691,11 @@
2724
2691
  autoFocus: autofocus,
2725
2692
  onChange: handleChange,
2726
2693
  onBlur: handleBlur,
2727
- onFocus: handleFocus
2694
+ onFocus: handleFocus,
2695
+ "aria-describedby": utils.ariaDescribedByIds(id)
2728
2696
  }), /*#__PURE__*/React__default["default"].createElement("span", null, label)));
2729
2697
  }
2730
2698
 
2731
- function selectValue(value, selected, all) {
2732
- var at = all.indexOf(value);
2733
- var updated = selected.slice(0, at).concat(value, selected.slice(at));
2734
- // As inserting values at predefined index positions doesn't work with empty
2735
- // arrays, we need to reorder the updated selection to match the initial order
2736
- return updated.sort(function (a, b) {
2737
- return Number(all.indexOf(a) > all.indexOf(b));
2738
- });
2739
- }
2740
- function deselectValue(value, selected) {
2741
- return selected.filter(function (v) {
2742
- return v !== value;
2743
- });
2744
- }
2745
2699
  /** The `CheckboxesWidget` is a widget for rendering checkbox groups.
2746
2700
  * It is typically used to represent an array of enums.
2747
2701
  *
@@ -2760,32 +2714,30 @@
2760
2714
  autofocus = _ref$autofocus === void 0 ? false : _ref$autofocus,
2761
2715
  readonly = _ref.readonly,
2762
2716
  onChange = _ref.onChange;
2717
+ var checkboxesValues = Array.isArray(value) ? value : [value];
2763
2718
  return /*#__PURE__*/React__default["default"].createElement("div", {
2764
2719
  className: "checkboxes",
2765
2720
  id: id
2766
2721
  }, Array.isArray(enumOptions) && enumOptions.map(function (option, index) {
2767
- var checked = value.indexOf(option.value) !== -1;
2722
+ var checked = checkboxesValues.includes(option.value);
2768
2723
  var itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) != -1;
2769
2724
  var disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
2770
2725
  var handleChange = function handleChange(event) {
2771
- var all = enumOptions.map(function (_ref2) {
2772
- var value = _ref2.value;
2773
- return value;
2774
- });
2775
2726
  if (event.target.checked) {
2776
- onChange(selectValue(option.value, value, all));
2727
+ onChange(utils.enumOptionsSelectValue(option.value, checkboxesValues, enumOptions));
2777
2728
  } else {
2778
- onChange(deselectValue(option.value, value));
2729
+ onChange(utils.enumOptionsDeselectValue(option.value, checkboxesValues));
2779
2730
  }
2780
2731
  };
2781
2732
  var checkbox = /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement("input", {
2782
2733
  type: "checkbox",
2783
- id: id + "-" + option.value,
2734
+ id: utils.optionId(id, option),
2784
2735
  name: id,
2785
2736
  checked: checked,
2786
2737
  disabled: disabled || itemDisabled || readonly,
2787
2738
  autoFocus: autofocus && index === 0,
2788
- onChange: handleChange
2739
+ onChange: handleChange,
2740
+ "aria-describedby": utils.ariaDescribedByIds(id)
2789
2741
  }), /*#__PURE__*/React__default["default"].createElement("span", null, option.label));
2790
2742
  return inline ? /*#__PURE__*/React__default["default"].createElement("label", {
2791
2743
  key: option.value,
@@ -2981,7 +2933,8 @@
2981
2933
  defaultValue: "",
2982
2934
  autoFocus: autofocus,
2983
2935
  multiple: multiple,
2984
- accept: options.accept ? String(options.accept) : undefined
2936
+ accept: options.accept ? String(options.accept) : undefined,
2937
+ "aria-describedby": utils.ariaDescribedByIds(id)
2985
2938
  })), /*#__PURE__*/React__default["default"].createElement(FilesInfo, {
2986
2939
  filesInfo: filesInfo
2987
2940
  }));
@@ -3058,7 +3011,7 @@
3058
3011
  };
3059
3012
  var radio = /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement("input", {
3060
3013
  type: "radio",
3061
- id: id + "-" + option.value,
3014
+ id: utils.optionId(id, option),
3062
3015
  checked: checked,
3063
3016
  name: name,
3064
3017
  required: required,
@@ -3067,7 +3020,8 @@
3067
3020
  autoFocus: autofocus && i === 0,
3068
3021
  onChange: handleChange,
3069
3022
  onBlur: handleBlur,
3070
- onFocus: handleFocus
3023
+ onFocus: handleFocus,
3024
+ "aria-describedby": utils.ariaDescribedByIds(id)
3071
3025
  }), /*#__PURE__*/React__default["default"].createElement("span", null, option.label));
3072
3026
  return inline ? /*#__PURE__*/React__default["default"].createElement("label", {
3073
3027
  key: option.value,
@@ -3153,7 +3107,8 @@
3153
3107
  autoFocus: autofocus,
3154
3108
  onBlur: handleBlur,
3155
3109
  onFocus: handleFocus,
3156
- onChange: handleChange
3110
+ onChange: handleChange,
3111
+ "aria-describedby": utils.ariaDescribedByIds(id)
3157
3112
  }, !multiple && schema["default"] === undefined && /*#__PURE__*/React__default["default"].createElement("option", {
3158
3113
  value: ""
3159
3114
  }, placeholder), Array.isArray(enumOptions) && enumOptions.map(function (_ref2, i) {
@@ -3211,7 +3166,8 @@
3211
3166
  rows: options.rows,
3212
3167
  onBlur: handleBlur,
3213
3168
  onFocus: handleFocus,
3214
- onChange: handleChange
3169
+ onChange: handleChange,
3170
+ "aria-describedby": utils.ariaDescribedByIds(id)
3215
3171
  });
3216
3172
  }
3217
3173
  TextareaWidget.defaultProps = {
@@ -3348,7 +3304,7 @@
3348
3304
  var formValue = get__default["default"](formData, path);
3349
3305
  // adds path to fieldNames if it points to a value
3350
3306
  // or an empty object/array
3351
- if (typeof formValue !== "object" || _isEmpty__default["default"](formValue)) {
3307
+ if (typeof formValue !== "object" || isEmpty__default["default"](formValue)) {
3352
3308
  acc.push(path);
3353
3309
  }
3354
3310
  });
@@ -3784,9 +3740,9 @@
3784
3740
  widgets = _ref.widgets,
3785
3741
  templates = _ref.templates,
3786
3742
  directProps = _objectWithoutPropertiesLoose(_ref, _excluded);
3787
- fields = _extends({}, themeProps.fields, fields);
3788
- widgets = _extends({}, themeProps.widgets, widgets);
3789
- templates = _extends({}, themeProps.templates, templates, {
3743
+ fields = _extends({}, themeProps === null || themeProps === void 0 ? void 0 : themeProps.fields, fields);
3744
+ widgets = _extends({}, themeProps === null || themeProps === void 0 ? void 0 : themeProps.widgets, widgets);
3745
+ templates = _extends({}, themeProps === null || themeProps === void 0 ? void 0 : themeProps.templates, templates, {
3790
3746
  ButtonTemplates: _extends({}, themeProps === null || themeProps === void 0 ? void 0 : (_themeProps$templates = themeProps.templates) === null || _themeProps$templates === void 0 ? void 0 : _themeProps$templates.ButtonTemplates, (_templates = templates) === null || _templates === void 0 ? void 0 : _templates.ButtonTemplates)
3791
3747
  });
3792
3748
  return /*#__PURE__*/React__default["default"].createElement(Form, _extends({}, themeProps, directProps, {