@rjsf/core 6.0.0-alpha.0 → 6.0.0-beta.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 (301) hide show
  1. package/dist/core.umd.js +1680 -809
  2. package/dist/index.esm.js +2166 -1198
  3. package/dist/index.esm.js.map +4 -4
  4. package/dist/index.js +2221 -1299
  5. package/dist/index.js.map +4 -4
  6. package/lib/components/Form.d.ts +22 -9
  7. package/lib/components/Form.d.ts.map +1 -0
  8. package/lib/components/Form.js +368 -312
  9. package/lib/components/RichDescription.d.ts +20 -0
  10. package/lib/components/RichDescription.d.ts.map +1 -0
  11. package/lib/components/RichDescription.js +17 -0
  12. package/lib/components/fields/ArrayField.d.ts +20 -9
  13. package/lib/components/fields/ArrayField.d.ts.map +1 -0
  14. package/lib/components/fields/ArrayField.js +212 -206
  15. package/lib/components/fields/BooleanField.d.ts +1 -0
  16. package/lib/components/fields/BooleanField.d.ts.map +1 -0
  17. package/lib/components/fields/BooleanField.js +6 -14
  18. package/lib/components/fields/LayoutGridField.d.ts +480 -0
  19. package/lib/components/fields/LayoutGridField.d.ts.map +1 -0
  20. package/lib/components/fields/LayoutGridField.js +711 -0
  21. package/lib/components/fields/LayoutHeaderField.d.ts +12 -0
  22. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -0
  23. package/lib/components/fields/LayoutHeaderField.js +23 -0
  24. package/lib/components/fields/LayoutMultiSchemaField.d.ts +28 -0
  25. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -0
  26. package/lib/components/fields/LayoutMultiSchemaField.js +114 -0
  27. package/lib/components/fields/MultiSchemaField.d.ts +1 -0
  28. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -0
  29. package/lib/components/fields/MultiSchemaField.js +31 -31
  30. package/lib/components/fields/NullField.d.ts +1 -0
  31. package/lib/components/fields/NullField.d.ts.map +1 -0
  32. package/lib/components/fields/NullField.js +0 -1
  33. package/lib/components/fields/NumberField.d.ts +1 -0
  34. package/lib/components/fields/NumberField.d.ts.map +1 -0
  35. package/lib/components/fields/NumberField.js +2 -3
  36. package/lib/components/fields/ObjectField.d.ts +1 -0
  37. package/lib/components/fields/ObjectField.d.ts.map +1 -0
  38. package/lib/components/fields/ObjectField.js +146 -141
  39. package/lib/components/fields/SchemaField.d.ts +1 -0
  40. package/lib/components/fields/SchemaField.d.ts.map +1 -0
  41. package/lib/components/fields/SchemaField.js +10 -20
  42. package/lib/components/fields/StringField.d.ts +1 -0
  43. package/lib/components/fields/StringField.d.ts.map +1 -0
  44. package/lib/components/fields/StringField.js +1 -3
  45. package/lib/components/fields/index.d.ts +1 -0
  46. package/lib/components/fields/index.d.ts.map +1 -0
  47. package/lib/components/fields/index.js +14 -9
  48. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -0
  49. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -0
  50. package/lib/components/templates/ArrayFieldDescriptionTemplate.js +0 -1
  51. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +8 -0
  52. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -0
  53. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +17 -0
  54. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +4 -3
  55. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -0
  56. package/lib/components/templates/ArrayFieldItemTemplate.js +7 -6
  57. package/lib/components/templates/ArrayFieldTemplate.d.ts +2 -1
  58. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -0
  59. package/lib/components/templates/ArrayFieldTemplate.js +3 -4
  60. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -0
  61. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -0
  62. package/lib/components/templates/ArrayFieldTitleTemplate.js +0 -1
  63. package/lib/components/templates/BaseInputTemplate.d.ts +1 -0
  64. package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -0
  65. package/lib/components/templates/BaseInputTemplate.js +0 -1
  66. package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -0
  67. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -0
  68. package/lib/components/templates/ButtonTemplates/AddButton.js +1 -2
  69. package/lib/components/templates/ButtonTemplates/IconButton.d.ts +1 -0
  70. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -0
  71. package/lib/components/templates/ButtonTemplates/IconButton.js +4 -5
  72. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -0
  73. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -0
  74. package/lib/components/templates/ButtonTemplates/SubmitButton.js +0 -1
  75. package/lib/components/templates/ButtonTemplates/index.d.ts +1 -0
  76. package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -0
  77. package/lib/components/templates/ButtonTemplates/index.js +3 -4
  78. package/lib/components/templates/DescriptionField.d.ts +1 -0
  79. package/lib/components/templates/DescriptionField.d.ts.map +1 -0
  80. package/lib/components/templates/DescriptionField.js +3 -8
  81. package/lib/components/templates/ErrorList.d.ts +1 -0
  82. package/lib/components/templates/ErrorList.d.ts.map +1 -0
  83. package/lib/components/templates/ErrorList.js +0 -1
  84. package/lib/components/templates/FieldErrorTemplate.d.ts +1 -0
  85. package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -0
  86. package/lib/components/templates/FieldErrorTemplate.js +0 -1
  87. package/lib/components/templates/FieldHelpTemplate.d.ts +1 -0
  88. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -0
  89. package/lib/components/templates/FieldHelpTemplate.js +0 -1
  90. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -0
  91. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -0
  92. package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -2
  93. package/lib/components/templates/FieldTemplate/Label.d.ts +1 -0
  94. package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -0
  95. package/lib/components/templates/FieldTemplate/Label.js +0 -1
  96. package/lib/components/templates/FieldTemplate/index.d.ts +2 -1
  97. package/lib/components/templates/FieldTemplate/index.d.ts.map +1 -0
  98. package/lib/components/templates/FieldTemplate/index.js +1 -2
  99. package/lib/components/templates/GridTemplate.d.ts +8 -0
  100. package/lib/components/templates/GridTemplate.d.ts.map +1 -0
  101. package/lib/components/templates/GridTemplate.js +10 -0
  102. package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -0
  103. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -0
  104. package/lib/components/templates/ObjectFieldTemplate.js +2 -3
  105. package/lib/components/templates/TitleField.d.ts +1 -0
  106. package/lib/components/templates/TitleField.d.ts.map +1 -0
  107. package/lib/components/templates/TitleField.js +0 -1
  108. package/lib/components/templates/UnsupportedField.d.ts +1 -0
  109. package/lib/components/templates/UnsupportedField.d.ts.map +1 -0
  110. package/lib/components/templates/UnsupportedField.js +0 -1
  111. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -0
  112. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -0
  113. package/lib/components/templates/WrapIfAdditionalTemplate.js +10 -6
  114. package/lib/components/templates/index.d.ts +1 -0
  115. package/lib/components/templates/index.d.ts.map +1 -0
  116. package/lib/components/templates/index.js +19 -16
  117. package/lib/components/widgets/AltDateTimeWidget.d.ts +1 -0
  118. package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -0
  119. package/lib/components/widgets/AltDateTimeWidget.js +0 -1
  120. package/lib/components/widgets/AltDateWidget.d.ts +1 -0
  121. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -0
  122. package/lib/components/widgets/AltDateWidget.js +0 -1
  123. package/lib/components/widgets/CheckboxWidget.d.ts +1 -0
  124. package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -0
  125. package/lib/components/widgets/CheckboxWidget.js +2 -4
  126. package/lib/components/widgets/CheckboxesWidget.d.ts +1 -0
  127. package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -0
  128. package/lib/components/widgets/CheckboxesWidget.js +0 -1
  129. package/lib/components/widgets/ColorWidget.d.ts +1 -0
  130. package/lib/components/widgets/ColorWidget.d.ts.map +1 -0
  131. package/lib/components/widgets/ColorWidget.js +0 -1
  132. package/lib/components/widgets/DateTimeWidget.d.ts +1 -0
  133. package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -0
  134. package/lib/components/widgets/DateTimeWidget.js +0 -1
  135. package/lib/components/widgets/DateWidget.d.ts +1 -0
  136. package/lib/components/widgets/DateWidget.d.ts.map +1 -0
  137. package/lib/components/widgets/DateWidget.js +0 -1
  138. package/lib/components/widgets/EmailWidget.d.ts +1 -0
  139. package/lib/components/widgets/EmailWidget.d.ts.map +1 -0
  140. package/lib/components/widgets/EmailWidget.js +0 -1
  141. package/lib/components/widgets/FileWidget.d.ts +1 -0
  142. package/lib/components/widgets/FileWidget.d.ts.map +1 -0
  143. package/lib/components/widgets/FileWidget.js +3 -5
  144. package/lib/components/widgets/HiddenWidget.d.ts +1 -0
  145. package/lib/components/widgets/HiddenWidget.d.ts.map +1 -0
  146. package/lib/components/widgets/HiddenWidget.js +0 -1
  147. package/lib/components/widgets/PasswordWidget.d.ts +1 -0
  148. package/lib/components/widgets/PasswordWidget.d.ts.map +1 -0
  149. package/lib/components/widgets/PasswordWidget.js +0 -1
  150. package/lib/components/widgets/RadioWidget.d.ts +1 -0
  151. package/lib/components/widgets/RadioWidget.d.ts.map +1 -0
  152. package/lib/components/widgets/RadioWidget.js +3 -4
  153. package/lib/components/widgets/RangeWidget.d.ts +1 -0
  154. package/lib/components/widgets/RangeWidget.d.ts.map +1 -0
  155. package/lib/components/widgets/RangeWidget.js +0 -1
  156. package/lib/components/widgets/RatingWidget.d.ts +15 -0
  157. package/lib/components/widgets/RatingWidget.d.ts.map +1 -0
  158. package/lib/components/widgets/RatingWidget.js +63 -0
  159. package/lib/components/widgets/SelectWidget.d.ts +1 -0
  160. package/lib/components/widgets/SelectWidget.d.ts.map +1 -0
  161. package/lib/components/widgets/SelectWidget.js +4 -5
  162. package/lib/components/widgets/TextWidget.d.ts +1 -0
  163. package/lib/components/widgets/TextWidget.d.ts.map +1 -0
  164. package/lib/components/widgets/TextWidget.js +0 -1
  165. package/lib/components/widgets/TextareaWidget.d.ts +1 -0
  166. package/lib/components/widgets/TextareaWidget.d.ts.map +1 -0
  167. package/lib/components/widgets/TextareaWidget.js +0 -1
  168. package/lib/components/widgets/TimeWidget.d.ts +1 -0
  169. package/lib/components/widgets/TimeWidget.d.ts.map +1 -0
  170. package/lib/components/widgets/TimeWidget.js +0 -1
  171. package/lib/components/widgets/URLWidget.d.ts +1 -0
  172. package/lib/components/widgets/URLWidget.d.ts.map +1 -0
  173. package/lib/components/widgets/URLWidget.js +0 -1
  174. package/lib/components/widgets/UpDownWidget.d.ts +1 -0
  175. package/lib/components/widgets/UpDownWidget.d.ts.map +1 -0
  176. package/lib/components/widgets/UpDownWidget.js +0 -1
  177. package/lib/components/widgets/index.d.ts +1 -0
  178. package/lib/components/widgets/index.d.ts.map +1 -0
  179. package/lib/components/widgets/index.js +21 -20
  180. package/lib/getDefaultRegistry.d.ts +1 -0
  181. package/lib/getDefaultRegistry.d.ts.map +1 -0
  182. package/lib/getDefaultRegistry.js +3 -4
  183. package/lib/index.d.ts +7 -5
  184. package/lib/index.d.ts.map +1 -0
  185. package/lib/index.js +5 -5
  186. package/lib/tsconfig.tsbuildinfo +1 -1
  187. package/lib/withTheme.d.ts +2 -1
  188. package/lib/withTheme.d.ts.map +1 -0
  189. package/lib/withTheme.js +7 -8
  190. package/package.json +46 -37
  191. package/src/components/Form.tsx +127 -41
  192. package/src/components/RichDescription.tsx +50 -0
  193. package/src/components/fields/ArrayField.tsx +34 -24
  194. package/src/components/fields/BooleanField.tsx +6 -14
  195. package/src/components/fields/LayoutGridField.tsx +967 -0
  196. package/src/components/fields/LayoutHeaderField.tsx +49 -0
  197. package/src/components/fields/LayoutMultiSchemaField.tsx +228 -0
  198. package/src/components/fields/MultiSchemaField.tsx +9 -4
  199. package/src/components/fields/NullField.tsx +1 -1
  200. package/src/components/fields/NumberField.tsx +5 -5
  201. package/src/components/fields/ObjectField.tsx +32 -24
  202. package/src/components/fields/SchemaField.tsx +17 -30
  203. package/src/components/fields/StringField.tsx +2 -2
  204. package/src/components/fields/index.ts +7 -1
  205. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -2
  206. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +85 -0
  207. package/src/components/templates/ArrayFieldItemTemplate.tsx +18 -57
  208. package/src/components/templates/ArrayFieldTemplate.tsx +10 -8
  209. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -2
  210. package/src/components/templates/BaseInputTemplate.tsx +4 -4
  211. package/src/components/templates/ButtonTemplates/IconButton.tsx +9 -36
  212. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +1 -1
  213. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  214. package/src/components/templates/DescriptionField.tsx +9 -15
  215. package/src/components/templates/FieldErrorTemplate.tsx +1 -1
  216. package/src/components/templates/FieldHelpTemplate.tsx +1 -1
  217. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -2
  218. package/src/components/templates/GridTemplate.tsx +15 -0
  219. package/src/components/templates/ObjectFieldTemplate.tsx +5 -3
  220. package/src/components/templates/TitleField.tsx +1 -1
  221. package/src/components/templates/UnsupportedField.tsx +1 -1
  222. package/src/components/templates/WrapIfAdditionalTemplate.tsx +14 -4
  223. package/src/components/templates/index.ts +4 -0
  224. package/src/components/widgets/AltDateWidget.tsx +9 -6
  225. package/src/components/widgets/CheckboxWidget.tsx +5 -5
  226. package/src/components/widgets/CheckboxesWidget.tsx +2 -2
  227. package/src/components/widgets/ColorWidget.tsx +1 -1
  228. package/src/components/widgets/DateTimeWidget.tsx +1 -1
  229. package/src/components/widgets/DateWidget.tsx +1 -1
  230. package/src/components/widgets/EmailWidget.tsx +1 -1
  231. package/src/components/widgets/FileWidget.tsx +5 -5
  232. package/src/components/widgets/PasswordWidget.tsx +1 -1
  233. package/src/components/widgets/RadioWidget.tsx +3 -3
  234. package/src/components/widgets/RangeWidget.tsx +1 -1
  235. package/src/components/widgets/RatingWidget.tsx +129 -0
  236. package/src/components/widgets/SelectWidget.tsx +4 -3
  237. package/src/components/widgets/TextWidget.tsx +1 -1
  238. package/src/components/widgets/TextareaWidget.tsx +3 -3
  239. package/src/components/widgets/TimeWidget.tsx +1 -1
  240. package/src/components/widgets/URLWidget.tsx +1 -1
  241. package/src/components/widgets/UpDownWidget.tsx +1 -1
  242. package/src/components/widgets/index.ts +3 -1
  243. package/src/getDefaultRegistry.ts +1 -1
  244. package/src/index.ts +3 -2
  245. package/src/tsconfig.json +14 -6
  246. package/src/withTheme.tsx +4 -3
  247. package/LICENSE.md +0 -201
  248. package/lib/components/Form.js.map +0 -1
  249. package/lib/components/fields/ArrayField.js.map +0 -1
  250. package/lib/components/fields/BooleanField.js.map +0 -1
  251. package/lib/components/fields/MultiSchemaField.js.map +0 -1
  252. package/lib/components/fields/NullField.js.map +0 -1
  253. package/lib/components/fields/NumberField.js.map +0 -1
  254. package/lib/components/fields/ObjectField.js.map +0 -1
  255. package/lib/components/fields/SchemaField.js.map +0 -1
  256. package/lib/components/fields/StringField.js.map +0 -1
  257. package/lib/components/fields/index.js.map +0 -1
  258. package/lib/components/templates/ArrayFieldDescriptionTemplate.js.map +0 -1
  259. package/lib/components/templates/ArrayFieldItemTemplate.js.map +0 -1
  260. package/lib/components/templates/ArrayFieldTemplate.js.map +0 -1
  261. package/lib/components/templates/ArrayFieldTitleTemplate.js.map +0 -1
  262. package/lib/components/templates/BaseInputTemplate.js.map +0 -1
  263. package/lib/components/templates/ButtonTemplates/AddButton.js.map +0 -1
  264. package/lib/components/templates/ButtonTemplates/IconButton.js.map +0 -1
  265. package/lib/components/templates/ButtonTemplates/SubmitButton.js.map +0 -1
  266. package/lib/components/templates/ButtonTemplates/index.js.map +0 -1
  267. package/lib/components/templates/DescriptionField.js.map +0 -1
  268. package/lib/components/templates/ErrorList.js.map +0 -1
  269. package/lib/components/templates/FieldErrorTemplate.js.map +0 -1
  270. package/lib/components/templates/FieldHelpTemplate.js.map +0 -1
  271. package/lib/components/templates/FieldTemplate/FieldTemplate.js.map +0 -1
  272. package/lib/components/templates/FieldTemplate/Label.js.map +0 -1
  273. package/lib/components/templates/FieldTemplate/index.js.map +0 -1
  274. package/lib/components/templates/ObjectFieldTemplate.js.map +0 -1
  275. package/lib/components/templates/TitleField.js.map +0 -1
  276. package/lib/components/templates/UnsupportedField.js.map +0 -1
  277. package/lib/components/templates/WrapIfAdditionalTemplate.js.map +0 -1
  278. package/lib/components/templates/index.js.map +0 -1
  279. package/lib/components/widgets/AltDateTimeWidget.js.map +0 -1
  280. package/lib/components/widgets/AltDateWidget.js.map +0 -1
  281. package/lib/components/widgets/CheckboxWidget.js.map +0 -1
  282. package/lib/components/widgets/CheckboxesWidget.js.map +0 -1
  283. package/lib/components/widgets/ColorWidget.js.map +0 -1
  284. package/lib/components/widgets/DateTimeWidget.js.map +0 -1
  285. package/lib/components/widgets/DateWidget.js.map +0 -1
  286. package/lib/components/widgets/EmailWidget.js.map +0 -1
  287. package/lib/components/widgets/FileWidget.js.map +0 -1
  288. package/lib/components/widgets/HiddenWidget.js.map +0 -1
  289. package/lib/components/widgets/PasswordWidget.js.map +0 -1
  290. package/lib/components/widgets/RadioWidget.js.map +0 -1
  291. package/lib/components/widgets/RangeWidget.js.map +0 -1
  292. package/lib/components/widgets/SelectWidget.js.map +0 -1
  293. package/lib/components/widgets/TextWidget.js.map +0 -1
  294. package/lib/components/widgets/TextareaWidget.js.map +0 -1
  295. package/lib/components/widgets/TimeWidget.js.map +0 -1
  296. package/lib/components/widgets/URLWidget.js.map +0 -1
  297. package/lib/components/widgets/UpDownWidget.js.map +0 -1
  298. package/lib/components/widgets/index.js.map +0 -1
  299. package/lib/getDefaultRegistry.js.map +0 -1
  300. package/lib/index.js.map +0 -1
  301. package/lib/withTheme.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -3,22 +3,26 @@ import { Component as Component5, createRef } from "react";
3
3
  import {
4
4
  createSchemaUtils,
5
5
  deepEquals as deepEquals3,
6
- getTemplate as getTemplate20,
7
- getUiOptions as getUiOptions12,
8
- isObject as isObject5,
9
- mergeObjects as mergeObjects2,
6
+ getChangedFields,
7
+ getTemplate as getTemplate24,
8
+ getUiOptions as getUiOptions17,
9
+ isObject as isObject6,
10
+ mergeObjects as mergeObjects3,
10
11
  NAME_KEY,
11
12
  RJSF_ADDITIONAL_PROPERTIES_FLAG,
12
13
  shouldRender,
13
14
  SUBMIT_BTN_OPTIONS_KEY,
14
15
  toErrorList,
15
16
  UI_GLOBAL_OPTIONS_KEY,
16
- UI_OPTIONS_KEY as UI_OPTIONS_KEY2,
17
- validationDataMerge
17
+ UI_OPTIONS_KEY as UI_OPTIONS_KEY3,
18
+ validationDataMerge,
19
+ createErrorHandler,
20
+ unwrapErrorHandler
18
21
  } from "@rjsf/utils";
19
22
  import _forEach from "lodash/forEach";
20
23
  import _get from "lodash/get";
21
24
  import _isEmpty from "lodash/isEmpty";
25
+ import _isNil from "lodash/isNil";
22
26
  import _pick from "lodash/pick";
23
27
  import _toPath from "lodash/toPath";
24
28
 
@@ -68,189 +72,6 @@ var ArrayField = class extends Component {
68
72
  */
69
73
  constructor(props) {
70
74
  super(props);
71
- /** Returns the default form information for an item based on the schema for that item. Deals with the possibility
72
- * that the schema is fixed and allows additional items.
73
- */
74
- this._getNewFormDataRow = () => {
75
- const { schema, registry } = this.props;
76
- const { schemaUtils } = registry;
77
- let itemSchema = schema.items;
78
- if (isFixedItems(schema) && allowAdditionalItems(schema)) {
79
- itemSchema = schema.additionalItems;
80
- }
81
- return schemaUtils.getDefaultFormState(itemSchema);
82
- };
83
- /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of
84
- * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the
85
- * keyed data
86
- *
87
- * @param event - The event for the click
88
- */
89
- this.onAddClick = (event) => {
90
- this._handleAddClick(event);
91
- };
92
- /** Callback handler for when the user clicks on the add button on an existing array element. Creates a new row of
93
- * keyed form data inserted at the `index`, adding it into the state, and then returning `onChange()` with the plain
94
- * form data converted from the keyed data
95
- *
96
- * @param index - The index at which the add button is clicked
97
- */
98
- this.onAddIndexClick = (index) => {
99
- return (event) => {
100
- this._handleAddClick(event, index);
101
- };
102
- };
103
- /** Callback handler for when the user clicks on the copy button on an existing array element. Clones the row of
104
- * keyed form data at the `index` into the next position in the state, and then returning `onChange()` with the plain
105
- * form data converted from the keyed data
106
- *
107
- * @param index - The index at which the copy button is clicked
108
- */
109
- this.onCopyIndexClick = (index) => {
110
- return (event) => {
111
- if (event) {
112
- event.preventDefault();
113
- }
114
- const { onChange, errorSchema } = this.props;
115
- const { keyedFormData } = this.state;
116
- let newErrorSchema;
117
- if (errorSchema) {
118
- newErrorSchema = {};
119
- for (const idx in errorSchema) {
120
- const i = parseInt(idx);
121
- if (i <= index) {
122
- set(newErrorSchema, [i], errorSchema[idx]);
123
- } else if (i > index) {
124
- set(newErrorSchema, [i + 1], errorSchema[idx]);
125
- }
126
- }
127
- }
128
- const newKeyedFormDataRow = {
129
- key: generateRowId(),
130
- item: cloneDeep(keyedFormData[index].item)
131
- };
132
- const newKeyedFormData = [...keyedFormData];
133
- if (index !== void 0) {
134
- newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
135
- } else {
136
- newKeyedFormData.push(newKeyedFormDataRow);
137
- }
138
- this.setState(
139
- {
140
- keyedFormData: newKeyedFormData,
141
- updatedKeyedFormData: true
142
- },
143
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
144
- );
145
- };
146
- };
147
- /** Callback handler for when the user clicks on the remove button on an existing array element. Removes the row of
148
- * keyed form data at the `index` in the state, and then returning `onChange()` with the plain form data converted
149
- * from the keyed data
150
- *
151
- * @param index - The index at which the remove button is clicked
152
- */
153
- this.onDropIndexClick = (index) => {
154
- return (event) => {
155
- if (event) {
156
- event.preventDefault();
157
- }
158
- const { onChange, errorSchema } = this.props;
159
- const { keyedFormData } = this.state;
160
- let newErrorSchema;
161
- if (errorSchema) {
162
- newErrorSchema = {};
163
- for (const idx in errorSchema) {
164
- const i = parseInt(idx);
165
- if (i < index) {
166
- set(newErrorSchema, [i], errorSchema[idx]);
167
- } else if (i > index) {
168
- set(newErrorSchema, [i - 1], errorSchema[idx]);
169
- }
170
- }
171
- }
172
- const newKeyedFormData = keyedFormData.filter((_, i) => i !== index);
173
- this.setState(
174
- {
175
- keyedFormData: newKeyedFormData,
176
- updatedKeyedFormData: true
177
- },
178
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
179
- );
180
- };
181
- };
182
- /** Callback handler for when the user clicks on one of the move item buttons on an existing array element. Moves the
183
- * row of keyed form data at the `index` to the `newIndex` in the state, and then returning `onChange()` with the
184
- * plain form data converted from the keyed data
185
- *
186
- * @param index - The index of the item to move
187
- * @param newIndex - The index to where the item is to be moved
188
- */
189
- this.onReorderClick = (index, newIndex) => {
190
- return (event) => {
191
- if (event) {
192
- event.preventDefault();
193
- event.currentTarget.blur();
194
- }
195
- const { onChange, errorSchema } = this.props;
196
- let newErrorSchema;
197
- if (errorSchema) {
198
- newErrorSchema = {};
199
- for (const idx in errorSchema) {
200
- const i = parseInt(idx);
201
- if (i == index) {
202
- set(newErrorSchema, [newIndex], errorSchema[index]);
203
- } else if (i == newIndex) {
204
- set(newErrorSchema, [index], errorSchema[newIndex]);
205
- } else {
206
- set(newErrorSchema, [idx], errorSchema[i]);
207
- }
208
- }
209
- }
210
- const { keyedFormData } = this.state;
211
- function reOrderArray() {
212
- const _newKeyedFormData = keyedFormData.slice();
213
- _newKeyedFormData.splice(index, 1);
214
- _newKeyedFormData.splice(newIndex, 0, keyedFormData[index]);
215
- return _newKeyedFormData;
216
- }
217
- const newKeyedFormData = reOrderArray();
218
- this.setState(
219
- {
220
- keyedFormData: newKeyedFormData
221
- },
222
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
223
- );
224
- };
225
- };
226
- /** Callback handler used to deal with changing the value of the data in the array at the `index`. Calls the
227
- * `onChange` callback with the updated form data
228
- *
229
- * @param index - The index of the item being changed
230
- */
231
- this.onChangeForIndex = (index) => {
232
- return (value, newErrorSchema, id) => {
233
- const { formData, onChange, errorSchema } = this.props;
234
- const arrayData = Array.isArray(formData) ? formData : [];
235
- const newFormData = arrayData.map((item, i) => {
236
- const jsonValue = typeof value === "undefined" ? null : value;
237
- return index === i ? jsonValue : item;
238
- });
239
- onChange(
240
- newFormData,
241
- errorSchema && errorSchema && {
242
- ...errorSchema,
243
- [index]: newErrorSchema
244
- },
245
- id
246
- );
247
- };
248
- };
249
- /** Callback handler used to change the value for a checkbox */
250
- this.onSelectChange = (value) => {
251
- const { onChange, idSchema } = this.props;
252
- onChange(value, void 0, idSchema && idSchema.$id);
253
- };
254
75
  const { formData = [] } = props;
255
76
  const keyedFormData = generateKeyedFormData(formData);
256
77
  this.state = {
@@ -325,6 +146,18 @@ var ArrayField = class extends Component {
325
146
  }
326
147
  return addable;
327
148
  }
149
+ /** Returns the default form information for an item based on the schema for that item. Deals with the possibility
150
+ * that the schema is fixed and allows additional items.
151
+ */
152
+ _getNewFormDataRow = () => {
153
+ const { schema, registry } = this.props;
154
+ const { schemaUtils } = registry;
155
+ let itemSchema = schema.items;
156
+ if (isFixedItems(schema) && allowAdditionalItems(schema)) {
157
+ itemSchema = schema.additionalItems;
158
+ }
159
+ return schemaUtils.getDefaultFormState(itemSchema);
160
+ };
328
161
  /** Callback handler for when the user clicks on the add or add at index buttons. Creates a new row of keyed form data
329
162
  * either at the end of the list (when index is not specified) or inserted at the `index` when it is, adding it into
330
163
  * the state, and then returning `onChange()` with the plain form data converted from the keyed data
@@ -368,6 +201,177 @@ var ArrayField = class extends Component {
368
201
  () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
369
202
  );
370
203
  }
204
+ /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of
205
+ * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the
206
+ * keyed data
207
+ *
208
+ * @param event - The event for the click
209
+ */
210
+ onAddClick = (event) => {
211
+ this._handleAddClick(event);
212
+ };
213
+ /** Callback handler for when the user clicks on the add button on an existing array element. Creates a new row of
214
+ * keyed form data inserted at the `index`, adding it into the state, and then returning `onChange()` with the plain
215
+ * form data converted from the keyed data
216
+ *
217
+ * @param index - The index at which the add button is clicked
218
+ */
219
+ onAddIndexClick = (index) => {
220
+ return (event) => {
221
+ this._handleAddClick(event, index);
222
+ };
223
+ };
224
+ /** Callback handler for when the user clicks on the copy button on an existing array element. Clones the row of
225
+ * keyed form data at the `index` into the next position in the state, and then returning `onChange()` with the plain
226
+ * form data converted from the keyed data
227
+ *
228
+ * @param index - The index at which the copy button is clicked
229
+ */
230
+ onCopyIndexClick = (index) => {
231
+ return (event) => {
232
+ if (event) {
233
+ event.preventDefault();
234
+ }
235
+ const { onChange, errorSchema } = this.props;
236
+ const { keyedFormData } = this.state;
237
+ let newErrorSchema;
238
+ if (errorSchema) {
239
+ newErrorSchema = {};
240
+ for (const idx in errorSchema) {
241
+ const i = parseInt(idx);
242
+ if (i <= index) {
243
+ set(newErrorSchema, [i], errorSchema[idx]);
244
+ } else if (i > index) {
245
+ set(newErrorSchema, [i + 1], errorSchema[idx]);
246
+ }
247
+ }
248
+ }
249
+ const newKeyedFormDataRow = {
250
+ key: generateRowId(),
251
+ item: cloneDeep(keyedFormData[index].item)
252
+ };
253
+ const newKeyedFormData = [...keyedFormData];
254
+ if (index !== void 0) {
255
+ newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
256
+ } else {
257
+ newKeyedFormData.push(newKeyedFormDataRow);
258
+ }
259
+ this.setState(
260
+ {
261
+ keyedFormData: newKeyedFormData,
262
+ updatedKeyedFormData: true
263
+ },
264
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
265
+ );
266
+ };
267
+ };
268
+ /** Callback handler for when the user clicks on the remove button on an existing array element. Removes the row of
269
+ * keyed form data at the `index` in the state, and then returning `onChange()` with the plain form data converted
270
+ * from the keyed data
271
+ *
272
+ * @param index - The index at which the remove button is clicked
273
+ */
274
+ onDropIndexClick = (index) => {
275
+ return (event) => {
276
+ if (event) {
277
+ event.preventDefault();
278
+ }
279
+ const { onChange, errorSchema } = this.props;
280
+ const { keyedFormData } = this.state;
281
+ let newErrorSchema;
282
+ if (errorSchema) {
283
+ newErrorSchema = {};
284
+ for (const idx in errorSchema) {
285
+ const i = parseInt(idx);
286
+ if (i < index) {
287
+ set(newErrorSchema, [i], errorSchema[idx]);
288
+ } else if (i > index) {
289
+ set(newErrorSchema, [i - 1], errorSchema[idx]);
290
+ }
291
+ }
292
+ }
293
+ const newKeyedFormData = keyedFormData.filter((_, i) => i !== index);
294
+ this.setState(
295
+ {
296
+ keyedFormData: newKeyedFormData,
297
+ updatedKeyedFormData: true
298
+ },
299
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
300
+ );
301
+ };
302
+ };
303
+ /** Callback handler for when the user clicks on one of the move item buttons on an existing array element. Moves the
304
+ * row of keyed form data at the `index` to the `newIndex` in the state, and then returning `onChange()` with the
305
+ * plain form data converted from the keyed data
306
+ *
307
+ * @param index - The index of the item to move
308
+ * @param newIndex - The index to where the item is to be moved
309
+ */
310
+ onReorderClick = (index, newIndex) => {
311
+ return (event) => {
312
+ if (event) {
313
+ event.preventDefault();
314
+ event.currentTarget.blur();
315
+ }
316
+ const { onChange, errorSchema } = this.props;
317
+ let newErrorSchema;
318
+ if (errorSchema) {
319
+ newErrorSchema = {};
320
+ for (const idx in errorSchema) {
321
+ const i = parseInt(idx);
322
+ if (i == index) {
323
+ set(newErrorSchema, [newIndex], errorSchema[index]);
324
+ } else if (i == newIndex) {
325
+ set(newErrorSchema, [index], errorSchema[newIndex]);
326
+ } else {
327
+ set(newErrorSchema, [idx], errorSchema[i]);
328
+ }
329
+ }
330
+ }
331
+ const { keyedFormData } = this.state;
332
+ function reOrderArray() {
333
+ const _newKeyedFormData = keyedFormData.slice();
334
+ _newKeyedFormData.splice(index, 1);
335
+ _newKeyedFormData.splice(newIndex, 0, keyedFormData[index]);
336
+ return _newKeyedFormData;
337
+ }
338
+ const newKeyedFormData = reOrderArray();
339
+ this.setState(
340
+ {
341
+ keyedFormData: newKeyedFormData
342
+ },
343
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema)
344
+ );
345
+ };
346
+ };
347
+ /** Callback handler used to deal with changing the value of the data in the array at the `index`. Calls the
348
+ * `onChange` callback with the updated form data
349
+ *
350
+ * @param index - The index of the item being changed
351
+ */
352
+ onChangeForIndex = (index) => {
353
+ return (value, newErrorSchema, id) => {
354
+ const { formData, onChange, errorSchema } = this.props;
355
+ const arrayData = Array.isArray(formData) ? formData : [];
356
+ const newFormData = arrayData.map((item, i) => {
357
+ const jsonValue = typeof value === "undefined" ? null : value;
358
+ return index === i ? jsonValue : item;
359
+ });
360
+ onChange(
361
+ newFormData,
362
+ errorSchema && errorSchema && {
363
+ ...errorSchema,
364
+ [index]: newErrorSchema
365
+ },
366
+ id
367
+ );
368
+ };
369
+ };
370
+ /** Callback handler used to change the value for a checkbox */
371
+ onSelectChange = (value) => {
372
+ const { onChange, idSchema } = this.props;
373
+ onChange(value, void 0, idSchema && idSchema.$id);
374
+ };
371
375
  /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements
372
376
  */
373
377
  render() {
@@ -462,7 +466,7 @@ var ArrayField = class extends Component {
462
466
  totalItems: keyedFormData.length
463
467
  });
464
468
  }),
465
- className: `field field-array field-array-of-${itemsSchema.type}`,
469
+ className: `rjsf-field rjsf-field-array rjsf-field-array-of-${itemsSchema.type}`,
466
470
  disabled,
467
471
  idSchema,
468
472
  uiSchema,
@@ -670,7 +674,7 @@ var ArrayField = class extends Component {
670
674
  const canAdd = this.canAddItem(items) && !!additionalSchema;
671
675
  const arrayProps = {
672
676
  canAdd,
673
- className: "field field-array field-array-fixed-items",
677
+ className: "rjsf-field rjsf-field-array rjsf-field-array-fixed-items",
674
678
  disabled,
675
679
  idSchema,
676
680
  formData,
@@ -751,14 +755,14 @@ var ArrayField = class extends Component {
751
755
  } = registry;
752
756
  const ItemSchemaField = ArraySchemaField || SchemaField2;
753
757
  const { orderable = true, removable = true, copyable = false } = getUiOptions(uiSchema, globalUiOptions);
754
- const has2 = {
758
+ const has4 = {
755
759
  moveUp: orderable && canMoveUp,
756
760
  moveDown: orderable && canMoveDown,
757
761
  copy: copyable && canAdd,
758
762
  remove: removable && canRemove,
759
763
  toolbar: false
760
764
  };
761
- has2.toolbar = Object.keys(has2).some((key2) => has2[key2]);
765
+ has4.toolbar = Object.keys(has4).some((key2) => has4[key2]);
762
766
  return {
763
767
  children: /* @__PURE__ */ jsx(
764
768
  ItemSchemaField,
@@ -786,21 +790,31 @@ var ArrayField = class extends Component {
786
790
  rawErrors
787
791
  }
788
792
  ),
789
- className: "array-item",
793
+ buttonsProps: {
794
+ idSchema: itemIdSchema,
795
+ disabled,
796
+ readonly,
797
+ canAdd,
798
+ hasCopy: has4.copy,
799
+ hasMoveUp: has4.moveUp,
800
+ hasMoveDown: has4.moveDown,
801
+ hasRemove: has4.remove,
802
+ index,
803
+ totalItems,
804
+ onAddIndexClick: this.onAddIndexClick,
805
+ onCopyIndexClick: this.onCopyIndexClick,
806
+ onDropIndexClick: this.onDropIndexClick,
807
+ onReorderClick: this.onReorderClick,
808
+ registry,
809
+ schema: itemSchema,
810
+ uiSchema: itemUiSchema
811
+ },
812
+ className: "rjsf-array-item",
790
813
  disabled,
791
- canAdd,
792
- hasCopy: has2.copy,
793
- hasToolbar: has2.toolbar,
794
- hasMoveUp: has2.moveUp,
795
- hasMoveDown: has2.moveDown,
796
- hasRemove: has2.remove,
814
+ hasToolbar: has4.toolbar,
797
815
  index,
798
816
  totalItems,
799
817
  key,
800
- onAddIndexClick: this.onAddIndexClick,
801
- onCopyIndexClick: this.onCopyIndexClick,
802
- onDropIndexClick: this.onDropIndexClick,
803
- onReorderClick: this.onReorderClick,
804
818
  readonly,
805
819
  registry,
806
820
  schema: itemSchema,
@@ -845,6 +859,7 @@ function BooleanField(props) {
845
859
  title: uiTitle,
846
860
  // Unlike the other fields, don't use `getDisplayLabel()` since it always returns false for the boolean type
847
861
  label: displayLabel = true,
862
+ enumNames,
848
863
  ...options
849
864
  } = getUiOptions2(uiSchema, globalUiOptions);
850
865
  const Widget = getWidget2(schema, widget, widgets2);
@@ -869,9 +884,8 @@ function BooleanField(props) {
869
884
  uiSchema
870
885
  );
871
886
  } else {
872
- const schemaWithEnumNames = schema;
873
887
  const enums = schema.enum ?? [true, false];
874
- if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every((v) => typeof v === "boolean")) {
888
+ if (!enumNames && enums.length === 2 && enums.every((v) => typeof v === "boolean")) {
875
889
  enumOptions = [
876
890
  {
877
891
  value: enums[0],
@@ -883,14 +897,7 @@ function BooleanField(props) {
883
897
  }
884
898
  ];
885
899
  } else {
886
- enumOptions = optionsList2(
887
- {
888
- enum: enums,
889
- // NOTE: enumNames is deprecated, but still supported for now.
890
- enumNames: schemaWithEnumNames.enumNames
891
- },
892
- uiSchema
893
- );
900
+ enumOptions = optionsList2({ enum: enums }, uiSchema);
894
901
  }
895
902
  }
896
903
  return /* @__PURE__ */ jsx2(
@@ -920,184 +927,937 @@ function BooleanField(props) {
920
927
  }
921
928
  var BooleanField_default = BooleanField;
922
929
 
923
- // src/components/fields/MultiSchemaField.tsx
924
- import { Component as Component2 } from "react";
925
- import get2 from "lodash/get";
926
- import isEmpty from "lodash/isEmpty";
927
- import omit from "lodash/omit";
930
+ // src/components/fields/LayoutGridField.tsx
931
+ import { PureComponent } from "react";
928
932
  import {
929
933
  ANY_OF_KEY,
930
- deepEquals,
931
- ERRORS_KEY,
932
934
  getDiscriminatorFieldFromSchema,
935
+ getTemplate as getTemplate2,
936
+ getTestIds,
933
937
  getUiOptions as getUiOptions3,
934
- getWidget as getWidget3,
935
- mergeSchemas,
938
+ hashObject,
939
+ ID_KEY,
940
+ lookupFromFormContext,
941
+ mergeObjects,
936
942
  ONE_OF_KEY,
937
- TranslatableString as TranslatableString3
943
+ PROPERTIES_KEY,
944
+ READONLY_KEY,
945
+ UI_OPTIONS_KEY
938
946
  } from "@rjsf/utils";
939
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
940
- var AnyOfField = class extends Component2 {
941
- /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
947
+ import cloneDeep2 from "lodash/cloneDeep";
948
+ import each from "lodash/each";
949
+ import flatten from "lodash/flatten";
950
+ import get2 from "lodash/get";
951
+ import has from "lodash/has";
952
+ import includes from "lodash/includes";
953
+ import intersection from "lodash/intersection";
954
+ import isEmpty from "lodash/isEmpty";
955
+ import isFunction from "lodash/isFunction";
956
+ import isEqual from "lodash/isEqual";
957
+ import isObject3 from "lodash/isObject";
958
+ import isPlainObject from "lodash/isPlainObject";
959
+ import isString from "lodash/isString";
960
+ import isUndefined from "lodash/isUndefined";
961
+ import set2 from "lodash/set";
962
+ import { jsx as jsx3 } from "react/jsx-runtime";
963
+ import { createElement } from "react";
964
+ var LOOKUP_REGEX = /^\$lookup=(.+)/;
965
+ var LAYOUT_GRID_UI_OPTION = "layoutGrid";
966
+ var LAYOUT_GRID_OPTION = `ui:${LAYOUT_GRID_UI_OPTION}`;
967
+ var UI_GLOBAL_OPTIONS = "ui:global_options";
968
+ function getNonNullishValue(value, fallback) {
969
+ return value ?? fallback;
970
+ }
971
+ var LayoutGridField = class _LayoutGridField extends PureComponent {
972
+ static defaultProps = {
973
+ layoutGridSchema: void 0
974
+ };
975
+ static TEST_IDS = getTestIds();
976
+ /** Computes the uiSchema for the field with `name` from the `uiProps` and `uiSchema` provided. The field UI Schema
977
+ * will always contain a copy of the global options from the `uiSchema` (so they can be passed down) as well as
978
+ * copying them into the local ui options. When the `forceReadonly` flag is true, then the field UI Schema is
979
+ * updated to make "readonly" be true. When the `schemaReadonly` flag is true AND the field UI Schema does NOT have
980
+ * the flag already provided, then we also make "readonly" true. We always make sure to return the final value of the
981
+ * field UI Schema's "readonly" flag as `uiReadonly` along with the `fieldUiSchema` in the return value.
942
982
  *
943
- * @param props - The `FieldProps` for this template
983
+ * @param field - The name of the field to pull the existing UI Schema for
984
+ * @param uiProps - Any props that should be put into the field's uiSchema
985
+ * @param [uiSchema] - The optional UI Schema from which to get the UI schema for the field
986
+ * @param [schemaReadonly] - Optional flag indicating whether the schema indicates the field is readonly
987
+ * @param [forceReadonly] - Optional flag indicating whether the Form itself is in readonly mode
944
988
  */
945
- constructor(props) {
946
- super(props);
947
- /** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated
948
- * to remove properties that are not part of the newly selected option schema, and then the updated data is passed to
949
- * the `onChange` handler.
950
- *
951
- * @param option - The new option value being selected
952
- */
953
- this.onOptionChange = (option) => {
954
- const { selectedOption, retrievedOptions } = this.state;
955
- const { formData, onChange, registry } = this.props;
956
- const { schemaUtils } = registry;
957
- const intOption = option !== void 0 ? parseInt(option, 10) : -1;
958
- if (intOption === selectedOption) {
959
- return;
960
- }
961
- const newOption = intOption >= 0 ? retrievedOptions[intOption] : void 0;
962
- const oldOption = selectedOption >= 0 ? retrievedOptions[selectedOption] : void 0;
963
- let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
964
- if (newFormData && newOption) {
965
- newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
989
+ static computeFieldUiSchema(field, uiProps, uiSchema, schemaReadonly, forceReadonly) {
990
+ const globalUiOptions = get2(uiSchema, [UI_GLOBAL_OPTIONS], {});
991
+ const localUiSchema = get2(uiSchema, field);
992
+ const localUiOptions = { ...get2(localUiSchema, [UI_OPTIONS_KEY], {}), ...uiProps, ...globalUiOptions };
993
+ const fieldUiSchema = { ...localUiSchema };
994
+ if (!isEmpty(localUiOptions)) {
995
+ set2(fieldUiSchema, [UI_OPTIONS_KEY], localUiOptions);
996
+ }
997
+ if (!isEmpty(globalUiOptions)) {
998
+ set2(fieldUiSchema, [UI_GLOBAL_OPTIONS], globalUiOptions);
999
+ }
1000
+ let { readonly: uiReadonly } = getUiOptions3(fieldUiSchema);
1001
+ if (forceReadonly === true || isUndefined(uiReadonly) && schemaReadonly === true) {
1002
+ uiReadonly = true;
1003
+ if (has(localUiOptions, READONLY_KEY)) {
1004
+ set2(fieldUiSchema, [UI_OPTIONS_KEY, READONLY_KEY], true);
1005
+ } else {
1006
+ set2(fieldUiSchema, `ui:${READONLY_KEY}`, true);
966
1007
  }
967
- onChange(newFormData, void 0, this.getFieldId());
968
- this.setState({ selectedOption: intOption });
969
- };
970
- const {
971
- formData,
972
- options,
973
- registry: { schemaUtils }
974
- } = this.props;
975
- const retrievedOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
976
- this.state = {
977
- retrievedOptions,
978
- selectedOption: this.getMatchingOption(0, formData, retrievedOptions)
979
- };
1008
+ }
1009
+ return { fieldUiSchema, uiReadonly };
980
1010
  }
981
- /** React lifecycle method that is called when the props and/or state for this component is updated. It recomputes the
982
- * currently selected option based on the overall `formData`
1011
+ /** Given an `operator`, `datum` and `value` determines whether this condition is considered matching. Matching
1012
+ * depends on the `operator`. The `datum` and `value` are converted into arrays if they aren't already and then the
1013
+ * contents of the two arrays are compared using the `operator`. When `operator` is All, then the two arrays must be
1014
+ * equal to match. When `operator` is SOME then the intersection of the two arrays must have at least one value in
1015
+ * common to match. When `operator` is NONE then the intersection of the two arrays must not have any values in common
1016
+ * to match.
983
1017
  *
984
- * @param prevProps - The previous `FieldProps` for this template
985
- * @param prevState - The previous `AnyOfFieldState` for this template
1018
+ * @param [operator] - The optional operator for the condition
1019
+ * @param [datum] - The optional datum for the condition, this can be an item or a list of items of type unknown
1020
+ * @param [value='$0m3tH1nG Un3xP3cT3d'] The optional value for the condition, defaulting to a highly unlikely value
1021
+ * to avoid comparing two undefined elements when `value` was forgotten in the condition definition.
1022
+ * This can be an item or a list of items of type unknown
1023
+ * @returns - True if the condition matches, false otherwise
986
1024
  */
987
- componentDidUpdate(prevProps, prevState) {
988
- const { formData, options, idSchema } = this.props;
989
- const { selectedOption } = this.state;
990
- let newState = this.state;
991
- if (!deepEquals(prevProps.options, options)) {
992
- const {
993
- registry: { schemaUtils }
994
- } = this.props;
995
- const retrievedOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
996
- newState = { selectedOption, retrievedOptions };
1025
+ static conditionMatches(operator, datum, value = "$0m3tH1nG Un3xP3cT3d") {
1026
+ const data = flatten([datum]).sort();
1027
+ const values = flatten([value]).sort();
1028
+ switch (operator) {
1029
+ case "all" /* ALL */:
1030
+ return isEqual(data, values);
1031
+ case "some" /* SOME */:
1032
+ return intersection(data, values).length > 0;
1033
+ case "none" /* NONE */:
1034
+ return intersection(data, values).length === 0;
1035
+ default:
1036
+ return false;
997
1037
  }
998
- if (!deepEquals(formData, prevProps.formData) && idSchema.$id === prevProps.idSchema.$id) {
999
- const { retrievedOptions } = newState;
1000
- const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
1001
- if (prevState && matchingOption !== selectedOption) {
1002
- newState = { selectedOption: matchingOption, retrievedOptions };
1038
+ }
1039
+ /** From within the `layoutGridSchema` finds the `children` and any extra `gridProps` from the object keyed by
1040
+ * `schemaKey`. If the `children` contains extra `gridProps` and those props contain a `className` string, try to
1041
+ * lookup whether that `className` has a replacement value in the `registry` using the `FORM_CONTEXT_LOOKUP_BASE`.
1042
+ * When the `className` value contains multiple classNames separated by a space, the lookup will look for a
1043
+ * replacement value for each `className` and combine them into one.
1044
+ *
1045
+ * @param layoutGridSchema - The GridSchemaType instance from which to obtain the `schemaKey` children and extra props
1046
+ * @param schemaKey - A `GridType` value, used to get the children and extra props from within the `layoutGridSchema`
1047
+ * @param registry - The `@rjsf` Registry from which to look up `classNames` if they are present in the extra props
1048
+ * @returns - An object containing the list of `LayoutGridSchemaType` `children` and any extra `gridProps`
1049
+ * @throws - A `TypeError` when the `children` is not an array
1050
+ */
1051
+ static findChildrenAndProps(layoutGridSchema, schemaKey, registry) {
1052
+ let gridProps = {};
1053
+ let children = layoutGridSchema[schemaKey];
1054
+ if (isPlainObject(children)) {
1055
+ const { children: elements, className: toMapClassNames, ...otherProps } = children;
1056
+ children = elements;
1057
+ if (toMapClassNames) {
1058
+ const classes = toMapClassNames.split(" ");
1059
+ const className = classes.map((ele) => lookupFromFormContext(registry, ele, ele)).join(" ");
1060
+ gridProps = { ...otherProps, className };
1061
+ } else {
1062
+ gridProps = otherProps;
1003
1063
  }
1004
1064
  }
1005
- if (newState !== this.state) {
1006
- this.setState(newState);
1065
+ if (!Array.isArray(children)) {
1066
+ throw new TypeError(`Expected array for "${schemaKey}" in ${JSON.stringify(layoutGridSchema)}`);
1007
1067
  }
1068
+ return { children, gridProps };
1008
1069
  }
1009
- /** Determines the best matching option for the given `formData` and `options`.
1070
+ /** Generates an idSchema for the `schema` using `@rjsf`'s `toIdSchema` util, passing the `baseIdSchema`'s `$id` value
1071
+ * as the id prefix.
1010
1072
  *
1011
- * @param formData - The new formData
1012
- * @param options - The list of options to choose from
1013
- * @return - The index of the `option` that best matches the `formData`
1073
+ * @param schemaUtils - The `SchemaUtilsType` used to call `toIdSchema`
1074
+ * @param schema - The schema to generate the idSchema for
1075
+ * @param baseIdSchema - The IdSchema for the base
1076
+ * @param formData - The formData to pass the `toIdSchema`
1077
+ * @param [idSeparator] - The param to pass into the `toIdSchema` util which will use it to join the `idSchema` paths
1078
+ * @returns - The generated `idSchema` for the `schema`
1014
1079
  */
1015
- getMatchingOption(selectedOption, formData, options) {
1016
- const {
1017
- schema,
1018
- registry: { schemaUtils }
1019
- } = this.props;
1020
- const discriminator = getDiscriminatorFieldFromSchema(schema);
1021
- const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
1022
- return option;
1023
- }
1024
- getFieldId() {
1025
- const { idSchema, schema } = this.props;
1026
- return `${idSchema.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
1080
+ static getIdSchema(schemaUtils, baseIdSchema, formData, schema = {}, idSeparator) {
1081
+ const baseId = get2(baseIdSchema, ID_KEY);
1082
+ return schemaUtils.toIdSchema(schema, baseId, formData, baseId, idSeparator);
1027
1083
  }
1028
- /** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
1084
+ /** Given a `dottedPath` to a field in the `initialSchema`, iterate through each individual path in the schema until
1085
+ * the leaf path is found and returned (along with whether that leaf path `isRequired`) OR no schema exists for an
1086
+ * element in the path. If the leaf schema element happens to be a oneOf/anyOf then also return the oneOf/anyOf as
1087
+ * `options`.
1088
+ *
1089
+ * @param schemaUtils - The `SchemaUtilsType` used to call `retrieveSchema`
1090
+ * @param dottedPath - The dotted-path to the field for which to get the schema
1091
+ * @param initialSchema - The initial schema to start the search from
1092
+ * @param formData - The formData, useful for resolving a oneOf/anyOf selection in the path hierarchy
1093
+ * @param initialIdSchema - The initial idSchema to start the search from
1094
+ * @param [idSeparator] - The param to pass into the `toIdSchema` util which will use it to join the `idSchema` paths
1095
+ * @returns - An object containing the destination schema, isRequired and isReadonly flags for the field and options
1096
+ * info if a oneOf/anyOf
1029
1097
  */
1030
- render() {
1031
- const {
1032
- name,
1033
- disabled = false,
1034
- errorSchema = {},
1035
- formContext,
1036
- onBlur,
1037
- onFocus,
1038
- registry,
1039
- schema,
1040
- uiSchema
1041
- } = this.props;
1042
- const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
1043
- const { SchemaField: _SchemaField } = fields2;
1044
- const { selectedOption, retrievedOptions } = this.state;
1045
- const {
1046
- widget = "select",
1047
- placeholder,
1048
- autofocus,
1049
- autocomplete,
1050
- title = schema.title,
1051
- ...uiOptions
1052
- } = getUiOptions3(uiSchema, globalUiOptions);
1053
- const Widget = getWidget3({ type: "number" }, widget, widgets2);
1054
- const rawErrors = get2(errorSchema, ERRORS_KEY, []);
1055
- const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);
1056
- const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1057
- const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
1058
- let optionSchema;
1059
- if (option) {
1060
- const { required } = schema;
1061
- optionSchema = required ? mergeSchemas({ required }, option) : option;
1062
- }
1063
- let optionsUiSchema = [];
1064
- if (ONE_OF_KEY in schema && uiSchema && ONE_OF_KEY in uiSchema) {
1065
- if (Array.isArray(uiSchema[ONE_OF_KEY])) {
1066
- optionsUiSchema = uiSchema[ONE_OF_KEY];
1098
+ static getSchemaDetailsForField(schemaUtils, dottedPath, initialSchema, formData, initialIdSchema, idSeparator) {
1099
+ let rawSchema = initialSchema;
1100
+ let idSchema = initialIdSchema;
1101
+ const parts = dottedPath.split(".");
1102
+ const leafPath = parts.pop();
1103
+ let schema = schemaUtils.retrieveSchema(rawSchema, formData);
1104
+ let innerData = formData;
1105
+ let isReadonly = schema.readOnly;
1106
+ parts.forEach((part) => {
1107
+ if (has(schema, PROPERTIES_KEY)) {
1108
+ rawSchema = get2(schema, [PROPERTIES_KEY, part], {});
1109
+ idSchema = get2(idSchema, part, {});
1110
+ } else if (schema && (has(schema, ONE_OF_KEY) || has(schema, ANY_OF_KEY))) {
1111
+ const xxx = has(schema, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;
1112
+ const selectedSchema = schemaUtils.findSelectedOptionInXxxOf(schema, part, xxx, innerData);
1113
+ const selectedIdSchema = _LayoutGridField.getIdSchema(
1114
+ schemaUtils,
1115
+ idSchema,
1116
+ formData,
1117
+ selectedSchema,
1118
+ idSeparator
1119
+ );
1120
+ rawSchema = get2(selectedSchema, [PROPERTIES_KEY, part], {});
1121
+ idSchema = get2(selectedIdSchema, part, {});
1067
1122
  } else {
1068
- console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
1123
+ rawSchema = {};
1069
1124
  }
1070
- } else if (ANY_OF_KEY in schema && uiSchema && ANY_OF_KEY in uiSchema) {
1071
- if (Array.isArray(uiSchema[ANY_OF_KEY])) {
1072
- optionsUiSchema = uiSchema[ANY_OF_KEY];
1073
- } else {
1074
- console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
1125
+ innerData = get2(innerData, part, {});
1126
+ schema = schemaUtils.retrieveSchema(rawSchema, innerData);
1127
+ isReadonly = getNonNullishValue(schema.readOnly, isReadonly);
1128
+ });
1129
+ let optionsInfo;
1130
+ let isRequired = false;
1131
+ if (isEmpty(schema)) {
1132
+ schema = void 0;
1133
+ }
1134
+ if (schema && leafPath) {
1135
+ if (schema && (has(schema, ONE_OF_KEY) || has(schema, ANY_OF_KEY))) {
1136
+ const xxx = has(schema, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;
1137
+ schema = schemaUtils.findSelectedOptionInXxxOf(schema, leafPath, xxx, innerData);
1138
+ const rawIdSchema = _LayoutGridField.getIdSchema(schemaUtils, idSchema, formData, schema, idSeparator);
1139
+ idSchema = mergeObjects(rawIdSchema, idSchema);
1140
+ }
1141
+ isRequired = schema !== void 0 && Array.isArray(schema.required) && includes(schema.required, leafPath);
1142
+ schema = get2(schema, [PROPERTIES_KEY, leafPath]);
1143
+ schema = schema ? schemaUtils.retrieveSchema(schema) : schema;
1144
+ idSchema = get2(idSchema, leafPath, {});
1145
+ isReadonly = getNonNullishValue(schema?.readOnly, isReadonly);
1146
+ if (schema && (has(schema, ONE_OF_KEY) || has(schema, ANY_OF_KEY))) {
1147
+ const xxx = has(schema, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;
1148
+ const discriminator = getDiscriminatorFieldFromSchema(schema);
1149
+ optionsInfo = { options: schema[xxx], hasDiscriminator: !!discriminator };
1075
1150
  }
1076
1151
  }
1077
- let optionUiSchema = uiSchema;
1078
- if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {
1079
- optionUiSchema = optionsUiSchema[selectedOption];
1152
+ return { schema, isRequired, isReadonly, optionsInfo, idSchema };
1153
+ }
1154
+ /** Gets the custom render component from the `render`, by either determining that it is either already a function or
1155
+ * it is a non-function value that can be used to look up the function in the registry. If no function can be found,
1156
+ * null is returned.
1157
+ *
1158
+ * @param render - The potential render function or lookup name to one
1159
+ * @param registry - The `@rjsf` Registry from which to look up `classNames` if they are present in the extra props
1160
+ * @returns - Either a render function if available, or null if not
1161
+ */
1162
+ static getCustomRenderComponent(render, registry) {
1163
+ let customRenderer = render;
1164
+ if (isString(customRenderer)) {
1165
+ customRenderer = lookupFromFormContext(registry, customRenderer);
1080
1166
  }
1081
- const translateEnum = title ? TranslatableString3.TitleOptionPrefix : TranslatableString3.OptionPrefix;
1082
- const translateParams = title ? [title] : [];
1083
- const enumOptions = retrievedOptions.map((opt, index) => {
1084
- const { title: uiTitle = opt.title } = getUiOptions3(optionsUiSchema[index]);
1085
- return {
1086
- label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
1087
- value: index
1088
- };
1089
- });
1090
- return /* @__PURE__ */ jsxs("div", { className: "panel panel-default panel-body", children: [
1091
- /* @__PURE__ */ jsx3("div", { className: "form-group", children: /* @__PURE__ */ jsx3(
1092
- Widget,
1093
- {
1167
+ if (isFunction(customRenderer)) {
1168
+ return customRenderer;
1169
+ }
1170
+ return null;
1171
+ }
1172
+ /** Extract the `name`, and optional `render` and all other props from the `gridSchema`. We look up the `render` to
1173
+ * see if can be resolved to a UIComponent. If `name` does not exist and there is an optional `render` UIComponent, we
1174
+ * set the `rendered` component with only specified props for that component in the object.
1175
+ *
1176
+ * @param registry - The `@rjsf` Registry from which to look up `classNames` if they are present in the extra props
1177
+ * @param gridSchema - The string or object that represents the configuration for the grid field
1178
+ * @returns - The UIComponentPropsType computed from the gridSchema
1179
+ */
1180
+ static computeUIComponentPropsFromGridSchema(registry, gridSchema) {
1181
+ let name;
1182
+ let UIComponent = null;
1183
+ let uiProps = {};
1184
+ let rendered;
1185
+ if (isString(gridSchema) || isUndefined(gridSchema)) {
1186
+ name = gridSchema ?? "";
1187
+ } else {
1188
+ const { name: innerName, render, ...innerProps } = gridSchema;
1189
+ name = innerName;
1190
+ uiProps = innerProps;
1191
+ if (!isEmpty(uiProps)) {
1192
+ each(uiProps, (prop, key) => {
1193
+ if (isString(prop)) {
1194
+ const match = LOOKUP_REGEX.exec(prop);
1195
+ if (Array.isArray(match) && match.length > 1) {
1196
+ const name2 = match[1];
1197
+ uiProps[key] = lookupFromFormContext(registry, name2, name2);
1198
+ }
1199
+ }
1200
+ });
1201
+ }
1202
+ UIComponent = _LayoutGridField.getCustomRenderComponent(render, registry);
1203
+ if (!innerName && UIComponent) {
1204
+ rendered = /* @__PURE__ */ jsx3(UIComponent, { ...innerProps, "data-testid": _LayoutGridField.TEST_IDS.uiComponent });
1205
+ }
1206
+ }
1207
+ return { name, UIComponent, uiProps, rendered };
1208
+ }
1209
+ /** Constructs an `LayoutGridField` with the given `props`
1210
+ *
1211
+ * @param props - The `LayoutGridField` for this template
1212
+ */
1213
+ constructor(props) {
1214
+ super(props);
1215
+ }
1216
+ /** Generates an `onChange` handler for the field associated with the `dottedPath`. This handler will clone and update
1217
+ * the `formData` with the new `value` and the `errorSchema` if an `errSchema` is provided. After updating those two
1218
+ * elements, they will then be passed on to the `onChange` handler of the `LayoutFieldGrid`.
1219
+ *
1220
+ * @param dottedPath - The dotted-path to the field for which to generate the onChange handler
1221
+ * @returns - The `onChange` handling function for the `dottedPath` field
1222
+ */
1223
+ onFieldChange = (dottedPath) => {
1224
+ return (value, errSchema, id) => {
1225
+ const { onChange, errorSchema, formData } = this.props;
1226
+ const newFormData = cloneDeep2(formData || {});
1227
+ let newErrorSchema = errorSchema;
1228
+ if (errSchema && errorSchema) {
1229
+ newErrorSchema = cloneDeep2(errorSchema);
1230
+ set2(newErrorSchema, dottedPath, errSchema);
1231
+ }
1232
+ set2(newFormData, dottedPath, value);
1233
+ onChange(newFormData, newErrorSchema, id);
1234
+ };
1235
+ };
1236
+ /** Renders the `children` of the `GridType.CONDITION` if it passes. The `layoutGridSchema` for the
1237
+ * `GridType.CONDITION` is separated into the `children` and other `gridProps`. The `gridProps` are used to extract
1238
+ * the `operator`, `field` and `value` of the condition. If the condition matches, then all of the `children` are
1239
+ * rendered, otherwise null is returned.
1240
+ *
1241
+ * @param layoutGridSchema - The string or object that represents the configuration for the grid field
1242
+ * @returns - The rendered the children for the `GridType.CONDITION` or null
1243
+ */
1244
+ renderCondition(layoutGridSchema) {
1245
+ const { formData, registry } = this.props;
1246
+ const { children, gridProps } = _LayoutGridField.findChildrenAndProps(
1247
+ layoutGridSchema,
1248
+ "ui:condition" /* CONDITION */,
1249
+ registry
1250
+ );
1251
+ const { operator, field = "", value } = gridProps;
1252
+ const fieldData = get2(formData, field, null);
1253
+ if (_LayoutGridField.conditionMatches(operator, fieldData, value)) {
1254
+ return this.renderChildren(children);
1255
+ }
1256
+ return null;
1257
+ }
1258
+ /** Renders a material-ui `GridTemplate` as an item. The `layoutGridSchema` for the `GridType.COLUMN` is separated
1259
+ * into the `children` and other `gridProps`. The `gridProps` will be spread onto the outer `GridTemplate`. Inside
1260
+ * the `GridTemplate` all the `children` are rendered.
1261
+ *
1262
+ * @param layoutGridSchema - The string or object that represents the configuration for the grid field
1263
+ * @returns - The rendered `GridTemplate` containing the children for the `GridType.COLUMN`
1264
+ */
1265
+ renderCol(layoutGridSchema) {
1266
+ const { registry, uiSchema } = this.props;
1267
+ const { children, gridProps } = _LayoutGridField.findChildrenAndProps(
1268
+ layoutGridSchema,
1269
+ "ui:col" /* COLUMN */,
1270
+ registry
1271
+ );
1272
+ const uiOptions = getUiOptions3(uiSchema);
1273
+ const GridTemplate2 = getTemplate2("GridTemplate", registry, uiOptions);
1274
+ return /* @__PURE__ */ jsx3(GridTemplate2, { column: true, "data-testid": _LayoutGridField.TEST_IDS.col, ...gridProps, children: this.renderChildren(children) });
1275
+ }
1276
+ /** Renders a material-ui `GridTemplate` as an item. The `layoutGridSchema` for the `GridType.COLUMNS` is separated
1277
+ * into the `children` and other `gridProps`. The `children` is iterated on and `gridProps` will be spread onto the
1278
+ * outer `GridTemplate`. Each child will have their own rendered `GridTemplate`.
1279
+ *
1280
+ * @param layoutGridSchema - The string or object that represents the configuration for the grid field
1281
+ * @returns - The rendered `GridTemplate` containing the children for the `GridType.COLUMNS`
1282
+ */
1283
+ renderColumns(layoutGridSchema) {
1284
+ const { registry, uiSchema } = this.props;
1285
+ const { children, gridProps } = _LayoutGridField.findChildrenAndProps(
1286
+ layoutGridSchema,
1287
+ "ui:columns" /* COLUMNS */,
1288
+ registry
1289
+ );
1290
+ const uiOptions = getUiOptions3(uiSchema);
1291
+ const GridTemplate2 = getTemplate2("GridTemplate", registry, uiOptions);
1292
+ return children.map((child) => /* @__PURE__ */ jsx3(
1293
+ GridTemplate2,
1294
+ {
1295
+ column: true,
1296
+ "data-testid": _LayoutGridField.TEST_IDS.col,
1297
+ ...gridProps,
1298
+ children: this.renderChildren([child])
1299
+ },
1300
+ `column-${hashObject(child)}`
1301
+ ));
1302
+ }
1303
+ /** Renders a material-ui `GridTemplate` as a container. The
1304
+ * `layoutGridSchema` for the `GridType.ROW` is separated into the `children` and other `gridProps`. The `gridProps`
1305
+ * will be spread onto the outer `GridTemplate`. Inside of the `GridTemplate` all of the `children` are rendered.
1306
+ *
1307
+ * @param layoutGridSchema - The string or object that represents the configuration for the grid field
1308
+ * @returns - The rendered `GridTemplate` containing the children for the `GridType.ROW`
1309
+ */
1310
+ renderRow(layoutGridSchema) {
1311
+ const { registry, uiSchema } = this.props;
1312
+ const { children, gridProps } = _LayoutGridField.findChildrenAndProps(
1313
+ layoutGridSchema,
1314
+ "ui:row" /* ROW */,
1315
+ registry
1316
+ );
1317
+ const uiOptions = getUiOptions3(uiSchema);
1318
+ const GridTemplate2 = getTemplate2("GridTemplate", registry, uiOptions);
1319
+ return /* @__PURE__ */ jsx3(GridTemplate2, { ...gridProps, "data-testid": _LayoutGridField.TEST_IDS.row, children: this.renderChildren(children) });
1320
+ }
1321
+ /** Iterates through all the `childrenLayoutGridSchema`, rendering a nested `LayoutGridField` for each item in the
1322
+ * list, passing all the props for the current `LayoutGridField` along, updating the `schema` by calling
1323
+ * `retrieveSchema()` on it to resolve any `$ref`s. In addition to the updated `schema`, each item in
1324
+ * `childrenLayoutGridSchema` is passed as `layoutGridSchema`.
1325
+ *
1326
+ * @param childrenLayoutGridSchema - The list of strings or objects that represents the configurations for the
1327
+ * children fields
1328
+ * @returns - The nested `LayoutGridField`s
1329
+ */
1330
+ renderChildren(childrenLayoutGridSchema) {
1331
+ const { registry, schema: rawSchema, formData } = this.props;
1332
+ const { schemaUtils } = registry;
1333
+ const schema = schemaUtils.retrieveSchema(rawSchema, formData);
1334
+ return childrenLayoutGridSchema.map((layoutGridSchema) => /* @__PURE__ */ createElement(
1335
+ _LayoutGridField,
1336
+ {
1337
+ ...this.props,
1338
+ key: `layoutGrid-${hashObject(layoutGridSchema)}`,
1339
+ schema,
1340
+ layoutGridSchema
1341
+ }
1342
+ ));
1343
+ }
1344
+ /** Renders the field described by `gridSchema`. If `gridSchema` is not an object, then is will be assumed
1345
+ * to be the dotted-path to the field in the schema. Otherwise, we extract the `name`, and optional `render` and all
1346
+ * other props. If `name` does not exist and there is an optional `render`, we return the `render` component with only
1347
+ * specified props for that component. If `name` exists, we take the name, the initial & root schemas and the formData
1348
+ * and get the destination schema, is required state and optional oneOf/anyOf options for it. If the destination
1349
+ * schema was located along with oneOf/anyOf options then a `LayoutMultiSchemaField` will be rendered with the
1350
+ * `uiSchema`, `errorSchema`, `idSchema` and `formData` drilled down to the dotted-path field, spreading any other
1351
+ * props from `gridSchema` into the `ui:options`. If the destination schema located without any oneOf/anyOf options,
1352
+ * then a `SchemaField` will be rendered with the same props as mentioned in the previous sentence. If no destination
1353
+ * schema was located, but a custom render component was found, then it will be rendered with many of the non-event
1354
+ * handling props. If none of the previous render paths are valid, then a null is returned.
1355
+ *
1356
+ * @param gridSchema - The string or object that represents the configuration for the grid field
1357
+ * @returns - One of `LayoutMultiSchemaField`, `SchemaField`, a custom render component or null, depending
1358
+ */
1359
+ renderField(gridSchema) {
1360
+ const {
1361
+ schema: initialSchema,
1362
+ uiSchema,
1363
+ errorSchema,
1364
+ idSchema,
1365
+ onBlur,
1366
+ onFocus,
1367
+ formData,
1368
+ readonly,
1369
+ registry,
1370
+ idSeparator,
1371
+ layoutGridSchema,
1372
+ // Used to pull this out of otherProps since we don't want to pass it through
1373
+ ...otherProps
1374
+ } = this.props;
1375
+ const { fields: fields2, schemaUtils } = registry;
1376
+ const { SchemaField: SchemaField2, LayoutMultiSchemaField: LayoutMultiSchemaField2 } = fields2;
1377
+ const uiComponentProps = _LayoutGridField.computeUIComponentPropsFromGridSchema(registry, gridSchema);
1378
+ if (uiComponentProps.rendered) {
1379
+ return uiComponentProps.rendered;
1380
+ }
1381
+ const { name, UIComponent, uiProps } = uiComponentProps;
1382
+ const {
1383
+ schema,
1384
+ isRequired,
1385
+ isReadonly,
1386
+ optionsInfo,
1387
+ idSchema: fieldIdSchema
1388
+ } = _LayoutGridField.getSchemaDetailsForField(
1389
+ schemaUtils,
1390
+ name,
1391
+ initialSchema,
1392
+ formData,
1393
+ idSchema,
1394
+ idSeparator
1395
+ );
1396
+ if (schema) {
1397
+ const Field = optionsInfo?.hasDiscriminator ? LayoutMultiSchemaField2 : SchemaField2;
1398
+ const { fieldUiSchema, uiReadonly } = _LayoutGridField.computeFieldUiSchema(
1399
+ name,
1400
+ uiProps,
1401
+ uiSchema,
1402
+ isReadonly,
1403
+ readonly
1404
+ );
1405
+ return /* @__PURE__ */ jsx3(
1406
+ Field,
1407
+ {
1408
+ "data-testid": optionsInfo?.hasDiscriminator ? _LayoutGridField.TEST_IDS.layoutMultiSchemaField : _LayoutGridField.TEST_IDS.field,
1409
+ ...otherProps,
1410
+ name,
1411
+ required: isRequired,
1412
+ readonly: uiReadonly,
1413
+ schema,
1414
+ uiSchema: fieldUiSchema,
1415
+ errorSchema: get2(errorSchema, name),
1416
+ idSchema: fieldIdSchema,
1417
+ idSeparator,
1418
+ formData: get2(formData, name),
1419
+ onChange: this.onFieldChange(name),
1420
+ onBlur,
1421
+ onFocus,
1422
+ options: optionsInfo?.options,
1423
+ registry
1424
+ }
1425
+ );
1426
+ }
1427
+ if (UIComponent) {
1428
+ return /* @__PURE__ */ jsx3(
1429
+ UIComponent,
1430
+ {
1431
+ "data-testid": _LayoutGridField.TEST_IDS.uiComponent,
1432
+ ...otherProps,
1433
+ name,
1434
+ required: isRequired,
1435
+ formData,
1436
+ readOnly: !!isReadonly || readonly,
1437
+ errorSchema,
1438
+ uiSchema,
1439
+ schema: initialSchema,
1440
+ idSchema,
1441
+ idSeparator,
1442
+ onBlur,
1443
+ onFocus,
1444
+ registry,
1445
+ ...uiProps
1446
+ }
1447
+ );
1448
+ }
1449
+ return null;
1450
+ }
1451
+ /** Renders the `LayoutGridField`. If there isn't a `layoutGridSchema` prop defined, then try pulling it out of the
1452
+ * `uiSchema` via `ui:LayoutGridField`. If `layoutGridSchema` is an object, then check to see if any of the properties
1453
+ * match one of the `GridType`s. If so, call the appropriate render function for the type. Otherwise, just call the
1454
+ * generic `renderField()` function with the `layoutGridSchema`.
1455
+ *
1456
+ * @returns - the rendered `LayoutGridField`
1457
+ */
1458
+ render() {
1459
+ const { uiSchema } = this.props;
1460
+ let { layoutGridSchema } = this.props;
1461
+ const uiOptions = getUiOptions3(uiSchema);
1462
+ if (!layoutGridSchema && LAYOUT_GRID_UI_OPTION in uiOptions && isObject3(uiOptions[LAYOUT_GRID_UI_OPTION])) {
1463
+ layoutGridSchema = uiOptions[LAYOUT_GRID_UI_OPTION];
1464
+ }
1465
+ if (isObject3(layoutGridSchema)) {
1466
+ if ("ui:row" /* ROW */ in layoutGridSchema) {
1467
+ return this.renderRow(layoutGridSchema);
1468
+ }
1469
+ if ("ui:col" /* COLUMN */ in layoutGridSchema) {
1470
+ return this.renderCol(layoutGridSchema);
1471
+ }
1472
+ if ("ui:columns" /* COLUMNS */ in layoutGridSchema) {
1473
+ return this.renderColumns(layoutGridSchema);
1474
+ }
1475
+ if ("ui:condition" /* CONDITION */ in layoutGridSchema) {
1476
+ return this.renderCondition(layoutGridSchema);
1477
+ }
1478
+ }
1479
+ return this.renderField(layoutGridSchema);
1480
+ }
1481
+ };
1482
+
1483
+ // src/components/fields/LayoutHeaderField.tsx
1484
+ import {
1485
+ getTemplate as getTemplate3,
1486
+ getUiOptions as getUiOptions4,
1487
+ titleId
1488
+ } from "@rjsf/utils";
1489
+ import { jsx as jsx4 } from "react/jsx-runtime";
1490
+ function LayoutHeaderField(props) {
1491
+ const { idSchema, title, schema, uiSchema, required, registry, name } = props;
1492
+ const options = getUiOptions4(uiSchema, registry.globalUiOptions);
1493
+ const { title: uiTitle } = options;
1494
+ const { title: schemaTitle } = schema;
1495
+ const fieldTitle = uiTitle || title || schemaTitle || name;
1496
+ if (!fieldTitle) {
1497
+ return null;
1498
+ }
1499
+ const TitleFieldTemplate = getTemplate3(
1500
+ "TitleFieldTemplate",
1501
+ registry,
1502
+ options
1503
+ );
1504
+ return /* @__PURE__ */ jsx4(
1505
+ TitleFieldTemplate,
1506
+ {
1507
+ id: titleId(idSchema),
1508
+ title: fieldTitle,
1509
+ required,
1510
+ schema,
1511
+ uiSchema,
1512
+ registry
1513
+ }
1514
+ );
1515
+ }
1516
+
1517
+ // src/components/fields/LayoutMultiSchemaField.tsx
1518
+ import { useState, useEffect } from "react";
1519
+ import {
1520
+ ANY_OF_KEY as ANY_OF_KEY2,
1521
+ CONST_KEY,
1522
+ DEFAULT_KEY,
1523
+ ERRORS_KEY,
1524
+ getDiscriminatorFieldFromSchema as getDiscriminatorFieldFromSchema2,
1525
+ hashObject as hashObject2,
1526
+ ID_KEY as ID_KEY2,
1527
+ ONE_OF_KEY as ONE_OF_KEY2,
1528
+ optionsList as optionsList3,
1529
+ PROPERTIES_KEY as PROPERTIES_KEY2,
1530
+ getTemplate as getTemplate4,
1531
+ getUiOptions as getUiOptions5,
1532
+ getWidget as getWidget3
1533
+ } from "@rjsf/utils";
1534
+ import get3 from "lodash/get";
1535
+ import has2 from "lodash/has";
1536
+ import isEmpty2 from "lodash/isEmpty";
1537
+ import noop from "lodash/noop";
1538
+ import omit from "lodash/omit";
1539
+ import set3 from "lodash/set";
1540
+ import { jsx as jsx5 } from "react/jsx-runtime";
1541
+ function getSelectedOption(options, selectorField, value) {
1542
+ const defaultValue = "!@#!@$@#$!@$#";
1543
+ const schemaOptions = options.map(({ schema }) => schema);
1544
+ return schemaOptions.find((option) => {
1545
+ const selector = get3(option, [PROPERTIES_KEY2, selectorField]);
1546
+ const result = get3(selector, DEFAULT_KEY, get3(selector, CONST_KEY, defaultValue));
1547
+ return result === value;
1548
+ });
1549
+ }
1550
+ function computeEnumOptions(schema, options, schemaUtils, uiSchema, formData) {
1551
+ const realOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
1552
+ let tempSchema = schema;
1553
+ if (has2(schema, ONE_OF_KEY2)) {
1554
+ tempSchema = { ...schema, [ONE_OF_KEY2]: realOptions };
1555
+ } else if (has2(schema, ANY_OF_KEY2)) {
1556
+ tempSchema = { ...schema, [ANY_OF_KEY2]: realOptions };
1557
+ }
1558
+ const enumOptions = optionsList3(tempSchema, uiSchema);
1559
+ if (!enumOptions) {
1560
+ throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(tempSchema)}`);
1561
+ }
1562
+ return enumOptions;
1563
+ }
1564
+ function LayoutMultiSchemaField(props) {
1565
+ const {
1566
+ name,
1567
+ baseType,
1568
+ disabled = false,
1569
+ formData,
1570
+ idSchema,
1571
+ onBlur,
1572
+ onChange,
1573
+ options,
1574
+ onFocus,
1575
+ registry,
1576
+ uiSchema,
1577
+ schema,
1578
+ formContext,
1579
+ autofocus,
1580
+ readonly,
1581
+ required,
1582
+ errorSchema,
1583
+ hideError = false
1584
+ } = props;
1585
+ const { widgets: widgets2, schemaUtils, globalUiOptions } = registry;
1586
+ const [enumOptions, setEnumOptions] = useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1587
+ const id = get3(idSchema, ID_KEY2);
1588
+ const discriminator = getDiscriminatorFieldFromSchema2(schema);
1589
+ const FieldErrorTemplate2 = getTemplate4("FieldErrorTemplate", registry, options);
1590
+ const FieldTemplate2 = getTemplate4("FieldTemplate", registry, options);
1591
+ const schemaHash = hashObject2(schema);
1592
+ const optionsHash = hashObject2(options);
1593
+ const uiSchemaHash = uiSchema ? hashObject2(uiSchema) : "";
1594
+ const formDataHash = formData ? hashObject2(formData) : "";
1595
+ useEffect(() => {
1596
+ setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
1597
+ }, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
1598
+ const {
1599
+ widget = discriminator ? "radio" : "select",
1600
+ title = "",
1601
+ placeholder = "",
1602
+ optionsSchemaSelector: selectorField = discriminator,
1603
+ hideError: uiSchemaHideError,
1604
+ ...uiOptions
1605
+ } = getUiOptions5(uiSchema);
1606
+ if (!selectorField) {
1607
+ throw new Error("No selector field provided for the LayoutMultiSchemaField");
1608
+ }
1609
+ const selectedOption = get3(formData, selectorField);
1610
+ let optionSchema = get3(enumOptions[0]?.schema, [PROPERTIES_KEY2, selectorField], {});
1611
+ const option = getSelectedOption(enumOptions, selectorField, selectedOption);
1612
+ optionSchema = optionSchema?.type ? optionSchema : { ...optionSchema, type: option?.type || baseType };
1613
+ const Widget = getWidget3(optionSchema, widget, widgets2);
1614
+ const hideFieldError = uiSchemaHideError === void 0 ? hideError : Boolean(uiSchemaHideError);
1615
+ const rawErrors = get3(errorSchema, [ERRORS_KEY], []);
1616
+ const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);
1617
+ const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1618
+ const onOptionChange = (opt) => {
1619
+ const newOption = getSelectedOption(enumOptions, selectorField, opt);
1620
+ const oldOption = getSelectedOption(enumOptions, selectorField, selectedOption);
1621
+ let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
1622
+ if (newFormData && newOption) {
1623
+ newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
1624
+ }
1625
+ if (newFormData) {
1626
+ set3(newFormData, selectorField, opt);
1627
+ }
1628
+ onChange(newFormData, void 0, id);
1629
+ };
1630
+ const widgetOptions = { enumOptions, ...uiOptions };
1631
+ const errors = !hideFieldError && rawErrors.length > 0 ? /* @__PURE__ */ jsx5(FieldErrorTemplate2, { idSchema, schema, errors: rawErrors, registry }) : void 0;
1632
+ const ignored = (value) => noop;
1633
+ return /* @__PURE__ */ jsx5(
1634
+ FieldTemplate2,
1635
+ {
1636
+ id,
1637
+ schema,
1638
+ label: (title || schema.title) ?? "",
1639
+ disabled: disabled || Array.isArray(enumOptions) && isEmpty2(enumOptions),
1640
+ uiSchema,
1641
+ formContext,
1642
+ required,
1643
+ readonly: !!readonly,
1644
+ registry,
1645
+ displayLabel,
1646
+ errors,
1647
+ onChange,
1648
+ onDropPropertyClick: ignored,
1649
+ onKeyChange: ignored,
1650
+ children: /* @__PURE__ */ jsx5(
1651
+ Widget,
1652
+ {
1653
+ id,
1654
+ name,
1655
+ schema,
1656
+ label: (title || schema.title) ?? "",
1657
+ disabled: disabled || Array.isArray(enumOptions) && isEmpty2(enumOptions),
1658
+ uiSchema,
1659
+ formContext,
1660
+ autofocus,
1661
+ readonly,
1662
+ required,
1663
+ registry,
1664
+ multiple: false,
1665
+ rawErrors,
1666
+ hideError: hideFieldError,
1667
+ hideLabel: !displayLabel,
1668
+ errorSchema: fieldErrorSchema,
1669
+ placeholder,
1670
+ onChange: onOptionChange,
1671
+ onBlur,
1672
+ onFocus,
1673
+ value: selectedOption,
1674
+ options: widgetOptions
1675
+ }
1676
+ )
1677
+ }
1678
+ );
1679
+ }
1680
+
1681
+ // src/components/fields/MultiSchemaField.tsx
1682
+ import { Component as Component2 } from "react";
1683
+ import get4 from "lodash/get";
1684
+ import isEmpty3 from "lodash/isEmpty";
1685
+ import omit2 from "lodash/omit";
1686
+ import {
1687
+ ANY_OF_KEY as ANY_OF_KEY3,
1688
+ deepEquals,
1689
+ ERRORS_KEY as ERRORS_KEY2,
1690
+ getDiscriminatorFieldFromSchema as getDiscriminatorFieldFromSchema3,
1691
+ getUiOptions as getUiOptions6,
1692
+ getWidget as getWidget4,
1693
+ mergeSchemas,
1694
+ ONE_OF_KEY as ONE_OF_KEY3,
1695
+ TranslatableString as TranslatableString3
1696
+ } from "@rjsf/utils";
1697
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
1698
+ var AnyOfField = class extends Component2 {
1699
+ /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
1700
+ *
1701
+ * @param props - The `FieldProps` for this template
1702
+ */
1703
+ constructor(props) {
1704
+ super(props);
1705
+ const {
1706
+ formData,
1707
+ options,
1708
+ registry: { schemaUtils }
1709
+ } = this.props;
1710
+ const retrievedOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
1711
+ this.state = {
1712
+ retrievedOptions,
1713
+ selectedOption: this.getMatchingOption(0, formData, retrievedOptions)
1714
+ };
1715
+ }
1716
+ /** React lifecycle method that is called when the props and/or state for this component is updated. It recomputes the
1717
+ * currently selected option based on the overall `formData`
1718
+ *
1719
+ * @param prevProps - The previous `FieldProps` for this template
1720
+ * @param prevState - The previous `AnyOfFieldState` for this template
1721
+ */
1722
+ componentDidUpdate(prevProps, prevState) {
1723
+ const { formData, options, idSchema } = this.props;
1724
+ const { selectedOption } = this.state;
1725
+ let newState = this.state;
1726
+ if (!deepEquals(prevProps.options, options)) {
1727
+ const {
1728
+ registry: { schemaUtils }
1729
+ } = this.props;
1730
+ const retrievedOptions = options.map((opt) => schemaUtils.retrieveSchema(opt, formData));
1731
+ newState = { selectedOption, retrievedOptions };
1732
+ }
1733
+ if (!deepEquals(formData, prevProps.formData) && idSchema.$id === prevProps.idSchema.$id) {
1734
+ const { retrievedOptions } = newState;
1735
+ const matchingOption = this.getMatchingOption(selectedOption, formData, retrievedOptions);
1736
+ if (prevState && matchingOption !== selectedOption) {
1737
+ newState = { selectedOption: matchingOption, retrievedOptions };
1738
+ }
1739
+ }
1740
+ if (newState !== this.state) {
1741
+ this.setState(newState);
1742
+ }
1743
+ }
1744
+ /** Determines the best matching option for the given `formData` and `options`.
1745
+ *
1746
+ * @param formData - The new formData
1747
+ * @param options - The list of options to choose from
1748
+ * @return - The index of the `option` that best matches the `formData`
1749
+ */
1750
+ getMatchingOption(selectedOption, formData, options) {
1751
+ const {
1752
+ schema,
1753
+ registry: { schemaUtils }
1754
+ } = this.props;
1755
+ const discriminator = getDiscriminatorFieldFromSchema3(schema);
1756
+ const option = schemaUtils.getClosestMatchingOption(formData, options, selectedOption, discriminator);
1757
+ return option;
1758
+ }
1759
+ /** Callback handler to remember what the currently selected option is. In addition to that the `formData` is updated
1760
+ * to remove properties that are not part of the newly selected option schema, and then the updated data is passed to
1761
+ * the `onChange` handler.
1762
+ *
1763
+ * @param option - The new option value being selected
1764
+ */
1765
+ onOptionChange = (option) => {
1766
+ const { selectedOption, retrievedOptions } = this.state;
1767
+ const { formData, onChange, registry } = this.props;
1768
+ const { schemaUtils } = registry;
1769
+ const intOption = option !== void 0 ? parseInt(option, 10) : -1;
1770
+ if (intOption === selectedOption) {
1771
+ return;
1772
+ }
1773
+ const newOption = intOption >= 0 ? retrievedOptions[intOption] : void 0;
1774
+ const oldOption = selectedOption >= 0 ? retrievedOptions[selectedOption] : void 0;
1775
+ let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
1776
+ if (newOption) {
1777
+ newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, "excludeObjectChildren");
1778
+ }
1779
+ this.setState({ selectedOption: intOption }, () => {
1780
+ onChange(newFormData, void 0, this.getFieldId());
1781
+ });
1782
+ };
1783
+ getFieldId() {
1784
+ const { idSchema, schema } = this.props;
1785
+ return `${idSchema.$id}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`;
1786
+ }
1787
+ /** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
1788
+ */
1789
+ render() {
1790
+ const {
1791
+ name,
1792
+ disabled = false,
1793
+ errorSchema = {},
1794
+ formContext,
1795
+ onBlur,
1796
+ onFocus,
1797
+ readonly,
1798
+ registry,
1799
+ schema,
1800
+ uiSchema
1801
+ } = this.props;
1802
+ const { widgets: widgets2, fields: fields2, translateString, globalUiOptions, schemaUtils } = registry;
1803
+ const { SchemaField: _SchemaField } = fields2;
1804
+ const { selectedOption, retrievedOptions } = this.state;
1805
+ const {
1806
+ widget = "select",
1807
+ placeholder,
1808
+ autofocus,
1809
+ autocomplete,
1810
+ title = schema.title,
1811
+ ...uiOptions
1812
+ } = getUiOptions6(uiSchema, globalUiOptions);
1813
+ const Widget = getWidget4({ type: "number" }, widget, widgets2);
1814
+ const rawErrors = get4(errorSchema, ERRORS_KEY2, []);
1815
+ const fieldErrorSchema = omit2(errorSchema, [ERRORS_KEY2]);
1816
+ const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1817
+ const option = selectedOption >= 0 ? retrievedOptions[selectedOption] || null : null;
1818
+ let optionSchema;
1819
+ if (option) {
1820
+ const { required } = schema;
1821
+ optionSchema = required ? mergeSchemas({ required }, option) : option;
1822
+ }
1823
+ let optionsUiSchema = [];
1824
+ if (ONE_OF_KEY3 in schema && uiSchema && ONE_OF_KEY3 in uiSchema) {
1825
+ if (Array.isArray(uiSchema[ONE_OF_KEY3])) {
1826
+ optionsUiSchema = uiSchema[ONE_OF_KEY3];
1827
+ } else {
1828
+ console.warn(`uiSchema.oneOf is not an array for "${title || name}"`);
1829
+ }
1830
+ } else if (ANY_OF_KEY3 in schema && uiSchema && ANY_OF_KEY3 in uiSchema) {
1831
+ if (Array.isArray(uiSchema[ANY_OF_KEY3])) {
1832
+ optionsUiSchema = uiSchema[ANY_OF_KEY3];
1833
+ } else {
1834
+ console.warn(`uiSchema.anyOf is not an array for "${title || name}"`);
1835
+ }
1836
+ }
1837
+ let optionUiSchema = uiSchema;
1838
+ if (selectedOption >= 0 && optionsUiSchema.length > selectedOption) {
1839
+ optionUiSchema = optionsUiSchema[selectedOption];
1840
+ }
1841
+ const translateEnum = title ? TranslatableString3.TitleOptionPrefix : TranslatableString3.OptionPrefix;
1842
+ const translateParams = title ? [title] : [];
1843
+ const enumOptions = retrievedOptions.map((opt, index) => {
1844
+ const { title: uiTitle = opt.title } = getUiOptions6(optionsUiSchema[index]);
1845
+ return {
1846
+ label: uiTitle || translateString(translateEnum, translateParams.concat(String(index + 1))),
1847
+ value: index
1848
+ };
1849
+ });
1850
+ return /* @__PURE__ */ jsxs("div", { className: "panel panel-default panel-body", children: [
1851
+ /* @__PURE__ */ jsx6("div", { className: "form-group", children: /* @__PURE__ */ jsx6(
1852
+ Widget,
1853
+ {
1094
1854
  id: this.getFieldId(),
1095
1855
  name: `${name}${schema.oneOf ? "__oneof_select" : "__anyof_select"}`,
1096
1856
  schema: { type: "number", default: 0 },
1097
1857
  onChange: this.onOptionChange,
1098
1858
  onBlur,
1099
1859
  onFocus,
1100
- disabled: disabled || isEmpty(enumOptions),
1860
+ disabled: disabled || isEmpty3(enumOptions),
1101
1861
  multiple: false,
1102
1862
  rawErrors,
1103
1863
  errorSchema: fieldErrorSchema,
@@ -1109,196 +1869,74 @@ var AnyOfField = class extends Component2 {
1109
1869
  autocomplete,
1110
1870
  autofocus,
1111
1871
  label: title ?? name,
1112
- hideLabel: !displayLabel
1872
+ hideLabel: !displayLabel,
1873
+ readonly
1113
1874
  }
1114
1875
  ) }),
1115
- optionSchema && /* @__PURE__ */ jsx3(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema })
1876
+ optionSchema && optionSchema.type !== "null" && /* @__PURE__ */ jsx6(_SchemaField, { ...this.props, schema: optionSchema, uiSchema: optionUiSchema })
1116
1877
  ] });
1117
1878
  }
1118
1879
  };
1119
1880
  var MultiSchemaField_default = AnyOfField;
1120
1881
 
1121
1882
  // src/components/fields/NumberField.tsx
1122
- import { useState, useCallback } from "react";
1883
+ import { useState as useState2, useCallback } from "react";
1123
1884
  import { asNumber } from "@rjsf/utils";
1124
- import { jsx as jsx4 } from "react/jsx-runtime";
1885
+ import { jsx as jsx7 } from "react/jsx-runtime";
1125
1886
  var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
1126
1887
  var trailingCharMatcher = /[0.]0*$/;
1127
1888
  function NumberField(props) {
1128
1889
  const { registry, onChange, formData, value: initialValue } = props;
1129
- const [lastValue, setLastValue] = useState(initialValue);
1890
+ const [lastValue, setLastValue] = useState2(initialValue);
1130
1891
  const { StringField: StringField2 } = registry.fields;
1131
1892
  let value = formData;
1132
1893
  const handleChange = useCallback(
1133
- (value2) => {
1894
+ (value2, errorSchema, id) => {
1134
1895
  setLastValue(value2);
1135
1896
  if (`${value2}`.charAt(0) === ".") {
1136
1897
  value2 = `0${value2}`;
1137
1898
  }
1138
1899
  const processed = typeof value2 === "string" && value2.match(trailingCharMatcherWithPrefix) ? asNumber(value2.replace(trailingCharMatcher, "")) : asNumber(value2);
1139
- onChange(processed);
1900
+ onChange(processed, errorSchema, id);
1140
1901
  },
1141
1902
  [onChange]
1142
- );
1143
- if (typeof lastValue === "string" && typeof value === "number") {
1144
- const re = new RegExp(`^(${String(value).replace(".", "\\.")})?\\.?0*$`);
1145
- if (lastValue.match(re)) {
1146
- value = lastValue;
1147
- }
1148
- }
1149
- return /* @__PURE__ */ jsx4(StringField2, { ...props, formData: value, onChange: handleChange });
1150
- }
1151
- var NumberField_default = NumberField;
1152
-
1153
- // src/components/fields/ObjectField.tsx
1154
- import { Component as Component3 } from "react";
1155
- import {
1156
- getTemplate as getTemplate2,
1157
- getUiOptions as getUiOptions4,
1158
- orderProperties,
1159
- TranslatableString as TranslatableString4,
1160
- ADDITIONAL_PROPERTY_FLAG,
1161
- PROPERTIES_KEY,
1162
- REF_KEY,
1163
- ANY_OF_KEY as ANY_OF_KEY2,
1164
- ONE_OF_KEY as ONE_OF_KEY2
1165
- } from "@rjsf/utils";
1166
- import Markdown from "markdown-to-jsx";
1167
- import get3 from "lodash/get";
1168
- import has from "lodash/has";
1169
- import isObject3 from "lodash/isObject";
1170
- import set2 from "lodash/set";
1171
- import unset from "lodash/unset";
1172
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1173
- var ObjectField = class extends Component3 {
1174
- constructor() {
1175
- super(...arguments);
1176
- /** Set up the initial state */
1177
- this.state = {
1178
- wasPropertyKeyModified: false,
1179
- additionalProperties: {}
1180
- };
1181
- /** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting
1182
- * to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated
1183
- * formData.
1184
- *
1185
- * @param name - The name of the property
1186
- * @param addedByAdditionalProperties - Flag indicating whether this property is an additional property
1187
- * @returns - The onPropertyChange callback for the `name` property
1188
- */
1189
- this.onPropertyChange = (name, addedByAdditionalProperties = false) => {
1190
- return (value, newErrorSchema, id) => {
1191
- const { formData, onChange, errorSchema } = this.props;
1192
- if (value === void 0 && addedByAdditionalProperties) {
1193
- value = "";
1194
- }
1195
- const newFormData = { ...formData, [name]: value };
1196
- onChange(
1197
- newFormData,
1198
- errorSchema && errorSchema && {
1199
- ...errorSchema,
1200
- [name]: newErrorSchema
1201
- },
1202
- id
1203
- );
1204
- };
1205
- };
1206
- /** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data
1207
- * and calls the `onChange` callback with it
1208
- *
1209
- * @param key - The key for which the drop callback is desired
1210
- * @returns - The drop property click callback
1211
- */
1212
- this.onDropPropertyClick = (key) => {
1213
- return (event) => {
1214
- event.preventDefault();
1215
- const { onChange, formData } = this.props;
1216
- const copiedFormData = { ...formData };
1217
- unset(copiedFormData, key);
1218
- onChange(copiedFormData);
1219
- };
1220
- };
1221
- /** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
1222
- * that is already not assigned is found.
1223
- *
1224
- * @param preferredKey - The preferred name of a new key
1225
- * @param [formData] - The form data in which to check if the desired key already exists
1226
- * @returns - The name of the next available key from `preferredKey`
1227
- */
1228
- this.getAvailableKey = (preferredKey, formData) => {
1229
- const { uiSchema, registry } = this.props;
1230
- const { duplicateKeySuffixSeparator = "-" } = getUiOptions4(uiSchema, registry.globalUiOptions);
1231
- let index = 0;
1232
- let newKey = preferredKey;
1233
- while (has(formData, newKey)) {
1234
- newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
1235
- }
1236
- return newKey;
1237
- };
1238
- /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
1239
- * callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.
1240
- *
1241
- * @param oldValue - The old value of a field
1242
- * @returns - The key change callback function
1243
- */
1244
- this.onKeyChange = (oldValue) => {
1245
- return (value, newErrorSchema) => {
1246
- if (oldValue === value) {
1247
- return;
1248
- }
1249
- const { formData, onChange, errorSchema } = this.props;
1250
- value = this.getAvailableKey(value, formData);
1251
- const newFormData = {
1252
- ...formData
1253
- };
1254
- const newKeys = { [oldValue]: value };
1255
- const keyValues = Object.keys(newFormData).map((key) => {
1256
- const newKey = newKeys[key] || key;
1257
- return { [newKey]: newFormData[key] };
1258
- });
1259
- const renamedObj = Object.assign({}, ...keyValues);
1260
- this.setState({ wasPropertyKeyModified: true });
1261
- onChange(
1262
- renamedObj,
1263
- errorSchema && errorSchema && {
1264
- ...errorSchema,
1265
- [value]: newErrorSchema
1266
- }
1267
- );
1268
- };
1269
- };
1270
- /** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new
1271
- * default data for that field has been added to the formData.
1272
- *
1273
- * @param schema - The schema element to which the new property is being added
1274
- */
1275
- this.handleAddClick = (schema) => () => {
1276
- if (!schema.additionalProperties) {
1277
- return;
1278
- }
1279
- const { formData, onChange, registry } = this.props;
1280
- const newFormData = { ...formData };
1281
- let type = void 0;
1282
- let defaultValue = void 0;
1283
- if (isObject3(schema.additionalProperties)) {
1284
- type = schema.additionalProperties.type;
1285
- defaultValue = schema.additionalProperties.default;
1286
- let apSchema = schema.additionalProperties;
1287
- if (REF_KEY in apSchema) {
1288
- const { schemaUtils } = registry;
1289
- apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
1290
- type = apSchema.type;
1291
- defaultValue = apSchema.default;
1292
- }
1293
- if (!type && (ANY_OF_KEY2 in apSchema || ONE_OF_KEY2 in apSchema)) {
1294
- type = "object";
1295
- }
1296
- }
1297
- const newKey = this.getAvailableKey("newKey", newFormData);
1298
- set2(newFormData, newKey, defaultValue ?? this.getDefaultValue(type));
1299
- onChange(newFormData);
1300
- };
1903
+ );
1904
+ if (typeof lastValue === "string" && typeof value === "number") {
1905
+ const re = new RegExp(`^(${String(value).replace(".", "\\.")})?\\.?0*$`);
1906
+ if (lastValue.match(re)) {
1907
+ value = lastValue;
1908
+ }
1301
1909
  }
1910
+ return /* @__PURE__ */ jsx7(StringField2, { ...props, formData: value, onChange: handleChange });
1911
+ }
1912
+ var NumberField_default = NumberField;
1913
+
1914
+ // src/components/fields/ObjectField.tsx
1915
+ import { Component as Component3 } from "react";
1916
+ import {
1917
+ getTemplate as getTemplate5,
1918
+ getUiOptions as getUiOptions7,
1919
+ orderProperties,
1920
+ TranslatableString as TranslatableString4,
1921
+ ADDITIONAL_PROPERTY_FLAG,
1922
+ PROPERTIES_KEY as PROPERTIES_KEY3,
1923
+ REF_KEY,
1924
+ ANY_OF_KEY as ANY_OF_KEY4,
1925
+ ONE_OF_KEY as ONE_OF_KEY4
1926
+ } from "@rjsf/utils";
1927
+ import Markdown from "markdown-to-jsx";
1928
+ import get5 from "lodash/get";
1929
+ import has3 from "lodash/has";
1930
+ import isObject4 from "lodash/isObject";
1931
+ import set4 from "lodash/set";
1932
+ import unset from "lodash/unset";
1933
+ import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
1934
+ var ObjectField = class extends Component3 {
1935
+ /** Set up the initial state */
1936
+ state = {
1937
+ wasPropertyKeyModified: false,
1938
+ additionalProperties: {}
1939
+ };
1302
1940
  /** Returns a flag indicating whether the `name` field is required in the object schema
1303
1941
  *
1304
1942
  * @param name - The name of the field to check for required-ness
@@ -1308,6 +1946,95 @@ var ObjectField = class extends Component3 {
1308
1946
  const { schema } = this.props;
1309
1947
  return Array.isArray(schema.required) && schema.required.indexOf(name) !== -1;
1310
1948
  }
1949
+ /** Returns the `onPropertyChange` handler for the `name` field. Handles the special case where a user is attempting
1950
+ * to clear the data for a field added as an additional property. Calls the `onChange()` handler with the updated
1951
+ * formData.
1952
+ *
1953
+ * @param name - The name of the property
1954
+ * @param addedByAdditionalProperties - Flag indicating whether this property is an additional property
1955
+ * @returns - The onPropertyChange callback for the `name` property
1956
+ */
1957
+ onPropertyChange = (name, addedByAdditionalProperties = false) => {
1958
+ return (value, newErrorSchema, id) => {
1959
+ const { formData, onChange, errorSchema } = this.props;
1960
+ if (value === void 0 && addedByAdditionalProperties) {
1961
+ value = "";
1962
+ }
1963
+ const newFormData = { ...formData, [name]: value };
1964
+ onChange(
1965
+ newFormData,
1966
+ errorSchema && errorSchema && {
1967
+ ...errorSchema,
1968
+ [name]: newErrorSchema
1969
+ },
1970
+ id
1971
+ );
1972
+ };
1973
+ };
1974
+ /** Returns a callback to handle the onDropPropertyClick event for the given `key` which removes the old `key` data
1975
+ * and calls the `onChange` callback with it
1976
+ *
1977
+ * @param key - The key for which the drop callback is desired
1978
+ * @returns - The drop property click callback
1979
+ */
1980
+ onDropPropertyClick = (key) => {
1981
+ return (event) => {
1982
+ event.preventDefault();
1983
+ const { onChange, formData } = this.props;
1984
+ const copiedFormData = { ...formData };
1985
+ unset(copiedFormData, key);
1986
+ onChange(copiedFormData);
1987
+ };
1988
+ };
1989
+ /** Computes the next available key name from the `preferredKey`, indexing through the already existing keys until one
1990
+ * that is already not assigned is found.
1991
+ *
1992
+ * @param preferredKey - The preferred name of a new key
1993
+ * @param [formData] - The form data in which to check if the desired key already exists
1994
+ * @returns - The name of the next available key from `preferredKey`
1995
+ */
1996
+ getAvailableKey = (preferredKey, formData) => {
1997
+ const { uiSchema, registry } = this.props;
1998
+ const { duplicateKeySuffixSeparator = "-" } = getUiOptions7(uiSchema, registry.globalUiOptions);
1999
+ let index = 0;
2000
+ let newKey = preferredKey;
2001
+ while (has3(formData, newKey)) {
2002
+ newKey = `${preferredKey}${duplicateKeySuffixSeparator}${++index}`;
2003
+ }
2004
+ return newKey;
2005
+ };
2006
+ /** Returns a callback function that deals with the rename of a key for an additional property for a schema. That
2007
+ * callback will attempt to rename the key and move the existing data to that key, calling `onChange` when it does.
2008
+ *
2009
+ * @param oldValue - The old value of a field
2010
+ * @returns - The key change callback function
2011
+ */
2012
+ onKeyChange = (oldValue) => {
2013
+ return (value, newErrorSchema) => {
2014
+ if (oldValue === value) {
2015
+ return;
2016
+ }
2017
+ const { formData, onChange, errorSchema } = this.props;
2018
+ value = this.getAvailableKey(value, formData);
2019
+ const newFormData = {
2020
+ ...formData
2021
+ };
2022
+ const newKeys = { [oldValue]: value };
2023
+ const keyValues = Object.keys(newFormData).map((key) => {
2024
+ const newKey = newKeys[key] || key;
2025
+ return { [newKey]: newFormData[key] };
2026
+ });
2027
+ const renamedObj = Object.assign({}, ...keyValues);
2028
+ this.setState({ wasPropertyKeyModified: true });
2029
+ onChange(
2030
+ renamedObj,
2031
+ errorSchema && errorSchema && {
2032
+ ...errorSchema,
2033
+ [value]: newErrorSchema
2034
+ }
2035
+ );
2036
+ };
2037
+ };
1311
2038
  /** Returns a default value to be used for a new additional schema property of the given `type`
1312
2039
  *
1313
2040
  * @param type - The type of the new additional schema property
@@ -1332,6 +2059,45 @@ var ObjectField = class extends Component3 {
1332
2059
  return translateString(TranslatableString4.NewStringDefault);
1333
2060
  }
1334
2061
  }
2062
+ /** Handles the adding of a new additional property on the given `schema`. Calls the `onChange` callback once the new
2063
+ * default data for that field has been added to the formData.
2064
+ *
2065
+ * @param schema - The schema element to which the new property is being added
2066
+ */
2067
+ handleAddClick = (schema) => () => {
2068
+ if (!(schema.additionalProperties || schema.patternProperties)) {
2069
+ return;
2070
+ }
2071
+ const { formData, onChange, registry } = this.props;
2072
+ const newFormData = { ...formData };
2073
+ const newKey = this.getAvailableKey("newKey", newFormData);
2074
+ if (schema.patternProperties) {
2075
+ set4(newFormData, newKey, null);
2076
+ } else {
2077
+ let type = void 0;
2078
+ let constValue = void 0;
2079
+ let defaultValue = void 0;
2080
+ if (isObject4(schema.additionalProperties)) {
2081
+ type = schema.additionalProperties.type;
2082
+ constValue = schema.additionalProperties.const;
2083
+ defaultValue = schema.additionalProperties.default;
2084
+ let apSchema = schema.additionalProperties;
2085
+ if (REF_KEY in apSchema) {
2086
+ const { schemaUtils } = registry;
2087
+ apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] }, formData);
2088
+ type = apSchema.type;
2089
+ constValue = apSchema.const;
2090
+ defaultValue = apSchema.default;
2091
+ }
2092
+ if (!type && (ANY_OF_KEY4 in apSchema || ONE_OF_KEY4 in apSchema)) {
2093
+ type = "object";
2094
+ }
2095
+ }
2096
+ const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
2097
+ set4(newFormData, newKey, newValue);
2098
+ }
2099
+ onChange(newFormData);
2100
+ };
1335
2101
  /** Renders the `ObjectField` from the given props
1336
2102
  */
1337
2103
  render() {
@@ -1356,7 +2122,7 @@ var ObjectField = class extends Component3 {
1356
2122
  const { fields: fields2, formContext, schemaUtils, translateString, globalUiOptions } = registry;
1357
2123
  const { SchemaField: SchemaField2 } = fields2;
1358
2124
  const schema = schemaUtils.retrieveSchema(rawSchema, formData);
1359
- const uiOptions = getUiOptions4(uiSchema, globalUiOptions);
2125
+ const uiOptions = getUiOptions7(uiSchema, globalUiOptions);
1360
2126
  const { properties: schemaProperties = {} } = schema;
1361
2127
  const templateTitle = uiOptions.title ?? schema.title ?? title ?? name;
1362
2128
  const description = uiOptions.description ?? schema.description;
@@ -1366,33 +2132,33 @@ var ObjectField = class extends Component3 {
1366
2132
  orderedProperties = orderProperties(properties, uiOptions.order);
1367
2133
  } catch (err) {
1368
2134
  return /* @__PURE__ */ jsxs2("div", { children: [
1369
- /* @__PURE__ */ jsx5("p", { className: "config-error", style: { color: "red" }, children: /* @__PURE__ */ jsx5(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString4.InvalidObjectField, [name || "root", err.message]) }) }),
1370
- /* @__PURE__ */ jsx5("pre", { children: JSON.stringify(schema) })
2135
+ /* @__PURE__ */ jsx8("p", { className: "rjsf-config-error", style: { color: "red" }, children: /* @__PURE__ */ jsx8(Markdown, { options: { disableParsingRawHTML: true }, children: translateString(TranslatableString4.InvalidObjectField, [name || "root", err.message]) }) }),
2136
+ /* @__PURE__ */ jsx8("pre", { children: JSON.stringify(schema) })
1371
2137
  ] });
1372
2138
  }
1373
- const Template = getTemplate2("ObjectFieldTemplate", registry, uiOptions);
2139
+ const Template = getTemplate5("ObjectFieldTemplate", registry, uiOptions);
1374
2140
  const templateProps = {
1375
2141
  // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
1376
2142
  title: uiOptions.label === false ? "" : templateTitle,
1377
2143
  description: uiOptions.label === false ? void 0 : description,
1378
2144
  properties: orderedProperties.map((name2) => {
1379
- const addedByAdditionalProperties = has(schema, [PROPERTIES_KEY, name2, ADDITIONAL_PROPERTY_FLAG]);
2145
+ const addedByAdditionalProperties = has3(schema, [PROPERTIES_KEY3, name2, ADDITIONAL_PROPERTY_FLAG]);
1380
2146
  const fieldUiSchema = addedByAdditionalProperties ? uiSchema.additionalProperties : uiSchema[name2];
1381
- const hidden = getUiOptions4(fieldUiSchema).widget === "hidden";
1382
- const fieldIdSchema = get3(idSchema, [name2], {});
2147
+ const hidden = getUiOptions7(fieldUiSchema).widget === "hidden";
2148
+ const fieldIdSchema = get5(idSchema, [name2], {});
1383
2149
  return {
1384
- content: /* @__PURE__ */ jsx5(
2150
+ content: /* @__PURE__ */ jsx8(
1385
2151
  SchemaField2,
1386
2152
  {
1387
2153
  name: name2,
1388
2154
  required: this.isRequired(name2),
1389
- schema: get3(schema, [PROPERTIES_KEY, name2], {}),
2155
+ schema: get5(schema, [PROPERTIES_KEY3, name2], {}),
1390
2156
  uiSchema: fieldUiSchema,
1391
- errorSchema: get3(errorSchema, name2),
2157
+ errorSchema: get5(errorSchema, name2),
1392
2158
  idSchema: fieldIdSchema,
1393
2159
  idPrefix,
1394
2160
  idSeparator,
1395
- formData: get3(formData, name2),
2161
+ formData: get5(formData, name2),
1396
2162
  formContext,
1397
2163
  wasPropertyKeyModified: this.state.wasPropertyKeyModified,
1398
2164
  onKeyChange: this.onKeyChange(name2),
@@ -1425,7 +2191,7 @@ var ObjectField = class extends Component3 {
1425
2191
  formContext,
1426
2192
  registry
1427
2193
  };
1428
- return /* @__PURE__ */ jsx5(Template, { ...templateProps, onAddClick: this.handleAddClick });
2194
+ return /* @__PURE__ */ jsx8(Template, { ...templateProps, onAddClick: this.handleAddClick });
1429
2195
  }
1430
2196
  };
1431
2197
  var ObjectField_default = ObjectField;
@@ -1437,17 +2203,16 @@ import {
1437
2203
  deepEquals as deepEquals2,
1438
2204
  descriptionId,
1439
2205
  getSchemaType,
1440
- getTemplate as getTemplate3,
1441
- getUiOptions as getUiOptions5,
1442
- ID_KEY,
1443
- mergeObjects,
2206
+ getTemplate as getTemplate6,
2207
+ getUiOptions as getUiOptions8,
2208
+ ID_KEY as ID_KEY3,
2209
+ mergeObjects as mergeObjects2,
1444
2210
  TranslatableString as TranslatableString5,
1445
- UI_OPTIONS_KEY
2211
+ UI_OPTIONS_KEY as UI_OPTIONS_KEY2
1446
2212
  } from "@rjsf/utils";
1447
- import isObject4 from "lodash/isObject";
1448
- import omit2 from "lodash/omit";
1449
- import Markdown2 from "markdown-to-jsx";
1450
- import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
2213
+ import isObject5 from "lodash/isObject";
2214
+ import omit3 from "lodash/omit";
2215
+ import { Fragment, jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
1451
2216
  var COMPONENT_TYPES = {
1452
2217
  array: "ArrayField",
1453
2218
  boolean: "BooleanField",
@@ -1477,12 +2242,12 @@ function getFieldComponent(schema, uiOptions, idSchema, registry) {
1477
2242
  return () => null;
1478
2243
  }
1479
2244
  return componentName in fields2 ? fields2[componentName] : () => {
1480
- const UnsupportedFieldTemplate = getTemplate3(
2245
+ const UnsupportedFieldTemplate = getTemplate6(
1481
2246
  "UnsupportedFieldTemplate",
1482
2247
  registry,
1483
2248
  uiOptions
1484
2249
  );
1485
- return /* @__PURE__ */ jsx6(
2250
+ return /* @__PURE__ */ jsx9(
1486
2251
  UnsupportedFieldTemplate,
1487
2252
  {
1488
2253
  schema,
@@ -1511,18 +2276,18 @@ function SchemaFieldRender(props) {
1511
2276
  wasPropertyKeyModified = false
1512
2277
  } = props;
1513
2278
  const { formContext, schemaUtils, globalUiOptions } = registry;
1514
- const uiOptions = getUiOptions5(uiSchema, globalUiOptions);
1515
- const FieldTemplate2 = getTemplate3("FieldTemplate", registry, uiOptions);
1516
- const DescriptionFieldTemplate = getTemplate3(
2279
+ const uiOptions = getUiOptions8(uiSchema, globalUiOptions);
2280
+ const FieldTemplate2 = getTemplate6("FieldTemplate", registry, uiOptions);
2281
+ const DescriptionFieldTemplate = getTemplate6(
1517
2282
  "DescriptionFieldTemplate",
1518
2283
  registry,
1519
2284
  uiOptions
1520
2285
  );
1521
- const FieldHelpTemplate2 = getTemplate3("FieldHelpTemplate", registry, uiOptions);
1522
- const FieldErrorTemplate2 = getTemplate3("FieldErrorTemplate", registry, uiOptions);
2286
+ const FieldHelpTemplate2 = getTemplate6("FieldHelpTemplate", registry, uiOptions);
2287
+ const FieldErrorTemplate2 = getTemplate6("FieldErrorTemplate", registry, uiOptions);
1523
2288
  const schema = schemaUtils.retrieveSchema(_schema, formData);
1524
- const fieldId = _idSchema[ID_KEY];
1525
- const idSchema = mergeObjects(
2289
+ const fieldId = _idSchema[ID_KEY3];
2290
+ const idSchema = mergeObjects2(
1526
2291
  schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator),
1527
2292
  _idSchema
1528
2293
  );
@@ -1544,11 +2309,11 @@ function SchemaFieldRender(props) {
1544
2309
  }
1545
2310
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1546
2311
  const { __errors, ...fieldErrorSchema } = errorSchema || {};
1547
- const fieldUiSchema = omit2(uiSchema, ["ui:classNames", "classNames", "ui:style"]);
1548
- if (UI_OPTIONS_KEY in fieldUiSchema) {
1549
- fieldUiSchema[UI_OPTIONS_KEY] = omit2(fieldUiSchema[UI_OPTIONS_KEY], ["classNames", "style"]);
2312
+ const fieldUiSchema = omit3(uiSchema, ["ui:classNames", "classNames", "ui:style"]);
2313
+ if (UI_OPTIONS_KEY2 in fieldUiSchema) {
2314
+ fieldUiSchema[UI_OPTIONS_KEY2] = omit3(fieldUiSchema[UI_OPTIONS_KEY2], ["classNames", "style"]);
1550
2315
  }
1551
- const field = /* @__PURE__ */ jsx6(
2316
+ const field = /* @__PURE__ */ jsx9(
1552
2317
  FieldComponent,
1553
2318
  {
1554
2319
  ...props,
@@ -1565,7 +2330,7 @@ function SchemaFieldRender(props) {
1565
2330
  rawErrors: __errors
1566
2331
  }
1567
2332
  );
1568
- const id = idSchema[ID_KEY];
2333
+ const id = idSchema[ID_KEY3];
1569
2334
  let label;
1570
2335
  if (wasPropertyKeyModified) {
1571
2336
  label = name;
@@ -1573,25 +2338,16 @@ function SchemaFieldRender(props) {
1573
2338
  label = ADDITIONAL_PROPERTY_FLAG2 in schema ? name : uiOptions.title || props.schema.title || schema.title || props.title || name;
1574
2339
  }
1575
2340
  const description = uiOptions.description || props.schema.description || schema.description || "";
1576
- const richDescription = uiOptions.enableMarkdownInDescription ? /* @__PURE__ */ jsx6(Markdown2, { options: { disableParsingRawHTML: true }, children: description }) : description;
1577
2341
  const help = uiOptions.help;
1578
2342
  const hidden = uiOptions.widget === "hidden";
1579
- const classNames = ["form-group", "field", `field-${getSchemaType(schema)}`];
2343
+ const classNames = ["rjsf-field", `rjsf-field-${getSchemaType(schema)}`];
1580
2344
  if (!hideError && __errors && __errors.length > 0) {
1581
- classNames.push("field-error has-error has-danger");
1582
- }
1583
- if (uiSchema?.classNames) {
1584
- if (true) {
1585
- console.warn(
1586
- "'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead."
1587
- );
1588
- }
1589
- classNames.push(uiSchema.classNames);
2345
+ classNames.push("rjsf-field-error");
1590
2346
  }
1591
2347
  if (uiOptions.classNames) {
1592
2348
  classNames.push(uiOptions.classNames);
1593
2349
  }
1594
- const helpComponent = /* @__PURE__ */ jsx6(
2350
+ const helpComponent = /* @__PURE__ */ jsx9(
1595
2351
  FieldHelpTemplate2,
1596
2352
  {
1597
2353
  help,
@@ -1602,7 +2358,7 @@ function SchemaFieldRender(props) {
1602
2358
  registry
1603
2359
  }
1604
2360
  );
1605
- const errorsComponent = hideError || (schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ jsx6(
2361
+ const errorsComponent = hideError || (schema.anyOf || schema.oneOf) && !schemaUtils.isSelect(schema) ? void 0 : /* @__PURE__ */ jsx9(
1606
2362
  FieldErrorTemplate2,
1607
2363
  {
1608
2364
  errors: __errors,
@@ -1614,11 +2370,11 @@ function SchemaFieldRender(props) {
1614
2370
  }
1615
2371
  );
1616
2372
  const fieldProps = {
1617
- description: /* @__PURE__ */ jsx6(
2373
+ description: /* @__PURE__ */ jsx9(
1618
2374
  DescriptionFieldTemplate,
1619
2375
  {
1620
2376
  id: descriptionId(id),
1621
- description: richDescription,
2377
+ description,
1622
2378
  schema,
1623
2379
  uiSchema,
1624
2380
  registry
@@ -1651,9 +2407,9 @@ function SchemaFieldRender(props) {
1651
2407
  const _AnyOfField = registry.fields.AnyOfField;
1652
2408
  const _OneOfField = registry.fields.OneOfField;
1653
2409
  const isReplacingAnyOrOneOf = uiSchema?.["ui:field"] && uiSchema?.["ui:fieldReplacesAnyOrOneOf"] === true;
1654
- return /* @__PURE__ */ jsx6(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ jsxs3(Fragment, { children: [
2410
+ return /* @__PURE__ */ jsx9(FieldTemplate2, { ...fieldProps, children: /* @__PURE__ */ jsxs3(Fragment, { children: [
1655
2411
  field,
1656
- schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ jsx6(
2412
+ schema.anyOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ jsx9(
1657
2413
  _AnyOfField,
1658
2414
  {
1659
2415
  name,
@@ -1670,14 +2426,15 @@ function SchemaFieldRender(props) {
1670
2426
  onChange: props.onChange,
1671
2427
  onFocus: props.onFocus,
1672
2428
  options: schema.anyOf.map(
1673
- (_schema2) => schemaUtils.retrieveSchema(isObject4(_schema2) ? _schema2 : {}, formData)
2429
+ (_schema2) => schemaUtils.retrieveSchema(isObject5(_schema2) ? _schema2 : {}, formData)
1674
2430
  ),
1675
2431
  registry,
2432
+ required,
1676
2433
  schema,
1677
2434
  uiSchema
1678
2435
  }
1679
2436
  ),
1680
- schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ jsx6(
2437
+ schema.oneOf && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema) && /* @__PURE__ */ jsx9(
1681
2438
  _OneOfField,
1682
2439
  {
1683
2440
  name,
@@ -1694,9 +2451,10 @@ function SchemaFieldRender(props) {
1694
2451
  onChange: props.onChange,
1695
2452
  onFocus: props.onFocus,
1696
2453
  options: schema.oneOf.map(
1697
- (_schema2) => schemaUtils.retrieveSchema(isObject4(_schema2) ? _schema2 : {}, formData)
2454
+ (_schema2) => schemaUtils.retrieveSchema(isObject5(_schema2) ? _schema2 : {}, formData)
1698
2455
  ),
1699
2456
  registry,
2457
+ required,
1700
2458
  schema,
1701
2459
  uiSchema
1702
2460
  }
@@ -1708,19 +2466,19 @@ var SchemaField = class extends Component4 {
1708
2466
  return !deepEquals2(this.props, nextProps);
1709
2467
  }
1710
2468
  render() {
1711
- return /* @__PURE__ */ jsx6(SchemaFieldRender, { ...this.props });
2469
+ return /* @__PURE__ */ jsx9(SchemaFieldRender, { ...this.props });
1712
2470
  }
1713
2471
  };
1714
2472
  var SchemaField_default = SchemaField;
1715
2473
 
1716
2474
  // src/components/fields/StringField.tsx
1717
2475
  import {
1718
- getWidget as getWidget4,
1719
- getUiOptions as getUiOptions6,
1720
- optionsList as optionsList3,
2476
+ getWidget as getWidget5,
2477
+ getUiOptions as getUiOptions9,
2478
+ optionsList as optionsList4,
1721
2479
  hasWidget
1722
2480
  } from "@rjsf/utils";
1723
- import { jsx as jsx7 } from "react/jsx-runtime";
2481
+ import { jsx as jsx10 } from "react/jsx-runtime";
1724
2482
  function StringField(props) {
1725
2483
  const {
1726
2484
  schema,
@@ -1741,16 +2499,16 @@ function StringField(props) {
1741
2499
  } = props;
1742
2500
  const { title, format } = schema;
1743
2501
  const { widgets: widgets2, formContext, schemaUtils, globalUiOptions } = registry;
1744
- const enumOptions = schemaUtils.isSelect(schema) ? optionsList3(schema, uiSchema) : void 0;
2502
+ const enumOptions = schemaUtils.isSelect(schema) ? optionsList4(schema, uiSchema) : void 0;
1745
2503
  let defaultWidget = enumOptions ? "select" : "text";
1746
2504
  if (format && hasWidget(schema, format, widgets2)) {
1747
2505
  defaultWidget = format;
1748
2506
  }
1749
- const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = getUiOptions6(uiSchema);
2507
+ const { widget = defaultWidget, placeholder = "", title: uiTitle, ...options } = getUiOptions9(uiSchema);
1750
2508
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
1751
2509
  const label = uiTitle ?? title ?? name;
1752
- const Widget = getWidget4(schema, widget, widgets2);
1753
- return /* @__PURE__ */ jsx7(
2510
+ const Widget = getWidget5(schema, widget, widgets2);
2511
+ return /* @__PURE__ */ jsx10(
1754
2512
  Widget,
1755
2513
  {
1756
2514
  options: { ...options, enumOptions },
@@ -1779,10 +2537,10 @@ function StringField(props) {
1779
2537
  var StringField_default = StringField;
1780
2538
 
1781
2539
  // src/components/fields/NullField.tsx
1782
- import { useEffect } from "react";
2540
+ import { useEffect as useEffect2 } from "react";
1783
2541
  function NullField(props) {
1784
2542
  const { formData, onChange } = props;
1785
- useEffect(() => {
2543
+ useEffect2(() => {
1786
2544
  if (formData === void 0) {
1787
2545
  onChange(null);
1788
2546
  }
@@ -1798,6 +2556,9 @@ function fields() {
1798
2556
  ArrayField: ArrayField_default,
1799
2557
  // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
1800
2558
  BooleanField: BooleanField_default,
2559
+ LayoutGridField,
2560
+ LayoutHeaderField,
2561
+ LayoutMultiSchemaField,
1801
2562
  NumberField: NumberField_default,
1802
2563
  ObjectField: ObjectField_default,
1803
2564
  OneOfField: MultiSchemaField_default,
@@ -1811,23 +2572,23 @@ var fields_default = fields;
1811
2572
  // src/components/templates/ArrayFieldDescriptionTemplate.tsx
1812
2573
  import {
1813
2574
  descriptionId as descriptionId2,
1814
- getTemplate as getTemplate4,
1815
- getUiOptions as getUiOptions7
2575
+ getTemplate as getTemplate7,
2576
+ getUiOptions as getUiOptions10
1816
2577
  } from "@rjsf/utils";
1817
- import { jsx as jsx8 } from "react/jsx-runtime";
2578
+ import { jsx as jsx11 } from "react/jsx-runtime";
1818
2579
  function ArrayFieldDescriptionTemplate(props) {
1819
2580
  const { idSchema, description, registry, schema, uiSchema } = props;
1820
- const options = getUiOptions7(uiSchema, registry.globalUiOptions);
2581
+ const options = getUiOptions10(uiSchema, registry.globalUiOptions);
1821
2582
  const { label: displayLabel = true } = options;
1822
2583
  if (!description || !displayLabel) {
1823
2584
  return null;
1824
2585
  }
1825
- const DescriptionFieldTemplate = getTemplate4(
2586
+ const DescriptionFieldTemplate = getTemplate7(
1826
2587
  "DescriptionFieldTemplate",
1827
2588
  registry,
1828
2589
  options
1829
2590
  );
1830
- return /* @__PURE__ */ jsx8(
2591
+ return /* @__PURE__ */ jsx11(
1831
2592
  DescriptionFieldTemplate,
1832
2593
  {
1833
2594
  id: descriptionId2(idSchema),
@@ -1840,26 +2601,19 @@ function ArrayFieldDescriptionTemplate(props) {
1840
2601
  }
1841
2602
 
1842
2603
  // src/components/templates/ArrayFieldItemTemplate.tsx
1843
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
2604
+ import {
2605
+ getTemplate as getTemplate8,
2606
+ getUiOptions as getUiOptions11
2607
+ } from "@rjsf/utils";
2608
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
1844
2609
  function ArrayFieldItemTemplate(props) {
1845
- const {
1846
- children,
1847
- className,
1848
- disabled,
1849
- hasToolbar,
1850
- hasMoveDown,
1851
- hasMoveUp,
1852
- hasRemove,
1853
- hasCopy,
1854
- index,
1855
- onCopyIndexClick,
1856
- onDropIndexClick,
1857
- onReorderClick,
1858
- readonly,
2610
+ const { children, className, buttonsProps, hasToolbar, registry, uiSchema } = props;
2611
+ const uiOptions = getUiOptions11(uiSchema);
2612
+ const ArrayFieldItemButtonsTemplate2 = getTemplate8(
2613
+ "ArrayFieldItemButtonsTemplate",
1859
2614
  registry,
1860
- uiSchema
1861
- } = props;
1862
- const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
2615
+ uiOptions
2616
+ );
1863
2617
  const btnStyle = {
1864
2618
  flex: 1,
1865
2619
  paddingLeft: 6,
@@ -1867,8 +2621,8 @@ function ArrayFieldItemTemplate(props) {
1867
2621
  fontWeight: "bold"
1868
2622
  };
1869
2623
  return /* @__PURE__ */ jsxs4("div", { className, children: [
1870
- /* @__PURE__ */ jsx9("div", { className: hasToolbar ? "col-xs-9" : "col-xs-12", children }),
1871
- hasToolbar && /* @__PURE__ */ jsx9("div", { className: "col-xs-3 array-item-toolbox", children: /* @__PURE__ */ jsxs4(
2624
+ /* @__PURE__ */ jsx12("div", { className: hasToolbar ? "col-xs-9" : "col-xs-12", children }),
2625
+ hasToolbar && /* @__PURE__ */ jsx12("div", { className: "col-xs-3 array-item-toolbox", children: /* @__PURE__ */ jsx12(
1872
2626
  "div",
1873
2627
  {
1874
2628
  className: "btn-group",
@@ -1876,59 +2630,94 @@ function ArrayFieldItemTemplate(props) {
1876
2630
  display: "flex",
1877
2631
  justifyContent: "space-around"
1878
2632
  },
1879
- children: [
1880
- (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx9(
1881
- MoveUpButton2,
1882
- {
1883
- style: btnStyle,
1884
- disabled: disabled || readonly || !hasMoveUp,
1885
- onClick: onReorderClick(index, index - 1),
1886
- uiSchema,
1887
- registry
1888
- }
1889
- ),
1890
- (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx9(
1891
- MoveDownButton2,
1892
- {
1893
- style: btnStyle,
1894
- disabled: disabled || readonly || !hasMoveDown,
1895
- onClick: onReorderClick(index, index + 1),
1896
- uiSchema,
1897
- registry
1898
- }
1899
- ),
1900
- hasCopy && /* @__PURE__ */ jsx9(
1901
- CopyButton2,
1902
- {
1903
- style: btnStyle,
1904
- disabled: disabled || readonly,
1905
- onClick: onCopyIndexClick(index),
1906
- uiSchema,
1907
- registry
1908
- }
1909
- ),
1910
- hasRemove && /* @__PURE__ */ jsx9(
1911
- RemoveButton2,
1912
- {
1913
- style: btnStyle,
1914
- disabled: disabled || readonly,
1915
- onClick: onDropIndexClick(index),
1916
- uiSchema,
1917
- registry
1918
- }
1919
- )
1920
- ]
2633
+ children: /* @__PURE__ */ jsx12(ArrayFieldItemButtonsTemplate2, { ...buttonsProps, style: btnStyle })
1921
2634
  }
1922
2635
  ) })
1923
2636
  ] });
1924
2637
  }
1925
2638
 
2639
+ // src/components/templates/ArrayFieldItemButtonsTemplate.tsx
2640
+ import { useMemo } from "react";
2641
+ import {
2642
+ buttonId
2643
+ } from "@rjsf/utils";
2644
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
2645
+ function ArrayFieldItemButtonsTemplate(props) {
2646
+ const {
2647
+ disabled,
2648
+ hasCopy,
2649
+ hasMoveDown,
2650
+ hasMoveUp,
2651
+ hasRemove,
2652
+ idSchema,
2653
+ index,
2654
+ onCopyIndexClick,
2655
+ onDropIndexClick,
2656
+ onReorderClick,
2657
+ readonly,
2658
+ registry,
2659
+ uiSchema
2660
+ } = props;
2661
+ const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
2662
+ const onCopyClick = useMemo(() => onCopyIndexClick(index), [index, onCopyIndexClick]);
2663
+ const onRemoveClick = useMemo(() => onDropIndexClick(index), [index, onDropIndexClick]);
2664
+ const onArrowUpClick = useMemo(() => onReorderClick(index, index - 1), [index, onReorderClick]);
2665
+ const onArrowDownClick = useMemo(() => onReorderClick(index, index + 1), [index, onReorderClick]);
2666
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
2667
+ (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx13(
2668
+ MoveUpButton2,
2669
+ {
2670
+ id: buttonId(idSchema, "moveUp"),
2671
+ className: "rjsf-array-item-move-up",
2672
+ disabled: disabled || readonly || !hasMoveUp,
2673
+ onClick: onArrowUpClick,
2674
+ uiSchema,
2675
+ registry
2676
+ }
2677
+ ),
2678
+ (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx13(
2679
+ MoveDownButton2,
2680
+ {
2681
+ id: buttonId(idSchema, "moveDown"),
2682
+ className: "rjsf-array-item-move-down",
2683
+ disabled: disabled || readonly || !hasMoveDown,
2684
+ onClick: onArrowDownClick,
2685
+ uiSchema,
2686
+ registry
2687
+ }
2688
+ ),
2689
+ hasCopy && /* @__PURE__ */ jsx13(
2690
+ CopyButton2,
2691
+ {
2692
+ id: buttonId(idSchema, "copy"),
2693
+ className: "rjsf-array-item-copy",
2694
+ disabled: disabled || readonly,
2695
+ onClick: onCopyClick,
2696
+ uiSchema,
2697
+ registry
2698
+ }
2699
+ ),
2700
+ hasRemove && /* @__PURE__ */ jsx13(
2701
+ RemoveButton2,
2702
+ {
2703
+ id: buttonId(idSchema, "remove"),
2704
+ className: "rjsf-array-item-remove",
2705
+ disabled: disabled || readonly,
2706
+ onClick: onRemoveClick,
2707
+ uiSchema,
2708
+ registry
2709
+ }
2710
+ )
2711
+ ] });
2712
+ }
2713
+
1926
2714
  // src/components/templates/ArrayFieldTemplate.tsx
1927
2715
  import {
1928
- getTemplate as getTemplate5,
1929
- getUiOptions as getUiOptions8
2716
+ getTemplate as getTemplate9,
2717
+ getUiOptions as getUiOptions12,
2718
+ buttonId as buttonId2
1930
2719
  } from "@rjsf/utils";
1931
- import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
2720
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1932
2721
  function ArrayFieldTemplate(props) {
1933
2722
  const {
1934
2723
  canAdd,
@@ -1944,18 +2733,18 @@ function ArrayFieldTemplate(props) {
1944
2733
  schema,
1945
2734
  title
1946
2735
  } = props;
1947
- const uiOptions = getUiOptions8(uiSchema);
1948
- const ArrayFieldDescriptionTemplate2 = getTemplate5(
2736
+ const uiOptions = getUiOptions12(uiSchema);
2737
+ const ArrayFieldDescriptionTemplate2 = getTemplate9(
1949
2738
  "ArrayFieldDescriptionTemplate",
1950
2739
  registry,
1951
2740
  uiOptions
1952
2741
  );
1953
- const ArrayFieldItemTemplate2 = getTemplate5(
2742
+ const ArrayFieldItemTemplate2 = getTemplate9(
1954
2743
  "ArrayFieldItemTemplate",
1955
2744
  registry,
1956
2745
  uiOptions
1957
2746
  );
1958
- const ArrayFieldTitleTemplate2 = getTemplate5(
2747
+ const ArrayFieldTitleTemplate2 = getTemplate9(
1959
2748
  "ArrayFieldTitleTemplate",
1960
2749
  registry,
1961
2750
  uiOptions
@@ -1963,8 +2752,8 @@ function ArrayFieldTemplate(props) {
1963
2752
  const {
1964
2753
  ButtonTemplates: { AddButton: AddButton2 }
1965
2754
  } = registry.templates;
1966
- return /* @__PURE__ */ jsxs5("fieldset", { className, id: idSchema.$id, children: [
1967
- /* @__PURE__ */ jsx10(
2755
+ return /* @__PURE__ */ jsxs6("fieldset", { className, id: idSchema.$id, children: [
2756
+ /* @__PURE__ */ jsx14(
1968
2757
  ArrayFieldTitleTemplate2,
1969
2758
  {
1970
2759
  idSchema,
@@ -1975,7 +2764,7 @@ function ArrayFieldTemplate(props) {
1975
2764
  registry
1976
2765
  }
1977
2766
  ),
1978
- /* @__PURE__ */ jsx10(
2767
+ /* @__PURE__ */ jsx14(
1979
2768
  ArrayFieldDescriptionTemplate2,
1980
2769
  {
1981
2770
  idSchema,
@@ -1985,11 +2774,12 @@ function ArrayFieldTemplate(props) {
1985
2774
  registry
1986
2775
  }
1987
2776
  ),
1988
- /* @__PURE__ */ jsx10("div", { className: "row array-item-list", children: items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ jsx10(ArrayFieldItemTemplate2, { ...itemProps }, key)) }),
1989
- canAdd && /* @__PURE__ */ jsx10(
2777
+ /* @__PURE__ */ jsx14("div", { className: "row array-item-list", children: items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ jsx14(ArrayFieldItemTemplate2, { ...itemProps }, key)) }),
2778
+ canAdd && /* @__PURE__ */ jsx14(
1990
2779
  AddButton2,
1991
2780
  {
1992
- className: "array-item-add",
2781
+ id: buttonId2(idSchema, "add"),
2782
+ className: "rjsf-array-item-add",
1993
2783
  onClick: onAddClick,
1994
2784
  disabled: disabled || readonly,
1995
2785
  uiSchema,
@@ -2001,27 +2791,27 @@ function ArrayFieldTemplate(props) {
2001
2791
 
2002
2792
  // src/components/templates/ArrayFieldTitleTemplate.tsx
2003
2793
  import {
2004
- getTemplate as getTemplate6,
2005
- getUiOptions as getUiOptions9,
2006
- titleId
2794
+ getTemplate as getTemplate10,
2795
+ getUiOptions as getUiOptions13,
2796
+ titleId as titleId2
2007
2797
  } from "@rjsf/utils";
2008
- import { jsx as jsx11 } from "react/jsx-runtime";
2798
+ import { jsx as jsx15 } from "react/jsx-runtime";
2009
2799
  function ArrayFieldTitleTemplate(props) {
2010
2800
  const { idSchema, title, schema, uiSchema, required, registry } = props;
2011
- const options = getUiOptions9(uiSchema, registry.globalUiOptions);
2801
+ const options = getUiOptions13(uiSchema, registry.globalUiOptions);
2012
2802
  const { label: displayLabel = true } = options;
2013
2803
  if (!title || !displayLabel) {
2014
2804
  return null;
2015
2805
  }
2016
- const TitleFieldTemplate = getTemplate6(
2806
+ const TitleFieldTemplate = getTemplate10(
2017
2807
  "TitleFieldTemplate",
2018
2808
  registry,
2019
2809
  options
2020
2810
  );
2021
- return /* @__PURE__ */ jsx11(
2811
+ return /* @__PURE__ */ jsx15(
2022
2812
  TitleFieldTemplate,
2023
2813
  {
2024
- id: titleId(idSchema),
2814
+ id: titleId2(idSchema),
2025
2815
  title,
2026
2816
  required,
2027
2817
  schema,
@@ -2038,7 +2828,7 @@ import {
2038
2828
  examplesId,
2039
2829
  getInputProps
2040
2830
  } from "@rjsf/utils";
2041
- import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
2831
+ import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
2042
2832
  function BaseInputTemplate(props) {
2043
2833
  const {
2044
2834
  id,
@@ -2091,8 +2881,8 @@ function BaseInputTemplate(props) {
2091
2881
  ({ target }) => onFocus(id, target && target.value),
2092
2882
  [onFocus, id]
2093
2883
  );
2094
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
2095
- /* @__PURE__ */ jsx12(
2884
+ return /* @__PURE__ */ jsxs7(Fragment3, { children: [
2885
+ /* @__PURE__ */ jsx16(
2096
2886
  "input",
2097
2887
  {
2098
2888
  id,
@@ -2110,21 +2900,21 @@ function BaseInputTemplate(props) {
2110
2900
  "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
2111
2901
  }
2112
2902
  ),
2113
- Array.isArray(schema.examples) && /* @__PURE__ */ jsx12("datalist", { id: examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
2114
- return /* @__PURE__ */ jsx12("option", { value: example }, example);
2903
+ Array.isArray(schema.examples) && /* @__PURE__ */ jsx16("datalist", { id: examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
2904
+ return /* @__PURE__ */ jsx16("option", { value: example }, example);
2115
2905
  }) }, `datalist_${id}`)
2116
2906
  ] });
2117
2907
  }
2118
2908
 
2119
2909
  // src/components/templates/ButtonTemplates/SubmitButton.tsx
2120
2910
  import { getSubmitButtonOptions } from "@rjsf/utils";
2121
- import { jsx as jsx13 } from "react/jsx-runtime";
2911
+ import { jsx as jsx17 } from "react/jsx-runtime";
2122
2912
  function SubmitButton({ uiSchema }) {
2123
2913
  const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
2124
2914
  if (norender) {
2125
2915
  return null;
2126
2916
  }
2127
- return /* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
2917
+ return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17("button", { type: "submit", ...submitButtonProps, className: `btn btn-info ${submitButtonProps.className || ""}`, children: submitText }) });
2128
2918
  }
2129
2919
 
2130
2920
  // src/components/templates/ButtonTemplates/AddButton.tsx
@@ -2132,71 +2922,38 @@ import { TranslatableString as TranslatableString7 } from "@rjsf/utils";
2132
2922
 
2133
2923
  // src/components/templates/ButtonTemplates/IconButton.tsx
2134
2924
  import { TranslatableString as TranslatableString6 } from "@rjsf/utils";
2135
- import { jsx as jsx14 } from "react/jsx-runtime";
2925
+ import { jsx as jsx18 } from "react/jsx-runtime";
2136
2926
  function IconButton(props) {
2137
2927
  const { iconType = "default", icon, className, uiSchema, registry, ...otherProps } = props;
2138
- return /* @__PURE__ */ jsx14("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ jsx14("i", { className: `glyphicon glyphicon-${icon}` }) });
2928
+ return /* @__PURE__ */ jsx18("button", { type: "button", className: `btn btn-${iconType} ${className}`, ...otherProps, children: /* @__PURE__ */ jsx18("i", { className: `glyphicon glyphicon-${icon}` }) });
2139
2929
  }
2140
2930
  function CopyButton(props) {
2141
2931
  const {
2142
2932
  registry: { translateString }
2143
2933
  } = props;
2144
- return /* @__PURE__ */ jsx14(
2145
- IconButton,
2146
- {
2147
- title: translateString(TranslatableString6.CopyButton),
2148
- className: "array-item-copy",
2149
- ...props,
2150
- icon: "copy"
2151
- }
2152
- );
2934
+ return /* @__PURE__ */ jsx18(IconButton, { title: translateString(TranslatableString6.CopyButton), ...props, icon: "copy" });
2153
2935
  }
2154
2936
  function MoveDownButton(props) {
2155
2937
  const {
2156
2938
  registry: { translateString }
2157
2939
  } = props;
2158
- return /* @__PURE__ */ jsx14(
2159
- IconButton,
2160
- {
2161
- title: translateString(TranslatableString6.MoveDownButton),
2162
- className: "array-item-move-down",
2163
- ...props,
2164
- icon: "arrow-down"
2165
- }
2166
- );
2940
+ return /* @__PURE__ */ jsx18(IconButton, { title: translateString(TranslatableString6.MoveDownButton), ...props, icon: "arrow-down" });
2167
2941
  }
2168
2942
  function MoveUpButton(props) {
2169
2943
  const {
2170
2944
  registry: { translateString }
2171
2945
  } = props;
2172
- return /* @__PURE__ */ jsx14(
2173
- IconButton,
2174
- {
2175
- title: translateString(TranslatableString6.MoveUpButton),
2176
- className: "array-item-move-up",
2177
- ...props,
2178
- icon: "arrow-up"
2179
- }
2180
- );
2946
+ return /* @__PURE__ */ jsx18(IconButton, { title: translateString(TranslatableString6.MoveUpButton), ...props, icon: "arrow-up" });
2181
2947
  }
2182
2948
  function RemoveButton(props) {
2183
2949
  const {
2184
2950
  registry: { translateString }
2185
2951
  } = props;
2186
- return /* @__PURE__ */ jsx14(
2187
- IconButton,
2188
- {
2189
- title: translateString(TranslatableString6.RemoveButton),
2190
- className: "array-item-remove",
2191
- ...props,
2192
- iconType: "danger",
2193
- icon: "remove"
2194
- }
2195
- );
2952
+ return /* @__PURE__ */ jsx18(IconButton, { title: translateString(TranslatableString6.RemoveButton), ...props, iconType: "danger", icon: "remove" });
2196
2953
  }
2197
2954
 
2198
2955
  // src/components/templates/ButtonTemplates/AddButton.tsx
2199
- import { jsx as jsx15 } from "react/jsx-runtime";
2956
+ import { jsx as jsx19 } from "react/jsx-runtime";
2200
2957
  function AddButton({
2201
2958
  className,
2202
2959
  onClick,
@@ -2204,7 +2961,7 @@ function AddButton({
2204
2961
  registry
2205
2962
  }) {
2206
2963
  const { translateString } = registry;
2207
- return /* @__PURE__ */ jsx15("div", { className: "row", children: /* @__PURE__ */ jsx15("p", { className: `col-xs-3 col-xs-offset-9 text-right ${className}`, children: /* @__PURE__ */ jsx15(
2964
+ return /* @__PURE__ */ jsx19("div", { className: "row", children: /* @__PURE__ */ jsx19("p", { className: `col-xs-3 col-xs-offset-9 text-right ${className}`, children: /* @__PURE__ */ jsx19(
2208
2965
  IconButton,
2209
2966
  {
2210
2967
  iconType: "info",
@@ -2231,73 +2988,87 @@ function buttonTemplates() {
2231
2988
  }
2232
2989
  var ButtonTemplates_default = buttonTemplates;
2233
2990
 
2991
+ // src/components/RichDescription.tsx
2992
+ import {
2993
+ getTestIds as getTestIds2,
2994
+ getUiOptions as getUiOptions14
2995
+ } from "@rjsf/utils";
2996
+ import Markdown2 from "markdown-to-jsx";
2997
+ import { jsx as jsx20 } from "react/jsx-runtime";
2998
+ var TEST_IDS = getTestIds2();
2999
+ function RichDescription({ description, registry, uiSchema = {} }) {
3000
+ const { globalUiOptions } = registry;
3001
+ const uiOptions = getUiOptions14(uiSchema, globalUiOptions);
3002
+ if (uiOptions.enableMarkdownInDescription && typeof description === "string") {
3003
+ return /* @__PURE__ */ jsx20(Markdown2, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description });
3004
+ }
3005
+ return description;
3006
+ }
3007
+ RichDescription.TEST_IDS = TEST_IDS;
3008
+
2234
3009
  // src/components/templates/DescriptionField.tsx
2235
- import { jsx as jsx16 } from "react/jsx-runtime";
3010
+ import { jsx as jsx21 } from "react/jsx-runtime";
2236
3011
  function DescriptionField(props) {
2237
- const { id, description } = props;
3012
+ const { id, description, registry, uiSchema } = props;
2238
3013
  if (!description) {
2239
3014
  return null;
2240
3015
  }
2241
- if (typeof description === "string") {
2242
- return /* @__PURE__ */ jsx16("p", { id, className: "field-description", children: description });
2243
- } else {
2244
- return /* @__PURE__ */ jsx16("div", { id, className: "field-description", children: description });
2245
- }
3016
+ return /* @__PURE__ */ jsx21("div", { id, className: "field-description", children: /* @__PURE__ */ jsx21(RichDescription, { description, registry, uiSchema }) });
2246
3017
  }
2247
3018
 
2248
3019
  // src/components/templates/ErrorList.tsx
2249
3020
  import {
2250
3021
  TranslatableString as TranslatableString8
2251
3022
  } from "@rjsf/utils";
2252
- import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
3023
+ import { jsx as jsx22, jsxs as jsxs8 } from "react/jsx-runtime";
2253
3024
  function ErrorList({
2254
3025
  errors,
2255
3026
  registry
2256
3027
  }) {
2257
3028
  const { translateString } = registry;
2258
- return /* @__PURE__ */ jsxs7("div", { className: "panel panel-danger errors", children: [
2259
- /* @__PURE__ */ jsx17("div", { className: "panel-heading", children: /* @__PURE__ */ jsx17("h3", { className: "panel-title", children: translateString(TranslatableString8.ErrorsLabel) }) }),
2260
- /* @__PURE__ */ jsx17("ul", { className: "list-group", children: errors.map((error, i) => {
2261
- return /* @__PURE__ */ jsx17("li", { className: "list-group-item text-danger", children: error.stack }, i);
3029
+ return /* @__PURE__ */ jsxs8("div", { className: "panel panel-danger errors", children: [
3030
+ /* @__PURE__ */ jsx22("div", { className: "panel-heading", children: /* @__PURE__ */ jsx22("h3", { className: "panel-title", children: translateString(TranslatableString8.ErrorsLabel) }) }),
3031
+ /* @__PURE__ */ jsx22("ul", { className: "list-group", children: errors.map((error, i) => {
3032
+ return /* @__PURE__ */ jsx22("li", { className: "list-group-item text-danger", children: error.stack }, i);
2262
3033
  }) })
2263
3034
  ] });
2264
3035
  }
2265
3036
 
2266
3037
  // src/components/templates/FieldTemplate/FieldTemplate.tsx
2267
3038
  import {
2268
- getTemplate as getTemplate7,
2269
- getUiOptions as getUiOptions10
3039
+ getTemplate as getTemplate11,
3040
+ getUiOptions as getUiOptions15
2270
3041
  } from "@rjsf/utils";
2271
3042
 
2272
3043
  // src/components/templates/FieldTemplate/Label.tsx
2273
- import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
3044
+ import { jsx as jsx23, jsxs as jsxs9 } from "react/jsx-runtime";
2274
3045
  var REQUIRED_FIELD_SYMBOL = "*";
2275
3046
  function Label(props) {
2276
3047
  const { label, required, id } = props;
2277
3048
  if (!label) {
2278
3049
  return null;
2279
3050
  }
2280
- return /* @__PURE__ */ jsxs8("label", { className: "control-label", htmlFor: id, children: [
3051
+ return /* @__PURE__ */ jsxs9("label", { className: "control-label", htmlFor: id, children: [
2281
3052
  label,
2282
- required && /* @__PURE__ */ jsx18("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
3053
+ required && /* @__PURE__ */ jsx23("span", { className: "required", children: REQUIRED_FIELD_SYMBOL })
2283
3054
  ] });
2284
3055
  }
2285
3056
 
2286
3057
  // src/components/templates/FieldTemplate/FieldTemplate.tsx
2287
- import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
3058
+ import { jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
2288
3059
  function FieldTemplate(props) {
2289
3060
  const { id, label, children, errors, help, description, hidden, required, displayLabel, registry, uiSchema } = props;
2290
- const uiOptions = getUiOptions10(uiSchema);
2291
- const WrapIfAdditionalTemplate2 = getTemplate7(
3061
+ const uiOptions = getUiOptions15(uiSchema);
3062
+ const WrapIfAdditionalTemplate2 = getTemplate11(
2292
3063
  "WrapIfAdditionalTemplate",
2293
3064
  registry,
2294
3065
  uiOptions
2295
3066
  );
2296
3067
  if (hidden) {
2297
- return /* @__PURE__ */ jsx19("div", { className: "hidden", children });
3068
+ return /* @__PURE__ */ jsx24("div", { className: "hidden", children });
2298
3069
  }
2299
- return /* @__PURE__ */ jsxs9(WrapIfAdditionalTemplate2, { ...props, children: [
2300
- displayLabel && /* @__PURE__ */ jsx19(Label, { label, required, id }),
3070
+ return /* @__PURE__ */ jsxs10(WrapIfAdditionalTemplate2, { ...props, children: [
3071
+ displayLabel && /* @__PURE__ */ jsx24(Label, { label, required, id }),
2301
3072
  displayLabel && description ? description : null,
2302
3073
  children,
2303
3074
  errors,
@@ -2310,21 +3081,21 @@ var FieldTemplate_default = FieldTemplate;
2310
3081
 
2311
3082
  // src/components/templates/FieldErrorTemplate.tsx
2312
3083
  import { errorId } from "@rjsf/utils";
2313
- import { jsx as jsx20 } from "react/jsx-runtime";
3084
+ import { jsx as jsx25 } from "react/jsx-runtime";
2314
3085
  function FieldErrorTemplate(props) {
2315
3086
  const { errors = [], idSchema } = props;
2316
3087
  if (errors.length === 0) {
2317
3088
  return null;
2318
3089
  }
2319
3090
  const id = errorId(idSchema);
2320
- return /* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
2321
- return /* @__PURE__ */ jsx20("li", { className: "text-danger", children: error }, index);
3091
+ return /* @__PURE__ */ jsx25("div", { children: /* @__PURE__ */ jsx25("ul", { id, className: "error-detail bs-callout bs-callout-info", children: errors.filter((elem) => !!elem).map((error, index) => {
3092
+ return /* @__PURE__ */ jsx25("li", { className: "text-danger", children: error }, index);
2322
3093
  }) }) });
2323
3094
  }
2324
3095
 
2325
3096
  // src/components/templates/FieldHelpTemplate.tsx
2326
3097
  import { helpId } from "@rjsf/utils";
2327
- import { jsx as jsx21 } from "react/jsx-runtime";
3098
+ import { jsx as jsx26 } from "react/jsx-runtime";
2328
3099
  function FieldHelpTemplate(props) {
2329
3100
  const { idSchema, help } = props;
2330
3101
  if (!help) {
@@ -2332,20 +3103,28 @@ function FieldHelpTemplate(props) {
2332
3103
  }
2333
3104
  const id = helpId(idSchema);
2334
3105
  if (typeof help === "string") {
2335
- return /* @__PURE__ */ jsx21("p", { id, className: "help-block", children: help });
3106
+ return /* @__PURE__ */ jsx26("p", { id, className: "help-block", children: help });
2336
3107
  }
2337
- return /* @__PURE__ */ jsx21("div", { id, className: "help-block", children: help });
3108
+ return /* @__PURE__ */ jsx26("div", { id, className: "help-block", children: help });
3109
+ }
3110
+
3111
+ // src/components/templates/GridTemplate.tsx
3112
+ import { jsx as jsx27 } from "react/jsx-runtime";
3113
+ function GridTemplate(props) {
3114
+ const { children, column, className, ...rest } = props;
3115
+ return /* @__PURE__ */ jsx27("div", { className, ...rest, children });
2338
3116
  }
2339
3117
 
2340
3118
  // src/components/templates/ObjectFieldTemplate.tsx
2341
3119
  import {
2342
3120
  canExpand,
2343
3121
  descriptionId as descriptionId3,
2344
- getTemplate as getTemplate8,
2345
- getUiOptions as getUiOptions11,
2346
- titleId as titleId2
3122
+ getTemplate as getTemplate12,
3123
+ getUiOptions as getUiOptions16,
3124
+ titleId as titleId3,
3125
+ buttonId as buttonId3
2347
3126
  } from "@rjsf/utils";
2348
- import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
3127
+ import { jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
2349
3128
  function ObjectFieldTemplate(props) {
2350
3129
  const {
2351
3130
  description,
@@ -2361,9 +3140,9 @@ function ObjectFieldTemplate(props) {
2361
3140
  title,
2362
3141
  uiSchema
2363
3142
  } = props;
2364
- const options = getUiOptions11(uiSchema);
2365
- const TitleFieldTemplate = getTemplate8("TitleFieldTemplate", registry, options);
2366
- const DescriptionFieldTemplate = getTemplate8(
3143
+ const options = getUiOptions16(uiSchema);
3144
+ const TitleFieldTemplate = getTemplate12("TitleFieldTemplate", registry, options);
3145
+ const DescriptionFieldTemplate = getTemplate12(
2367
3146
  "DescriptionFieldTemplate",
2368
3147
  registry,
2369
3148
  options
@@ -2371,11 +3150,11 @@ function ObjectFieldTemplate(props) {
2371
3150
  const {
2372
3151
  ButtonTemplates: { AddButton: AddButton2 }
2373
3152
  } = registry.templates;
2374
- return /* @__PURE__ */ jsxs10("fieldset", { id: idSchema.$id, children: [
2375
- title && /* @__PURE__ */ jsx22(
3153
+ return /* @__PURE__ */ jsxs11("fieldset", { id: idSchema.$id, children: [
3154
+ title && /* @__PURE__ */ jsx28(
2376
3155
  TitleFieldTemplate,
2377
3156
  {
2378
- id: titleId2(idSchema),
3157
+ id: titleId3(idSchema),
2379
3158
  title,
2380
3159
  required,
2381
3160
  schema,
@@ -2383,7 +3162,7 @@ function ObjectFieldTemplate(props) {
2383
3162
  registry
2384
3163
  }
2385
3164
  ),
2386
- description && /* @__PURE__ */ jsx22(
3165
+ description && /* @__PURE__ */ jsx28(
2387
3166
  DescriptionFieldTemplate,
2388
3167
  {
2389
3168
  id: descriptionId3(idSchema),
@@ -2394,10 +3173,11 @@ function ObjectFieldTemplate(props) {
2394
3173
  }
2395
3174
  ),
2396
3175
  properties.map((prop) => prop.content),
2397
- canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx22(
3176
+ canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx28(
2398
3177
  AddButton2,
2399
3178
  {
2400
- className: "object-property-expand",
3179
+ id: buttonId3(idSchema, "add"),
3180
+ className: "rjsf-object-property-expand",
2401
3181
  onClick: onAddClick(schema),
2402
3182
  disabled: disabled || readonly,
2403
3183
  uiSchema,
@@ -2408,20 +3188,20 @@ function ObjectFieldTemplate(props) {
2408
3188
  }
2409
3189
 
2410
3190
  // src/components/templates/TitleField.tsx
2411
- import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
3191
+ import { jsx as jsx29, jsxs as jsxs12 } from "react/jsx-runtime";
2412
3192
  var REQUIRED_FIELD_SYMBOL2 = "*";
2413
3193
  function TitleField(props) {
2414
3194
  const { id, title, required } = props;
2415
- return /* @__PURE__ */ jsxs11("legend", { id, children: [
3195
+ return /* @__PURE__ */ jsxs12("legend", { id, children: [
2416
3196
  title,
2417
- required && /* @__PURE__ */ jsx23("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 })
3197
+ required && /* @__PURE__ */ jsx29("span", { className: "required", children: REQUIRED_FIELD_SYMBOL2 })
2418
3198
  ] });
2419
3199
  }
2420
3200
 
2421
3201
  // src/components/templates/UnsupportedField.tsx
2422
3202
  import { TranslatableString as TranslatableString9 } from "@rjsf/utils";
2423
3203
  import Markdown3 from "markdown-to-jsx";
2424
- import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
3204
+ import { jsx as jsx30, jsxs as jsxs13 } from "react/jsx-runtime";
2425
3205
  function UnsupportedField(props) {
2426
3206
  const { schema, idSchema, reason, registry } = props;
2427
3207
  const { translateString } = registry;
@@ -2435,9 +3215,9 @@ function UnsupportedField(props) {
2435
3215
  translateEnum = translateEnum === TranslatableString9.UnsupportedField ? TranslatableString9.UnsupportedFieldWithReason : TranslatableString9.UnsupportedFieldWithIdAndReason;
2436
3216
  translateParams.push(reason);
2437
3217
  }
2438
- return /* @__PURE__ */ jsxs12("div", { className: "unsupported-field", children: [
2439
- /* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(Markdown3, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
2440
- schema && /* @__PURE__ */ jsx24("pre", { children: JSON.stringify(schema, null, 2) })
3218
+ return /* @__PURE__ */ jsxs13("div", { className: "unsupported-field", children: [
3219
+ /* @__PURE__ */ jsx30("p", { children: /* @__PURE__ */ jsx30(Markdown3, { options: { disableParsingRawHTML: true }, children: translateString(translateEnum, translateParams) }) }),
3220
+ schema && /* @__PURE__ */ jsx30("pre", { children: JSON.stringify(schema, null, 2) })
2441
3221
  ] });
2442
3222
  }
2443
3223
  var UnsupportedField_default = UnsupportedField;
@@ -2445,9 +3225,10 @@ var UnsupportedField_default = UnsupportedField;
2445
3225
  // src/components/templates/WrapIfAdditionalTemplate.tsx
2446
3226
  import {
2447
3227
  ADDITIONAL_PROPERTY_FLAG as ADDITIONAL_PROPERTY_FLAG3,
3228
+ buttonId as buttonId4,
2448
3229
  TranslatableString as TranslatableString10
2449
3230
  } from "@rjsf/utils";
2450
- import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
3231
+ import { jsx as jsx31, jsxs as jsxs14 } from "react/jsx-runtime";
2451
3232
  function WrapIfAdditionalTemplate(props) {
2452
3233
  const {
2453
3234
  id,
@@ -2460,6 +3241,8 @@ function WrapIfAdditionalTemplate(props) {
2460
3241
  readonly,
2461
3242
  required,
2462
3243
  schema,
3244
+ hideError,
3245
+ rawErrors,
2463
3246
  children,
2464
3247
  uiSchema,
2465
3248
  registry
@@ -2468,13 +3251,18 @@ function WrapIfAdditionalTemplate(props) {
2468
3251
  const { RemoveButton: RemoveButton2 } = templates2.ButtonTemplates;
2469
3252
  const keyLabel = translateString(TranslatableString10.KeyLabel, [label]);
2470
3253
  const additional = ADDITIONAL_PROPERTY_FLAG3 in schema;
3254
+ const classNamesList = ["form-group", classNames];
3255
+ if (!hideError && rawErrors && rawErrors.length > 0) {
3256
+ classNamesList.push("has-error has-danger");
3257
+ }
3258
+ const uiClassNames = classNamesList.join(" ").trim();
2471
3259
  if (!additional) {
2472
- return /* @__PURE__ */ jsx25("div", { className: classNames, style, children });
3260
+ return /* @__PURE__ */ jsx31("div", { className: uiClassNames, style, children });
2473
3261
  }
2474
- return /* @__PURE__ */ jsx25("div", { className: classNames, style, children: /* @__PURE__ */ jsxs13("div", { className: "row", children: [
2475
- /* @__PURE__ */ jsx25("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ jsxs13("div", { className: "form-group", children: [
2476
- /* @__PURE__ */ jsx25(Label, { label: keyLabel, required, id: `${id}-key` }),
2477
- /* @__PURE__ */ jsx25(
3262
+ return /* @__PURE__ */ jsx31("div", { className: uiClassNames, style, children: /* @__PURE__ */ jsxs14("div", { className: "row", children: [
3263
+ /* @__PURE__ */ jsx31("div", { className: "col-xs-5 form-additional", children: /* @__PURE__ */ jsxs14("div", { className: "form-group", children: [
3264
+ /* @__PURE__ */ jsx31(Label, { label: keyLabel, required, id: `${id}-key` }),
3265
+ /* @__PURE__ */ jsx31(
2478
3266
  "input",
2479
3267
  {
2480
3268
  className: "form-control",
@@ -2485,11 +3273,12 @@ function WrapIfAdditionalTemplate(props) {
2485
3273
  }
2486
3274
  )
2487
3275
  ] }) }),
2488
- /* @__PURE__ */ jsx25("div", { className: "form-additional form-group col-xs-5", children }),
2489
- /* @__PURE__ */ jsx25("div", { className: "col-xs-2", children: /* @__PURE__ */ jsx25(
3276
+ /* @__PURE__ */ jsx31("div", { className: "form-additional form-group col-xs-5", children }),
3277
+ /* @__PURE__ */ jsx31("div", { className: "col-xs-2", children: /* @__PURE__ */ jsx31(
2490
3278
  RemoveButton2,
2491
3279
  {
2492
- className: "array-item-remove btn-block",
3280
+ id: buttonId4(id, "remove"),
3281
+ className: "rjsf-object-property-remove btn-block",
2493
3282
  style: { border: "0" },
2494
3283
  disabled: disabled || readonly,
2495
3284
  onClick: onDropPropertyClick(label),
@@ -2505,6 +3294,7 @@ function templates() {
2505
3294
  return {
2506
3295
  ArrayFieldDescriptionTemplate,
2507
3296
  ArrayFieldItemTemplate,
3297
+ ArrayFieldItemButtonsTemplate,
2508
3298
  ArrayFieldTemplate,
2509
3299
  ArrayFieldTitleTemplate,
2510
3300
  ButtonTemplates: ButtonTemplates_default(),
@@ -2514,6 +3304,7 @@ function templates() {
2514
3304
  FieldTemplate: FieldTemplate_default,
2515
3305
  FieldErrorTemplate,
2516
3306
  FieldHelpTemplate,
3307
+ GridTemplate,
2517
3308
  ObjectFieldTemplate,
2518
3309
  TitleFieldTemplate: TitleField,
2519
3310
  UnsupportedFieldTemplate: UnsupportedField_default,
@@ -2523,7 +3314,7 @@ function templates() {
2523
3314
  var templates_default = templates;
2524
3315
 
2525
3316
  // src/components/widgets/AltDateWidget.tsx
2526
- import { useCallback as useCallback4, useEffect as useEffect2, useReducer, useState as useState2 } from "react";
3317
+ import { useCallback as useCallback4, useEffect as useEffect3, useReducer, useState as useState3 } from "react";
2527
3318
  import {
2528
3319
  ariaDescribedByIds as ariaDescribedByIds2,
2529
3320
  dateRangeOptions,
@@ -2532,7 +3323,7 @@ import {
2532
3323
  TranslatableString as TranslatableString11,
2533
3324
  getDateElementProps
2534
3325
  } from "@rjsf/utils";
2535
- import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
3326
+ import { jsx as jsx32, jsxs as jsxs15 } from "react/jsx-runtime";
2536
3327
  function readyForChange(state) {
2537
3328
  return Object.values(state).every((value) => value !== -1);
2538
3329
  }
@@ -2552,7 +3343,7 @@ function DateElement({
2552
3343
  }) {
2553
3344
  const id = rootId + "_" + type;
2554
3345
  const { SelectWidget: SelectWidget2 } = registry.widgets;
2555
- return /* @__PURE__ */ jsx26(
3346
+ return /* @__PURE__ */ jsx32(
2556
3347
  SelectWidget2,
2557
3348
  {
2558
3349
  schema: { type: "integer" },
@@ -2589,11 +3380,14 @@ function AltDateWidget({
2589
3380
  value
2590
3381
  }) {
2591
3382
  const { translateString } = registry;
2592
- const [lastValue, setLastValue] = useState2(value);
2593
- const [state, setState] = useReducer((state2, action) => {
2594
- return { ...state2, ...action };
2595
- }, parseDateString(value, time));
2596
- useEffect2(() => {
3383
+ const [lastValue, setLastValue] = useState3(value);
3384
+ const [state, setState] = useReducer(
3385
+ (state2, action) => {
3386
+ return { ...state2, ...action };
3387
+ },
3388
+ parseDateString(value, time)
3389
+ );
3390
+ useEffect3(() => {
2597
3391
  const stateValue = toDateString(state, time);
2598
3392
  if (readyForChange(state) && stateValue !== value) {
2599
3393
  onChange(stateValue);
@@ -2626,13 +3420,13 @@ function AltDateWidget({
2626
3420
  },
2627
3421
  [disabled, readonly, onChange]
2628
3422
  );
2629
- return /* @__PURE__ */ jsxs14("ul", { className: "list-inline", children: [
3423
+ return /* @__PURE__ */ jsxs15("ul", { className: "list-inline", children: [
2630
3424
  getDateElementProps(
2631
3425
  state,
2632
3426
  time,
2633
3427
  options.yearsRange,
2634
3428
  options.format
2635
- ).map((elemProps, i) => /* @__PURE__ */ jsx26("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx26(
3429
+ ).map((elemProps, i) => /* @__PURE__ */ jsx32("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx32(
2636
3430
  DateElement,
2637
3431
  {
2638
3432
  rootId: id,
@@ -2647,20 +3441,20 @@ function AltDateWidget({
2647
3441
  autofocus: autofocus && i === 0
2648
3442
  }
2649
3443
  ) }, i)),
2650
- (options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsx26("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx26("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(TranslatableString11.NowLabel) }) }),
2651
- (options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsx26("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx26("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(TranslatableString11.ClearLabel) }) })
3444
+ (options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsx32("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx32("a", { href: "#", className: "btn btn-info btn-now", onClick: handleSetNow, children: translateString(TranslatableString11.NowLabel) }) }),
3445
+ (options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsx32("li", { className: "list-inline-item", children: /* @__PURE__ */ jsx32("a", { href: "#", className: "btn btn-warning btn-clear", onClick: handleClear, children: translateString(TranslatableString11.ClearLabel) }) })
2652
3446
  ] });
2653
3447
  }
2654
3448
  var AltDateWidget_default = AltDateWidget;
2655
3449
 
2656
3450
  // src/components/widgets/AltDateTimeWidget.tsx
2657
- import { jsx as jsx27 } from "react/jsx-runtime";
3451
+ import { jsx as jsx33 } from "react/jsx-runtime";
2658
3452
  function AltDateTimeWidget({
2659
3453
  time = true,
2660
3454
  ...props
2661
3455
  }) {
2662
3456
  const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
2663
- return /* @__PURE__ */ jsx27(AltDateWidget2, { time, ...props });
3457
+ return /* @__PURE__ */ jsx33(AltDateWidget2, { time, ...props });
2664
3458
  }
2665
3459
  var AltDateTimeWidget_default = AltDateTimeWidget;
2666
3460
 
@@ -2669,11 +3463,11 @@ import { useCallback as useCallback5 } from "react";
2669
3463
  import {
2670
3464
  ariaDescribedByIds as ariaDescribedByIds3,
2671
3465
  descriptionId as descriptionId4,
2672
- getTemplate as getTemplate9,
3466
+ getTemplate as getTemplate13,
2673
3467
  labelValue,
2674
3468
  schemaRequiresTrueValue
2675
3469
  } from "@rjsf/utils";
2676
- import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
3470
+ import { jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
2677
3471
  function CheckboxWidget({
2678
3472
  schema,
2679
3473
  uiSchema,
@@ -2690,7 +3484,7 @@ function CheckboxWidget({
2690
3484
  onChange,
2691
3485
  registry
2692
3486
  }) {
2693
- const DescriptionFieldTemplate = getTemplate9(
3487
+ const DescriptionFieldTemplate = getTemplate13(
2694
3488
  "DescriptionFieldTemplate",
2695
3489
  registry,
2696
3490
  options
@@ -2709,8 +3503,8 @@ function CheckboxWidget({
2709
3503
  [onFocus, id]
2710
3504
  );
2711
3505
  const description = options.description ?? schema.description;
2712
- return /* @__PURE__ */ jsxs15("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
2713
- !hideLabel && !!description && /* @__PURE__ */ jsx28(
3506
+ return /* @__PURE__ */ jsxs16("div", { className: `checkbox ${disabled || readonly ? "disabled" : ""}`, children: [
3507
+ !hideLabel && description && /* @__PURE__ */ jsx34(
2714
3508
  DescriptionFieldTemplate,
2715
3509
  {
2716
3510
  id: descriptionId4(id),
@@ -2720,8 +3514,8 @@ function CheckboxWidget({
2720
3514
  registry
2721
3515
  }
2722
3516
  ),
2723
- /* @__PURE__ */ jsxs15("label", { children: [
2724
- /* @__PURE__ */ jsx28(
3517
+ /* @__PURE__ */ jsxs16("label", { children: [
3518
+ /* @__PURE__ */ jsx34(
2725
3519
  "input",
2726
3520
  {
2727
3521
  type: "checkbox",
@@ -2737,7 +3531,7 @@ function CheckboxWidget({
2737
3531
  "aria-describedby": ariaDescribedByIds3(id)
2738
3532
  }
2739
3533
  ),
2740
- labelValue(/* @__PURE__ */ jsx28("span", { children: label }), hideLabel)
3534
+ labelValue(/* @__PURE__ */ jsx34("span", { children: label }), hideLabel)
2741
3535
  ] })
2742
3536
  ] });
2743
3537
  }
@@ -2753,7 +3547,7 @@ import {
2753
3547
  enumOptionsValueForIndex,
2754
3548
  optionId
2755
3549
  } from "@rjsf/utils";
2756
- import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
3550
+ import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
2757
3551
  function CheckboxesWidget({
2758
3552
  id,
2759
3553
  disabled,
@@ -2774,7 +3568,7 @@ function CheckboxesWidget({
2774
3568
  ({ target }) => onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue)),
2775
3569
  [onFocus, id]
2776
3570
  );
2777
- return /* @__PURE__ */ jsx29("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
3571
+ return /* @__PURE__ */ jsx35("div", { className: "checkboxes", id, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
2778
3572
  const checked = enumOptionsIsSelected(option.value, checkboxesValues);
2779
3573
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
2780
3574
  const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
@@ -2785,8 +3579,8 @@ function CheckboxesWidget({
2785
3579
  onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
2786
3580
  }
2787
3581
  };
2788
- const checkbox = /* @__PURE__ */ jsxs16("span", { children: [
2789
- /* @__PURE__ */ jsx29(
3582
+ const checkbox = /* @__PURE__ */ jsxs17("span", { children: [
3583
+ /* @__PURE__ */ jsx35(
2790
3584
  "input",
2791
3585
  {
2792
3586
  type: "checkbox",
@@ -2802,44 +3596,44 @@ function CheckboxesWidget({
2802
3596
  "aria-describedby": ariaDescribedByIds4(id)
2803
3597
  }
2804
3598
  ),
2805
- /* @__PURE__ */ jsx29("span", { children: option.label })
3599
+ /* @__PURE__ */ jsx35("span", { children: option.label })
2806
3600
  ] });
2807
- return inline ? /* @__PURE__ */ jsx29("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ jsx29("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsx29("label", { children: checkbox }) }, index);
3601
+ return inline ? /* @__PURE__ */ jsx35("label", { className: `checkbox-inline ${disabledCls}`, children: checkbox }, index) : /* @__PURE__ */ jsx35("div", { className: `checkbox ${disabledCls}`, children: /* @__PURE__ */ jsx35("label", { children: checkbox }) }, index);
2808
3602
  }) });
2809
3603
  }
2810
3604
  var CheckboxesWidget_default = CheckboxesWidget;
2811
3605
 
2812
3606
  // src/components/widgets/ColorWidget.tsx
2813
- import { getTemplate as getTemplate10 } from "@rjsf/utils";
2814
- import { jsx as jsx30 } from "react/jsx-runtime";
3607
+ import { getTemplate as getTemplate14 } from "@rjsf/utils";
3608
+ import { jsx as jsx36 } from "react/jsx-runtime";
2815
3609
  function ColorWidget(props) {
2816
3610
  const { disabled, readonly, options, registry } = props;
2817
- const BaseInputTemplate2 = getTemplate10("BaseInputTemplate", registry, options);
2818
- return /* @__PURE__ */ jsx30(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
3611
+ const BaseInputTemplate2 = getTemplate14("BaseInputTemplate", registry, options);
3612
+ return /* @__PURE__ */ jsx36(BaseInputTemplate2, { type: "color", ...props, disabled: disabled || readonly });
2819
3613
  }
2820
3614
 
2821
3615
  // src/components/widgets/DateWidget.tsx
2822
3616
  import { useCallback as useCallback7 } from "react";
2823
- import { getTemplate as getTemplate11 } from "@rjsf/utils";
2824
- import { jsx as jsx31 } from "react/jsx-runtime";
3617
+ import { getTemplate as getTemplate15 } from "@rjsf/utils";
3618
+ import { jsx as jsx37 } from "react/jsx-runtime";
2825
3619
  function DateWidget(props) {
2826
3620
  const { onChange, options, registry } = props;
2827
- const BaseInputTemplate2 = getTemplate11("BaseInputTemplate", registry, options);
3621
+ const BaseInputTemplate2 = getTemplate15("BaseInputTemplate", registry, options);
2828
3622
  const handleChange = useCallback7((value) => onChange(value || void 0), [onChange]);
2829
- return /* @__PURE__ */ jsx31(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
3623
+ return /* @__PURE__ */ jsx37(BaseInputTemplate2, { type: "date", ...props, onChange: handleChange });
2830
3624
  }
2831
3625
 
2832
3626
  // src/components/widgets/DateTimeWidget.tsx
2833
3627
  import {
2834
- getTemplate as getTemplate12,
3628
+ getTemplate as getTemplate16,
2835
3629
  localToUTC,
2836
3630
  utcToLocal
2837
3631
  } from "@rjsf/utils";
2838
- import { jsx as jsx32 } from "react/jsx-runtime";
3632
+ import { jsx as jsx38 } from "react/jsx-runtime";
2839
3633
  function DateTimeWidget(props) {
2840
3634
  const { onChange, value, options, registry } = props;
2841
- const BaseInputTemplate2 = getTemplate12("BaseInputTemplate", registry, options);
2842
- return /* @__PURE__ */ jsx32(
3635
+ const BaseInputTemplate2 = getTemplate16("BaseInputTemplate", registry, options);
3636
+ return /* @__PURE__ */ jsx38(
2843
3637
  BaseInputTemplate2,
2844
3638
  {
2845
3639
  type: "datetime-local",
@@ -2851,23 +3645,23 @@ function DateTimeWidget(props) {
2851
3645
  }
2852
3646
 
2853
3647
  // src/components/widgets/EmailWidget.tsx
2854
- import { getTemplate as getTemplate13 } from "@rjsf/utils";
2855
- import { jsx as jsx33 } from "react/jsx-runtime";
3648
+ import { getTemplate as getTemplate17 } from "@rjsf/utils";
3649
+ import { jsx as jsx39 } from "react/jsx-runtime";
2856
3650
  function EmailWidget(props) {
2857
3651
  const { options, registry } = props;
2858
- const BaseInputTemplate2 = getTemplate13("BaseInputTemplate", registry, options);
2859
- return /* @__PURE__ */ jsx33(BaseInputTemplate2, { type: "email", ...props });
3652
+ const BaseInputTemplate2 = getTemplate17("BaseInputTemplate", registry, options);
3653
+ return /* @__PURE__ */ jsx39(BaseInputTemplate2, { type: "email", ...props });
2860
3654
  }
2861
3655
 
2862
3656
  // src/components/widgets/FileWidget.tsx
2863
- import { useCallback as useCallback8, useMemo } from "react";
3657
+ import { useCallback as useCallback8, useMemo as useMemo2 } from "react";
2864
3658
  import {
2865
3659
  dataURItoBlob,
2866
- getTemplate as getTemplate14,
3660
+ getTemplate as getTemplate18,
2867
3661
  TranslatableString as TranslatableString12
2868
3662
  } from "@rjsf/utils";
2869
3663
  import Markdown4 from "markdown-to-jsx";
2870
- import { Fragment as Fragment3, jsx as jsx34, jsxs as jsxs17 } from "react/jsx-runtime";
3664
+ import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs18 } from "react/jsx-runtime";
2871
3665
  function addNameToDataURL(dataURL, name) {
2872
3666
  if (dataURL === null) {
2873
3667
  return null;
@@ -2912,11 +3706,11 @@ function FileInfoPreview({
2912
3706
  return null;
2913
3707
  }
2914
3708
  if (["image/jpeg", "image/png"].includes(type)) {
2915
- return /* @__PURE__ */ jsx34("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
3709
+ return /* @__PURE__ */ jsx40("img", { src: dataURL, style: { maxWidth: "100%" }, className: "file-preview" });
2916
3710
  }
2917
- return /* @__PURE__ */ jsxs17(Fragment3, { children: [
3711
+ return /* @__PURE__ */ jsxs18(Fragment4, { children: [
2918
3712
  " ",
2919
- /* @__PURE__ */ jsx34("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(TranslatableString12.PreviewLabel) })
3713
+ /* @__PURE__ */ jsx40("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(TranslatableString12.PreviewLabel) })
2920
3714
  ] });
2921
3715
  }
2922
3716
  function FilesInfo({
@@ -2930,14 +3724,14 @@ function FilesInfo({
2930
3724
  return null;
2931
3725
  }
2932
3726
  const { translateString } = registry;
2933
- const { RemoveButton: RemoveButton2 } = getTemplate14("ButtonTemplates", registry, options);
2934
- return /* @__PURE__ */ jsx34("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
3727
+ const { RemoveButton: RemoveButton2 } = getTemplate18("ButtonTemplates", registry, options);
3728
+ return /* @__PURE__ */ jsx40("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
2935
3729
  const { name, size, type } = fileInfo;
2936
3730
  const handleRemove = () => onRemove(key);
2937
- return /* @__PURE__ */ jsxs17("li", { children: [
2938
- /* @__PURE__ */ jsx34(Markdown4, { children: translateString(TranslatableString12.FilesInfo, [name, type, String(size)]) }),
2939
- preview && /* @__PURE__ */ jsx34(FileInfoPreview, { fileInfo, registry }),
2940
- /* @__PURE__ */ jsx34(RemoveButton2, { onClick: handleRemove, registry })
3731
+ return /* @__PURE__ */ jsxs18("li", { children: [
3732
+ /* @__PURE__ */ jsx40(Markdown4, { children: translateString(TranslatableString12.FilesInfo, [name, type, String(size)]) }),
3733
+ preview && /* @__PURE__ */ jsx40(FileInfoPreview, { fileInfo, registry }),
3734
+ /* @__PURE__ */ jsx40(RemoveButton2, { onClick: handleRemove, registry })
2941
3735
  ] }, key);
2942
3736
  }) });
2943
3737
  }
@@ -2957,14 +3751,14 @@ function extractFileInfo(dataURLs) {
2957
3751
  type: blob.type
2958
3752
  }
2959
3753
  ];
2960
- } catch (e) {
3754
+ } catch {
2961
3755
  return acc;
2962
3756
  }
2963
3757
  }, []);
2964
3758
  }
2965
3759
  function FileWidget(props) {
2966
3760
  const { disabled, readonly, required, multiple, onChange, value, options, registry } = props;
2967
- const BaseInputTemplate2 = getTemplate14("BaseInputTemplate", registry, options);
3761
+ const BaseInputTemplate2 = getTemplate18("BaseInputTemplate", registry, options);
2968
3762
  const handleChange = useCallback8(
2969
3763
  (event) => {
2970
3764
  if (!event.target.files) {
@@ -2973,7 +3767,7 @@ function FileWidget(props) {
2973
3767
  processFiles(event.target.files).then((filesInfoEvent) => {
2974
3768
  const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL);
2975
3769
  if (multiple) {
2976
- onChange(value.concat(newValue[0]));
3770
+ onChange(value.concat(newValue));
2977
3771
  } else {
2978
3772
  onChange(newValue[0]);
2979
3773
  }
@@ -2981,7 +3775,7 @@ function FileWidget(props) {
2981
3775
  },
2982
3776
  [multiple, value, onChange]
2983
3777
  );
2984
- const filesInfo = useMemo(() => extractFileInfo(Array.isArray(value) ? value : [value]), [value]);
3778
+ const filesInfo = useMemo2(() => extractFileInfo(Array.isArray(value) ? value : [value]), [value]);
2985
3779
  const rmFile = useCallback8(
2986
3780
  (index) => {
2987
3781
  if (multiple) {
@@ -2993,8 +3787,8 @@ function FileWidget(props) {
2993
3787
  },
2994
3788
  [multiple, value, onChange]
2995
3789
  );
2996
- return /* @__PURE__ */ jsxs17("div", { children: [
2997
- /* @__PURE__ */ jsx34(
3790
+ return /* @__PURE__ */ jsxs18("div", { children: [
3791
+ /* @__PURE__ */ jsx40(
2998
3792
  BaseInputTemplate2,
2999
3793
  {
3000
3794
  ...props,
@@ -3006,7 +3800,7 @@ function FileWidget(props) {
3006
3800
  accept: options.accept ? String(options.accept) : void 0
3007
3801
  }
3008
3802
  ),
3009
- /* @__PURE__ */ jsx34(
3803
+ /* @__PURE__ */ jsx40(
3010
3804
  FilesInfo,
3011
3805
  {
3012
3806
  filesInfo,
@@ -3021,22 +3815,22 @@ function FileWidget(props) {
3021
3815
  var FileWidget_default = FileWidget;
3022
3816
 
3023
3817
  // src/components/widgets/HiddenWidget.tsx
3024
- import { jsx as jsx35 } from "react/jsx-runtime";
3818
+ import { jsx as jsx41 } from "react/jsx-runtime";
3025
3819
  function HiddenWidget({
3026
3820
  id,
3027
3821
  value
3028
3822
  }) {
3029
- return /* @__PURE__ */ jsx35("input", { type: "hidden", id, name: id, value: typeof value === "undefined" ? "" : value });
3823
+ return /* @__PURE__ */ jsx41("input", { type: "hidden", id, name: id, value: typeof value === "undefined" ? "" : value });
3030
3824
  }
3031
3825
  var HiddenWidget_default = HiddenWidget;
3032
3826
 
3033
3827
  // src/components/widgets/PasswordWidget.tsx
3034
- import { getTemplate as getTemplate15 } from "@rjsf/utils";
3035
- import { jsx as jsx36 } from "react/jsx-runtime";
3828
+ import { getTemplate as getTemplate19 } from "@rjsf/utils";
3829
+ import { jsx as jsx42 } from "react/jsx-runtime";
3036
3830
  function PasswordWidget(props) {
3037
3831
  const { options, registry } = props;
3038
- const BaseInputTemplate2 = getTemplate15("BaseInputTemplate", registry, options);
3039
- return /* @__PURE__ */ jsx36(BaseInputTemplate2, { type: "password", ...props });
3832
+ const BaseInputTemplate2 = getTemplate19("BaseInputTemplate", registry, options);
3833
+ return /* @__PURE__ */ jsx42(BaseInputTemplate2, { type: "password", ...props });
3040
3834
  }
3041
3835
 
3042
3836
  // src/components/widgets/RadioWidget.tsx
@@ -3047,7 +3841,7 @@ import {
3047
3841
  enumOptionsValueForIndex as enumOptionsValueForIndex2,
3048
3842
  optionId as optionId2
3049
3843
  } from "@rjsf/utils";
3050
- import { jsx as jsx37, jsxs as jsxs18 } from "react/jsx-runtime";
3844
+ import { jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
3051
3845
  function RadioWidget({
3052
3846
  options,
3053
3847
  value,
@@ -3063,19 +3857,19 @@ function RadioWidget({
3063
3857
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
3064
3858
  const handleBlur = useCallback9(
3065
3859
  ({ target }) => onBlur(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue)),
3066
- [onBlur, id]
3860
+ [onBlur, enumOptions, emptyValue, id]
3067
3861
  );
3068
3862
  const handleFocus = useCallback9(
3069
3863
  ({ target }) => onFocus(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue)),
3070
- [onFocus, id]
3864
+ [onFocus, enumOptions, emptyValue, id]
3071
3865
  );
3072
- return /* @__PURE__ */ jsx37("div", { className: "field-radio-group", id, children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
3866
+ return /* @__PURE__ */ jsx43("div", { className: "field-radio-group", id, role: "radiogroup", children: Array.isArray(enumOptions) && enumOptions.map((option, i) => {
3073
3867
  const checked = enumOptionsIsSelected2(option.value, value);
3074
3868
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
3075
3869
  const disabledCls = disabled || itemDisabled || readonly ? "disabled" : "";
3076
3870
  const handleChange = () => onChange(option.value);
3077
- const radio = /* @__PURE__ */ jsxs18("span", { children: [
3078
- /* @__PURE__ */ jsx37(
3871
+ const radio = /* @__PURE__ */ jsxs19("span", { children: [
3872
+ /* @__PURE__ */ jsx43(
3079
3873
  "input",
3080
3874
  {
3081
3875
  type: "radio",
@@ -3092,15 +3886,15 @@ function RadioWidget({
3092
3886
  "aria-describedby": ariaDescribedByIds5(id)
3093
3887
  }
3094
3888
  ),
3095
- /* @__PURE__ */ jsx37("span", { children: option.label })
3889
+ /* @__PURE__ */ jsx43("span", { children: option.label })
3096
3890
  ] });
3097
- return inline ? /* @__PURE__ */ jsx37("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ jsx37("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ jsx37("label", { children: radio }) }, i);
3891
+ return inline ? /* @__PURE__ */ jsx43("label", { className: `radio-inline ${disabledCls}`, children: radio }, i) : /* @__PURE__ */ jsx43("div", { className: `radio ${disabledCls}`, children: /* @__PURE__ */ jsx43("label", { children: radio }) }, i);
3098
3892
  }) });
3099
3893
  }
3100
3894
  var RadioWidget_default = RadioWidget;
3101
3895
 
3102
3896
  // src/components/widgets/RangeWidget.tsx
3103
- import { jsx as jsx38, jsxs as jsxs19 } from "react/jsx-runtime";
3897
+ import { jsx as jsx44, jsxs as jsxs20 } from "react/jsx-runtime";
3104
3898
  function RangeWidget(props) {
3105
3899
  const {
3106
3900
  value,
@@ -3108,20 +3902,123 @@ function RangeWidget(props) {
3108
3902
  templates: { BaseInputTemplate: BaseInputTemplate2 }
3109
3903
  }
3110
3904
  } = props;
3111
- return /* @__PURE__ */ jsxs19("div", { className: "field-range-wrapper", children: [
3112
- /* @__PURE__ */ jsx38(BaseInputTemplate2, { type: "range", ...props }),
3113
- /* @__PURE__ */ jsx38("span", { className: "range-view", children: value })
3905
+ return /* @__PURE__ */ jsxs20("div", { className: "field-range-wrapper", children: [
3906
+ /* @__PURE__ */ jsx44(BaseInputTemplate2, { type: "range", ...props }),
3907
+ /* @__PURE__ */ jsx44("span", { className: "range-view", children: value })
3114
3908
  ] });
3115
3909
  }
3116
3910
 
3117
- // src/components/widgets/SelectWidget.tsx
3911
+ // src/components/widgets/RatingWidget.tsx
3118
3912
  import { useCallback as useCallback10 } from "react";
3913
+ import { Fragment as Fragment5, jsx as jsx45, jsxs as jsxs21 } from "react/jsx-runtime";
3914
+ function RatingWidget({
3915
+ id,
3916
+ value,
3917
+ required,
3918
+ disabled,
3919
+ readonly,
3920
+ autofocus,
3921
+ onChange,
3922
+ onFocus,
3923
+ onBlur,
3924
+ schema,
3925
+ options
3926
+ }) {
3927
+ const { stars = 5, shape = "star" } = options;
3928
+ const numStars = schema.maximum ? Math.min(schema.maximum, 5) : Math.min(Math.max(stars, 1), 5);
3929
+ const min = schema.minimum || 0;
3930
+ const handleStarClick = useCallback10(
3931
+ (starValue) => {
3932
+ if (!disabled && !readonly) {
3933
+ onChange(starValue);
3934
+ }
3935
+ },
3936
+ [onChange, disabled, readonly]
3937
+ );
3938
+ const handleFocus = useCallback10(
3939
+ (event) => {
3940
+ if (onFocus) {
3941
+ const starValue = Number(event.target.dataset.value);
3942
+ onFocus(id, starValue);
3943
+ }
3944
+ },
3945
+ [onFocus, id]
3946
+ );
3947
+ const handleBlur = useCallback10(
3948
+ (event) => {
3949
+ if (onBlur) {
3950
+ const starValue = Number(event.target.dataset.value);
3951
+ onBlur(id, starValue);
3952
+ }
3953
+ },
3954
+ [onBlur, id]
3955
+ );
3956
+ const getSymbol = (isFilled) => {
3957
+ if (shape === "heart") {
3958
+ return isFilled ? "\u2665" : "\u2661";
3959
+ }
3960
+ return isFilled ? "\u2605" : "\u2606";
3961
+ };
3962
+ return /* @__PURE__ */ jsx45(Fragment5, { children: /* @__PURE__ */ jsxs21(
3963
+ "div",
3964
+ {
3965
+ className: "rating-widget",
3966
+ style: {
3967
+ display: "inline-flex",
3968
+ fontSize: "1.5rem",
3969
+ cursor: disabled || readonly ? "default" : "pointer"
3970
+ },
3971
+ children: [
3972
+ [...Array(numStars)].map((_, index) => {
3973
+ const starValue = min + index;
3974
+ const isFilled = starValue <= value;
3975
+ return /* @__PURE__ */ jsx45(
3976
+ "span",
3977
+ {
3978
+ onClick: () => handleStarClick(starValue),
3979
+ onFocus: handleFocus,
3980
+ onBlur: handleBlur,
3981
+ "data-value": starValue,
3982
+ tabIndex: disabled || readonly ? -1 : 0,
3983
+ role: "radio",
3984
+ "aria-checked": starValue === value,
3985
+ "aria-label": `${starValue} ${shape === "heart" ? "heart" : "star"}${starValue === 1 ? "" : "s"}`,
3986
+ style: {
3987
+ color: isFilled ? "#FFD700" : "#ccc",
3988
+ padding: "0 0.2rem",
3989
+ transition: "color 0.2s",
3990
+ userSelect: "none"
3991
+ },
3992
+ children: getSymbol(isFilled)
3993
+ },
3994
+ index
3995
+ );
3996
+ }),
3997
+ /* @__PURE__ */ jsx45(
3998
+ "input",
3999
+ {
4000
+ type: "hidden",
4001
+ id,
4002
+ name: id,
4003
+ value: value || "",
4004
+ required,
4005
+ disabled: disabled || readonly,
4006
+ "aria-hidden": "true"
4007
+ }
4008
+ )
4009
+ ]
4010
+ }
4011
+ ) });
4012
+ }
4013
+
4014
+ // src/components/widgets/SelectWidget.tsx
4015
+ import { useCallback as useCallback11 } from "react";
3119
4016
  import {
3120
4017
  ariaDescribedByIds as ariaDescribedByIds6,
3121
4018
  enumOptionsIndexForValue,
3122
4019
  enumOptionsValueForIndex as enumOptionsValueForIndex3
3123
4020
  } from "@rjsf/utils";
3124
- import { jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
4021
+ import { jsx as jsx46, jsxs as jsxs22 } from "react/jsx-runtime";
3125
4022
  function getValue(event, multiple) {
3126
4023
  if (multiple) {
3127
4024
  return Array.from(event.target.options).slice().filter((o) => o.selected).map((o) => o.value);
@@ -3145,35 +4042,36 @@ function SelectWidget({
3145
4042
  }) {
3146
4043
  const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
3147
4044
  const emptyValue = multiple ? [] : "";
3148
- const handleFocus = useCallback10(
4045
+ const handleFocus = useCallback11(
3149
4046
  (event) => {
3150
4047
  const newValue = getValue(event, multiple);
3151
4048
  return onFocus(id, enumOptionsValueForIndex3(newValue, enumOptions, optEmptyVal));
3152
4049
  },
3153
- [onFocus, id, schema, multiple, enumOptions, optEmptyVal]
4050
+ [onFocus, id, multiple, enumOptions, optEmptyVal]
3154
4051
  );
3155
- const handleBlur = useCallback10(
4052
+ const handleBlur = useCallback11(
3156
4053
  (event) => {
3157
4054
  const newValue = getValue(event, multiple);
3158
4055
  return onBlur(id, enumOptionsValueForIndex3(newValue, enumOptions, optEmptyVal));
3159
4056
  },
3160
- [onBlur, id, schema, multiple, enumOptions, optEmptyVal]
4057
+ [onBlur, id, multiple, enumOptions, optEmptyVal]
3161
4058
  );
3162
- const handleChange = useCallback10(
4059
+ const handleChange = useCallback11(
3163
4060
  (event) => {
3164
4061
  const newValue = getValue(event, multiple);
3165
4062
  return onChange(enumOptionsValueForIndex3(newValue, enumOptions, optEmptyVal));
3166
4063
  },
3167
- [onChange, schema, multiple, enumOptions, optEmptyVal]
4064
+ [onChange, multiple, enumOptions, optEmptyVal]
3168
4065
  );
3169
4066
  const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
3170
4067
  const showPlaceholderOption = !multiple && schema.default === void 0;
3171
- return /* @__PURE__ */ jsxs20(
4068
+ return /* @__PURE__ */ jsxs22(
3172
4069
  "select",
3173
4070
  {
3174
4071
  id,
3175
4072
  name: id,
3176
4073
  multiple,
4074
+ role: "combobox",
3177
4075
  className: "form-control",
3178
4076
  value: typeof selectedIndexes === "undefined" ? emptyValue : selectedIndexes,
3179
4077
  required,
@@ -3184,10 +4082,10 @@ function SelectWidget({
3184
4082
  onChange: handleChange,
3185
4083
  "aria-describedby": ariaDescribedByIds6(id),
3186
4084
  children: [
3187
- showPlaceholderOption && /* @__PURE__ */ jsx39("option", { value: "", children: placeholder }),
4085
+ showPlaceholderOption && /* @__PURE__ */ jsx46("option", { value: "", children: placeholder }),
3188
4086
  Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
3189
4087
  const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
3190
- return /* @__PURE__ */ jsx39("option", { value: String(i), disabled: disabled2, children: label }, i);
4088
+ return /* @__PURE__ */ jsx46("option", { value: String(i), disabled: disabled2, children: label }, i);
3191
4089
  })
3192
4090
  ]
3193
4091
  }
@@ -3196,9 +4094,9 @@ function SelectWidget({
3196
4094
  var SelectWidget_default = SelectWidget;
3197
4095
 
3198
4096
  // src/components/widgets/TextareaWidget.tsx
3199
- import { useCallback as useCallback11 } from "react";
4097
+ import { useCallback as useCallback12 } from "react";
3200
4098
  import { ariaDescribedByIds as ariaDescribedByIds7 } from "@rjsf/utils";
3201
- import { jsx as jsx40 } from "react/jsx-runtime";
4099
+ import { jsx as jsx47 } from "react/jsx-runtime";
3202
4100
  function TextareaWidget({
3203
4101
  id,
3204
4102
  options = {},
@@ -3212,19 +4110,19 @@ function TextareaWidget({
3212
4110
  onBlur,
3213
4111
  onFocus
3214
4112
  }) {
3215
- const handleChange = useCallback11(
4113
+ const handleChange = useCallback12(
3216
4114
  ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
3217
4115
  [onChange, options.emptyValue]
3218
4116
  );
3219
- const handleBlur = useCallback11(
4117
+ const handleBlur = useCallback12(
3220
4118
  ({ target }) => onBlur(id, target && target.value),
3221
4119
  [onBlur, id]
3222
4120
  );
3223
- const handleFocus = useCallback11(
4121
+ const handleFocus = useCallback12(
3224
4122
  ({ target }) => onFocus(id, target && target.value),
3225
4123
  [id, onFocus]
3226
4124
  );
3227
- return /* @__PURE__ */ jsx40(
4125
+ return /* @__PURE__ */ jsx47(
3228
4126
  "textarea",
3229
4127
  {
3230
4128
  id,
@@ -3251,41 +4149,41 @@ TextareaWidget.defaultProps = {
3251
4149
  var TextareaWidget_default = TextareaWidget;
3252
4150
 
3253
4151
  // src/components/widgets/TextWidget.tsx
3254
- import { getTemplate as getTemplate16 } from "@rjsf/utils";
3255
- import { jsx as jsx41 } from "react/jsx-runtime";
4152
+ import { getTemplate as getTemplate20 } from "@rjsf/utils";
4153
+ import { jsx as jsx48 } from "react/jsx-runtime";
3256
4154
  function TextWidget(props) {
3257
4155
  const { options, registry } = props;
3258
- const BaseInputTemplate2 = getTemplate16("BaseInputTemplate", registry, options);
3259
- return /* @__PURE__ */ jsx41(BaseInputTemplate2, { ...props });
4156
+ const BaseInputTemplate2 = getTemplate20("BaseInputTemplate", registry, options);
4157
+ return /* @__PURE__ */ jsx48(BaseInputTemplate2, { ...props });
3260
4158
  }
3261
4159
 
3262
4160
  // src/components/widgets/TimeWidget.tsx
3263
- import { useCallback as useCallback12 } from "react";
3264
- import { getTemplate as getTemplate17 } from "@rjsf/utils";
3265
- import { jsx as jsx42 } from "react/jsx-runtime";
4161
+ import { useCallback as useCallback13 } from "react";
4162
+ import { getTemplate as getTemplate21 } from "@rjsf/utils";
4163
+ import { jsx as jsx49 } from "react/jsx-runtime";
3266
4164
  function TimeWidget(props) {
3267
4165
  const { onChange, options, registry } = props;
3268
- const BaseInputTemplate2 = getTemplate17("BaseInputTemplate", registry, options);
3269
- const handleChange = useCallback12((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
3270
- return /* @__PURE__ */ jsx42(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
4166
+ const BaseInputTemplate2 = getTemplate21("BaseInputTemplate", registry, options);
4167
+ const handleChange = useCallback13((value) => onChange(value ? `${value}:00` : void 0), [onChange]);
4168
+ return /* @__PURE__ */ jsx49(BaseInputTemplate2, { type: "time", ...props, onChange: handleChange });
3271
4169
  }
3272
4170
 
3273
4171
  // src/components/widgets/URLWidget.tsx
3274
- import { getTemplate as getTemplate18 } from "@rjsf/utils";
3275
- import { jsx as jsx43 } from "react/jsx-runtime";
4172
+ import { getTemplate as getTemplate22 } from "@rjsf/utils";
4173
+ import { jsx as jsx50 } from "react/jsx-runtime";
3276
4174
  function URLWidget(props) {
3277
4175
  const { options, registry } = props;
3278
- const BaseInputTemplate2 = getTemplate18("BaseInputTemplate", registry, options);
3279
- return /* @__PURE__ */ jsx43(BaseInputTemplate2, { type: "url", ...props });
4176
+ const BaseInputTemplate2 = getTemplate22("BaseInputTemplate", registry, options);
4177
+ return /* @__PURE__ */ jsx50(BaseInputTemplate2, { type: "url", ...props });
3280
4178
  }
3281
4179
 
3282
4180
  // src/components/widgets/UpDownWidget.tsx
3283
- import { getTemplate as getTemplate19 } from "@rjsf/utils";
3284
- import { jsx as jsx44 } from "react/jsx-runtime";
4181
+ import { getTemplate as getTemplate23 } from "@rjsf/utils";
4182
+ import { jsx as jsx51 } from "react/jsx-runtime";
3285
4183
  function UpDownWidget(props) {
3286
4184
  const { options, registry } = props;
3287
- const BaseInputTemplate2 = getTemplate19("BaseInputTemplate", registry, options);
3288
- return /* @__PURE__ */ jsx44(BaseInputTemplate2, { type: "number", ...props });
4185
+ const BaseInputTemplate2 = getTemplate23("BaseInputTemplate", registry, options);
4186
+ return /* @__PURE__ */ jsx51(BaseInputTemplate2, { type: "number", ...props });
3289
4187
  }
3290
4188
 
3291
4189
  // src/components/widgets/index.ts
@@ -3304,6 +4202,7 @@ function widgets() {
3304
4202
  PasswordWidget,
3305
4203
  RadioWidget: RadioWidget_default,
3306
4204
  RangeWidget,
4205
+ RatingWidget,
3307
4206
  SelectWidget: SelectWidget_default,
3308
4207
  TextWidget,
3309
4208
  TextareaWidget: TextareaWidget_default,
@@ -3327,8 +4226,12 @@ function getDefaultRegistry() {
3327
4226
  }
3328
4227
 
3329
4228
  // src/components/Form.tsx
3330
- import { jsx as jsx45, jsxs as jsxs21 } from "react/jsx-runtime";
4229
+ import { jsx as jsx52, jsxs as jsxs23 } from "react/jsx-runtime";
3331
4230
  var Form = class extends Component5 {
4231
+ /** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
4232
+ * provide any possible type here
4233
+ */
4234
+ formElement;
3332
4235
  /** Constructs the `Form` from the `props`. Will setup the initial state from the props. It will also call the
3333
4236
  * `onChange` handler if the initially provided `formData` is modified to add missing default values as part of the
3334
4237
  * state construction.
@@ -3337,270 +4240,6 @@ var Form = class extends Component5 {
3337
4240
  */
3338
4241
  constructor(props) {
3339
4242
  super(props);
3340
- /** Returns the `formData` with only the elements specified in the `fields` list
3341
- *
3342
- * @param formData - The data for the `Form`
3343
- * @param fields - The fields to keep while filtering
3344
- */
3345
- this.getUsedFormData = (formData, fields2) => {
3346
- if (fields2.length === 0 && typeof formData !== "object") {
3347
- return formData;
3348
- }
3349
- const data = _pick(formData, fields2);
3350
- if (Array.isArray(formData)) {
3351
- return Object.keys(data).map((key) => data[key]);
3352
- }
3353
- return data;
3354
- };
3355
- /** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`
3356
- *
3357
- * @param pathSchema - The `PathSchema` object for the form
3358
- * @param [formData] - The form data to use while checking for empty objects/arrays
3359
- */
3360
- this.getFieldNames = (pathSchema, formData) => {
3361
- const getAllPaths = (_obj, acc = [], paths = [[]]) => {
3362
- Object.keys(_obj).forEach((key) => {
3363
- if (typeof _obj[key] === "object") {
3364
- const newPaths = paths.map((path) => [...path, key]);
3365
- if (_obj[key][RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== "") {
3366
- acc.push(_obj[key][NAME_KEY]);
3367
- } else {
3368
- getAllPaths(_obj[key], acc, newPaths);
3369
- }
3370
- } else if (key === NAME_KEY && _obj[key] !== "") {
3371
- paths.forEach((path) => {
3372
- const formValue = _get(formData, path);
3373
- if (typeof formValue !== "object" || _isEmpty(formValue) || Array.isArray(formValue) && formValue.every((val) => typeof val !== "object")) {
3374
- acc.push(path);
3375
- }
3376
- });
3377
- }
3378
- });
3379
- return acc;
3380
- };
3381
- return getAllPaths(pathSchema);
3382
- };
3383
- /** Returns the `formData` after filtering to remove any extra data not in a form field
3384
- *
3385
- * @param formData - The data for the `Form`
3386
- * @returns The `formData` after omitting extra data
3387
- */
3388
- this.omitExtraData = (formData) => {
3389
- const { schema, schemaUtils } = this.state;
3390
- const retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
3391
- const pathSchema = schemaUtils.toPathSchema(retrievedSchema, "", formData);
3392
- const fieldNames = this.getFieldNames(pathSchema, formData);
3393
- const newFormData = this.getUsedFormData(formData, fieldNames);
3394
- return newFormData;
3395
- };
3396
- /** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the
3397
- * `formData` along with a new `ErrorSchema`. It will first update the `formData` with any missing default fields and
3398
- * then, if `omitExtraData` and `liveOmit` are turned on, the `formData` will be filtered to remove any extra data not
3399
- * in a form field. Then, the resulting formData will be validated if required. The state will be updated with the new
3400
- * updated (potentially filtered) `formData`, any errors that resulted from validation. Finally the `onChange`
3401
- * callback will be called if specified with the updated state.
3402
- *
3403
- * @param formData - The new form data from a change to a field
3404
- * @param newErrorSchema - The new `ErrorSchema` based on the field change
3405
- * @param id - The id of the field that caused the change
3406
- */
3407
- this.onChange = (formData, newErrorSchema, id) => {
3408
- const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
3409
- const { schemaUtils, schema, retrievedSchema } = this.state;
3410
- if (isObject5(formData) || Array.isArray(formData)) {
3411
- const newState = this.getStateFromProps(this.props, formData, retrievedSchema);
3412
- formData = newState.formData;
3413
- }
3414
- const mustValidate = !noValidate && liveValidate;
3415
- let state = { formData, schema };
3416
- let newFormData = formData;
3417
- let _retrievedSchema;
3418
- if (omitExtraData === true && liveOmit === true) {
3419
- newFormData = this.omitExtraData(formData);
3420
- state = {
3421
- formData: newFormData
3422
- };
3423
- }
3424
- if (mustValidate) {
3425
- const schemaValidation = this.validate(newFormData, schema, schemaUtils, retrievedSchema);
3426
- let errors = schemaValidation.errors;
3427
- let errorSchema = schemaValidation.errorSchema;
3428
- const schemaValidationErrors = errors;
3429
- const schemaValidationErrorSchema = errorSchema;
3430
- if (extraErrors) {
3431
- const merged = validationDataMerge(schemaValidation, extraErrors);
3432
- errorSchema = merged.errorSchema;
3433
- errors = merged.errors;
3434
- }
3435
- if (newErrorSchema) {
3436
- const filteredErrors = this.filterErrorsBasedOnSchema(newErrorSchema, retrievedSchema, newFormData);
3437
- errorSchema = mergeObjects2(errorSchema, filteredErrors, "preventDuplicates");
3438
- }
3439
- state = {
3440
- formData: newFormData,
3441
- errors,
3442
- errorSchema,
3443
- schemaValidationErrors,
3444
- schemaValidationErrorSchema
3445
- };
3446
- } else if (!noValidate && newErrorSchema) {
3447
- const errorSchema = extraErrors ? mergeObjects2(newErrorSchema, extraErrors, "preventDuplicates") : newErrorSchema;
3448
- state = {
3449
- formData: newFormData,
3450
- errorSchema,
3451
- errors: toErrorList(errorSchema)
3452
- };
3453
- }
3454
- if (_retrievedSchema) {
3455
- state.retrievedSchema = _retrievedSchema;
3456
- }
3457
- this.setState(state, () => onChange && onChange({ ...this.state, ...state }, id));
3458
- };
3459
- /**
3460
- * Callback function to handle reset form data.
3461
- * - Reset all fields with default values.
3462
- * - Reset validations and errors
3463
- *
3464
- */
3465
- this.reset = () => {
3466
- const { onChange } = this.props;
3467
- const newState = this.getStateFromProps(this.props, void 0);
3468
- const newFormData = newState.formData;
3469
- const state = {
3470
- formData: newFormData,
3471
- errorSchema: {},
3472
- errors: [],
3473
- schemaValidationErrors: [],
3474
- schemaValidationErrorSchema: {}
3475
- };
3476
- this.setState(state, () => onChange && onChange({ ...this.state, ...state }));
3477
- };
3478
- /** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
3479
- * was provided.
3480
- *
3481
- * @param id - The unique `id` of the field that was blurred
3482
- * @param data - The data associated with the field that was blurred
3483
- */
3484
- this.onBlur = (id, data) => {
3485
- const { onBlur } = this.props;
3486
- if (onBlur) {
3487
- onBlur(id, data);
3488
- }
3489
- };
3490
- /** Callback function to handle when a field on the form is focused. Calls the `onFocus` callback for the `Form` if it
3491
- * was provided.
3492
- *
3493
- * @param id - The unique `id` of the field that was focused
3494
- * @param data - The data associated with the field that was focused
3495
- */
3496
- this.onFocus = (id, data) => {
3497
- const { onFocus } = this.props;
3498
- if (onFocus) {
3499
- onFocus(id, data);
3500
- }
3501
- };
3502
- /** Callback function to handle when the form is submitted. First, it prevents the default event behavior. Nothing
3503
- * happens if the target and currentTarget of the event are not the same. It will omit any extra data in the
3504
- * `formData` in the state if `omitExtraData` is true. It will validate the resulting `formData`, reporting errors
3505
- * via the `onError()` callback unless validation is disabled. Finally, it will add in any `extraErrors` and then call
3506
- * back the `onSubmit` callback if it was provided.
3507
- *
3508
- * @param event - The submit HTML form event
3509
- */
3510
- this.onSubmit = (event) => {
3511
- event.preventDefault();
3512
- if (event.target !== event.currentTarget) {
3513
- return;
3514
- }
3515
- event.persist();
3516
- const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
3517
- let { formData: newFormData } = this.state;
3518
- if (omitExtraData === true) {
3519
- newFormData = this.omitExtraData(newFormData);
3520
- }
3521
- if (noValidate || this.validateFormWithFormData(newFormData)) {
3522
- const errorSchema = extraErrors || {};
3523
- const errors = extraErrors ? toErrorList(extraErrors) : [];
3524
- this.setState(
3525
- {
3526
- formData: newFormData,
3527
- errors,
3528
- errorSchema,
3529
- schemaValidationErrors: [],
3530
- schemaValidationErrorSchema: {}
3531
- },
3532
- () => {
3533
- if (onSubmit) {
3534
- onSubmit({ ...this.state, formData: newFormData, status: "submitted" }, event);
3535
- }
3536
- }
3537
- );
3538
- }
3539
- };
3540
- /** Provides a function that can be used to programmatically submit the `Form` */
3541
- this.submit = () => {
3542
- if (this.formElement.current) {
3543
- const submitCustomEvent = new CustomEvent("submit", {
3544
- cancelable: true
3545
- });
3546
- submitCustomEvent.preventDefault();
3547
- this.formElement.current.dispatchEvent(submitCustomEvent);
3548
- this.formElement.current.requestSubmit();
3549
- }
3550
- };
3551
- /** Validates the form using the given `formData`. For use on form submission or on programmatic validation.
3552
- * If `onError` is provided, then it will be called with the list of errors.
3553
- *
3554
- * @param formData - The form data to validate
3555
- * @returns - True if the form is valid, false otherwise.
3556
- */
3557
- this.validateFormWithFormData = (formData) => {
3558
- const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props;
3559
- const { errors: prevErrors } = this.state;
3560
- const schemaValidation = this.validate(formData);
3561
- let errors = schemaValidation.errors;
3562
- let errorSchema = schemaValidation.errorSchema;
3563
- const schemaValidationErrors = errors;
3564
- const schemaValidationErrorSchema = errorSchema;
3565
- const hasError = errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
3566
- if (hasError) {
3567
- if (extraErrors) {
3568
- const merged = validationDataMerge(schemaValidation, extraErrors);
3569
- errorSchema = merged.errorSchema;
3570
- errors = merged.errors;
3571
- }
3572
- if (focusOnFirstError) {
3573
- if (typeof focusOnFirstError === "function") {
3574
- focusOnFirstError(errors[0]);
3575
- } else {
3576
- this.focusOnError(errors[0]);
3577
- }
3578
- }
3579
- this.setState(
3580
- {
3581
- errors,
3582
- errorSchema,
3583
- schemaValidationErrors,
3584
- schemaValidationErrorSchema
3585
- },
3586
- () => {
3587
- if (onError) {
3588
- onError(errors);
3589
- } else {
3590
- console.error("Form validation failed", errors);
3591
- }
3592
- }
3593
- );
3594
- } else if (prevErrors.length > 0) {
3595
- this.setState({
3596
- errors: [],
3597
- errorSchema: {},
3598
- schemaValidationErrors: [],
3599
- schemaValidationErrorSchema: {}
3600
- });
3601
- }
3602
- return !hasError;
3603
- };
3604
4243
  if (!props.validator) {
3605
4244
  throw new Error("A validator is required for Form functionality to work");
3606
4245
  }
@@ -3630,8 +4269,9 @@ var Form = class extends Component5 {
3630
4269
  */
3631
4270
  getSnapshotBeforeUpdate(prevProps, prevState) {
3632
4271
  if (!deepEquals3(this.props, prevProps)) {
4272
+ const formDataChangedFields = getChangedFields(this.props.formData, prevProps.formData);
3633
4273
  const isSchemaChanged = !deepEquals3(prevProps.schema, this.props.schema);
3634
- const isFormDataChanged = !deepEquals3(prevProps.formData, this.props.formData);
4274
+ const isFormDataChanged = formDataChangedFields.length > 0 || !deepEquals3(prevProps.formData, this.props.formData);
3635
4275
  const nextState = this.getStateFromProps(
3636
4276
  this.props,
3637
4277
  this.props.formData,
@@ -3639,7 +4279,8 @@ var Form = class extends Component5 {
3639
4279
  // Or if the `formData` changes, for example in the case of a schema with dependencies that need to
3640
4280
  // match one of the subSchemas, the retrieved schema must be updated.
3641
4281
  isSchemaChanged || isFormDataChanged ? void 0 : this.state.retrievedSchema,
3642
- isSchemaChanged
4282
+ isSchemaChanged,
4283
+ formDataChangedFields
3643
4284
  );
3644
4285
  const shouldUpdate = !deepEquals3(nextState, prevState);
3645
4286
  return { nextState, shouldUpdate };
@@ -3654,9 +4295,6 @@ var Form = class extends Component5 {
3654
4295
  * If an update is required, it applies the next state and, if needed, triggers the `onChange` handler to inform about
3655
4296
  * changes.
3656
4297
  *
3657
- * This method effectively replaces the deprecated `UNSAFE_componentWillReceiveProps`, providing a safer alternative
3658
- * to handle prop changes and state updates.
3659
- *
3660
4298
  * @param _ - The previous set of props.
3661
4299
  * @param prevState - The previous state of the component before the update.
3662
4300
  * @param snapshot - The value returned from `getSnapshotBeforeUpdate`.
@@ -3678,9 +4316,10 @@ var Form = class extends Component5 {
3678
4316
  * @param inputFormData - The new or current data for the `Form`
3679
4317
  * @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.
3680
4318
  * @param isSchemaChanged - A flag indicating whether the schema has changed.
4319
+ * @param formDataChangedFields - The changed fields of `formData`
3681
4320
  * @returns - The new state for the `Form`
3682
4321
  */
3683
- getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false) {
4322
+ getStateFromProps(props, inputFormData, retrievedSchema, isSchemaChanged = false, formDataChangedFields = []) {
3684
4323
  const state = this.state || {};
3685
4324
  const schema = "schema" in props ? props.schema : this.props.schema;
3686
4325
  const uiSchema = ("uiSchema" in props ? props.uiSchema : this.props.uiSchema) || {};
@@ -3689,12 +4328,25 @@ var Form = class extends Component5 {
3689
4328
  const mustValidate = edit && !props.noValidate && liveValidate;
3690
4329
  const rootSchema = schema;
3691
4330
  const experimental_defaultFormStateBehavior = "experimental_defaultFormStateBehavior" in props ? props.experimental_defaultFormStateBehavior : this.props.experimental_defaultFormStateBehavior;
4331
+ const experimental_customMergeAllOf = "experimental_customMergeAllOf" in props ? props.experimental_customMergeAllOf : this.props.experimental_customMergeAllOf;
3692
4332
  let schemaUtils = state.schemaUtils;
3693
- if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema, experimental_defaultFormStateBehavior)) {
3694
- schemaUtils = createSchemaUtils(props.validator, rootSchema, experimental_defaultFormStateBehavior);
4333
+ if (!schemaUtils || schemaUtils.doesSchemaUtilsDiffer(
4334
+ props.validator,
4335
+ rootSchema,
4336
+ experimental_defaultFormStateBehavior,
4337
+ experimental_customMergeAllOf
4338
+ )) {
4339
+ schemaUtils = createSchemaUtils(
4340
+ props.validator,
4341
+ rootSchema,
4342
+ experimental_defaultFormStateBehavior,
4343
+ experimental_customMergeAllOf
4344
+ );
3695
4345
  }
3696
4346
  const formData = schemaUtils.getDefaultFormState(schema, inputFormData);
3697
- const _retrievedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);
4347
+ const _retrievedSchema = this.updateRetrievedSchema(
4348
+ retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData)
4349
+ );
3698
4350
  const getCurrentErrors = () => {
3699
4351
  if (props.noValidate || isSchemaChanged) {
3700
4352
  return { errors: [], errorSchema: {} };
@@ -3716,10 +4368,10 @@ var Form = class extends Component5 {
3716
4368
  if (mustValidate) {
3717
4369
  const schemaValidation = this.validate(formData, schema, schemaUtils, _retrievedSchema);
3718
4370
  errors = schemaValidation.errors;
3719
- if (isSchemaChanged) {
4371
+ if (retrievedSchema === void 0) {
3720
4372
  errorSchema = schemaValidation.errorSchema;
3721
4373
  } else {
3722
- errorSchema = mergeObjects2(
4374
+ errorSchema = mergeObjects3(
3723
4375
  this.state?.errorSchema,
3724
4376
  schemaValidation.errorSchema,
3725
4377
  "preventDuplicates"
@@ -3731,6 +4383,20 @@ var Form = class extends Component5 {
3731
4383
  const currentErrors = getCurrentErrors();
3732
4384
  errors = currentErrors.errors;
3733
4385
  errorSchema = currentErrors.errorSchema;
4386
+ if (formDataChangedFields.length > 0) {
4387
+ const newErrorSchema = formDataChangedFields.reduce(
4388
+ (acc, key) => {
4389
+ acc[key] = void 0;
4390
+ return acc;
4391
+ },
4392
+ {}
4393
+ );
4394
+ errorSchema = schemaValidationErrorSchema = mergeObjects3(
4395
+ currentErrors.errorSchema,
4396
+ newErrorSchema,
4397
+ "preventDuplicates"
4398
+ );
4399
+ }
3734
4400
  }
3735
4401
  if (props.extraErrors) {
3736
4402
  const merged = validationDataMerge({ errorSchema, errors }, props.extraErrors);
@@ -3768,6 +4434,21 @@ var Form = class extends Component5 {
3768
4434
  shouldComponentUpdate(nextProps, nextState) {
3769
4435
  return shouldRender(this, nextProps, nextState);
3770
4436
  }
4437
+ /** Gets the previously raised customValidate errors.
4438
+ *
4439
+ * @returns the previous customValidate errors
4440
+ */
4441
+ getPreviousCustomValidateErrors() {
4442
+ const { customValidate, uiSchema } = this.props;
4443
+ const prevFormData = this.state.formData;
4444
+ let customValidateErrors = {};
4445
+ if (typeof customValidate === "function") {
4446
+ const errorHandler = customValidate(prevFormData, createErrorHandler(prevFormData), uiSchema);
4447
+ const userErrorSchema = unwrapErrorHandler(errorHandler);
4448
+ customValidateErrors = userErrorSchema;
4449
+ }
4450
+ return customValidateErrors;
4451
+ }
3771
4452
  /** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
3772
4453
  * `schemaUtils` in the state), returning the results.
3773
4454
  *
@@ -3785,10 +4466,10 @@ var Form = class extends Component5 {
3785
4466
  renderErrors(registry) {
3786
4467
  const { errors, errorSchema, schema, uiSchema } = this.state;
3787
4468
  const { formContext } = this.props;
3788
- const options = getUiOptions12(uiSchema);
3789
- const ErrorListTemplate = getTemplate20("ErrorListTemplate", registry, options);
4469
+ const options = getUiOptions17(uiSchema);
4470
+ const ErrorListTemplate = getTemplate24("ErrorListTemplate", registry, options);
3790
4471
  if (errors && errors.length) {
3791
- return /* @__PURE__ */ jsx45(
4472
+ return /* @__PURE__ */ jsx52(
3792
4473
  ErrorListTemplate,
3793
4474
  {
3794
4475
  errors,
@@ -3802,6 +4483,62 @@ var Form = class extends Component5 {
3802
4483
  }
3803
4484
  return null;
3804
4485
  }
4486
+ /** Returns the `formData` with only the elements specified in the `fields` list
4487
+ *
4488
+ * @param formData - The data for the `Form`
4489
+ * @param fields - The fields to keep while filtering
4490
+ */
4491
+ getUsedFormData = (formData, fields2) => {
4492
+ if (fields2.length === 0 && typeof formData !== "object") {
4493
+ return formData;
4494
+ }
4495
+ const data = _pick(formData, fields2);
4496
+ if (Array.isArray(formData)) {
4497
+ return Object.keys(data).map((key) => data[key]);
4498
+ }
4499
+ return data;
4500
+ };
4501
+ /** Returns the list of field names from inspecting the `pathSchema` as well as using the `formData`
4502
+ *
4503
+ * @param pathSchema - The `PathSchema` object for the form
4504
+ * @param [formData] - The form data to use while checking for empty objects/arrays
4505
+ */
4506
+ getFieldNames = (pathSchema, formData) => {
4507
+ const getAllPaths = (_obj, acc = [], paths = [[]]) => {
4508
+ Object.keys(_obj).forEach((key) => {
4509
+ if (typeof _obj[key] === "object") {
4510
+ const newPaths = paths.map((path) => [...path, key]);
4511
+ if (_obj[key][RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== "") {
4512
+ acc.push(_obj[key][NAME_KEY]);
4513
+ } else {
4514
+ getAllPaths(_obj[key], acc, newPaths);
4515
+ }
4516
+ } else if (key === NAME_KEY && _obj[key] !== "") {
4517
+ paths.forEach((path) => {
4518
+ const formValue = _get(formData, path);
4519
+ if (typeof formValue !== "object" || _isEmpty(formValue) || Array.isArray(formValue) && formValue.every((val) => typeof val !== "object")) {
4520
+ acc.push(path);
4521
+ }
4522
+ });
4523
+ }
4524
+ });
4525
+ return acc;
4526
+ };
4527
+ return getAllPaths(pathSchema);
4528
+ };
4529
+ /** Returns the `formData` after filtering to remove any extra data not in a form field
4530
+ *
4531
+ * @param formData - The data for the `Form`
4532
+ * @returns The `formData` after omitting extra data
4533
+ */
4534
+ omitExtraData = (formData) => {
4535
+ const { schema, schemaUtils } = this.state;
4536
+ const retrievedSchema = schemaUtils.retrieveSchema(schema, formData);
4537
+ const pathSchema = schemaUtils.toPathSchema(retrievedSchema, "", formData);
4538
+ const fieldNames = this.getFieldNames(pathSchema, formData);
4539
+ const newFormData = this.getUsedFormData(formData, fieldNames);
4540
+ return newFormData;
4541
+ };
3805
4542
  // Filtering errors based on your retrieved schema to only show errors for properties in the selected branch.
3806
4543
  filterErrorsBasedOnSchema(schemaErrors, resolvedSchema, formData) {
3807
4544
  const { retrievedSchema, schemaUtils } = this.state;
@@ -3812,18 +4549,185 @@ var Form = class extends Component5 {
3812
4549
  if (resolvedSchema?.type !== "object" && resolvedSchema?.type !== "array") {
3813
4550
  filteredErrors.__errors = schemaErrors.__errors;
3814
4551
  }
3815
- const filterUndefinedErrors = (errors) => {
4552
+ const prevCustomValidateErrors = this.getPreviousCustomValidateErrors();
4553
+ const filterPreviousCustomErrors = (errors = [], prevCustomErrors) => {
4554
+ if (errors.length === 0) {
4555
+ return errors;
4556
+ }
4557
+ return errors.filter((error) => {
4558
+ return !prevCustomErrors.includes(error);
4559
+ });
4560
+ };
4561
+ const filterNilOrEmptyErrors = (errors, previousCustomValidateErrors = {}) => {
3816
4562
  _forEach(errors, (errorAtKey, errorKey) => {
3817
- if (errorAtKey === void 0) {
4563
+ const prevCustomValidateErrorAtKey = previousCustomValidateErrors[errorKey];
4564
+ if (_isNil(errorAtKey) || Array.isArray(errorAtKey) && errorAtKey.length === 0) {
3818
4565
  delete errors[errorKey];
4566
+ } else if (isObject6(errorAtKey) && isObject6(prevCustomValidateErrorAtKey) && Array.isArray(prevCustomValidateErrorAtKey?.__errors)) {
4567
+ errors[errorKey] = filterPreviousCustomErrors(errorAtKey.__errors, prevCustomValidateErrorAtKey.__errors);
3819
4568
  } else if (typeof errorAtKey === "object" && !Array.isArray(errorAtKey.__errors)) {
3820
- filterUndefinedErrors(errorAtKey);
4569
+ filterNilOrEmptyErrors(errorAtKey, previousCustomValidateErrors[errorKey]);
3821
4570
  }
3822
4571
  });
3823
4572
  return errors;
3824
4573
  };
3825
- return filterUndefinedErrors(filteredErrors);
4574
+ return filterNilOrEmptyErrors(filteredErrors, prevCustomValidateErrors);
4575
+ }
4576
+ /** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the
4577
+ * `formData` along with a new `ErrorSchema`. It will first update the `formData` with any missing default fields and
4578
+ * then, if `omitExtraData` and `liveOmit` are turned on, the `formData` will be filtered to remove any extra data not
4579
+ * in a form field. Then, the resulting formData will be validated if required. The state will be updated with the new
4580
+ * updated (potentially filtered) `formData`, any errors that resulted from validation. Finally the `onChange`
4581
+ * callback will be called if specified with the updated state.
4582
+ *
4583
+ * @param formData - The new form data from a change to a field
4584
+ * @param newErrorSchema - The new `ErrorSchema` based on the field change
4585
+ * @param id - The id of the field that caused the change
4586
+ */
4587
+ onChange = (formData, newErrorSchema, id) => {
4588
+ const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
4589
+ const { schemaUtils, schema } = this.state;
4590
+ let retrievedSchema = this.state.retrievedSchema;
4591
+ if (isObject6(formData) || Array.isArray(formData)) {
4592
+ const newState = this.getStateFromProps(this.props, formData);
4593
+ formData = newState.formData;
4594
+ retrievedSchema = newState.retrievedSchema;
4595
+ }
4596
+ const mustValidate = !noValidate && liveValidate;
4597
+ let state = { formData, schema };
4598
+ let newFormData = formData;
4599
+ if (omitExtraData === true && liveOmit === true) {
4600
+ newFormData = this.omitExtraData(formData);
4601
+ state = {
4602
+ formData: newFormData
4603
+ };
4604
+ }
4605
+ if (mustValidate) {
4606
+ const schemaValidation = this.validate(newFormData, schema, schemaUtils, retrievedSchema);
4607
+ let errors = schemaValidation.errors;
4608
+ let errorSchema = schemaValidation.errorSchema;
4609
+ const schemaValidationErrors = errors;
4610
+ const schemaValidationErrorSchema = errorSchema;
4611
+ if (extraErrors) {
4612
+ const merged = validationDataMerge(schemaValidation, extraErrors);
4613
+ errorSchema = merged.errorSchema;
4614
+ errors = merged.errors;
4615
+ }
4616
+ if (newErrorSchema) {
4617
+ const filteredErrors = this.filterErrorsBasedOnSchema(newErrorSchema, retrievedSchema, newFormData);
4618
+ errorSchema = mergeObjects3(errorSchema, filteredErrors, "preventDuplicates");
4619
+ }
4620
+ state = {
4621
+ formData: newFormData,
4622
+ errors,
4623
+ errorSchema,
4624
+ schemaValidationErrors,
4625
+ schemaValidationErrorSchema
4626
+ };
4627
+ } else if (!noValidate && newErrorSchema) {
4628
+ const errorSchema = extraErrors ? mergeObjects3(newErrorSchema, extraErrors, "preventDuplicates") : newErrorSchema;
4629
+ state = {
4630
+ formData: newFormData,
4631
+ errorSchema,
4632
+ errors: toErrorList(errorSchema)
4633
+ };
4634
+ }
4635
+ this.setState(state, () => onChange && onChange({ ...this.state, ...state }, id));
4636
+ };
4637
+ /**
4638
+ * If the retrievedSchema has changed the new retrievedSchema is returned.
4639
+ * Otherwise, the old retrievedSchema is returned to persist reference.
4640
+ * - This ensures that AJV retrieves the schema from the cache when it has not changed,
4641
+ * avoiding the performance cost of recompiling the schema.
4642
+ *
4643
+ * @param retrievedSchema The new retrieved schema.
4644
+ * @returns The new retrieved schema if it has changed, else the old retrieved schema.
4645
+ */
4646
+ updateRetrievedSchema(retrievedSchema) {
4647
+ const isTheSame = deepEquals3(retrievedSchema, this.state?.retrievedSchema);
4648
+ return isTheSame ? this.state.retrievedSchema : retrievedSchema;
3826
4649
  }
4650
+ /**
4651
+ * Callback function to handle reset form data.
4652
+ * - Reset all fields with default values.
4653
+ * - Reset validations and errors
4654
+ *
4655
+ */
4656
+ reset = () => {
4657
+ const { onChange } = this.props;
4658
+ const newState = this.getStateFromProps(this.props, void 0);
4659
+ const newFormData = newState.formData;
4660
+ const state = {
4661
+ formData: newFormData,
4662
+ errorSchema: {},
4663
+ errors: [],
4664
+ schemaValidationErrors: [],
4665
+ schemaValidationErrorSchema: {}
4666
+ };
4667
+ this.setState(state, () => onChange && onChange({ ...this.state, ...state }));
4668
+ };
4669
+ /** Callback function to handle when a field on the form is blurred. Calls the `onBlur` callback for the `Form` if it
4670
+ * was provided.
4671
+ *
4672
+ * @param id - The unique `id` of the field that was blurred
4673
+ * @param data - The data associated with the field that was blurred
4674
+ */
4675
+ onBlur = (id, data) => {
4676
+ const { onBlur } = this.props;
4677
+ if (onBlur) {
4678
+ onBlur(id, data);
4679
+ }
4680
+ };
4681
+ /** Callback function to handle when a field on the form is focused. Calls the `onFocus` callback for the `Form` if it
4682
+ * was provided.
4683
+ *
4684
+ * @param id - The unique `id` of the field that was focused
4685
+ * @param data - The data associated with the field that was focused
4686
+ */
4687
+ onFocus = (id, data) => {
4688
+ const { onFocus } = this.props;
4689
+ if (onFocus) {
4690
+ onFocus(id, data);
4691
+ }
4692
+ };
4693
+ /** Callback function to handle when the form is submitted. First, it prevents the default event behavior. Nothing
4694
+ * happens if the target and currentTarget of the event are not the same. It will omit any extra data in the
4695
+ * `formData` in the state if `omitExtraData` is true. It will validate the resulting `formData`, reporting errors
4696
+ * via the `onError()` callback unless validation is disabled. Finally, it will add in any `extraErrors` and then call
4697
+ * back the `onSubmit` callback if it was provided.
4698
+ *
4699
+ * @param event - The submit HTML form event
4700
+ */
4701
+ onSubmit = (event) => {
4702
+ event.preventDefault();
4703
+ if (event.target !== event.currentTarget) {
4704
+ return;
4705
+ }
4706
+ event.persist();
4707
+ const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
4708
+ let { formData: newFormData } = this.state;
4709
+ if (omitExtraData === true) {
4710
+ newFormData = this.omitExtraData(newFormData);
4711
+ }
4712
+ if (noValidate || this.validateFormWithFormData(newFormData)) {
4713
+ const errorSchema = extraErrors || {};
4714
+ const errors = extraErrors ? toErrorList(extraErrors) : [];
4715
+ this.setState(
4716
+ {
4717
+ formData: newFormData,
4718
+ errors,
4719
+ errorSchema,
4720
+ schemaValidationErrors: [],
4721
+ schemaValidationErrorSchema: {}
4722
+ },
4723
+ () => {
4724
+ if (onSubmit) {
4725
+ onSubmit({ ...this.state, formData: newFormData, status: "submitted" }, event);
4726
+ }
4727
+ }
4728
+ );
4729
+ }
4730
+ };
3827
4731
  /** Returns the registry for the form */
3828
4732
  getRegistry() {
3829
4733
  const { translateString: customTranslateString, uiSchema = {} } = this.props;
@@ -3847,6 +4751,17 @@ var Form = class extends Component5 {
3847
4751
  globalUiOptions: uiSchema[UI_GLOBAL_OPTIONS_KEY]
3848
4752
  };
3849
4753
  }
4754
+ /** Provides a function that can be used to programmatically submit the `Form` */
4755
+ submit = () => {
4756
+ if (this.formElement.current) {
4757
+ const submitCustomEvent = new CustomEvent("submit", {
4758
+ cancelable: true
4759
+ });
4760
+ submitCustomEvent.preventDefault();
4761
+ this.formElement.current.dispatchEvent(submitCustomEvent);
4762
+ this.formElement.current.requestSubmit();
4763
+ }
4764
+ };
3850
4765
  /** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error
3851
4766
  * field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that
3852
4767
  * id is attempted to be found using the `formElement` ref. If it is located, then it is focused.
@@ -3865,7 +4780,7 @@ var Form = class extends Component5 {
3865
4780
  const elementId = path.join(idSeparator);
3866
4781
  let field = this.formElement.current.elements[elementId];
3867
4782
  if (!field) {
3868
- field = this.formElement.current.querySelector(`input[id^=${elementId}`);
4783
+ field = this.formElement.current.querySelector(`input[id^="${elementId}"`);
3869
4784
  }
3870
4785
  if (field && field.length) {
3871
4786
  field = field[0];
@@ -3874,6 +4789,59 @@ var Form = class extends Component5 {
3874
4789
  field.focus();
3875
4790
  }
3876
4791
  }
4792
+ /** Validates the form using the given `formData`. For use on form submission or on programmatic validation.
4793
+ * If `onError` is provided, then it will be called with the list of errors.
4794
+ *
4795
+ * @param formData - The form data to validate
4796
+ * @returns - True if the form is valid, false otherwise.
4797
+ */
4798
+ validateFormWithFormData = (formData) => {
4799
+ const { extraErrors, extraErrorsBlockSubmit, focusOnFirstError, onError } = this.props;
4800
+ const { errors: prevErrors } = this.state;
4801
+ const schemaValidation = this.validate(formData);
4802
+ let errors = schemaValidation.errors;
4803
+ let errorSchema = schemaValidation.errorSchema;
4804
+ const schemaValidationErrors = errors;
4805
+ const schemaValidationErrorSchema = errorSchema;
4806
+ const hasError = errors.length > 0 || extraErrors && extraErrorsBlockSubmit;
4807
+ if (hasError) {
4808
+ if (extraErrors) {
4809
+ const merged = validationDataMerge(schemaValidation, extraErrors);
4810
+ errorSchema = merged.errorSchema;
4811
+ errors = merged.errors;
4812
+ }
4813
+ if (focusOnFirstError) {
4814
+ if (typeof focusOnFirstError === "function") {
4815
+ focusOnFirstError(errors[0]);
4816
+ } else {
4817
+ this.focusOnError(errors[0]);
4818
+ }
4819
+ }
4820
+ this.setState(
4821
+ {
4822
+ errors,
4823
+ errorSchema,
4824
+ schemaValidationErrors,
4825
+ schemaValidationErrorSchema
4826
+ },
4827
+ () => {
4828
+ if (onError) {
4829
+ onError(errors);
4830
+ } else {
4831
+ console.error("Form validation failed", errors);
4832
+ }
4833
+ }
4834
+ );
4835
+ } else if (prevErrors.length > 0) {
4836
+ this.setState({
4837
+ errors: [],
4838
+ errorSchema: {},
4839
+ schemaValidationErrors: [],
4840
+ schemaValidationErrorSchema: {}
4841
+ });
4842
+ }
4843
+ return !hasError;
4844
+ };
3877
4845
  /** Programmatically validate the form. If `omitExtraData` is true, the `formData` will first be filtered to remove
3878
4846
  * any extra data not in a form field. If `onError` is provided, then it will be called with the list of errors the
3879
4847
  * same way as would happen on form submission.
@@ -3905,7 +4873,6 @@ var Form = class extends Component5 {
3905
4873
  action,
3906
4874
  autoComplete,
3907
4875
  enctype,
3908
- acceptcharset,
3909
4876
  acceptCharset,
3910
4877
  noHtml5Validate = false,
3911
4878
  disabled,
@@ -3920,12 +4887,12 @@ var Form = class extends Component5 {
3920
4887
  const { SubmitButton: SubmitButton2 } = registry.templates.ButtonTemplates;
3921
4888
  const as = _internalFormWrapper ? tagName : void 0;
3922
4889
  const FormTag = _internalFormWrapper || tagName || "form";
3923
- let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = getUiOptions12(uiSchema);
4890
+ let { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions = {} } = getUiOptions17(uiSchema);
3924
4891
  if (disabled) {
3925
4892
  submitOptions = { ...submitOptions, props: { ...submitOptions.props, disabled: true } };
3926
4893
  }
3927
- const submitUiSchema = { [UI_OPTIONS_KEY2]: { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
3928
- return /* @__PURE__ */ jsxs21(
4894
+ const submitUiSchema = { [UI_OPTIONS_KEY3]: { [SUBMIT_BTN_OPTIONS_KEY]: submitOptions } };
4895
+ return /* @__PURE__ */ jsxs23(
3929
4896
  FormTag,
3930
4897
  {
3931
4898
  className: className ? className : "rjsf",
@@ -3936,14 +4903,14 @@ var Form = class extends Component5 {
3936
4903
  action,
3937
4904
  autoComplete,
3938
4905
  encType: enctype,
3939
- acceptCharset: acceptCharset || acceptcharset,
4906
+ acceptCharset,
3940
4907
  noValidate: noHtml5Validate,
3941
4908
  onSubmit: this.onSubmit,
3942
4909
  as,
3943
4910
  ref: this.formElement,
3944
4911
  children: [
3945
4912
  showErrorList === "top" && this.renderErrors(registry),
3946
- /* @__PURE__ */ jsx45(
4913
+ /* @__PURE__ */ jsx52(
3947
4914
  _SchemaField,
3948
4915
  {
3949
4916
  name: "",
@@ -3963,7 +4930,7 @@ var Form = class extends Component5 {
3963
4930
  readonly
3964
4931
  }
3965
4932
  ),
3966
- children ? children : /* @__PURE__ */ jsx45(SubmitButton2, { uiSchema: submitUiSchema, registry }),
4933
+ children ? children : /* @__PURE__ */ jsx52(SubmitButton2, { uiSchema: submitUiSchema, registry }),
3967
4934
  showErrorList === "bottom" && this.renderErrors(registry)
3968
4935
  ]
3969
4936
  }
@@ -3973,7 +4940,7 @@ var Form = class extends Component5 {
3973
4940
 
3974
4941
  // src/withTheme.tsx
3975
4942
  import { forwardRef } from "react";
3976
- import { jsx as jsx46 } from "react/jsx-runtime";
4943
+ import { jsx as jsx53 } from "react/jsx-runtime";
3977
4944
  function withTheme(themeProps) {
3978
4945
  return forwardRef(
3979
4946
  ({ fields: fields2, widgets: widgets2, templates: templates2, ...directProps }, ref) => {
@@ -3987,7 +4954,7 @@ function withTheme(themeProps) {
3987
4954
  ...templates2?.ButtonTemplates
3988
4955
  }
3989
4956
  };
3990
- return /* @__PURE__ */ jsx46(
4957
+ return /* @__PURE__ */ jsx53(
3991
4958
  Form,
3992
4959
  {
3993
4960
  ...themeProps,
@@ -4003,9 +4970,10 @@ function withTheme(themeProps) {
4003
4970
  }
4004
4971
 
4005
4972
  // src/index.ts
4006
- var src_default = Form;
4973
+ var index_default = Form;
4007
4974
  export {
4008
- src_default as default,
4975
+ RichDescription,
4976
+ index_default as default,
4009
4977
  getDefaultRegistry,
4010
4978
  withTheme
4011
4979
  };