@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,20 @@
1
+ import { ReactElement } from 'react';
2
+ import { FormContextType, Registry, RJSFSchema, StrictRJSFSchema, UiSchema } from '@rjsf/utils';
3
+ export interface RichDescriptionProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
4
+ /** The description text for a field, potentially containing markdown */
5
+ description: string | ReactElement;
6
+ /** The uiSchema object for this base component */
7
+ uiSchema?: UiSchema<T, S, F>;
8
+ /** The `registry` object */
9
+ registry: Registry<T, S, F>;
10
+ }
11
+ /** Renders the given `description` in the props as
12
+ *
13
+ * @param props - The `RichDescriptionProps` for this component
14
+ */
15
+ declare function RichDescription<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ description, registry, uiSchema }: RichDescriptionProps<T, S, F>): string | import("react/jsx-runtime").JSX.Element;
16
+ declare namespace RichDescription {
17
+ var TEST_IDS: import("@rjsf/utils").TestIdShape;
18
+ }
19
+ export default RichDescription;
20
+ //# sourceMappingURL=RichDescription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichDescription.d.ts","sourceRoot":"","sources":["../../src/components/RichDescription.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EACL,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,QAAQ,EAGT,MAAM,aAAa,CAAC;AAKrB,MAAM,WAAW,oBAAoB,CACnC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG;IAE/B,wEAAwE;IACxE,WAAW,EAAE,MAAM,GAAG,YAAY,CAAC;IACnC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,4BAA4B;IAC5B,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,iBAAwB,eAAe,CACrC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAa,EAAE,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,oDAYxE;kBAhBuB,eAAe;;;eAAf,eAAe"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getTestIds, getUiOptions, } from '@rjsf/utils';
3
+ import Markdown from 'markdown-to-jsx';
4
+ const TEST_IDS = getTestIds();
5
+ /** Renders the given `description` in the props as
6
+ *
7
+ * @param props - The `RichDescriptionProps` for this component
8
+ */
9
+ export default function RichDescription({ description, registry, uiSchema = {} }) {
10
+ const { globalUiOptions } = registry;
11
+ const uiOptions = getUiOptions(uiSchema, globalUiOptions);
12
+ if (uiOptions.enableMarkdownInDescription && typeof description === 'string') {
13
+ return (_jsx(Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description }));
14
+ }
15
+ return description;
16
+ }
17
+ RichDescription.TEST_IDS = TEST_IDS;
@@ -153,21 +153,31 @@ declare class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F ext
153
153
  totalItems: number;
154
154
  }): {
155
155
  children: import("react/jsx-runtime").JSX.Element;
156
+ buttonsProps: {
157
+ idSchema: import("@rjsf/utils").FieldId & (IdSchema<T> | undefined)[];
158
+ disabled: boolean | undefined;
159
+ readonly: boolean | undefined;
160
+ canAdd: boolean;
161
+ hasCopy: boolean;
162
+ hasMoveUp: boolean;
163
+ hasMoveDown: boolean;
164
+ hasRemove: boolean;
165
+ index: number;
166
+ totalItems: number;
167
+ onAddIndexClick: (index: number) => (event: MouseEvent) => void;
168
+ onCopyIndexClick: (index: number) => (event: MouseEvent) => void;
169
+ onDropIndexClick: (index: number) => (event: MouseEvent) => void;
170
+ onReorderClick: (index: number, newIndex: number) => (event: MouseEvent<HTMLButtonElement>) => void;
171
+ registry: import("@rjsf/utils").Registry<T[], S, F>;
172
+ schema: S;
173
+ uiSchema: UiSchema<T[], S, F>;
174
+ };
156
175
  className: string;
157
176
  disabled: boolean | undefined;
158
- canAdd: boolean;
159
- hasCopy: boolean;
160
177
  hasToolbar: boolean;
161
- hasMoveUp: boolean;
162
- hasMoveDown: boolean;
163
- hasRemove: boolean;
164
178
  index: number;
165
179
  totalItems: number;
166
180
  key: string;
167
- onAddIndexClick: (index: number) => (event: MouseEvent<Element, globalThis.MouseEvent>) => void;
168
- onCopyIndexClick: (index: number) => (event: MouseEvent<Element, globalThis.MouseEvent>) => void;
169
- onDropIndexClick: (index: number) => (event: MouseEvent<Element, globalThis.MouseEvent>) => void;
170
- onReorderClick: (index: number, newIndex: number) => (event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>) => void;
171
181
  readonly: boolean | undefined;
172
182
  registry: import("@rjsf/utils").Registry<T[], S, F>;
173
183
  schema: S;
@@ -178,3 +188,4 @@ declare class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F ext
178
188
  * `Field` which is defined as `React.ComponentType<FieldProps<T, S, F>>`, so cast it to make `registry` happy.
179
189
  */
180
190
  export default ArrayField;
191
+ //# sourceMappingURL=ArrayField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/ArrayField.tsx"],"names":[],"mappings":"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"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Component } from 'react';
3
3
  import { getTemplate, getWidget, getUiOptions, isFixedItems, allowAdditionalItems, isCustomWidget, optionsList, TranslatableString, ITEMS_KEY, } from '@rjsf/utils';
4
- import cloneDeep from 'lodash/cloneDeep';
5
- import get from 'lodash/get';
6
- import isObject from 'lodash/isObject';
7
- import set from 'lodash/set';
4
+ import cloneDeep from 'lodash-es/cloneDeep.js';
5
+ import get from 'lodash-es/get.js';
6
+ import isObject from 'lodash-es/isObject.js';
7
+ import set from 'lodash-es/set.js';
8
8
  import { nanoid } from 'nanoid';
9
9
  /** Used to generate a unique ID for an element in a row */
10
10
  function generateRowId() {
@@ -46,189 +46,6 @@ class ArrayField extends Component {
46
46
  */
47
47
  constructor(props) {
48
48
  super(props);
49
- /** Returns the default form information for an item based on the schema for that item. Deals with the possibility
50
- * that the schema is fixed and allows additional items.
51
- */
52
- this._getNewFormDataRow = () => {
53
- const { schema, registry } = this.props;
54
- const { schemaUtils } = registry;
55
- let itemSchema = schema.items;
56
- if (isFixedItems(schema) && allowAdditionalItems(schema)) {
57
- itemSchema = schema.additionalItems;
58
- }
59
- // Cast this as a T to work around schema utils being for T[] caused by the FieldProps<T[], S, F> call on the class
60
- return schemaUtils.getDefaultFormState(itemSchema);
61
- };
62
- /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of
63
- * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the
64
- * keyed data
65
- *
66
- * @param event - The event for the click
67
- */
68
- this.onAddClick = (event) => {
69
- this._handleAddClick(event);
70
- };
71
- /** Callback handler for when the user clicks on the add button on an existing array element. Creates a new row of
72
- * keyed form data inserted at the `index`, adding it into the state, and then returning `onChange()` with the plain
73
- * form data converted from the keyed data
74
- *
75
- * @param index - The index at which the add button is clicked
76
- */
77
- this.onAddIndexClick = (index) => {
78
- return (event) => {
79
- this._handleAddClick(event, index);
80
- };
81
- };
82
- /** Callback handler for when the user clicks on the copy button on an existing array element. Clones the row of
83
- * keyed form data at the `index` into the next position in the state, and then returning `onChange()` with the plain
84
- * form data converted from the keyed data
85
- *
86
- * @param index - The index at which the copy button is clicked
87
- */
88
- this.onCopyIndexClick = (index) => {
89
- return (event) => {
90
- if (event) {
91
- event.preventDefault();
92
- }
93
- const { onChange, errorSchema } = this.props;
94
- const { keyedFormData } = this.state;
95
- // refs #195: revalidate to ensure properly reindexing errors
96
- let newErrorSchema;
97
- if (errorSchema) {
98
- newErrorSchema = {};
99
- for (const idx in errorSchema) {
100
- const i = parseInt(idx);
101
- if (i <= index) {
102
- set(newErrorSchema, [i], errorSchema[idx]);
103
- }
104
- else if (i > index) {
105
- set(newErrorSchema, [i + 1], errorSchema[idx]);
106
- }
107
- }
108
- }
109
- const newKeyedFormDataRow = {
110
- key: generateRowId(),
111
- item: cloneDeep(keyedFormData[index].item),
112
- };
113
- const newKeyedFormData = [...keyedFormData];
114
- if (index !== undefined) {
115
- newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
116
- }
117
- else {
118
- newKeyedFormData.push(newKeyedFormDataRow);
119
- }
120
- this.setState({
121
- keyedFormData: newKeyedFormData,
122
- updatedKeyedFormData: true,
123
- }, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
124
- };
125
- };
126
- /** Callback handler for when the user clicks on the remove button on an existing array element. Removes the row of
127
- * keyed form data at the `index` in the state, and then returning `onChange()` with the plain form data converted
128
- * from the keyed data
129
- *
130
- * @param index - The index at which the remove button is clicked
131
- */
132
- this.onDropIndexClick = (index) => {
133
- return (event) => {
134
- if (event) {
135
- event.preventDefault();
136
- }
137
- const { onChange, errorSchema } = this.props;
138
- const { keyedFormData } = this.state;
139
- // refs #195: revalidate to ensure properly reindexing errors
140
- let newErrorSchema;
141
- if (errorSchema) {
142
- newErrorSchema = {};
143
- for (const idx in errorSchema) {
144
- const i = parseInt(idx);
145
- if (i < index) {
146
- set(newErrorSchema, [i], errorSchema[idx]);
147
- }
148
- else if (i > index) {
149
- set(newErrorSchema, [i - 1], errorSchema[idx]);
150
- }
151
- }
152
- }
153
- const newKeyedFormData = keyedFormData.filter((_, i) => i !== index);
154
- this.setState({
155
- keyedFormData: newKeyedFormData,
156
- updatedKeyedFormData: true,
157
- }, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
158
- };
159
- };
160
- /** Callback handler for when the user clicks on one of the move item buttons on an existing array element. Moves the
161
- * row of keyed form data at the `index` to the `newIndex` in the state, and then returning `onChange()` with the
162
- * plain form data converted from the keyed data
163
- *
164
- * @param index - The index of the item to move
165
- * @param newIndex - The index to where the item is to be moved
166
- */
167
- this.onReorderClick = (index, newIndex) => {
168
- return (event) => {
169
- if (event) {
170
- event.preventDefault();
171
- event.currentTarget.blur();
172
- }
173
- const { onChange, errorSchema } = this.props;
174
- let newErrorSchema;
175
- if (errorSchema) {
176
- newErrorSchema = {};
177
- for (const idx in errorSchema) {
178
- const i = parseInt(idx);
179
- if (i == index) {
180
- set(newErrorSchema, [newIndex], errorSchema[index]);
181
- }
182
- else if (i == newIndex) {
183
- set(newErrorSchema, [index], errorSchema[newIndex]);
184
- }
185
- else {
186
- set(newErrorSchema, [idx], errorSchema[i]);
187
- }
188
- }
189
- }
190
- const { keyedFormData } = this.state;
191
- function reOrderArray() {
192
- // Copy item
193
- const _newKeyedFormData = keyedFormData.slice();
194
- // Moves item from index to newIndex
195
- _newKeyedFormData.splice(index, 1);
196
- _newKeyedFormData.splice(newIndex, 0, keyedFormData[index]);
197
- return _newKeyedFormData;
198
- }
199
- const newKeyedFormData = reOrderArray();
200
- this.setState({
201
- keyedFormData: newKeyedFormData,
202
- }, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
203
- };
204
- };
205
- /** Callback handler used to deal with changing the value of the data in the array at the `index`. Calls the
206
- * `onChange` callback with the updated form data
207
- *
208
- * @param index - The index of the item being changed
209
- */
210
- this.onChangeForIndex = (index) => {
211
- return (value, newErrorSchema, id) => {
212
- const { formData, onChange, errorSchema } = this.props;
213
- const arrayData = Array.isArray(formData) ? formData : [];
214
- const newFormData = arrayData.map((item, i) => {
215
- // We need to treat undefined items as nulls to have validation.
216
- // See https://github.com/tdegrunt/jsonschema/issues/206
217
- const jsonValue = typeof value === 'undefined' ? null : value;
218
- return index === i ? jsonValue : item;
219
- });
220
- onChange(newFormData, errorSchema &&
221
- errorSchema && {
222
- ...errorSchema,
223
- [index]: newErrorSchema,
224
- }, id);
225
- };
226
- };
227
- /** Callback handler used to change the value for a checkbox */
228
- this.onSelectChange = (value) => {
229
- const { onChange, idSchema } = this.props;
230
- onChange(value, undefined, idSchema && idSchema.$id);
231
- };
232
49
  const { formData = [] } = props;
233
50
  const keyedFormData = generateKeyedFormData(formData);
234
51
  this.state = {
@@ -308,6 +125,19 @@ class ArrayField extends Component {
308
125
  }
309
126
  return addable;
310
127
  }
128
+ /** Returns the default form information for an item based on the schema for that item. Deals with the possibility
129
+ * that the schema is fixed and allows additional items.
130
+ */
131
+ _getNewFormDataRow = () => {
132
+ const { schema, registry } = this.props;
133
+ const { schemaUtils } = registry;
134
+ let itemSchema = schema.items;
135
+ if (isFixedItems(schema) && allowAdditionalItems(schema)) {
136
+ itemSchema = schema.additionalItems;
137
+ }
138
+ // Cast this as a T to work around schema utils being for T[] caused by the FieldProps<T[], S, F> call on the class
139
+ return schemaUtils.getDefaultFormState(itemSchema);
140
+ };
311
141
  /** Callback handler for when the user clicks on the add or add at index buttons. Creates a new row of keyed form data
312
142
  * either at the end of the list (when index is not specified) or inserted at the `index` when it is, adding it into
313
143
  * the state, and then returning `onChange()` with the plain form data converted from the keyed data
@@ -351,6 +181,176 @@ class ArrayField extends Component {
351
181
  updatedKeyedFormData: true,
352
182
  }, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
353
183
  }
184
+ /** Callback handler for when the user clicks on the add button. Creates a new row of keyed form data at the end of
185
+ * the list, adding it into the state, and then returning `onChange()` with the plain form data converted from the
186
+ * keyed data
187
+ *
188
+ * @param event - The event for the click
189
+ */
190
+ onAddClick = (event) => {
191
+ this._handleAddClick(event);
192
+ };
193
+ /** Callback handler for when the user clicks on the add button on an existing array element. Creates a new row of
194
+ * keyed form data inserted at the `index`, adding it into the state, and then returning `onChange()` with the plain
195
+ * form data converted from the keyed data
196
+ *
197
+ * @param index - The index at which the add button is clicked
198
+ */
199
+ onAddIndexClick = (index) => {
200
+ return (event) => {
201
+ this._handleAddClick(event, index);
202
+ };
203
+ };
204
+ /** Callback handler for when the user clicks on the copy button on an existing array element. Clones the row of
205
+ * keyed form data at the `index` into the next position in the state, and then returning `onChange()` with the plain
206
+ * form data converted from the keyed data
207
+ *
208
+ * @param index - The index at which the copy button is clicked
209
+ */
210
+ onCopyIndexClick = (index) => {
211
+ return (event) => {
212
+ if (event) {
213
+ event.preventDefault();
214
+ }
215
+ const { onChange, errorSchema } = this.props;
216
+ const { keyedFormData } = this.state;
217
+ // refs #195: revalidate to ensure properly reindexing errors
218
+ let newErrorSchema;
219
+ if (errorSchema) {
220
+ newErrorSchema = {};
221
+ for (const idx in errorSchema) {
222
+ const i = parseInt(idx);
223
+ if (i <= index) {
224
+ set(newErrorSchema, [i], errorSchema[idx]);
225
+ }
226
+ else if (i > index) {
227
+ set(newErrorSchema, [i + 1], errorSchema[idx]);
228
+ }
229
+ }
230
+ }
231
+ const newKeyedFormDataRow = {
232
+ key: generateRowId(),
233
+ item: cloneDeep(keyedFormData[index].item),
234
+ };
235
+ const newKeyedFormData = [...keyedFormData];
236
+ if (index !== undefined) {
237
+ newKeyedFormData.splice(index + 1, 0, newKeyedFormDataRow);
238
+ }
239
+ else {
240
+ newKeyedFormData.push(newKeyedFormDataRow);
241
+ }
242
+ this.setState({
243
+ keyedFormData: newKeyedFormData,
244
+ updatedKeyedFormData: true,
245
+ }, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
246
+ };
247
+ };
248
+ /** Callback handler for when the user clicks on the remove button on an existing array element. Removes the row of
249
+ * keyed form data at the `index` in the state, and then returning `onChange()` with the plain form data converted
250
+ * from the keyed data
251
+ *
252
+ * @param index - The index at which the remove button is clicked
253
+ */
254
+ onDropIndexClick = (index) => {
255
+ return (event) => {
256
+ if (event) {
257
+ event.preventDefault();
258
+ }
259
+ const { onChange, errorSchema } = this.props;
260
+ const { keyedFormData } = this.state;
261
+ // refs #195: revalidate to ensure properly reindexing errors
262
+ let newErrorSchema;
263
+ if (errorSchema) {
264
+ newErrorSchema = {};
265
+ for (const idx in errorSchema) {
266
+ const i = parseInt(idx);
267
+ if (i < index) {
268
+ set(newErrorSchema, [i], errorSchema[idx]);
269
+ }
270
+ else if (i > index) {
271
+ set(newErrorSchema, [i - 1], errorSchema[idx]);
272
+ }
273
+ }
274
+ }
275
+ const newKeyedFormData = keyedFormData.filter((_, i) => i !== index);
276
+ this.setState({
277
+ keyedFormData: newKeyedFormData,
278
+ updatedKeyedFormData: true,
279
+ }, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
280
+ };
281
+ };
282
+ /** Callback handler for when the user clicks on one of the move item buttons on an existing array element. Moves the
283
+ * row of keyed form data at the `index` to the `newIndex` in the state, and then returning `onChange()` with the
284
+ * plain form data converted from the keyed data
285
+ *
286
+ * @param index - The index of the item to move
287
+ * @param newIndex - The index to where the item is to be moved
288
+ */
289
+ onReorderClick = (index, newIndex) => {
290
+ return (event) => {
291
+ if (event) {
292
+ event.preventDefault();
293
+ event.currentTarget.blur();
294
+ }
295
+ const { onChange, errorSchema } = this.props;
296
+ let newErrorSchema;
297
+ if (errorSchema) {
298
+ newErrorSchema = {};
299
+ for (const idx in errorSchema) {
300
+ const i = parseInt(idx);
301
+ if (i == index) {
302
+ set(newErrorSchema, [newIndex], errorSchema[index]);
303
+ }
304
+ else if (i == newIndex) {
305
+ set(newErrorSchema, [index], errorSchema[newIndex]);
306
+ }
307
+ else {
308
+ set(newErrorSchema, [idx], errorSchema[i]);
309
+ }
310
+ }
311
+ }
312
+ const { keyedFormData } = this.state;
313
+ function reOrderArray() {
314
+ // Copy item
315
+ const _newKeyedFormData = keyedFormData.slice();
316
+ // Moves item from index to newIndex
317
+ _newKeyedFormData.splice(index, 1);
318
+ _newKeyedFormData.splice(newIndex, 0, keyedFormData[index]);
319
+ return _newKeyedFormData;
320
+ }
321
+ const newKeyedFormData = reOrderArray();
322
+ this.setState({
323
+ keyedFormData: newKeyedFormData,
324
+ }, () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema));
325
+ };
326
+ };
327
+ /** Callback handler used to deal with changing the value of the data in the array at the `index`. Calls the
328
+ * `onChange` callback with the updated form data
329
+ *
330
+ * @param index - The index of the item being changed
331
+ */
332
+ onChangeForIndex = (index) => {
333
+ return (value, newErrorSchema, id) => {
334
+ const { formData, onChange, errorSchema } = this.props;
335
+ const arrayData = Array.isArray(formData) ? formData : [];
336
+ const newFormData = arrayData.map((item, i) => {
337
+ // We need to treat undefined items as nulls to have validation.
338
+ // See https://github.com/tdegrunt/jsonschema/issues/206
339
+ const jsonValue = typeof value === 'undefined' ? null : value;
340
+ return index === i ? jsonValue : item;
341
+ });
342
+ onChange(newFormData, errorSchema &&
343
+ errorSchema && {
344
+ ...errorSchema,
345
+ [index]: newErrorSchema,
346
+ }, id);
347
+ };
348
+ };
349
+ /** Callback handler used to change the value for a checkbox */
350
+ onSelectChange = (value) => {
351
+ const { onChange, idSchema } = this.props;
352
+ onChange(value, undefined, idSchema && idSchema.$id);
353
+ };
354
354
  /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements
355
355
  */
356
356
  render() {
@@ -418,7 +418,7 @@ class ArrayField extends Component {
418
418
  totalItems: keyedFormData.length,
419
419
  });
420
420
  }),
421
- className: `field field-array field-array-of-${itemsSchema.type}`,
421
+ className: `rjsf-field rjsf-field-array rjsf-field-array-of-${itemsSchema.type}`,
422
422
  disabled,
423
423
  idSchema,
424
424
  uiSchema,
@@ -438,38 +438,35 @@ class ArrayField extends Component {
438
438
  /** Renders an array using the custom widget provided by the user in the `uiSchema`
439
439
  */
440
440
  renderCustomWidget() {
441
- var _a;
442
441
  const { schema, idSchema, uiSchema, disabled = false, readonly = false, autofocus = false, required = false, hideError, placeholder, onBlur, onFocus, formData: items = [], registry, rawErrors, name, } = this.props;
443
442
  const { widgets, formContext, globalUiOptions, schemaUtils } = registry;
444
443
  const { widget, title: uiTitle, ...options } = getUiOptions(uiSchema, globalUiOptions);
445
444
  const Widget = getWidget(schema, widget, widgets);
446
- const label = (_a = uiTitle !== null && uiTitle !== void 0 ? uiTitle : schema.title) !== null && _a !== void 0 ? _a : name;
445
+ const label = uiTitle ?? schema.title ?? name;
447
446
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
448
447
  return (_jsx(Widget, { id: idSchema.$id, name: name, multiple: true, onChange: this.onSelectChange, onBlur: onBlur, onFocus: onFocus, options: options, schema: schema, uiSchema: uiSchema, registry: registry, value: items, disabled: disabled, readonly: readonly, hideError: hideError, required: required, label: label, hideLabel: !displayLabel, placeholder: placeholder, formContext: formContext, autofocus: autofocus, rawErrors: rawErrors }));
449
448
  }
450
449
  /** Renders an array as a set of checkboxes
451
450
  */
452
451
  renderMultiSelect() {
453
- var _a;
454
452
  const { schema, idSchema, uiSchema, formData: items = [], disabled = false, readonly = false, autofocus = false, required = false, placeholder, onBlur, onFocus, registry, rawErrors, name, } = this.props;
455
453
  const { widgets, schemaUtils, formContext, globalUiOptions } = registry;
456
454
  const itemsSchema = schemaUtils.retrieveSchema(schema.items, items);
457
455
  const enumOptions = optionsList(itemsSchema, uiSchema);
458
456
  const { widget = 'select', title: uiTitle, ...options } = getUiOptions(uiSchema, globalUiOptions);
459
457
  const Widget = getWidget(schema, widget, widgets);
460
- const label = (_a = uiTitle !== null && uiTitle !== void 0 ? uiTitle : schema.title) !== null && _a !== void 0 ? _a : name;
458
+ const label = uiTitle ?? schema.title ?? name;
461
459
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
462
460
  return (_jsx(Widget, { id: idSchema.$id, name: name, multiple: true, onChange: this.onSelectChange, onBlur: onBlur, onFocus: onFocus, options: { ...options, enumOptions }, schema: schema, uiSchema: uiSchema, registry: registry, value: items, disabled: disabled, readonly: readonly, required: required, label: label, hideLabel: !displayLabel, placeholder: placeholder, formContext: formContext, autofocus: autofocus, rawErrors: rawErrors }));
463
461
  }
464
462
  /** Renders an array of files using the `FileWidget`
465
463
  */
466
464
  renderFiles() {
467
- var _a;
468
465
  const { schema, uiSchema, idSchema, name, disabled = false, readonly = false, autofocus = false, required = false, onBlur, onFocus, registry, formData: items = [], rawErrors, } = this.props;
469
466
  const { widgets, formContext, globalUiOptions, schemaUtils } = registry;
470
467
  const { widget = 'files', title: uiTitle, ...options } = getUiOptions(uiSchema, globalUiOptions);
471
468
  const Widget = getWidget(schema, widget, widgets);
472
- const label = (_a = uiTitle !== null && uiTitle !== void 0 ? uiTitle : schema.title) !== null && _a !== void 0 ? _a : name;
469
+ const label = uiTitle ?? schema.title ?? name;
473
470
  const displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema, globalUiOptions);
474
471
  return (_jsx(Widget, { options: options, id: idSchema.$id, name: name, multiple: true, onChange: this.onSelectChange, onBlur: onBlur, onFocus: onFocus, schema: schema, uiSchema: uiSchema, value: items, disabled: disabled, readonly: readonly, required: required, registry: registry, formContext: formContext, autofocus: autofocus, rawErrors: rawErrors, label: label, hideLabel: !displayLabel }));
475
472
  }
@@ -496,7 +493,7 @@ class ArrayField extends Component {
496
493
  const canAdd = this.canAddItem(items) && !!additionalSchema;
497
494
  const arrayProps = {
498
495
  canAdd,
499
- className: 'field field-array field-array-fixed-items',
496
+ className: 'rjsf-field rjsf-field-array rjsf-field-array-fixed-items',
500
497
  disabled,
501
498
  idSchema,
502
499
  formData,
@@ -572,21 +569,31 @@ class ArrayField extends Component {
572
569
  has.toolbar = Object.keys(has).some((key) => has[key]);
573
570
  return {
574
571
  children: (_jsx(ItemSchemaField, { name: name, title: title, index: index, schema: itemSchema, uiSchema: itemUiSchema, formData: itemData, formContext: formContext, errorSchema: itemErrorSchema, idPrefix: idPrefix, idSeparator: idSeparator, idSchema: itemIdSchema, required: this.isItemRequired(itemSchema), onChange: this.onChangeForIndex(index), onBlur: onBlur, onFocus: onFocus, registry: registry, disabled: disabled, readonly: readonly, hideError: hideError, autofocus: autofocus, rawErrors: rawErrors })),
575
- className: 'array-item',
572
+ buttonsProps: {
573
+ idSchema: itemIdSchema,
574
+ disabled: disabled,
575
+ readonly: readonly,
576
+ canAdd,
577
+ hasCopy: has.copy,
578
+ hasMoveUp: has.moveUp,
579
+ hasMoveDown: has.moveDown,
580
+ hasRemove: has.remove,
581
+ index: index,
582
+ totalItems: totalItems,
583
+ onAddIndexClick: this.onAddIndexClick,
584
+ onCopyIndexClick: this.onCopyIndexClick,
585
+ onDropIndexClick: this.onDropIndexClick,
586
+ onReorderClick: this.onReorderClick,
587
+ registry: registry,
588
+ schema: itemSchema,
589
+ uiSchema: itemUiSchema,
590
+ },
591
+ className: 'rjsf-array-item',
576
592
  disabled,
577
- canAdd,
578
- hasCopy: has.copy,
579
593
  hasToolbar: has.toolbar,
580
- hasMoveUp: has.moveUp,
581
- hasMoveDown: has.moveDown,
582
- hasRemove: has.remove,
583
594
  index,
584
595
  totalItems,
585
596
  key,
586
- onAddIndexClick: this.onAddIndexClick,
587
- onCopyIndexClick: this.onCopyIndexClick,
588
- onDropIndexClick: this.onDropIndexClick,
589
- onReorderClick: this.onReorderClick,
590
597
  readonly,
591
598
  registry,
592
599
  schema: itemSchema,
@@ -598,4 +605,3 @@ class ArrayField extends Component {
598
605
  * `Field` which is defined as `React.ComponentType<FieldProps<T, S, F>>`, so cast it to make `registry` happy.
599
606
  */
600
607
  export default ArrayField;
601
- //# sourceMappingURL=ArrayField.js.map
@@ -6,3 +6,4 @@ import { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf
6
6
  */
7
7
  declare function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: FieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
8
8
  export default BooleanField;
9
+ //# sourceMappingURL=BooleanField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BooleanField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/BooleanField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACV,eAAe,EAEf,UAAU,EACV,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAGrB;;;;GAIG;AACH,iBAAS,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACrG,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CA6F3B;AAED,eAAe,YAAY,CAAC"}