@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
@@ -0,0 +1,49 @@
1
+ import {
2
+ getTemplate,
3
+ getUiOptions,
4
+ titleId,
5
+ FieldProps,
6
+ FormContextType,
7
+ RJSFSchema,
8
+ StrictRJSFSchema,
9
+ TemplatesType,
10
+ } from '@rjsf/utils';
11
+
12
+ /** The `LayoutHeaderField` component renders a `TitleFieldTemplate` with an `id` derived from the `idSchema`
13
+ * and whether it is `required` from the props. The `title` is derived from the props as follows:
14
+ * - If there is a title in the `uiSchema`, it is displayed
15
+ * - Else, if there is an explicit `title` passed in the props, it is displayed
16
+ * - Otherwise, if there is a title in the `schema`, it is displayed
17
+ * - Finally, the `name` prop is displayed as the title
18
+ *
19
+ * @param props - The `LayoutHeaderField` for the component
20
+ */
21
+ export default function LayoutHeaderField<
22
+ T = any,
23
+ S extends StrictRJSFSchema = RJSFSchema,
24
+ F extends FormContextType = any,
25
+ >(props: FieldProps<T, S, F>) {
26
+ const { idSchema, title, schema, uiSchema, required, registry, name } = props;
27
+ const options = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);
28
+ const { title: uiTitle } = options;
29
+ const { title: schemaTitle } = schema;
30
+ const fieldTitle = uiTitle || title || schemaTitle || name;
31
+ if (!fieldTitle) {
32
+ return null;
33
+ }
34
+ const TitleFieldTemplate: TemplatesType<T, S, F>['TitleFieldTemplate'] = getTemplate<'TitleFieldTemplate', T, S, F>(
35
+ 'TitleFieldTemplate',
36
+ registry,
37
+ options,
38
+ );
39
+ return (
40
+ <TitleFieldTemplate
41
+ id={titleId<T>(idSchema)}
42
+ title={fieldTitle}
43
+ required={required}
44
+ schema={schema}
45
+ uiSchema={uiSchema}
46
+ registry={registry}
47
+ />
48
+ );
49
+ }
@@ -0,0 +1,228 @@
1
+ import { useState, useEffect } from 'react';
2
+ import {
3
+ ANY_OF_KEY,
4
+ CONST_KEY,
5
+ DEFAULT_KEY,
6
+ EnumOptionsType,
7
+ ERRORS_KEY,
8
+ FieldProps,
9
+ FormContextType,
10
+ getDiscriminatorFieldFromSchema,
11
+ hashObject,
12
+ ID_KEY,
13
+ ONE_OF_KEY,
14
+ optionsList,
15
+ PROPERTIES_KEY,
16
+ RJSFSchema,
17
+ getTemplate,
18
+ getUiOptions,
19
+ getWidget,
20
+ SchemaUtilsType,
21
+ StrictRJSFSchema,
22
+ UiSchema,
23
+ } from '@rjsf/utils';
24
+ import get from 'lodash/get';
25
+ import has from 'lodash/has';
26
+ import isEmpty from 'lodash/isEmpty';
27
+ import noop from 'lodash/noop';
28
+ import omit from 'lodash/omit';
29
+ import set from 'lodash/set';
30
+
31
+ /** Gets the selected option from the list of `options`, using the `selectorField` to search inside each `option` for
32
+ * the `properties[selectorField].default(or const)` that matches the given `value`.
33
+ *
34
+ * @param options - The list of schemas each representing a choice in the `oneOf`
35
+ * @param selectorField - The name of the field that is common in all of the schemas that represents the selector field
36
+ * @param value - The current value of the selector field from the data
37
+ */
38
+ export function getSelectedOption<S extends StrictRJSFSchema = RJSFSchema>(
39
+ options: EnumOptionsType<S>[],
40
+ selectorField: string,
41
+ value: unknown,
42
+ ): S | undefined {
43
+ const defaultValue = '!@#!@$@#$!@$#';
44
+ const schemaOptions: S[] = options.map(({ schema }) => schema!);
45
+ return schemaOptions.find((option) => {
46
+ const selector = get(option, [PROPERTIES_KEY, selectorField]);
47
+ const result = get(selector, DEFAULT_KEY, get(selector, CONST_KEY, defaultValue));
48
+ return result === value;
49
+ });
50
+ }
51
+
52
+ /** Computes the `enumOptions` array from the schema and options.
53
+ *
54
+ * @param schema - The schema that contains the `options`
55
+ * @param options - The options from the `schema`
56
+ * @param schemaUtils - The SchemaUtilsType object used to call retrieveSchema,
57
+ * @param [uiSchema] - The optional uiSchema for the schema
58
+ * @param [formData] - The optional formData associated with the schema
59
+ * @returns - The list of enumOptions for the `schema` and `options`
60
+ * @throws - Error when no enum options were computed
61
+ */
62
+ export function computeEnumOptions<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
63
+ schema: S,
64
+ options: S[],
65
+ schemaUtils: SchemaUtilsType<T, S, F>,
66
+ uiSchema?: UiSchema<T, S, F>,
67
+ formData?: T,
68
+ ): EnumOptionsType<S>[] {
69
+ const realOptions = options.map((opt: S) => schemaUtils.retrieveSchema(opt, formData));
70
+ let tempSchema = schema;
71
+ if (has(schema, ONE_OF_KEY)) {
72
+ tempSchema = { ...schema, [ONE_OF_KEY]: realOptions };
73
+ } else if (has(schema, ANY_OF_KEY)) {
74
+ tempSchema = { ...schema, [ANY_OF_KEY]: realOptions };
75
+ }
76
+ const enumOptions = optionsList<T, S, F>(tempSchema, uiSchema);
77
+ if (!enumOptions) {
78
+ throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(tempSchema)}`);
79
+ }
80
+ return enumOptions;
81
+ }
82
+
83
+ /** The `LayoutMultiSchemaField` is an adaptation of the `MultiSchemaField` but changed considerably to only
84
+ * support `anyOf`/`oneOf` fields that are being displayed in a `LayoutGridField` where the field selection is shown as
85
+ * a radio group by default. It expects that a `selectorField` is provided (either directly via the `discriminator`
86
+ * field or indirectly via `ui:optionsSchemaSelector` in the `uiSchema`) to help determine which `anyOf`/`oneOf` schema
87
+ * is active. If no `selectorField` is specified, then an error is thrown.
88
+ */
89
+ export default function LayoutMultiSchemaField<
90
+ T = any,
91
+ S extends StrictRJSFSchema = RJSFSchema,
92
+ F extends FormContextType = any,
93
+ >(props: FieldProps<T, S, F>) {
94
+ const {
95
+ name,
96
+ baseType,
97
+ disabled = false,
98
+ formData,
99
+ idSchema,
100
+ onBlur,
101
+ onChange,
102
+ options,
103
+ onFocus,
104
+ registry,
105
+ uiSchema,
106
+ schema,
107
+ formContext,
108
+ autofocus,
109
+ readonly,
110
+ required,
111
+ errorSchema,
112
+ hideError = false,
113
+ } = props;
114
+ const { widgets, schemaUtils, globalUiOptions } = registry;
115
+ const [enumOptions, setEnumOptions] = useState(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData)!);
116
+ const id = get(idSchema, ID_KEY);
117
+ const discriminator = getDiscriminatorFieldFromSchema(schema);
118
+ const FieldErrorTemplate = getTemplate<'FieldErrorTemplate', T, S, F>('FieldErrorTemplate', registry, options);
119
+ const FieldTemplate = getTemplate<'FieldTemplate', T, S, F>('FieldTemplate', registry, options);
120
+ const schemaHash = hashObject(schema);
121
+ const optionsHash = hashObject(options);
122
+ const uiSchemaHash = uiSchema ? hashObject(uiSchema) : '';
123
+ const formDataHash = formData ? hashObject(formData) : '';
124
+
125
+ useEffect(() => {
126
+ setEnumOptions(computeEnumOptions(schema, options, schemaUtils, uiSchema, formData));
127
+ // We are using hashes in place of the dependencies
128
+ // eslint-disable-next-line react-hooks/exhaustive-deps
129
+ }, [schemaHash, optionsHash, schemaUtils, uiSchemaHash, formDataHash]);
130
+ const {
131
+ widget = discriminator ? 'radio' : 'select',
132
+ title = '',
133
+ placeholder = '',
134
+ optionsSchemaSelector: selectorField = discriminator,
135
+ hideError: uiSchemaHideError,
136
+ ...uiOptions
137
+ } = getUiOptions<T, S, F>(uiSchema);
138
+ if (!selectorField) {
139
+ throw new Error('No selector field provided for the LayoutMultiSchemaField');
140
+ }
141
+ const selectedOption = get(formData, selectorField);
142
+ let optionSchema: S = get(enumOptions[0]?.schema, [PROPERTIES_KEY, selectorField], {}) as S;
143
+ const option = getSelectedOption<S>(enumOptions, selectorField, selectedOption);
144
+ // If the subschema doesn't declare a type, infer the type from the parent schema
145
+ optionSchema = optionSchema?.type ? optionSchema : ({ ...optionSchema, type: option?.type || baseType } as S);
146
+ const Widget = getWidget<T, S, F>(optionSchema!, widget, widgets);
147
+
148
+ // The following code was copied from `@rjsf`'s `SchemaField`
149
+ // Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children
150
+ const hideFieldError = uiSchemaHideError === undefined ? hideError : Boolean(uiSchemaHideError);
151
+
152
+ const rawErrors = get(errorSchema, [ERRORS_KEY], []) as string[];
153
+ const fieldErrorSchema = omit(errorSchema, [ERRORS_KEY]);
154
+ const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
155
+
156
+ /** Callback function that updates the selected option and adjusts the form data based on the structure of the new
157
+ * option, calling the `onChange` callback with the adjusted formData.
158
+ *
159
+ * @param opt - If the option is undefined, we are going to clear the selection otherwise we
160
+ * will use it as the index of the new option to select
161
+ */
162
+ const onOptionChange = (opt?: unknown) => {
163
+ const newOption = getSelectedOption<S>(enumOptions, selectorField, opt);
164
+ const oldOption = getSelectedOption<S>(enumOptions, selectorField, selectedOption);
165
+
166
+ let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
167
+ if (newFormData && newOption) {
168
+ // Call getDefaultFormState to make sure defaults are populated on change.
169
+ newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren') as T;
170
+ }
171
+ if (newFormData) {
172
+ set(newFormData, selectorField, opt);
173
+ }
174
+ onChange(newFormData, undefined, id);
175
+ };
176
+
177
+ // filtering the options based on the type of widget because `selectField` does not recognize the `convertOther` prop
178
+ const widgetOptions = { enumOptions, ...uiOptions };
179
+ const errors =
180
+ !hideFieldError && rawErrors.length > 0 ? (
181
+ <FieldErrorTemplate idSchema={idSchema} schema={schema} errors={rawErrors} registry={registry} />
182
+ ) : undefined;
183
+ const ignored = (value: string) => noop;
184
+
185
+ return (
186
+ <FieldTemplate
187
+ id={id}
188
+ schema={schema}
189
+ label={(title || schema.title) ?? ''}
190
+ disabled={disabled || (Array.isArray(enumOptions) && isEmpty(enumOptions))}
191
+ uiSchema={uiSchema}
192
+ formContext={formContext}
193
+ required={required}
194
+ readonly={!!readonly}
195
+ registry={registry}
196
+ displayLabel={displayLabel}
197
+ errors={errors}
198
+ onChange={onChange}
199
+ onDropPropertyClick={ignored}
200
+ onKeyChange={ignored}
201
+ >
202
+ <Widget
203
+ id={id}
204
+ name={name}
205
+ schema={schema}
206
+ label={(title || schema.title) ?? ''}
207
+ disabled={disabled || (Array.isArray(enumOptions) && isEmpty(enumOptions))}
208
+ uiSchema={uiSchema}
209
+ formContext={formContext}
210
+ autofocus={autofocus}
211
+ readonly={readonly}
212
+ required={required}
213
+ registry={registry}
214
+ multiple={false}
215
+ rawErrors={rawErrors}
216
+ hideError={hideFieldError}
217
+ hideLabel={!displayLabel}
218
+ errorSchema={fieldErrorSchema}
219
+ placeholder={placeholder}
220
+ onChange={onOptionChange}
221
+ onBlur={onBlur}
222
+ onFocus={onFocus}
223
+ value={selectedOption}
224
+ options={widgetOptions}
225
+ />
226
+ </FieldTemplate>
227
+ );
228
+ }
@@ -123,14 +123,15 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
123
123
  const oldOption = selectedOption >= 0 ? retrievedOptions[selectedOption] : undefined;
124
124
 
125
125
  let newFormData = schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData);
126
- if (newFormData && newOption) {
126
+ if (newOption) {
127
127
  // Call getDefaultFormState to make sure defaults are populated on change. Pass "excludeObjectChildren"
128
128
  // so that only the root objects themselves are created without adding undefined children properties
129
129
  newFormData = schemaUtils.getDefaultFormState(newOption, newFormData, 'excludeObjectChildren') as T;
130
130
  }
131
- onChange(newFormData, undefined, this.getFieldId());
132
131
 
133
- this.setState({ selectedOption: intOption });
132
+ this.setState({ selectedOption: intOption }, () => {
133
+ onChange(newFormData, undefined, this.getFieldId());
134
+ });
134
135
  };
135
136
 
136
137
  getFieldId() {
@@ -148,6 +149,7 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
148
149
  formContext,
149
150
  onBlur,
150
151
  onFocus,
152
+ readonly,
151
153
  registry,
152
154
  schema,
153
155
  uiSchema,
@@ -236,9 +238,12 @@ class AnyOfField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
236
238
  autofocus={autofocus}
237
239
  label={title ?? name}
238
240
  hideLabel={!displayLabel}
241
+ readonly={readonly}
239
242
  />
240
243
  </div>
241
- {optionSchema && <_SchemaField {...this.props} schema={optionSchema} uiSchema={optionUiSchema} />}
244
+ {optionSchema && optionSchema.type !== 'null' && (
245
+ <_SchemaField {...this.props} schema={optionSchema} uiSchema={optionUiSchema} />
246
+ )}
242
247
  </div>
243
248
  );
244
249
  }
@@ -7,7 +7,7 @@ import { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf
7
7
  * @param props - The `FieldProps` for this template
8
8
  */
9
9
  function NullField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
10
- props: FieldProps<T, S, F>
10
+ props: FieldProps<T, S, F>,
11
11
  ) {
12
12
  const { formData, onChange } = props;
13
13
  useEffect(() => {
@@ -1,5 +1,5 @@
1
1
  import { useState, useCallback } from 'react';
2
- import { asNumber, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { asNumber, ErrorSchema, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
3
 
4
4
  // Matches a string that ends in a . character, optionally followed by a sequence of
5
5
  // digits followed by any number of 0 characters up until the end of the line.
@@ -31,7 +31,7 @@ const trailingCharMatcher = /[0.]0*$/;
31
31
  * value is passed to the input instead of the formData value
32
32
  */
33
33
  function NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
34
- props: FieldProps<T, S, F>
34
+ props: FieldProps<T, S, F>,
35
35
  ) {
36
36
  const { registry, onChange, formData, value: initialValue } = props;
37
37
  const [lastValue, setLastValue] = useState(initialValue);
@@ -44,7 +44,7 @@ function NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
44
44
  * @param value - The current value for the change occurring
45
45
  */
46
46
  const handleChange = useCallback(
47
- (value: FieldProps<T, S, F>['value']) => {
47
+ (value: FieldProps<T, S, F>['value'], errorSchema?: ErrorSchema<T>, id?: string) => {
48
48
  // Cache the original value in component state
49
49
  setLastValue(value);
50
50
 
@@ -62,9 +62,9 @@ function NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
62
62
  ? asNumber(value.replace(trailingCharMatcher, ''))
63
63
  : asNumber(value);
64
64
 
65
- onChange(processed as unknown as T);
65
+ onChange(processed as unknown as T, errorSchema, id);
66
66
  },
67
- [onChange]
67
+ [onChange],
68
68
  );
69
69
 
70
70
  if (typeof lastValue === 'string' && typeof value === 'number') {
@@ -86,7 +86,7 @@ class ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends Fo
86
86
  ...errorSchema,
87
87
  [name]: newErrorSchema,
88
88
  },
89
- id
89
+ id,
90
90
  );
91
91
  };
92
92
  };
@@ -158,7 +158,7 @@ class ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends Fo
158
158
  errorSchema && {
159
159
  ...errorSchema,
160
160
  [value]: newErrorSchema,
161
- }
161
+ },
162
162
  );
163
163
  };
164
164
  };
@@ -195,32 +195,40 @@ class ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends Fo
195
195
  * @param schema - The schema element to which the new property is being added
196
196
  */
197
197
  handleAddClick = (schema: S) => () => {
198
- if (!schema.additionalProperties) {
198
+ if (!(schema.additionalProperties || schema.patternProperties)) {
199
199
  return;
200
200
  }
201
201
  const { formData, onChange, registry } = this.props;
202
202
  const newFormData = { ...formData } as T;
203
-
204
- let type: RJSFSchema['type'] = undefined;
205
- let defaultValue: RJSFSchema['default'] = undefined;
206
- if (isObject(schema.additionalProperties)) {
207
- type = schema.additionalProperties.type;
208
- defaultValue = schema.additionalProperties.default;
209
- let apSchema = schema.additionalProperties;
210
- if (REF_KEY in apSchema) {
211
- const { schemaUtils } = registry;
212
- apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] } as S, formData);
213
- type = apSchema.type;
214
- defaultValue = apSchema.default;
215
- }
216
- if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
217
- type = 'object';
203
+ const newKey = this.getAvailableKey('newKey', newFormData);
204
+ if (schema.patternProperties) {
205
+ // Cast this to make the `set` work properly
206
+ set(newFormData as GenericObjectType, newKey, null);
207
+ } else {
208
+ let type: RJSFSchema['type'] = undefined;
209
+ let constValue: RJSFSchema['const'] = undefined;
210
+ let defaultValue: RJSFSchema['default'] = undefined;
211
+ if (isObject(schema.additionalProperties)) {
212
+ type = schema.additionalProperties.type;
213
+ constValue = schema.additionalProperties.const;
214
+ defaultValue = schema.additionalProperties.default;
215
+ let apSchema = schema.additionalProperties;
216
+ if (REF_KEY in apSchema) {
217
+ const { schemaUtils } = registry;
218
+ apSchema = schemaUtils.retrieveSchema({ $ref: apSchema[REF_KEY] } as S, formData);
219
+ type = apSchema.type;
220
+ constValue = apSchema.const;
221
+ defaultValue = apSchema.default;
222
+ }
223
+ if (!type && (ANY_OF_KEY in apSchema || ONE_OF_KEY in apSchema)) {
224
+ type = 'object';
225
+ }
218
226
  }
219
- }
220
227
 
221
- const newKey = this.getAvailableKey('newKey', newFormData);
222
- // Cast this to make the `set` work properly
223
- set(newFormData as GenericObjectType, newKey, defaultValue ?? this.getDefaultValue(type));
228
+ const newValue = constValue ?? defaultValue ?? this.getDefaultValue(type);
229
+ // Cast this to make the `set` work properly
230
+ set(newFormData as GenericObjectType, newKey, newValue);
231
+ }
224
232
 
225
233
  onChange(newFormData);
226
234
  };
@@ -262,7 +270,7 @@ class ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends Fo
262
270
  } catch (err) {
263
271
  return (
264
272
  <div>
265
- <p className='config-error' style={{ color: 'red' }}>
273
+ <p className='rjsf-config-error' style={{ color: 'red' }}>
266
274
  <Markdown options={{ disableParsingRawHTML: true }}>
267
275
  {translateString(TranslatableString.InvalidObjectField, [name || 'root', (err as Error).message])}
268
276
  </Markdown>
@@ -290,7 +298,7 @@ class ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends Fo
290
298
  key={name}
291
299
  name={name}
292
300
  required={this.isRequired(name)}
293
- schema={get(schema, [PROPERTIES_KEY, name], {})}
301
+ schema={get(schema, [PROPERTIES_KEY, name], {}) as S}
294
302
  uiSchema={fieldUiSchema}
295
303
  errorSchema={get(errorSchema, name)}
296
304
  idSchema={fieldIdSchema}
@@ -1,4 +1,4 @@
1
- import { useCallback, Component } from 'react';
1
+ import { useCallback, Component, ComponentType } from 'react';
2
2
  import {
3
3
  ADDITIONAL_PROPERTY_FLAG,
4
4
  deepEquals,
@@ -22,7 +22,6 @@ import {
22
22
  } from '@rjsf/utils';
23
23
  import isObject from 'lodash/isObject';
24
24
  import omit from 'lodash/omit';
25
- import Markdown from 'markdown-to-jsx';
26
25
 
27
26
  /** The map of component type to FieldName */
28
27
  const COMPONENT_TYPES: { [key: string]: string } = {
@@ -49,15 +48,15 @@ function getFieldComponent<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
49
48
  schema: S,
50
49
  uiOptions: UIOptionsType<T, S, F>,
51
50
  idSchema: IdSchema<T>,
52
- registry: Registry<T, S, F>
53
- ) {
51
+ registry: Registry<T, S, F>,
52
+ ): ComponentType<FieldProps<T, S, F>> {
54
53
  const field = uiOptions.field;
55
54
  const { fields, translateString } = registry;
56
55
  if (typeof field === 'function') {
57
56
  return field;
58
57
  }
59
58
  if (typeof field === 'string' && field in fields) {
60
- return fields[field];
59
+ return fields[field] as ComponentType<FieldProps<T, S, F>>;
61
60
  }
62
61
 
63
62
  const schemaType = getSchemaType(schema);
@@ -82,7 +81,7 @@ function getFieldComponent<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
82
81
  const UnsupportedFieldTemplate = getTemplate<'UnsupportedFieldTemplate', T, S, F>(
83
82
  'UnsupportedFieldTemplate',
84
83
  registry,
85
- uiOptions
84
+ uiOptions,
86
85
  );
87
86
 
88
87
  return (
@@ -103,7 +102,7 @@ function getFieldComponent<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
103
102
  * @param props - The `FieldProps` for this component
104
103
  */
105
104
  function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
106
- props: FieldProps<T, S, F>
105
+ props: FieldProps<T, S, F>,
107
106
  ) {
108
107
  const {
109
108
  schema: _schema,
@@ -127,7 +126,7 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
127
126
  const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
128
127
  'DescriptionFieldTemplate',
129
128
  registry,
130
- uiOptions
129
+ uiOptions,
131
130
  );
132
131
  const FieldHelpTemplate = getTemplate<'FieldHelpTemplate', T, S, F>('FieldHelpTemplate', registry, uiOptions);
133
132
  const FieldErrorTemplate = getTemplate<'FieldErrorTemplate', T, S, F>('FieldErrorTemplate', registry, uiOptions);
@@ -135,7 +134,7 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
135
134
  const fieldId = _idSchema[ID_KEY];
136
135
  const idSchema = mergeObjects(
137
136
  schemaUtils.toIdSchema(schema, fieldId, formData, idPrefix, idSeparator),
138
- _idSchema
137
+ _idSchema,
139
138
  ) as IdSchema<T>;
140
139
 
141
140
  /** Intermediary `onChange` handler for field components that will inject the `id` of the current field into the
@@ -146,7 +145,7 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
146
145
  const theId = id || fieldId;
147
146
  return onChange(formData, newErrorSchema, theId);
148
147
  },
149
- [fieldId, onChange]
148
+ [fieldId, onChange],
150
149
  );
151
150
 
152
151
  const FieldComponent = getFieldComponent<T, S, F>(schema, uiOptions, idSchema, registry);
@@ -180,7 +179,7 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
180
179
  readonly={readonly}
181
180
  hideError={hideError}
182
181
  autofocus={autofocus}
183
- errorSchema={fieldErrorSchema}
182
+ errorSchema={fieldErrorSchema as ErrorSchema}
184
183
  formContext={formContext}
185
184
  rawErrors={__errors}
186
185
  />
@@ -200,26 +199,12 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
200
199
  }
201
200
 
202
201
  const description = uiOptions.description || props.schema.description || schema.description || '';
203
-
204
- const richDescription = uiOptions.enableMarkdownInDescription ? (
205
- <Markdown options={{ disableParsingRawHTML: true }}>{description}</Markdown>
206
- ) : (
207
- description
208
- );
209
202
  const help = uiOptions.help;
210
203
  const hidden = uiOptions.widget === 'hidden';
211
204
 
212
- const classNames = ['form-group', 'field', `field-${getSchemaType(schema)}`];
205
+ const classNames = ['rjsf-field', `rjsf-field-${getSchemaType(schema)}`];
213
206
  if (!hideError && __errors && __errors.length > 0) {
214
- classNames.push('field-error has-error has-danger');
215
- }
216
- if (uiSchema?.classNames) {
217
- if (process.env.NODE_ENV !== 'production') {
218
- console.warn(
219
- "'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead."
220
- );
221
- }
222
- classNames.push(uiSchema.classNames);
207
+ classNames.push('rjsf-field-error');
223
208
  }
224
209
  if (uiOptions.classNames) {
225
210
  classNames.push(uiOptions.classNames);
@@ -254,7 +239,7 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
254
239
  description: (
255
240
  <DescriptionFieldTemplate
256
241
  id={descriptionId<T>(id)}
257
- description={richDescription}
242
+ description={description}
258
243
  schema={schema}
259
244
  uiSchema={uiSchema}
260
245
  registry={registry}
@@ -314,9 +299,10 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
314
299
  onChange={props.onChange}
315
300
  onFocus={props.onFocus}
316
301
  options={schema.anyOf.map((_schema) =>
317
- schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData)
302
+ schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData),
318
303
  )}
319
304
  registry={registry}
305
+ required={required}
320
306
  schema={schema}
321
307
  uiSchema={uiSchema}
322
308
  />
@@ -337,9 +323,10 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
337
323
  onChange={props.onChange}
338
324
  onFocus={props.onFocus}
339
325
  options={schema.oneOf.map((_schema) =>
340
- schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData)
326
+ schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData),
341
327
  )}
342
328
  registry={registry}
329
+ required={required}
343
330
  schema={schema}
344
331
  uiSchema={uiSchema}
345
332
  />
@@ -14,7 +14,7 @@ import {
14
14
  * @param props - The `FieldProps` for this template
15
15
  */
16
16
  function StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
17
- props: FieldProps<T, S, F>
17
+ props: FieldProps<T, S, F>,
18
18
  ) {
19
19
  const {
20
20
  schema,
@@ -35,7 +35,7 @@ function StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
35
35
  } = props;
36
36
  const { title, format } = schema;
37
37
  const { widgets, formContext, schemaUtils, globalUiOptions } = registry;
38
- const enumOptions = schemaUtils.isSelect(schema) ? optionsList<S, T, F>(schema, uiSchema) : undefined;
38
+ const enumOptions = schemaUtils.isSelect(schema) ? optionsList<T, S, F>(schema, uiSchema) : undefined;
39
39
  let defaultWidget = enumOptions ? 'select' : 'text';
40
40
  if (format && hasWidget<T, S, F>(schema, format, widgets)) {
41
41
  defaultWidget = format;
@@ -2,6 +2,9 @@ import { Field, FormContextType, RegistryFieldsType, RJSFSchema, StrictRJSFSchem
2
2
 
3
3
  import ArrayField from './ArrayField';
4
4
  import BooleanField from './BooleanField';
5
+ import LayoutGridField from './LayoutGridField';
6
+ import LayoutHeaderField from './LayoutHeaderField';
7
+ import LayoutMultiSchemaField from './LayoutMultiSchemaField';
5
8
  import MultiSchemaField from './MultiSchemaField';
6
9
  import NumberField from './NumberField';
7
10
  import ObjectField from './ObjectField';
@@ -12,13 +15,16 @@ import NullField from './NullField';
12
15
  function fields<
13
16
  T = any,
14
17
  S extends StrictRJSFSchema = RJSFSchema,
15
- F extends FormContextType = any
18
+ F extends FormContextType = any,
16
19
  >(): RegistryFieldsType<T, S, F> {
17
20
  return {
18
21
  AnyOfField: MultiSchemaField,
19
22
  ArrayField: ArrayField as unknown as Field<T, S, F>,
20
23
  // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
21
24
  BooleanField,
25
+ LayoutGridField,
26
+ LayoutHeaderField,
27
+ LayoutMultiSchemaField,
22
28
  NumberField,
23
29
  ObjectField,
24
30
  OneOfField: MultiSchemaField,
@@ -16,7 +16,7 @@ import {
16
16
  export default function ArrayFieldDescriptionTemplate<
17
17
  T = any,
18
18
  S extends StrictRJSFSchema = RJSFSchema,
19
- F extends FormContextType = any
19
+ F extends FormContextType = any,
20
20
  >(props: ArrayFieldDescriptionProps<T, S, F>) {
21
21
  const { idSchema, description, registry, schema, uiSchema } = props;
22
22
  const options = getUiOptions<T, S, F>(uiSchema, registry.globalUiOptions);
@@ -27,7 +27,7 @@ export default function ArrayFieldDescriptionTemplate<
27
27
  const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
28
28
  'DescriptionFieldTemplate',
29
29
  registry,
30
- options
30
+ options,
31
31
  );
32
32
  return (
33
33
  <DescriptionFieldTemplate