@rjsf/utils 5.1.0 → 5.2.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.
@@ -17,7 +17,8 @@ var mergeAllOf = require('json-schema-merge-allof');
17
17
  var union = require('lodash/union');
18
18
  var isEqual = require('lodash/isEqual');
19
19
  var cloneDeep = require('lodash/cloneDeep');
20
- var React = require('react');
20
+ var jsxRuntime = require('react/jsx-runtime');
21
+ var react = require('react');
21
22
  var ReactIs = require('react-is');
22
23
 
23
24
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -37,7 +38,6 @@ var mergeAllOf__default = /*#__PURE__*/_interopDefaultLegacy(mergeAllOf);
37
38
  var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
38
39
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
39
40
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
40
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var ReactIs__default = /*#__PURE__*/_interopDefaultLegacy(ReactIs);
42
42
 
43
43
  /** Determines whether a `thing` is an object for the purposes of RSJF. In this case, `thing` is an object if it has
@@ -47,13 +47,13 @@ var ReactIs__default = /*#__PURE__*/_interopDefaultLegacy(ReactIs);
47
47
  * @returns - True if it is a non-null, non-array, non-File object
48
48
  */
49
49
  function isObject(thing) {
50
- if (typeof File !== "undefined" && thing instanceof File) {
50
+ if (typeof File !== 'undefined' && thing instanceof File) {
51
51
  return false;
52
52
  }
53
- if (typeof Date !== "undefined" && thing instanceof Date) {
53
+ if (typeof Date !== 'undefined' && thing instanceof Date) {
54
54
  return false;
55
55
  }
56
- return typeof thing === "object" && thing !== null && !Array.isArray(thing);
56
+ return typeof thing === 'object' && thing !== null && !Array.isArray(thing);
57
57
  }
58
58
 
59
59
  /** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
@@ -64,7 +64,7 @@ function isObject(thing) {
64
64
  */
65
65
  function allowAdditionalItems(schema) {
66
66
  if (schema.additionalItems === true) {
67
- console.warn("additionalItems=true is currently not supported");
67
+ console.warn('additionalItems=true is currently not supported');
68
68
  }
69
69
  return isObject(schema.additionalItems);
70
70
  }
@@ -79,7 +79,7 @@ function allowAdditionalItems(schema) {
79
79
  * @returns - The `value` converted to a number when appropriate, otherwise the `value`
80
80
  */
81
81
  function asNumber(value) {
82
- if (value === "") {
82
+ if (value === '') {
83
83
  return undefined;
84
84
  }
85
85
  if (value === null) {
@@ -101,7 +101,7 @@ function asNumber(value) {
101
101
  return value;
102
102
  }
103
103
  var n = Number(value);
104
- var valid = typeof n === "number" && !Number.isNaN(n);
104
+ var valid = typeof n === 'number' && !Number.isNaN(n);
105
105
  return valid ? n : value;
106
106
  }
107
107
 
@@ -171,28 +171,28 @@ function _toPropertyKey(arg) {
171
171
  * `RJSF_ADDITONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`
172
172
  * utility.
173
173
  */
174
- var ADDITIONAL_PROPERTY_FLAG = "__additional_property";
175
- var ADDITIONAL_PROPERTIES_KEY = "additionalProperties";
176
- var ALL_OF_KEY = "allOf";
177
- var ANY_OF_KEY = "anyOf";
178
- var CONST_KEY = "const";
179
- var DEFAULT_KEY = "default";
180
- var DEFINITIONS_KEY = "definitions";
181
- var DEPENDENCIES_KEY = "dependencies";
182
- var ENUM_KEY = "enum";
183
- var ERRORS_KEY = "__errors";
184
- var ID_KEY = "$id";
185
- var ITEMS_KEY = "items";
186
- var NAME_KEY = "$name";
187
- var ONE_OF_KEY = "oneOf";
188
- var PROPERTIES_KEY = "properties";
189
- var REQUIRED_KEY = "required";
190
- var SUBMIT_BTN_OPTIONS_KEY = "submitButtonOptions";
191
- var REF_KEY = "$ref";
192
- var RJSF_ADDITONAL_PROPERTIES_FLAG = "__rjsf_additionalProperties";
193
- var UI_FIELD_KEY = "ui:field";
194
- var UI_WIDGET_KEY = "ui:widget";
195
- var UI_OPTIONS_KEY = "ui:options";
174
+ var ADDITIONAL_PROPERTY_FLAG = '__additional_property';
175
+ var ADDITIONAL_PROPERTIES_KEY = 'additionalProperties';
176
+ var ALL_OF_KEY = 'allOf';
177
+ var ANY_OF_KEY = 'anyOf';
178
+ var CONST_KEY = 'const';
179
+ var DEFAULT_KEY = 'default';
180
+ var DEFINITIONS_KEY = 'definitions';
181
+ var DEPENDENCIES_KEY = 'dependencies';
182
+ var ENUM_KEY = 'enum';
183
+ var ERRORS_KEY = '__errors';
184
+ var ID_KEY = '$id';
185
+ var ITEMS_KEY = 'items';
186
+ var NAME_KEY = '$name';
187
+ var ONE_OF_KEY = 'oneOf';
188
+ var PROPERTIES_KEY = 'properties';
189
+ var REQUIRED_KEY = 'required';
190
+ var SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
191
+ var REF_KEY = '$ref';
192
+ var RJSF_ADDITONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
193
+ var UI_FIELD_KEY = 'ui:field';
194
+ var UI_WIDGET_KEY = 'ui:widget';
195
+ var UI_OPTIONS_KEY = 'ui:options';
196
196
 
197
197
  /** Get all passed options from ui:options, and ui:<optionName>, returning them in an object with the `ui:`
198
198
  * stripped off.
@@ -205,12 +205,12 @@ function getUiOptions(uiSchema) {
205
205
  uiSchema = {};
206
206
  }
207
207
  return Object.keys(uiSchema).filter(function (key) {
208
- return key.indexOf("ui:") === 0;
208
+ return key.indexOf('ui:') === 0;
209
209
  }).reduce(function (options, key) {
210
210
  var _extends2;
211
211
  var value = uiSchema[key];
212
212
  if (key === UI_WIDGET_KEY && isObject(value)) {
213
- console.error("Setting options via ui:widget object is no longer supported, use ui:options instead");
213
+ console.error('Setting options via ui:widget object is no longer supported, use ui:options instead');
214
214
  return options;
215
215
  }
216
216
  if (key === UI_OPTIONS_KEY && isObject(value)) {
@@ -259,7 +259,7 @@ function canExpand(schema, uiSchema, formData) {
259
259
  */
260
260
  function deepEquals(a, b) {
261
261
  return isEqualWith__default["default"](a, b, function (obj, other) {
262
- if (typeof obj === "function" && typeof other === "function") {
262
+ if (typeof obj === 'function' && typeof other === 'function') {
263
263
  // Assume all functions are equivalent
264
264
  // see https://github.com/rjsf-team/react-jsonschema-form/issues/255
265
265
  return true;
@@ -294,8 +294,8 @@ function findSchemaDefinition($ref, rootSchema) {
294
294
  if (rootSchema === void 0) {
295
295
  rootSchema = {};
296
296
  }
297
- var ref = $ref || "";
298
- if (ref.startsWith("#")) {
297
+ var ref = $ref || '';
298
+ if (ref.startsWith('#')) {
299
299
  // Decode URI fragment representation.
300
300
  ref = decodeURIComponent(ref.substring(1));
301
301
  } else {
@@ -403,25 +403,25 @@ function getFirstMatchingOption(validator, formData, options, rootSchema) {
403
403
  */
404
404
  function guessType(value) {
405
405
  if (Array.isArray(value)) {
406
- return "array";
406
+ return 'array';
407
407
  }
408
- if (typeof value === "string") {
409
- return "string";
408
+ if (typeof value === 'string') {
409
+ return 'string';
410
410
  }
411
411
  if (value == null) {
412
- return "null";
412
+ return 'null';
413
413
  }
414
- if (typeof value === "boolean") {
415
- return "boolean";
414
+ if (typeof value === 'boolean') {
415
+ return 'boolean';
416
416
  }
417
417
  if (!isNaN(value)) {
418
- return "number";
418
+ return 'number';
419
419
  }
420
- if (typeof value === "object") {
421
- return "object";
420
+ if (typeof value === 'object') {
421
+ return 'object';
422
422
  }
423
423
  // Default to string if we can't figure it out
424
- return "string";
424
+ return 'string';
425
425
  }
426
426
 
427
427
  /** Gets the type of a given `schema`. If the type is not explicitly defined, then an attempt is made to infer it from
@@ -441,14 +441,14 @@ function getSchemaType(schema) {
441
441
  return guessType(schema["const"]);
442
442
  }
443
443
  if (!type && schema["enum"]) {
444
- return "string";
444
+ return 'string';
445
445
  }
446
446
  if (!type && (schema.properties || schema.additionalProperties)) {
447
- return "object";
447
+ return 'object';
448
448
  }
449
- if (Array.isArray(type) && type.length === 2 && type.includes("null")) {
449
+ if (Array.isArray(type) && type.length === 2 && type.includes('null')) {
450
450
  type = type.find(function (type) {
451
- return type !== "null";
451
+ return type !== 'null';
452
452
  });
453
453
  }
454
454
  return type;
@@ -469,7 +469,7 @@ function mergeSchemas(obj1, obj2) {
469
469
  right = obj2[key];
470
470
  if (obj1 && key in obj1 && isObject(right)) {
471
471
  acc[key] = mergeSchemas(left, right);
472
- } else if (obj1 && obj2 && (getSchemaType(obj1) === "object" || getSchemaType(obj2) === "object") && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
472
+ } else if (obj1 && obj2 && (getSchemaType(obj1) === 'object' || getSchemaType(obj2) === 'object') && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
473
473
  // Don't include duplicate values when merging 'required' fields.
474
474
  acc[key] = union__default["default"](left, right);
475
475
  } else {
@@ -499,7 +499,7 @@ function resolveCondition(validator, schema, rootSchema, formData) {
499
499
  otherwise = schema["else"],
500
500
  resolvedSchemaLessConditional = _objectWithoutPropertiesLoose(schema, _excluded$1);
501
501
  var conditionalSchema = validator.isValid(expression, formData, rootSchema) ? then : otherwise;
502
- if (conditionalSchema && typeof conditionalSchema !== "boolean") {
502
+ if (conditionalSchema && typeof conditionalSchema !== 'boolean') {
503
503
  return retrieveSchema(validator, mergeSchemas(resolvedSchemaLessConditional, retrieveSchema(validator, conditionalSchema, rootSchema, formData)), rootSchema, formData);
504
504
  }
505
505
  return retrieveSchema(validator, resolvedSchemaLessConditional, rootSchema, formData);
@@ -571,16 +571,16 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
571
571
  return;
572
572
  }
573
573
  var additionalProperties = {};
574
- if (typeof schema.additionalProperties !== "boolean") {
574
+ if (typeof schema.additionalProperties !== 'boolean') {
575
575
  if (REF_KEY in schema.additionalProperties) {
576
576
  additionalProperties = retrieveSchema(validator, {
577
577
  $ref: get__default["default"](schema.additionalProperties, [REF_KEY])
578
578
  }, rootSchema, formData);
579
- } else if ("type" in schema.additionalProperties) {
579
+ } else if ('type' in schema.additionalProperties) {
580
580
  additionalProperties = _extends({}, schema.additionalProperties);
581
581
  } else if (ANY_OF_KEY in schema.additionalProperties || ONE_OF_KEY in schema.additionalProperties) {
582
582
  additionalProperties = _extends({
583
- type: "object"
583
+ type: 'object'
584
584
  }, schema.additionalProperties);
585
585
  } else {
586
586
  additionalProperties = {
@@ -617,7 +617,7 @@ function retrieveSchema(validator, schema, rootSchema, rawFormData) {
617
617
  return {};
618
618
  }
619
619
  var resolvedSchema = resolveSchema(validator, schema, rootSchema, rawFormData);
620
- if ("if" in schema) {
620
+ if ('if' in schema) {
621
621
  return resolveCondition(validator, schema, rootSchema, rawFormData);
622
622
  }
623
623
  var formData = rawFormData || {};
@@ -627,7 +627,7 @@ function retrieveSchema(validator, schema, rootSchema, rawFormData) {
627
627
  deep: false
628
628
  });
629
629
  } catch (e) {
630
- console.warn("could not merge subschemas in allOf:\n" + e);
630
+ console.warn('could not merge subschemas in allOf:\n' + e);
631
631
  var _resolvedSchema = resolvedSchema,
632
632
  resolvedSchemaWithoutAllOf = _objectWithoutPropertiesLoose(_resolvedSchema, _excluded3);
633
633
  return resolvedSchemaWithoutAllOf;
@@ -728,7 +728,7 @@ function withDependentSchema(validator, schema, rootSchema, dependencyKey, depen
728
728
  }
729
729
  // Resolve $refs inside oneOf.
730
730
  var resolvedOneOf = oneOf.map(function (subschema) {
731
- if (typeof subschema === "boolean" || !(REF_KEY in subschema)) {
731
+ if (typeof subschema === 'boolean' || !(REF_KEY in subschema)) {
732
732
  return subschema;
733
733
  }
734
734
  return resolveReference(validator, subschema, rootSchema, formData);
@@ -747,14 +747,14 @@ function withDependentSchema(validator, schema, rootSchema, dependencyKey, depen
747
747
  */
748
748
  function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, oneOf, formData) {
749
749
  var validSubschemas = oneOf.filter(function (subschema) {
750
- if (typeof subschema === "boolean" || !subschema || !subschema.properties) {
750
+ if (typeof subschema === 'boolean' || !subschema || !subschema.properties) {
751
751
  return false;
752
752
  }
753
753
  var conditionPropertySchema = subschema.properties[dependencyKey];
754
754
  if (conditionPropertySchema) {
755
755
  var _properties;
756
756
  var conditionSchema = {
757
- type: "object",
757
+ type: 'object',
758
758
  properties: (_properties = {}, _properties[dependencyKey] = conditionPropertySchema, _properties)
759
759
  };
760
760
  var _validator$validateFo = validator.validateFormData(formData, conditionSchema),
@@ -780,10 +780,10 @@ function withExactlyOneSubschema(validator, schema, rootSchema, dependencyKey, o
780
780
  * the first item
781
781
  */
782
782
  var JUNK_OPTION = {
783
- type: "object",
783
+ type: 'object',
784
784
  properties: {
785
785
  __not_really_there__: {
786
- type: "number"
786
+ type: 'number'
787
787
  }
788
788
  }
789
789
  };
@@ -816,7 +816,7 @@ function calculateIndexScore(validator, rootSchema, schema, formData) {
816
816
  if (isObject__default["default"](schema.properties)) {
817
817
  totalScore += reduce__default["default"](schema.properties, function (score, value, key) {
818
818
  var formValue = get__default["default"](formData, key);
819
- if (typeof value === "boolean") {
819
+ if (typeof value === 'boolean') {
820
820
  return score;
821
821
  }
822
822
  if (has__default["default"](value, REF_KEY)) {
@@ -826,7 +826,7 @@ function calculateIndexScore(validator, rootSchema, schema, formData) {
826
826
  if (has__default["default"](value, ONE_OF_KEY) && formValue) {
827
827
  return score + getClosestMatchingOption(validator, rootSchema, formValue, get__default["default"](value, ONE_OF_KEY));
828
828
  }
829
- if (value.type === "object") {
829
+ if (value.type === 'object') {
830
830
  return score + calculateIndexScore(validator, rootSchema, value, formValue || {});
831
831
  }
832
832
  if (value.type === guessType(formValue)) {
@@ -986,7 +986,7 @@ function mergeObjects(obj1, obj2, concatArrays) {
986
986
  acc[key] = mergeObjects(left, right, concatArrays);
987
987
  } else if (concatArrays && Array.isArray(left) && Array.isArray(right)) {
988
988
  var toMerge = right;
989
- if (concatArrays === "preventDuplicates") {
989
+ if (concatArrays === 'preventDuplicates') {
990
990
  toMerge = right.reduce(function (result, value) {
991
991
  if (!left.includes(value)) {
992
992
  result.push(value);
@@ -1030,7 +1030,7 @@ function isSelect(validator, theSchema, rootSchema) {
1030
1030
  }
1031
1031
  if (Array.isArray(altSchemas)) {
1032
1032
  return altSchemas.every(function (altSchemas) {
1033
- return typeof altSchemas !== "boolean" && isConstant(altSchemas);
1033
+ return typeof altSchemas !== 'boolean' && isConstant(altSchemas);
1034
1034
  });
1035
1035
  }
1036
1036
  return false;
@@ -1044,7 +1044,7 @@ function isSelect(validator, theSchema, rootSchema) {
1044
1044
  * @returns - True if schema contains a multi-select, otherwise false
1045
1045
  */
1046
1046
  function isMultiSelect(validator, schema, rootSchema) {
1047
- if (!schema.uniqueItems || !schema.items || typeof schema.items === "boolean") {
1047
+ if (!schema.uniqueItems || !schema.items || typeof schema.items === 'boolean') {
1048
1048
  return false;
1049
1049
  }
1050
1050
  return isSelect(validator, schema.items, rootSchema);
@@ -1083,11 +1083,11 @@ function getInnerSchemaForArrayItem(schema, additionalItems, idx) {
1083
1083
  if (idx >= 0) {
1084
1084
  if (Array.isArray(schema.items) && idx < schema.items.length) {
1085
1085
  var item = schema.items[idx];
1086
- if (typeof item !== "boolean") {
1086
+ if (typeof item !== 'boolean') {
1087
1087
  return item;
1088
1088
  }
1089
1089
  }
1090
- } else if (schema.items && !Array.isArray(schema.items) && typeof schema.items !== "boolean") {
1090
+ } else if (schema.items && !Array.isArray(schema.items) && typeof schema.items !== 'boolean') {
1091
1091
  return schema.items;
1092
1092
  }
1093
1093
  if (additionalItems !== AdditionalItemsHandling.Ignore && isObject(schema.additionalItems)) {
@@ -1179,12 +1179,12 @@ function computeDefaults(validator, rawSchema, parentDefaults, rootSchema, rawFo
1179
1179
  schema = schema.anyOf[getClosestMatchingOption(validator, rootSchema, isEmpty__default["default"](formData) ? undefined : formData, schema.anyOf, 0)];
1180
1180
  }
1181
1181
  // Not defaults defined for this node, fallback to generic typed ones.
1182
- if (typeof defaults === "undefined") {
1182
+ if (typeof defaults === 'undefined') {
1183
1183
  defaults = schema["default"];
1184
1184
  }
1185
1185
  switch (getSchemaType(schema)) {
1186
1186
  // We need to recur for object schema inner default values.
1187
- case "object":
1187
+ case 'object':
1188
1188
  {
1189
1189
  var objectDefaults = Object.keys(schema.properties || {}).reduce(function (acc, key) {
1190
1190
  // Compute the defaults for this node, with the parent defaults we might
@@ -1204,7 +1204,7 @@ function computeDefaults(validator, rawSchema, parentDefaults, rootSchema, rawFo
1204
1204
  }
1205
1205
  return objectDefaults;
1206
1206
  }
1207
- case "array":
1207
+ case 'array':
1208
1208
  // Inject defaults into existing array defaults
1209
1209
  if (Array.isArray(defaults)) {
1210
1210
  defaults = defaults.map(function (item, idx) {
@@ -1254,11 +1254,11 @@ function getDefaultFormState(validator, theSchema, formData, rootSchema, include
1254
1254
  includeUndefinedValues = false;
1255
1255
  }
1256
1256
  if (!isObject(theSchema)) {
1257
- throw new Error("Invalid schema: " + theSchema);
1257
+ throw new Error('Invalid schema: ' + theSchema);
1258
1258
  }
1259
1259
  var schema = retrieveSchema(validator, theSchema, rootSchema, formData);
1260
1260
  var defaults = computeDefaults(validator, schema, undefined, rootSchema, formData, includeUndefinedValues);
1261
- if (typeof formData === "undefined" || formData === null || typeof formData === "number" && isNaN(formData)) {
1261
+ if (typeof formData === 'undefined' || formData === null || typeof formData === 'number' && isNaN(formData)) {
1262
1262
  // No form data? Use schema defaults.
1263
1263
  return defaults;
1264
1264
  }
@@ -1283,7 +1283,7 @@ function isCustomWidget(uiSchema) {
1283
1283
  return (
1284
1284
  // TODO: Remove the `&& uiSchema['ui:widget'] !== 'hidden'` once we support hidden widgets for arrays.
1285
1285
  // https://react-jsonschema-form.readthedocs.io/en/latest/usage/widgets/#hidden-widgets
1286
- "widget" in getUiOptions(uiSchema) && getUiOptions(uiSchema)["widget"] !== "hidden"
1286
+ 'widget' in getUiOptions(uiSchema) && getUiOptions(uiSchema)['widget'] !== 'hidden'
1287
1287
  );
1288
1288
  }
1289
1289
 
@@ -1299,12 +1299,12 @@ function isFilesArray(validator, schema, uiSchema, rootSchema) {
1299
1299
  if (uiSchema === void 0) {
1300
1300
  uiSchema = {};
1301
1301
  }
1302
- if (uiSchema[UI_WIDGET_KEY] === "files") {
1302
+ if (uiSchema[UI_WIDGET_KEY] === 'files') {
1303
1303
  return true;
1304
1304
  }
1305
1305
  if (schema.items) {
1306
1306
  var itemsSchema = retrieveSchema(validator, schema.items, rootSchema);
1307
- return itemsSchema.type === "string" && itemsSchema.format === "data-url";
1307
+ return itemsSchema.type === 'string' && itemsSchema.format === 'data-url';
1308
1308
  }
1309
1309
  return false;
1310
1310
  }
@@ -1327,13 +1327,13 @@ function getDisplayLabel(validator, schema, uiSchema, rootSchema) {
1327
1327
  label = _uiOptions$label === void 0 ? true : _uiOptions$label;
1328
1328
  var displayLabel = !!label;
1329
1329
  var schemaType = getSchemaType(schema);
1330
- if (schemaType === "array") {
1330
+ if (schemaType === 'array') {
1331
1331
  displayLabel = isMultiSelect(validator, schema, rootSchema) || isFilesArray(validator, schema, uiSchema, rootSchema) || isCustomWidget(uiSchema);
1332
1332
  }
1333
- if (schemaType === "object") {
1333
+ if (schemaType === 'object') {
1334
1334
  displayLabel = false;
1335
1335
  }
1336
- if (schemaType === "boolean" && !uiSchema[UI_WIDGET_KEY]) {
1336
+ if (schemaType === 'boolean' && !uiSchema[UI_WIDGET_KEY]) {
1337
1337
  displayLabel = false;
1338
1338
  }
1339
1339
  if (uiSchema[UI_FIELD_KEY]) {
@@ -1370,7 +1370,7 @@ function mergeValidationData(validator, validationData, additionalErrorSchema) {
1370
1370
  };
1371
1371
  }
1372
1372
 
1373
- var NO_VALUE = /*#__PURE__*/Symbol("no Value");
1373
+ var NO_VALUE = /*#__PURE__*/Symbol('no Value');
1374
1374
  /** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the new
1375
1375
  * schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the nature
1376
1376
  * of schemas, this sanitization happens recursively for nested objects of data. Also, any properties in the old schema
@@ -1451,8 +1451,8 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1451
1451
  newKeyedSchema = retrieveSchema(validator, newKeyedSchema, rootSchema, formValue);
1452
1452
  }
1453
1453
  // Now get types and see if they are the same
1454
- var oldSchemaTypeForKey = get__default["default"](oldKeyedSchema, "type");
1455
- var newSchemaTypeForKey = get__default["default"](newKeyedSchema, "type");
1454
+ var oldSchemaTypeForKey = get__default["default"](oldKeyedSchema, 'type');
1455
+ var newSchemaTypeForKey = get__default["default"](newKeyedSchema, 'type');
1456
1456
  // Check if the old option has the same key with the same type
1457
1457
  if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
1458
1458
  if (has__default["default"](removeOldSchemaData, key)) {
@@ -1460,10 +1460,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1460
1460
  delete removeOldSchemaData[key];
1461
1461
  }
1462
1462
  // If it is an object, we'll recurse and store the resulting sanitized data for the key
1463
- if (newSchemaTypeForKey === "object" || newSchemaTypeForKey === "array" && Array.isArray(formValue)) {
1463
+ if (newSchemaTypeForKey === 'object' || newSchemaTypeForKey === 'array' && Array.isArray(formValue)) {
1464
1464
  // SIDE-EFFECT: process the new schema type of object recursively to save iterations
1465
1465
  var itemData = sanitizeDataForNewSchema(validator, rootSchema, newKeyedSchema, oldKeyedSchema, formValue);
1466
- if (itemData !== undefined || newSchemaTypeForKey === "array") {
1466
+ if (itemData !== undefined || newSchemaTypeForKey === 'array') {
1467
1467
  // only put undefined values for the array type and not the object type
1468
1468
  nestedData[key] = itemData;
1469
1469
  }
@@ -1471,19 +1471,19 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1471
1471
  // Ok, the non-object types match, let's make sure that a default or a const of a different value is replaced
1472
1472
  // with the new default or const. This allows the case where two schemas differ that only by the default/const
1473
1473
  // value to be properly selected
1474
- var newOptionDefault = get__default["default"](newKeyedSchema, "default", NO_VALUE);
1475
- var oldOptionDefault = get__default["default"](oldKeyedSchema, "default", NO_VALUE);
1474
+ var newOptionDefault = get__default["default"](newKeyedSchema, 'default', NO_VALUE);
1475
+ var oldOptionDefault = get__default["default"](oldKeyedSchema, 'default', NO_VALUE);
1476
1476
  if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
1477
1477
  if (oldOptionDefault === formValue) {
1478
1478
  // If the old default matches the formValue, we'll update the new value to match the new default
1479
1479
  removeOldSchemaData[key] = newOptionDefault;
1480
- } else if (get__default["default"](newKeyedSchema, "readOnly") === true) {
1480
+ } else if (get__default["default"](newKeyedSchema, 'readOnly') === true) {
1481
1481
  // If the new schema has the default set to read-only, treat it like a const and remove the value
1482
1482
  removeOldSchemaData[key] = undefined;
1483
1483
  }
1484
1484
  }
1485
- var newOptionConst = get__default["default"](newKeyedSchema, "const", NO_VALUE);
1486
- var oldOptionConst = get__default["default"](oldKeyedSchema, "const", NO_VALUE);
1485
+ var newOptionConst = get__default["default"](newKeyedSchema, 'const', NO_VALUE);
1486
+ var oldOptionConst = get__default["default"](oldKeyedSchema, 'const', NO_VALUE);
1487
1487
  if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
1488
1488
  // Since this is a const, if the old value matches, replace the value with the new const otherwise clear it
1489
1489
  removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : undefined;
@@ -1493,12 +1493,12 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1493
1493
  });
1494
1494
  newFormData = _extends({}, data, removeOldSchemaData, nestedData);
1495
1495
  // First apply removing the old schema data, then apply the nested data, then apply the old data keys to keep
1496
- } else if (get__default["default"](oldSchema, "type") === "array" && get__default["default"](newSchema, "type") === "array" && Array.isArray(data)) {
1497
- var oldSchemaItems = get__default["default"](oldSchema, "items");
1498
- var newSchemaItems = get__default["default"](newSchema, "items");
1496
+ } else if (get__default["default"](oldSchema, 'type') === 'array' && get__default["default"](newSchema, 'type') === 'array' && Array.isArray(data)) {
1497
+ var oldSchemaItems = get__default["default"](oldSchema, 'items');
1498
+ var newSchemaItems = get__default["default"](newSchema, 'items');
1499
1499
  // If any of the array types `items` are arrays (remember arrays are objects) then we'll just drop the data
1500
1500
  // Eventually, we may want to deal with when either of the `items` are arrays since those tuple validations
1501
- if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
1501
+ if (typeof oldSchemaItems === 'object' && typeof newSchemaItems === 'object' && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
1502
1502
  if (has__default["default"](oldSchemaItems, REF_KEY)) {
1503
1503
  oldSchemaItems = retrieveSchema(validator, oldSchemaItems, rootSchema, data);
1504
1504
  }
@@ -1506,12 +1506,12 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1506
1506
  newSchemaItems = retrieveSchema(validator, newSchemaItems, rootSchema, data);
1507
1507
  }
1508
1508
  // Now get types and see if they are the same
1509
- var oldSchemaType = get__default["default"](oldSchemaItems, "type");
1510
- var newSchemaType = get__default["default"](newSchemaItems, "type");
1509
+ var oldSchemaType = get__default["default"](oldSchemaItems, 'type');
1510
+ var newSchemaType = get__default["default"](newSchemaItems, 'type');
1511
1511
  // Check if the old option has the same key with the same type
1512
1512
  if (!oldSchemaType || oldSchemaType === newSchemaType) {
1513
- var maxItems = get__default["default"](newSchema, "maxItems", -1);
1514
- if (newSchemaType === "object") {
1513
+ var maxItems = get__default["default"](newSchema, 'maxItems', -1);
1514
+ if (newSchemaType === 'object') {
1515
1515
  newFormData = data.reduce(function (newValue, aValue) {
1516
1516
  var itemValue = sanitizeDataForNewSchema(validator, rootSchema, newSchemaItems, oldSchemaItems, aValue);
1517
1517
  if (itemValue !== undefined && (maxItems < 0 || newValue.length < maxItems)) {
@@ -1523,7 +1523,7 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1523
1523
  newFormData = maxItems > 0 && data.length > maxItems ? data.slice(0, maxItems) : data;
1524
1524
  }
1525
1525
  }
1526
- } else if (typeof oldSchemaItems === "boolean" && typeof newSchemaItems === "boolean" && oldSchemaItems === newSchemaItems) {
1526
+ } else if (typeof oldSchemaItems === 'boolean' && typeof newSchemaItems === 'boolean' && oldSchemaItems === newSchemaItems) {
1527
1527
  // If they are both booleans and have the same value just return the data as is otherwise fall-thru to undefined
1528
1528
  newFormData = data;
1529
1529
  }
@@ -1546,10 +1546,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
1546
1546
  */
1547
1547
  function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSeparator) {
1548
1548
  if (idPrefix === void 0) {
1549
- idPrefix = "root";
1549
+ idPrefix = 'root';
1550
1550
  }
1551
1551
  if (idSeparator === void 0) {
1552
- idSeparator = "_";
1552
+ idSeparator = '_';
1553
1553
  }
1554
1554
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
1555
1555
  var _schema = retrieveSchema(validator, schema, rootSchema, formData);
@@ -1562,7 +1562,7 @@ function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSep
1562
1562
  var idSchema = {
1563
1563
  $id: $id
1564
1564
  };
1565
- if (schema.type === "object" && PROPERTIES_KEY in schema) {
1565
+ if (schema.type === 'object' && PROPERTIES_KEY in schema) {
1566
1566
  for (var name in schema.properties) {
1567
1567
  var field = get__default["default"](schema, [PROPERTIES_KEY, name]);
1568
1568
  var fieldId = idSchema[ID_KEY] + idSeparator + name;
@@ -1587,13 +1587,13 @@ function toIdSchema(validator, schema, id, rootSchema, formData, idPrefix, idSep
1587
1587
  function toPathSchema(validator, schema, name, rootSchema, formData) {
1588
1588
  var _pathSchema;
1589
1589
  if (name === void 0) {
1590
- name = "";
1590
+ name = '';
1591
1591
  }
1592
1592
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
1593
1593
  var _schema = retrieveSchema(validator, schema, rootSchema, formData);
1594
1594
  return toPathSchema(validator, _schema, name, rootSchema, formData);
1595
1595
  }
1596
- var pathSchema = (_pathSchema = {}, _pathSchema[NAME_KEY] = name.replace(/^\./, ""), _pathSchema);
1596
+ var pathSchema = (_pathSchema = {}, _pathSchema[NAME_KEY] = name.replace(/^\./, ''), _pathSchema);
1597
1597
  if (ONE_OF_KEY in schema) {
1598
1598
  var index = getClosestMatchingOption(validator, rootSchema, formData, schema.oneOf, 0);
1599
1599
  var _schema2 = schema.oneOf[index];
@@ -1796,10 +1796,10 @@ var SchemaUtils = /*#__PURE__*/function () {
1796
1796
  */;
1797
1797
  _proto.toIdSchema = function toIdSchema$1(schema, id, formData, idPrefix, idSeparator) {
1798
1798
  if (idPrefix === void 0) {
1799
- idPrefix = "root";
1799
+ idPrefix = 'root';
1800
1800
  }
1801
1801
  if (idSeparator === void 0) {
1802
- idSeparator = "_";
1802
+ idSeparator = '_';
1803
1803
  }
1804
1804
  return toIdSchema(this.validator, schema, id, this.rootSchema, formData, idPrefix, idSeparator);
1805
1805
  }
@@ -1834,38 +1834,85 @@ function createSchemaUtils(validator, rootSchema) {
1834
1834
  */
1835
1835
  function dataURItoBlob(dataURI) {
1836
1836
  // Split metadata from data
1837
- var splitted = dataURI.split(",");
1837
+ var splitted = dataURI.split(',');
1838
1838
  // Split params
1839
- var params = splitted[0].split(";");
1839
+ var params = splitted[0].split(';');
1840
1840
  // Get mime-type from params
1841
- var type = params[0].replace("data:", "");
1841
+ var type = params[0].replace('data:', '');
1842
1842
  // Filter the name property from params
1843
1843
  var properties = params.filter(function (param) {
1844
- return param.split("=")[0] === "name";
1844
+ return param.split('=')[0] === 'name';
1845
1845
  });
1846
1846
  // Look for the name and use unknown if no name property.
1847
1847
  var name;
1848
1848
  if (properties.length !== 1) {
1849
- name = "unknown";
1849
+ name = 'unknown';
1850
1850
  } else {
1851
1851
  // Because we filtered out the other property,
1852
- // we only have the name case here.
1853
- name = properties[0].split("=")[1];
1852
+ // we only have the name case here, which we decode to make it human-readable
1853
+ name = decodeURI(properties[0].split('=')[1]);
1854
1854
  }
1855
1855
  // Built the Uint8Array Blob parameter from the base64 string.
1856
- var binary = atob(splitted[1]);
1857
- var array = [];
1858
- for (var i = 0; i < binary.length; i++) {
1859
- array.push(binary.charCodeAt(i));
1860
- }
1861
- // Create the blob object
1862
- var blob = new window.Blob([new Uint8Array(array)], {
1863
- type: type
1864
- });
1865
- return {
1866
- blob: blob,
1867
- name: name
1868
- };
1856
+ try {
1857
+ var binary = atob(splitted[1]);
1858
+ var array = [];
1859
+ for (var i = 0; i < binary.length; i++) {
1860
+ array.push(binary.charCodeAt(i));
1861
+ }
1862
+ // Create the blob object
1863
+ var blob = new window.Blob([new Uint8Array(array)], {
1864
+ type: type
1865
+ });
1866
+ return {
1867
+ blob: blob,
1868
+ name: name
1869
+ };
1870
+ } catch (error) {
1871
+ return {
1872
+ blob: {
1873
+ size: 0,
1874
+ type: error.message
1875
+ },
1876
+ name: dataURI
1877
+ };
1878
+ }
1879
+ }
1880
+
1881
+ /** Potentially substitutes all replaceable parameters with the associated value(s) from the `params` if available. When
1882
+ * a `params` array is provided, each value in the array is used to replace any of the replaceable parameters in the
1883
+ * `inputString` using the `%1`, `%2`, etc. replacement specifiers.
1884
+ *
1885
+ * @param inputString - The string which will be potentially updated with replacement parameters
1886
+ * @param params - The optional list of replaceable parameter values to substitute into the english string
1887
+ * @returns - The updated string with any replacement specifiers replaced
1888
+ */
1889
+ function replaceStringParameters(inputString, params) {
1890
+ var output = inputString;
1891
+ if (Array.isArray(params)) {
1892
+ var parts = output.split(/(%\d)/);
1893
+ params.forEach(function (param, index) {
1894
+ var partIndex = parts.findIndex(function (part) {
1895
+ return part === "%" + (index + 1);
1896
+ });
1897
+ if (partIndex >= 0) {
1898
+ parts[partIndex] = param;
1899
+ }
1900
+ });
1901
+ output = parts.join('');
1902
+ }
1903
+ return output;
1904
+ }
1905
+
1906
+ /** Translates a `TranslatableString` value `stringToTranslate` into english. When a `params` array is provided, each
1907
+ * value in the array is used to replace any of the replaceable parameters in the `stringToTranslate` using the `%1`,
1908
+ * `%2`, etc. replacement specifiers.
1909
+ *
1910
+ * @param stringToTranslate - The `TranslatableString` value to convert to english
1911
+ * @param params - The optional list of replaceable parameter values to substitute into the english string
1912
+ * @returns - The `stringToTranslate` itself with any replaceable parameter values substituted
1913
+ */
1914
+ function englishStringTranslator(stringToTranslate, params) {
1915
+ return replaceStringParameters(stringToTranslate, params);
1869
1916
  }
1870
1917
 
1871
1918
  /** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an
@@ -1891,7 +1938,7 @@ function enumOptionsValueForIndex(valueIndex, allEnumOptions, emptyValue) {
1891
1938
  });
1892
1939
  }
1893
1940
  // So Number(null) and Number('') both return 0, so use emptyValue for those two values
1894
- var index = valueIndex === "" || valueIndex === null ? -1 : Number(valueIndex);
1941
+ var index = valueIndex === '' || valueIndex === null ? -1 : Number(valueIndex);
1895
1942
  var option = allEnumOptions[index];
1896
1943
  return option ? option.value : emptyValue;
1897
1944
  }
@@ -1957,7 +2004,7 @@ function enumOptionsIndexForValue(value, allEnumOptions, multiple) {
1957
2004
  var selectedIndexes = allEnumOptions.map(function (opt, index) {
1958
2005
  return enumOptionsIsSelected(opt.value, value) ? String(index) : undefined;
1959
2006
  }).filter(function (opt) {
1960
- return typeof opt !== "undefined";
2007
+ return typeof opt !== 'undefined';
1961
2008
  });
1962
2009
  if (!multiple) {
1963
2010
  return selectedIndexes[0];
@@ -2025,7 +2072,7 @@ var ErrorSchemaBuilder = /*#__PURE__*/function () {
2025
2072
  * @private
2026
2073
  */
2027
2074
  _proto.getOrCreateErrorBlock = function getOrCreateErrorBlock(pathOfError) {
2028
- var hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
2075
+ var hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === 'string';
2029
2076
  var errorBlock = hasPath ? get__default["default"](this.errorSchema, pathOfError) : this.errorSchema;
2030
2077
  if (!errorBlock && pathOfError) {
2031
2078
  errorBlock = {};
@@ -2137,23 +2184,23 @@ function getInputProps(schema, defaultType, options, autoDefaultStepAny) {
2137
2184
  autoDefaultStepAny = true;
2138
2185
  }
2139
2186
  var inputProps = _extends({
2140
- type: defaultType || "text"
2187
+ type: defaultType || 'text'
2141
2188
  }, rangeSpec(schema));
2142
2189
  // If options.inputType is set use that as the input type
2143
2190
  if (options.inputType) {
2144
2191
  inputProps.type = options.inputType;
2145
2192
  } else if (!defaultType) {
2146
2193
  // If the schema is of type number or integer, set the input type to number
2147
- if (schema.type === "number") {
2148
- inputProps.type = "number";
2194
+ if (schema.type === 'number') {
2195
+ inputProps.type = 'number';
2149
2196
  // Only add step if one isn't already defined and we are auto-defaulting the "any" step
2150
2197
  if (autoDefaultStepAny && inputProps.step === undefined) {
2151
2198
  // Setting step to 'any' fixes a bug in Safari where decimals are not
2152
2199
  // allowed in number inputs
2153
- inputProps.step = "any";
2200
+ inputProps.step = 'any';
2154
2201
  }
2155
- } else if (schema.type === "integer") {
2156
- inputProps.type = "number";
2202
+ } else if (schema.type === 'integer') {
2203
+ inputProps.type = 'number';
2157
2204
  // Only add step if one isn't already defined
2158
2205
  if (inputProps.step === undefined) {
2159
2206
  // Since this is integer, you always want to step up or down in multiples of 1
@@ -2173,7 +2220,7 @@ var DEFAULT_OPTIONS = {
2173
2220
  props: {
2174
2221
  disabled: false
2175
2222
  },
2176
- submitText: "Submit",
2223
+ submitText: 'Submit',
2177
2224
  norender: false
2178
2225
  };
2179
2226
  /** Extracts any `ui:submitButtonOptions` from the `uiSchema` and merges them onto the `DEFAULT_OPTIONS`
@@ -2206,7 +2253,7 @@ function getTemplate(name, registry, uiOptions) {
2206
2253
  uiOptions = {};
2207
2254
  }
2208
2255
  var templates = registry.templates;
2209
- if (name === "ButtonTemplates") {
2256
+ if (name === 'ButtonTemplates') {
2210
2257
  return templates[name];
2211
2258
  }
2212
2259
  return (
@@ -2221,53 +2268,53 @@ var _excluded = ["options"];
2221
2268
  */
2222
2269
  var widgetMap = {
2223
2270
  "boolean": {
2224
- checkbox: "CheckboxWidget",
2225
- radio: "RadioWidget",
2226
- select: "SelectWidget",
2227
- hidden: "HiddenWidget"
2271
+ checkbox: 'CheckboxWidget',
2272
+ radio: 'RadioWidget',
2273
+ select: 'SelectWidget',
2274
+ hidden: 'HiddenWidget'
2228
2275
  },
2229
2276
  string: {
2230
- text: "TextWidget",
2231
- password: "PasswordWidget",
2232
- email: "EmailWidget",
2233
- hostname: "TextWidget",
2234
- ipv4: "TextWidget",
2235
- ipv6: "TextWidget",
2236
- uri: "URLWidget",
2237
- "data-url": "FileWidget",
2238
- radio: "RadioWidget",
2239
- select: "SelectWidget",
2240
- textarea: "TextareaWidget",
2241
- hidden: "HiddenWidget",
2242
- date: "DateWidget",
2243
- datetime: "DateTimeWidget",
2244
- "date-time": "DateTimeWidget",
2245
- "alt-date": "AltDateWidget",
2246
- "alt-datetime": "AltDateTimeWidget",
2247
- color: "ColorWidget",
2248
- file: "FileWidget"
2277
+ text: 'TextWidget',
2278
+ password: 'PasswordWidget',
2279
+ email: 'EmailWidget',
2280
+ hostname: 'TextWidget',
2281
+ ipv4: 'TextWidget',
2282
+ ipv6: 'TextWidget',
2283
+ uri: 'URLWidget',
2284
+ 'data-url': 'FileWidget',
2285
+ radio: 'RadioWidget',
2286
+ select: 'SelectWidget',
2287
+ textarea: 'TextareaWidget',
2288
+ hidden: 'HiddenWidget',
2289
+ date: 'DateWidget',
2290
+ datetime: 'DateTimeWidget',
2291
+ 'date-time': 'DateTimeWidget',
2292
+ 'alt-date': 'AltDateWidget',
2293
+ 'alt-datetime': 'AltDateTimeWidget',
2294
+ color: 'ColorWidget',
2295
+ file: 'FileWidget'
2249
2296
  },
2250
2297
  number: {
2251
- text: "TextWidget",
2252
- select: "SelectWidget",
2253
- updown: "UpDownWidget",
2254
- range: "RangeWidget",
2255
- radio: "RadioWidget",
2256
- hidden: "HiddenWidget"
2298
+ text: 'TextWidget',
2299
+ select: 'SelectWidget',
2300
+ updown: 'UpDownWidget',
2301
+ range: 'RangeWidget',
2302
+ radio: 'RadioWidget',
2303
+ hidden: 'HiddenWidget'
2257
2304
  },
2258
2305
  integer: {
2259
- text: "TextWidget",
2260
- select: "SelectWidget",
2261
- updown: "UpDownWidget",
2262
- range: "RangeWidget",
2263
- radio: "RadioWidget",
2264
- hidden: "HiddenWidget"
2306
+ text: 'TextWidget',
2307
+ select: 'SelectWidget',
2308
+ updown: 'UpDownWidget',
2309
+ range: 'RangeWidget',
2310
+ radio: 'RadioWidget',
2311
+ hidden: 'HiddenWidget'
2265
2312
  },
2266
2313
  array: {
2267
- select: "SelectWidget",
2268
- checkboxes: "CheckboxesWidget",
2269
- files: "FileWidget",
2270
- hidden: "HiddenWidget"
2314
+ select: 'SelectWidget',
2315
+ checkboxes: 'CheckboxesWidget',
2316
+ files: 'FileWidget',
2317
+ hidden: 'HiddenWidget'
2271
2318
  }
2272
2319
  };
2273
2320
  /** Wraps the given widget with stateless functional component that will merge any `defaultProps.options` with the
@@ -2278,18 +2325,18 @@ var widgetMap = {
2278
2325
  * @returns - The wrapper widget
2279
2326
  */
2280
2327
  function mergeWidgetOptions(AWidget) {
2281
- var MergedWidget = get__default["default"](AWidget, "MergedWidget");
2328
+ var MergedWidget = get__default["default"](AWidget, 'MergedWidget');
2282
2329
  // cache return value as property of widget for proper react reconciliation
2283
2330
  if (!MergedWidget) {
2284
2331
  var defaultOptions = AWidget.defaultProps && AWidget.defaultProps.options || {};
2285
2332
  MergedWidget = function MergedWidget(_ref) {
2286
2333
  var options = _ref.options,
2287
2334
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
2288
- return /*#__PURE__*/React__default["default"].createElement(AWidget, _extends({
2335
+ return jsxRuntime.jsx(AWidget, _extends({
2289
2336
  options: _extends({}, defaultOptions, options)
2290
2337
  }, props));
2291
2338
  };
2292
- set__default["default"](AWidget, "MergedWidget", MergedWidget);
2339
+ set__default["default"](AWidget, 'MergedWidget', MergedWidget);
2293
2340
  }
2294
2341
  return MergedWidget;
2295
2342
  }
@@ -2309,17 +2356,17 @@ function getWidget(schema, widget, registeredWidgets) {
2309
2356
  registeredWidgets = {};
2310
2357
  }
2311
2358
  var type = getSchemaType(schema);
2312
- if (typeof widget === "function" || widget && ReactIs__default["default"].isForwardRef( /*#__PURE__*/React__default["default"].createElement(widget)) || ReactIs__default["default"].isMemo(widget)) {
2359
+ if (typeof widget === 'function' || widget && ReactIs__default["default"].isForwardRef( /*#__PURE__*/react.createElement(widget)) || ReactIs__default["default"].isMemo(widget)) {
2313
2360
  return mergeWidgetOptions(widget);
2314
2361
  }
2315
- if (typeof widget !== "string") {
2362
+ if (typeof widget !== 'string') {
2316
2363
  throw new Error("Unsupported widget definition: " + typeof widget);
2317
2364
  }
2318
2365
  if (widget in registeredWidgets) {
2319
2366
  var registeredWidget = registeredWidgets[widget];
2320
2367
  return getWidget(schema, registeredWidget, registeredWidgets);
2321
2368
  }
2322
- if (typeof type === "string") {
2369
+ if (typeof type === 'string') {
2323
2370
  if (!(type in widgetMap)) {
2324
2371
  throw new Error("No widget for type '" + type + "'");
2325
2372
  }
@@ -2348,7 +2395,7 @@ function hasWidget(schema, widget, registeredWidgets) {
2348
2395
  return true;
2349
2396
  } catch (e) {
2350
2397
  var err = e;
2351
- if (err.message && (err.message.startsWith("No widget") || err.message.startsWith("Unsupported widget"))) {
2398
+ if (err.message && (err.message.startsWith('No widget') || err.message.startsWith('Unsupported widget'))) {
2352
2399
  return false;
2353
2400
  }
2354
2401
  throw e;
@@ -2370,7 +2417,7 @@ function idGenerator(id, suffix) {
2370
2417
  * @returns - The consistent id for the field description element from the given `id`
2371
2418
  */
2372
2419
  function descriptionId(id) {
2373
- return idGenerator(id, "description");
2420
+ return idGenerator(id, 'description');
2374
2421
  }
2375
2422
  /** Return a consistent `id` for the field error element
2376
2423
  *
@@ -2378,7 +2425,7 @@ function descriptionId(id) {
2378
2425
  * @returns - The consistent id for the field error element from the given `id`
2379
2426
  */
2380
2427
  function errorId(id) {
2381
- return idGenerator(id, "error");
2428
+ return idGenerator(id, 'error');
2382
2429
  }
2383
2430
  /** Return a consistent `id` for the field examples element
2384
2431
  *
@@ -2386,7 +2433,7 @@ function errorId(id) {
2386
2433
  * @returns - The consistent id for the field examples element from the given `id`
2387
2434
  */
2388
2435
  function examplesId(id) {
2389
- return idGenerator(id, "examples");
2436
+ return idGenerator(id, 'examples');
2390
2437
  }
2391
2438
  /** Return a consistent `id` for the field help element
2392
2439
  *
@@ -2394,7 +2441,7 @@ function examplesId(id) {
2394
2441
  * @returns - The consistent id for the field help element from the given `id`
2395
2442
  */
2396
2443
  function helpId(id) {
2397
- return idGenerator(id, "help");
2444
+ return idGenerator(id, 'help');
2398
2445
  }
2399
2446
  /** Return a consistent `id` for the field title element
2400
2447
  *
@@ -2402,7 +2449,7 @@ function helpId(id) {
2402
2449
  * @returns - The consistent id for the field title element from the given `id`
2403
2450
  */
2404
2451
  function titleId(id) {
2405
- return idGenerator(id, "title");
2452
+ return idGenerator(id, 'title');
2406
2453
  }
2407
2454
  /** Return a list of element ids that contain additional information about the field that can be used to as the aria
2408
2455
  * description of the field. This is correctly omitting `titleId` which would be "labeling" rather than "describing" the
@@ -2416,7 +2463,7 @@ function ariaDescribedByIds(id, includeExamples) {
2416
2463
  if (includeExamples === void 0) {
2417
2464
  includeExamples = false;
2418
2465
  }
2419
- var examples = includeExamples ? " " + examplesId(id) : "";
2466
+ var examples = includeExamples ? " " + examplesId(id) : '';
2420
2467
  return errorId(id) + " " + descriptionId(id) + " " + helpId(id) + examples;
2421
2468
  }
2422
2469
  /** Return a consistent `id` for the `optionIndex`s of a `Radio` or `Checkboxes` widget
@@ -2452,7 +2499,7 @@ function toConstant(schema) {
2452
2499
  if (CONST_KEY in schema) {
2453
2500
  return schema["const"];
2454
2501
  }
2455
- throw new Error("schema cannot be inferred as a constant");
2502
+ throw new Error('schema cannot be inferred as a constant');
2456
2503
  }
2457
2504
 
2458
2505
  /** Gets the list of options from the schema. If the schema has an enum list, then those enum values are returned. The
@@ -2467,8 +2514,8 @@ function optionsList(schema) {
2467
2514
  // enumNames was deprecated in v5 and is intentionally omitted from the RJSFSchema type.
2468
2515
  // Cast the type to include enumNames so the feature still works.
2469
2516
  var schemaWithEnumNames = schema;
2470
- if (schemaWithEnumNames.enumNames && "development" !== "production") {
2471
- console.warn("The enumNames property is deprecated and may be removed in a future major release.");
2517
+ if (schemaWithEnumNames.enumNames && "development" !== 'production') {
2518
+ console.warn('The enumNames property is deprecated and may be removed in a future major release.');
2472
2519
  }
2473
2520
  if (schema["enum"]) {
2474
2521
  return schema["enum"].map(function (value, i) {
@@ -2517,21 +2564,21 @@ function orderProperties(properties, order) {
2517
2564
  };
2518
2565
  var propertyHash = arrayToHash(properties);
2519
2566
  var orderFiltered = order.filter(function (prop) {
2520
- return prop === "*" || propertyHash[prop];
2567
+ return prop === '*' || propertyHash[prop];
2521
2568
  });
2522
2569
  var orderHash = arrayToHash(orderFiltered);
2523
2570
  var rest = properties.filter(function (prop) {
2524
2571
  return !orderHash[prop];
2525
2572
  });
2526
- var restIndex = orderFiltered.indexOf("*");
2573
+ var restIndex = orderFiltered.indexOf('*');
2527
2574
  if (restIndex === -1) {
2528
2575
  if (rest.length) {
2529
2576
  throw new Error("uiSchema order list does not contain " + errorPropList(rest));
2530
2577
  }
2531
2578
  return orderFiltered;
2532
2579
  }
2533
- if (restIndex !== orderFiltered.lastIndexOf("*")) {
2534
- throw new Error("uiSchema order list contains more than one wildcard item");
2580
+ if (restIndex !== orderFiltered.lastIndexOf('*')) {
2581
+ throw new Error('uiSchema order list contains more than one wildcard item');
2535
2582
  }
2536
2583
  var complete = [].concat(orderFiltered);
2537
2584
  complete.splice.apply(complete, [restIndex, 1].concat(rest));
@@ -2547,7 +2594,7 @@ function orderProperties(properties, order) {
2547
2594
  function pad(num, width) {
2548
2595
  var s = String(num);
2549
2596
  while (s.length < width) {
2550
- s = "0" + s;
2597
+ s = '0' + s;
2551
2598
  }
2552
2599
  return s;
2553
2600
  }
@@ -2575,7 +2622,7 @@ function parseDateString(dateString, includeTime) {
2575
2622
  }
2576
2623
  var date = new Date(dateString);
2577
2624
  if (Number.isNaN(date.getTime())) {
2578
- throw new Error("Unable to parse date " + dateString);
2625
+ throw new Error('Unable to parse date ' + dateString);
2579
2626
  }
2580
2627
  return {
2581
2628
  year: date.getUTCFullYear(),
@@ -2669,7 +2716,7 @@ function toDateString(dateObject, time) {
2669
2716
  */
2670
2717
  function utcToLocal(jsonDate) {
2671
2718
  if (!jsonDate) {
2672
- return "";
2719
+ return '';
2673
2720
  }
2674
2721
  // required format of `'yyyy-MM-ddThh:mm' followed by optional ':ss' or ':ss.SSS'
2675
2722
  // https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type%3Ddatetime-local)
@@ -2687,6 +2734,76 @@ function utcToLocal(jsonDate) {
2687
2734
  return yyyy + "-" + MM + "-" + dd + "T" + hh + ":" + mm + ":" + ss + "." + SSS;
2688
2735
  }
2689
2736
 
2737
+ /** An enumeration of all the translatable strings used by `@rjsf/core` and its themes. The value of each of the
2738
+ * enumeration keys is expected to be the actual english string. Some strings contain replaceable parameter values
2739
+ * as indicated by `%1`, `%2`, etc. The number after the `%` indicates the order of the parameter. The ordering of
2740
+ * parameters is important because some languages may choose to put the second parameter before the first in its
2741
+ * translation. Also, some strings are rendered using `markdown-to-jsx` and thus support markdown and inline html.
2742
+ */
2743
+ exports.TranslatableString = void 0;
2744
+ (function (TranslatableString) {
2745
+ /** Fallback title of an array item, used by ArrayField */
2746
+ TranslatableString["ArrayItemTitle"] = "Item";
2747
+ /** Missing items reason, used by ArrayField */
2748
+ TranslatableString["MissingItems"] = "Missing items definition";
2749
+ /** Yes label, used by BooleanField */
2750
+ TranslatableString["YesLabel"] = "Yes";
2751
+ /** No label, used by BooleanField */
2752
+ TranslatableString["NoLabel"] = "No";
2753
+ /** Close label, used by ErrorList */
2754
+ TranslatableString["CloseLabel"] = "Close";
2755
+ /** Errors label, used by ErrorList */
2756
+ TranslatableString["ErrorsLabel"] = "Errors";
2757
+ /** New additionalProperties string default value, used by ObjectField */
2758
+ TranslatableString["NewStringDefault"] = "New Value";
2759
+ /** Add button title, used by AddButton */
2760
+ TranslatableString["AddButton"] = "Add";
2761
+ /** Add button title, used by AddButton */
2762
+ TranslatableString["AddItemButton"] = "Add Item";
2763
+ /** Move down button title, used by IconButton */
2764
+ TranslatableString["MoveDownButton"] = "Move down";
2765
+ /** Move up button title, used by IconButton */
2766
+ TranslatableString["MoveUpButton"] = "Move up";
2767
+ /** Remove button title, used by IconButton */
2768
+ TranslatableString["RemoveButton"] = "Remove";
2769
+ /** Now label, used by AltDateWidget */
2770
+ TranslatableString["NowLabel"] = "Now";
2771
+ /** Clear label, used by AltDateWidget */
2772
+ TranslatableString["ClearLabel"] = "Clear";
2773
+ /** Aria date label, used by DateWidget */
2774
+ TranslatableString["AriaDateLabel"] = "Select a date";
2775
+ /** Decrement button aria label, used by UpDownWidget */
2776
+ TranslatableString["DecrementAriaLabel"] = "Decrease value by 1";
2777
+ /** Increment button aria label, used by UpDownWidget */
2778
+ TranslatableString["IncrementAriaLabel"] = "Increase value by 1";
2779
+ // Strings with replaceable parameters
2780
+ /** Unknown field type reason, where %1 will be replaced with the type as provided by SchemaField */
2781
+ TranslatableString["UnknownFieldType"] = "Unknown field type %1";
2782
+ /** Option prefix, where %1 will be replaced with the option index as provided by MultiSchemaField */
2783
+ TranslatableString["OptionPrefix"] = "Option %1";
2784
+ /** Option prefix, where %1 and %2 will be replaced by the schema title and option index, respectively as provided by
2785
+ * MultiSchemaField
2786
+ */
2787
+ TranslatableString["TitleOptionPrefix"] = "%1 option %2";
2788
+ /** Key label, where %1 will be replaced by the label as provided by WrapIfAdditionalTemplate */
2789
+ TranslatableString["KeyLabel"] = "%1 Key";
2790
+ // Strings with replaceable parameters AND/OR that support markdown and html
2791
+ /** Unsupported field schema, used by UnsupportedField */
2792
+ TranslatableString["UnsupportedField"] = "Unsupported field schema.";
2793
+ /** Unsupported field schema, where %1 will be replaced by the idSchema.$id as provided by UnsupportedField */
2794
+ TranslatableString["UnsupportedFieldWithId"] = "Unsupported field schema for field <code>%1</code>.";
2795
+ /** Unsupported field schema, where %1 will be replaced by the reason string as provided by UnsupportedField */
2796
+ TranslatableString["UnsupportedFieldWithReason"] = "Unsupported field schema: <em>%1</em>.";
2797
+ /** Unsupported field schema, where %1 and %2 will be replaced by the idSchema.$id and reason strings, respectively,
2798
+ * as provided by UnsupportedField
2799
+ */
2800
+ TranslatableString["UnsupportedFieldWithIdAndReason"] = "Unsupported field schema for field <code>%1</code>: <em>%2</em>.";
2801
+ /** File name, type and size info, where %1, %2 and %3 will be replaced by the file name, file type and file size as
2802
+ * provided by FileWidget
2803
+ */
2804
+ TranslatableString["FilesInfo"] = "<strong>%1</strong> (%2, %3 bytes)";
2805
+ })(exports.TranslatableString || (exports.TranslatableString = {}));
2806
+
2690
2807
  exports.ADDITIONAL_PROPERTIES_KEY = ADDITIONAL_PROPERTIES_KEY;
2691
2808
  exports.ADDITIONAL_PROPERTY_FLAG = ADDITIONAL_PROPERTY_FLAG;
2692
2809
  exports.ALL_OF_KEY = ALL_OF_KEY;
@@ -2718,6 +2835,7 @@ exports.createSchemaUtils = createSchemaUtils;
2718
2835
  exports.dataURItoBlob = dataURItoBlob;
2719
2836
  exports.deepEquals = deepEquals;
2720
2837
  exports.descriptionId = descriptionId;
2838
+ exports.englishStringTranslator = englishStringTranslator;
2721
2839
  exports.enumOptionsDeselectValue = enumOptionsDeselectValue;
2722
2840
  exports.enumOptionsIndexForValue = enumOptionsIndexForValue;
2723
2841
  exports.enumOptionsIsSelected = enumOptionsIsSelected;
@@ -2758,6 +2876,7 @@ exports.orderProperties = orderProperties;
2758
2876
  exports.pad = pad;
2759
2877
  exports.parseDateString = parseDateString;
2760
2878
  exports.rangeSpec = rangeSpec;
2879
+ exports.replaceStringParameters = replaceStringParameters;
2761
2880
  exports.retrieveSchema = retrieveSchema;
2762
2881
  exports.sanitizeDataForNewSchema = sanitizeDataForNewSchema;
2763
2882
  exports.schemaRequiresTrueValue = schemaRequiresTrueValue;