@rjsf/antd 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.
@@ -290,9 +290,10 @@ function BaseInputTemplate(props) {
290
290
  onFocus: !readonly ? handleFocus : undefined,
291
291
  placeholder: placeholder,
292
292
  style: INPUT_STYLE$2,
293
- list: schema.examples ? "examples_" + id : undefined
293
+ list: schema.examples ? utils.examplesId(id) : undefined
294
294
  }, inputProps, {
295
- value: value
295
+ value: value,
296
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
296
297
  })) : /*#__PURE__*/React__default["default"].createElement(Input__default["default"], _extends({
297
298
  disabled: disabled || readonlyAsDisabled && readonly,
298
299
  id: id,
@@ -302,12 +303,13 @@ function BaseInputTemplate(props) {
302
303
  onFocus: !readonly ? handleFocus : undefined,
303
304
  placeholder: placeholder,
304
305
  style: INPUT_STYLE$2,
305
- list: schema.examples ? "examples_" + id : undefined
306
+ list: schema.examples ? utils.examplesId(id) : undefined
306
307
  }, inputProps, {
307
- value: value
308
+ value: value,
309
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
308
310
  }));
309
311
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, input, schema.examples && /*#__PURE__*/React__default["default"].createElement("datalist", {
310
- id: "examples_" + id
312
+ id: utils.examplesId(id)
311
313
  }, schema.examples.concat(schema["default"] ? [schema["default"]] : []).map(function (example) {
312
314
  return /*#__PURE__*/React__default["default"].createElement("option", {
313
315
  key: example,
@@ -413,7 +415,7 @@ function FieldErrorTemplate(props) {
413
415
  if (errors.length === 0) {
414
416
  return null;
415
417
  }
416
- var id = idSchema.$id + "__error";
418
+ var id = utils.errorId(idSchema);
417
419
  return /*#__PURE__*/React__default["default"].createElement("div", {
418
420
  id: id
419
421
  }, errors.map(function (error) {
@@ -437,6 +439,7 @@ var VERTICAL_WRAPPER_COL$1 = {
437
439
  function FieldTemplate(props) {
438
440
  var children = props.children,
439
441
  classNames = props.classNames,
442
+ style = props.style,
440
443
  description = props.description,
441
444
  disabled = props.disabled,
442
445
  displayLabel = props.displayLabel,
@@ -471,6 +474,7 @@ function FieldTemplate(props) {
471
474
  }
472
475
  return /*#__PURE__*/React__default["default"].createElement(WrapIfAdditionalTemplate, {
473
476
  classNames: classNames,
477
+ style: style,
474
478
  disabled: disabled,
475
479
  id: id,
476
480
  label: label,
@@ -585,9 +589,9 @@ function ObjectFieldTemplate(props) {
585
589
  className: labelColClassName,
586
590
  span: 24
587
591
  }, /*#__PURE__*/React__default["default"].createElement(TitleFieldTemplate, {
588
- id: idSchema.$id + "-title",
589
- required: required,
592
+ id: utils.titleId(idSchema),
590
593
  title: uiOptions.title || title,
594
+ required: required,
591
595
  schema: schema,
592
596
  uiSchema: uiSchema,
593
597
  registry: registry
@@ -595,8 +599,8 @@ function ObjectFieldTemplate(props) {
595
599
  span: 24,
596
600
  style: DESCRIPTION_COL_STYLE
597
601
  }, /*#__PURE__*/React__default["default"].createElement(DescriptionFieldTemplate, {
602
+ id: utils.descriptionId(idSchema),
598
603
  description: uiOptions.description || description,
599
- id: idSchema.$id + "-description",
600
604
  schema: schema,
601
605
  uiSchema: uiSchema,
602
606
  registry: registry
@@ -699,6 +703,7 @@ function WrapIfAdditionalTemplate(props) {
699
703
  var _extends2;
700
704
  var children = props.children,
701
705
  classNames = props.classNames,
706
+ style = props.style,
702
707
  disabled = props.disabled,
703
708
  id = props.id,
704
709
  label = props.label,
@@ -728,7 +733,8 @@ function WrapIfAdditionalTemplate(props) {
728
733
  var additional = (utils.ADDITIONAL_PROPERTY_FLAG in schema);
729
734
  if (!additional) {
730
735
  return /*#__PURE__*/React__default["default"].createElement("div", {
731
- className: classNames
736
+ className: classNames,
737
+ style: style
732
738
  }, children);
733
739
  }
734
740
  var handleBlur = function handleBlur(_ref) {
@@ -741,7 +747,8 @@ function WrapIfAdditionalTemplate(props) {
741
747
  block: true
742
748
  }), _extends2));
743
749
  return /*#__PURE__*/React__default["default"].createElement("div", {
744
- className: classNames
750
+ className: classNames,
751
+ style: style
745
752
  }, /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
746
753
  align: toolbarAlign,
747
754
  gutter: rowGutter
@@ -929,7 +936,8 @@ function AltDateWidget(props) {
929
936
  },
930
937
  value: elemProps.value,
931
938
  registry: registry,
932
- label: ""
939
+ label: "",
940
+ "aria-describedby": utils.ariaDescribedByIds(id)
933
941
  });
934
942
  };
935
943
  return /*#__PURE__*/React__default["default"].createElement(Row__default["default"], {
@@ -1034,18 +1042,18 @@ function CheckboxesWidget(_ref) {
1034
1042
  name: id,
1035
1043
  onChange: !readonly ? handleChange : undefined,
1036
1044
  value: value
1037
- }, extraProps), Array.isArray(enumOptions) && enumOptions.map(function (_ref4, i) {
1038
- var optionValue = _ref4.value,
1039
- optionLabel = _ref4.label;
1045
+ }, extraProps, {
1046
+ "aria-describedby": utils.ariaDescribedByIds(id)
1047
+ }), Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
1040
1048
  return /*#__PURE__*/React__default["default"].createElement("span", {
1041
- key: optionValue
1049
+ key: option.value
1042
1050
  }, /*#__PURE__*/React__default["default"].createElement(Checkbox__default["default"], {
1043
- id: id + "-" + optionValue,
1051
+ id: utils.optionId(id, option),
1044
1052
  name: id,
1045
1053
  autoFocus: i === 0 ? autofocus : false,
1046
1054
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
1047
- value: optionValue
1048
- }, optionLabel), !inline && /*#__PURE__*/React__default["default"].createElement("br", null));
1055
+ value: option.value
1056
+ }, option.label), !inline && /*#__PURE__*/React__default["default"].createElement("br", null));
1049
1057
  })) : null;
1050
1058
  }
1051
1059
 
@@ -1092,7 +1100,9 @@ function CheckboxWidget(props) {
1092
1100
  id: id,
1093
1101
  name: id,
1094
1102
  onChange: !readonly ? handleChange : undefined
1095
- }, extraProps), label);
1103
+ }, extraProps, {
1104
+ "aria-describedby": utils.ariaDescribedByIds(id)
1105
+ }), label);
1096
1106
  }
1097
1107
 
1098
1108
  var DatePicker = /*#__PURE__*/generatePicker__default["default"](dayjsGenerateConfig__default["default"]);
@@ -1140,7 +1150,8 @@ function DateTimeWidget(props) {
1140
1150
  placeholder: placeholder,
1141
1151
  showTime: true,
1142
1152
  style: DATE_PICKER_STYLE$1,
1143
- value: value && dayjs__default["default"](value)
1153
+ value: value && dayjs__default["default"](value),
1154
+ "aria-describedby": utils.ariaDescribedByIds(id)
1144
1155
  });
1145
1156
  }
1146
1157
 
@@ -1187,7 +1198,8 @@ function DateWidget(props) {
1187
1198
  placeholder: placeholder,
1188
1199
  showTime: false,
1189
1200
  style: DATE_PICKER_STYLE,
1190
- value: value && dayjs__default["default"](value)
1201
+ value: value && dayjs__default["default"](value),
1202
+ "aria-describedby": utils.ariaDescribedByIds(id)
1191
1203
  });
1192
1204
  }
1193
1205
 
@@ -1229,7 +1241,8 @@ function PasswordWidget(props) {
1229
1241
  onChange: !readonly ? handleChange : undefined,
1230
1242
  onFocus: !readonly ? handleFocus : undefined,
1231
1243
  placeholder: placeholder,
1232
- value: value || ""
1244
+ value: value || "",
1245
+ "aria-describedby": utils.ariaDescribedByIds(id)
1233
1246
  });
1234
1247
  }
1235
1248
 
@@ -1273,18 +1286,17 @@ function RadioWidget(_ref) {
1273
1286
  onChange: !readonly ? handleChange : undefined,
1274
1287
  onBlur: !readonly ? handleBlur : undefined,
1275
1288
  onFocus: !readonly ? handleFocus : undefined,
1276
- value: "" + value
1277
- }, Array.isArray(enumOptions) && enumOptions.map(function (_ref5, i) {
1278
- var optionValue = _ref5.value,
1279
- optionLabel = _ref5.label;
1289
+ value: "" + value,
1290
+ "aria-describedby": utils.ariaDescribedByIds(id)
1291
+ }, Array.isArray(enumOptions) && enumOptions.map(function (option, i) {
1280
1292
  return /*#__PURE__*/React__default["default"].createElement(Radio__default["default"], {
1281
- id: id + "-" + optionValue,
1293
+ id: utils.optionId(id, option),
1282
1294
  name: id,
1283
1295
  autoFocus: i === 0 ? autofocus : false,
1284
1296
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
1285
- key: optionValue,
1286
- value: "" + optionValue
1287
- }, optionLabel);
1297
+ key: option.value,
1298
+ value: "" + option.value
1299
+ }, option.label);
1288
1300
  }));
1289
1301
  }
1290
1302
 
@@ -1339,7 +1351,9 @@ function RangeWidget(props) {
1339
1351
  range: false,
1340
1352
  step: step,
1341
1353
  value: value
1342
- }, extraProps));
1354
+ }, extraProps, {
1355
+ "aria-describedby": utils.ariaDescribedByIds(id)
1356
+ }));
1343
1357
  }
1344
1358
 
1345
1359
  var SELECT_STYLE = {
@@ -1378,6 +1392,13 @@ function SelectWidget(_ref) {
1378
1392
  var handleFocus = function handleFocus() {
1379
1393
  return onFocus(id, utils.processSelectValue(schema, value, options));
1380
1394
  };
1395
+ var filterOption = function filterOption(input, option) {
1396
+ if (option && isString__default["default"](option.label)) {
1397
+ // labels are strings in this context
1398
+ return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
1399
+ }
1400
+ return false;
1401
+ };
1381
1402
  var getPopupContainer = function getPopupContainer(node) {
1382
1403
  return node.parentNode;
1383
1404
  };
@@ -1401,7 +1422,10 @@ function SelectWidget(_ref) {
1401
1422
  placeholder: placeholder,
1402
1423
  style: SELECT_STYLE,
1403
1424
  value: typeof value !== "undefined" ? stringify(value) : undefined
1404
- }, extraProps), Array.isArray(enumOptions) && enumOptions.map(function (_ref2) {
1425
+ }, extraProps, {
1426
+ filterOption: filterOption,
1427
+ "aria-describedby": utils.ariaDescribedByIds(id)
1428
+ }), Array.isArray(enumOptions) && enumOptions.map(function (_ref2) {
1405
1429
  var optionValue = _ref2.value,
1406
1430
  optionLabel = _ref2.label;
1407
1431
  return /*#__PURE__*/React__default["default"].createElement(Select__default["default"].Option, {
@@ -1460,7 +1484,9 @@ function TextareaWidget(_ref) {
1460
1484
  rows: options.rows || 4,
1461
1485
  style: INPUT_STYLE,
1462
1486
  value: value
1463
- }, extraProps));
1487
+ }, extraProps, {
1488
+ "aria-describedby": utils.ariaDescribedByIds(id)
1489
+ }));
1464
1490
  }
1465
1491
 
1466
1492
  function generateWidgets() {