@rjsf/core 6.6.0 → 6.6.2

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.
Files changed (251) hide show
  1. package/dist/core.umd.js +454 -373
  2. package/dist/index.cjs +416 -334
  3. package/dist/index.cjs.map +3 -3
  4. package/dist/index.esm.js +418 -415
  5. package/dist/index.esm.js.map +3 -3
  6. package/lib/components/Form.d.ts +14 -11
  7. package/lib/components/Form.d.ts.map +1 -1
  8. package/lib/components/Form.js +97 -62
  9. package/lib/components/RichDescription.d.ts +2 -2
  10. package/lib/components/RichDescription.d.ts.map +1 -1
  11. package/lib/components/RichDescription.js +1 -1
  12. package/lib/components/RichHelp.d.ts +2 -2
  13. package/lib/components/RichHelp.d.ts.map +1 -1
  14. package/lib/components/RichHelp.js +1 -1
  15. package/lib/components/SchemaExamples.d.ts +1 -1
  16. package/lib/components/SchemaExamples.d.ts.map +1 -1
  17. package/lib/components/SchemaExamples.js +1 -3
  18. package/lib/components/fields/ArrayField.d.ts +1 -1
  19. package/lib/components/fields/ArrayField.d.ts.map +1 -1
  20. package/lib/components/fields/ArrayField.js +87 -88
  21. package/lib/components/fields/BooleanField.d.ts +1 -1
  22. package/lib/components/fields/BooleanField.d.ts.map +1 -1
  23. package/lib/components/fields/BooleanField.js +2 -5
  24. package/lib/components/fields/FallbackField.d.ts +1 -1
  25. package/lib/components/fields/FallbackField.d.ts.map +1 -1
  26. package/lib/components/fields/FallbackField.js +2 -2
  27. package/lib/components/fields/LayoutGridField.d.ts +7 -9
  28. package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
  29. package/lib/components/fields/LayoutGridField.js +5 -4
  30. package/lib/components/fields/LayoutHeaderField.d.ts +1 -1
  31. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -1
  32. package/lib/components/fields/LayoutHeaderField.js +1 -1
  33. package/lib/components/fields/LayoutMultiSchemaField.d.ts +1 -1
  34. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -1
  35. package/lib/components/fields/LayoutMultiSchemaField.js +4 -1
  36. package/lib/components/fields/MultiSchemaField.d.ts +9 -3
  37. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
  38. package/lib/components/fields/MultiSchemaField.js +27 -9
  39. package/lib/components/fields/NullField.d.ts +1 -1
  40. package/lib/components/fields/NullField.d.ts.map +1 -1
  41. package/lib/components/fields/NumberField.d.ts +1 -1
  42. package/lib/components/fields/NumberField.d.ts.map +1 -1
  43. package/lib/components/fields/NumberField.js +7 -9
  44. package/lib/components/fields/ObjectField.d.ts +1 -1
  45. package/lib/components/fields/ObjectField.d.ts.map +1 -1
  46. package/lib/components/fields/ObjectField.js +27 -25
  47. package/lib/components/fields/OptionalDataControlsField.d.ts +1 -1
  48. package/lib/components/fields/OptionalDataControlsField.d.ts.map +1 -1
  49. package/lib/components/fields/SchemaField.d.ts +1 -1
  50. package/lib/components/fields/SchemaField.d.ts.map +1 -1
  51. package/lib/components/fields/SchemaField.js +7 -7
  52. package/lib/components/fields/StringField.d.ts +1 -1
  53. package/lib/components/fields/StringField.d.ts.map +1 -1
  54. package/lib/components/fields/StringField.js +2 -5
  55. package/lib/components/fields/index.d.ts +1 -1
  56. package/lib/components/fields/index.d.ts.map +1 -1
  57. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -1
  58. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -1
  59. package/lib/components/templates/ArrayFieldDescriptionTemplate.js +1 -1
  60. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +1 -1
  61. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -1
  62. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +1 -1
  63. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +1 -1
  64. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
  65. package/lib/components/templates/ArrayFieldItemTemplate.js +1 -1
  66. package/lib/components/templates/ArrayFieldTemplate.d.ts +1 -1
  67. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
  68. package/lib/components/templates/ArrayFieldTemplate.js +1 -1
  69. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -1
  70. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -1
  71. package/lib/components/templates/ArrayFieldTitleTemplate.js +1 -1
  72. package/lib/components/templates/BaseInputTemplate.d.ts +1 -1
  73. package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -1
  74. package/lib/components/templates/BaseInputTemplate.js +7 -6
  75. package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -1
  76. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
  77. package/lib/components/templates/ButtonTemplates/IconButton.d.ts +14 -7
  78. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -1
  79. package/lib/components/templates/ButtonTemplates/IconButton.js +14 -6
  80. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -1
  81. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -1
  82. package/lib/components/templates/ButtonTemplates/index.d.ts +1 -1
  83. package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -1
  84. package/lib/components/templates/DescriptionField.d.ts +1 -1
  85. package/lib/components/templates/DescriptionField.d.ts.map +1 -1
  86. package/lib/components/templates/ErrorList.d.ts +1 -1
  87. package/lib/components/templates/ErrorList.d.ts.map +1 -1
  88. package/lib/components/templates/ErrorList.js +2 -4
  89. package/lib/components/templates/FallbackFieldTemplate.d.ts +1 -1
  90. package/lib/components/templates/FallbackFieldTemplate.d.ts.map +1 -1
  91. package/lib/components/templates/FieldErrorTemplate.d.ts +1 -1
  92. package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -1
  93. package/lib/components/templates/FieldErrorTemplate.js +1 -3
  94. package/lib/components/templates/FieldHelpTemplate.d.ts +1 -1
  95. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
  96. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -1
  97. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -1
  98. package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -1
  99. package/lib/components/templates/FieldTemplate/Label.d.ts +2 -2
  100. package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -1
  101. package/lib/components/templates/GridTemplate.d.ts +1 -1
  102. package/lib/components/templates/GridTemplate.d.ts.map +1 -1
  103. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts +1 -1
  104. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts.map +1 -1
  105. package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -1
  106. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
  107. package/lib/components/templates/ObjectFieldTemplate.js +1 -1
  108. package/lib/components/templates/OptionalDataControlsTemplate.d.ts +1 -1
  109. package/lib/components/templates/OptionalDataControlsTemplate.d.ts.map +1 -1
  110. package/lib/components/templates/OptionalDataControlsTemplate.js +1 -1
  111. package/lib/components/templates/TitleField.d.ts +1 -1
  112. package/lib/components/templates/TitleField.d.ts.map +1 -1
  113. package/lib/components/templates/UnsupportedField.d.ts +1 -1
  114. package/lib/components/templates/UnsupportedField.d.ts.map +1 -1
  115. package/lib/components/templates/UnsupportedField.js +1 -1
  116. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -1
  117. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
  118. package/lib/components/templates/WrapIfAdditionalTemplate.js +1 -1
  119. package/lib/components/templates/index.d.ts +1 -1
  120. package/lib/components/templates/index.d.ts.map +1 -1
  121. package/lib/components/widgets/AltDateTimeWidget.d.ts +1 -1
  122. package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -1
  123. package/lib/components/widgets/AltDateWidget.d.ts +1 -1
  124. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
  125. package/lib/components/widgets/AltDateWidget.js +2 -2
  126. package/lib/components/widgets/CheckboxWidget.d.ts +1 -1
  127. package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
  128. package/lib/components/widgets/CheckboxesWidget.d.ts +1 -1
  129. package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -1
  130. package/lib/components/widgets/CheckboxesWidget.js +2 -2
  131. package/lib/components/widgets/ColorWidget.d.ts +1 -1
  132. package/lib/components/widgets/ColorWidget.d.ts.map +1 -1
  133. package/lib/components/widgets/DateTimeWidget.d.ts +1 -1
  134. package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -1
  135. package/lib/components/widgets/DateTimeWidget.js +2 -2
  136. package/lib/components/widgets/DateWidget.d.ts +1 -1
  137. package/lib/components/widgets/DateWidget.d.ts.map +1 -1
  138. package/lib/components/widgets/EmailWidget.d.ts +1 -1
  139. package/lib/components/widgets/EmailWidget.d.ts.map +1 -1
  140. package/lib/components/widgets/FileWidget.d.ts +1 -1
  141. package/lib/components/widgets/FileWidget.d.ts.map +1 -1
  142. package/lib/components/widgets/FileWidget.js +6 -4
  143. package/lib/components/widgets/HiddenWidget.d.ts +1 -1
  144. package/lib/components/widgets/HiddenWidget.d.ts.map +1 -1
  145. package/lib/components/widgets/PasswordWidget.d.ts +1 -1
  146. package/lib/components/widgets/PasswordWidget.d.ts.map +1 -1
  147. package/lib/components/widgets/RadioWidget.d.ts +1 -1
  148. package/lib/components/widgets/RadioWidget.d.ts.map +1 -1
  149. package/lib/components/widgets/RadioWidget.js +2 -2
  150. package/lib/components/widgets/RangeWidget.d.ts +1 -1
  151. package/lib/components/widgets/RangeWidget.d.ts.map +1 -1
  152. package/lib/components/widgets/RatingWidget.d.ts +1 -1
  153. package/lib/components/widgets/RatingWidget.d.ts.map +1 -1
  154. package/lib/components/widgets/RatingWidget.js +15 -15
  155. package/lib/components/widgets/SelectWidget.d.ts +1 -1
  156. package/lib/components/widgets/SelectWidget.d.ts.map +1 -1
  157. package/lib/components/widgets/SelectWidget.js +4 -4
  158. package/lib/components/widgets/TextWidget.d.ts +1 -1
  159. package/lib/components/widgets/TextWidget.d.ts.map +1 -1
  160. package/lib/components/widgets/TextareaWidget.d.ts +1 -1
  161. package/lib/components/widgets/TextareaWidget.d.ts.map +1 -1
  162. package/lib/components/widgets/TextareaWidget.js +2 -2
  163. package/lib/components/widgets/TimeWidget.d.ts +1 -1
  164. package/lib/components/widgets/TimeWidget.d.ts.map +1 -1
  165. package/lib/components/widgets/URLWidget.d.ts +1 -1
  166. package/lib/components/widgets/URLWidget.d.ts.map +1 -1
  167. package/lib/components/widgets/UpDownWidget.d.ts +1 -1
  168. package/lib/components/widgets/UpDownWidget.d.ts.map +1 -1
  169. package/lib/components/widgets/index.d.ts +1 -1
  170. package/lib/components/widgets/index.d.ts.map +1 -1
  171. package/lib/getDefaultRegistry.d.ts +1 -1
  172. package/lib/getDefaultRegistry.d.ts.map +1 -1
  173. package/lib/getDefaultRegistry.js +1 -1
  174. package/lib/getTestRegistry.d.ts +1 -1
  175. package/lib/getTestRegistry.d.ts.map +1 -1
  176. package/lib/getTestRegistry.js +1 -1
  177. package/lib/index.d.ts +10 -5
  178. package/lib/index.d.ts.map +1 -1
  179. package/lib/tsconfig.tsbuildinfo +1 -1
  180. package/lib/withTheme.d.ts +3 -3
  181. package/lib/withTheme.d.ts.map +1 -1
  182. package/lib/withTheme.js +6 -6
  183. package/package.json +6 -7
  184. package/src/components/Form.tsx +164 -97
  185. package/src/components/RichDescription.tsx +3 -10
  186. package/src/components/RichHelp.tsx +3 -10
  187. package/src/components/SchemaExamples.tsx +6 -4
  188. package/src/components/fields/ArrayField.tsx +122 -108
  189. package/src/components/fields/BooleanField.tsx +4 -9
  190. package/src/components/fields/FallbackField.tsx +4 -8
  191. package/src/components/fields/LayoutGridField.tsx +21 -19
  192. package/src/components/fields/LayoutHeaderField.tsx +2 -10
  193. package/src/components/fields/LayoutMultiSchemaField.tsx +15 -10
  194. package/src/components/fields/MultiSchemaField.tsx +29 -16
  195. package/src/components/fields/NullField.tsx +1 -1
  196. package/src/components/fields/NumberField.tsx +8 -10
  197. package/src/components/fields/ObjectField.tsx +48 -39
  198. package/src/components/fields/OptionalDataControlsField.tsx +6 -4
  199. package/src/components/fields/SchemaField.tsx +22 -19
  200. package/src/components/fields/StringField.tsx +4 -15
  201. package/src/components/fields/index.ts +1 -1
  202. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -9
  203. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +2 -7
  204. package/src/components/templates/ArrayFieldItemTemplate.tsx +3 -9
  205. package/src/components/templates/ArrayFieldTemplate.tsx +2 -9
  206. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -10
  207. package/src/components/templates/BaseInputTemplate.tsx +15 -19
  208. package/src/components/templates/ButtonTemplates/AddButton.tsx +2 -1
  209. package/src/components/templates/ButtonTemplates/IconButton.tsx +16 -7
  210. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +2 -1
  211. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  212. package/src/components/templates/DescriptionField.tsx +1 -1
  213. package/src/components/templates/ErrorList.tsx +8 -15
  214. package/src/components/templates/FallbackFieldTemplate.tsx +2 -1
  215. package/src/components/templates/FieldErrorTemplate.tsx +8 -8
  216. package/src/components/templates/FieldHelpTemplate.tsx +2 -1
  217. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -8
  218. package/src/components/templates/FieldTemplate/Label.tsx +2 -2
  219. package/src/components/templates/GridTemplate.tsx +1 -1
  220. package/src/components/templates/MultiSchemaFieldTemplate.tsx +1 -1
  221. package/src/components/templates/ObjectFieldTemplate.tsx +2 -7
  222. package/src/components/templates/OptionalDataControlsTemplate.tsx +3 -2
  223. package/src/components/templates/TitleField.tsx +1 -1
  224. package/src/components/templates/UnsupportedField.tsx +3 -2
  225. package/src/components/templates/WrapIfAdditionalTemplate.tsx +2 -9
  226. package/src/components/templates/index.ts +1 -1
  227. package/src/components/widgets/AltDateTimeWidget.tsx +1 -1
  228. package/src/components/widgets/AltDateWidget.tsx +7 -13
  229. package/src/components/widgets/CheckboxWidget.tsx +3 -5
  230. package/src/components/widgets/CheckboxesWidget.tsx +6 -8
  231. package/src/components/widgets/ColorWidget.tsx +2 -1
  232. package/src/components/widgets/DateTimeWidget.tsx +3 -10
  233. package/src/components/widgets/DateWidget.tsx +2 -1
  234. package/src/components/widgets/EmailWidget.tsx +2 -1
  235. package/src/components/widgets/FileWidget.tsx +9 -8
  236. package/src/components/widgets/HiddenWidget.tsx +1 -1
  237. package/src/components/widgets/PasswordWidget.tsx +2 -1
  238. package/src/components/widgets/RadioWidget.tsx +6 -8
  239. package/src/components/widgets/RangeWidget.tsx +1 -1
  240. package/src/components/widgets/RatingWidget.tsx +48 -47
  241. package/src/components/widgets/SelectWidget.tsx +12 -10
  242. package/src/components/widgets/TextWidget.tsx +2 -1
  243. package/src/components/widgets/TextareaWidget.tsx +7 -4
  244. package/src/components/widgets/TimeWidget.tsx +2 -1
  245. package/src/components/widgets/URLWidget.tsx +2 -1
  246. package/src/components/widgets/UpDownWidget.tsx +2 -1
  247. package/src/components/widgets/index.ts +1 -1
  248. package/src/getDefaultRegistry.ts +2 -9
  249. package/src/getTestRegistry.tsx +2 -7
  250. package/src/index.ts +10 -5
  251. package/src/withTheme.tsx +14 -9
package/dist/core.umd.js CHANGED
@@ -1,20 +1,18 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/cloneDeep'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), require('lodash/unset'), require('lodash/isObject'), require('lodash/uniqueId'), require('react/jsx-runtime'), require('lodash/each'), require('lodash/flatten'), require('lodash/has'), require('lodash/includes'), require('lodash/intersection'), require('lodash/isEqual'), require('lodash/isFunction'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/isUndefined'), require('lodash/last'), require('lodash/noop'), require('lodash/omit'), require('markdown-to-jsx'), require('markdown-to-jsx/react'), require('@rjsf/validator-ajv8')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/get', 'lodash/isEmpty', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/unset', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/isEqual', 'lodash/isFunction', 'lodash/isPlainObject', 'lodash/isString', 'lodash/isUndefined', 'lodash/last', 'lodash/noop', 'lodash/omit', 'markdown-to-jsx', 'markdown-to-jsx/react', '@rjsf/validator-ajv8'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react$1, global.utils, global._cloneDeep, global.get, global.isEmpty, global._pick, global.set, global._toPath, global._unset, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.isEqual, global.isFunction, global.isPlainObject, global.isString, global.isUndefined, global.last, global.noop, global.omit3, global.markdownToJsx, global.react, global.validator));
5
- })(this, (function (exports, react$1, utils, _cloneDeep, get, isEmpty, _pick, set, _toPath, _unset, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection, isEqual, isFunction, isPlainObject, isString, isUndefined, last, noop, omit3, markdownToJsx, react, validator) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@rjsf/utils'), require('lodash/cloneDeep'), require('lodash/get'), require('lodash/isEmpty'), require('lodash/pick'), require('lodash/set'), require('lodash/toPath'), require('lodash/unset'), require('lodash/isObject'), require('lodash/uniqueId'), require('react/jsx-runtime'), require('lodash/each'), require('lodash/flatten'), require('lodash/has'), require('lodash/includes'), require('lodash/intersection'), require('lodash/isEqual'), require('lodash/isFunction'), require('lodash/isPlainObject'), require('lodash/isString'), require('lodash/isUndefined'), require('lodash/last'), require('lodash/noop'), require('lodash/omit'), require('markdown-to-jsx/react'), require('@rjsf/validator-ajv8')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@rjsf/utils', 'lodash/cloneDeep', 'lodash/get', 'lodash/isEmpty', 'lodash/pick', 'lodash/set', 'lodash/toPath', 'lodash/unset', 'lodash/isObject', 'lodash/uniqueId', 'react/jsx-runtime', 'lodash/each', 'lodash/flatten', 'lodash/has', 'lodash/includes', 'lodash/intersection', 'lodash/isEqual', 'lodash/isFunction', 'lodash/isPlainObject', 'lodash/isString', 'lodash/isUndefined', 'lodash/last', 'lodash/noop', 'lodash/omit', 'markdown-to-jsx/react', '@rjsf/validator-ajv8'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONSchemaForm = {}, global.react, global.utils, global._cloneDeep, global.get, global.isEmpty, global._pick, global.set, global._toPath, global._unset, global.isObject, global.uniqueId, global.jsxRuntime, global.each, global.flatten, global.has, global.includes, global.intersection, global.isEqual, global.isFunction, global.isPlainObject, global.isString, global.isUndefined, global.last, global.noop, global.omit3, global.react$1, global.validator));
5
+ })(this, (function (exports, react, utils, _cloneDeep, get, isEmpty, _pick, set, _toPath, _unset, isObject, uniqueId, jsxRuntime, each, flatten, has, includes, intersection, isEqual, isFunction, isPlainObject, isString, isUndefined, last, noop, omit3, react$1, validator) { 'use strict';
6
6
 
7
7
  // src/components/Form.tsx
8
8
  function generateRowId() {
9
9
  return uniqueId("rjsf-array-item-");
10
10
  }
11
11
  function generateKeyedFormData(formData) {
12
- return !Array.isArray(formData) ? [] : formData.map((item) => {
13
- return {
14
- key: generateRowId(),
15
- item
16
- };
17
- });
12
+ return !Array.isArray(formData) ? [] : formData.map((item) => ({
13
+ key: generateRowId(),
14
+ item
15
+ }));
18
16
  }
19
17
  function keyedToPlainFormData(keyedFormData) {
20
18
  if (Array.isArray(keyedFormData)) {
@@ -215,7 +213,7 @@
215
213
  }
216
214
  );
217
215
  }
218
- function ArrayFieldItem(props) {
216
+ function ArrayFieldItemInner(props) {
219
217
  const {
220
218
  itemKey,
221
219
  index,
@@ -230,10 +228,10 @@
230
228
  canRemove = true,
231
229
  canMoveUp,
232
230
  canMoveDown,
233
- itemSchema,
231
+ rawItemSchema,
234
232
  itemData,
235
233
  itemUiSchema,
236
- itemFieldPathId,
234
+ parentFieldPathId,
237
235
  itemErrorSchema,
238
236
  autofocus,
239
237
  onBlur,
@@ -250,9 +248,17 @@
250
248
  const {
251
249
  schemaUtils,
252
250
  fields: { ArraySchemaField, SchemaField: SchemaField2 },
253
- globalUiOptions
251
+ globalUiOptions,
252
+ globalFormOptions
254
253
  } = registry;
255
- const fieldPathId = utils.useDeepCompareMemo(itemFieldPathId);
254
+ const itemSchema = react.useMemo(
255
+ () => schemaUtils.retrieveSchema(rawItemSchema, itemData),
256
+ [schemaUtils, rawItemSchema, itemData]
257
+ );
258
+ const fieldPathId = react.useMemo(
259
+ () => utils.toFieldPathId(index, globalFormOptions, parentFieldPathId),
260
+ [index, globalFormOptions, parentFieldPathId]
261
+ );
256
262
  const ItemSchemaField = ArraySchemaField || SchemaField2;
257
263
  const ArrayFieldItemTemplate2 = utils.getTemplate(
258
264
  "ArrayFieldItemTemplate",
@@ -271,31 +277,31 @@
271
277
  toolbar: false
272
278
  };
273
279
  has4.toolbar = Object.keys(has4).some((key) => has4[key]);
274
- const onAddItem = react$1.useCallback(
280
+ const onAddItem = react.useCallback(
275
281
  (event) => {
276
282
  handleAddItem(event, index + 1);
277
283
  },
278
284
  [handleAddItem, index]
279
285
  );
280
- const onCopyItem = react$1.useCallback(
286
+ const onCopyItem = react.useCallback(
281
287
  (event) => {
282
288
  handleCopyItem(event, index);
283
289
  },
284
290
  [handleCopyItem, index]
285
291
  );
286
- const onRemoveItem = react$1.useCallback(
292
+ const onRemoveItem = react.useCallback(
287
293
  (event) => {
288
294
  handleRemoveItem(event, index);
289
295
  },
290
296
  [handleRemoveItem, index]
291
297
  );
292
- const onMoveUpItem = react$1.useCallback(
298
+ const onMoveUpItem = react.useCallback(
293
299
  (event) => {
294
300
  handleReorderItems(event, index, index - 1);
295
301
  },
296
302
  [handleReorderItems, index]
297
303
  );
298
- const onMoveDownItem = react$1.useCallback(
304
+ const onMoveDownItem = react.useCallback(
299
305
  (event) => {
300
306
  handleReorderItems(event, index, index + 1);
301
307
  },
@@ -361,6 +367,7 @@
361
367
  };
362
368
  return /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemTemplate2, { ...templateProps });
363
369
  }
370
+ var ArrayFieldItem = react.memo(ArrayFieldItemInner);
364
371
  function NormalArray(props) {
365
372
  const {
366
373
  schema,
@@ -387,15 +394,18 @@
387
394
  handleReorderItems
388
395
  } = props;
389
396
  const fieldTitle = schema.title || title || name;
390
- const { schemaUtils, fields: fields2, formContext, globalFormOptions, globalUiOptions } = registry;
397
+ const { schemaUtils, fields: fields2, formContext, globalUiOptions } = registry;
391
398
  const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
392
- const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
393
- const _schemaItems = isObject(schema.items) ? schema.items : {};
394
- const itemsSchema = schemaUtils.retrieveSchema(_schemaItems);
395
- const formData = keyedToPlainFormData(keyedFormData);
399
+ const uiOptions = react.useMemo(() => utils.getUiOptions(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
400
+ const schemaItems = react.useMemo(() => isObject(schema.items) ? schema.items : {}, [schema.items]);
401
+ const itemsSchema = react.useMemo(() => schemaUtils.retrieveSchema(schemaItems), [schemaUtils, schemaItems]);
402
+ const formData = react.useMemo(() => keyedToPlainFormData(keyedFormData), [keyedFormData]);
396
403
  const renderOptionalField = utils.shouldRenderOptionalField(registry, schema, required, uiSchema);
397
404
  const hasFormData = utils.isFormDataAvailable(formDataFromProps);
398
- const canAdd = canAddItem(registry, schema, formData, uiSchema) && (!renderOptionalField || hasFormData);
405
+ const canAdd = react.useMemo(
406
+ () => canAddItem(registry, schema, formData, uiSchema) && (!renderOptionalField || hasFormData),
407
+ [registry, schema, formData, uiSchema, renderOptionalField, hasFormData]
408
+ );
399
409
  const actualFormData = hasFormData ? keyedFormData : [];
400
410
  const extraClass = renderOptionalField ? " rjsf-optional-array-field" : "";
401
411
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
@@ -405,9 +415,7 @@
405
415
  items: actualFormData.map((keyedItem, index) => {
406
416
  const { key, item } = keyedItem;
407
417
  const itemCast = item;
408
- const itemSchema = schemaUtils.retrieveSchema(_schemaItems, itemCast);
409
418
  const itemErrorSchema = errorSchema ? errorSchema[index] : void 0;
410
- const itemFieldPathId = utils.toFieldPathId(index, globalFormOptions, childFieldPathId);
411
419
  const itemUiSchema = computeItemUiSchema(uiSchema, item, index, formContext);
412
420
  const itemProps = {
413
421
  itemKey: key,
@@ -424,8 +432,8 @@
424
432
  canAdd,
425
433
  canMoveUp: index > 0,
426
434
  canMoveDown: index < formData.length - 1,
427
- itemSchema,
428
- itemFieldPathId,
435
+ rawItemSchema: schemaItems,
436
+ parentFieldPathId: childFieldPathId,
429
437
  itemErrorSchema,
430
438
  itemData: itemCast,
431
439
  itemUiSchema,
@@ -486,24 +494,24 @@
486
494
  } = props;
487
495
  let { formData: items = [] } = props;
488
496
  const fieldTitle = schema.title || title || name;
489
- const { schemaUtils, fields: fields2, formContext, globalFormOptions, globalUiOptions } = registry;
490
- const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
497
+ const { fields: fields2, formContext, globalUiOptions } = registry;
498
+ const uiOptions = react.useMemo(() => utils.getUiOptions(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
491
499
  const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
492
500
  const renderOptionalField = utils.shouldRenderOptionalField(registry, schema, required, uiSchema);
493
501
  const hasFormData = utils.isFormDataAvailable(formData);
494
- const _schemaItems = isObject(schema.items) ? schema.items : [];
495
- const itemSchemas = _schemaItems.map(
496
- (item, index) => schemaUtils.retrieveSchema(item, items[index])
502
+ const schemaItems = react.useMemo(
503
+ () => isObject(schema.items) ? schema.items : [],
504
+ [schema.items]
497
505
  );
498
- const additionalSchema = isObject(schema.additionalItems) ? schemaUtils.retrieveSchema(schema.additionalItems, formData) : null;
506
+ const hasAdditionalItems = isObject(schema.additionalItems);
499
507
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
500
- if (items.length < itemSchemas.length) {
501
- items = items.concat(new Array(itemSchemas.length - items.length));
508
+ if (items.length < schemaItems.length) {
509
+ items = items.concat(new Array(schemaItems.length - items.length));
502
510
  }
503
511
  const actualFormData = hasFormData ? keyedFormData : [];
504
512
  const extraClass = renderOptionalField ? " rjsf-optional-array-field" : "";
505
513
  const optionalDataControl = renderOptionalField ? /* @__PURE__ */ jsxRuntime.jsx(OptionalDataControlsField2, { ...props, fieldPathId: childFieldPathId }) : void 0;
506
- const canAdd = canAddItem(registry, schema, items, uiSchema) && !!additionalSchema && (!renderOptionalField || hasFormData);
514
+ const canAdd = canAddItem(registry, schema, items, uiSchema) && hasAdditionalItems && (!renderOptionalField || hasFormData);
507
515
  const arrayProps = {
508
516
  canAdd,
509
517
  className: `rjsf-field rjsf-field-array rjsf-field-array-fixed-items${extraClass}`,
@@ -513,18 +521,15 @@
513
521
  items: actualFormData.map((keyedItem, index) => {
514
522
  const { key, item } = keyedItem;
515
523
  const itemCast = item;
516
- const additional = index >= itemSchemas.length;
517
- const itemSchema = (additional && isObject(schema.additionalItems) ? schemaUtils.retrieveSchema(schema.additionalItems, itemCast) : itemSchemas[index]) || {};
518
- const itemFieldPathId = utils.toFieldPathId(index, globalFormOptions, childFieldPathId);
524
+ const additional = index >= schemaItems.length;
525
+ const rawItemSchema = (additional && isObject(schema.additionalItems) ? schema.additionalItems : schemaItems[index]) || {};
519
526
  let itemUiSchema;
520
527
  if (additional) {
521
528
  itemUiSchema = uiSchema.additionalItems;
529
+ } else if (Array.isArray(uiSchema.items)) {
530
+ itemUiSchema = uiSchema.items[index];
522
531
  } else {
523
- if (Array.isArray(uiSchema.items)) {
524
- itemUiSchema = uiSchema.items[index];
525
- } else {
526
- itemUiSchema = computeItemUiSchema(uiSchema, item, index, formContext);
527
- }
532
+ itemUiSchema = computeItemUiSchema(uiSchema, item, index, formContext);
528
533
  }
529
534
  const itemErrorSchema = errorSchema ? errorSchema[index] : void 0;
530
535
  const itemProps = {
@@ -541,12 +546,12 @@
541
546
  title: fieldTitle ? `${fieldTitle}-${index + 1}` : void 0,
542
547
  canAdd,
543
548
  canRemove: additional,
544
- canMoveUp: index >= itemSchemas.length + 1,
549
+ canMoveUp: index >= schemaItems.length + 1,
545
550
  canMoveDown: additional && index < items.length - 1,
546
- itemSchema,
551
+ rawItemSchema,
547
552
  itemData: itemCast,
548
553
  itemUiSchema,
549
- itemFieldPathId,
554
+ parentFieldPathId: childFieldPathId,
550
555
  itemErrorSchema,
551
556
  autofocus: autofocus && index === 0,
552
557
  onBlur,
@@ -576,8 +581,8 @@
576
581
  return /* @__PURE__ */ jsxRuntime.jsx(Template, { ...arrayProps });
577
582
  }
578
583
  function useKeyedFormData(formData = []) {
579
- const newHash = react$1.useMemo(() => utils.hashObject(formData), [formData]);
580
- const [state, setState] = react$1.useState(() => ({
584
+ const newHash = react.useMemo(() => utils.hashObject(formData), [formData]);
585
+ const [state, setState] = react.useState(() => ({
581
586
  formDataHash: newHash,
582
587
  keyedFormData: generateKeyedFormData(formData)
583
588
  }));
@@ -592,10 +597,10 @@
592
597
  formDataHash = newHash;
593
598
  setState({ formDataHash, keyedFormData });
594
599
  }
595
- const updateKeyedFormData = react$1.useCallback((newData) => {
600
+ const updateKeyedFormData = react.useCallback((newData) => {
596
601
  const plainFormData = keyedToPlainFormData(newData);
597
- const newHash2 = utils.hashObject(plainFormData);
598
- setState({ formDataHash: newHash2, keyedFormData: newData });
602
+ const updatedHash = utils.hashObject(plainFormData);
603
+ setState({ formDataHash: updatedHash, keyedFormData: newData });
599
604
  return plainFormData;
600
605
  }, []);
601
606
  return { keyedFormData, updateKeyedFormData };
@@ -604,21 +609,25 @@
604
609
  const { schema, uiSchema, errorSchema, fieldPathId, registry, formData, onChange } = props;
605
610
  const { globalFormOptions, schemaUtils, translateString } = registry;
606
611
  const { keyedFormData, updateKeyedFormData } = useKeyedFormData(formData);
612
+ const keyedFormDataRef = react.useRef(keyedFormData);
613
+ keyedFormDataRef.current = keyedFormData;
614
+ const errorSchemaRef = react.useRef(errorSchema);
615
+ errorSchemaRef.current = errorSchema;
607
616
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
608
- const handleAddItem = react$1.useCallback(
617
+ const handleAddItem = react.useCallback(
609
618
  (event, index) => {
610
619
  if (event) {
611
620
  event.preventDefault();
612
621
  }
613
622
  let newErrorSchema;
614
- if (errorSchema) {
623
+ if (errorSchemaRef.current) {
615
624
  newErrorSchema = {};
616
- for (const idx in errorSchema) {
617
- const i = parseInt(idx);
625
+ for (const idx of Object.keys(errorSchemaRef.current)) {
626
+ const i = parseInt(idx, 10);
618
627
  if (index === void 0 || i < index) {
619
- set(newErrorSchema, [i], errorSchema[idx]);
628
+ set(newErrorSchema, [i], errorSchemaRef.current[i]);
620
629
  } else if (i >= index) {
621
- set(newErrorSchema, [i + 1], errorSchema[idx]);
630
+ set(newErrorSchema, [i + 1], errorSchemaRef.current[i]);
622
631
  }
623
632
  }
624
633
  }
@@ -626,7 +635,7 @@
626
635
  key: generateRowId(),
627
636
  item: getNewFormDataRow(registry, schema)
628
637
  };
629
- const newKeyedFormData = [...keyedFormData];
638
+ const newKeyedFormData = [...keyedFormDataRef.current];
630
639
  if (index !== void 0) {
631
640
  newKeyedFormData.splice(index, 0, newKeyedFormDataRow);
632
641
  } else {
@@ -634,30 +643,30 @@
634
643
  }
635
644
  onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
636
645
  },
637
- [keyedFormData, registry, schema, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
646
+ [registry, schema, onChange, updateKeyedFormData, childFieldPathId]
638
647
  );
639
- const handleCopyItem = react$1.useCallback(
648
+ const handleCopyItem = react.useCallback(
640
649
  (event, index) => {
641
650
  if (event) {
642
651
  event.preventDefault();
643
652
  }
644
653
  let newErrorSchema;
645
- if (errorSchema) {
654
+ if (errorSchemaRef.current) {
646
655
  newErrorSchema = {};
647
- for (const idx in errorSchema) {
648
- const i = parseInt(idx);
656
+ for (const idx of Object.keys(errorSchemaRef.current)) {
657
+ const i = parseInt(idx, 10);
649
658
  if (i <= index) {
650
- set(newErrorSchema, [i], errorSchema[idx]);
659
+ set(newErrorSchema, [i], errorSchemaRef.current[i]);
651
660
  } else if (i > index) {
652
- set(newErrorSchema, [i + 1], errorSchema[idx]);
661
+ set(newErrorSchema, [i + 1], errorSchemaRef.current[i]);
653
662
  }
654
663
  }
655
664
  }
656
665
  const newKeyedFormDataRow = {
657
666
  key: generateRowId(),
658
- item: _cloneDeep(keyedFormData[index].item)
667
+ item: _cloneDeep(keyedFormDataRef.current[index].item)
659
668
  };
660
- const newKeyedFormData = [...keyedFormData];
669
+ const newKeyedFormData = [...keyedFormDataRef.current];
661
670
  if (index !== void 0) {
662
671
  newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
663
672
  } else {
@@ -665,62 +674,62 @@
665
674
  }
666
675
  onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
667
676
  },
668
- [keyedFormData, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
677
+ [onChange, updateKeyedFormData, childFieldPathId]
669
678
  );
670
- const handleRemoveItem = react$1.useCallback(
679
+ const handleRemoveItem = react.useCallback(
671
680
  (event, index) => {
672
681
  if (event) {
673
682
  event.preventDefault();
674
683
  }
675
684
  let newErrorSchema;
676
- if (errorSchema) {
685
+ if (errorSchemaRef.current) {
677
686
  newErrorSchema = {};
678
- for (const idx in errorSchema) {
679
- const i = parseInt(idx);
687
+ for (const idx of Object.keys(errorSchemaRef.current)) {
688
+ const i = parseInt(idx, 10);
680
689
  if (i < index) {
681
- set(newErrorSchema, [i], errorSchema[idx]);
690
+ set(newErrorSchema, [i], errorSchemaRef.current[i]);
682
691
  } else if (i > index) {
683
- set(newErrorSchema, [i - 1], errorSchema[idx]);
692
+ set(newErrorSchema, [i - 1], errorSchemaRef.current[i]);
684
693
  }
685
694
  }
686
695
  }
687
- const newKeyedFormData = keyedFormData.filter((_, i) => i !== index);
696
+ const newKeyedFormData = keyedFormDataRef.current.filter((_, i) => i !== index);
688
697
  onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
689
698
  },
690
- [keyedFormData, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
699
+ [onChange, updateKeyedFormData, childFieldPathId]
691
700
  );
692
- const handleReorderItems = react$1.useCallback(
701
+ const handleReorderItems = react.useCallback(
693
702
  (event, index, newIndex) => {
694
703
  if (event) {
695
704
  event.preventDefault();
696
705
  event.currentTarget.blur();
697
706
  }
698
707
  let newErrorSchema;
699
- if (errorSchema) {
708
+ if (errorSchemaRef.current) {
700
709
  newErrorSchema = {};
701
- for (const idx in errorSchema) {
702
- const i = parseInt(idx);
703
- if (i == index) {
704
- set(newErrorSchema, [newIndex], errorSchema[index]);
705
- } else if (i == newIndex) {
706
- set(newErrorSchema, [index], errorSchema[newIndex]);
710
+ for (const idx of Object.keys(errorSchemaRef.current)) {
711
+ const i = parseInt(idx, 10);
712
+ if (i === index) {
713
+ set(newErrorSchema, [newIndex], errorSchemaRef.current[index]);
714
+ } else if (i === newIndex) {
715
+ set(newErrorSchema, [index], errorSchemaRef.current[newIndex]);
707
716
  } else {
708
- set(newErrorSchema, [idx], errorSchema[i]);
717
+ set(newErrorSchema, [idx], errorSchemaRef.current[i]);
709
718
  }
710
719
  }
711
720
  }
712
721
  function reOrderArray() {
713
- const _newKeyedFormData = keyedFormData.slice();
714
- _newKeyedFormData.splice(index, 1);
715
- _newKeyedFormData.splice(newIndex, 0, keyedFormData[index]);
716
- return _newKeyedFormData;
722
+ const newKeyedFormData2 = keyedFormDataRef.current.slice();
723
+ newKeyedFormData2.splice(index, 1);
724
+ newKeyedFormData2.splice(newIndex, 0, keyedFormDataRef.current[index]);
725
+ return newKeyedFormData2;
717
726
  }
718
727
  const newKeyedFormData = reOrderArray();
719
728
  onChange(updateKeyedFormData(newKeyedFormData), childFieldPathId.path, newErrorSchema);
720
729
  },
721
- [keyedFormData, onChange, updateKeyedFormData, errorSchema, childFieldPathId]
730
+ [onChange, updateKeyedFormData, childFieldPathId]
722
731
  );
723
- const handleChange = react$1.useCallback(
732
+ const handleChange = react.useCallback(
724
733
  (value, path, newErrorSchema, id) => {
725
734
  const lastPathIsItemIndex = typeof path.at(-1) === "number";
726
735
  onChange(
@@ -735,7 +744,7 @@
735
744
  },
736
745
  [onChange]
737
746
  );
738
- const onSelectChange = react$1.useCallback(
747
+ const onSelectChange = react.useCallback(
739
748
  (value) => {
740
749
  onChange(value, childFieldPathId.path, void 0, childFieldPathId?.[utils.ID_KEY]);
741
750
  },
@@ -859,10 +868,8 @@
859
868
  enumOptions = utils.optionsList({ enum: enums }, uiSchema);
860
869
  }
861
870
  }
862
- const onWidgetChange = react$1.useCallback(
863
- (value, errorSchema, id) => {
864
- return onChange(value, fieldPathId.path, errorSchema, id);
865
- },
871
+ const onWidgetChange = react.useCallback(
872
+ (value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id),
866
873
  [onChange, fieldPathId]
867
874
  );
868
875
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -915,7 +922,7 @@
915
922
  return String(formData);
916
923
  case "number": {
917
924
  const castedNumber = Number(formData);
918
- return isNaN(castedNumber) ? 0 : castedNumber;
925
+ return Number.isNaN(castedNumber) ? 0 : castedNumber;
919
926
  }
920
927
  case "boolean":
921
928
  return Boolean(formData);
@@ -942,13 +949,13 @@
942
949
  errorSchema
943
950
  } = props;
944
951
  const { translateString, fields: fields2, globalFormOptions } = registry;
945
- const [type, setType] = react$1.useState(getTypeOfFormData(formData));
952
+ const [type, setType] = react.useState(getTypeOfFormData(formData));
946
953
  const uiOptions = utils.getUiOptions(uiSchema);
947
954
  const typeSelectorInnerFieldPathId = utils.useDeepCompareMemo(
948
955
  utils.toFieldPathId("__internal_type_selector", globalFormOptions, fieldPathId)
949
956
  );
950
957
  const schemaTitle = translateString(utils.TranslatableString.Type);
951
- const typesOptionSchema = react$1.useMemo(() => getFallbackTypeSelectionSchema(schemaTitle), [schemaTitle]);
958
+ const typesOptionSchema = react.useMemo(() => getFallbackTypeSelectionSchema(schemaTitle), [schemaTitle]);
952
959
  const onTypeChange = (newType) => {
953
960
  if (newType != null) {
954
961
  setType(newType);
@@ -1073,6 +1080,7 @@
1073
1080
  }
1074
1081
  function computeArraySchemasIfPresent(schema, fieldPathId, potentialIndex) {
1075
1082
  let rawSchema;
1083
+ let resultPathId = fieldPathId;
1076
1084
  if (isNumericIndex(potentialIndex) && schema && schema?.type === "array" && has(schema, utils.ITEMS_KEY)) {
1077
1085
  const index = Number(potentialIndex);
1078
1086
  const items = schema[utils.ITEMS_KEY];
@@ -1085,12 +1093,12 @@
1085
1093
  } else {
1086
1094
  rawSchema = items;
1087
1095
  }
1088
- fieldPathId = {
1096
+ resultPathId = {
1089
1097
  [utils.ID_KEY]: fieldPathId[utils.ID_KEY],
1090
1098
  path: [...fieldPathId.path.slice(0, fieldPathId.path.length - 1), index]
1091
1099
  };
1092
1100
  }
1093
- return { rawSchema, fieldPathId };
1101
+ return { rawSchema, fieldPathId: resultPathId };
1094
1102
  }
1095
1103
  function getSchemaDetailsForField(registry, dottedPath, initialSchema, formData, initialFieldIdPath) {
1096
1104
  const { schemaUtils, globalFormOptions } = registry;
@@ -1173,8 +1181,8 @@
1173
1181
  if (isString(prop)) {
1174
1182
  const match = LOOKUP_REGEX.exec(prop);
1175
1183
  if (Array.isArray(match) && match.length > 1) {
1176
- const name2 = match[1];
1177
- uiProps[key] = utils.lookupFromFormContext(registry, name2, name2);
1184
+ const lookupName = match[1];
1185
+ uiProps[key] = utils.lookupFromFormContext(registry, lookupName, lookupName);
1178
1186
  }
1179
1187
  }
1180
1188
  });
@@ -1191,7 +1199,7 @@
1191
1199
  const { registry, schema: rawSchema, formData } = layoutGridFieldProps;
1192
1200
  const { schemaUtils } = registry;
1193
1201
  const schema = schemaUtils.retrieveSchema(rawSchema, formData);
1194
- return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ react$1.createElement(
1202
+ return childrenLayoutGridSchemaId.map((layoutGridSchema) => /* @__PURE__ */ react.createElement(
1195
1203
  LayoutGridField,
1196
1204
  {
1197
1205
  ...layoutGridFieldProps,
@@ -1278,10 +1286,10 @@
1278
1286
  return uiComponentProps.rendered;
1279
1287
  }
1280
1288
  if (schema) {
1281
- const Field2 = optionsInfo?.hasDiscriminator ? LayoutMultiSchemaField2 : SchemaField2;
1289
+ const Field = optionsInfo?.hasDiscriminator ? LayoutMultiSchemaField2 : SchemaField2;
1282
1290
  const { fieldUiSchema, uiReadonly } = computeFieldUiSchema(name, uiProps, uiSchema, isReadonly, readonly);
1283
1291
  return /* @__PURE__ */ jsxRuntime.jsx(
1284
- Field2,
1292
+ Field,
1285
1293
  {
1286
1294
  "data-testid": optionsInfo?.hasDiscriminator ? LAYOUT_GRID_FIELD_TEST_IDS.layoutMultiSchemaField : LAYOUT_GRID_FIELD_TEST_IDS.field,
1287
1295
  ...otherProps,
@@ -1418,7 +1426,7 @@
1418
1426
  hideError = false
1419
1427
  } = props;
1420
1428
  const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
1421
- const [enumOptions, setEnumOptions] = react$1.useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1429
+ const [enumOptions, setEnumOptions] = react.useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1422
1430
  const id = get(fieldPathId, utils.ID_KEY);
1423
1431
  const discriminator = utils.getDiscriminatorFieldFromSchema(schema);
1424
1432
  const FieldErrorTemplate2 = utils.getTemplate("FieldErrorTemplate", registry, options);
@@ -1427,7 +1435,7 @@
1427
1435
  const optionsHash = utils.hashObject(options);
1428
1436
  const uiSchemaHash = uiSchema ? utils.hashObject(uiSchema) : "";
1429
1437
  const formDataHash = formData ? utils.hashObject(formData) : "";
1430
- react$1.useEffect(() => {
1438
+ react.useEffect(() => {
1431
1439
  setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1432
1440
  }, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
1433
1441
  const {
@@ -1451,6 +1459,9 @@
1451
1459
  const fieldErrorSchema = omit3(errorSchema, [utils.ERRORS_KEY]);
1452
1460
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1453
1461
  const onOptionChange = (opt) => {
1462
+ if (disabled || readonly) {
1463
+ return;
1464
+ }
1454
1465
  const newOption = getSelectedOption(enumOptions, selectorField, opt);
1455
1466
  const oldOption = getSelectedOption(enumOptions, selectorField, selectedOption);
1456
1467
  let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
@@ -1512,7 +1523,13 @@
1512
1523
  }
1513
1524
  );
1514
1525
  }
1515
- var AnyOfField = class extends react$1.Component {
1526
+ var AnyOfField = class extends react.Component {
1527
+ /** Flag to skip the formData-change-driven option recalculation when the user just selected an option.
1528
+ * Set to true in the setState callback of onOptionChange (after onChange is called), consumed and reset in
1529
+ * componentDidUpdate. This prevents the matching-option recalculation from overriding a user's explicit choice
1530
+ * when getDefaultFormState populates undefined properties that make deepEquals see a false formData change.
1531
+ */
1532
+ skipNextOptionRecalculation = false;
1516
1533
  /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
1517
1534
  *
1518
1535
  * @param props - The `FieldProps` for this template
@@ -1548,10 +1565,14 @@
1548
1565
  newState = { selectedOption, retrievedOptions };
1549
1566
  }
1550
1567
  if (!utils.deepEquals(formData, prevProps.formData) && fieldPathId.$id === prevProps.fieldPathId.$id) {
1551
- const { retrievedOptions } = newState;
1552
- const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
1553
- if (prevState && matchingOption !== selectedOption) {
1554
- newState = { selectedOption: matchingOption, retrievedOptions };
1568
+ if (this.skipNextOptionRecalculation) {
1569
+ this.skipNextOptionRecalculation = false;
1570
+ } else {
1571
+ const { retrievedOptions } = newState;
1572
+ const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
1573
+ if (prevState && matchingOption !== selectedOption) {
1574
+ newState = { selectedOption: matchingOption, retrievedOptions };
1575
+ }
1555
1576
  }
1556
1577
  }
1557
1578
  if (newState !== this.state) {
@@ -1581,7 +1602,10 @@
1581
1602
  */
1582
1603
  onOptionChange = (option) => {
1583
1604
  const { selectedOption, retrievedOptions } = this.state;
1584
- const { formData, onChange, registry, fieldPathId } = this.props;
1605
+ const { disabled = false, formData, onChange, readonly = false, registry, fieldPathId } = this.props;
1606
+ if (disabled || readonly) {
1607
+ return;
1608
+ }
1585
1609
  const { schemaUtils } = registry;
1586
1610
  const intOption = option !== void 0 ? parseInt(option, 10) : -1;
1587
1611
  if (intOption === selectedOption) {
@@ -1594,6 +1618,7 @@
1594
1618
  newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
1595
1619
  }
1596
1620
  this.setState({ selectedOption: intOption }, () => {
1621
+ this.skipNextOptionRecalculation = true;
1597
1622
  onChange(newFormData, fieldPathId.path, void 0, this.getFieldId());
1598
1623
  });
1599
1624
  };
@@ -1618,7 +1643,7 @@
1618
1643
  uiSchema
1619
1644
  } = this.props;
1620
1645
  const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
1621
- const { SchemaField: _SchemaField } = fields2;
1646
+ const { SchemaField: SchemaFieldComponent } = fields2;
1622
1647
  const MultiSchemaFieldTemplate2 = utils.getTemplate(
1623
1648
  "MultiSchemaFieldTemplate",
1624
1649
  registry,
@@ -1642,8 +1667,8 @@
1642
1667
  const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
1643
1668
  let optionSchema;
1644
1669
  if (option) {
1645
- const { required: required2 } = schema;
1646
- optionSchema = required2 ? utils.mergeSchemas({ required: required2 }, option) : option;
1670
+ const { required: schemaRequired } = schema;
1671
+ optionSchema = schemaRequired ? utils.mergeSchemas({ required: schemaRequired }, option) : option;
1647
1672
  }
1648
1673
  let optionsUiSchema = [];
1649
1674
  if (utils.ONE_OF_KEY in schema && uiSchema && utils.ONE_OF_KEY in uiSchema) {
@@ -1696,7 +1721,7 @@
1696
1721
  readonly
1697
1722
  }
1698
1723
  ) : void 0;
1699
- const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ jsxRuntime.jsx(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
1724
+ const optionsSchemaField = optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ jsxRuntime.jsx(SchemaFieldComponent, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema }) || null;
1700
1725
  return /* @__PURE__ */ jsxRuntime.jsx(
1701
1726
  MultiSchemaFieldTemplate2,
1702
1727
  {
@@ -1712,7 +1737,7 @@
1712
1737
  var MultiSchemaField_default = AnyOfField;
1713
1738
  function NullField(props) {
1714
1739
  const { formData, onChange, fieldPathId } = props;
1715
- react$1.useEffect(() => {
1740
+ react.useEffect(() => {
1716
1741
  if (formData === void 0) {
1717
1742
  onChange(null, fieldPathId.path);
1718
1743
  }
@@ -1724,16 +1749,14 @@
1724
1749
  var trailingCharMatcher = /[0.]0*$/;
1725
1750
  function NumberField(props) {
1726
1751
  const { registry, onChange, formData, value: initialValue } = props;
1727
- const [lastValue, setLastValue] = react$1.useState(initialValue);
1752
+ const [lastValue, setLastValue] = react.useState(initialValue);
1728
1753
  const { StringField: StringField2 } = registry.fields;
1729
1754
  let value = formData;
1730
- const handleChange = react$1.useCallback(
1731
- (value2, path, errorSchema, id) => {
1732
- setLastValue(value2);
1733
- if (`${value2}`.charAt(0) === ".") {
1734
- value2 = `0${value2}`;
1735
- }
1736
- const processed = typeof value2 === "string" && value2.match(trailingCharMatcherWithPrefix) ? utils.asNumber(value2.replace(trailingCharMatcher, "")) : utils.asNumber(value2);
1755
+ const handleChange = react.useCallback(
1756
+ (newValue, path, errorSchema, id) => {
1757
+ setLastValue(newValue);
1758
+ const normalizedValue = `${newValue}`.startsWith(".") ? `0${newValue}` : newValue;
1759
+ const processed = typeof normalizedValue === "string" && normalizedValue.match(trailingCharMatcherWithPrefix) ? utils.asNumber(normalizedValue.replace(trailingCharMatcher, "")) : utils.asNumber(normalizedValue);
1737
1760
  onChange(processed, path, errorSchema, id);
1738
1761
  },
1739
1762
  [onChange]
@@ -1752,7 +1775,7 @@
1752
1775
  var ADDITIONAL_PROPERTY_KEY_REMOVE = /* @__PURE__ */ Symbol("remove-this-key");
1753
1776
  var IS_RESET = /* @__PURE__ */ Symbol("reset");
1754
1777
  function isRequired(schema, name) {
1755
- return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
1778
+ return Array.isArray(schema.required) && schema.required.includes(name);
1756
1779
  }
1757
1780
  function getDefaultValue(translateString, type) {
1758
1781
  switch (type) {
@@ -1771,7 +1794,7 @@
1771
1794
  return translateString(utils.TranslatableString.NewStringDefault);
1772
1795
  }
1773
1796
  }
1774
- function ObjectFieldProperty(props) {
1797
+ function ObjectFieldPropertyFn(props) {
1775
1798
  const {
1776
1799
  fieldPathId,
1777
1800
  schema,
@@ -1791,22 +1814,23 @@
1791
1814
  handleRemoveProperty,
1792
1815
  addedByAdditionalProperties
1793
1816
  } = props;
1794
- const [wasPropertyKeyModified, setWasPropertyKeyModified] = react$1.useState(false);
1817
+ const [wasPropertyKeyModified, setWasPropertyKeyModified] = react.useState(false);
1795
1818
  const { globalFormOptions, fields: fields2 } = registry;
1796
1819
  const { SchemaField: SchemaField2 } = fields2;
1797
1820
  const innerFieldIdPathId = utils.useDeepCompareMemo(
1798
1821
  utils.toFieldPathId(propertyName, globalFormOptions, fieldPathId.path)
1799
1822
  );
1800
- const onPropertyChange = react$1.useCallback(
1823
+ const onPropertyChange = react.useCallback(
1801
1824
  (value, path, newErrorSchema, id) => {
1825
+ let normalizedValue = value;
1802
1826
  if (value === void 0 && addedByAdditionalProperties) {
1803
- value = "";
1827
+ normalizedValue = "";
1804
1828
  }
1805
- onChange(value, path, newErrorSchema, id);
1829
+ onChange(normalizedValue, path, newErrorSchema, id);
1806
1830
  },
1807
1831
  [onChange, addedByAdditionalProperties]
1808
1832
  );
1809
- const onKeyRename = react$1.useCallback(
1833
+ const onKeyRename = react.useCallback(
1810
1834
  (value) => {
1811
1835
  if (propertyName !== value) {
1812
1836
  setWasPropertyKeyModified(true);
@@ -1815,7 +1839,7 @@
1815
1839
  },
1816
1840
  [propertyName, handleKeyRename]
1817
1841
  );
1818
- const onKeyRenameBlur = react$1.useCallback(
1842
+ const onKeyRenameBlur = react.useCallback(
1819
1843
  (event) => {
1820
1844
  const {
1821
1845
  target: { value }
@@ -1824,7 +1848,7 @@
1824
1848
  },
1825
1849
  [onKeyRename]
1826
1850
  );
1827
- const onRemoveProperty = react$1.useCallback(() => {
1851
+ const onRemoveProperty = react.useCallback(() => {
1828
1852
  handleRemoveProperty(propertyName);
1829
1853
  }, [propertyName, handleRemoveProperty]);
1830
1854
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -1851,6 +1875,7 @@
1851
1875
  }
1852
1876
  );
1853
1877
  }
1878
+ var ObjectFieldProperty = react.memo(ObjectFieldPropertyFn);
1854
1879
  function ObjectField(props) {
1855
1880
  const {
1856
1881
  schema: rawSchema,
@@ -1871,35 +1896,38 @@
1871
1896
  } = props;
1872
1897
  const { fields: fields2, schemaUtils, translateString, globalUiOptions } = registry;
1873
1898
  const { OptionalDataControlsField: OptionalDataControlsField2 } = fields2;
1874
- const formDataRef = react$1.useRef(formData);
1899
+ const formDataRef = react.useRef(formData);
1875
1900
  formDataRef.current = formData;
1876
- const schema = schemaUtils.retrieveSchema(rawSchema, formData, true);
1877
- const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
1901
+ const schema = react.useMemo(
1902
+ () => schemaUtils.retrieveSchema(rawSchema, formData, true),
1903
+ [schemaUtils, rawSchema, formData]
1904
+ );
1905
+ const uiOptions = react.useMemo(() => utils.getUiOptions(uiSchema, globalUiOptions), [uiSchema, globalUiOptions]);
1878
1906
  const { properties: schemaProperties = {} } = schema;
1879
1907
  const childFieldPathId = props.childFieldPathId ?? fieldPathId;
1880
- const lastRenamedProperty = react$1.useRef({ previousKey: "", currentKey: void 0 });
1908
+ const lastRenamedProperty = react.useRef({ previousKey: "", currentKey: void 0 });
1881
1909
  const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
1882
1910
  const description = uiOptions.description ?? schema.description;
1883
1911
  const renderOptionalField = utils.shouldRenderOptionalField(registry, schema, required, uiSchema);
1884
1912
  const hasFormData = utils.isFormDataAvailable(formData);
1885
1913
  let orderedProperties = [];
1886
- const getAvailableKey = react$1.useCallback(
1887
- (preferredKey, formData2) => {
1914
+ const getAvailableKey = react.useCallback(
1915
+ (preferredKey, existingFormData) => {
1888
1916
  const { duplicateKeySuffixSeparator = "-" } = utils.getUiOptions(uiSchema, globalUiOptions);
1889
1917
  let index = 0;
1890
1918
  let newKey = preferredKey;
1891
- while (has(formData2, newKey)) {
1892
- newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
1919
+ while (has(existingFormData, newKey)) {
1920
+ index += 1;
1921
+ newKey = `${preferredKey}${duplicateKeySuffixSeparator}${index}`;
1893
1922
  }
1894
1923
  return newKey;
1895
1924
  },
1896
1925
  [uiSchema, globalUiOptions]
1897
1926
  );
1898
- const onAddProperty = react$1.useCallback(() => {
1927
+ const onAddProperty = react.useCallback(() => {
1899
1928
  if (!(schema.additionalProperties || schema.patternProperties)) {
1900
1929
  return;
1901
1930
  }
1902
- const { translateString: translateString2 } = registry;
1903
1931
  const newFormData = { ...formData };
1904
1932
  const newKey = getAvailableKey("newKey", newFormData);
1905
1933
  if (schema.patternProperties) {
@@ -1914,8 +1942,7 @@
1914
1942
  defaultValue = schema.additionalProperties.default;
1915
1943
  let apSchema = schema.additionalProperties;
1916
1944
  if (utils.REF_KEY in apSchema) {
1917
- const { schemaUtils: schemaUtils2 } = registry;
1918
- apSchema = schemaUtils2.retrieveSchema({ [utils.REF_KEY]: apSchema[utils.REF_KEY] }, formData);
1945
+ apSchema = schemaUtils.retrieveSchema({ [utils.REF_KEY]: apSchema[utils.REF_KEY] }, formData);
1919
1946
  type = apSchema.type;
1920
1947
  constValue = apSchema.const;
1921
1948
  defaultValue = apSchema.default;
@@ -1924,7 +1951,7 @@
1924
1951
  type = "object";
1925
1952
  }
1926
1953
  }
1927
- const newValue = constValue ?? defaultValue ?? getDefaultValue(translateString2, type);
1954
+ const newValue = constValue ?? defaultValue ?? getDefaultValue(translateString, type);
1928
1955
  set(newFormData, newKey, newValue);
1929
1956
  }
1930
1957
  if (lastRenamedProperty.current.previousKey === newKey) {
@@ -1932,8 +1959,8 @@
1932
1959
  lastRenamedProperty.current.previousKey = getAvailableKey(newKey, newFormData);
1933
1960
  }
1934
1961
  onChange(newFormData, childFieldPathId.path);
1935
- }, [formData, onChange, registry, childFieldPathId, getAvailableKey, schema]);
1936
- const handleKeyRename = react$1.useCallback(
1962
+ }, [formData, onChange, translateString, schemaUtils, childFieldPathId, getAvailableKey, schema]);
1963
+ const handleKeyRename = react.useCallback(
1937
1964
  (oldKey, newKey) => {
1938
1965
  if (oldKey !== newKey) {
1939
1966
  const currentFormData = formDataRef.current;
@@ -1943,8 +1970,8 @@
1943
1970
  };
1944
1971
  const newKeys = { [oldKey]: actualNewKey };
1945
1972
  const keyValues = Object.keys(newFormData).map((key) => {
1946
- const newKey2 = newKeys[key] || key;
1947
- return { [newKey2]: newFormData[key] };
1973
+ const mappedKey = Object.hasOwn(newKeys, key) ? newKeys[key] : key;
1974
+ return { [mappedKey]: newFormData[key] };
1948
1975
  });
1949
1976
  const renamedObj = Object.assign({}, ...keyValues);
1950
1977
  formDataRef.current = renamedObj;
@@ -1957,13 +1984,13 @@
1957
1984
  },
1958
1985
  [onChange, childFieldPathId, getAvailableKey]
1959
1986
  );
1960
- const handleRemoveProperty = react$1.useCallback(
1987
+ const handleRemoveProperty = react.useCallback(
1961
1988
  (key) => {
1962
1989
  onChange(ADDITIONAL_PROPERTY_KEY_REMOVE, [...childFieldPathId.path, key]);
1963
1990
  },
1964
1991
  [onChange, childFieldPathId]
1965
1992
  );
1966
- const getStableKey = react$1.useCallback((property) => {
1993
+ const getStableKey = react.useCallback((property) => {
1967
1994
  if (lastRenamedProperty.current.currentKey === property) {
1968
1995
  return lastRenamedProperty.current.previousKey;
1969
1996
  }
@@ -1975,7 +2002,7 @@
1975
2002
  orderedProperties = utils.orderProperties(properties, uiOptions.order);
1976
2003
  } catch (err) {
1977
2004
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1978
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ jsxRuntime.jsx(markdownToJsx.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(utils.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
2005
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(utils.TranslatableString.InvalidObjectField, [name || "root", err.message]) }) }),
1979
2006
  /* @__PURE__ */ jsxRuntime.jsx("pre", { children: JSON.stringify(schema) })
1980
2007
  ] });
1981
2008
  }
@@ -1986,20 +2013,20 @@
1986
2013
  // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
1987
2014
  title: uiOptions.label === false ? "" : templateTitle,
1988
2015
  description: uiOptions.label === false ? void 0 : description,
1989
- properties: orderedProperties.map((name2) => {
1990
- const addedByAdditionalProperties = has(schema, [utils.PROPERTIES_KEY, name2, utils.ADDITIONAL_PROPERTY_FLAG]);
1991
- const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name2];
2016
+ properties: orderedProperties.map((propertyName) => {
2017
+ const addedByAdditionalProperties = has(schema, [utils.PROPERTIES_KEY, propertyName, utils.ADDITIONAL_PROPERTY_FLAG]);
2018
+ const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[propertyName];
1992
2019
  const hidden = utils.getUiOptions(fieldUiSchema).widget === "hidden";
1993
2020
  const content = /* @__PURE__ */ jsxRuntime.jsx(
1994
2021
  ObjectFieldProperty,
1995
2022
  {
1996
- propertyName: name2,
1997
- required: isRequired(schema, name2),
1998
- schema: get(schema, [utils.PROPERTIES_KEY, name2], {}),
2023
+ propertyName,
2024
+ required: isRequired(schema, propertyName),
2025
+ schema: get(schema, [utils.PROPERTIES_KEY, propertyName], {}),
1999
2026
  uiSchema: fieldUiSchema,
2000
- errorSchema: get(errorSchema, [name2]),
2027
+ errorSchema: get(errorSchema, [propertyName]),
2001
2028
  fieldPathId: childFieldPathId,
2002
- formData: get(formData, [name2]),
2029
+ formData: get(formData, [propertyName]),
2003
2030
  handleKeyRename,
2004
2031
  handleRemoveProperty,
2005
2032
  addedByAdditionalProperties,
@@ -2011,11 +2038,11 @@
2011
2038
  readonly,
2012
2039
  hideError
2013
2040
  },
2014
- getStableKey(name2)
2041
+ getStableKey(propertyName)
2015
2042
  );
2016
2043
  return {
2017
2044
  content,
2018
- name: name2,
2045
+ name: propertyName,
2019
2046
  readonly,
2020
2047
  disabled,
2021
2048
  required,
@@ -2103,7 +2130,7 @@
2103
2130
  null: "NullField"
2104
2131
  };
2105
2132
  function getFieldComponent(schema, uiOptions, registry) {
2106
- const field = uiOptions.field;
2133
+ const { field } = uiOptions;
2107
2134
  const { fields: fields2 } = registry;
2108
2135
  if (typeof field === "function") {
2109
2136
  return field;
@@ -2121,7 +2148,7 @@
2121
2148
  if (!componentName && (schema.anyOf || schema.oneOf)) {
2122
2149
  return () => null;
2123
2150
  }
2124
- return componentName in fields2 ? fields2[componentName] : fields2["FallbackField"];
2151
+ return componentName in fields2 ? fields2[componentName] : fields2.FallbackField;
2125
2152
  }
2126
2153
  function SchemaFieldRender(props) {
2127
2154
  const {
@@ -2153,10 +2180,10 @@
2153
2180
  const FieldErrorTemplate2 = utils.getTemplate("FieldErrorTemplate", registry, uiOptions);
2154
2181
  const schema = schemaUtils.retrieveSchema(_schema, formData);
2155
2182
  const fieldId = fieldPathId[utils.ID_KEY];
2156
- const handleFieldComponentChange = react$1.useCallback(
2157
- (formData2, path, newErrorSchema, id2) => {
2183
+ const handleFieldComponentChange = react.useCallback(
2184
+ (newFormData, path, newErrorSchema, id2) => {
2158
2185
  const theId = id2 || fieldId;
2159
- return onChange(formData2, path, newErrorSchema, theId);
2186
+ return onChange(newFormData, path, newErrorSchema, theId);
2160
2187
  },
2161
2188
  [fieldId, onChange]
2162
2189
  );
@@ -2180,12 +2207,12 @@
2180
2207
  if (schema[utils.ANY_OF_KEY]) {
2181
2208
  XxxOfField = _AnyOfField;
2182
2209
  XxxOfOptions = schema[utils.ANY_OF_KEY].map(
2183
- (_schema2) => schemaUtils.retrieveSchema(isObject(_schema2) ? _schema2 : {}, formData)
2210
+ (xxxOfSchema) => schemaUtils.retrieveSchema(isObject(xxxOfSchema) ? xxxOfSchema : {}, formData)
2184
2211
  );
2185
2212
  } else if (schema[utils.ONE_OF_KEY]) {
2186
2213
  XxxOfField = _OneOfField;
2187
2214
  XxxOfOptions = schema[utils.ONE_OF_KEY].map(
2188
- (_schema2) => schemaUtils.retrieveSchema(isObject(_schema2) ? _schema2 : {}, formData)
2215
+ (xxxOfSchema) => schemaUtils.retrieveSchema(isObject(xxxOfSchema) ? xxxOfSchema : {}, formData)
2189
2216
  );
2190
2217
  }
2191
2218
  const isOptionalRender = utils.shouldRenderOptionalField(registry, schema, required, uiSchema);
@@ -2230,7 +2257,7 @@
2230
2257
  label = registry.translateString(utils.TranslatableString.DeprecatedLabel, [label]);
2231
2258
  }
2232
2259
  const description = uiOptions.description || props.schema.description || schema.description || "";
2233
- const help = uiOptions.help;
2260
+ const { help } = uiOptions;
2234
2261
  const hidden = uiOptions.widget === "hidden" || deprecatedHandling === "hide";
2235
2262
  const classNames = ["rjsf-field", `rjsf-field-${utils.getSchemaType(schema)}`];
2236
2263
  if (!hideError && __errors && __errors.length > 0) {
@@ -2321,7 +2348,7 @@
2321
2348
  )
2322
2349
  ] }) });
2323
2350
  }
2324
- var SchemaField = class extends react$1.Component {
2351
+ var SchemaField = class extends react.Component {
2325
2352
  shouldComponentUpdate(nextProps) {
2326
2353
  const {
2327
2354
  registry: { globalFormOptions }
@@ -2364,10 +2391,8 @@
2364
2391
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
2365
2392
  const label = uiTitle ?? title ?? schemaTitle ?? name;
2366
2393
  const Widget = utils.getWidget(schema, widget, widgets2);
2367
- const onWidgetChange = react$1.useCallback(
2368
- (value, errorSchema, id) => {
2369
- return onChange(value, fieldPathId.path, errorSchema, id);
2370
- },
2394
+ const onWidgetChange = react.useCallback(
2395
+ (value, errorSchema, id) => onChange(value, fieldPathId.path, errorSchema, id),
2371
2396
  [onChange, fieldPathId]
2372
2397
  );
2373
2398
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -2630,9 +2655,10 @@
2630
2655
  }
2631
2656
  return /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: utils.examplesId(id), children: examples.concat(
2632
2657
  schemaDefault !== void 0 && !examples.map(String).includes(String(schemaDefault)) ? [schemaDefault] : []
2633
- ).map((example) => {
2634
- return /* @__PURE__ */ jsxRuntime.jsx("option", { value: example }, String(example));
2635
- }) }, `datalist_${id}`);
2658
+ ).map((example) => (
2659
+ // oxlint-disable-next-line jsx-a11y/control-has-associated-label
2660
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: example }, String(example))
2661
+ )) }, `datalist_${id}`);
2636
2662
  }
2637
2663
  function BaseInputTemplate(props) {
2638
2664
  const {
@@ -2675,19 +2701,19 @@
2675
2701
  } else {
2676
2702
  inputValue = value == null ? "" : value;
2677
2703
  }
2678
- const _onChange = react$1.useCallback(
2679
- ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
2704
+ const handleChange = react.useCallback(
2705
+ ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
2680
2706
  [onChange, options]
2681
2707
  );
2682
- const _onBlur = react$1.useCallback(
2708
+ const handleBlur = react.useCallback(
2683
2709
  ({ target }) => onBlur(id, target && target.value),
2684
2710
  [onBlur, id]
2685
2711
  );
2686
- const _onFocus = react$1.useCallback(
2712
+ const handleFocus = react.useCallback(
2687
2713
  ({ target }) => onFocus(id, target && target.value),
2688
2714
  [onFocus, id]
2689
2715
  );
2690
- const _onClear = react$1.useCallback(
2716
+ const handleClear = react.useCallback(
2691
2717
  (e) => {
2692
2718
  e.preventDefault();
2693
2719
  e.stopPropagation();
@@ -2708,45 +2734,51 @@
2708
2734
  value: inputValue,
2709
2735
  ...inputProps,
2710
2736
  list: schema.examples ? utils.examplesId(id) : void 0,
2711
- onChange: onChangeOverride || _onChange,
2712
- onBlur: _onBlur,
2713
- onFocus: _onFocus,
2737
+ onChange: onChangeOverride || handleChange,
2738
+ onBlur: handleBlur,
2739
+ onFocus: handleFocus,
2714
2740
  "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
2715
2741
  }
2716
2742
  ),
2717
- options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick: _onClear }),
2743
+ options.allowClearTextInputs && !readonly && !disabled && inputValue && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick: handleClear }),
2718
2744
  /* @__PURE__ */ jsxRuntime.jsx(SchemaExamples, { id, schema })
2719
2745
  ] });
2720
2746
  }
2721
- function IconButton(props) {
2747
+ function IconButtonFn(props) {
2722
2748
  const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
2723
2749
  return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: `glyphicon glyphicon-${icon}` }) });
2724
2750
  }
2725
- function CopyButton(props) {
2751
+ var IconButton = react.memo(IconButtonFn);
2752
+ var IconButton_default = IconButton;
2753
+ function CopyButtonFn(props) {
2726
2754
  const {
2727
2755
  registry: { translateString }
2728
2756
  } = props;
2729
2757
  return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: "copy" });
2730
2758
  }
2731
- function MoveDownButton(props) {
2759
+ var CopyButton = react.memo(CopyButtonFn);
2760
+ function MoveDownButtonFn(props) {
2732
2761
  const {
2733
2762
  registry: { translateString }
2734
2763
  } = props;
2735
2764
  return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveDownButton), ...props, icon: "arrow-down" });
2736
2765
  }
2737
- function MoveUpButton(props) {
2766
+ var MoveDownButton = react.memo(MoveDownButtonFn);
2767
+ function MoveUpButtonFn(props) {
2738
2768
  const {
2739
2769
  registry: { translateString }
2740
2770
  } = props;
2741
2771
  return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.MoveUpButton), ...props, icon: "arrow-up" });
2742
2772
  }
2743
- function RemoveButton(props) {
2773
+ var MoveUpButton = react.memo(MoveUpButtonFn);
2774
+ function RemoveButtonFn(props) {
2744
2775
  const {
2745
2776
  registry: { translateString }
2746
2777
  } = props;
2747
2778
  return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.RemoveButton), ...props, iconType: "danger", icon: "remove" });
2748
2779
  }
2749
- function ClearButton({
2780
+ var RemoveButton = react.memo(RemoveButtonFn);
2781
+ function ClearButtonFn({
2750
2782
  id,
2751
2783
  className,
2752
2784
  onClick,
@@ -2770,6 +2802,7 @@
2770
2802
  }
2771
2803
  );
2772
2804
  }
2805
+ var ClearButton = react.memo(ClearButtonFn);
2773
2806
  function AddButton({
2774
2807
  id,
2775
2808
  className,
@@ -2783,7 +2816,7 @@
2783
2816
  {
2784
2817
  className: `col-xs-4 col-sm-2 col-lg-1 col-xs-offset-8 col-sm-offset-10 col-lg-offset-11 text-right ${className}`,
2785
2818
  children: /* @__PURE__ */ jsxRuntime.jsx(
2786
- IconButton,
2819
+ IconButton_default,
2787
2820
  {
2788
2821
  id,
2789
2822
  iconType: "info",
@@ -2824,7 +2857,7 @@
2824
2857
  const { globalUiOptions } = registry;
2825
2858
  const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
2826
2859
  if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
2827
- return /* @__PURE__ */ jsxRuntime.jsx(react.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
2860
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
2828
2861
  }
2829
2862
  return description;
2830
2863
  }
@@ -2843,9 +2876,10 @@
2843
2876
  const { translateString } = registry;
2844
2877
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "panel panel-danger errors", children: [
2845
2878
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "panel-heading", children: /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "panel-title", children: translateString(utils.TranslatableString.ErrorsLabel) }) }),
2846
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-group", children: errors.map((error, i) => {
2847
- return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-group-item text-danger", children: error.stack }, i);
2848
- }) })
2879
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-group", children: errors.map((error, i) => (
2880
+ // oxlint-disable-next-line react/no-array-index-key
2881
+ /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-group-item text-danger", children: error.stack }, i)
2882
+ )) })
2849
2883
  ] });
2850
2884
  }
2851
2885
  function FallbackFieldTemplate(props) {
@@ -2870,9 +2904,10 @@
2870
2904
  return null;
2871
2905
  }
2872
2906
  const id = utils.errorId(fieldPathId);
2873
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
2874
- return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-danger", children: error }, index);
2875
- }) }) });
2907
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => (
2908
+ // oxlint-disable-next-line react/no-array-index-key
2909
+ /* @__PURE__ */ jsxRuntime.jsx("li", { className: "text-danger", children: error }, index)
2910
+ )) }) });
2876
2911
  }
2877
2912
  var TEST_IDS2 = utils.getTestIds();
2878
2913
  function RichHelp({
@@ -2883,7 +2918,7 @@
2883
2918
  const { globalUiOptions } = registry;
2884
2919
  const uiOptions = utils.getUiOptions(uiSchema, globalUiOptions);
2885
2920
  if (uiOptions.enableMarkdownInHelp && typeof help === "string") {
2886
- return /* @__PURE__ */ jsxRuntime.jsx(react.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
2921
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS2.markdown, children: help });
2887
2922
  }
2888
2923
  return help;
2889
2924
  }
@@ -3014,7 +3049,7 @@
3014
3049
  const { id, registry, label, onAddClick, onRemoveClick } = props;
3015
3050
  if (onAddClick) {
3016
3051
  return /* @__PURE__ */ jsxRuntime.jsx(
3017
- IconButton,
3052
+ IconButton_default,
3018
3053
  {
3019
3054
  id,
3020
3055
  registry,
@@ -3024,9 +3059,10 @@
3024
3059
  title: label
3025
3060
  }
3026
3061
  );
3027
- } else if (onRemoveClick) {
3062
+ }
3063
+ if (onRemoveClick) {
3028
3064
  return /* @__PURE__ */ jsxRuntime.jsx(
3029
- IconButton,
3065
+ IconButton_default,
3030
3066
  {
3031
3067
  id,
3032
3068
  registry,
@@ -3062,7 +3098,7 @@
3062
3098
  translateParams.push(reason);
3063
3099
  }
3064
3100
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "unsupported-field", children: [
3065
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx(markdownToJsx.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
3101
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Markdown, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
3066
3102
  schema && /* @__PURE__ */ jsxRuntime.jsx("pre", { children: JSON.stringify(schema, null, 2) })
3067
3103
  ] });
3068
3104
  }
@@ -3172,23 +3208,26 @@
3172
3208
  const { translateString } = registry;
3173
3209
  const { elements, handleChange, handleClear, handleSetNow } = utils.useAltDateWidgetProps(props);
3174
3210
  return /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "list-inline", children: [
3175
- elements.map((elemProps, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-inline-item", children: /* @__PURE__ */ jsxRuntime.jsx(
3176
- utils.DateElement,
3177
- {
3178
- rootId: id,
3179
- name,
3180
- select: handleChange,
3181
- ...elemProps,
3182
- disabled,
3183
- readonly,
3184
- registry,
3185
- onBlur,
3186
- onFocus,
3187
- autofocus: autofocus && i === 0
3188
- }
3189
- ) }, i)),
3190
- (options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-inline-item", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(utils.TranslatableString.NowLabel) }) }),
3191
- (options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-inline-item", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(utils.TranslatableString.ClearLabel) }) })
3211
+ elements.map((elemProps, i) => (
3212
+ // oxlint-disable-next-line react/no-array-index-key
3213
+ /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-inline-item", children: /* @__PURE__ */ jsxRuntime.jsx(
3214
+ utils.DateElement,
3215
+ {
3216
+ rootId: id,
3217
+ name,
3218
+ select: handleChange,
3219
+ ...elemProps,
3220
+ disabled,
3221
+ readonly,
3222
+ registry,
3223
+ onBlur,
3224
+ onFocus,
3225
+ autofocus: autofocus && i === 0
3226
+ }
3227
+ ) }, i)
3228
+ )),
3229
+ (options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-inline-item", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(utils.TranslatableString.NowLabel) }) }),
3230
+ (options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsxRuntime.jsx("li", { className: "list-inline-item", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(utils.TranslatableString.ClearLabel) }) })
3192
3231
  ] });
3193
3232
  }
3194
3233
  var AltDateWidget_default = AltDateWidget;
@@ -3207,17 +3246,17 @@
3207
3246
  const { inline = false, enumOptions, enumDisabled, emptyValue } = options;
3208
3247
  const optionValueFormat = utils.getOptionValueFormat(options);
3209
3248
  const checkboxesValues = Array.isArray(value) ? value : [value];
3210
- const handleBlur = react$1.useCallback(
3249
+ const handleBlur = react.useCallback(
3211
3250
  ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
3212
3251
  [onBlur, id, enumOptions, emptyValue, optionValueFormat]
3213
3252
  );
3214
- const handleFocus = react$1.useCallback(
3253
+ const handleFocus = react.useCallback(
3215
3254
  ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
3216
3255
  [onFocus, id, enumOptions, emptyValue, optionValueFormat]
3217
3256
  );
3218
3257
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
3219
3258
  const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
3220
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
3259
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
3221
3260
  const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
3222
3261
  const handleChange = (event) => {
3223
3262
  if (event.target.checked) {
@@ -3245,7 +3284,7 @@
3245
3284
  ),
3246
3285
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
3247
3286
  ] });
3248
- return inline ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: checkbox }) }, index);
3287
+ return inline ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, String(option.value)) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: checkbox }) }, String(option.value));
3249
3288
  }) });
3250
3289
  }
3251
3290
  var CheckboxesWidget_default = CheckboxesWidget;
@@ -3272,15 +3311,15 @@
3272
3311
  options
3273
3312
  );
3274
3313
  const required = utils.schemaRequiresTrueValue(schema);
3275
- const handleChange = react$1.useCallback(
3314
+ const handleChange = react.useCallback(
3276
3315
  (event) => onChange(event.target.checked),
3277
3316
  [onChange]
3278
3317
  );
3279
- const handleBlur = react$1.useCallback(
3318
+ const handleBlur = react.useCallback(
3280
3319
  (event) => onBlur(id, event.target.checked),
3281
3320
  [onBlur, id]
3282
3321
  );
3283
- const handleFocus = react$1.useCallback(
3322
+ const handleFocus = react.useCallback(
3284
3323
  (event) => onFocus(id, event.target.checked),
3285
3324
  [onFocus, id]
3286
3325
  );
@@ -3334,14 +3373,14 @@
3334
3373
  type: "datetime-local",
3335
3374
  ...props,
3336
3375
  value: utils.utcToLocal(value),
3337
- onChange: (value2) => onChange(utils.localToUTC(value2))
3376
+ onChange: (newValue) => onChange(utils.localToUTC(newValue))
3338
3377
  }
3339
3378
  );
3340
3379
  }
3341
3380
  function DateWidget(props) {
3342
3381
  const { onChange, options, registry } = props;
3343
3382
  const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
3344
- const handleChange = react$1.useCallback((value) => onChange(value || void 0), [onChange]);
3383
+ const handleChange = react.useCallback((value) => onChange(value || void 0), [onChange]);
3345
3384
  return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
3346
3385
  }
3347
3386
  function EmailWidget(props) {
@@ -3358,12 +3397,13 @@
3358
3397
  if (!dataURL) {
3359
3398
  return null;
3360
3399
  }
3400
+ const previewLabel = translateString(utils.TranslatableString.PreviewLabel);
3361
3401
  if (["image/jpeg", "image/png"].includes(type)) {
3362
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
3402
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: dataURL, alt: previewLabel, style: { maxWidth: "100%" }, className: "file-preview" });
3363
3403
  }
3364
3404
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3365
3405
  " ",
3366
- /* @__PURE__ */ jsxRuntime.jsx("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(utils.TranslatableString.PreviewLabel) })
3406
+ /* @__PURE__ */ jsxRuntime.jsx("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: previewLabel })
3367
3407
  ] });
3368
3408
  }
3369
3409
  function FilesInfo({
@@ -3381,11 +3421,14 @@
3381
3421
  return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
3382
3422
  const { name, size, type } = fileInfo;
3383
3423
  const handleRemove = () => onRemove(key);
3384
- return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
3385
- /* @__PURE__ */ jsxRuntime.jsx(markdownToJsx.Markdown, { children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)]) }),
3386
- preview && /* @__PURE__ */ jsxRuntime.jsx(FileInfoPreview, { fileInfo, registry }),
3387
- /* @__PURE__ */ jsxRuntime.jsx(RemoveButton2, { onClick: handleRemove, registry })
3388
- ] }, key);
3424
+ return (
3425
+ // oxlint-disable-next-line react/no-array-index-key
3426
+ /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
3427
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Markdown, { children: translateString(utils.TranslatableString.FilesInfo, [name, type, String(size)]) }),
3428
+ preview && /* @__PURE__ */ jsxRuntime.jsx(FileInfoPreview, { fileInfo, registry }),
3429
+ /* @__PURE__ */ jsxRuntime.jsx(RemoveButton2, { onClick: handleRemove, registry })
3430
+ ] }, key)
3431
+ );
3389
3432
  }) });
3390
3433
  }
3391
3434
  function FileWidget(props) {
@@ -3451,17 +3494,17 @@
3451
3494
  }) {
3452
3495
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
3453
3496
  const optionValueFormat = utils.getOptionValueFormat(options);
3454
- const handleBlur = react$1.useCallback(
3497
+ const handleBlur = react.useCallback(
3455
3498
  ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
3456
3499
  [onBlur, enumOptions, emptyValue, id, optionValueFormat]
3457
3500
  );
3458
- const handleFocus = react$1.useCallback(
3501
+ const handleFocus = react.useCallback(
3459
3502
  ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue)),
3460
3503
  [onFocus, enumOptions, emptyValue, id, optionValueFormat]
3461
3504
  );
3462
3505
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
3463
3506
  const checked = utils.enumOptionsIsSelected(option.value, value);
3464
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
3507
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
3465
3508
  const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
3466
3509
  const handleChange = () => onChange(option.value);
3467
3510
  const radio = /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
@@ -3484,7 +3527,7 @@
3484
3527
  ),
3485
3528
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
3486
3529
  ] });
3487
- return inline ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: radio }) }, i);
3530
+ return inline ? /* @__PURE__ */ jsxRuntime.jsx("label", { className: `radio-inline ${disabledCls}`, children: radio }, String(option.value)) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: radio }) }, String(option.value));
3488
3531
  }) });
3489
3532
  }
3490
3533
  var RadioWidget_default = RadioWidget;
@@ -3517,7 +3560,7 @@
3517
3560
  const { stars = 5, shape = "star" } = options;
3518
3561
  const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
3519
3562
  const min = schema.minimum || 0;
3520
- const handleStarClick = react$1.useCallback(
3563
+ const handleStarClick = react.useCallback(
3521
3564
  (starValue) => {
3522
3565
  if (!disabled && !readonly) {
3523
3566
  onChange(starValue);
@@ -3525,7 +3568,7 @@
3525
3568
  },
3526
3569
  [onChange, disabled, readonly]
3527
3570
  );
3528
- const handleFocus = react$1.useCallback(
3571
+ const handleFocus = react.useCallback(
3529
3572
  (event) => {
3530
3573
  if (onFocus) {
3531
3574
  const starValue = Number(event.target.dataset.value);
@@ -3534,7 +3577,7 @@
3534
3577
  },
3535
3578
  [onFocus, id]
3536
3579
  );
3537
- const handleBlur = react$1.useCallback(
3580
+ const handleBlur = react.useCallback(
3538
3581
  (event) => {
3539
3582
  if (onBlur) {
3540
3583
  const starValue = Number(event.target.dataset.value);
@@ -3549,7 +3592,7 @@
3549
3592
  }
3550
3593
  return isFilled ? "\u2605" : "\u2606";
3551
3594
  };
3552
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
3595
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3553
3596
  "div",
3554
3597
  {
3555
3598
  className: "rating-widget",
@@ -3566,6 +3609,7 @@
3566
3609
  "span",
3567
3610
  {
3568
3611
  onClick: () => handleStarClick(starValue),
3612
+ onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && handleStarClick(starValue),
3569
3613
  onFocus: handleFocus,
3570
3614
  onBlur: handleBlur,
3571
3615
  "data-value": starValue,
@@ -3598,7 +3642,7 @@
3598
3642
  )
3599
3643
  ]
3600
3644
  }
3601
- ) });
3645
+ );
3602
3646
  }
3603
3647
  function getValue(event, multiple) {
3604
3648
  if (multiple) {
@@ -3625,21 +3669,21 @@
3625
3669
  const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
3626
3670
  const emptyValue = multiple ? [] : "";
3627
3671
  const optionValueFormat = utils.getOptionValueFormat(options);
3628
- const handleFocus = react$1.useCallback(
3672
+ const handleFocus = react.useCallback(
3629
3673
  (event) => {
3630
3674
  const newValue = getValue(event, multiple);
3631
3675
  return onFocus(id, utils.enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
3632
3676
  },
3633
3677
  [onFocus, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
3634
3678
  );
3635
- const handleBlur = react$1.useCallback(
3679
+ const handleBlur = react.useCallback(
3636
3680
  (event) => {
3637
3681
  const newValue = getValue(event, multiple);
3638
3682
  return onBlur(id, utils.enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
3639
3683
  },
3640
3684
  [onBlur, id, multiple, enumOptions, optEmptyVal, optionValueFormat]
3641
3685
  );
3642
- const handleChange = react$1.useCallback(
3686
+ const handleChange = react.useCallback(
3643
3687
  (event) => {
3644
3688
  const newValue = getValue(event, multiple);
3645
3689
  return onChange(utils.enumOptionValueDecoder(newValue, enumOptions, optionValueFormat, optEmptyVal));
@@ -3648,30 +3692,40 @@
3648
3692
  );
3649
3693
  const selectValue = utils.enumOptionSelectedValue(value, enumOptions, multiple, optionValueFormat, emptyValue);
3650
3694
  const showPlaceholderOption = !multiple && schema.default === void 0;
3651
- return /* @__PURE__ */ jsxRuntime.jsxs(
3652
- "select",
3653
- {
3654
- id,
3655
- name: htmlName || id,
3656
- multiple,
3657
- role: "combobox",
3658
- className: "form-control",
3659
- value: selectValue,
3660
- required,
3661
- disabled: disabled || readonly,
3662
- autoFocus: autofocus,
3663
- onBlur: handleBlur,
3664
- onFocus: handleFocus,
3665
- onChange: handleChange,
3666
- "aria-describedby": utils.ariaDescribedByIds(id),
3667
- children: [
3668
- showPlaceholderOption && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: placeholder }),
3669
- Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
3670
- const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
3671
- return /* @__PURE__ */ jsxRuntime.jsx("option", { value: utils.enumOptionValueEncoder(value2, i, optionValueFormat), disabled: disabled2, children: label }, i);
3672
- })
3673
- ]
3674
- }
3695
+ return (
3696
+ // oxlint-disable-next-line jsx-a11y/no-autofocus
3697
+ /* @__PURE__ */ jsxRuntime.jsxs(
3698
+ "select",
3699
+ {
3700
+ id,
3701
+ name: htmlName || id,
3702
+ multiple,
3703
+ className: "form-control",
3704
+ value: selectValue,
3705
+ required,
3706
+ disabled: disabled || readonly,
3707
+ autoFocus: autofocus,
3708
+ onBlur: handleBlur,
3709
+ onFocus: handleFocus,
3710
+ onChange: handleChange,
3711
+ "aria-describedby": utils.ariaDescribedByIds(id),
3712
+ children: [
3713
+ showPlaceholderOption && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: placeholder }),
3714
+ Array.isArray(enumOptions) && enumOptions.map(({ value: enumValue, label: enumLabel }, i) => {
3715
+ const isDisabled = enumDisabled && enumDisabled.includes(enumValue);
3716
+ return /* @__PURE__ */ jsxRuntime.jsx(
3717
+ "option",
3718
+ {
3719
+ value: utils.enumOptionValueEncoder(enumValue, i, optionValueFormat),
3720
+ disabled: isDisabled,
3721
+ children: enumLabel
3722
+ },
3723
+ String(enumValue)
3724
+ );
3725
+ })
3726
+ ]
3727
+ }
3728
+ )
3675
3729
  );
3676
3730
  }
3677
3731
  var SelectWidget_default = SelectWidget;
@@ -3689,15 +3743,15 @@
3689
3743
  onFocus,
3690
3744
  htmlName
3691
3745
  }) {
3692
- const handleChange = react$1.useCallback(
3693
- ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
3746
+ const handleChange = react.useCallback(
3747
+ ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue),
3694
3748
  [onChange, options.emptyValue]
3695
3749
  );
3696
- const handleBlur = react$1.useCallback(
3750
+ const handleBlur = react.useCallback(
3697
3751
  ({ target }) => onBlur(id, target && target.value),
3698
3752
  [onBlur, id]
3699
3753
  );
3700
- const handleFocus = react$1.useCallback(
3754
+ const handleFocus = react.useCallback(
3701
3755
  ({ target }) => onFocus(id, target && target.value),
3702
3756
  [id, onFocus]
3703
3757
  );
@@ -3707,7 +3761,7 @@
3707
3761
  id,
3708
3762
  name: htmlName || id,
3709
3763
  className: "form-control",
3710
- value: value ? value : "",
3764
+ value: value || "",
3711
3765
  placeholder,
3712
3766
  required,
3713
3767
  disabled,
@@ -3730,7 +3784,7 @@
3730
3784
  function TimeWidget(props) {
3731
3785
  const { onChange, options, registry } = props;
3732
3786
  const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
3733
- const handleChange = react$1.useCallback((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
3787
+ const handleChange = react.useCallback((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
3734
3788
  return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
3735
3789
  }
3736
3790
  function UpDownWidget(props) {
@@ -3793,7 +3847,7 @@
3793
3847
  ...status !== void 0 && { status }
3794
3848
  };
3795
3849
  }
3796
- var Form = class extends react$1.Component {
3850
+ var Form = class _Form extends react.Component {
3797
3851
  /** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
3798
3852
  * provide any possible type here
3799
3853
  */
@@ -3804,7 +3858,7 @@
3804
3858
  /** Flag to track when we're processing a user-initiated field change.
3805
3859
  * This prevents componentDidUpdate from reverting oneOf/anyOf option switches.
3806
3860
  */
3807
- _isProcessingUserChange = false;
3861
+ isProcessingUserChange = false;
3808
3862
  /** When the `extraErrors` prop changes, re-merges `schemaValidationErrors` + `extraErrors` + `customErrors` into
3809
3863
  * state before render, ensuring the updated errors are visible immediately in a single render cycle.
3810
3864
  *
@@ -3813,7 +3867,7 @@
3813
3867
  * @returns Partial state with re-merged errors if `extraErrors` changed, or `null` if no update is needed
3814
3868
  */
3815
3869
  static getDerivedStateFromProps(props, state) {
3816
- if (props.extraErrors !== state._prevExtraErrors) {
3870
+ if (props.extraErrors !== state.prevExtraErrors) {
3817
3871
  const baseErrors = {
3818
3872
  errors: state.schemaValidationErrors || [],
3819
3873
  errorSchema: state.schemaValidationErrorSchema || {}
@@ -3829,7 +3883,7 @@
3829
3883
  true
3830
3884
  ));
3831
3885
  }
3832
- return { _prevExtraErrors: props.extraErrors, errors, errorSchema };
3886
+ return { prevExtraErrors: props.extraErrors, errors, errorSchema };
3833
3887
  }
3834
3888
  return null;
3835
3889
  }
@@ -3848,12 +3902,12 @@
3848
3902
  const formData = propsFormData ?? initialFormData;
3849
3903
  this.state = {
3850
3904
  ...this.getStateFromProps(props, formData, void 0, void 0, void 0, true),
3851
- _prevExtraErrors: props.extraErrors
3905
+ prevExtraErrors: props.extraErrors
3852
3906
  };
3853
3907
  if (onChange && !utils.deepEquals(this.state.formData, formData)) {
3854
3908
  onChange(toIChangeEvent(this.state));
3855
3909
  }
3856
- this.formElement = react$1.createRef();
3910
+ this.formElement = react.createRef();
3857
3911
  }
3858
3912
  /**
3859
3913
  * `getSnapshotBeforeUpdate` is a React lifecycle method that is invoked right before the most recently rendered
@@ -3913,8 +3967,8 @@
3913
3967
  if (snapshot.shouldUpdate) {
3914
3968
  const { nextState } = snapshot;
3915
3969
  const nextStateDiffersFromProps = !utils.deepEquals(nextState.formData, this.props.formData);
3916
- const wasProcessingUserChange = this._isProcessingUserChange;
3917
- this._isProcessingUserChange = false;
3970
+ const wasProcessingUserChange = this.isProcessingUserChange;
3971
+ this.isProcessingUserChange = false;
3918
3972
  if (wasProcessingUserChange && nextStateDiffersFromProps) {
3919
3973
  return;
3920
3974
  }
@@ -3931,12 +3985,13 @@
3931
3985
  * @param props - The props passed to the `Form`
3932
3986
  * @param inputFormData - The new or current data for the `Form`
3933
3987
  * @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.
3934
- * @param isSchemaChanged - A flag indicating whether the schema has changed.
3935
- * @param formDataChangedFields - The changed fields of `formData`
3936
- * @param skipLiveValidate - Optional flag, if true, means that we are not running live validation
3988
+ * @param [isSchemaChanged=false] - A flag indicating whether the schema has changed.
3989
+ * @param [formDataChangedFields=[]] - The changed fields of `formData`
3990
+ * @param [skipLiveValidate=false] - Optional flag, if true, means that we are not running live validation
3991
+ * @param [shouldSanitize=false] - Optional flag, if true, means that we should attempt to sanitize formData
3937
3992
  * @returns - The new state for the `Form`
3938
3993
  */
3939
- getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false, formDataChangedFields = [], skipLiveValidate = false) {
3994
+ getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false, formDataChangedFields = [], skipLiveValidate = false, shouldSanitize = false) {
3940
3995
  const state = this.state || {};
3941
3996
  const schema = "schema" in props ? props.schema : this.props.schema;
3942
3997
  const validator2 = "validator" in props ? props.validator : this.props.validator;
@@ -3947,7 +4002,7 @@
3947
4002
  const mustValidate = edit && !props.noValidate && liveValidate;
3948
4003
  const experimental_defaultFormStateBehavior = "experimental_defaultFormStateBehavior" in props ? props.experimental_defaultFormStateBehavior : this.props.experimental_defaultFormStateBehavior;
3949
4004
  const experimental_customMergeAllOf = "experimental_customMergeAllOf" in props ? props.experimental_customMergeAllOf : this.props.experimental_customMergeAllOf;
3950
- let schemaUtils = state.schemaUtils;
4005
+ let { schemaUtils } = state;
3951
4006
  if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(
3952
4007
  validator2,
3953
4008
  schema,
@@ -3968,19 +4023,45 @@
3968
4023
  } else if (inputFormData === void 0 && isUncontrolled) {
3969
4024
  defaultsFormData = state.formData;
3970
4025
  }
3971
- const formData = schemaUtils.getDefaultFormState(
3972
- rootSchema,
3973
- defaultsFormData,
3974
- false,
3975
- state.initialDefaultsGenerated
3976
- );
3977
- const _retrievedSchema = this.updateRetrievedSchema(
3978
- retrievedSchema ?? schemaUtils.retrieveSchema(rootSchema, formData)
3979
- );
4026
+ let formData;
4027
+ let computedRetrievedSchema;
4028
+ let wasSanitized = false;
4029
+ const preventInfiniteSanitize = [];
4030
+ do {
4031
+ formData = schemaUtils.getDefaultFormState(
4032
+ rootSchema,
4033
+ defaultsFormData,
4034
+ false,
4035
+ state.initialDefaultsGenerated
4036
+ );
4037
+ const formHash = shouldSanitize ? utils.hashObject({ formData }) : "";
4038
+ computedRetrievedSchema = this.updateRetrievedSchema(
4039
+ retrievedSchema ?? schemaUtils.retrieveSchema(rootSchema, formData)
4040
+ );
4041
+ if (shouldSanitize && !preventInfiniteSanitize.includes(formHash) && !utils.deepEquals(computedRetrievedSchema, state.retrievedSchema)) {
4042
+ const sanitizedFormData = schemaUtils.sanitizeDataForNewSchema(
4043
+ computedRetrievedSchema,
4044
+ state.retrievedSchema,
4045
+ formData
4046
+ );
4047
+ wasSanitized = !utils.deepEquals(sanitizedFormData, formData);
4048
+ if (wasSanitized) {
4049
+ formData = sanitizedFormData;
4050
+ defaultsFormData = sanitizedFormData;
4051
+ const sanitizedFormHash = utils.hashObject({ formData: sanitizedFormData });
4052
+ wasSanitized = !preventInfiniteSanitize.includes(sanitizedFormHash);
4053
+ preventInfiniteSanitize.push(sanitizedFormHash);
4054
+ }
4055
+ preventInfiniteSanitize.push(formHash);
4056
+ } else {
4057
+ wasSanitized = false;
4058
+ }
4059
+ } while (wasSanitized);
3980
4060
  const getCurrentErrors = () => {
3981
4061
  if (props.noValidate || isSchemaChanged) {
3982
4062
  return { errors: [], errorSchema: {} };
3983
- } else if (!props.liveValidate) {
4063
+ }
4064
+ if (!props.liveValidate) {
3984
4065
  return {
3985
4066
  errors: state.schemaValidationErrors || [],
3986
4067
  errorSchema: state.schemaValidationErrorSchema || {}
@@ -3993,8 +4074,7 @@
3993
4074
  };
3994
4075
  let errors;
3995
4076
  let errorSchema;
3996
- let schemaValidationErrors = state.schemaValidationErrors;
3997
- let schemaValidationErrorSchema = state.schemaValidationErrorSchema;
4077
+ let { schemaValidationErrors, schemaValidationErrorSchema } = state;
3998
4078
  if (mustValidate && !skipLiveValidate) {
3999
4079
  const liveValidation = this.liveValidate(
4000
4080
  rootSchema,
@@ -4017,24 +4097,22 @@
4017
4097
  errors = currentErrors.errors;
4018
4098
  errorSchema = currentErrors.errorSchema;
4019
4099
  if (formDataChangedFields.length > 0 && !mustValidate) {
4020
- const newErrorSchema = formDataChangedFields.reduce(
4021
- (acc, key) => {
4022
- acc[key] = void 0;
4023
- return acc;
4024
- },
4025
- {}
4026
- );
4027
- errorSchema = schemaValidationErrorSchema = utils.mergeObjects(
4100
+ const newErrorSchema = formDataChangedFields.reduce((acc, key) => {
4101
+ acc[key] = void 0;
4102
+ return acc;
4103
+ }, {});
4104
+ schemaValidationErrorSchema = utils.mergeObjects(
4028
4105
  currentErrors.errorSchema,
4029
4106
  newErrorSchema,
4030
4107
  "preventDuplicates"
4031
4108
  );
4109
+ errorSchema = schemaValidationErrorSchema;
4032
4110
  }
4033
- const mergedErrors = this.mergeErrors({ errorSchema, errors }, props.extraErrors, state.customErrors);
4111
+ const mergedErrors = _Form.mergeErrors({ errorSchema, errors }, props.extraErrors, state.customErrors);
4034
4112
  errors = mergedErrors.errors;
4035
4113
  errorSchema = mergedErrors.errorSchema;
4036
4114
  }
4037
- const newRegistry = this.getRegistry(props, rootSchema, schemaUtils);
4115
+ const newRegistry = _Form.getRegistry(props, rootSchema, schemaUtils);
4038
4116
  const registry = utils.deepEquals(state.registry, newRegistry) ? state.registry : newRegistry;
4039
4117
  const fieldPathId = state.fieldPathId && state.fieldPathId?.[utils.ID_KEY] === registry.globalFormOptions.idPrefix ? state.fieldPathId : utils.toFieldPathId("", registry.globalFormOptions);
4040
4118
  const nextState = {
@@ -4048,7 +4126,7 @@
4048
4126
  errorSchema,
4049
4127
  schemaValidationErrors,
4050
4128
  schemaValidationErrorSchema,
4051
- retrievedSchema: _retrievedSchema,
4129
+ retrievedSchema: computedRetrievedSchema,
4052
4130
  initialDefaultsGenerated: true,
4053
4131
  registry
4054
4132
  };
@@ -4073,10 +4151,10 @@
4073
4151
  * @param [retrievedSchema] - An optionally retrieved schema for per
4074
4152
  */
4075
4153
  validate(formData, schema = this.state.schema, altSchemaUtils, retrievedSchema) {
4076
- const schemaUtils = altSchemaUtils ? altSchemaUtils : this.state.schemaUtils;
4154
+ const schemaUtils = altSchemaUtils || this.state.schemaUtils;
4077
4155
  const { customValidate, transformErrors, uiSchema } = this.props;
4078
- const resolvedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);
4079
- return schemaUtils.getValidator().validateFormData(formData, resolvedSchema, customValidate, transformErrors, uiSchema);
4156
+ const validationSchema = retrievedSchema ?? schema;
4157
+ return schemaUtils.getValidator().validateFormData(formData, validationSchema, customValidate, transformErrors, uiSchema);
4080
4158
  }
4081
4159
  /** Renders any errors contained in the `state` in using the `ErrorList`, if not disabled by `showErrorList`. */
4082
4160
  renderErrors(registry) {
@@ -4105,9 +4183,8 @@
4105
4183
  * @return - The `extraErrors` and `customErrors` merged into the `schemaValidation`
4106
4184
  * @private
4107
4185
  */
4108
- mergeErrors(schemaValidation, extraErrors, customErrors) {
4109
- let errorSchema = schemaValidation.errorSchema;
4110
- let errors = schemaValidation.errors;
4186
+ static mergeErrors(schemaValidation, extraErrors, customErrors) {
4187
+ let { errorSchema, errors } = schemaValidation;
4111
4188
  if (extraErrors) {
4112
4189
  const merged = utils.validationDataMerge(schemaValidation, extraErrors);
4113
4190
  errorSchema = merged.errorSchema;
@@ -4136,8 +4213,8 @@
4136
4213
  */
4137
4214
  liveValidate(rootSchema, schemaUtils, originalErrorSchema, formData, extraErrors, customErrors, retrievedSchema, mergeIntoOriginalErrorSchema = false) {
4138
4215
  const schemaValidation = this.validate(formData, rootSchema, schemaUtils, retrievedSchema);
4139
- const errors = schemaValidation.errors;
4140
- let errorSchema = schemaValidation.errorSchema;
4216
+ const { errors } = schemaValidation;
4217
+ let { errorSchema } = schemaValidation;
4141
4218
  if (mergeIntoOriginalErrorSchema) {
4142
4219
  errorSchema = utils.mergeObjects(
4143
4220
  originalErrorSchema,
@@ -4147,7 +4224,7 @@
4147
4224
  }
4148
4225
  const schemaValidationErrors = errors;
4149
4226
  const schemaValidationErrorSchema = errorSchema;
4150
- const mergedErrors = this.mergeErrors({ errorSchema, errors }, extraErrors, customErrors);
4227
+ const mergedErrors = _Form.mergeErrors({ errorSchema, errors }, extraErrors, customErrors);
4151
4228
  return { ...mergedErrors, schemaValidationErrors, schemaValidationErrorSchema };
4152
4229
  }
4153
4230
  /** Returns the `formData` with only the elements specified in the `fields` list
@@ -4156,18 +4233,16 @@
4156
4233
  * @param fields - The fields to keep while filtering
4157
4234
  * @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
4158
4235
  */
4159
- getUsedFormData = (formData, fields2) => {
4160
- return utils.getUsedFormData(formData, fields2);
4161
- };
4236
+ // oxlint-disable-next-line class-methods-use-this, typescript/no-deprecated
4237
+ getUsedFormData = (formData, fields2) => utils.getUsedFormData(formData, fields2);
4162
4238
  /** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`
4163
4239
  *
4164
4240
  * @param pathSchema - The `PathSchema` object for the form
4165
4241
  * @param [formData] - The form data to use while checking for empty objects/arrays
4166
4242
  * @deprecated - To be removed as an exported `Form` function in a future release; there isn't a planned replacement
4167
4243
  */
4168
- getFieldNames = (pathSchema, formData) => {
4169
- return utils.getFieldNames(pathSchema, formData);
4170
- };
4244
+ // oxlint-disable-next-line class-methods-use-this, typescript/no-deprecated
4245
+ getFieldNames = (pathSchema, formData) => utils.getFieldNames(pathSchema, formData);
4171
4246
  /** Returns the `formData` after filtering to remove any extra data not in a form field
4172
4247
  *
4173
4248
  * @param formData - The data for the `Form`
@@ -4219,16 +4294,15 @@
4219
4294
  if (this.pendingChanges.length === 0) {
4220
4295
  return;
4221
4296
  }
4222
- this._isProcessingUserChange = true;
4297
+ this.isProcessingUserChange = true;
4223
4298
  const { newValue, path, id } = this.pendingChanges[0];
4224
4299
  const { newErrorSchema } = this.pendingChanges[0];
4225
- const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
4300
+ const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange, disabled, readonly } = this.props;
4226
4301
  const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
4227
- let { customErrors } = this.state;
4302
+ let { customErrors, retrievedSchema } = this.state;
4228
4303
  let mergeBaseErrorSchema = schemaValidationErrorSchema;
4229
4304
  const rootPathId = fieldPathId.path[0] || "";
4230
4305
  const isRootPath = !path || path.length === 0 || path.length === 1 && path[0] === rootPathId;
4231
- let retrievedSchema = this.state.retrievedSchema;
4232
4306
  let formData = isRootPath ? newValue : _cloneDeep(oldFormData);
4233
4307
  const hasOnlyUndefinedValues = utils.isObject(formData) && Object.keys(formData).length > 0 && Object.values(formData).every((v) => v === void 0);
4234
4308
  const wasPreviouslyNull = oldFormData === null || oldFormData === void 0;
@@ -4258,18 +4332,25 @@
4258
4332
  set(formData, path, valueForPath);
4259
4333
  }
4260
4334
  }
4261
- const newState = this.getStateFromProps(this.props, inputForDefaults, void 0, void 0, void 0, true);
4335
+ const shouldSanitize = retrievedSchema && !isRootPath && !utils.isObject(newValue) && !Array.isArray(newValue) && !disabled && !readonly;
4336
+ const newState = this.getStateFromProps(
4337
+ this.props,
4338
+ inputForDefaults,
4339
+ void 0,
4340
+ void 0,
4341
+ void 0,
4342
+ true,
4343
+ shouldSanitize
4344
+ );
4262
4345
  formData = newState.formData;
4263
4346
  retrievedSchema = newState.retrievedSchema;
4264
4347
  }
4265
4348
  const mustValidate = !noValidate && (liveValidate === true || liveValidate === "onChange");
4266
- let state = { formData, schema };
4349
+ let state = { formData, retrievedSchema };
4267
4350
  let newFormData = formData;
4268
4351
  if (omitExtraData === true && (liveOmit === true || liveOmit === "onChange")) {
4269
4352
  newFormData = this.omitExtraData(formData);
4270
- state = {
4271
- formData: newFormData
4272
- };
4353
+ state = { ...state, formData: newFormData };
4273
4354
  }
4274
4355
  if (newErrorSchema) {
4275
4356
  const oldValidationError = !isRootPath ? get(schemaValidationErrorSchema, path) : schemaValidationErrorSchema;
@@ -4285,9 +4366,9 @@
4285
4366
  customErrors = new utils.ErrorSchemaBuilder();
4286
4367
  }
4287
4368
  if (isRootPath) {
4288
- const errors2 = get(newErrorSchema, utils.ERRORS_KEY);
4289
- if (errors2) {
4290
- customErrors.setErrors(errors2);
4369
+ const pathErrors = get(newErrorSchema, utils.ERRORS_KEY);
4370
+ if (pathErrors) {
4371
+ customErrors.setErrors(pathErrors);
4291
4372
  }
4292
4373
  } else {
4293
4374
  set(customErrors.ErrorSchema, path, newErrorSchema);
@@ -4306,14 +4387,14 @@
4306
4387
  customErrors,
4307
4388
  retrievedSchema
4308
4389
  );
4309
- state = { formData: newFormData, ...liveValidation, customErrors };
4390
+ state = { ...state, formData: newFormData, ...liveValidation, customErrors };
4310
4391
  } else if (!noValidate && newErrorSchema) {
4311
- const mergedErrors = this.mergeErrors({ errorSchema: mergeBaseErrorSchema, errors }, extraErrors, customErrors);
4312
- state = {
4313
- formData: newFormData,
4314
- ...mergedErrors,
4392
+ const mergedErrors = _Form.mergeErrors(
4393
+ { errorSchema: mergeBaseErrorSchema, errors },
4394
+ extraErrors,
4315
4395
  customErrors
4316
- };
4396
+ );
4397
+ state = { ...state, formData: newFormData, ...mergedErrors, customErrors };
4317
4398
  }
4318
4399
  this.setState(state, () => {
4319
4400
  if (onChange) {
@@ -4466,7 +4547,7 @@
4466
4547
  * @returns - The `GlobalFormOptions` from the props
4467
4548
  * @private
4468
4549
  */
4469
- getGlobalFormOptions(props) {
4550
+ static getGlobalFormOptions(props) {
4470
4551
  const {
4471
4552
  uiSchema = {},
4472
4553
  experimental_componentUpdateStrategy,
@@ -4485,7 +4566,7 @@
4485
4566
  };
4486
4567
  }
4487
4568
  /** Computed the registry for the form using the given `props`, `schema` and `schemaUtils` */
4488
- getRegistry(props, schema, schemaUtils) {
4569
+ static getRegistry(props, schema, schemaUtils) {
4489
4570
  const { translateString: customTranslateString, uiSchema = {} } = props;
4490
4571
  const { fields: fields2, templates: templates2, widgets: widgets2, formContext, translateString } = getDefaultRegistry();
4491
4572
  return {
@@ -4504,7 +4585,7 @@
4504
4585
  schemaUtils,
4505
4586
  translateString: customTranslateString || translateString,
4506
4587
  globalUiOptions: uiSchema[utils.UI_GLOBAL_OPTIONS_KEY],
4507
- globalFormOptions: this.getGlobalFormOptions(props),
4588
+ globalFormOptions: _Form.getGlobalFormOptions(props),
4508
4589
  uiSchemaDefinitions: uiSchema[utils.UI_DEFINITIONS_KEY] ?? {}
4509
4590
  };
4510
4591
  }
@@ -4556,7 +4637,7 @@
4556
4637
  const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props;
4557
4638
  const { errors: prevErrors } = this.state;
4558
4639
  const schemaValidation = this.validate(formData);
4559
- const { errors, errorSchema } = extraErrors ? this.mergeErrors(schemaValidation, extraErrors) : schemaValidation;
4640
+ const { errors, errorSchema } = extraErrors ? _Form.mergeErrors(schemaValidation, extraErrors) : schemaValidation;
4560
4641
  const hasError = schemaValidation.errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
4561
4642
  if (hasError) {
4562
4643
  if (focusOnFirstError) {
@@ -4635,7 +4716,7 @@
4635
4716
  _internalFormWrapper
4636
4717
  } = this.props;
4637
4718
  const { schema, uiSchema, formData, errorSchema, fieldPathId, registry } = this.state;
4638
- const { SchemaField: _SchemaField } = registry.fields;
4719
+ const { SchemaField: SchemaFieldComponent } = registry.fields;
4639
4720
  const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
4640
4721
  const as = _internalFormWrapper ? tagName : void 0;
4641
4722
  const FormTag = _internalFormWrapper || tagName || "form";
@@ -4647,7 +4728,7 @@
4647
4728
  return /* @__PURE__ */ jsxRuntime.jsxs(
4648
4729
  FormTag,
4649
4730
  {
4650
- className: className ? className : "rjsf",
4731
+ className: className || "rjsf",
4651
4732
  id,
4652
4733
  name,
4653
4734
  method,
@@ -4663,7 +4744,7 @@
4663
4744
  children: [
4664
4745
  showErrorList === "top" && this.renderErrors(registry),
4665
4746
  /* @__PURE__ */ jsxRuntime.jsx(
4666
- _SchemaField,
4747
+ SchemaFieldComponent,
4667
4748
  {
4668
4749
  name: "",
4669
4750
  schema,
@@ -4679,7 +4760,7 @@
4679
4760
  readonly
4680
4761
  }
4681
4762
  ),
4682
- children ? children : /* @__PURE__ */ jsxRuntime.jsx(SubmitButton2, { uiSchema: submitUiSchema, registry }),
4763
+ children || /* @__PURE__ */ jsxRuntime.jsx(SubmitButton2, { uiSchema: submitUiSchema, registry }),
4683
4764
  showErrorList === "bottom" && this.renderErrors(registry)
4684
4765
  ]
4685
4766
  }
@@ -4705,16 +4786,16 @@
4705
4786
  };
4706
4787
  }
4707
4788
  function withTheme(themeProps) {
4708
- return react$1.forwardRef(
4709
- ({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
4710
- fields2 = { ...themeProps?.fields, ...fields2 };
4711
- widgets2 = { ...themeProps?.widgets, ...widgets2 };
4712
- templates2 = {
4789
+ return react.forwardRef(
4790
+ ({ fields: propFields, widgets: propWidgets, templates: propTemplates, ...directProps }, ref) => {
4791
+ const fields2 = { ...themeProps?.fields, ...propFields };
4792
+ const widgets2 = { ...themeProps?.widgets, ...propWidgets };
4793
+ const templates2 = {
4713
4794
  ...themeProps?.templates,
4714
- ...templates2,
4795
+ ...propTemplates,
4715
4796
  ButtonTemplates: {
4716
4797
  ...themeProps?.templates?.ButtonTemplates,
4717
- ...templates2?.ButtonTemplates
4798
+ ...propTemplates?.ButtonTemplates
4718
4799
  }
4719
4800
  };
4720
4801
  return /* @__PURE__ */ jsxRuntime.jsx(