@rjsf/core 6.0.0-alpha.0 → 6.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/dist/core.umd.js +1680 -809
  2. package/dist/index.esm.js +2166 -1198
  3. package/dist/index.esm.js.map +4 -4
  4. package/dist/index.js +2221 -1299
  5. package/dist/index.js.map +4 -4
  6. package/lib/components/Form.d.ts +22 -9
  7. package/lib/components/Form.d.ts.map +1 -0
  8. package/lib/components/Form.js +368 -312
  9. package/lib/components/RichDescription.d.ts +20 -0
  10. package/lib/components/RichDescription.d.ts.map +1 -0
  11. package/lib/components/RichDescription.js +17 -0
  12. package/lib/components/fields/ArrayField.d.ts +20 -9
  13. package/lib/components/fields/ArrayField.d.ts.map +1 -0
  14. package/lib/components/fields/ArrayField.js +212 -206
  15. package/lib/components/fields/BooleanField.d.ts +1 -0
  16. package/lib/components/fields/BooleanField.d.ts.map +1 -0
  17. package/lib/components/fields/BooleanField.js +6 -14
  18. package/lib/components/fields/LayoutGridField.d.ts +480 -0
  19. package/lib/components/fields/LayoutGridField.d.ts.map +1 -0
  20. package/lib/components/fields/LayoutGridField.js +711 -0
  21. package/lib/components/fields/LayoutHeaderField.d.ts +12 -0
  22. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -0
  23. package/lib/components/fields/LayoutHeaderField.js +23 -0
  24. package/lib/components/fields/LayoutMultiSchemaField.d.ts +28 -0
  25. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -0
  26. package/lib/components/fields/LayoutMultiSchemaField.js +114 -0
  27. package/lib/components/fields/MultiSchemaField.d.ts +1 -0
  28. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -0
  29. package/lib/components/fields/MultiSchemaField.js +31 -31
  30. package/lib/components/fields/NullField.d.ts +1 -0
  31. package/lib/components/fields/NullField.d.ts.map +1 -0
  32. package/lib/components/fields/NullField.js +0 -1
  33. package/lib/components/fields/NumberField.d.ts +1 -0
  34. package/lib/components/fields/NumberField.d.ts.map +1 -0
  35. package/lib/components/fields/NumberField.js +2 -3
  36. package/lib/components/fields/ObjectField.d.ts +1 -0
  37. package/lib/components/fields/ObjectField.d.ts.map +1 -0
  38. package/lib/components/fields/ObjectField.js +146 -141
  39. package/lib/components/fields/SchemaField.d.ts +1 -0
  40. package/lib/components/fields/SchemaField.d.ts.map +1 -0
  41. package/lib/components/fields/SchemaField.js +10 -20
  42. package/lib/components/fields/StringField.d.ts +1 -0
  43. package/lib/components/fields/StringField.d.ts.map +1 -0
  44. package/lib/components/fields/StringField.js +1 -3
  45. package/lib/components/fields/index.d.ts +1 -0
  46. package/lib/components/fields/index.d.ts.map +1 -0
  47. package/lib/components/fields/index.js +14 -9
  48. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -0
  49. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -0
  50. package/lib/components/templates/ArrayFieldDescriptionTemplate.js +0 -1
  51. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +8 -0
  52. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -0
  53. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +17 -0
  54. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +4 -3
  55. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -0
  56. package/lib/components/templates/ArrayFieldItemTemplate.js +7 -6
  57. package/lib/components/templates/ArrayFieldTemplate.d.ts +2 -1
  58. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -0
  59. package/lib/components/templates/ArrayFieldTemplate.js +3 -4
  60. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -0
  61. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -0
  62. package/lib/components/templates/ArrayFieldTitleTemplate.js +0 -1
  63. package/lib/components/templates/BaseInputTemplate.d.ts +1 -0
  64. package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -0
  65. package/lib/components/templates/BaseInputTemplate.js +0 -1
  66. package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -0
  67. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -0
  68. package/lib/components/templates/ButtonTemplates/AddButton.js +1 -2
  69. package/lib/components/templates/ButtonTemplates/IconButton.d.ts +1 -0
  70. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -0
  71. package/lib/components/templates/ButtonTemplates/IconButton.js +4 -5
  72. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -0
  73. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -0
  74. package/lib/components/templates/ButtonTemplates/SubmitButton.js +0 -1
  75. package/lib/components/templates/ButtonTemplates/index.d.ts +1 -0
  76. package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -0
  77. package/lib/components/templates/ButtonTemplates/index.js +3 -4
  78. package/lib/components/templates/DescriptionField.d.ts +1 -0
  79. package/lib/components/templates/DescriptionField.d.ts.map +1 -0
  80. package/lib/components/templates/DescriptionField.js +3 -8
  81. package/lib/components/templates/ErrorList.d.ts +1 -0
  82. package/lib/components/templates/ErrorList.d.ts.map +1 -0
  83. package/lib/components/templates/ErrorList.js +0 -1
  84. package/lib/components/templates/FieldErrorTemplate.d.ts +1 -0
  85. package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -0
  86. package/lib/components/templates/FieldErrorTemplate.js +0 -1
  87. package/lib/components/templates/FieldHelpTemplate.d.ts +1 -0
  88. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -0
  89. package/lib/components/templates/FieldHelpTemplate.js +0 -1
  90. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -0
  91. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -0
  92. package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -2
  93. package/lib/components/templates/FieldTemplate/Label.d.ts +1 -0
  94. package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -0
  95. package/lib/components/templates/FieldTemplate/Label.js +0 -1
  96. package/lib/components/templates/FieldTemplate/index.d.ts +2 -1
  97. package/lib/components/templates/FieldTemplate/index.d.ts.map +1 -0
  98. package/lib/components/templates/FieldTemplate/index.js +1 -2
  99. package/lib/components/templates/GridTemplate.d.ts +8 -0
  100. package/lib/components/templates/GridTemplate.d.ts.map +1 -0
  101. package/lib/components/templates/GridTemplate.js +10 -0
  102. package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -0
  103. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -0
  104. package/lib/components/templates/ObjectFieldTemplate.js +2 -3
  105. package/lib/components/templates/TitleField.d.ts +1 -0
  106. package/lib/components/templates/TitleField.d.ts.map +1 -0
  107. package/lib/components/templates/TitleField.js +0 -1
  108. package/lib/components/templates/UnsupportedField.d.ts +1 -0
  109. package/lib/components/templates/UnsupportedField.d.ts.map +1 -0
  110. package/lib/components/templates/UnsupportedField.js +0 -1
  111. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -0
  112. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -0
  113. package/lib/components/templates/WrapIfAdditionalTemplate.js +10 -6
  114. package/lib/components/templates/index.d.ts +1 -0
  115. package/lib/components/templates/index.d.ts.map +1 -0
  116. package/lib/components/templates/index.js +19 -16
  117. package/lib/components/widgets/AltDateTimeWidget.d.ts +1 -0
  118. package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -0
  119. package/lib/components/widgets/AltDateTimeWidget.js +0 -1
  120. package/lib/components/widgets/AltDateWidget.d.ts +1 -0
  121. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -0
  122. package/lib/components/widgets/AltDateWidget.js +0 -1
  123. package/lib/components/widgets/CheckboxWidget.d.ts +1 -0
  124. package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -0
  125. package/lib/components/widgets/CheckboxWidget.js +2 -4
  126. package/lib/components/widgets/CheckboxesWidget.d.ts +1 -0
  127. package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -0
  128. package/lib/components/widgets/CheckboxesWidget.js +0 -1
  129. package/lib/components/widgets/ColorWidget.d.ts +1 -0
  130. package/lib/components/widgets/ColorWidget.d.ts.map +1 -0
  131. package/lib/components/widgets/ColorWidget.js +0 -1
  132. package/lib/components/widgets/DateTimeWidget.d.ts +1 -0
  133. package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -0
  134. package/lib/components/widgets/DateTimeWidget.js +0 -1
  135. package/lib/components/widgets/DateWidget.d.ts +1 -0
  136. package/lib/components/widgets/DateWidget.d.ts.map +1 -0
  137. package/lib/components/widgets/DateWidget.js +0 -1
  138. package/lib/components/widgets/EmailWidget.d.ts +1 -0
  139. package/lib/components/widgets/EmailWidget.d.ts.map +1 -0
  140. package/lib/components/widgets/EmailWidget.js +0 -1
  141. package/lib/components/widgets/FileWidget.d.ts +1 -0
  142. package/lib/components/widgets/FileWidget.d.ts.map +1 -0
  143. package/lib/components/widgets/FileWidget.js +3 -5
  144. package/lib/components/widgets/HiddenWidget.d.ts +1 -0
  145. package/lib/components/widgets/HiddenWidget.d.ts.map +1 -0
  146. package/lib/components/widgets/HiddenWidget.js +0 -1
  147. package/lib/components/widgets/PasswordWidget.d.ts +1 -0
  148. package/lib/components/widgets/PasswordWidget.d.ts.map +1 -0
  149. package/lib/components/widgets/PasswordWidget.js +0 -1
  150. package/lib/components/widgets/RadioWidget.d.ts +1 -0
  151. package/lib/components/widgets/RadioWidget.d.ts.map +1 -0
  152. package/lib/components/widgets/RadioWidget.js +3 -4
  153. package/lib/components/widgets/RangeWidget.d.ts +1 -0
  154. package/lib/components/widgets/RangeWidget.d.ts.map +1 -0
  155. package/lib/components/widgets/RangeWidget.js +0 -1
  156. package/lib/components/widgets/RatingWidget.d.ts +15 -0
  157. package/lib/components/widgets/RatingWidget.d.ts.map +1 -0
  158. package/lib/components/widgets/RatingWidget.js +63 -0
  159. package/lib/components/widgets/SelectWidget.d.ts +1 -0
  160. package/lib/components/widgets/SelectWidget.d.ts.map +1 -0
  161. package/lib/components/widgets/SelectWidget.js +4 -5
  162. package/lib/components/widgets/TextWidget.d.ts +1 -0
  163. package/lib/components/widgets/TextWidget.d.ts.map +1 -0
  164. package/lib/components/widgets/TextWidget.js +0 -1
  165. package/lib/components/widgets/TextareaWidget.d.ts +1 -0
  166. package/lib/components/widgets/TextareaWidget.d.ts.map +1 -0
  167. package/lib/components/widgets/TextareaWidget.js +0 -1
  168. package/lib/components/widgets/TimeWidget.d.ts +1 -0
  169. package/lib/components/widgets/TimeWidget.d.ts.map +1 -0
  170. package/lib/components/widgets/TimeWidget.js +0 -1
  171. package/lib/components/widgets/URLWidget.d.ts +1 -0
  172. package/lib/components/widgets/URLWidget.d.ts.map +1 -0
  173. package/lib/components/widgets/URLWidget.js +0 -1
  174. package/lib/components/widgets/UpDownWidget.d.ts +1 -0
  175. package/lib/components/widgets/UpDownWidget.d.ts.map +1 -0
  176. package/lib/components/widgets/UpDownWidget.js +0 -1
  177. package/lib/components/widgets/index.d.ts +1 -0
  178. package/lib/components/widgets/index.d.ts.map +1 -0
  179. package/lib/components/widgets/index.js +21 -20
  180. package/lib/getDefaultRegistry.d.ts +1 -0
  181. package/lib/getDefaultRegistry.d.ts.map +1 -0
  182. package/lib/getDefaultRegistry.js +3 -4
  183. package/lib/index.d.ts +7 -5
  184. package/lib/index.d.ts.map +1 -0
  185. package/lib/index.js +5 -5
  186. package/lib/tsconfig.tsbuildinfo +1 -1
  187. package/lib/withTheme.d.ts +2 -1
  188. package/lib/withTheme.d.ts.map +1 -0
  189. package/lib/withTheme.js +7 -8
  190. package/package.json +46 -37
  191. package/src/components/Form.tsx +127 -41
  192. package/src/components/RichDescription.tsx +50 -0
  193. package/src/components/fields/ArrayField.tsx +34 -24
  194. package/src/components/fields/BooleanField.tsx +6 -14
  195. package/src/components/fields/LayoutGridField.tsx +967 -0
  196. package/src/components/fields/LayoutHeaderField.tsx +49 -0
  197. package/src/components/fields/LayoutMultiSchemaField.tsx +228 -0
  198. package/src/components/fields/MultiSchemaField.tsx +9 -4
  199. package/src/components/fields/NullField.tsx +1 -1
  200. package/src/components/fields/NumberField.tsx +5 -5
  201. package/src/components/fields/ObjectField.tsx +32 -24
  202. package/src/components/fields/SchemaField.tsx +17 -30
  203. package/src/components/fields/StringField.tsx +2 -2
  204. package/src/components/fields/index.ts +7 -1
  205. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -2
  206. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +85 -0
  207. package/src/components/templates/ArrayFieldItemTemplate.tsx +18 -57
  208. package/src/components/templates/ArrayFieldTemplate.tsx +10 -8
  209. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -2
  210. package/src/components/templates/BaseInputTemplate.tsx +4 -4
  211. package/src/components/templates/ButtonTemplates/IconButton.tsx +9 -36
  212. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +1 -1
  213. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  214. package/src/components/templates/DescriptionField.tsx +9 -15
  215. package/src/components/templates/FieldErrorTemplate.tsx +1 -1
  216. package/src/components/templates/FieldHelpTemplate.tsx +1 -1
  217. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -2
  218. package/src/components/templates/GridTemplate.tsx +15 -0
  219. package/src/components/templates/ObjectFieldTemplate.tsx +5 -3
  220. package/src/components/templates/TitleField.tsx +1 -1
  221. package/src/components/templates/UnsupportedField.tsx +1 -1
  222. package/src/components/templates/WrapIfAdditionalTemplate.tsx +14 -4
  223. package/src/components/templates/index.ts +4 -0
  224. package/src/components/widgets/AltDateWidget.tsx +9 -6
  225. package/src/components/widgets/CheckboxWidget.tsx +5 -5
  226. package/src/components/widgets/CheckboxesWidget.tsx +2 -2
  227. package/src/components/widgets/ColorWidget.tsx +1 -1
  228. package/src/components/widgets/DateTimeWidget.tsx +1 -1
  229. package/src/components/widgets/DateWidget.tsx +1 -1
  230. package/src/components/widgets/EmailWidget.tsx +1 -1
  231. package/src/components/widgets/FileWidget.tsx +5 -5
  232. package/src/components/widgets/PasswordWidget.tsx +1 -1
  233. package/src/components/widgets/RadioWidget.tsx +3 -3
  234. package/src/components/widgets/RangeWidget.tsx +1 -1
  235. package/src/components/widgets/RatingWidget.tsx +129 -0
  236. package/src/components/widgets/SelectWidget.tsx +4 -3
  237. package/src/components/widgets/TextWidget.tsx +1 -1
  238. package/src/components/widgets/TextareaWidget.tsx +3 -3
  239. package/src/components/widgets/TimeWidget.tsx +1 -1
  240. package/src/components/widgets/URLWidget.tsx +1 -1
  241. package/src/components/widgets/UpDownWidget.tsx +1 -1
  242. package/src/components/widgets/index.ts +3 -1
  243. package/src/getDefaultRegistry.ts +1 -1
  244. package/src/index.ts +3 -2
  245. package/src/tsconfig.json +14 -6
  246. package/src/withTheme.tsx +4 -3
  247. package/LICENSE.md +0 -201
  248. package/lib/components/Form.js.map +0 -1
  249. package/lib/components/fields/ArrayField.js.map +0 -1
  250. package/lib/components/fields/BooleanField.js.map +0 -1
  251. package/lib/components/fields/MultiSchemaField.js.map +0 -1
  252. package/lib/components/fields/NullField.js.map +0 -1
  253. package/lib/components/fields/NumberField.js.map +0 -1
  254. package/lib/components/fields/ObjectField.js.map +0 -1
  255. package/lib/components/fields/SchemaField.js.map +0 -1
  256. package/lib/components/fields/StringField.js.map +0 -1
  257. package/lib/components/fields/index.js.map +0 -1
  258. package/lib/components/templates/ArrayFieldDescriptionTemplate.js.map +0 -1
  259. package/lib/components/templates/ArrayFieldItemTemplate.js.map +0 -1
  260. package/lib/components/templates/ArrayFieldTemplate.js.map +0 -1
  261. package/lib/components/templates/ArrayFieldTitleTemplate.js.map +0 -1
  262. package/lib/components/templates/BaseInputTemplate.js.map +0 -1
  263. package/lib/components/templates/ButtonTemplates/AddButton.js.map +0 -1
  264. package/lib/components/templates/ButtonTemplates/IconButton.js.map +0 -1
  265. package/lib/components/templates/ButtonTemplates/SubmitButton.js.map +0 -1
  266. package/lib/components/templates/ButtonTemplates/index.js.map +0 -1
  267. package/lib/components/templates/DescriptionField.js.map +0 -1
  268. package/lib/components/templates/ErrorList.js.map +0 -1
  269. package/lib/components/templates/FieldErrorTemplate.js.map +0 -1
  270. package/lib/components/templates/FieldHelpTemplate.js.map +0 -1
  271. package/lib/components/templates/FieldTemplate/FieldTemplate.js.map +0 -1
  272. package/lib/components/templates/FieldTemplate/Label.js.map +0 -1
  273. package/lib/components/templates/FieldTemplate/index.js.map +0 -1
  274. package/lib/components/templates/ObjectFieldTemplate.js.map +0 -1
  275. package/lib/components/templates/TitleField.js.map +0 -1
  276. package/lib/components/templates/UnsupportedField.js.map +0 -1
  277. package/lib/components/templates/WrapIfAdditionalTemplate.js.map +0 -1
  278. package/lib/components/templates/index.js.map +0 -1
  279. package/lib/components/widgets/AltDateTimeWidget.js.map +0 -1
  280. package/lib/components/widgets/AltDateWidget.js.map +0 -1
  281. package/lib/components/widgets/CheckboxWidget.js.map +0 -1
  282. package/lib/components/widgets/CheckboxesWidget.js.map +0 -1
  283. package/lib/components/widgets/ColorWidget.js.map +0 -1
  284. package/lib/components/widgets/DateTimeWidget.js.map +0 -1
  285. package/lib/components/widgets/DateWidget.js.map +0 -1
  286. package/lib/components/widgets/EmailWidget.js.map +0 -1
  287. package/lib/components/widgets/FileWidget.js.map +0 -1
  288. package/lib/components/widgets/HiddenWidget.js.map +0 -1
  289. package/lib/components/widgets/PasswordWidget.js.map +0 -1
  290. package/lib/components/widgets/RadioWidget.js.map +0 -1
  291. package/lib/components/widgets/RangeWidget.js.map +0 -1
  292. package/lib/components/widgets/SelectWidget.js.map +0 -1
  293. package/lib/components/widgets/TextWidget.js.map +0 -1
  294. package/lib/components/widgets/TextareaWidget.js.map +0 -1
  295. package/lib/components/widgets/TimeWidget.js.map +0 -1
  296. package/lib/components/widgets/URLWidget.js.map +0 -1
  297. package/lib/components/widgets/UpDownWidget.js.map +0 -1
  298. package/lib/components/widgets/index.js.map +0 -1
  299. package/lib/getDefaultRegistry.js.map +0 -1
  300. package/lib/index.js.map +0 -1
  301. package/lib/withTheme.js.map +0 -1
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@rjsf/core",
3
- "version": "6.0.0-alpha.0",
3
+ "version": "6.0.0-beta.2",
4
4
  "description": "A simple React component capable of building HTML forms out of a JSON schema.",
5
5
  "scripts": {
6
- "build:ts": "tsc -b",
6
+ "compileReplacer": "tsc -p tsconfig.replacer.json && move-file lodashReplacer.js lodashReplacer.cjs",
7
+ "build:ts": "npm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
7
8
  "build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --sourcemap --packages=external --format=cjs",
8
9
  "build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/index.esm.js --sourcemap --packages=external --format=esm",
9
10
  "build:umd": "rollup dist/index.esm.js --format=umd --file=dist/core.umd.js --name=JSONSchemaForm",
@@ -14,7 +15,7 @@
14
15
  "precommit": "lint-staged",
15
16
  "publish-to-npm": "npm run build && npm publish",
16
17
  "test": "jest",
17
- "test:debug": "node --inspect-brk node_modules/.bin/jest",
18
+ "test:debug": "node --inspect-brk ../../node_modules/.bin/jest",
18
19
  "test:update": "jest --u",
19
20
  "test:watch": "jest --watch",
20
21
  "test-coverage": "jest --coverage"
@@ -27,6 +28,34 @@
27
28
  "main": "dist/index.js",
28
29
  "module": "lib/index.js",
29
30
  "typings": "lib/index.d.ts",
31
+ "type": "module",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./lib/index.d.ts",
35
+ "require": "./dist/index.js",
36
+ "import": "./lib/index.js"
37
+ },
38
+ "./lib": {
39
+ "types": "./lib/index.d.ts",
40
+ "require": "./dist/index.js",
41
+ "import": "./lib/index.js"
42
+ },
43
+ "./lib/*.js": {
44
+ "types": "./lib/*.d.ts",
45
+ "require": "./dist/*.js",
46
+ "import": "./lib/*.js"
47
+ },
48
+ "./dist": {
49
+ "types": "./lib/index.d.ts",
50
+ "require": "./dist/index.js",
51
+ "import": "./lib/index.js"
52
+ },
53
+ "./dist/*.js": {
54
+ "types": "./lib/*.d.ts",
55
+ "require": "./dist/*.js",
56
+ "import": "./lib/*.js"
57
+ }
58
+ },
30
59
  "files": [
31
60
  "dist",
32
61
  "lib",
@@ -34,54 +63,35 @@
34
63
  ],
35
64
  "engineStrict": false,
36
65
  "engines": {
37
- "node": ">=14"
66
+ "node": ">=20"
38
67
  },
39
68
  "peerDependencies": {
40
- "@rjsf/utils": "^5.20.x",
41
- "react": "^16.14.0 || >=17"
69
+ "@rjsf/utils": "^6.0.0-beta.x",
70
+ "react": ">=18"
42
71
  },
43
72
  "dependencies": {
44
73
  "lodash": "^4.17.21",
45
74
  "lodash-es": "^4.17.21",
46
- "markdown-to-jsx": "^7.4.1",
47
- "nanoid": "^3.3.7",
75
+ "markdown-to-jsx": "^7.7.6",
76
+ "nanoid": "^5.1.5",
48
77
  "prop-types": "^15.8.1"
49
78
  },
50
79
  "devDependencies": {
51
- "@babel/core": "^7.23.9",
52
- "@babel/plugin-proposal-class-properties": "^7.18.6",
53
- "@babel/plugin-proposal-optional-chaining": "^7.21.0",
54
- "@babel/preset-env": "^7.23.9",
55
- "@babel/preset-react": "^7.23.3",
56
- "@babel/preset-typescript": "^7.23.3",
57
- "@rjsf/snapshot-tests": "^6.0.0-alpha.0",
58
- "@rjsf/utils": "^6.0.0-alpha.0",
59
- "@rjsf/validator-ajv6": "^6.0.0-alpha.0",
60
- "@rjsf/validator-ajv8": "^6.0.0-alpha.0",
61
- "@types/jest": "^29.5.12",
62
- "@types/lodash": "^4.14.202",
63
- "@types/react": "^18.2.58",
64
- "@types/react-dom": "^18.2.19",
65
- "@types/react-test-renderer": "^18.0.7",
80
+ "@rjsf/snapshot-tests": "^6.0.0-beta.2",
81
+ "@rjsf/utils": "^6.0.0-beta.2",
82
+ "@rjsf/validator-ajv8": "^6.0.0-beta.2",
83
+ "@testing-library/jest-dom": "^6.6.3",
84
+ "@testing-library/react": "^16.2.0",
85
+ "@testing-library/user-event": "^14.6.1",
66
86
  "ajv": "^8.12.0",
67
87
  "atob": "^2.1.2",
68
- "babel-jest": "^29.7.0",
69
88
  "chai": "^3.5.0",
70
- "esbuild": "^0.18.20",
71
89
  "eslint": "^8.56.0",
72
90
  "html": "^1.0.0",
73
- "jest": "^29.7.0",
74
- "jest-environment-jsdom": "^29.7.0",
75
91
  "jsdom": "^20.0.3",
76
92
  "mocha": "^10.2.0",
77
- "react": "^18.2.0",
78
- "react-dom": "^18.2.0",
79
- "react-portal": "^4.2.2",
80
- "react-test-renderer": "^18.2.0",
81
- "rimraf": "^5.0.5",
82
- "rollup": "^3.29.4",
83
- "sinon": "^9.2.4",
84
- "typescript": "^4.9.5"
93
+ "react-portal": "^4.3.0",
94
+ "sinon": "^9.2.4"
85
95
  },
86
96
  "directories": {
87
97
  "test": "test"
@@ -103,6 +113,5 @@
103
113
  "homepage": "https://github.com/rjsf-team/react-jsonschema-form",
104
114
  "publishConfig": {
105
115
  "access": "public"
106
- },
107
- "gitHead": "f4229bf6e067d31b24de3ef9d3ca754ee52529ac"
116
+ }
108
117
  }
@@ -7,6 +7,7 @@ import {
7
7
  ErrorTransformer,
8
8
  FormContextType,
9
9
  GenericObjectType,
10
+ getChangedFields,
10
11
  getTemplate,
11
12
  getUiOptions,
12
13
  IdSchema,
@@ -33,10 +34,14 @@ import {
33
34
  validationDataMerge,
34
35
  ValidatorType,
35
36
  Experimental_DefaultFormStateBehavior,
37
+ Experimental_CustomMergeAllOf,
38
+ createErrorHandler,
39
+ unwrapErrorHandler,
36
40
  } from '@rjsf/utils';
37
41
  import _forEach from 'lodash/forEach';
38
42
  import _get from 'lodash/get';
39
43
  import _isEmpty from 'lodash/isEmpty';
44
+ import _isNil from 'lodash/isNil';
40
45
  import _pick from 'lodash/pick';
41
46
  import _toPath from 'lodash/toPath';
42
47
 
@@ -111,11 +116,6 @@ export interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
111
116
  * an `onFocus` handler, which will receive the id of the input that is focused and the field value
112
117
  */
113
118
  onFocus?: (id: string, data: any) => void;
114
- // <form /> HTML attributes
115
- /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form
116
- * @deprecated replaced with `acceptCharset` which will supercede this value if both are specified
117
- */
118
- acceptcharset?: string;
119
119
  /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */
120
120
  acceptCharset?: string;
121
121
  /** The value of this prop will be passed to the `action` HTML attribute on the form
@@ -195,6 +195,9 @@ export interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
195
195
  * `emptyObjectFields`
196
196
  */
197
197
  experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior;
198
+ /** Optional function that allows for custom merging of `allOf` schemas
199
+ */
200
+ experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>;
198
201
  // Private
199
202
  /**
200
203
  * _internalFormWrapper is currently used by the semantic-ui theme to provide a custom wrapper around `<Form />`
@@ -261,7 +264,7 @@ export interface IChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema,
261
264
  export default class Form<
262
265
  T = any,
263
266
  S extends StrictRJSFSchema = RJSFSchema,
264
- F extends FormContextType = any
267
+ F extends FormContextType = any,
265
268
  > extends Component<FormProps<T, S, F>, FormState<T, S, F>> {
266
269
  /** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
267
270
  * provide any possible type here
@@ -308,11 +311,15 @@ export default class Form<
308
311
  */
309
312
  getSnapshotBeforeUpdate(
310
313
  prevProps: FormProps<T, S, F>,
311
- prevState: FormState<T, S, F>
314
+ prevState: FormState<T, S, F>,
312
315
  ): { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false } {
313
316
  if (!deepEquals(this.props, prevProps)) {
317
+ const formDataChangedFields = getChangedFields(this.props.formData, prevProps.formData);
314
318
  const isSchemaChanged = !deepEquals(prevProps.schema, this.props.schema);
315
- const isFormDataChanged = !deepEquals(prevProps.formData, this.props.formData);
319
+ // When formData is not an object, getChangedFields returns an empty array.
320
+ // In this case, deepEquals is most needed to check again.
321
+ const isFormDataChanged =
322
+ formDataChangedFields.length > 0 || !deepEquals(prevProps.formData, this.props.formData);
316
323
  const nextState = this.getStateFromProps(
317
324
  this.props,
318
325
  this.props.formData,
@@ -320,7 +327,8 @@ export default class Form<
320
327
  // Or if the `formData` changes, for example in the case of a schema with dependencies that need to
321
328
  // match one of the subSchemas, the retrieved schema must be updated.
322
329
  isSchemaChanged || isFormDataChanged ? undefined : this.state.retrievedSchema,
323
- isSchemaChanged
330
+ isSchemaChanged,
331
+ formDataChangedFields,
324
332
  );
325
333
  const shouldUpdate = !deepEquals(nextState, prevState);
326
334
  return { nextState, shouldUpdate };
@@ -336,9 +344,6 @@ export default class Form<
336
344
  * If an update is required, it applies the next state and, if needed, triggers the `onChange` handler to inform about
337
345
  * changes.
338
346
  *
339
- * This method effectively replaces the deprecated `UNSAFE_componentWillReceiveProps`, providing a safer alternative
340
- * to handle prop changes and state updates.
341
- *
342
347
  * @param _ - The previous set of props.
343
348
  * @param prevState - The previous state of the component before the update.
344
349
  * @param snapshot - The value returned from `getSnapshotBeforeUpdate`.
@@ -346,7 +351,7 @@ export default class Form<
346
351
  componentDidUpdate(
347
352
  _: FormProps<T, S, F>,
348
353
  prevState: FormState<T, S, F>,
349
- snapshot: { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false }
354
+ snapshot: { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false },
350
355
  ) {
351
356
  if (snapshot.shouldUpdate) {
352
357
  const { nextState } = snapshot;
@@ -370,13 +375,15 @@ export default class Form<
370
375
  * @param inputFormData - The new or current data for the `Form`
371
376
  * @param retrievedSchema - An expanded schema, if not provided, it will be retrieved from the `schema` and `formData`.
372
377
  * @param isSchemaChanged - A flag indicating whether the schema has changed.
378
+ * @param formDataChangedFields - The changed fields of `formData`
373
379
  * @returns - The new state for the `Form`
374
380
  */
375
381
  getStateFromProps(
376
382
  props: FormProps<T, S, F>,
377
383
  inputFormData?: T,
378
384
  retrievedSchema?: S,
379
- isSchemaChanged = false
385
+ isSchemaChanged = false,
386
+ formDataChangedFields: string[] = [],
380
387
  ): FormState<T, S, F> {
381
388
  const state: FormState<T, S, F> = this.state || {};
382
389
  const schema = 'schema' in props ? props.schema : this.props.schema;
@@ -389,15 +396,31 @@ export default class Form<
389
396
  'experimental_defaultFormStateBehavior' in props
390
397
  ? props.experimental_defaultFormStateBehavior
391
398
  : this.props.experimental_defaultFormStateBehavior;
399
+ const experimental_customMergeAllOf =
400
+ 'experimental_customMergeAllOf' in props
401
+ ? props.experimental_customMergeAllOf
402
+ : this.props.experimental_customMergeAllOf;
392
403
  let schemaUtils: SchemaUtilsType<T, S, F> = state.schemaUtils;
393
404
  if (
394
405
  !schemaUtils ||
395
- schemaUtils.doesSchemaUtilsDiffer(props.validator, rootSchema, experimental_defaultFormStateBehavior)
406
+ schemaUtils.doesSchemaUtilsDiffer(
407
+ props.validator,
408
+ rootSchema,
409
+ experimental_defaultFormStateBehavior,
410
+ experimental_customMergeAllOf,
411
+ )
396
412
  ) {
397
- schemaUtils = createSchemaUtils<T, S, F>(props.validator, rootSchema, experimental_defaultFormStateBehavior);
413
+ schemaUtils = createSchemaUtils<T, S, F>(
414
+ props.validator,
415
+ rootSchema,
416
+ experimental_defaultFormStateBehavior,
417
+ experimental_customMergeAllOf,
418
+ );
398
419
  }
399
420
  const formData: T = schemaUtils.getDefaultFormState(schema, inputFormData) as T;
400
- const _retrievedSchema = retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData);
421
+ const _retrievedSchema = this.updateRetrievedSchema(
422
+ retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData),
423
+ );
401
424
 
402
425
  const getCurrentErrors = (): ValidationData<T> => {
403
426
  // If the `props.noValidate` option is set or the schema has changed, we reset the error state.
@@ -422,15 +445,15 @@ export default class Form<
422
445
  if (mustValidate) {
423
446
  const schemaValidation = this.validate(formData, schema, schemaUtils, _retrievedSchema);
424
447
  errors = schemaValidation.errors;
425
- // If the schema has changed, we do not merge state.errorSchema.
448
+ // If retrievedSchema is undefined which means the schema or formData has changed, we do not merge state.
426
449
  // Else in the case where it hasn't changed, we merge 'state.errorSchema' with 'schemaValidation.errorSchema.' This done to display the raised field error.
427
- if (isSchemaChanged) {
450
+ if (retrievedSchema === undefined) {
428
451
  errorSchema = schemaValidation.errorSchema;
429
452
  } else {
430
453
  errorSchema = mergeObjects(
431
454
  this.state?.errorSchema,
432
455
  schemaValidation.errorSchema,
433
- 'preventDuplicates'
456
+ 'preventDuplicates',
434
457
  ) as ErrorSchema<T>;
435
458
  }
436
459
  schemaValidationErrors = errors;
@@ -439,7 +462,22 @@ export default class Form<
439
462
  const currentErrors = getCurrentErrors();
440
463
  errors = currentErrors.errors;
441
464
  errorSchema = currentErrors.errorSchema;
465
+ if (formDataChangedFields.length > 0) {
466
+ const newErrorSchema = formDataChangedFields.reduce(
467
+ (acc, key) => {
468
+ acc[key] = undefined;
469
+ return acc;
470
+ },
471
+ {} as Record<string, undefined>,
472
+ );
473
+ errorSchema = schemaValidationErrorSchema = mergeObjects(
474
+ currentErrors.errorSchema,
475
+ newErrorSchema,
476
+ 'preventDuplicates',
477
+ ) as ErrorSchema<T>;
478
+ }
442
479
  }
480
+
443
481
  if (props.extraErrors) {
444
482
  const merged = validationDataMerge({ errorSchema, errors }, props.extraErrors);
445
483
  errorSchema = merged.errorSchema;
@@ -450,7 +488,7 @@ export default class Form<
450
488
  uiSchema['ui:rootFieldId'],
451
489
  formData,
452
490
  props.idPrefix,
453
- props.idSeparator
491
+ props.idSeparator,
454
492
  );
455
493
  const nextState: FormState<T, S, F> = {
456
494
  schemaUtils,
@@ -478,6 +516,22 @@ export default class Form<
478
516
  return shouldRender(this, nextProps, nextState);
479
517
  }
480
518
 
519
+ /** Gets the previously raised customValidate errors.
520
+ *
521
+ * @returns the previous customValidate errors
522
+ */
523
+ private getPreviousCustomValidateErrors(): ErrorSchema<T> {
524
+ const { customValidate, uiSchema } = this.props;
525
+ const prevFormData = this.state.formData as T;
526
+ let customValidateErrors = {};
527
+ if (typeof customValidate === 'function') {
528
+ const errorHandler = customValidate(prevFormData, createErrorHandler<T>(prevFormData), uiSchema);
529
+ const userErrorSchema = unwrapErrorHandler<T>(errorHandler);
530
+ customValidateErrors = userErrorSchema;
531
+ }
532
+ return customValidateErrors;
533
+ }
534
+
481
535
  /** Validates the `formData` against the `schema` using the `altSchemaUtils` (if provided otherwise it uses the
482
536
  * `schemaUtils` in the state), returning the results.
483
537
  *
@@ -489,7 +543,7 @@ export default class Form<
489
543
  formData: T | undefined,
490
544
  schema = this.props.schema,
491
545
  altSchemaUtils?: SchemaUtilsType<T, S, F>,
492
- retrievedSchema?: S
546
+ retrievedSchema?: S,
493
547
  ): ValidationData<T> {
494
548
  const schemaUtils = altSchemaUtils ? altSchemaUtils : this.state.schemaUtils;
495
549
  const { customValidate, transformErrors, uiSchema } = this.props;
@@ -603,18 +657,39 @@ export default class Form<
603
657
  if (resolvedSchema?.type !== 'object' && resolvedSchema?.type !== 'array') {
604
658
  filteredErrors.__errors = schemaErrors.__errors;
605
659
  }
606
- // Removing undefined and empty errors.
607
- const filterUndefinedErrors = (errors: any): ErrorSchema<T> => {
608
- _forEach(errors, (errorAtKey, errorKey: keyof typeof errors) => {
609
- if (errorAtKey === undefined) {
660
+
661
+ const prevCustomValidateErrors = this.getPreviousCustomValidateErrors();
662
+ // Filtering out the previous raised customValidate errors so that they are cleared when no longer valid.
663
+ const filterPreviousCustomErrors = (errors: string[] = [], prevCustomErrors: string[]) => {
664
+ if (errors.length === 0) {
665
+ return errors;
666
+ }
667
+
668
+ return errors.filter((error) => {
669
+ return !prevCustomErrors.includes(error);
670
+ });
671
+ };
672
+
673
+ // Removing undefined, null and empty errors.
674
+ const filterNilOrEmptyErrors = (errors: any, previousCustomValidateErrors: any = {}): ErrorSchema<T> => {
675
+ _forEach(errors, (errorAtKey: ErrorSchema<T>['__errors'] | undefined, errorKey: keyof typeof errors) => {
676
+ const prevCustomValidateErrorAtKey: ErrorSchema<T> | undefined = previousCustomValidateErrors[errorKey];
677
+ if (_isNil(errorAtKey) || (Array.isArray(errorAtKey) && errorAtKey.length === 0)) {
610
678
  delete errors[errorKey];
679
+ } else if (
680
+ isObject(errorAtKey) &&
681
+ isObject(prevCustomValidateErrorAtKey) &&
682
+ Array.isArray(prevCustomValidateErrorAtKey?.__errors)
683
+ ) {
684
+ // if previous customValidate error is an object and has __errors array, filter out the errors previous customValidate errors.
685
+ errors[errorKey] = filterPreviousCustomErrors(errorAtKey.__errors, prevCustomValidateErrorAtKey.__errors);
611
686
  } else if (typeof errorAtKey === 'object' && !Array.isArray(errorAtKey.__errors)) {
612
- filterUndefinedErrors(errorAtKey);
687
+ filterNilOrEmptyErrors(errorAtKey, previousCustomValidateErrors[errorKey]);
613
688
  }
614
689
  });
615
690
  return errors;
616
691
  };
617
- return filterUndefinedErrors(filteredErrors);
692
+ return filterNilOrEmptyErrors(filteredErrors, prevCustomValidateErrors);
618
693
  }
619
694
 
620
695
  /** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the
@@ -630,18 +705,19 @@ export default class Form<
630
705
  */
631
706
  onChange = (formData: T | undefined, newErrorSchema?: ErrorSchema<T>, id?: string) => {
632
707
  const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
633
- const { schemaUtils, schema, retrievedSchema } = this.state;
708
+ const { schemaUtils, schema } = this.state;
634
709
 
710
+ let retrievedSchema = this.state.retrievedSchema;
635
711
  if (isObject(formData) || Array.isArray(formData)) {
636
- const newState = this.getStateFromProps(this.props, formData, retrievedSchema);
712
+ const newState = this.getStateFromProps(this.props, formData);
637
713
  formData = newState.formData;
714
+ retrievedSchema = newState.retrievedSchema;
638
715
  }
639
716
 
640
717
  const mustValidate = !noValidate && liveValidate;
641
718
  let state: Partial<FormState<T, S, F>> = { formData, schema };
642
719
  let newFormData = formData;
643
720
 
644
- let _retrievedSchema: S | undefined;
645
721
  if (omitExtraData === true && liveOmit === true) {
646
722
  newFormData = this.omitExtraData(formData);
647
723
  state = {
@@ -682,12 +758,23 @@ export default class Form<
682
758
  errors: toErrorList(errorSchema),
683
759
  };
684
760
  }
685
- if (_retrievedSchema) {
686
- state.retrievedSchema = _retrievedSchema;
687
- }
688
761
  this.setState(state as FormState<T, S, F>, () => onChange && onChange({ ...this.state, ...state }, id));
689
762
  };
690
763
 
764
+ /**
765
+ * If the retrievedSchema has changed the new retrievedSchema is returned.
766
+ * Otherwise, the old retrievedSchema is returned to persist reference.
767
+ * - This ensures that AJV retrieves the schema from the cache when it has not changed,
768
+ * avoiding the performance cost of recompiling the schema.
769
+ *
770
+ * @param retrievedSchema The new retrieved schema.
771
+ * @returns The new retrieved schema if it has changed, else the old retrieved schema.
772
+ */
773
+ private updateRetrievedSchema(retrievedSchema: S) {
774
+ const isTheSame = deepEquals(retrievedSchema, this.state?.retrievedSchema);
775
+ return isTheSame ? this.state.retrievedSchema : retrievedSchema;
776
+ }
777
+
691
778
  /**
692
779
  * Callback function to handle reset form data.
693
780
  * - Reset all fields with default values.
@@ -774,7 +861,7 @@ export default class Form<
774
861
  if (onSubmit) {
775
862
  onSubmit({ ...this.state, formData: newFormData, status: 'submitted' }, event);
776
863
  }
777
- }
864
+ },
778
865
  );
779
866
  }
780
867
  };
@@ -837,7 +924,7 @@ export default class Form<
837
924
  let field = this.formElement.current.elements[elementId];
838
925
  if (!field) {
839
926
  // if not an exact match, try finding an input starting with the element id (like radio buttons or checkboxes)
840
- field = this.formElement.current.querySelector(`input[id^=${elementId}`);
927
+ field = this.formElement.current.querySelector(`input[id^="${elementId}"`);
841
928
  }
842
929
  if (field && field.length) {
843
930
  // If we got a list with length > 0
@@ -889,7 +976,7 @@ export default class Form<
889
976
  } else {
890
977
  console.error('Form validation failed', errors);
891
978
  }
892
- }
979
+ },
893
980
  );
894
981
  } else if (prevErrors.length > 0) {
895
982
  this.setState({
@@ -934,7 +1021,6 @@ export default class Form<
934
1021
  action,
935
1022
  autoComplete,
936
1023
  enctype,
937
- acceptcharset,
938
1024
  acceptCharset,
939
1025
  noHtml5Validate = false,
940
1026
  disabled,
@@ -948,9 +1034,9 @@ export default class Form<
948
1034
  const registry = this.getRegistry();
949
1035
  const { SchemaField: _SchemaField } = registry.fields;
950
1036
  const { SubmitButton } = registry.templates.ButtonTemplates;
951
- // The `semantic-ui` theme has an `_internalFormWrapper` that take an `as` prop that is the
1037
+ // The `semantic-ui` and `material-ui` themes have `_internalFormWrapper`s that take an `as` prop that is the
952
1038
  // PropTypes.elementType to use for the inner tag, so we'll need to pass `tagName` along if it is provided.
953
- // NOTE, the `as` prop is native to `semantic-ui`
1039
+ // NOTE, the `as` prop is native to `semantic-ui` and is emulated in the `material-ui` theme
954
1040
  const as = _internalFormWrapper ? tagName : undefined;
955
1041
  const FormTag = _internalFormWrapper || tagName || 'form';
956
1042
 
@@ -970,7 +1056,7 @@ export default class Form<
970
1056
  action={action}
971
1057
  autoComplete={autoComplete}
972
1058
  encType={enctype}
973
- acceptCharset={acceptCharset || acceptcharset}
1059
+ acceptCharset={acceptCharset}
974
1060
  noValidate={noHtml5Validate}
975
1061
  onSubmit={this.onSubmit}
976
1062
  as={as}
@@ -0,0 +1,50 @@
1
+ import { ReactElement } from 'react';
2
+ import {
3
+ FormContextType,
4
+ Registry,
5
+ RJSFSchema,
6
+ StrictRJSFSchema,
7
+ UiSchema,
8
+ getTestIds,
9
+ getUiOptions,
10
+ } from '@rjsf/utils';
11
+ import Markdown from 'markdown-to-jsx';
12
+
13
+ const TEST_IDS = getTestIds();
14
+
15
+ export interface RichDescriptionProps<
16
+ T = any,
17
+ S extends StrictRJSFSchema = RJSFSchema,
18
+ F extends FormContextType = any,
19
+ > {
20
+ /** The description text for a field, potentially containing markdown */
21
+ description: string | ReactElement;
22
+ /** The uiSchema object for this base component */
23
+ uiSchema?: UiSchema<T, S, F>;
24
+ /** The `registry` object */
25
+ registry: Registry<T, S, F>;
26
+ }
27
+
28
+ /** Renders the given `description` in the props as
29
+ *
30
+ * @param props - The `RichDescriptionProps` for this component
31
+ */
32
+ export default function RichDescription<
33
+ T = any,
34
+ S extends StrictRJSFSchema = RJSFSchema,
35
+ F extends FormContextType = any,
36
+ >({ description, registry, uiSchema = {} }: RichDescriptionProps<T, S, F>) {
37
+ const { globalUiOptions } = registry;
38
+ const uiOptions = getUiOptions<T, S, F>(uiSchema, globalUiOptions);
39
+
40
+ if (uiOptions.enableMarkdownInDescription && typeof description === 'string') {
41
+ return (
42
+ <Markdown options={{ disableParsingRawHTML: true }} data-testid={TEST_IDS.markdown}>
43
+ {description}
44
+ </Markdown>
45
+ );
46
+ }
47
+ return description;
48
+ }
49
+
50
+ RichDescription.TEST_IDS = TEST_IDS;