@rjsf/utils 5.0.0-beta.11 → 5.0.0-beta.12

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import * as json_schema from 'json-schema';
3
- import { JSONSchema7, JSONSchema7Definition } from 'json-schema';
3
+ import { JSONSchema7 } from 'json-schema';
4
4
 
5
5
  /** The representation of any generic object type, usually used as an intersection on other types to make them more
6
6
  * flexible in the properties they support (i.e. anything else)
@@ -8,14 +8,16 @@ import { JSONSchema7, JSONSchema7Definition } from 'json-schema';
8
8
  declare type GenericObjectType = {
9
9
  [name: string]: any;
10
10
  };
11
- /** Map the JSONSchema7 to our own type so that we can easily bump to JSONSchema8 at some future date and only have to
12
- * update this one type.
11
+ /** Map the JSONSchema7 to our own type so that we can easily bump to a more recent version at some future date and only
12
+ * have to update this one type.
13
13
  */
14
- declare type RJSFSchema = JSONSchema7;
15
- /** Map the JSONSchema7Definition to our own type so that we can easily bump to JSONSchema8Definition at some future
16
- * date and only have to update this one type.
14
+ declare type StrictRJSFSchema = JSONSchema7;
15
+ /** Allow for more flexible schemas (i.e. draft-2019) than the strict JSONSchema7
17
16
  */
18
- declare type RJSFSchemaDefinition = JSONSchema7Definition;
17
+ declare type RJSFSchema = StrictRJSFSchema & GenericObjectType;
18
+ /** Alias GenericObjectType as FormContextType to allow us to remap this at some future date
19
+ */
20
+ declare type FormContextType = GenericObjectType;
19
21
  /** The interface representing a Date object that contains an optional time */
20
22
  interface DateObject {
21
23
  /** The year of the Date */
@@ -110,7 +112,7 @@ declare type FormValidation<T = any> = FieldValidation & {
110
112
  [key in keyof T]?: FormValidation<T[key]>;
111
113
  };
112
114
  /** The properties that are passed to an `ErrorListTemplate` implementation */
113
- declare type ErrorListProps<T = any, F = any> = {
115
+ declare type ErrorListProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
114
116
  /** The errorSchema constructed by `Form` */
115
117
  errorSchema: ErrorSchema<T>;
116
118
  /** An array of the errors */
@@ -118,12 +120,12 @@ declare type ErrorListProps<T = any, F = any> = {
118
120
  /** The `formContext` object that was passed to `Form` */
119
121
  formContext?: F;
120
122
  /** The schema that was passed to `Form` */
121
- schema: RJSFSchema;
123
+ schema: S;
122
124
  /** The uiSchema that was passed to `Form` */
123
- uiSchema?: UiSchema<T, F>;
125
+ uiSchema?: UiSchema<T, S, F>;
124
126
  };
125
127
  /** The properties that are passed to an `FieldErrorTemplate` implementation */
126
- declare type FieldErrorProps<T = any, F = any> = {
128
+ declare type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
127
129
  /** The errorSchema constructed by `Form` */
128
130
  errorSchema?: ErrorSchema<T>;
129
131
  /** An array of the errors */
@@ -131,112 +133,112 @@ declare type FieldErrorProps<T = any, F = any> = {
131
133
  /** The tree of unique ids for every child field */
132
134
  idSchema: IdSchema<T>;
133
135
  /** The schema that was passed to field */
134
- schema: RJSFSchema;
136
+ schema: S;
135
137
  /** The uiSchema that was passed to field */
136
- uiSchema?: UiSchema<T, F>;
138
+ uiSchema?: UiSchema<T, S, F>;
137
139
  /** The `registry` object */
138
- registry: Registry<T, F>;
140
+ registry: Registry<T, S, F>;
139
141
  };
140
142
  /** The properties that are passed to an `FieldHelpTemplate` implementation */
141
- declare type FieldHelpProps<T = any, F = any> = {
143
+ declare type FieldHelpProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
142
144
  /** The help information to be rendered */
143
145
  help?: string | React.ReactElement;
144
146
  /** The tree of unique ids for every child field */
145
147
  idSchema: IdSchema<T>;
146
148
  /** The schema that was passed to field */
147
- schema: RJSFSchema;
149
+ schema: S;
148
150
  /** The uiSchema that was passed to field */
149
- uiSchema?: UiSchema<T, F>;
151
+ uiSchema?: UiSchema<T, S, F>;
150
152
  /** Flag indicating whether there are errors associated with this field */
151
153
  hasErrors?: boolean;
152
154
  /** The `registry` object */
153
- registry: Registry<T, F>;
155
+ registry: Registry<T, S, F>;
154
156
  };
155
157
  /** The set of `Fields` stored in the `Registry` */
156
- declare type RegistryFieldsType<T = any, F = any> = {
158
+ declare type RegistryFieldsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
157
159
  /** A `Field` indexed by `name` */
158
- [name: string]: Field<T, F>;
160
+ [name: string]: Field<T, S, F>;
159
161
  };
160
162
  /** The set of `Widgets` stored in the `Registry` */
161
- declare type RegistryWidgetsType<T = any, F = any> = {
163
+ declare type RegistryWidgetsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
162
164
  /** A `Widget` indexed by `name` */
163
- [name: string]: Widget<T, F>;
165
+ [name: string]: Widget<T, S, F>;
164
166
  };
165
167
  /** The set of RJSF templates that can be overridden by themes or users */
166
- interface TemplatesType<T = any, F = any> {
168
+ interface TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
167
169
  /** The template to use while rendering normal or fixed array fields */
168
- ArrayFieldTemplate: React.ComponentType<ArrayFieldTemplateProps<T, F>>;
170
+ ArrayFieldTemplate: React.ComponentType<ArrayFieldTemplateProps<T, S, F>>;
169
171
  /** The template to use while rendering the description for an array field */
170
- ArrayFieldDescriptionTemplate: React.ComponentType<ArrayFieldDescriptionProps<T, F>>;
172
+ ArrayFieldDescriptionTemplate: React.ComponentType<ArrayFieldDescriptionProps<T, S, F>>;
171
173
  /** The template to use while rendering an item in an array field */
172
- ArrayFieldItemTemplate: React.ComponentType<ArrayFieldTemplateItemType<T, F>>;
174
+ ArrayFieldItemTemplate: React.ComponentType<ArrayFieldTemplateItemType<T, S, F>>;
173
175
  /** The template to use while rendering the title for an array field */
174
- ArrayFieldTitleTemplate: React.ComponentType<ArrayFieldTitleProps<T, F>>;
176
+ ArrayFieldTitleTemplate: React.ComponentType<ArrayFieldTitleProps<T, S, F>>;
175
177
  /** The template to use while rendering the standard html input */
176
- BaseInputTemplate: React.ComponentType<WidgetProps<T, F>>;
178
+ BaseInputTemplate: React.ComponentType<WidgetProps<T, S, F>>;
177
179
  /** The template to use for rendering the description of a field */
178
- DescriptionFieldTemplate: React.ComponentType<DescriptionFieldProps<T, F>>;
180
+ DescriptionFieldTemplate: React.ComponentType<DescriptionFieldProps<T, S, F>>;
179
181
  /** The template to use while rendering the errors for the whole form */
180
- ErrorListTemplate: React.ComponentType<ErrorListProps<T, F>>;
182
+ ErrorListTemplate: React.ComponentType<ErrorListProps<T, S, F>>;
181
183
  /** The template to use while rendering the errors for a single field */
182
- FieldErrorTemplate: React.ComponentType<FieldErrorProps<T, F>>;
184
+ FieldErrorTemplate: React.ComponentType<FieldErrorProps<T, S, F>>;
183
185
  /** The template to use while rendering the errors for a single field */
184
- FieldHelpTemplate: React.ComponentType<FieldHelpProps<T, F>>;
186
+ FieldHelpTemplate: React.ComponentType<FieldHelpProps<T, S, F>>;
185
187
  /** The template to use while rendering a field */
186
- FieldTemplate: React.ComponentType<FieldTemplateProps<T, F>>;
188
+ FieldTemplate: React.ComponentType<FieldTemplateProps<T, S, F>>;
187
189
  /** The template to use while rendering an object */
188
- ObjectFieldTemplate: React.ComponentType<ObjectFieldTemplateProps<T, F>>;
190
+ ObjectFieldTemplate: React.ComponentType<ObjectFieldTemplateProps<T, S, F>>;
189
191
  /** The template to use for rendering the title of a field */
190
- TitleFieldTemplate: React.ComponentType<TitleFieldProps<T, F>>;
192
+ TitleFieldTemplate: React.ComponentType<TitleFieldProps<T, S, F>>;
191
193
  /** The template to use for rendering information about an unsupported field type in the schema */
192
- UnsupportedFieldTemplate: React.ComponentType<UnsupportedFieldProps<T, F>>;
194
+ UnsupportedFieldTemplate: React.ComponentType<UnsupportedFieldProps<T, S, F>>;
193
195
  /** The template to use for rendering a field that allows a user to add additional properties */
194
- WrapIfAdditionalTemplate: React.ComponentType<WrapIfAdditionalTemplateProps<T, F>>;
196
+ WrapIfAdditionalTemplate: React.ComponentType<WrapIfAdditionalTemplateProps<T, S, F>>;
195
197
  /** The set of templates associated with buttons in the form */
196
198
  ButtonTemplates: {
197
199
  /** The template to use for the main `Submit` button */
198
- SubmitButton: React.ComponentType<SubmitButtonProps<T, F>>;
200
+ SubmitButton: React.ComponentType<SubmitButtonProps<T, S, F>>;
199
201
  /** The template to use for the Add button used for AdditionalProperties and Array items */
200
- AddButton: React.ComponentType<IconButtonProps<T, F>>;
202
+ AddButton: React.ComponentType<IconButtonProps<T, S, F>>;
201
203
  /** The template to use for the Move Down button used for Array items */
202
- MoveDownButton: React.ComponentType<IconButtonProps<T, F>>;
204
+ MoveDownButton: React.ComponentType<IconButtonProps<T, S, F>>;
203
205
  /** The template to use for the Move Up button used for Array items */
204
- MoveUpButton: React.ComponentType<IconButtonProps<T, F>>;
206
+ MoveUpButton: React.ComponentType<IconButtonProps<T, S, F>>;
205
207
  /** The template to use for the Remove button used for AdditionalProperties and Array items */
206
- RemoveButton: React.ComponentType<IconButtonProps<T, F>>;
208
+ RemoveButton: React.ComponentType<IconButtonProps<T, S, F>>;
207
209
  };
208
210
  }
209
211
  /** The object containing the registered core, theme and custom fields and widgets as well as the root schema, form
210
212
  * context, schema utils and templates.
211
213
  */
212
- interface Registry<T = any, F = any> {
214
+ interface Registry<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
213
215
  /** The set of all fields used by the `Form`. Includes fields from `core`, theme-specific fields and any custom
214
216
  * registered fields
215
217
  */
216
- fields: RegistryFieldsType<T, F>;
218
+ fields: RegistryFieldsType<T, S, F>;
217
219
  /** The set of templates used by the `Form`. Includes templates from `core`, theme-specific fields and any custom
218
220
  * registered templates
219
221
  */
220
- templates: TemplatesType<T, F>;
222
+ templates: TemplatesType<T, S, F>;
221
223
  /** The set of all widgets used by the `Form`. Includes widgets from `core`, theme-specific widgets and any custom
222
224
  * registered widgets
223
225
  */
224
- widgets: RegistryWidgetsType<T, F>;
226
+ widgets: RegistryWidgetsType<T, S, F>;
225
227
  /** The `formContext` object that was passed to `Form` */
226
228
  formContext: F;
227
229
  /** The root schema, as passed to the `Form`, which can contain referenced definitions */
228
- rootSchema: RJSFSchema;
230
+ rootSchema: S;
229
231
  /** The current implementation of the `SchemaUtilsType` (from `@rjsf/utils`) in use by the `Form`. Used to call any
230
232
  * of the validation-schema-based utility functions
231
233
  */
232
- schemaUtils: SchemaUtilsType<T>;
234
+ schemaUtils: SchemaUtilsType<T, S>;
233
235
  }
234
236
  /** The properties that are passed to a Field implementation */
235
- interface FieldProps<T = any, F = any> extends GenericObjectType, Pick<React.HTMLAttributes<HTMLElement>, Exclude<keyof React.HTMLAttributes<HTMLElement>, "onBlur" | "onFocus" | "onChange">> {
237
+ interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<React.HTMLAttributes<HTMLElement>, Exclude<keyof React.HTMLAttributes<HTMLElement>, "onBlur" | "onFocus" | "onChange">> {
236
238
  /** The JSON subschema object for this field */
237
- schema: RJSFSchema;
239
+ schema: S;
238
240
  /** The uiSchema for this field */
239
- uiSchema?: UiSchema<T, F>;
241
+ uiSchema?: UiSchema<T, S, F>;
240
242
  /** The tree of unique ids for every child field */
241
243
  idSchema: IdSchema<T>;
242
244
  /** The data for this field */
@@ -264,12 +266,12 @@ interface FieldProps<T = any, F = any> extends GenericObjectType, Pick<React.HTM
264
266
  /** The unique name of the field, usually derived from the name of the property in the JSONSchema */
265
267
  name: string;
266
268
  /** The `registry` object */
267
- registry: Registry<T, F>;
269
+ registry: Registry<T, S, F>;
268
270
  }
269
271
  /** The definition of a React-based Field component */
270
- declare type Field<T = any, F = any> = React.ComponentType<FieldProps<T, F>>;
272
+ declare type Field<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = React.ComponentType<FieldProps<T, S, F>>;
271
273
  /** The properties that are passed to a FieldTemplate implementation */
272
- declare type FieldTemplateProps<T = any, F = any> = {
274
+ declare type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
273
275
  /** The id of the field in the hierarchy. You can use it to render a label targeting the wrapped widget */
274
276
  id: string;
275
277
  /** A string containing the base CSS classes, merged with any custom ones defined in your uiSchema */
@@ -309,9 +311,9 @@ declare type FieldTemplateProps<T = any, F = any> = {
309
311
  */
310
312
  displayLabel?: boolean;
311
313
  /** The schema object for this field */
312
- schema: RJSFSchema;
314
+ schema: S;
313
315
  /** The uiSchema object for this field */
314
- uiSchema?: UiSchema<T, F>;
316
+ uiSchema?: UiSchema<T, S, F>;
315
317
  /** The `formContext` object that was passed to `Form` */
316
318
  formContext?: F;
317
319
  /** The formData for this field */
@@ -323,63 +325,63 @@ declare type FieldTemplateProps<T = any, F = any> = {
323
325
  /** The property drop/removal event handler; Called when a field is removed in an additionalProperty context */
324
326
  onDropPropertyClick: (value: string) => () => void;
325
327
  /** The `registry` object */
326
- registry: Registry<T, F>;
328
+ registry: Registry<T, S, F>;
327
329
  };
328
330
  /** The properties that are passed to the `UnsupportedFieldTemplate` implementation */
329
- declare type UnsupportedFieldProps<T = any, F = any> = {
331
+ declare type UnsupportedFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
330
332
  /** The schema object for this field */
331
- schema: RJSFSchema;
333
+ schema: S;
332
334
  /** The tree of unique ids for every child field */
333
335
  idSchema?: IdSchema<T>;
334
336
  /** The reason why the schema field has an unsupported type */
335
337
  reason: string;
336
338
  /** The `registry` object */
337
- registry: Registry<T, F>;
339
+ registry: Registry<T, S, F>;
338
340
  };
339
341
  /** The properties that are passed to a `TitleFieldTemplate` implementation */
340
- declare type TitleFieldProps<T = any, F = any> = {
342
+ declare type TitleFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
341
343
  /** The id of the field title in the hierarchy */
342
344
  id: string;
343
345
  /** The title for the field being rendered */
344
346
  title: string;
345
347
  /** The schema object for the field being titled */
346
- schema: RJSFSchema;
348
+ schema: S;
347
349
  /** The uiSchema object for this title field */
348
- uiSchema?: UiSchema<T, F>;
350
+ uiSchema?: UiSchema<T, S, F>;
349
351
  /** A boolean value stating if the field is required */
350
352
  required?: boolean;
351
353
  /** The `registry` object */
352
- registry: Registry<T, F>;
354
+ registry: Registry<T, S, F>;
353
355
  };
354
356
  /** The properties that are passed to a `DescriptionFieldTemplate` implementation */
355
- declare type DescriptionFieldProps<T = any, F = any> = {
357
+ declare type DescriptionFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
356
358
  /** The id of the field description in the hierarchy */
357
359
  id: string;
358
360
  /** The schema object for the field being described */
359
- schema: RJSFSchema;
361
+ schema: S;
360
362
  /** The uiSchema object for this description field */
361
- uiSchema?: UiSchema<T, F>;
363
+ uiSchema?: UiSchema<T, S, F>;
362
364
  /** The description of the field being rendered */
363
365
  description: string | React.ReactElement;
364
366
  /** The `registry` object */
365
- registry: Registry<T, F>;
367
+ registry: Registry<T, S, F>;
366
368
  };
367
369
  /** The properties that are passed to a `ArrayFieldTitleTemplate` implementation */
368
- declare type ArrayFieldTitleProps<T = any, F = any> = Omit<TitleFieldProps<T, F>, "id" | "title"> & {
370
+ declare type ArrayFieldTitleProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<TitleFieldProps<T, S, F>, "id" | "title"> & {
369
371
  /** The title for the field being rendered */
370
372
  title?: string;
371
373
  /** The idSchema of the field in the hierarchy */
372
374
  idSchema: IdSchema<T>;
373
375
  };
374
376
  /** The properties that are passed to a `ArrayFieldDescriptionTemplate` implementation */
375
- declare type ArrayFieldDescriptionProps<T = any, F = any> = Omit<DescriptionFieldProps<T, F>, "id" | "description"> & {
377
+ declare type ArrayFieldDescriptionProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<DescriptionFieldProps<T, S, F>, "id" | "description"> & {
376
378
  /** The description of the field being rendered */
377
379
  description?: string | React.ReactElement;
378
380
  /** The idSchema of the field in the hierarchy */
379
381
  idSchema: IdSchema<T>;
380
382
  };
381
383
  /** The properties of each element in the ArrayFieldTemplateProps.items array */
382
- declare type ArrayFieldTemplateItemType<T = any, F = any> = {
384
+ declare type ArrayFieldTemplateItemType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
383
385
  /** The html for the item's content */
384
386
  children: React.ReactElement;
385
387
  /** The className string */
@@ -407,12 +409,12 @@ declare type ArrayFieldTemplateItemType<T = any, F = any> = {
407
409
  /** A stable, unique key for the array item */
408
410
  key: string;
409
411
  /** The uiSchema object for this field */
410
- uiSchema?: UiSchema<T, F>;
412
+ uiSchema?: UiSchema<T, S, F>;
411
413
  /** The `registry` object */
412
- registry: Registry<T, F>;
414
+ registry: Registry<T, S, F>;
413
415
  };
414
416
  /** The properties that are passed to an ArrayFieldTemplate implementation */
415
- declare type ArrayFieldTemplateProps<T = any, F = any> = {
417
+ declare type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
416
418
  /** A boolean value stating whether new elements can be added to the array */
417
419
  canAdd?: boolean;
418
420
  /** The className string */
@@ -422,7 +424,7 @@ declare type ArrayFieldTemplateProps<T = any, F = any> = {
422
424
  /** An object containing the id for this object & ids for its properties */
423
425
  idSchema: IdSchema<T>;
424
426
  /** An array of objects representing the items in the array */
425
- items: ArrayFieldTemplateItemType<T, F>[];
427
+ items: ArrayFieldTemplateItemType<T, S, F>[];
426
428
  /** A function that adds a new item to the array */
427
429
  onAddClick: (event?: any) => void;
428
430
  /** A boolean value stating if the array is read-only */
@@ -432,9 +434,9 @@ declare type ArrayFieldTemplateProps<T = any, F = any> = {
432
434
  /** A boolean value stating if the field is hiding its errors */
433
435
  hideError?: boolean;
434
436
  /** The schema object for this array */
435
- schema: RJSFSchema;
437
+ schema: S;
436
438
  /** The uiSchema object for this array field */
437
- uiSchema?: UiSchema<T, F>;
439
+ uiSchema?: UiSchema<T, S, F>;
438
440
  /** A string value containing the title for the array */
439
441
  title: string;
440
442
  /** The `formContext` object that was passed to Form */
@@ -444,7 +446,7 @@ declare type ArrayFieldTemplateProps<T = any, F = any> = {
444
446
  /** An array of strings listing all generated error messages from encountered errors for this widget */
445
447
  rawErrors?: string[];
446
448
  /** The `registry` object */
447
- registry: Registry<T, F>;
449
+ registry: Registry<T, S, F>;
448
450
  };
449
451
  /** The properties of each element in the ObjectFieldTemplateProps.properties array */
450
452
  declare type ObjectFieldTemplatePropertyType = {
@@ -460,7 +462,7 @@ declare type ObjectFieldTemplatePropertyType = {
460
462
  hidden: boolean;
461
463
  };
462
464
  /** The properties that are passed to an ObjectFieldTemplate implementation */
463
- declare type ObjectFieldTemplateProps<T = any, F = any> = {
465
+ declare type ObjectFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
464
466
  /** A string value containing the title for the object */
465
467
  title: string;
466
468
  /** A string value containing the description for the object */
@@ -470,7 +472,7 @@ declare type ObjectFieldTemplateProps<T = any, F = any> = {
470
472
  /** An array of objects representing the properties in the object */
471
473
  properties: ObjectFieldTemplatePropertyType[];
472
474
  /** Returns a function that adds a new property to the object (to be used with additionalProperties) */
473
- onAddClick: (schema: RJSFSchema) => () => void;
475
+ onAddClick: (schema: S) => () => void;
474
476
  /** A boolean value stating if the object is read-only */
475
477
  readonly?: boolean;
476
478
  /** A boolean value stating if the object is required */
@@ -478,9 +480,9 @@ declare type ObjectFieldTemplateProps<T = any, F = any> = {
478
480
  /** A boolean value stating if the field is hiding its errors */
479
481
  hideError?: boolean;
480
482
  /** The schema object for this object */
481
- schema: RJSFSchema;
483
+ schema: S;
482
484
  /** The uiSchema object for this object field */
483
- uiSchema?: UiSchema<T, F>;
485
+ uiSchema?: UiSchema<T, S, F>;
484
486
  /** An object containing the id for this object & ids for its properties */
485
487
  idSchema: IdSchema<T>;
486
488
  /** The form data for the object */
@@ -488,21 +490,21 @@ declare type ObjectFieldTemplateProps<T = any, F = any> = {
488
490
  /** The `formContext` object that was passed to Form */
489
491
  formContext?: F;
490
492
  /** The `registry` object */
491
- registry: Registry<T, F>;
493
+ registry: Registry<T, S, F>;
492
494
  };
493
495
  /** The properties that are passed to a WrapIfAdditionalTemplate implementation */
494
- declare type WrapIfAdditionalTemplateProps<T = any, F = any> = {
496
+ declare type WrapIfAdditionalTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
495
497
  /** The field or widget component instance for this field row */
496
498
  children: React.ReactNode;
497
- } & Pick<FieldTemplateProps<T, F>, "id" | "classNames" | "label" | "required" | "readonly" | "disabled" | "schema" | "uiSchema" | "onKeyChange" | "onDropPropertyClick" | "registry">;
499
+ } & Pick<FieldTemplateProps<T, S, F>, "id" | "classNames" | "label" | "required" | "readonly" | "disabled" | "schema" | "uiSchema" | "onKeyChange" | "onDropPropertyClick" | "registry">;
498
500
  /** The properties that are passed to a Widget implementation */
499
- interface WidgetProps<T = any, F = any> extends GenericObjectType, Pick<React.HTMLAttributes<HTMLElement>, Exclude<keyof React.HTMLAttributes<HTMLElement>, "onBlur" | "onFocus">> {
501
+ interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<React.HTMLAttributes<HTMLElement>, Exclude<keyof React.HTMLAttributes<HTMLElement>, "onBlur" | "onFocus">> {
500
502
  /** The generated id for this widget */
501
503
  id: string;
502
504
  /** The JSONSchema subschema object for this widget */
503
- schema: RJSFSchema;
505
+ schema: S;
504
506
  /** The uiSchema for this widget */
505
- uiSchema?: UiSchema<T, F>;
507
+ uiSchema?: UiSchema<T, S, F>;
506
508
  /** The current value for this widget */
507
509
  value: any;
508
510
  /** The required status of this widget */
@@ -520,7 +522,7 @@ interface WidgetProps<T = any, F = any> extends GenericObjectType, Pick<React.HT
520
522
  /** A map of UI Options passed as a prop to the component, including the optional `enumOptions`
521
523
  * which is a special case on top of `UIOptionsType` needed only by widgets
522
524
  */
523
- options: NonNullable<UIOptionsType<T, F>> & {
525
+ options: NonNullable<UIOptionsType<T, S, F>> & {
524
526
  /** The enum options list for a type that supports them */
525
527
  enumOptions?: EnumOptionsType[];
526
528
  };
@@ -539,23 +541,23 @@ interface WidgetProps<T = any, F = any> extends GenericObjectType, Pick<React.HT
539
541
  /** An array of strings listing all generated error messages from encountered errors for this widget */
540
542
  rawErrors?: string[];
541
543
  /** The `registry` object */
542
- registry: Registry<T, F>;
544
+ registry: Registry<T, S, F>;
543
545
  }
544
546
  /** The definition of a React-based Widget component */
545
- declare type Widget<T = any, F = any> = React.ComponentType<WidgetProps<T, F>>;
547
+ declare type Widget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = React.ComponentType<WidgetProps<T, S, F>>;
546
548
  /** The type that defines the props used by the Submit button */
547
- declare type SubmitButtonProps<T = any, F = any> = {
549
+ declare type SubmitButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
548
550
  /** The uiSchema for this widget */
549
- uiSchema?: UiSchema<T, F>;
551
+ uiSchema?: UiSchema<T, S, F>;
550
552
  };
551
553
  /** The type that defines the props for an Icon button, extending from a basic HTML button attributes */
552
- declare type IconButtonProps<T = any, F = any> = React.ButtonHTMLAttributes<HTMLButtonElement> & {
554
+ declare type IconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = React.ButtonHTMLAttributes<HTMLButtonElement> & {
553
555
  /** An alternative specification for the type of the icon button */
554
556
  iconType?: string;
555
557
  /** The name representation or actual react element implementation for the icon */
556
558
  icon?: string | React.ReactElement;
557
559
  /** The uiSchema for this widget */
558
- uiSchema?: UiSchema<T, F>;
560
+ uiSchema?: UiSchema<T, S, F>;
559
561
  };
560
562
  /** The type that defines how to change the behavior of the submit button for the form */
561
563
  declare type UISchemaSubmitButtonOptions = {
@@ -572,13 +574,13 @@ declare type UISchemaSubmitButtonOptions = {
572
574
  };
573
575
  };
574
576
  /** This type represents an element used to render an enum option */
575
- declare type EnumOptionsType = {
577
+ declare type EnumOptionsType<S extends StrictRJSFSchema = RJSFSchema> = {
576
578
  /** The value for the enum option */
577
579
  value: any;
578
580
  /** The label for the enum options */
579
581
  label: string;
580
582
  /** The schema associated with the enum option when the option represents a `oneOf` or `anyOf` choice */
581
- schema?: RJSFSchema;
583
+ schema?: S;
582
584
  };
583
585
  /** This type remaps the keys of `Type` to prepend `ui:` onto them. As a result it does not need to be exported */
584
586
  declare type MakeUIType<Type> = {
@@ -587,7 +589,7 @@ declare type MakeUIType<Type> = {
587
589
  /** This type represents all the known supported options in the `ui:options` property, kept separate in order to
588
590
  * remap the keys. It also contains all the properties, optionally, of `TemplatesType` except "ButtonTemplates"
589
591
  */
590
- declare type UIOptionsBaseType<T = any, F = any> = Partial<Omit<TemplatesType<T, F>, "ButtonTemplates">> & {
592
+ declare type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<Omit<TemplatesType<T, S, F>, "ButtonTemplates">> & {
591
593
  /** Any classnames that the user wants to be applied to a field in the ui */
592
594
  classNames?: string;
593
595
  /** We know that for title, it will be a string, if it is provided */
@@ -635,29 +637,29 @@ declare type UIOptionsBaseType<T = any, F = any> = Partial<Omit<TemplatesType<T,
635
637
  /** Allows RJSF to override the default widget implementation by specifying either the name of a widget that is used
636
638
  * to look up an implementation from the `widgets` list or an actual one-off widget implementation itself
637
639
  */
638
- widget?: Widget<T, F> | string;
640
+ widget?: Widget<T, S, F> | string;
639
641
  /** When using `additionalProperties`, key collision is prevented by appending a unique integer to the duplicate key.
640
642
  * This option allows you to change the separator between the original key name and the integer. Default is "-"
641
643
  */
642
644
  duplicateKeySuffixSeparator?: string;
643
645
  };
644
646
  /** The type that represents the Options potentially provided by `ui:options` */
645
- declare type UIOptionsType<T = any, F = any> = UIOptionsBaseType<T, F> & {
647
+ declare type UIOptionsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = UIOptionsBaseType<T, S, F> & {
646
648
  /** Anything else will be one of these types */
647
649
  [key: string]: boolean | number | string | object | any[] | null | undefined;
648
650
  };
649
651
  /** Type describing the well-known properties of the `UiSchema` while also supporting all user defined properties,
650
652
  * starting with `ui:`.
651
653
  */
652
- declare type UiSchema<T = any, F = any> = GenericObjectType & MakeUIType<UIOptionsBaseType<T, F>> & {
654
+ declare type UiSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = GenericObjectType & MakeUIType<UIOptionsBaseType<T, S, F>> & {
653
655
  /** Allows the form to generate a unique prefix for the `Form`'s root prefix */
654
656
  "ui:rootFieldId"?: string;
655
657
  /** Allows RJSF to override the default field implementation by specifying either the name of a field that is used
656
658
  * to look up an implementation from the `fields` list or an actual one-off `Field` component implementation itself
657
659
  */
658
- "ui:field"?: Field<T, F> | string;
659
- /** An object that contains all of the potential UI options in a single object */
660
- "ui:options"?: UIOptionsType<T, F>;
660
+ "ui:field"?: Field<T, S, F> | string;
661
+ /** An object that contains all the potential UI options in a single object */
662
+ "ui:options"?: UIOptionsType<T, S, F>;
661
663
  };
662
664
  /** A `CustomValidator` function takes in a `formData` and `errors` object and returns the given `errors` object back,
663
665
  * while potentially adding additional messages to the `errors`
@@ -677,7 +679,7 @@ declare type ValidationData<T> = {
677
679
  /** The interface that describes the validation functions that are provided by a Validator implementation used by the
678
680
  * schema utilities.
679
681
  */
680
- interface ValidatorType<T = any> {
682
+ interface ValidatorType<T = any, S extends StrictRJSFSchema = RJSFSchema> {
681
683
  /** This function processes the `formData` with an optional user contributed `customValidate` function, which receives
682
684
  * the form data and a `errorHandler` function that will be used to add custom validation errors for each field. Also
683
685
  * supports a `transformErrors` function that will take the raw AJV validation errors, prior to custom validation and
@@ -688,7 +690,7 @@ interface ValidatorType<T = any> {
688
690
  * @param [customValidate] - An optional function that is used to perform custom validation
689
691
  * @param [transformErrors] - An optional function that is used to transform errors after AJV validation
690
692
  */
691
- validateFormData(formData: T, schema: RJSFSchema, customValidate?: CustomValidator<T>, transformErrors?: ErrorTransformer): ValidationData<T>;
693
+ validateFormData(formData: T | undefined, schema: S, customValidate?: CustomValidator<T>, transformErrors?: ErrorTransformer): ValidationData<T>;
692
694
  /** Converts an `errorSchema` into a list of `RJSFValidationErrors`
693
695
  *
694
696
  * @param errorSchema - The `ErrorSchema` instance to convert
@@ -700,22 +702,32 @@ interface ValidatorType<T = any> {
700
702
  * false.
701
703
  *
702
704
  * @param schema - The schema against which to validate the form data * @param schema
703
- * @param formData- - The form data to validate
705
+ * @param formData - The form data to validate
704
706
  * @param rootSchema - The root schema used to provide $ref resolutions
705
707
  */
706
- isValid(schema: RJSFSchema, formData: T, rootSchema: RJSFSchema): boolean;
708
+ isValid(schema: S, formData: T, rootSchema: S): boolean;
709
+ /** Runs the pure validation of the `schema` and `formData` without any of the RJSF functionality. Provided for use
710
+ * by the playground. Returns the `errors` from the validation
711
+ *
712
+ * @param schema - The schema against which to validate the form data * @param schema
713
+ * @param formData - The form data to validate
714
+ */
715
+ rawValidation<Result = any>(schema: S, formData?: T): {
716
+ errors?: Result[];
717
+ validationError?: Error;
718
+ };
707
719
  }
708
720
  /** The `SchemaUtilsType` interface provides a wrapper around the publicly exported APIs in the `@rjsf/utils/schema`
709
721
  * directory such that one does not have to explicitly pass the `validator` or `rootSchema` to each method. Since both
710
722
  * the `validator` and `rootSchema` generally does not change across a `Form`, this allows for providing a simplified
711
723
  * set of APIs to the `@rjsf/core` components and the various themes as well.
712
724
  */
713
- interface SchemaUtilsType<T = any> {
725
+ interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
714
726
  /** Returns the `ValidatorType` in the `SchemaUtilsType`
715
727
  *
716
728
  * @returns - The `ValidatorType`
717
729
  */
718
- getValidator(): ValidatorType<T>;
730
+ getValidator(): ValidatorType<T, S>;
719
731
  /** Determines whether either the `validator` and `rootSchema` differ from the ones associated with this instance of
720
732
  * the `SchemaUtilsType`. If either `validator` or `rootSchema` are falsy, then return false to prevent the creation
721
733
  * of a new `SchemaUtilsType` with incomplete properties.
@@ -724,7 +736,7 @@ interface SchemaUtilsType<T = any> {
724
736
  * @param rootSchema - The root schema that will be compared against the current one
725
737
  * @returns - True if the `SchemaUtilsType` differs from the given `validator` or `rootSchema`
726
738
  */
727
- doesSchemaUtilsDiffer(validator: ValidatorType, rootSchema: RJSFSchema): boolean;
739
+ doesSchemaUtilsDiffer(validator: ValidatorType<T, S>, rootSchema: S): boolean;
728
740
  /** Returns the superset of `formData` that includes the given set updated to include any missing fields that have
729
741
  * computed to have defaults provided in the `schema`.
730
742
  *
@@ -733,7 +745,7 @@ interface SchemaUtilsType<T = any> {
733
745
  * @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults
734
746
  * @returns - The resulting `formData` with all the defaults provided
735
747
  */
736
- getDefaultFormState(schema: RJSFSchema, formData?: T, includeUndefinedValues?: boolean): T | T[] | undefined;
748
+ getDefaultFormState(schema: S, formData?: T, includeUndefinedValues?: boolean): T | T[] | undefined;
737
749
  /** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
738
750
  * should be displayed in a UI.
739
751
  *
@@ -741,39 +753,38 @@ interface SchemaUtilsType<T = any> {
741
753
  * @param [uiSchema] - The UI schema from which to derive potentially displayable information
742
754
  * @returns - True if the label should be displayed or false if it should not
743
755
  */
744
- getDisplayLabel<F = any>(schema: RJSFSchema, uiSchema?: UiSchema<T, F>): boolean;
756
+ getDisplayLabel(schema: S, uiSchema?: UiSchema<T, S, F>): boolean;
745
757
  /** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.
746
758
  *
747
759
  * @param formData - The current formData, if any, onto which to provide any missing defaults
748
760
  * @param options - The list of options to find a matching options from
749
761
  * @returns - The index of the matched option or 0 if none is available
750
762
  */
751
- getMatchingOption(formData: T, options: RJSFSchema[]): number;
763
+ getMatchingOption(formData: T, options: S[]): number;
752
764
  /** Checks to see if the `schema` and `uiSchema` combination represents an array of files
753
765
  *
754
766
  * @param schema - The schema for which check for array of files flag is desired
755
767
  * @param [uiSchema] - The UI schema from which to check the widget
756
768
  * @returns - True if schema/uiSchema contains an array of files, otherwise false
757
769
  */
758
- isFilesArray<F = any>(schema: RJSFSchema, uiSchema?: UiSchema<T, F>): boolean;
770
+ isFilesArray(schema: S, uiSchema?: UiSchema<T, S, F>): boolean;
759
771
  /** Checks to see if the `schema` combination represents a multi-select
760
772
  *
761
773
  * @param schema - The schema for which check for a multi-select flag is desired
762
774
  * @returns - True if schema contains a multi-select, otherwise false
763
775
  */
764
- isMultiSelect(schema: RJSFSchema): boolean;
776
+ isMultiSelect(schema: S): boolean;
765
777
  /** Checks to see if the `schema` combination represents a select
766
778
  *
767
779
  * @param schema - The schema for which check for a select flag is desired
768
780
  * @returns - True if schema contains a select, otherwise false
769
781
  */
770
- isSelect(schema: RJSFSchema): boolean;
782
+ isSelect(schema: S): boolean;
771
783
  /** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
772
784
  * two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
773
785
  * `validator.toErrorList()` onto the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
774
786
  * `validationData` is returned.
775
787
  *
776
- * @param validator - The validator used to convert an ErrorSchema to a list of errors
777
788
  * @param validationData - The current `ValidationData` into which to merge the additional errors
778
789
  * @param [additionalErrorSchema] - The additional set of errors
779
790
  * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
@@ -784,10 +795,10 @@ interface SchemaUtilsType<T = any> {
784
795
  * recursive resolution.
785
796
  *
786
797
  * @param schema - The schema for which retrieving a schema is desired
787
- * @param [rawFormData] - The current formData, if any, to assist retrieving a schema
798
+ * @param [formData] - The current formData, if any, to assist retrieving a schema
788
799
  * @returns - The schema having its conditions, additional properties, references and dependencies resolved
789
800
  */
790
- retrieveSchema(schema: RJSFSchema, formData?: T): RJSFSchema;
801
+ retrieveSchema(schema: S, formData?: T): S;
791
802
  /** Generates an `IdSchema` object for the `schema`, recursively
792
803
  *
793
804
  * @param schema - The schema for which the display label flag is desired
@@ -797,7 +808,7 @@ interface SchemaUtilsType<T = any> {
797
808
  * @param [idSeparator='_'] - The separator to use for the path segments in the id
798
809
  * @returns - The `IdSchema` object for the `schema`
799
810
  */
800
- toIdSchema(schema: RJSFSchema, id?: string, formData?: T, idPrefix?: string, idSeparator?: string): IdSchema<T>;
811
+ toIdSchema(schema: S, id?: string, formData?: T, idPrefix?: string, idSeparator?: string): IdSchema<T>;
801
812
  /** Generates an `PathSchema` object for the `schema`, recursively
802
813
  *
803
814
  * @param schema - The schema for which the display label flag is desired
@@ -805,7 +816,7 @@ interface SchemaUtilsType<T = any> {
805
816
  * @param [formData] - The current formData, if any, onto which to provide any missing defaults
806
817
  * @returns - The `PathSchema` object for the `schema`
807
818
  */
808
- toPathSchema(schema: RJSFSchema, name?: string, formData?: T): PathSchema<T>;
819
+ toPathSchema(schema: S, name?: string, formData?: T): PathSchema<T>;
809
820
  }
810
821
 
811
822
  /** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
@@ -814,7 +825,7 @@ interface SchemaUtilsType<T = any> {
814
825
  * @param schema - The schema object to check
815
826
  * @returns - True if additional items is allowed, otherwise false
816
827
  */
817
- declare function allowAdditionalItems(schema: RJSFSchema): boolean;
828
+ declare function allowAdditionalItems<S extends StrictRJSFSchema = RJSFSchema>(schema: S): boolean;
818
829
 
819
830
  /** Attempts to convert the string into a number. If an empty string is provided, then `undefined` is returned. If a
820
831
  * `null` is provided, it is returned. If the string ends in a `.` then the string is returned because the user may be
@@ -836,7 +847,7 @@ declare function asNumber(value: string | null): string | number | null | undefi
836
847
  * @param [formData] - The formData for the field
837
848
  * @returns - True if the schema element has additionalProperties, is expandable, and not at the maxProperties limit
838
849
  */
839
- declare function canExpand<T = any, F = any>(schema: RJSFSchema, uiSchema?: UiSchema<T, F>, formData?: T): boolean;
850
+ declare function canExpand<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: RJSFSchema, uiSchema?: UiSchema<T, S, F>, formData?: T): boolean;
840
851
 
841
852
  /** Creates a `SchemaUtilsType` interface that is based around the given `validator` and `rootSchema` parameters. The
842
853
  * resulting interface implementation will forward the `validator` and `rootSchema` to all the wrapped APIs.
@@ -845,7 +856,7 @@ declare function canExpand<T = any, F = any>(schema: RJSFSchema, uiSchema?: UiSc
845
856
  * @param rootSchema - The root schema that will be forwarded to all the APIs
846
857
  * @returns - An implementation of a `SchemaUtilsType` interface
847
858
  */
848
- declare function createSchemaUtils<T = any>(validator: ValidatorType, rootSchema: RJSFSchema): SchemaUtilsType<T>;
859
+ declare function createSchemaUtils<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S>, rootSchema: S): SchemaUtilsType<T, S, F>;
849
860
 
850
861
  /** Given the `FileReader.readAsDataURL()` based `dataURI` extracts that data into an actual Blob along with the name
851
862
  * of that Blob if provided in the URL. If no name is provided, then the name falls back to `unknown`.
@@ -876,7 +887,7 @@ declare function deepEquals(a: any, b: any): boolean;
876
887
  * @returns - The sub-schema within the `rootSchema` which matches the `$ref` if it exists
877
888
  * @throws - Error indicating that no schema for that reference exists
878
889
  */
879
- declare function findSchemaDefinition($ref?: string, rootSchema?: RJSFSchema): RJSFSchema;
890
+ declare function findSchemaDefinition<S extends StrictRJSFSchema = RJSFSchema>($ref?: string, rootSchema?: S): S;
880
891
 
881
892
  /** Using the `schema`, `defaultType` and `options`, extract out the props for the <input> element that make sense.
882
893
  *
@@ -886,7 +897,7 @@ declare function findSchemaDefinition($ref?: string, rootSchema?: RJSFSchema): R
886
897
  * @param [autoDefaultStepAny=true] - Determines whether to auto-default step=any when the type is number and no step
887
898
  * @returns - The extracted `InputPropsType` object
888
899
  */
889
- declare function getInputProps<T = any, F = any>(schema: RJSFSchema, defaultType?: string, options?: UIOptionsType<T, F>, autoDefaultStepAny?: boolean): InputPropsType;
900
+ declare function getInputProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: RJSFSchema, defaultType?: string, options?: UIOptionsType<T, S, F>, autoDefaultStepAny?: boolean): InputPropsType;
890
901
 
891
902
  /** Gets the type of a given `schema`. If the type is not explicitly defined, then an attempt is made to infer it from
892
903
  * other elements of the schema as follows:
@@ -899,14 +910,14 @@ declare function getInputProps<T = any, F = any>(schema: RJSFSchema, defaultType
899
910
  * @param schema - The schema for which to get the type
900
911
  * @returns - The type of the schema
901
912
  */
902
- declare function getSchemaType(schema: RJSFSchema): string | string[] | undefined;
913
+ declare function getSchemaType<S extends StrictRJSFSchema = RJSFSchema>(schema: S): string | string[] | undefined;
903
914
 
904
915
  /** Extracts any `ui:submitButtonOptions` from the `uiSchema` and merges them onto the `DEFAULT_OPTIONS`
905
916
  *
906
917
  * @param [uiSchema={}] - the UI Schema from which to extract submit button props
907
918
  * @returns - The merging of the `DEFAULT_OPTIONS` with any custom ones
908
919
  */
909
- declare function getSubmitButtonOptions<T = any, F = any>(uiSchema?: UiSchema<T, F>): UISchemaSubmitButtonOptions;
920
+ declare function getSubmitButtonOptions<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(uiSchema?: UiSchema<T, S, F>): UISchemaSubmitButtonOptions;
910
921
 
911
922
  /** Returns the template with the given `name` from either the `uiSchema` if it is defined or from the `registry`
912
923
  * otherwise. NOTE, since `ButtonTemplates` are not overridden in `uiSchema` only those in the `registry` are returned.
@@ -916,15 +927,15 @@ declare function getSubmitButtonOptions<T = any, F = any>(uiSchema?: UiSchema<T,
916
927
  * @param [uiOptions={}] - The `UIOptionsType` from which to read an alternate template
917
928
  * @returns - The template from either the `uiSchema` or `registry` for the `name`
918
929
  */
919
- declare function getTemplate<Name extends keyof TemplatesType<T, F>, T = any, F = any>(name: Name, registry: Registry<T, F>, uiOptions?: UIOptionsType<T, F>): TemplatesType<T, F>[Name];
930
+ declare function getTemplate<Name extends keyof TemplatesType<T, S, F>, T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(name: Name, registry: Registry<T, S, F>, uiOptions?: UIOptionsType<T, S, F>): TemplatesType<T, S, F>[Name];
920
931
 
921
932
  /** Get all passed options from ui:options, and ui:<optionName>, returning them in an object with the `ui:`
922
933
  * stripped off.
923
934
  *
924
935
  * @param [uiSchema={}] - The UI Schema from which to get any `ui:xxx` options
925
- * @returns - An object containing all of the `ui:xxx` options with the stripped off
936
+ * @returns - An object containing all the `ui:xxx` options with the stripped off
926
937
  */
927
- declare function getUiOptions<T = any, F = any>(uiSchema?: UiSchema<T, F>): UIOptionsType<T, F>;
938
+ declare function getUiOptions<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(uiSchema?: UiSchema<T, S, F>): UIOptionsType<T, S, F>;
928
939
 
929
940
  /** Given a schema representing a field to render and either the name or actual `Widget` implementation, returns the
930
941
  * React component that is used to render the widget. If the `widget` is already a React component, then it is wrapped
@@ -937,7 +948,7 @@ declare function getUiOptions<T = any, F = any>(uiSchema?: UiSchema<T, F>): UIOp
937
948
  * @returns - The `Widget` component to use
938
949
  * @throws - An error if there is no `Widget` component that can be returned
939
950
  */
940
- declare function getWidget<T = any, F = any>(schema: RJSFSchema, widget?: Widget<T, F> | string, registeredWidgets?: RegistryWidgetsType<T, F>): Widget<T, F>;
951
+ declare function getWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: RJSFSchema, widget?: Widget<T, S, F> | string, registeredWidgets?: RegistryWidgetsType<T, S, F>): Widget<T, S, F>;
941
952
 
942
953
  /** Given a specific `value` attempts to guess the type of a schema element. In the case where we have to implicitly
943
954
  * create a schema, it is useful to know what type to use based on the data we are defining.
@@ -955,7 +966,7 @@ declare function guessType(value: any): "array" | "string" | "null" | "boolean"
955
966
  * @param [registeredWidgets={}] - A registry of widget name to `Widget` implementation
956
967
  * @returns - True if the widget exists, false otherwise
957
968
  */
958
- declare function hasWidget<T = any, F = any>(schema: RJSFSchema, widget: Widget<T, F> | string, registeredWidgets?: RegistryWidgetsType<T, F>): boolean;
969
+ declare function hasWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: RJSFSchema, widget: Widget<T, S, F> | string, registeredWidgets?: RegistryWidgetsType<T, S, F>): boolean;
959
970
 
960
971
  /** This function checks if the given `schema` matches a single constant value. This happens when either the schema has
961
972
  * an `enum` array with a single value or there is a `const` defined.
@@ -963,14 +974,14 @@ declare function hasWidget<T = any, F = any>(schema: RJSFSchema, widget: Widget<
963
974
  * @param schema - The schema for a field
964
975
  * @returns - True if the `schema` has a single constant value, false otherwise
965
976
  */
966
- declare function isConstant(schema: RJSFSchema): boolean;
977
+ declare function isConstant<S extends StrictRJSFSchema = RJSFSchema>(schema: S): boolean;
967
978
 
968
979
  /** Checks to see if the `uiSchema` contains the `widget` field and that the widget is not `hidden`
969
980
  *
970
981
  * @param uiSchema - The UI Schema from which to detect if it is customized
971
982
  * @returns - True if the `uiSchema` describes a custom widget, false otherwise
972
983
  */
973
- declare function isCustomWidget<T = any, F = any>(uiSchema?: UiSchema<T, F>): boolean;
984
+ declare function isCustomWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(uiSchema?: UiSchema<T, S, F>): boolean;
974
985
 
975
986
  /** Detects whether the given `schema` contains fixed items. This is the case when `schema.items` is a non-empty array
976
987
  * that only contains objects.
@@ -978,7 +989,7 @@ declare function isCustomWidget<T = any, F = any>(uiSchema?: UiSchema<T, F>): bo
978
989
  * @param schema - The schema in which to check for fixed items
979
990
  * @returns - True if there are fixed items in the schema, false otherwise
980
991
  */
981
- declare function isFixedItems(schema: RJSFSchema): boolean;
992
+ declare function isFixedItems<S extends StrictRJSFSchema = RJSFSchema>(schema: S): boolean;
982
993
 
983
994
  /** Determines whether a `thing` is an object for the purposes of RSJF. In this case, `thing` is an object if it has
984
995
  * the type `object` but is NOT null, an array or a File.
@@ -1038,7 +1049,7 @@ declare function mergeSchemas(obj1: GenericObjectType, obj2: GenericObjectType):
1038
1049
  * @param schema - The schema from which to extract the options list
1039
1050
  * @returns - The list of options from the schema
1040
1051
  */
1041
- declare function optionsList(schema: RJSFSchema): EnumOptionsType[] | undefined;
1052
+ declare function optionsList<S extends StrictRJSFSchema = RJSFSchema>(schema: S): EnumOptionsType<S>[] | undefined;
1042
1053
 
1043
1054
  /** Given a list of `properties` and an `order` list, returns a list that contains the `properties` ordered correctly.
1044
1055
  * If `order` is not an array, then the untouched `properties` list is returned. Otherwise `properties` is ordered per
@@ -1078,7 +1089,7 @@ declare function parseDateString(dateString?: string, includeTime?: boolean): Da
1078
1089
  * @param [options] - The UIOptionsType from which to potentially extract the emptyValue
1079
1090
  * @returns - The `value` converted to the proper type
1080
1091
  */
1081
- declare function processSelectValue<T = any, F = any>(schema: RJSFSchema, value?: any, options?: UIOptionsType<T, F>): any;
1092
+ declare function processSelectValue<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(schema: S, value?: any, options?: UIOptionsType<T, S, F>): any;
1082
1093
 
1083
1094
  /** Extracts the range spec information `{ step?: number, min?: number, max?: number }` that can be spread onto an HTML
1084
1095
  * input from the range analog in the schema `{ multipleOf?: number, minimum?: number, maximum?: number }`.
@@ -1086,7 +1097,7 @@ declare function processSelectValue<T = any, F = any>(schema: RJSFSchema, value?
1086
1097
  * @param schema - The schema from which to extract the range spec
1087
1098
  * @returns - A range specification from the schema
1088
1099
  */
1089
- declare function rangeSpec(schema: RJSFSchema): RangeSpecType;
1100
+ declare function rangeSpec<S extends StrictRJSFSchema = RJSFSchema>(schema: S): RangeSpecType;
1090
1101
 
1091
1102
  /** Check to see if a `schema` specifies that a value must be true. This happens when:
1092
1103
  * - `schema.const` is truthy
@@ -1097,7 +1108,7 @@ declare function rangeSpec(schema: RJSFSchema): RangeSpecType;
1097
1108
  * @param schema - The schema to check
1098
1109
  * @returns - True if the schema specifies a value that must be true, false otherwise
1099
1110
  */
1100
- declare function schemaRequiresTrueValue(schema: RJSFSchema): boolean;
1111
+ declare function schemaRequiresTrueValue<S extends StrictRJSFSchema = RJSFSchema>(schema: S): boolean;
1101
1112
 
1102
1113
  /** Determines whether the given `component` should be rerendered by comparing its current set of props and state
1103
1114
  * against the next set. If either of those two sets are not the same, then the component should be rerendered.
@@ -1116,7 +1127,7 @@ declare function shouldRender(component: React.Component, nextProps: any, nextSt
1116
1127
  * @returns - The constant value for the schema
1117
1128
  * @throws - Error when the schema does not have a constant value
1118
1129
  */
1119
- declare function toConstant(schema: RJSFSchema): json_schema.JSONSchema7Type | undefined;
1130
+ declare function toConstant<S extends StrictRJSFSchema = RJSFSchema>(schema: S): json_schema.JSONSchema7Type | undefined;
1120
1131
 
1121
1132
  /** Returns a UTC date string for the given `dateObject`. If `time` is false, then the time portion of the string is
1122
1133
  * removed.
@@ -1172,7 +1183,7 @@ declare const UI_OPTIONS_KEY = "ui:options";
1172
1183
  * @param [includeUndefinedValues=false] - Optional flag, if true, cause undefined values to be added as defaults
1173
1184
  * @returns - The resulting `formData` with all the defaults provided
1174
1185
  */
1175
- declare function getDefaultFormState<T = any>(validator: ValidatorType, theSchema: RJSFSchema, formData?: T, rootSchema?: RJSFSchema, includeUndefinedValues?: boolean): T | T[] | undefined;
1186
+ declare function getDefaultFormState<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, theSchema: S, formData?: T, rootSchema?: S, includeUndefinedValues?: boolean): T | T[] | undefined;
1176
1187
 
1177
1188
  /** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
1178
1189
  * should be displayed in a UI.
@@ -1183,7 +1194,7 @@ declare function getDefaultFormState<T = any>(validator: ValidatorType, theSchem
1183
1194
  * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
1184
1195
  * @returns - True if the label should be displayed or false if it should not
1185
1196
  */
1186
- declare function getDisplayLabel<T = any, F = any>(validator: ValidatorType, schema: RJSFSchema, uiSchema?: UiSchema<T, F>, rootSchema?: RJSFSchema): boolean;
1197
+ declare function getDisplayLabel<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S>, schema: S, uiSchema?: UiSchema<T, S, F>, rootSchema?: S): boolean;
1187
1198
 
1188
1199
  /** Given the `formData` and list of `options`, attempts to find the index of the option that best matches the data.
1189
1200
  *
@@ -1193,7 +1204,7 @@ declare function getDisplayLabel<T = any, F = any>(validator: ValidatorType, sch
1193
1204
  * @param rootSchema - The root schema, used to primarily to look up `$ref`s
1194
1205
  * @returns - The index of the matched option or 0 if none is available
1195
1206
  */
1196
- declare function getMatchingOption<T = any>(validator: ValidatorType, formData: T | undefined, options: RJSFSchema[], rootSchema: RJSFSchema): number;
1207
+ declare function getMatchingOption<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, formData: T | undefined, options: S[], rootSchema: S): number;
1197
1208
 
1198
1209
  /** Checks to see if the `schema` and `uiSchema` combination represents an array of files
1199
1210
  *
@@ -1203,7 +1214,7 @@ declare function getMatchingOption<T = any>(validator: ValidatorType, formData:
1203
1214
  * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
1204
1215
  * @returns - True if schema/uiSchema contains an array of files, otherwise false
1205
1216
  */
1206
- declare function isFilesArray<T = any, F = any>(validator: ValidatorType, schema: RJSFSchema, uiSchema?: UiSchema<T, F>, rootSchema?: RJSFSchema): boolean;
1217
+ declare function isFilesArray<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S>, schema: S, uiSchema?: UiSchema<T, S, F>, rootSchema?: S): boolean;
1207
1218
 
1208
1219
  /** Checks to see if the `schema` combination represents a multi-select
1209
1220
  *
@@ -1212,7 +1223,7 @@ declare function isFilesArray<T = any, F = any>(validator: ValidatorType, schema
1212
1223
  * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
1213
1224
  * @returns - True if schema contains a multi-select, otherwise false
1214
1225
  */
1215
- declare function isMultiSelect<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema?: RJSFSchema): boolean;
1226
+ declare function isMultiSelect<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, schema: S, rootSchema?: S): boolean;
1216
1227
 
1217
1228
  /** Checks to see if the `schema` combination represents a select
1218
1229
  *
@@ -1221,7 +1232,7 @@ declare function isMultiSelect<T = any>(validator: ValidatorType, schema: RJSFSc
1221
1232
  * @param [rootSchema] - The root schema, used to primarily to look up `$ref`s
1222
1233
  * @returns - True if schema contains a select, otherwise false
1223
1234
  */
1224
- declare function isSelect<T = any>(validator: ValidatorType, theSchema: RJSFSchema, rootSchema?: RJSFSchema): boolean;
1235
+ declare function isSelect<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, theSchema: S, rootSchema?: S): boolean;
1225
1236
 
1226
1237
  /** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
1227
1238
  * two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
@@ -1233,19 +1244,19 @@ declare function isSelect<T = any>(validator: ValidatorType, theSchema: RJSFSche
1233
1244
  * @param [additionalErrorSchema] - The additional set of errors in an `ErrorSchema`
1234
1245
  * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
1235
1246
  */
1236
- declare function mergeValidationData<T = any>(validator: ValidatorType<T>, validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;
1247
+ declare function mergeValidationData<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>): ValidationData<T>;
1237
1248
 
1238
1249
  /** Retrieves an expanded schema that has had all of its conditions, additional properties, references and dependencies
1239
1250
  * resolved and merged into the `schema` given a `validator`, `rootSchema` and `rawFormData` that is used to do the
1240
1251
  * potentially recursive resolution.
1241
1252
  *
1242
- * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
1253
+ * @param validator - An implementation of the `ValidatorType<T, S>` interface that will be forwarded to all the APIs
1243
1254
  * @param schema - The schema for which retrieving a schema is desired
1244
1255
  * @param [rootSchema={}] - The root schema that will be forwarded to all the APIs
1245
1256
  * @param [rawFormData] - The current formData, if any, to assist retrieving a schema
1246
1257
  * @returns - The schema having its conditions, additional properties, references and dependencies resolved
1247
1258
  */
1248
- declare function retrieveSchema<T = any>(validator: ValidatorType, schema: RJSFSchema, rootSchema?: RJSFSchema, rawFormData?: T): RJSFSchema;
1259
+ declare function retrieveSchema<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, schema: S, rootSchema?: S, rawFormData?: T): S;
1249
1260
 
1250
1261
  /** Generates an `IdSchema` object for the `schema`, recursively
1251
1262
  *
@@ -1258,7 +1269,7 @@ declare function retrieveSchema<T = any>(validator: ValidatorType, schema: RJSFS
1258
1269
  * @param [idSeparator='_'] - The separator to use for the path segments in the id
1259
1270
  * @returns - The `IdSchema` object for the `schema`
1260
1271
  */
1261
- declare function toIdSchema<T = any>(validator: ValidatorType, schema: RJSFSchema, id?: string | null, rootSchema?: RJSFSchema, formData?: T, idPrefix?: string, idSeparator?: string): IdSchema<T>;
1272
+ declare function toIdSchema<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, schema: S, id?: string | null, rootSchema?: S, formData?: T, idPrefix?: string, idSeparator?: string): IdSchema<T>;
1262
1273
 
1263
1274
  /** Generates an `PathSchema` object for the `schema`, recursively
1264
1275
  *
@@ -1269,6 +1280,6 @@ declare function toIdSchema<T = any>(validator: ValidatorType, schema: RJSFSchem
1269
1280
  * @param [formData] - The current formData, if any, to assist retrieving a schema
1270
1281
  * @returns - The `PathSchema` object for the `schema`
1271
1282
  */
1272
- declare function toPathSchema<T = any>(validator: ValidatorType, schema: RJSFSchema, name?: string, rootSchema?: RJSFSchema, formData?: T): PathSchema<T>;
1283
+ declare function toPathSchema<T = any, S extends StrictRJSFSchema = RJSFSchema>(validator: ValidatorType<T, S>, schema: S, name?: string, rootSchema?: S, formData?: T): PathSchema<T>;
1273
1284
 
1274
- export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, ArrayFieldDescriptionProps, ArrayFieldTemplateItemType, ArrayFieldTemplateProps, ArrayFieldTitleProps, CONST_KEY, CustomValidator, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, DateObject, DescriptionFieldProps, ENUM_KEY, ERRORS_KEY, EnumOptionsType, ErrorListProps, ErrorSchema, ErrorTransformer, Field, FieldError, FieldErrorProps, FieldErrors, FieldHelpProps, FieldId, FieldPath, FieldProps, FieldTemplateProps, FieldValidation, FormValidation, GenericObjectType, ID_KEY, ITEMS_KEY, IconButtonProps, IdSchema, InputPropsType, NAME_KEY, ONE_OF_KEY, ObjectFieldTemplatePropertyType, ObjectFieldTemplateProps, PROPERTIES_KEY, PathSchema, REF_KEY, REQUIRED_KEY, RJSFSchema, RJSFSchemaDefinition, RJSFValidationError, RJSF_ADDITONAL_PROPERTIES_FLAG, RangeSpecType, Registry, RegistryFieldsType, RegistryWidgetsType, SUBMIT_BTN_OPTIONS_KEY, SchemaUtilsType, SubmitButtonProps, TemplatesType, TitleFieldProps, UIOptionsType, UISchemaSubmitButtonOptions, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, UiSchema, UnsupportedFieldProps, ValidationData, ValidatorType, Widget, WidgetProps, WrapIfAdditionalTemplateProps, allowAdditionalItems, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, findSchemaDefinition, getDefaultFormState, getDisplayLabel, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionsList, orderProperties, pad, parseDateString, processSelectValue, rangeSpec, retrieveSchema, schemaRequiresTrueValue, shouldRender, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };
1285
+ export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, ArrayFieldDescriptionProps, ArrayFieldTemplateItemType, ArrayFieldTemplateProps, ArrayFieldTitleProps, CONST_KEY, CustomValidator, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, DateObject, DescriptionFieldProps, ENUM_KEY, ERRORS_KEY, EnumOptionsType, ErrorListProps, ErrorSchema, ErrorTransformer, Field, FieldError, FieldErrorProps, FieldErrors, FieldHelpProps, FieldId, FieldPath, FieldProps, FieldTemplateProps, FieldValidation, FormContextType, FormValidation, GenericObjectType, ID_KEY, ITEMS_KEY, IconButtonProps, IdSchema, InputPropsType, NAME_KEY, ONE_OF_KEY, ObjectFieldTemplatePropertyType, ObjectFieldTemplateProps, PROPERTIES_KEY, PathSchema, REF_KEY, REQUIRED_KEY, RJSFSchema, RJSFValidationError, RJSF_ADDITONAL_PROPERTIES_FLAG, RangeSpecType, Registry, RegistryFieldsType, RegistryWidgetsType, SUBMIT_BTN_OPTIONS_KEY, SchemaUtilsType, StrictRJSFSchema, SubmitButtonProps, TemplatesType, TitleFieldProps, UIOptionsType, UISchemaSubmitButtonOptions, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, UiSchema, UnsupportedFieldProps, ValidationData, ValidatorType, Widget, WidgetProps, WrapIfAdditionalTemplateProps, allowAdditionalItems, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, findSchemaDefinition, getDefaultFormState, getDisplayLabel, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionsList, orderProperties, pad, parseDateString, processSelectValue, rangeSpec, retrieveSchema, schemaRequiresTrueValue, shouldRender, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };