@rjsf/utils 5.11.2 → 5.12.0

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 (303) hide show
  1. package/dist/index.js +2544 -5
  2. package/dist/index.js.map +7 -0
  3. package/dist/utils.esm.js +1228 -2113
  4. package/dist/utils.esm.js.map +7 -1
  5. package/dist/utils.umd.js +2414 -0
  6. package/lib/ErrorSchemaBuilder.d.ts +60 -0
  7. package/lib/ErrorSchemaBuilder.js +103 -0
  8. package/lib/ErrorSchemaBuilder.js.map +1 -0
  9. package/lib/allowAdditionalItems.d.ts +8 -0
  10. package/lib/allowAdditionalItems.js +14 -0
  11. package/lib/allowAdditionalItems.js.map +1 -0
  12. package/lib/asNumber.d.ts +10 -0
  13. package/lib/asNumber.js +36 -0
  14. package/lib/asNumber.js.map +1 -0
  15. package/lib/canExpand.d.ts +11 -0
  16. package/lib/canExpand.js +26 -0
  17. package/lib/canExpand.js.map +1 -0
  18. package/lib/constants.d.ts +31 -0
  19. package/lib/constants.js +32 -0
  20. package/lib/constants.js.map +1 -0
  21. package/lib/createErrorHandler.d.ts +7 -0
  22. package/lib/createErrorHandler.js +31 -0
  23. package/lib/createErrorHandler.js.map +1 -0
  24. package/lib/createSchemaUtils.d.ts +10 -0
  25. package/lib/createSchemaUtils.js +207 -0
  26. package/lib/createSchemaUtils.js.map +1 -0
  27. package/lib/dataURItoBlob.d.ts +16 -0
  28. package/lib/dataURItoBlob.js +43 -0
  29. package/lib/dataURItoBlob.js.map +1 -0
  30. package/lib/deepEquals.d.ts +8 -0
  31. package/lib/deepEquals.js +19 -0
  32. package/lib/deepEquals.js.map +1 -0
  33. package/lib/englishStringTranslator.d.ts +10 -0
  34. package/lib/englishStringTranslator.js +13 -0
  35. package/lib/englishStringTranslator.js.map +1 -0
  36. package/lib/enumOptionsDeselectValue.d.ts +14 -0
  37. package/lib/enumOptionsDeselectValue.js +22 -0
  38. package/lib/enumOptionsDeselectValue.js.map +1 -0
  39. package/lib/enumOptionsIndexForValue.d.ts +13 -0
  40. package/lib/enumOptionsIndexForValue.js +22 -0
  41. package/lib/enumOptionsIndexForValue.js.map +1 -0
  42. package/lib/enumOptionsIsSelected.d.ts +8 -0
  43. package/lib/enumOptionsIsSelected.js +14 -0
  44. package/lib/enumOptionsIsSelected.js.map +1 -0
  45. package/lib/enumOptionsSelectValue.d.ts +10 -0
  46. package/lib/enumOptionsSelectValue.js +23 -0
  47. package/lib/enumOptionsSelectValue.js.map +1 -0
  48. package/lib/enumOptionsValueForIndex.d.ts +13 -0
  49. package/lib/enumOptionsValueForIndex.js +21 -0
  50. package/lib/enumOptionsValueForIndex.js.map +1 -0
  51. package/lib/enums.d.ts +72 -0
  52. package/lib/enums.js +76 -0
  53. package/lib/enums.js.map +1 -0
  54. package/lib/findSchemaDefinition.d.ts +20 -0
  55. package/lib/findSchemaDefinition.js +49 -0
  56. package/lib/findSchemaDefinition.js.map +1 -0
  57. package/lib/getDiscriminatorFieldFromSchema.d.ts +8 -0
  58. package/lib/getDiscriminatorFieldFromSchema.js +20 -0
  59. package/lib/getDiscriminatorFieldFromSchema.js.map +1 -0
  60. package/lib/getInputProps.d.ts +10 -0
  61. package/lib/getInputProps.js +41 -0
  62. package/lib/getInputProps.js.map +1 -0
  63. package/lib/getSchemaType.d.ts +13 -0
  64. package/lib/getSchemaType.js +29 -0
  65. package/lib/getSchemaType.js.map +1 -0
  66. package/lib/getSubmitButtonOptions.d.ts +10 -0
  67. package/lib/getSubmitButtonOptions.js +25 -0
  68. package/lib/getSubmitButtonOptions.js.map +1 -0
  69. package/lib/getTemplate.d.ts +10 -0
  70. package/lib/getTemplate.js +19 -0
  71. package/lib/getTemplate.js.map +1 -0
  72. package/lib/getUiOptions.d.ts +9 -0
  73. package/lib/getUiOptions.js +25 -0
  74. package/lib/getUiOptions.js.map +1 -0
  75. package/lib/getWidget.d.ts +13 -0
  76. package/lib/getWidget.js +118 -0
  77. package/lib/getWidget.js.map +1 -0
  78. package/lib/guessType.d.ts +7 -0
  79. package/lib/guessType.js +29 -0
  80. package/lib/guessType.js.map +1 -0
  81. package/lib/hasWidget.d.ts +10 -0
  82. package/lib/hasWidget.js +23 -0
  83. package/lib/hasWidget.js.map +1 -0
  84. package/lib/hashForSchema.d.ts +8 -0
  85. package/lib/hashForSchema.js +29 -0
  86. package/lib/hashForSchema.js.map +1 -0
  87. package/lib/idGenerators.d.ts +47 -0
  88. package/lib/idGenerators.js +73 -0
  89. package/lib/idGenerators.js.map +1 -0
  90. package/lib/index.d.ts +57 -0
  91. package/lib/index.js +58 -0
  92. package/lib/index.js.map +1 -0
  93. package/lib/isConstant.d.ts +8 -0
  94. package/lib/isConstant.js +11 -0
  95. package/lib/isConstant.js.map +1 -0
  96. package/lib/isCustomWidget.d.ts +7 -0
  97. package/lib/isCustomWidget.js +13 -0
  98. package/lib/isCustomWidget.js.map +1 -0
  99. package/lib/isFixedItems.d.ts +8 -0
  100. package/lib/isFixedItems.js +11 -0
  101. package/lib/isFixedItems.js.map +1 -0
  102. package/lib/isObject.d.ts +7 -0
  103. package/lib/isObject.js +16 -0
  104. package/lib/isObject.js.map +1 -0
  105. package/lib/labelValue.d.ts +13 -0
  106. package/lib/labelValue.js +4 -0
  107. package/lib/labelValue.js.map +1 -0
  108. package/lib/localToUTC.d.ts +6 -0
  109. package/lib/localToUTC.js +9 -0
  110. package/lib/localToUTC.js.map +1 -0
  111. package/lib/mergeDefaultsWithFormData.d.ts +17 -0
  112. package/lib/mergeDefaultsWithFormData.js +43 -0
  113. package/lib/mergeDefaultsWithFormData.js.map +1 -0
  114. package/lib/mergeObjects.d.ts +11 -0
  115. package/lib/mergeObjects.js +35 -0
  116. package/lib/mergeObjects.js.map +1 -0
  117. package/lib/mergeSchemas.d.ts +10 -0
  118. package/lib/mergeSchemas.js +35 -0
  119. package/lib/mergeSchemas.js.map +1 -0
  120. package/lib/optionsList.d.ts +10 -0
  121. package/lib/optionsList.js +36 -0
  122. package/lib/optionsList.js.map +1 -0
  123. package/lib/orderProperties.d.ts +11 -0
  124. package/lib/orderProperties.js +38 -0
  125. package/lib/orderProperties.js.map +1 -0
  126. package/lib/pad.d.ts +7 -0
  127. package/lib/pad.js +14 -0
  128. package/lib/pad.js.map +1 -0
  129. package/lib/parseDateString.d.ts +9 -0
  130. package/lib/parseDateString.js +32 -0
  131. package/lib/parseDateString.js.map +1 -0
  132. package/lib/parser/ParserValidator.d.ts +70 -0
  133. package/lib/parser/ParserValidator.js +93 -0
  134. package/lib/parser/ParserValidator.js.map +1 -0
  135. package/lib/parser/index.d.ts +4 -0
  136. package/lib/parser/index.js +3 -0
  137. package/lib/parser/index.js.map +1 -0
  138. package/lib/parser/schemaParser.d.ts +9 -0
  139. package/lib/parser/schemaParser.js +48 -0
  140. package/lib/parser/schemaParser.js.map +1 -0
  141. package/lib/rangeSpec.d.ts +9 -0
  142. package/lib/rangeSpec.js +20 -0
  143. package/lib/rangeSpec.js.map +1 -0
  144. package/lib/replaceStringParameters.d.ts +9 -0
  145. package/lib/replaceStringParameters.js +23 -0
  146. package/lib/replaceStringParameters.js.map +1 -0
  147. package/lib/schema/getClosestMatchingOption.d.ts +49 -0
  148. package/lib/schema/getClosestMatchingOption.js +154 -0
  149. package/lib/schema/getClosestMatchingOption.js.map +1 -0
  150. package/lib/schema/getDefaultFormState.d.ts +66 -0
  151. package/lib/schema/getDefaultFormState.js +351 -0
  152. package/lib/schema/getDefaultFormState.js.map +1 -0
  153. package/lib/schema/getDisplayLabel.d.ts +12 -0
  154. package/lib/schema/getDisplayLabel.js +39 -0
  155. package/lib/schema/getDisplayLabel.js.map +1 -0
  156. package/lib/schema/getFirstMatchingOption.d.ts +13 -0
  157. package/lib/schema/getFirstMatchingOption.js +16 -0
  158. package/lib/schema/getFirstMatchingOption.js.map +1 -0
  159. package/lib/schema/getMatchingOption.d.ts +14 -0
  160. package/lib/schema/getMatchingOption.js +80 -0
  161. package/lib/schema/getMatchingOption.js.map +1 -0
  162. package/lib/schema/index.d.ts +14 -0
  163. package/lib/schema/index.js +15 -0
  164. package/lib/schema/index.js.map +1 -0
  165. package/lib/schema/isFilesArray.d.ts +10 -0
  166. package/lib/schema/isFilesArray.js +21 -0
  167. package/lib/schema/isFilesArray.js.map +1 -0
  168. package/lib/schema/isMultiSelect.d.ts +9 -0
  169. package/lib/schema/isMultiSelect.js +15 -0
  170. package/lib/schema/isMultiSelect.js.map +1 -0
  171. package/lib/schema/isSelect.d.ts +9 -0
  172. package/lib/schema/isSelect.js +21 -0
  173. package/lib/schema/isSelect.js.map +1 -0
  174. package/lib/schema/mergeValidationData.d.ts +14 -0
  175. package/lib/schema/mergeValidationData.js +28 -0
  176. package/lib/schema/mergeValidationData.js.map +1 -0
  177. package/lib/schema/retrieveSchema.d.ts +170 -0
  178. package/lib/schema/retrieveSchema.js +437 -0
  179. package/lib/schema/retrieveSchema.js.map +1 -0
  180. package/lib/schema/sanitizeDataForNewSchema.d.ts +49 -0
  181. package/lib/schema/sanitizeDataForNewSchema.js +173 -0
  182. package/lib/schema/sanitizeDataForNewSchema.js.map +1 -0
  183. package/lib/schema/toIdSchema.d.ts +13 -0
  184. package/lib/schema/toIdSchema.js +59 -0
  185. package/lib/schema/toIdSchema.js.map +1 -0
  186. package/lib/schema/toPathSchema.d.ts +11 -0
  187. package/lib/schema/toPathSchema.js +68 -0
  188. package/lib/schema/toPathSchema.js.map +1 -0
  189. package/lib/schemaRequiresTrueValue.d.ts +11 -0
  190. package/lib/schemaRequiresTrueValue.js +34 -0
  191. package/lib/schemaRequiresTrueValue.js.map +1 -0
  192. package/lib/shouldRender.d.ts +10 -0
  193. package/lib/shouldRender.js +14 -0
  194. package/lib/shouldRender.js.map +1 -0
  195. package/lib/toConstant.d.ts +9 -0
  196. package/lib/toConstant.js +18 -0
  197. package/lib/toConstant.js.map +1 -0
  198. package/lib/toDateString.d.ts +9 -0
  199. package/lib/toDateString.js +14 -0
  200. package/lib/toDateString.js.map +1 -0
  201. package/lib/toErrorList.d.ts +8 -0
  202. package/lib/toErrorList.js +34 -0
  203. package/lib/toErrorList.js.map +1 -0
  204. package/lib/toErrorSchema.d.ts +21 -0
  205. package/lib/toErrorSchema.js +41 -0
  206. package/lib/toErrorSchema.js.map +1 -0
  207. package/lib/types.d.ts +982 -0
  208. package/lib/types.js +2 -0
  209. package/lib/types.js.map +1 -0
  210. package/lib/unwrapErrorHandler.d.ts +7 -0
  211. package/lib/unwrapErrorHandler.js +21 -0
  212. package/lib/unwrapErrorHandler.js.map +1 -0
  213. package/lib/utcToLocal.d.ts +6 -0
  214. package/lib/utcToLocal.js +26 -0
  215. package/lib/utcToLocal.js.map +1 -0
  216. package/lib/validationDataMerge.d.ts +11 -0
  217. package/lib/validationDataMerge.js +26 -0
  218. package/lib/validationDataMerge.js.map +1 -0
  219. package/lib/withIdRefPrefix.d.ts +8 -0
  220. package/lib/withIdRefPrefix.js +47 -0
  221. package/lib/withIdRefPrefix.js.map +1 -0
  222. package/package.json +20 -13
  223. package/src/ErrorSchemaBuilder.ts +112 -0
  224. package/src/allowAdditionalItems.ts +15 -0
  225. package/src/asNumber.ts +38 -0
  226. package/src/canExpand.ts +31 -0
  227. package/src/constants.ts +31 -0
  228. package/src/createErrorHandler.ts +33 -0
  229. package/src/createSchemaUtils.ts +298 -0
  230. package/src/dataURItoBlob.ts +42 -0
  231. package/src/deepEquals.ts +19 -0
  232. package/src/englishStringTranslator.ts +14 -0
  233. package/src/enumOptionsDeselectValue.ts +28 -0
  234. package/src/enumOptionsIndexForValue.ts +27 -0
  235. package/src/enumOptionsIsSelected.ts +19 -0
  236. package/src/enumOptionsSelectValue.ts +28 -0
  237. package/src/enumOptionsValueForIndex.ts +26 -0
  238. package/src/enums.ts +74 -0
  239. package/src/findSchemaDefinition.ts +54 -0
  240. package/src/getDiscriminatorFieldFromSchema.ts +21 -0
  241. package/src/getInputProps.ts +55 -0
  242. package/src/getSchemaType.ts +37 -0
  243. package/src/getSubmitButtonOptions.ts +32 -0
  244. package/src/getTemplate.ts +26 -0
  245. package/src/getUiOptions.ts +32 -0
  246. package/src/getWidget.tsx +133 -0
  247. package/src/guessType.ts +28 -0
  248. package/src/hasWidget.ts +27 -0
  249. package/src/hashForSchema.ts +31 -0
  250. package/src/idGenerators.ts +81 -0
  251. package/src/index.ts +118 -0
  252. package/src/isConstant.ts +12 -0
  253. package/src/isCustomWidget.ts +19 -0
  254. package/src/isFixedItems.ts +12 -0
  255. package/src/isObject.ts +15 -0
  256. package/src/labelValue.ts +16 -0
  257. package/src/localToUTC.ts +8 -0
  258. package/src/mergeDefaultsWithFormData.ts +53 -0
  259. package/src/mergeObjects.ts +39 -0
  260. package/src/mergeSchemas.ts +38 -0
  261. package/src/optionsList.ts +41 -0
  262. package/src/orderProperties.ts +44 -0
  263. package/src/pad.ts +13 -0
  264. package/src/parseDateString.ts +33 -0
  265. package/src/parser/ParserValidator.ts +132 -0
  266. package/src/parser/index.ts +6 -0
  267. package/src/parser/schemaParser.ts +60 -0
  268. package/src/rangeSpec.ts +22 -0
  269. package/src/replaceStringParameters.ts +22 -0
  270. package/src/schema/getClosestMatchingOption.ts +191 -0
  271. package/src/schema/getDefaultFormState.ts +447 -0
  272. package/src/schema/getDisplayLabel.ts +59 -0
  273. package/src/schema/getFirstMatchingOption.ts +27 -0
  274. package/src/schema/getMatchingOption.ts +95 -0
  275. package/src/schema/index.ts +29 -0
  276. package/src/schema/isFilesArray.ts +27 -0
  277. package/src/schema/isMultiSelect.ts +21 -0
  278. package/src/schema/isSelect.ts +26 -0
  279. package/src/schema/mergeValidationData.ts +38 -0
  280. package/src/schema/retrieveSchema.ts +614 -0
  281. package/src/schema/sanitizeDataForNewSchema.ts +197 -0
  282. package/src/schema/toIdSchema.ts +105 -0
  283. package/src/schema/toPathSchema.ts +121 -0
  284. package/src/schemaRequiresTrueValue.ts +40 -0
  285. package/src/shouldRender.ts +16 -0
  286. package/src/toConstant.ts +19 -0
  287. package/src/toDateString.ts +15 -0
  288. package/src/toErrorList.ts +41 -0
  289. package/src/toErrorSchema.ts +43 -0
  290. package/src/types.ts +1139 -0
  291. package/src/unwrapErrorHandler.ts +25 -0
  292. package/src/utcToLocal.ts +30 -0
  293. package/src/validationDataMerge.ts +31 -0
  294. package/src/withIdRefPrefix.ts +49 -0
  295. package/dist/index.d.ts +0 -1911
  296. package/dist/utils.cjs.development.js +0 -3522
  297. package/dist/utils.cjs.development.js.map +0 -1
  298. package/dist/utils.cjs.production.min.js +0 -2
  299. package/dist/utils.cjs.production.min.js.map +0 -1
  300. package/dist/utils.umd.development.js +0 -3504
  301. package/dist/utils.umd.development.js.map +0 -1
  302. package/dist/utils.umd.production.min.js +0 -2
  303. package/dist/utils.umd.production.min.js.map +0 -1
package/src/types.ts ADDED
@@ -0,0 +1,1139 @@
1
+ import type {
2
+ ButtonHTMLAttributes,
3
+ ChangeEvent,
4
+ ComponentType,
5
+ HTMLAttributes,
6
+ ReactElement,
7
+ ReactNode,
8
+ StyleHTMLAttributes,
9
+ } from 'react';
10
+ import { JSONSchema7 } from 'json-schema';
11
+
12
+ import { TranslatableString } from './enums';
13
+
14
+ /** The representation of any generic object type, usually used as an intersection on other types to make them more
15
+ * flexible in the properties they support (i.e. anything else)
16
+ */
17
+ export type GenericObjectType = {
18
+ [name: string]: any;
19
+ };
20
+
21
+ /** Map the JSONSchema7 to our own type so that we can easily bump to a more recent version at some future date and only
22
+ * have to update this one type.
23
+ */
24
+ export type StrictRJSFSchema = JSONSchema7;
25
+
26
+ /** Allow for more flexible schemas (i.e. draft-2019) than the strict JSONSchema7
27
+ */
28
+ export type RJSFSchema = StrictRJSFSchema & GenericObjectType;
29
+
30
+ /** Alias GenericObjectType as FormContextType to allow us to remap this at some future date
31
+ */
32
+ export type FormContextType = GenericObjectType;
33
+
34
+ /** Experimental feature that specifies the Array `minItems` default form state behavior
35
+ */
36
+ export type Experimental_ArrayMinItems = {
37
+ /** Optional enumerated flag controlling how array minItems are populated, defaulting to `all`:
38
+ * - `all`: Legacy behavior, populate minItems entries with default values initially and include an empty array when
39
+ * no values have been defined.
40
+ * - `requiredOnly`: Ignore `minItems` on a field when calculating defaults unless the field is required.
41
+ * - `never`: Ignore `minItems` on a field even the field is required.
42
+ */
43
+ populate?: 'all' | 'requiredOnly' | 'never';
44
+ /** When `formData` is provided and does not contain `minItems` worth of data, this flag (`false` by default) controls
45
+ * whether the extra data provided by the defaults is appended onto the existing `formData` items to ensure the
46
+ * `minItems` condition is met. When false (legacy behavior), only the `formData` provided is merged into the default
47
+ * form state, even if there are fewer than the `minItems`. When true, the defaults are appended onto the end of the
48
+ * `formData` until the `minItems` condition is met.
49
+ */
50
+ mergeExtraDefaults?: boolean;
51
+ };
52
+
53
+ /** Experimental features to specify different default form state behaviors. Currently, this affects the
54
+ * handling of optional array fields where `minItems` is set and handling of setting defaults based on the
55
+ * value of `emptyObjectFields`.
56
+ */
57
+ export type Experimental_DefaultFormStateBehavior = {
58
+ /** Optional object, that controls how the default form state for arrays with `minItems` is handled. When not provided
59
+ * it defaults to `{ populate: 'all' }`.
60
+ */
61
+ arrayMinItems?: Experimental_ArrayMinItems;
62
+ /** Optional enumerated flag controlling how empty object fields are populated, defaulting to `populateAllDefaults`:
63
+ * - `populateAllDefaults`: Legacy behavior - set default when there is a primitive value, an non-empty object field,
64
+ * or the field itself is required |
65
+ * - `populateRequiredDefaults`: Only sets default when a value is an object and its parent field is required, or it
66
+ * is a primitive value and it is required |
67
+ * - `skipDefaults`: Does not set defaults |
68
+ */
69
+ emptyObjectFields?: 'populateAllDefaults' | 'populateRequiredDefaults' | 'skipDefaults';
70
+ };
71
+
72
+ /** The interface representing a Date object that contains an optional time */
73
+ export interface DateObject {
74
+ /** The year of the Date */
75
+ year: number;
76
+ /** The month of the Date */
77
+ month: number;
78
+ /** The day of the Date */
79
+ day: number;
80
+ /** The optional hours for the time of a Date */
81
+ hour?: number;
82
+ /** The optional minutes for the time of a Date */
83
+ minute?: number;
84
+ /** The optional seconds for the time of a Date */
85
+ second?: number;
86
+ }
87
+
88
+ /** Properties describing a Range specification in terms of attribute that can be added to the `HTML` `<input>` */
89
+ export type RangeSpecType = {
90
+ /** Specifies the interval between legal numbers in an input field */
91
+ step?: number;
92
+ /** Specifies a minimum value for an <input> element */
93
+ min?: number;
94
+ /** Specifies the maximum value for an <input> element */
95
+ max?: number;
96
+ };
97
+
98
+ /** Properties describing a Range specification in terms of attribute that can be added to the `HTML` `<input>` */
99
+ export type InputPropsType = Omit<RangeSpecType, 'step'> & {
100
+ /** Specifies the type of the <input> element */
101
+ type: string;
102
+ /** Specifies the interval between legal numbers in an input field or "any" */
103
+ step?: number | 'any';
104
+ /** Specifies the `autoComplete` value for an <input> element */
105
+ autoComplete?: HTMLInputElement['autocomplete'];
106
+ };
107
+
108
+ /** Type describing an id used for a field in the `IdSchema` */
109
+ export type FieldId = {
110
+ /** The id for a field */
111
+ $id: string;
112
+ };
113
+
114
+ /** Type describing a recursive structure of `FieldId`s for an object with a non-empty set of keys */
115
+ export type IdSchema<T = any> = FieldId & {
116
+ /** The set of ids for fields in the recursive object structure */
117
+ [key in keyof T]?: IdSchema<T[key]>;
118
+ };
119
+
120
+ /** Type describing a name used for a field in the `PathSchema` */
121
+ export type FieldPath = {
122
+ /** The name of a field */
123
+ $name: string;
124
+ };
125
+
126
+ /** Type describing a recursive structure of `FieldPath`s for an object with a non-empty set of keys */
127
+ export type PathSchema<T = any> = FieldPath & {
128
+ /** The set of names for fields in the recursive object structure */
129
+ [key in keyof T]?: PathSchema<T[key]>;
130
+ };
131
+
132
+ /** The type for error produced by RJSF schema validation */
133
+ export type RJSFValidationError = {
134
+ /** Name of the error, for example, "required" or "minLength" */
135
+ name?: string;
136
+ /** Message, for example, "is a required property" or "should NOT be shorter than 3 characters" */
137
+ message?: string;
138
+ /** An object with the error params returned by ajv
139
+ * ([see doc](https://github.com/ajv-validator/ajv/tree/6a671057ea6aae690b5967ee26a0ddf8452c6297#error-parameters)
140
+ * for more info)
141
+ */
142
+ params?: any;
143
+ /** A string in Javascript property accessor notation to the data path of the field with the error. For example,
144
+ * `.name` or `['first-name']`
145
+ */
146
+ property?: string;
147
+ /** JSON pointer to the schema of the keyword that failed validation. For example, `#/fields/firstName/required`.
148
+ * (Note: this may sometimes be wrong due to a [bug in ajv](https://github.com/ajv-validator/ajv/issues/512))
149
+ */
150
+ schemaPath?: string;
151
+ /** Full error name, for example ".name is a required property" */
152
+ stack: string;
153
+ };
154
+
155
+ /** The type that describes an error in a field */
156
+ export type FieldError = string;
157
+
158
+ /** The type that describes the list of errors for a field */
159
+ export type FieldErrors = {
160
+ /** The list of errors for the field */
161
+ __errors?: FieldError[];
162
+ };
163
+
164
+ /** Type describing a recursive structure of `FieldErrors`s for an object with a non-empty set of keys */
165
+ export type ErrorSchema<T = any> = FieldErrors & {
166
+ /** The set of errors for fields in the recursive object structure */
167
+ [key in keyof T]?: ErrorSchema<T[key]>;
168
+ };
169
+
170
+ /** Type that describes the list of errors for a field being actively validated by a custom validator */
171
+ export type FieldValidation = FieldErrors & {
172
+ /** Function that will add a new `message` to the list of errors */
173
+ addError: (message: string) => void;
174
+ };
175
+
176
+ /** Type describing a recursive structure of `FieldValidation`s for an object with a non-empty set of keys */
177
+ export type FormValidation<T = any> = FieldValidation & {
178
+ /** The set of validation objects for fields in the recursive object structure */
179
+ [key in keyof T]?: FormValidation<T[key]>;
180
+ };
181
+
182
+ /** The properties that are passed to an `ErrorListTemplate` implementation */
183
+ export type ErrorListProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
184
+ /** The errorSchema constructed by `Form` */
185
+ errorSchema: ErrorSchema<T>;
186
+ /** An array of the errors */
187
+ errors: RJSFValidationError[];
188
+ /** The `formContext` object that was passed to `Form` */
189
+ formContext?: F;
190
+ /** The schema that was passed to `Form` */
191
+ schema: S;
192
+ /** The uiSchema that was passed to `Form` */
193
+ uiSchema?: UiSchema<T, S, F>;
194
+ /** The `registry` object */
195
+ registry: Registry<T, S, F>;
196
+ };
197
+
198
+ /** The properties that are passed to an `FieldErrorTemplate` implementation */
199
+ export type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
200
+ /** The errorSchema constructed by `Form` */
201
+ errorSchema?: ErrorSchema<T>;
202
+ /** An array of the errors */
203
+ errors?: Array<string | ReactElement>;
204
+ /** The tree of unique ids for every child field */
205
+ idSchema: IdSchema<T>;
206
+ /** The schema that was passed to field */
207
+ schema: S;
208
+ /** The uiSchema that was passed to field */
209
+ uiSchema?: UiSchema<T, S, F>;
210
+ /** The `registry` object */
211
+ registry: Registry<T, S, F>;
212
+ };
213
+
214
+ /** The properties that are passed to an `FieldHelpTemplate` implementation */
215
+ export type FieldHelpProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
216
+ /** The help information to be rendered */
217
+ help?: string | ReactElement;
218
+ /** The tree of unique ids for every child field */
219
+ idSchema: IdSchema<T>;
220
+ /** The schema that was passed to field */
221
+ schema: S;
222
+ /** The uiSchema that was passed to field */
223
+ uiSchema?: UiSchema<T, S, F>;
224
+ /** Flag indicating whether there are errors associated with this field */
225
+ hasErrors?: boolean;
226
+ /** The `registry` object */
227
+ registry: Registry<T, S, F>;
228
+ };
229
+
230
+ /** The set of `Fields` stored in the `Registry` */
231
+ export type RegistryFieldsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
232
+ /** A `Field` indexed by `name` */
233
+ [name: string]: Field<T, S, F>;
234
+ };
235
+
236
+ /** The set of `Widgets` stored in the `Registry` */
237
+ export type RegistryWidgetsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
238
+ /** A `Widget` indexed by `name` */
239
+ [name: string]: Widget<T, S, F>;
240
+ };
241
+
242
+ /** The set of RJSF templates that can be overridden by themes or users */
243
+ export interface TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
244
+ /** The template to use while rendering normal or fixed array fields */
245
+ ArrayFieldTemplate: ComponentType<ArrayFieldTemplateProps<T, S, F>>;
246
+ /** The template to use while rendering the description for an array field */
247
+ ArrayFieldDescriptionTemplate: ComponentType<ArrayFieldDescriptionProps<T, S, F>>;
248
+ /** The template to use while rendering an item in an array field */
249
+ ArrayFieldItemTemplate: ComponentType<ArrayFieldTemplateItemType<T, S, F>>;
250
+ /** The template to use while rendering the title for an array field */
251
+ ArrayFieldTitleTemplate: ComponentType<ArrayFieldTitleProps<T, S, F>>;
252
+ /** The template to use while rendering the standard html input */
253
+ BaseInputTemplate: ComponentType<BaseInputTemplateProps<T, S, F>>;
254
+ /** The template to use for rendering the description of a field */
255
+ DescriptionFieldTemplate: ComponentType<DescriptionFieldProps<T, S, F>>;
256
+ /** The template to use while rendering the errors for the whole form */
257
+ ErrorListTemplate: ComponentType<ErrorListProps<T, S, F>>;
258
+ /** The template to use while rendering the errors for a single field */
259
+ FieldErrorTemplate: ComponentType<FieldErrorProps<T, S, F>>;
260
+ /** The template to use while rendering the errors for a single field */
261
+ FieldHelpTemplate: ComponentType<FieldHelpProps<T, S, F>>;
262
+ /** The template to use while rendering a field */
263
+ FieldTemplate: ComponentType<FieldTemplateProps<T, S, F>>;
264
+ /** The template to use while rendering an object */
265
+ ObjectFieldTemplate: ComponentType<ObjectFieldTemplateProps<T, S, F>>;
266
+ /** The template to use for rendering the title of a field */
267
+ TitleFieldTemplate: ComponentType<TitleFieldProps<T, S, F>>;
268
+ /** The template to use for rendering information about an unsupported field type in the schema */
269
+ UnsupportedFieldTemplate: ComponentType<UnsupportedFieldProps<T, S, F>>;
270
+ /** The template to use for rendering a field that allows a user to add additional properties */
271
+ WrapIfAdditionalTemplate: ComponentType<WrapIfAdditionalTemplateProps<T, S, F>>;
272
+ /** The set of templates associated with buttons in the form */
273
+ ButtonTemplates: {
274
+ /** The template to use for the main `Submit` button */
275
+ SubmitButton: ComponentType<SubmitButtonProps<T, S, F>>;
276
+ /** The template to use for the Add button used for AdditionalProperties and Array items */
277
+ AddButton: ComponentType<IconButtonProps<T, S, F>>;
278
+ /** The template to use for the Copy button used for Array items */
279
+ CopyButton: ComponentType<IconButtonProps<T, S, F>>;
280
+ /** The template to use for the Move Down button used for Array items */
281
+ MoveDownButton: ComponentType<IconButtonProps<T, S, F>>;
282
+ /** The template to use for the Move Up button used for Array items */
283
+ MoveUpButton: ComponentType<IconButtonProps<T, S, F>>;
284
+ /** The template to use for the Remove button used for AdditionalProperties and Array items */
285
+ RemoveButton: ComponentType<IconButtonProps<T, S, F>>;
286
+ };
287
+ }
288
+
289
+ /** The set of UiSchema options that can be set globally and used as fallbacks at an individual template, field or
290
+ * widget level when no field-level value of the option is provided.
291
+ */
292
+ export type GlobalUISchemaOptions = {
293
+ /** Flag, if set to `false`, new items cannot be added to array fields, unless overridden (defaults to true) */
294
+ addable?: boolean;
295
+ /** Flag, if set to `true`, array items can be copied (defaults to false) */
296
+ copyable?: boolean;
297
+ /** Flag, if set to `false`, array items cannot be ordered (defaults to true) */
298
+ orderable?: boolean;
299
+ /** Flag, if set to `false`, array items will not be removable (defaults to true) */
300
+ removable?: boolean;
301
+ /** Field labels are rendered by default. Labels may be omitted by setting the `label` option to `false` */
302
+ label?: boolean;
303
+ /** When using `additionalProperties`, key collision is prevented by appending a unique integer to the duplicate key.
304
+ * This option allows you to change the separator between the original key name and the integer. Default is "-"
305
+ */
306
+ duplicateKeySuffixSeparator?: string;
307
+ };
308
+
309
+ /** The object containing the registered core, theme and custom fields and widgets as well as the root schema, form
310
+ * context, schema utils and templates.
311
+ */
312
+ export interface Registry<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
313
+ /** The set of all fields used by the `Form`. Includes fields from `core`, theme-specific fields and any custom
314
+ * registered fields
315
+ */
316
+ fields: RegistryFieldsType<T, S, F>;
317
+ /** The set of templates used by the `Form`. Includes templates from `core`, theme-specific fields and any custom
318
+ * registered templates
319
+ */
320
+ templates: TemplatesType<T, S, F>;
321
+ /** The set of all widgets used by the `Form`. Includes widgets from `core`, theme-specific widgets and any custom
322
+ * registered widgets
323
+ */
324
+ widgets: RegistryWidgetsType<T, S, F>;
325
+ /** The `formContext` object that was passed to `Form` */
326
+ formContext: F;
327
+ /** The root schema, as passed to the `Form`, which can contain referenced definitions */
328
+ rootSchema: S;
329
+ /** The current implementation of the `SchemaUtilsType` (from `@rjsf/utils`) in use by the `Form`. Used to call any
330
+ * of the validation-schema-based utility functions
331
+ */
332
+ schemaUtils: SchemaUtilsType<T, S>;
333
+ /** The string translation function to use when displaying any of the RJSF strings in templates, fields or widgets */
334
+ translateString: (stringKey: TranslatableString, params?: string[]) => string;
335
+ /** The optional global UI Options that are available for all templates, fields and widgets to access */
336
+ globalUiOptions?: GlobalUISchemaOptions;
337
+ }
338
+
339
+ /** The properties that are passed to a Field implementation */
340
+ export interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>
341
+ extends GenericObjectType,
342
+ Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus' | 'onChange'>> {
343
+ /** The JSON subschema object for this field */
344
+ schema: S;
345
+ /** The uiSchema for this field */
346
+ uiSchema?: UiSchema<T, S, F>;
347
+ /** The tree of unique ids for every child field */
348
+ idSchema: IdSchema<T>;
349
+ /** The data for this field */
350
+ formData?: T;
351
+ /** The tree of errors for this field and its children */
352
+ errorSchema?: ErrorSchema<T>;
353
+ /** The field change event handler; called with the updated form data and an optional `ErrorSchema` */
354
+ onChange: (newFormData: T | undefined, es?: ErrorSchema<T>, id?: string) => any;
355
+ /** The input blur event handler; call it with the field id and value */
356
+ onBlur: (id: string, value: any) => void;
357
+ /** The input focus event handler; call it with the field id and value */
358
+ onFocus: (id: string, value: any) => void;
359
+ /** The `formContext` object that you passed to `Form` */
360
+ formContext?: F;
361
+ /** A boolean value stating if the field should autofocus */
362
+ autofocus?: boolean;
363
+ /** A boolean value stating if the field is disabled */
364
+ disabled: boolean;
365
+ /** A boolean value stating if the field is hiding its errors */
366
+ hideError?: boolean;
367
+ /** A boolean value stating if the field is read-only */
368
+ readonly: boolean;
369
+ /** The required status of this field */
370
+ required?: boolean;
371
+ /** The unique name of the field, usually derived from the name of the property in the JSONSchema */
372
+ name: string;
373
+ /** To avoid collisions with existing ids in the DOM, it is possible to change the prefix used for ids;
374
+ * Default is `root`
375
+ */
376
+ idPrefix?: string;
377
+ /** To avoid using a path separator that is present in field names, it is possible to change the separator used for
378
+ * ids (Default is `_`)
379
+ */
380
+ idSeparator?: string;
381
+ /** An array of strings listing all generated error messages from encountered errors for this field */
382
+ rawErrors?: string[];
383
+ /** The `registry` object */
384
+ registry: Registry<T, S, F>;
385
+ }
386
+
387
+ /** The definition of a React-based Field component */
388
+ export type Field<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<
389
+ FieldProps<T, S, F>
390
+ >;
391
+
392
+ /** The properties that are passed to a FieldTemplate implementation */
393
+ export type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
394
+ /** The id of the field in the hierarchy. You can use it to render a label targeting the wrapped widget */
395
+ id: string;
396
+ /** A string containing the base CSS classes, merged with any custom ones defined in your uiSchema */
397
+ classNames?: string;
398
+ /** An object containing the style as defined in the `uiSchema` */
399
+ style?: StyleHTMLAttributes<any>;
400
+ /** The computed label for this field, as a string */
401
+ label: string;
402
+ /** A component instance rendering the field description, if one is defined (this will use any custom
403
+ * `DescriptionField` defined)
404
+ */
405
+ description?: ReactElement;
406
+ /** A string containing any `ui:description` uiSchema directive defined */
407
+ rawDescription?: string;
408
+ /** The field or widget component instance for this field row */
409
+ children: ReactElement;
410
+ /** A component instance listing any encountered errors for this field */
411
+ errors?: ReactElement;
412
+ /** An array of strings listing all generated error messages from encountered errors for this field */
413
+ rawErrors?: string[];
414
+ /** A component instance rendering any `ui:help` uiSchema directive defined */
415
+ help?: ReactElement;
416
+ /** A string containing any `ui:help` uiSchema directive defined. **NOTE:** `rawHelp` will be `undefined` if passed
417
+ * `ui:help` is a React component instead of a string
418
+ */
419
+ rawHelp?: string;
420
+ /** A boolean value stating if the field should be hidden */
421
+ hidden?: boolean;
422
+ /** A boolean value stating if the field is required */
423
+ required?: boolean;
424
+ /** A boolean value stating if the field is read-only */
425
+ readonly: boolean;
426
+ /** A boolean value stating if the field is hiding its errors */
427
+ hideError?: boolean;
428
+ /** A boolean value stating if the field is disabled */
429
+ disabled: boolean;
430
+ /** A boolean value stating if the label should be rendered or not. This is useful for nested fields in arrays where
431
+ * you don't want to clutter the UI
432
+ */
433
+ displayLabel?: boolean;
434
+ /** The schema object for this field */
435
+ schema: S;
436
+ /** The uiSchema object for this field */
437
+ uiSchema?: UiSchema<T, S, F>;
438
+ /** The `formContext` object that was passed to `Form` */
439
+ formContext?: F;
440
+ /** The formData for this field */
441
+ formData?: T;
442
+ /** The value change event handler; Can be called with a new value to change the value for this field */
443
+ onChange: FieldProps['onChange'];
444
+ /** The key change event handler; Called when the key associated with a field is changed for an additionalProperty */
445
+ onKeyChange: (value: string) => () => void;
446
+ /** The property drop/removal event handler; Called when a field is removed in an additionalProperty context */
447
+ onDropPropertyClick: (value: string) => () => void;
448
+ /** The `registry` object */
449
+ registry: Registry<T, S, F>;
450
+ };
451
+
452
+ /** The properties that are passed to the `UnsupportedFieldTemplate` implementation */
453
+ export type UnsupportedFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
454
+ /** The schema object for this field */
455
+ schema: S;
456
+ /** The tree of unique ids for every child field */
457
+ idSchema?: IdSchema<T>;
458
+ /** The reason why the schema field has an unsupported type */
459
+ reason: string;
460
+ /** The `registry` object */
461
+ registry: Registry<T, S, F>;
462
+ };
463
+
464
+ /** The properties that are passed to a `TitleFieldTemplate` implementation */
465
+ export type TitleFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
466
+ /** The id of the field title in the hierarchy */
467
+ id: string;
468
+ /** The title for the field being rendered */
469
+ title: string;
470
+ /** The schema object for the field being titled */
471
+ schema: S;
472
+ /** The uiSchema object for this title field */
473
+ uiSchema?: UiSchema<T, S, F>;
474
+ /** A boolean value stating if the field is required */
475
+ required?: boolean;
476
+ /** The `registry` object */
477
+ registry: Registry<T, S, F>;
478
+ };
479
+
480
+ /** The properties that are passed to a `DescriptionFieldTemplate` implementation */
481
+ export type DescriptionFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
482
+ /** The id of the field description in the hierarchy */
483
+ id: string;
484
+ /** The schema object for the field being described */
485
+ schema: S;
486
+ /** The uiSchema object for this description field */
487
+ uiSchema?: UiSchema<T, S, F>;
488
+ /** The description of the field being rendered */
489
+ description: string | ReactElement;
490
+ /** The `registry` object */
491
+ registry: Registry<T, S, F>;
492
+ };
493
+
494
+ /** The properties that are passed to a `ArrayFieldTitleTemplate` implementation */
495
+ export type ArrayFieldTitleProps<
496
+ T = any,
497
+ S extends StrictRJSFSchema = RJSFSchema,
498
+ F extends FormContextType = any
499
+ > = Omit<TitleFieldProps<T, S, F>, 'id' | 'title'> & {
500
+ /** The title for the field being rendered */
501
+ title?: string;
502
+ /** The idSchema of the field in the hierarchy */
503
+ idSchema: IdSchema<T>;
504
+ };
505
+
506
+ /** The properties that are passed to a `ArrayFieldDescriptionTemplate` implementation */
507
+ export type ArrayFieldDescriptionProps<
508
+ T = any,
509
+ S extends StrictRJSFSchema = RJSFSchema,
510
+ F extends FormContextType = any
511
+ > = Omit<DescriptionFieldProps<T, S, F>, 'id' | 'description'> & {
512
+ /** The description of the field being rendered */
513
+ description?: string | ReactElement;
514
+ /** The idSchema of the field in the hierarchy */
515
+ idSchema: IdSchema<T>;
516
+ };
517
+
518
+ /** The properties of each element in the ArrayFieldTemplateProps.items array */
519
+ export type ArrayFieldTemplateItemType<
520
+ T = any,
521
+ S extends StrictRJSFSchema = RJSFSchema,
522
+ F extends FormContextType = any
523
+ > = {
524
+ /** The html for the item's content */
525
+ children: ReactElement;
526
+ /** The className string */
527
+ className: string;
528
+ /** A boolean value stating if the array item is disabled */
529
+ disabled: boolean;
530
+ /** A boolean value stating whether new items can be added to the array */
531
+ canAdd: boolean;
532
+ /** A boolean value stating whether the array item can be copied, assumed false if missing */
533
+ hasCopy: boolean;
534
+ /** A boolean value stating whether the array item can be moved down */
535
+ hasMoveDown: boolean;
536
+ /** A boolean value stating whether the array item can be moved up */
537
+ hasMoveUp: boolean;
538
+ /** A boolean value stating whether the array item can be removed */
539
+ hasRemove: boolean;
540
+ /** A boolean value stating whether the array item has a toolbar */
541
+ hasToolbar: boolean;
542
+ /** A number stating the index the array item occurs in `items` */
543
+ index: number;
544
+ /** A number stating the total number `items` in the array */
545
+ totalItems: number;
546
+ /** Returns a function that adds a new item at `index` */
547
+ onAddIndexClick: (index: number) => (event?: any) => void;
548
+ /** Returns a function that copies the item at `index` into the position at `index + 1` */
549
+ onCopyIndexClick: (index: number) => (event?: any) => void;
550
+ /** Returns a function that removes the item at `index` */
551
+ onDropIndexClick: (index: number) => (event?: any) => void;
552
+ /** Returns a function that swaps the items at `index` with `newIndex` */
553
+ onReorderClick: (index: number, newIndex: number) => (event?: any) => void;
554
+ /** A boolean value stating if the array item is read-only */
555
+ readonly: boolean;
556
+ /** A stable, unique key for the array item */
557
+ key: string;
558
+ /** The schema object for this array item */
559
+ schema: S;
560
+ /** The uiSchema object for this array item */
561
+ uiSchema?: UiSchema<T, S, F>;
562
+ /** The `registry` object */
563
+ registry: Registry<T, S, F>;
564
+ };
565
+
566
+ /** The properties that are passed to an ArrayFieldTemplate implementation */
567
+ export type ArrayFieldTemplateProps<
568
+ T = any,
569
+ S extends StrictRJSFSchema = RJSFSchema,
570
+ F extends FormContextType = any
571
+ > = {
572
+ /** A boolean value stating whether new elements can be added to the array */
573
+ canAdd?: boolean;
574
+ /** The className string */
575
+ className?: string;
576
+ /** A boolean value stating if the array is disabled */
577
+ disabled?: boolean;
578
+ /** An object containing the id for this object & ids for its properties */
579
+ idSchema: IdSchema<T>;
580
+ /** An array of objects representing the items in the array */
581
+ items: ArrayFieldTemplateItemType<T, S, F>[];
582
+ /** A function that adds a new item to the array */
583
+ onAddClick: (event?: any) => void;
584
+ /** A boolean value stating if the array is read-only */
585
+ readonly?: boolean;
586
+ /** A boolean value stating if the array is required */
587
+ required?: boolean;
588
+ /** A boolean value stating if the field is hiding its errors */
589
+ hideError?: boolean;
590
+ /** The schema object for this array */
591
+ schema: S;
592
+ /** The uiSchema object for this array field */
593
+ uiSchema?: UiSchema<T, S, F>;
594
+ /** A string value containing the title for the array */
595
+ title: string;
596
+ /** The `formContext` object that was passed to Form */
597
+ formContext?: F;
598
+ /** The formData for this array */
599
+ formData?: T;
600
+ /** An array of strings listing all generated error messages from encountered errors for this widget */
601
+ rawErrors?: string[];
602
+ /** The `registry` object */
603
+ registry: Registry<T, S, F>;
604
+ };
605
+
606
+ /** The properties of each element in the ObjectFieldTemplateProps.properties array */
607
+ export type ObjectFieldTemplatePropertyType = {
608
+ /** The html for the property's content */
609
+ content: ReactElement;
610
+ /** A string representing the property name */
611
+ name: string;
612
+ /** A boolean value stating if the object property is disabled */
613
+ disabled: boolean;
614
+ /** A boolean value stating if the property is read-only */
615
+ readonly: boolean;
616
+ /** A boolean value stating if the property should be hidden */
617
+ hidden: boolean;
618
+ };
619
+
620
+ /** The properties that are passed to an ObjectFieldTemplate implementation */
621
+ export type ObjectFieldTemplateProps<
622
+ T = any,
623
+ S extends StrictRJSFSchema = RJSFSchema,
624
+ F extends FormContextType = any
625
+ > = {
626
+ /** A string value containing the title for the object */
627
+ title: string;
628
+ /** A string value containing the description for the object */
629
+ description?: string;
630
+ /** A boolean value stating if the object is disabled */
631
+ disabled?: boolean;
632
+ /** An array of objects representing the properties in the object */
633
+ properties: ObjectFieldTemplatePropertyType[];
634
+ /** Returns a function that adds a new property to the object (to be used with additionalProperties) */
635
+ onAddClick: (schema: S) => () => void;
636
+ /** A boolean value stating if the object is read-only */
637
+ readonly?: boolean;
638
+ /** A boolean value stating if the object is required */
639
+ required?: boolean;
640
+ /** A boolean value stating if the field is hiding its errors */
641
+ hideError?: boolean;
642
+ /** The schema object for this object */
643
+ schema: S;
644
+ /** The uiSchema object for this object field */
645
+ uiSchema?: UiSchema<T, S, F>;
646
+ /** An object containing the id for this object & ids for its properties */
647
+ idSchema: IdSchema<T>;
648
+ /** The optional validation errors in the form of an `ErrorSchema` */
649
+ errorSchema?: ErrorSchema<T>;
650
+ /** The form data for the object */
651
+ formData?: T;
652
+ /** The `formContext` object that was passed to Form */
653
+ formContext?: F;
654
+ /** The `registry` object */
655
+ registry: Registry<T, S, F>;
656
+ };
657
+
658
+ /** The properties that are passed to a WrapIfAdditionalTemplate implementation */
659
+ export type WrapIfAdditionalTemplateProps<
660
+ T = any,
661
+ S extends StrictRJSFSchema = RJSFSchema,
662
+ F extends FormContextType = any
663
+ > = {
664
+ /** The field or widget component instance for this field row */
665
+ children: ReactNode;
666
+ } & Pick<
667
+ FieldTemplateProps<T, S, F>,
668
+ | 'id'
669
+ | 'classNames'
670
+ | 'style'
671
+ | 'label'
672
+ | 'required'
673
+ | 'readonly'
674
+ | 'disabled'
675
+ | 'schema'
676
+ | 'uiSchema'
677
+ | 'onKeyChange'
678
+ | 'onDropPropertyClick'
679
+ | 'registry'
680
+ >;
681
+
682
+ /** The properties that are passed to a Widget implementation */
683
+ export interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>
684
+ extends GenericObjectType,
685
+ Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus'>> {
686
+ /** The generated id for this widget, used to provide unique `name`s and `id`s for the HTML field elements rendered by
687
+ * widgets
688
+ */
689
+ id: string;
690
+ /** The unique name of the field, usually derived from the name of the property in the JSONSchema; Provided in support
691
+ * of custom widgets.
692
+ */
693
+ name: string;
694
+ /** The JSONSchema subschema object for this widget */
695
+ schema: S;
696
+ /** The uiSchema for this widget */
697
+ uiSchema?: UiSchema<T, S, F>;
698
+ /** The current value for this widget */
699
+ value: any;
700
+ /** The required status of this widget */
701
+ required?: boolean;
702
+ /** A boolean value stating if the widget is disabled */
703
+ disabled?: boolean;
704
+ /** A boolean value stating if the widget is read-only */
705
+ readonly?: boolean;
706
+ /** A boolean value stating if the widget is hiding its errors */
707
+ hideError?: boolean;
708
+ /** A boolean value stating if the widget should autofocus */
709
+ autofocus?: boolean;
710
+ /** The placeholder for the widget, if any */
711
+ placeholder?: string;
712
+ /** A map of UI Options passed as a prop to the component, including the optional `enumOptions`
713
+ * which is a special case on top of `UIOptionsType` needed only by widgets
714
+ */
715
+ options: NonNullable<UIOptionsType<T, S, F>> & {
716
+ /** The enum options list for a type that supports them */
717
+ enumOptions?: EnumOptionsType<S>[];
718
+ };
719
+ /** The `formContext` object that you passed to `Form` */
720
+ formContext?: F;
721
+ /** The input blur event handler; call it with the widget id and value */
722
+ onBlur: (id: string, value: any) => void;
723
+ /** The value change event handler; call it with the new value every time it changes */
724
+ onChange: (value: any) => void;
725
+ /** The input focus event handler; call it with the widget id and value */
726
+ onFocus: (id: string, value: any) => void;
727
+ /** The computed label for this widget, as a string */
728
+ label: string;
729
+ /** A boolean value, if true, will cause the label to be hidden. This is useful for nested fields where you don't want
730
+ * to clutter the UI. Customized via `label` in the `UiSchema`
731
+ */
732
+ hideLabel?: boolean;
733
+ /** A boolean value stating if the widget can accept multiple values */
734
+ multiple?: boolean;
735
+ /** An array of strings listing all generated error messages from encountered errors for this widget */
736
+ rawErrors?: string[];
737
+ /** The `registry` object */
738
+ registry: Registry<T, S, F>;
739
+ }
740
+
741
+ /** The definition of a React-based Widget component */
742
+ export type Widget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<
743
+ WidgetProps<T, S, F>
744
+ >;
745
+
746
+ /** The properties that are passed to the BaseInputTemplate */
747
+ export interface BaseInputTemplateProps<
748
+ T = any,
749
+ S extends StrictRJSFSchema = RJSFSchema,
750
+ F extends FormContextType = any
751
+ > extends WidgetProps<T, S, F> {
752
+ /** A `BaseInputTemplate` implements a default `onChange` handler that it passes to the HTML input component to handle
753
+ * the `ChangeEvent`. Sometimes a widget may need to handle the `ChangeEvent` using custom logic. If that is the case,
754
+ * that widget should provide its own handler via this prop.
755
+ */
756
+ onChangeOverride?: (event: ChangeEvent<HTMLInputElement>) => void;
757
+ }
758
+
759
+ /** The type that defines the props used by the Submit button */
760
+ export type SubmitButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
761
+ /** The uiSchema for this widget */
762
+ uiSchema?: UiSchema<T, S, F>;
763
+ /** The `registry` object */
764
+ registry: Registry<T, S, F>;
765
+ };
766
+
767
+ /** The type that defines the props for an Icon button, extending from a basic HTML button attributes */
768
+ export type IconButtonProps<
769
+ T = any,
770
+ S extends StrictRJSFSchema = RJSFSchema,
771
+ F extends FormContextType = any
772
+ > = ButtonHTMLAttributes<HTMLButtonElement> & {
773
+ /** An alternative specification for the type of the icon button */
774
+ iconType?: string;
775
+ /** The name representation or actual react element implementation for the icon */
776
+ icon?: string | ReactElement;
777
+ /** The uiSchema for this widget */
778
+ uiSchema?: UiSchema<T, S, F>;
779
+ /** The `registry` object */
780
+ registry: Registry<T, S, F>;
781
+ };
782
+
783
+ /** The type that defines how to change the behavior of the submit button for the form */
784
+ export type UISchemaSubmitButtonOptions = {
785
+ /** The text of the submit button. Set to "Submit" by default */
786
+ submitText?: string;
787
+ /** Flag, if `true`, removes the submit button completely from the form */
788
+ norender?: boolean;
789
+ /** Any other props to be passed to the submit button itself */
790
+ props?: GenericObjectType & {
791
+ /** A boolean value stating if the submit button is disabled */
792
+ disabled?: boolean;
793
+ /** The class name for the submit button */
794
+ className?: string;
795
+ };
796
+ };
797
+
798
+ /** This type represents an element used to render an enum option */
799
+ export type EnumOptionsType<S extends StrictRJSFSchema = RJSFSchema> = {
800
+ /** The value for the enum option */
801
+ value: any;
802
+ /** The label for the enum options */
803
+ label: string;
804
+ /** The schema associated with the enum option when the option represents a `oneOf` or `anyOf` choice */
805
+ schema?: S;
806
+ };
807
+
808
+ /** This type remaps the keys of `Type` to prepend `ui:` onto them. As a result it does not need to be exported */
809
+ type MakeUIType<Type> = {
810
+ [Property in keyof Type as `ui:${string & Property}`]: Type[Property];
811
+ };
812
+
813
+ /** This type represents all the known supported options in the `ui:options` property, kept separate in order to
814
+ * remap the keys. It also contains all the properties, optionally, of `TemplatesType` except "ButtonTemplates"
815
+ */
816
+ type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<
817
+ Omit<TemplatesType<T, S, F>, 'ButtonTemplates'>
818
+ > &
819
+ GlobalUISchemaOptions & {
820
+ /** Any classnames that the user wants to be applied to a field in the ui */
821
+ classNames?: string;
822
+ /** Any custom style that the user wants to apply to a field in the ui, applied on the same element as classNames */
823
+ style?: StyleHTMLAttributes<any>;
824
+ /** We know that for title, it will be a string, if it is provided */
825
+ title?: string;
826
+ /** We know that for description, it will be a string, if it is provided */
827
+ description?: string;
828
+ /** We know that for placeholder, it will be a string, if it is provided */
829
+ placeholder?: string;
830
+ /** Used to add text next to a field to guide the end user in filling it in */
831
+ help?: string;
832
+ /** Flag, if set to `true`, will mark the field as automatically focused on a text input or textarea input */
833
+ autofocus?: boolean;
834
+ /** Use to mark the field as supporting auto complete on a text input or textarea input */
835
+ autocomplete?: HTMLInputElement['autocomplete'];
836
+ /** Flag, if set to `true`, will mark all child widgets from a given field as disabled */
837
+ disabled?: boolean;
838
+ /** The default value to use when an input for a field is empty */
839
+ emptyValue?: any;
840
+ /** Will disable any of the enum options specified in the array (by value) */
841
+ enumDisabled?: Array<string | number | boolean>;
842
+ /** Flag, if set to `true`, will hide the default error display for the given field AND all of its child fields in the
843
+ * hierarchy
844
+ */
845
+ hideError?: boolean;
846
+ /** Flag, if set to `true`, will mark all child widgets from a given field as read-only */
847
+ readonly?: boolean;
848
+ /** This property allows you to reorder the properties that are shown for a particular object */
849
+ order?: string[];
850
+ /** Flag, if set to `true`, will cause the `FileWidget` to show a preview (with download for non-image files) */
851
+ filePreview?: boolean;
852
+ /** Flag, if set to `true`, will mark a list of checkboxes as displayed all on one line instead of one per row */
853
+ inline?: boolean;
854
+ /** Used to change the input type (for example, `tel` or `email`) for an <input> */
855
+ inputType?: string;
856
+ /** Provides a means to set the initial height of a textarea widget */
857
+ rows?: number;
858
+ /** If submitButtonOptions is provided it should match the `UISchemaSubmitButtonOptions` type */
859
+ submitButtonOptions?: UISchemaSubmitButtonOptions;
860
+ /** Allows RJSF to override the default widget implementation by specifying either the name of a widget that is used
861
+ * to look up an implementation from the `widgets` list or an actual one-off widget implementation itself
862
+ */
863
+ widget?: Widget<T, S, F> | string;
864
+ };
865
+
866
+ /** The type that represents the Options potentially provided by `ui:options` */
867
+ export type UIOptionsType<
868
+ T = any,
869
+ S extends StrictRJSFSchema = RJSFSchema,
870
+ F extends FormContextType = any
871
+ > = UIOptionsBaseType<T, S, F> & {
872
+ /** Anything else will be one of these types */
873
+ [key: string]: boolean | number | string | object | any[] | null | undefined;
874
+ };
875
+
876
+ /** Type describing the well-known properties of the `UiSchema` while also supporting all user defined properties,
877
+ * starting with `ui:`.
878
+ */
879
+ export type UiSchema<
880
+ T = any,
881
+ S extends StrictRJSFSchema = RJSFSchema,
882
+ F extends FormContextType = any
883
+ > = GenericObjectType &
884
+ MakeUIType<UIOptionsBaseType<T, S, F>> & {
885
+ /** The set of Globally relevant UI Schema options that are read from the root-level UiSchema and stored in the
886
+ * Registry for use everywhere.
887
+ */
888
+ 'ui:globalOptions'?: GlobalUISchemaOptions;
889
+ /** Allows the form to generate a unique prefix for the `Form`'s root prefix */
890
+ 'ui:rootFieldId'?: string;
891
+ /** Allows RJSF to override the default field implementation by specifying either the name of a field that is used
892
+ * to look up an implementation from the `fields` list or an actual one-off `Field` component implementation itself
893
+ */
894
+ 'ui:field'?: Field<T, S, F> | string;
895
+ /** By default, any field that is rendered for an `anyOf`/`oneOf` schema will be wrapped inside the `AnyOfField` or
896
+ * `OneOfField` component. This default behavior may be undesirable if your custom field already handles behavior
897
+ * related to choosing one or more subschemas contained in the `anyOf`/`oneOf` schema.
898
+ * By providing a `true` value for this flag in association with a custom `ui:field`, the wrapped components will be
899
+ * omitted, so just one instance of the custom field will be rendered. If the flag is omitted or set to `false`,
900
+ * your custom field will be wrapped by `AnyOfField`/`OneOfField`.
901
+ */
902
+ 'ui:fieldReplacesAnyOrOneOf'?: boolean;
903
+ /** An object that contains all the potential UI options in a single object */
904
+ 'ui:options'?: UIOptionsType<T, S, F>;
905
+ };
906
+
907
+ /** A `CustomValidator` function takes in a `formData`, `errors` and `uiSchema` objects and returns the given `errors`
908
+ * object back, while potentially adding additional messages to the `errors`
909
+ */
910
+ export type CustomValidator<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = (
911
+ formData: T | undefined,
912
+ errors: FormValidation<T>,
913
+ uiSchema?: UiSchema<T, S, F>
914
+ ) => FormValidation<T>;
915
+
916
+ /** An `ErrorTransformer` function will take in a list of `errors` & a `uiSchema` and potentially return a
917
+ * transformation of those errors in what ever way it deems necessary
918
+ */
919
+ export type ErrorTransformer<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = (
920
+ errors: RJSFValidationError[],
921
+ uiSchema?: UiSchema<T, S, F>
922
+ ) => RJSFValidationError[];
923
+
924
+ /** The type that describes the data that is returned from the `ValidatorType.validateFormData()` function */
925
+ export type ValidationData<T> = {
926
+ /** The validation errors as a list of `RJSFValidationError` objects */
927
+ errors: RJSFValidationError[];
928
+ /** The validation errors in the form of an `ErrorSchema` */
929
+ errorSchema: ErrorSchema<T>;
930
+ };
931
+
932
+ /** The interface that describes the validation functions that are provided by a Validator implementation used by the
933
+ * schema utilities.
934
+ */
935
+ export interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
936
+ /** This function processes the `formData` with an optional user contributed `customValidate` function, which receives
937
+ * the form data and a `errorHandler` function that will be used to add custom validation errors for each field. Also
938
+ * supports a `transformErrors` function that will take the raw AJV validation errors, prior to custom validation and
939
+ * transform them in what ever way it chooses.
940
+ *
941
+ * @param formData - The form data to validate
942
+ * @param schema - The schema against which to validate the form data
943
+ * @param [customValidate] - An optional function that is used to perform custom validation
944
+ * @param [transformErrors] - An optional function that is used to transform errors after AJV validation
945
+ * @param [uiSchema] - An optional uiSchema that is passed to `transformErrors` and `customValidate`
946
+ */
947
+ validateFormData(
948
+ formData: T | undefined,
949
+ schema: S,
950
+ customValidate?: CustomValidator<T, S, F>,
951
+ transformErrors?: ErrorTransformer<T, S, F>,
952
+ uiSchema?: UiSchema<T, S, F>
953
+ ): ValidationData<T>;
954
+ /** Converts an `errorSchema` into a list of `RJSFValidationErrors`
955
+ *
956
+ * @param errorSchema - The `ErrorSchema` instance to convert
957
+ * @param [fieldPath=[]] - The current field path, defaults to [] if not specified
958
+ * @deprecated - Use the `toErrorList()` function provided by `@rjsf/utils` instead. This function will be removed in
959
+ * the next major release.
960
+ */
961
+ toErrorList(errorSchema?: ErrorSchema<T>, fieldPath?: string[]): RJSFValidationError[];
962
+ /** Validates data against a schema, returning true if the data is valid, or
963
+ * false otherwise. If the schema is invalid, then this function will return
964
+ * false.
965
+ *
966
+ * @param schema - The schema against which to validate the form data * @param schema
967
+ * @param formData - The form data to validate
968
+ * @param rootSchema - The root schema used to provide $ref resolutions
969
+ */
970
+ isValid(schema: S, formData: T | undefined, rootSchema: S): boolean;
971
+ /** Runs the pure validation of the `schema` and `formData` without any of the RJSF functionality. Provided for use
972
+ * by the playground. Returns the `errors` from the validation
973
+ *
974
+ * @param schema - The schema against which to validate the form data
975
+ * @param formData - The form data to validate
976
+ */
977
+ rawValidation<Result = any>(schema: S, formData?: T): { errors?: Result[]; validationError?: Error };
978
+ }
979
+
980
+ /** The `SchemaUtilsType` interface provides a wrapper around the publicly exported APIs in the `@rjsf/utils/schema`
981
+ * directory such that one does not have to explicitly pass the `validator` or `rootSchema` to each method. Since both
982
+ * the `validator` and `rootSchema` generally does not change across a `Form`, this allows for providing a simplified
983
+ * set of APIs to the `@rjsf/core` components and the various themes as well.
984
+ */
985
+ export interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
986
+ /** Returns the `ValidatorType` in the `SchemaUtilsType`
987
+ *
988
+ * @returns - The `ValidatorType`
989
+ */
990
+ getValidator(): ValidatorType<T, S, F>;
991
+ /** Determines whether either the `validator` and `rootSchema` differ from the ones associated with this instance of
992
+ * the `SchemaUtilsType`. If either `validator` or `rootSchema` are falsy, then return false to prevent the creation
993
+ * of a new `SchemaUtilsType` with incomplete properties.
994
+ *
995
+ * @param validator - An implementation of the `ValidatorType` interface that will be compared against the current one
996
+ * @param rootSchema - The root schema that will be compared against the current one
997
+ * @param [experimental_defaultFormStateBehavior] - Optional configuration object, if provided, allows users to override default form state behavior
998
+ * @returns - True if the `SchemaUtilsType` differs from the given `validator` or `rootSchema`
999
+ */
1000
+ doesSchemaUtilsDiffer(
1001
+ validator: ValidatorType<T, S, F>,
1002
+ rootSchema: S,
1003
+ experimental_defaultFormStateBehavior?: Experimental_DefaultFormStateBehavior
1004
+ ): boolean;
1005
+ /** Returns the superset of `formData` that includes the given set updated to include any missing fields that have
1006
+ * computed to have defaults provided in the `schema`.
1007
+ *
1008
+ * @param schema - The schema for which the default state is desired
1009
+ * @param [formData] - The current formData, if any, onto which to provide any missing defaults
1010
+ * @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults.
1011
+ * If "excludeObjectChildren", cause undefined values for this object and pass `includeUndefinedValues` as
1012
+ * false when computing defaults for any nested object properties.
1013
+ * @returns - The resulting `formData` with all the defaults provided
1014
+ */
1015
+ getDefaultFormState(
1016
+ schema: S,
1017
+ formData?: T,
1018
+ includeUndefinedValues?: boolean | 'excludeObjectChildren'
1019
+ ): T | T[] | undefined;
1020
+ /** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
1021
+ * should be displayed in a UI.
1022
+ *
1023
+ * @param schema - The schema for which the display label flag is desired
1024
+ * @param [uiSchema] - The UI schema from which to derive potentially displayable information
1025
+ * @param [globalOptions={}] - The Global UI Schema from which to get any fallback `xxx` options
1026
+ * @returns - True if the label should be displayed or false if it should not
1027
+ */
1028
+ getDisplayLabel(schema: S, uiSchema?: UiSchema<T, S, F>, globalOptions?: GlobalUISchemaOptions): boolean;
1029
+ /** Determines which of the given `options` provided most closely matches the `formData`.
1030
+ * Returns the index of the option that is valid and is the closest match, or 0 if there is no match.
1031
+ *
1032
+ * The closest match is determined using the number of matching properties, and more heavily favors options with
1033
+ * matching readOnly, default, or const values.
1034
+ *
1035
+ * @param formData - The form data associated with the schema
1036
+ * @param options - The list of options that can be selected from
1037
+ * @param [selectedOption] - The index of the currently selected option, defaulted to -1 if not specified
1038
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
1039
+ * determine which option is selected
1040
+ * @returns - The index of the option that is the closest match to the `formData` or the `selectedOption` if no match
1041
+ */
1042
+ getClosestMatchingOption(
1043
+ formData: T | undefined,
1044
+ options: S[],
1045
+ selectedOption?: number,
1046
+ discriminatorField?: string
1047
+ ): number;
1048
+ /** Given the `formData` and list of `options`, attempts to find the index of the first option that matches the data.
1049
+ * Always returns the first option if there is nothing that matches.
1050
+ *
1051
+ * @param formData - The current formData, if any, used to figure out a match
1052
+ * @param options - The list of options to find a matching options from
1053
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
1054
+ * determine which option is selected
1055
+ * @returns - The firstindex of the matched option or 0 if none is available
1056
+ */
1057
+ getFirstMatchingOption(formData: T | undefined, options: S[], discriminatorField?: string): number;
1058
+ /** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.
1059
+ * Deprecated, use `getFirstMatchingOption()` instead.
1060
+ *
1061
+ * @param formData - The current formData, if any, onto which to provide any missing defaults
1062
+ * @param options - The list of options to find a matching options from
1063
+ * @param [discriminatorField] - The optional name of the field within the options object whose value is used to
1064
+ * determine which option is selected
1065
+ * @returns - The index of the matched option or 0 if none is available
1066
+ * @deprecated
1067
+ */
1068
+ getMatchingOption(formData: T | undefined, options: S[], discriminatorField?: string): number;
1069
+ /** Checks to see if the `schema` and `uiSchema` combination represents an array of files
1070
+ *
1071
+ * @param schema - The schema for which check for array of files flag is desired
1072
+ * @param [uiSchema] - The UI schema from which to check the widget
1073
+ * @returns - True if schema/uiSchema contains an array of files, otherwise false
1074
+ */
1075
+ isFilesArray(schema: S, uiSchema?: UiSchema<T, S, F>): boolean;
1076
+ /** Checks to see if the `schema` combination represents a multi-select
1077
+ *
1078
+ * @param schema - The schema for which check for a multi-select flag is desired
1079
+ * @returns - True if schema contains a multi-select, otherwise false
1080
+ */
1081
+ isMultiSelect(schema: S): boolean;
1082
+ /** Checks to see if the `schema` combination represents a select
1083
+ *
1084
+ * @param schema - The schema for which check for a select flag is desired
1085
+ * @returns - True if schema contains a select, otherwise false
1086
+ */
1087
+ isSelect(schema: S): boolean;
1088
+ /** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in
1089
+ * the two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
1090
+ * `validator.toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
1091
+ * `validationData` is returned.
1092
+ *
1093
+ * @param validationData - The current `ValidationData` into which to merge the additional errors
1094
+ * @param [additionalErrorSchema] - The additional set of errors
1095
+ * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided
1096
+ * @deprecated - Use the `validationDataMerge()` function exported from `@rjsf/utils` instead. This function will be
1097
+ * removed in the next major release.
1098
+ */
1099
+ mergeValidationData(validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;
1100
+ /** Retrieves an expanded schema that has had all of its conditions, additional properties, references and
1101
+ * dependencies resolved and merged into the `schema` given a `rawFormData` that is used to do the potentially
1102
+ * recursive resolution.
1103
+ *
1104
+ * @param schema - The schema for which retrieving a schema is desired
1105
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
1106
+ * @returns - The schema having its conditions, additional properties, references and dependencies resolved
1107
+ */
1108
+ retrieveSchema(schema: S, formData?: T): S;
1109
+ /** Sanitize the `data` associated with the `oldSchema` so it is considered appropriate for the `newSchema`. If the
1110
+ * new schema does not contain any properties, then `undefined` is returned to clear all the form data. Due to the
1111
+ * nature of schemas, this sanitization happens recursively for nested objects of data. Also, any properties in the
1112
+ * old schema that are non-existent in the new schema are set to `undefined`.
1113
+ *
1114
+ * @param [newSchema] - The new schema for which the data is being sanitized
1115
+ * @param [oldSchema] - The old schema from which the data originated
1116
+ * @param [data={}] - The form data associated with the schema, defaulting to an empty object when undefined
1117
+ * @returns - The new form data, with all of the fields uniquely associated with the old schema set
1118
+ * to `undefined`. Will return `undefined` if the new schema is not an object containing properties.
1119
+ */
1120
+ sanitizeDataForNewSchema(newSchema?: S, oldSchema?: S, data?: any): T;
1121
+ /** Generates an `IdSchema` object for the `schema`, recursively
1122
+ *
1123
+ * @param schema - The schema for which the display label flag is desired
1124
+ * @param [id] - The base id for the schema
1125
+ * @param [formData] - The current formData, if any, onto which to provide any missing defaults
1126
+ * @param [idPrefix='root'] - The prefix to use for the id
1127
+ * @param [idSeparator='_'] - The separator to use for the path segments in the id
1128
+ * @returns - The `IdSchema` object for the `schema`
1129
+ */
1130
+ toIdSchema(schema: S, id?: string, formData?: T, idPrefix?: string, idSeparator?: string): IdSchema<T>;
1131
+ /** Generates an `PathSchema` object for the `schema`, recursively
1132
+ *
1133
+ * @param schema - The schema for which the display label flag is desired
1134
+ * @param [name] - The base name for the schema
1135
+ * @param [formData] - The current formData, if any, onto which to provide any missing defaults
1136
+ * @returns - The `PathSchema` object for the `schema`
1137
+ */
1138
+ toPathSchema(schema: S, name?: string, formData?: T): PathSchema<T>;
1139
+ }