@rjsf/utils 5.1.0 → 5.2.1

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,7 +1,74 @@
1
- import React, { StyleHTMLAttributes } from 'react';
1
+ import React, { ReactElement, ComponentType, HTMLAttributes, StyleHTMLAttributes, ReactNode, ChangeEvent, ButtonHTMLAttributes } from 'react';
2
2
  import * as json_schema from 'json-schema';
3
3
  import { JSONSchema7 } from 'json-schema';
4
4
 
5
+ /** An enumeration of all the translatable strings used by `@rjsf/core` and its themes. The value of each of the
6
+ * enumeration keys is expected to be the actual english string. Some strings contain replaceable parameter values
7
+ * as indicated by `%1`, `%2`, etc. The number after the `%` indicates the order of the parameter. The ordering of
8
+ * parameters is important because some languages may choose to put the second parameter before the first in its
9
+ * translation. Also, some strings are rendered using `markdown-to-jsx` and thus support markdown and inline html.
10
+ */
11
+ declare enum TranslatableString {
12
+ /** Fallback title of an array item, used by ArrayField */
13
+ ArrayItemTitle = "Item",
14
+ /** Missing items reason, used by ArrayField */
15
+ MissingItems = "Missing items definition",
16
+ /** Yes label, used by BooleanField */
17
+ YesLabel = "Yes",
18
+ /** No label, used by BooleanField */
19
+ NoLabel = "No",
20
+ /** Close label, used by ErrorList */
21
+ CloseLabel = "Close",
22
+ /** Errors label, used by ErrorList */
23
+ ErrorsLabel = "Errors",
24
+ /** New additionalProperties string default value, used by ObjectField */
25
+ NewStringDefault = "New Value",
26
+ /** Add button title, used by AddButton */
27
+ AddButton = "Add",
28
+ /** Add button title, used by AddButton */
29
+ AddItemButton = "Add Item",
30
+ /** Move down button title, used by IconButton */
31
+ MoveDownButton = "Move down",
32
+ /** Move up button title, used by IconButton */
33
+ MoveUpButton = "Move up",
34
+ /** Remove button title, used by IconButton */
35
+ RemoveButton = "Remove",
36
+ /** Now label, used by AltDateWidget */
37
+ NowLabel = "Now",
38
+ /** Clear label, used by AltDateWidget */
39
+ ClearLabel = "Clear",
40
+ /** Aria date label, used by DateWidget */
41
+ AriaDateLabel = "Select a date",
42
+ /** Decrement button aria label, used by UpDownWidget */
43
+ DecrementAriaLabel = "Decrease value by 1",
44
+ /** Increment button aria label, used by UpDownWidget */
45
+ IncrementAriaLabel = "Increase value by 1",
46
+ /** Unknown field type reason, where %1 will be replaced with the type as provided by SchemaField */
47
+ UnknownFieldType = "Unknown field type %1",
48
+ /** Option prefix, where %1 will be replaced with the option index as provided by MultiSchemaField */
49
+ OptionPrefix = "Option %1",
50
+ /** Option prefix, where %1 and %2 will be replaced by the schema title and option index, respectively as provided by
51
+ * MultiSchemaField
52
+ */
53
+ TitleOptionPrefix = "%1 option %2",
54
+ /** Key label, where %1 will be replaced by the label as provided by WrapIfAdditionalTemplate */
55
+ KeyLabel = "%1 Key",
56
+ /** Unsupported field schema, used by UnsupportedField */
57
+ UnsupportedField = "Unsupported field schema.",
58
+ /** Unsupported field schema, where %1 will be replaced by the idSchema.$id as provided by UnsupportedField */
59
+ UnsupportedFieldWithId = "Unsupported field schema for field <code>%1</code>.",
60
+ /** Unsupported field schema, where %1 will be replaced by the reason string as provided by UnsupportedField */
61
+ UnsupportedFieldWithReason = "Unsupported field schema: <em>%1</em>.",
62
+ /** Unsupported field schema, where %1 and %2 will be replaced by the idSchema.$id and reason strings, respectively,
63
+ * as provided by UnsupportedField
64
+ */
65
+ UnsupportedFieldWithIdAndReason = "Unsupported field schema for field <code>%1</code>: <em>%2</em>.",
66
+ /** File name, type and size info, where %1, %2 and %3 will be replaced by the file name, file type and file size as
67
+ * provided by FileWidget
68
+ */
69
+ FilesInfo = "<strong>%1</strong> (%2, %3 bytes)"
70
+ }
71
+
5
72
  /** The representation of any generic object type, usually used as an intersection on other types to make them more
6
73
  * flexible in the properties they support (i.e. anything else)
7
74
  */
@@ -43,13 +110,13 @@ type RangeSpecType = {
43
110
  max?: number;
44
111
  };
45
112
  /** Properties describing a Range specification in terms of attribute that can be added to the `HTML` `<input>` */
46
- type InputPropsType = Omit<RangeSpecType, "step"> & {
113
+ type InputPropsType = Omit<RangeSpecType, 'step'> & {
47
114
  /** Specifies the type of the <input> element */
48
115
  type: string;
49
116
  /** Specifies the interval between legal numbers in an input field or "any" */
50
- step?: number | "any";
117
+ step?: number | 'any';
51
118
  /** Specifies the `autoComplete` value for an <input> element */
52
- autoComplete?: HTMLInputElement["autocomplete"];
119
+ autoComplete?: HTMLInputElement['autocomplete'];
53
120
  };
54
121
  /** Type describing an id used for a field in the `IdSchema` */
55
122
  type FieldId = {
@@ -123,13 +190,15 @@ type ErrorListProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
123
190
  schema: S;
124
191
  /** The uiSchema that was passed to `Form` */
125
192
  uiSchema?: UiSchema<T, S, F>;
193
+ /** The `registry` object */
194
+ registry: Registry<T, S, F>;
126
195
  };
127
196
  /** The properties that are passed to an `FieldErrorTemplate` implementation */
128
197
  type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
129
198
  /** The errorSchema constructed by `Form` */
130
199
  errorSchema?: ErrorSchema<T>;
131
200
  /** An array of the errors */
132
- errors?: Array<string | React.ReactElement>;
201
+ errors?: Array<string | ReactElement>;
133
202
  /** The tree of unique ids for every child field */
134
203
  idSchema: IdSchema<T>;
135
204
  /** The schema that was passed to field */
@@ -142,7 +211,7 @@ type FieldErrorProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
142
211
  /** The properties that are passed to an `FieldHelpTemplate` implementation */
143
212
  type FieldHelpProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
144
213
  /** The help information to be rendered */
145
- help?: string | React.ReactElement;
214
+ help?: string | ReactElement;
146
215
  /** The tree of unique ids for every child field */
147
216
  idSchema: IdSchema<T>;
148
217
  /** The schema that was passed to field */
@@ -167,45 +236,45 @@ type RegistryWidgetsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F ext
167
236
  /** The set of RJSF templates that can be overridden by themes or users */
168
237
  interface TemplatesType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
169
238
  /** The template to use while rendering normal or fixed array fields */
170
- ArrayFieldTemplate: React.ComponentType<ArrayFieldTemplateProps<T, S, F>>;
239
+ ArrayFieldTemplate: ComponentType<ArrayFieldTemplateProps<T, S, F>>;
171
240
  /** The template to use while rendering the description for an array field */
172
- ArrayFieldDescriptionTemplate: React.ComponentType<ArrayFieldDescriptionProps<T, S, F>>;
241
+ ArrayFieldDescriptionTemplate: ComponentType<ArrayFieldDescriptionProps<T, S, F>>;
173
242
  /** The template to use while rendering an item in an array field */
174
- ArrayFieldItemTemplate: React.ComponentType<ArrayFieldTemplateItemType<T, S, F>>;
243
+ ArrayFieldItemTemplate: ComponentType<ArrayFieldTemplateItemType<T, S, F>>;
175
244
  /** The template to use while rendering the title for an array field */
176
- ArrayFieldTitleTemplate: React.ComponentType<ArrayFieldTitleProps<T, S, F>>;
245
+ ArrayFieldTitleTemplate: ComponentType<ArrayFieldTitleProps<T, S, F>>;
177
246
  /** The template to use while rendering the standard html input */
178
- BaseInputTemplate: React.ComponentType<WidgetProps<T, S, F>>;
247
+ BaseInputTemplate: ComponentType<BaseInputTemplateProps<T, S, F>>;
179
248
  /** The template to use for rendering the description of a field */
180
- DescriptionFieldTemplate: React.ComponentType<DescriptionFieldProps<T, S, F>>;
249
+ DescriptionFieldTemplate: ComponentType<DescriptionFieldProps<T, S, F>>;
181
250
  /** The template to use while rendering the errors for the whole form */
182
- ErrorListTemplate: React.ComponentType<ErrorListProps<T, S, F>>;
251
+ ErrorListTemplate: ComponentType<ErrorListProps<T, S, F>>;
183
252
  /** The template to use while rendering the errors for a single field */
184
- FieldErrorTemplate: React.ComponentType<FieldErrorProps<T, S, F>>;
253
+ FieldErrorTemplate: ComponentType<FieldErrorProps<T, S, F>>;
185
254
  /** The template to use while rendering the errors for a single field */
186
- FieldHelpTemplate: React.ComponentType<FieldHelpProps<T, S, F>>;
255
+ FieldHelpTemplate: ComponentType<FieldHelpProps<T, S, F>>;
187
256
  /** The template to use while rendering a field */
188
- FieldTemplate: React.ComponentType<FieldTemplateProps<T, S, F>>;
257
+ FieldTemplate: ComponentType<FieldTemplateProps<T, S, F>>;
189
258
  /** The template to use while rendering an object */
190
- ObjectFieldTemplate: React.ComponentType<ObjectFieldTemplateProps<T, S, F>>;
259
+ ObjectFieldTemplate: ComponentType<ObjectFieldTemplateProps<T, S, F>>;
191
260
  /** The template to use for rendering the title of a field */
192
- TitleFieldTemplate: React.ComponentType<TitleFieldProps<T, S, F>>;
261
+ TitleFieldTemplate: ComponentType<TitleFieldProps<T, S, F>>;
193
262
  /** The template to use for rendering information about an unsupported field type in the schema */
194
- UnsupportedFieldTemplate: React.ComponentType<UnsupportedFieldProps<T, S, F>>;
263
+ UnsupportedFieldTemplate: ComponentType<UnsupportedFieldProps<T, S, F>>;
195
264
  /** The template to use for rendering a field that allows a user to add additional properties */
196
- WrapIfAdditionalTemplate: React.ComponentType<WrapIfAdditionalTemplateProps<T, S, F>>;
265
+ WrapIfAdditionalTemplate: ComponentType<WrapIfAdditionalTemplateProps<T, S, F>>;
197
266
  /** The set of templates associated with buttons in the form */
198
267
  ButtonTemplates: {
199
268
  /** The template to use for the main `Submit` button */
200
- SubmitButton: React.ComponentType<SubmitButtonProps<T, S, F>>;
269
+ SubmitButton: ComponentType<SubmitButtonProps<T, S, F>>;
201
270
  /** The template to use for the Add button used for AdditionalProperties and Array items */
202
- AddButton: React.ComponentType<IconButtonProps<T, S, F>>;
271
+ AddButton: ComponentType<IconButtonProps<T, S, F>>;
203
272
  /** The template to use for the Move Down button used for Array items */
204
- MoveDownButton: React.ComponentType<IconButtonProps<T, S, F>>;
273
+ MoveDownButton: ComponentType<IconButtonProps<T, S, F>>;
205
274
  /** The template to use for the Move Up button used for Array items */
206
- MoveUpButton: React.ComponentType<IconButtonProps<T, S, F>>;
275
+ MoveUpButton: ComponentType<IconButtonProps<T, S, F>>;
207
276
  /** The template to use for the Remove button used for AdditionalProperties and Array items */
208
- RemoveButton: React.ComponentType<IconButtonProps<T, S, F>>;
277
+ RemoveButton: ComponentType<IconButtonProps<T, S, F>>;
209
278
  };
210
279
  }
211
280
  /** The object containing the registered core, theme and custom fields and widgets as well as the root schema, form
@@ -232,9 +301,11 @@ interface Registry<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
232
301
  * of the validation-schema-based utility functions
233
302
  */
234
303
  schemaUtils: SchemaUtilsType<T, S>;
304
+ /** The string translation function to use when displaying any of the RJSF strings in templates, fields or widgets */
305
+ translateString: (stringKey: TranslatableString, params?: string[]) => string;
235
306
  }
236
307
  /** The properties that are passed to a Field implementation */
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">> {
308
+ interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus' | 'onChange'>> {
238
309
  /** The JSON subschema object for this field */
239
310
  schema: S;
240
311
  /** The uiSchema for this field */
@@ -279,7 +350,7 @@ interface FieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
279
350
  registry: Registry<T, S, F>;
280
351
  }
281
352
  /** The definition of a React-based Field component */
282
- type Field<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = React.ComponentType<FieldProps<T, S, F>>;
353
+ type Field<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<FieldProps<T, S, F>>;
283
354
  /** The properties that are passed to a FieldTemplate implementation */
284
355
  type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
285
356
  /** The id of the field in the hierarchy. You can use it to render a label targeting the wrapped widget */
@@ -293,17 +364,17 @@ type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F exte
293
364
  /** A component instance rendering the field description, if one is defined (this will use any custom
294
365
  * `DescriptionField` defined)
295
366
  */
296
- description?: React.ReactElement;
367
+ description?: ReactElement;
297
368
  /** A string containing any `ui:description` uiSchema directive defined */
298
369
  rawDescription?: string;
299
370
  /** The field or widget component instance for this field row */
300
- children: React.ReactElement;
371
+ children: ReactElement;
301
372
  /** A component instance listing any encountered errors for this field */
302
- errors?: React.ReactElement;
373
+ errors?: ReactElement;
303
374
  /** An array of strings listing all generated error messages from encountered errors for this field */
304
375
  rawErrors?: string[];
305
376
  /** A component instance rendering any `ui:help` uiSchema directive defined */
306
- help?: React.ReactElement;
377
+ help?: ReactElement;
307
378
  /** A string containing any `ui:help` uiSchema directive defined. **NOTE:** `rawHelp` will be `undefined` if passed
308
379
  * `ui:help` is a React component instead of a string
309
380
  */
@@ -331,7 +402,7 @@ type FieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F exte
331
402
  /** The formData for this field */
332
403
  formData?: T;
333
404
  /** The value change event handler; Can be called with a new value to change the value for this field */
334
- onChange: FieldProps["onChange"];
405
+ onChange: FieldProps['onChange'];
335
406
  /** The key change event handler; Called when the key associated with a field is changed for an additionalProperty */
336
407
  onKeyChange: (value: string) => () => void;
337
408
  /** The property drop/removal event handler; Called when a field is removed in an additionalProperty context */
@@ -374,28 +445,28 @@ type DescriptionFieldProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
374
445
  /** The uiSchema object for this description field */
375
446
  uiSchema?: UiSchema<T, S, F>;
376
447
  /** The description of the field being rendered */
377
- description: string | React.ReactElement;
448
+ description: string | ReactElement;
378
449
  /** The `registry` object */
379
450
  registry: Registry<T, S, F>;
380
451
  };
381
452
  /** The properties that are passed to a `ArrayFieldTitleTemplate` implementation */
382
- type ArrayFieldTitleProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<TitleFieldProps<T, S, F>, "id" | "title"> & {
453
+ type ArrayFieldTitleProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<TitleFieldProps<T, S, F>, 'id' | 'title'> & {
383
454
  /** The title for the field being rendered */
384
455
  title?: string;
385
456
  /** The idSchema of the field in the hierarchy */
386
457
  idSchema: IdSchema<T>;
387
458
  };
388
459
  /** The properties that are passed to a `ArrayFieldDescriptionTemplate` implementation */
389
- type ArrayFieldDescriptionProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<DescriptionFieldProps<T, S, F>, "id" | "description"> & {
460
+ type ArrayFieldDescriptionProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Omit<DescriptionFieldProps<T, S, F>, 'id' | 'description'> & {
390
461
  /** The description of the field being rendered */
391
- description?: string | React.ReactElement;
462
+ description?: string | ReactElement;
392
463
  /** The idSchema of the field in the hierarchy */
393
464
  idSchema: IdSchema<T>;
394
465
  };
395
466
  /** The properties of each element in the ArrayFieldTemplateProps.items array */
396
467
  type ArrayFieldTemplateItemType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
397
468
  /** The html for the item's content */
398
- children: React.ReactElement;
469
+ children: ReactElement;
399
470
  /** The className string */
400
471
  className: string;
401
472
  /** A boolean value stating if the array item is disabled */
@@ -469,7 +540,7 @@ type ArrayFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F
469
540
  /** The properties of each element in the ObjectFieldTemplateProps.properties array */
470
541
  type ObjectFieldTemplatePropertyType = {
471
542
  /** The html for the property's content */
472
- content: React.ReactElement;
543
+ content: ReactElement;
473
544
  /** A string representing the property name */
474
545
  name: string;
475
546
  /** A boolean value stating if the object property is disabled */
@@ -513,12 +584,18 @@ type ObjectFieldTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema,
513
584
  /** The properties that are passed to a WrapIfAdditionalTemplate implementation */
514
585
  type WrapIfAdditionalTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
515
586
  /** The field or widget component instance for this field row */
516
- children: React.ReactNode;
517
- } & Pick<FieldTemplateProps<T, S, F>, "id" | "classNames" | "style" | "label" | "required" | "readonly" | "disabled" | "schema" | "uiSchema" | "onKeyChange" | "onDropPropertyClick" | "registry">;
587
+ children: ReactNode;
588
+ } & Pick<FieldTemplateProps<T, S, F>, 'id' | 'classNames' | 'style' | 'label' | 'required' | 'readonly' | 'disabled' | 'schema' | 'uiSchema' | 'onKeyChange' | 'onDropPropertyClick' | 'registry'>;
518
589
  /** The properties that are passed to a Widget implementation */
519
- 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">> {
520
- /** The generated id for this widget */
590
+ interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends GenericObjectType, Pick<HTMLAttributes<HTMLElement>, Exclude<keyof HTMLAttributes<HTMLElement>, 'onBlur' | 'onFocus'>> {
591
+ /** The generated id for this widget, used to provide unique `name`s and `id`s for the HTML field elements rendered by
592
+ * widgets
593
+ */
521
594
  id: string;
595
+ /** The unique name of the field, usually derived from the name of the property in the JSONSchema; Provided in support
596
+ * of custom widgets.
597
+ */
598
+ name: string;
522
599
  /** The JSONSchema subschema object for this widget */
523
600
  schema: S;
524
601
  /** The uiSchema for this widget */
@@ -562,7 +639,15 @@ interface WidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
562
639
  registry: Registry<T, S, F>;
563
640
  }
564
641
  /** The definition of a React-based Widget component */
565
- type Widget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = React.ComponentType<WidgetProps<T, S, F>>;
642
+ type Widget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ComponentType<WidgetProps<T, S, F>>;
643
+ /** The properties that are passed to the BaseInputTemplate */
644
+ interface BaseInputTemplateProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> extends WidgetProps<T, S, F> {
645
+ /** A `BaseInputTemplate` implements a default `onChange` handler that it passes to the HTML input component to handle
646
+ * the `ChangeEvent`. Sometimes a widget may need to handle the `ChangeEvent` using custom logic. If that is the case,
647
+ * that widget should provide its own handler via this prop.
648
+ */
649
+ onChangeOverride?: (event: ChangeEvent<HTMLInputElement>) => void;
650
+ }
566
651
  /** The type that defines the props used by the Submit button */
567
652
  type SubmitButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
568
653
  /** The uiSchema for this widget */
@@ -571,11 +656,11 @@ type SubmitButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
571
656
  registry: Registry<T, S, F>;
572
657
  };
573
658
  /** The type that defines the props for an Icon button, extending from a basic HTML button attributes */
574
- type IconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = React.ButtonHTMLAttributes<HTMLButtonElement> & {
659
+ type IconButtonProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = ButtonHTMLAttributes<HTMLButtonElement> & {
575
660
  /** An alternative specification for the type of the icon button */
576
661
  iconType?: string;
577
662
  /** The name representation or actual react element implementation for the icon */
578
- icon?: string | React.ReactElement;
663
+ icon?: string | ReactElement;
579
664
  /** The uiSchema for this widget */
580
665
  uiSchema?: UiSchema<T, S, F>;
581
666
  /** The `registry` object */
@@ -611,7 +696,7 @@ type MakeUIType<Type> = {
611
696
  /** This type represents all the known supported options in the `ui:options` property, kept separate in order to
612
697
  * remap the keys. It also contains all the properties, optionally, of `TemplatesType` except "ButtonTemplates"
613
698
  */
614
- type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<Omit<TemplatesType<T, S, F>, "ButtonTemplates">> & {
699
+ type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = Partial<Omit<TemplatesType<T, S, F>, 'ButtonTemplates'>> & {
615
700
  /** Any classnames that the user wants to be applied to a field in the ui */
616
701
  classNames?: string;
617
702
  /** Any custom style that the user wants to apply to a field in the ui, applied on the same element as classNames */
@@ -627,7 +712,7 @@ type UIOptionsBaseType<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
627
712
  /** Flag, if set to `true`, will mark the field as automatically focused on a text input or textarea input */
628
713
  autofocus?: boolean;
629
714
  /** Use to mark the field as supporting auto complete on a text input or textarea input */
630
- autocomplete?: HTMLInputElement["autocomplete"];
715
+ autocomplete?: HTMLInputElement['autocomplete'];
631
716
  /** Flag, if set to `true`, will mark all child widgets from a given field as disabled */
632
717
  disabled?: boolean;
633
718
  /** The default value to use when an input for a field is empty */
@@ -677,11 +762,11 @@ type UIOptionsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
677
762
  */
678
763
  type UiSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = GenericObjectType & MakeUIType<UIOptionsBaseType<T, S, F>> & {
679
764
  /** Allows the form to generate a unique prefix for the `Form`'s root prefix */
680
- "ui:rootFieldId"?: string;
765
+ 'ui:rootFieldId'?: string;
681
766
  /** Allows RJSF to override the default field implementation by specifying either the name of a field that is used
682
767
  * to look up an implementation from the `fields` list or an actual one-off `Field` component implementation itself
683
768
  */
684
- "ui:field"?: Field<T, S, F> | string;
769
+ 'ui:field'?: Field<T, S, F> | string;
685
770
  /** By default, any field that is rendered for an `anyOf`/`oneOf` schema will be wrapped inside the `AnyOfField` or
686
771
  * `OneOfField` component. This default behavior may be undesirable if your custom field already handles behavior
687
772
  * related to choosing one or more subschemas contained in the `anyOf`/`oneOf` schema.
@@ -689,9 +774,9 @@ type UiSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormCo
689
774
  * omitted, so just one instance of the custom field will be rendered. If the flag is omitted or set to `false`,
690
775
  * your custom field will be wrapped by `AnyOfField`/`OneOfField`.
691
776
  */
692
- "ui:fieldReplacesAnyOrOneOf"?: boolean;
777
+ 'ui:fieldReplacesAnyOrOneOf'?: boolean;
693
778
  /** An object that contains all the potential UI options in a single object */
694
- "ui:options"?: UIOptionsType<T, S, F>;
779
+ 'ui:options'?: UIOptionsType<T, S, F>;
695
780
  };
696
781
  /** A `CustomValidator` function takes in a `formData`, `errors` and `uiSchema` objects and returns the given `errors`
697
782
  * object back, while potentially adding additional messages to the `errors`
@@ -780,7 +865,7 @@ interface SchemaUtilsType<T = any, S extends StrictRJSFSchema = RJSFSchema, F ex
780
865
  * false when computing defaults for any nested object properties.
781
866
  * @returns - The resulting `formData` with all the defaults provided
782
867
  */
783
- getDefaultFormState(schema: S, formData?: T, includeUndefinedValues?: boolean | "excludeObjectChildren"): T | T[] | undefined;
868
+ getDefaultFormState(schema: S, formData?: T, includeUndefinedValues?: boolean | 'excludeObjectChildren'): T | T[] | undefined;
784
869
  /** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
785
870
  * should be displayed in a UI.
786
871
  *
@@ -936,6 +1021,12 @@ declare function createSchemaUtils<T = any, S extends StrictRJSFSchema = RJSFSch
936
1021
  declare function dataURItoBlob(dataURI: string): {
937
1022
  blob: Blob;
938
1023
  name: string;
1024
+ } | {
1025
+ blob: {
1026
+ size: number;
1027
+ type: string;
1028
+ };
1029
+ name: string;
939
1030
  };
940
1031
 
941
1032
  /** Implements a deep equals using the `lodash.isEqualWith` function, that provides a customized comparator that
@@ -947,6 +1038,16 @@ declare function dataURItoBlob(dataURI: string): {
947
1038
  */
948
1039
  declare function deepEquals(a: any, b: any): boolean;
949
1040
 
1041
+ /** Translates a `TranslatableString` value `stringToTranslate` into english. When a `params` array is provided, each
1042
+ * value in the array is used to replace any of the replaceable parameters in the `stringToTranslate` using the `%1`,
1043
+ * `%2`, etc. replacement specifiers.
1044
+ *
1045
+ * @param stringToTranslate - The `TranslatableString` value to convert to english
1046
+ * @param params - The optional list of replaceable parameter values to substitute into the english string
1047
+ * @returns - The `stringToTranslate` itself with any replaceable parameter values substituted
1048
+ */
1049
+ declare function englishStringTranslator(stringToTranslate: TranslatableString, params?: string[]): string;
1050
+
950
1051
  /** Removes the enum option value at the `valueIndex` from the currently `selected` (list of) value(s). If `selected` is
951
1052
  * a list, then that list is updated to remove the enum option value with the `valueIndex` in `allEnumOptions`. If it is
952
1053
  * a single value, then if the enum option value with the `valueIndex` in `allEnumOptions` matches `selected`, undefined
@@ -959,7 +1060,7 @@ declare function deepEquals(a: any, b: any): boolean;
959
1060
  * unless `selected` is a single value. In that case, if the `valueIndex` value matches `selected`, returns
960
1061
  * undefined, otherwise `selected`.
961
1062
  */
962
- declare function enumOptionsDeselectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected?: EnumOptionsType<S>["value"] | EnumOptionsType<S>["value"][], allEnumOptions?: EnumOptionsType<S>[]): EnumOptionsType<S>["value"] | EnumOptionsType<S>["value"][] | undefined;
1063
+ declare function enumOptionsDeselectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected?: EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][], allEnumOptions?: EnumOptionsType<S>[]): EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][] | undefined;
963
1064
 
964
1065
  /** Returns the index(es) of the options in `allEnumOptions` whose value(s) match the ones in `value`. All the
965
1066
  * `enumOptions` are filtered based on whether they are a "selected" `value` and the index of each selected one is then
@@ -972,7 +1073,7 @@ declare function enumOptionsDeselectValue<S extends StrictRJSFSchema = RJSFSchem
972
1073
  * @returns - A single string index for the first `value` in `allEnumOptions`, if not `multiple`. Otherwise, the list
973
1074
  * of indexes for (each of) the value(s) in `value`.
974
1075
  */
975
- declare function enumOptionsIndexForValue<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>["value"] | EnumOptionsType<S>["value"][], allEnumOptions?: EnumOptionsType<S>[], multiple?: boolean): string | string[] | undefined;
1076
+ declare function enumOptionsIndexForValue<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][], allEnumOptions?: EnumOptionsType<S>[], multiple?: boolean): string | string[] | undefined;
976
1077
 
977
1078
  /** Determines whether the given `value` is (one of) the `selected` value(s).
978
1079
  *
@@ -980,7 +1081,7 @@ declare function enumOptionsIndexForValue<S extends StrictRJSFSchema = RJSFSchem
980
1081
  * @param selected - The current selected value or list of values
981
1082
  * @returns - true if the `value` is one of the `selected` ones, false otherwise
982
1083
  */
983
- declare function enumOptionsIsSelected<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>["value"], selected: EnumOptionsType<S>["value"] | EnumOptionsType<S>["value"][]): boolean;
1084
+ declare function enumOptionsIsSelected<S extends StrictRJSFSchema = RJSFSchema>(value: EnumOptionsType<S>['value'], selected: EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][]): boolean;
984
1085
 
985
1086
  /** Add the enum option value at the `valueIndex` to the list of `selected` values in the proper order as defined by
986
1087
  * `allEnumOptions`
@@ -990,7 +1091,7 @@ declare function enumOptionsIsSelected<S extends StrictRJSFSchema = RJSFSchema>(
990
1091
  * @param [allEnumOptions=[]] - The list of all the known enumOptions
991
1092
  * @returns - The updated list of selected enum values with enum value at the `valueIndex` added to it
992
1093
  */
993
- declare function enumOptionsSelectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected: EnumOptionsType<S>["value"][], allEnumOptions?: EnumOptionsType<S>[]): any[];
1094
+ declare function enumOptionsSelectValue<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number, selected: EnumOptionsType<S>['value'][], allEnumOptions?: EnumOptionsType<S>[]): any[];
994
1095
 
995
1096
  /** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an
996
1097
  * array AND the index is not valid for `allEnumOptions`, `emptyValue` is returned. If `valueIndex` is an array, AND it
@@ -1003,7 +1104,7 @@ declare function enumOptionsSelectValue<S extends StrictRJSFSchema = RJSFSchema>
1003
1104
  * @returns - The single or list of values specified by the single or list of indexes if they are valid. Otherwise,
1004
1105
  * `emptyValue` or an empty list.
1005
1106
  */
1006
- declare function enumOptionsValueForIndex<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number | Array<string | number>, allEnumOptions?: EnumOptionsType<S>[], emptyValue?: EnumOptionsType<S>["value"]): EnumOptionsType<S>["value"] | EnumOptionsType<S>["value"][] | undefined;
1107
+ declare function enumOptionsValueForIndex<S extends StrictRJSFSchema = RJSFSchema>(valueIndex: string | number | Array<string | number>, allEnumOptions?: EnumOptionsType<S>[], emptyValue?: EnumOptionsType<S>['value']): EnumOptionsType<S>['value'] | EnumOptionsType<S>['value'][] | undefined;
1007
1108
 
1008
1109
  /** The `ErrorSchemaBuilder<T>` is used to build an `ErrorSchema<T>` since the definition of the `ErrorSchema` type is
1009
1110
  * designed for reading information rather than writing it. Use this class to add, replace or clear errors in an error
@@ -1265,7 +1366,7 @@ declare function mergeDefaultsWithFormData<T = any>(defaults?: T, formData?: T):
1265
1366
  * NOTE: Uses shallow comparison for the duplicate checking.
1266
1367
  * @returns - A new object that is the merge of the two given objects
1267
1368
  */
1268
- declare function mergeObjects(obj1: GenericObjectType, obj2: GenericObjectType, concatArrays?: boolean | "preventDuplicates"): GenericObjectType;
1369
+ declare function mergeObjects(obj1: GenericObjectType, obj2: GenericObjectType, concatArrays?: boolean | 'preventDuplicates'): GenericObjectType;
1269
1370
 
1270
1371
  /** Recursively merge deeply nested schemas. The difference between `mergeSchemas` and `mergeObjects` is that
1271
1372
  * `mergeSchemas` only concats arrays for values under the 'required' keyword, and when it does, it doesn't include
@@ -1324,6 +1425,16 @@ declare function parseDateString(dateString?: string, includeTime?: boolean): Da
1324
1425
  */
1325
1426
  declare function rangeSpec<S extends StrictRJSFSchema = RJSFSchema>(schema: S): RangeSpecType;
1326
1427
 
1428
+ /** Potentially substitutes all replaceable parameters with the associated value(s) from the `params` if available. When
1429
+ * a `params` array is provided, each value in the array is used to replace any of the replaceable parameters in the
1430
+ * `inputString` using the `%1`, `%2`, etc. replacement specifiers.
1431
+ *
1432
+ * @param inputString - The string which will be potentially updated with replacement parameters
1433
+ * @param params - The optional list of replaceable parameter values to substitute into the english string
1434
+ * @returns - The updated string with any replacement specifiers replaced
1435
+ */
1436
+ declare function replaceStringParameters(inputString: string, params?: string[]): string;
1437
+
1327
1438
  /** Check to see if a `schema` specifies that a value must be true. This happens when:
1328
1439
  * - `schema.const` is truthy
1329
1440
  * - `schema.enum` == `[true]`
@@ -1410,7 +1521,7 @@ declare const UI_OPTIONS_KEY = "ui:options";
1410
1521
  * false when computing defaults for any nested object properties.
1411
1522
  * @returns - The resulting `formData` with all the defaults provided
1412
1523
  */
1413
- declare function getDefaultFormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, theSchema: S, formData?: T, rootSchema?: S, includeUndefinedValues?: boolean | "excludeObjectChildren"): T | T[] | undefined;
1524
+ declare function getDefaultFormState<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, theSchema: S, formData?: T, rootSchema?: S, includeUndefinedValues?: boolean | 'excludeObjectChildren'): T | T[] | undefined;
1414
1525
 
1415
1526
  /** Determines whether the combination of `schema` and `uiSchema` properties indicates that the label for the `schema`
1416
1527
  * should be displayed in a UI.
@@ -1593,4 +1704,4 @@ declare function toIdSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F
1593
1704
  */
1594
1705
  declare function toPathSchema<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, name?: string, rootSchema?: S, formData?: T): PathSchema<T>;
1595
1706
 
1596
- 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, ErrorSchemaBuilder, 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, ariaDescribedByIds, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, descriptionId, enumOptionsDeselectValue, enumOptionsIndexForValue, enumOptionsIsSelected, enumOptionsSelectValue, enumOptionsValueForIndex, errorId, examplesId, findSchemaDefinition, getClosestMatchingOption, getDefaultFormState, getDisplayLabel, getFirstMatchingOption, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, helpId, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionId, optionsList, orderProperties, pad, parseDateString, rangeSpec, retrieveSchema, sanitizeDataForNewSchema, schemaRequiresTrueValue, shouldRender, titleId, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };
1707
+ export { ADDITIONAL_PROPERTIES_KEY, ADDITIONAL_PROPERTY_FLAG, ALL_OF_KEY, ANY_OF_KEY, ArrayFieldDescriptionProps, ArrayFieldTemplateItemType, ArrayFieldTemplateProps, ArrayFieldTitleProps, BaseInputTemplateProps, CONST_KEY, CustomValidator, DEFAULT_KEY, DEFINITIONS_KEY, DEPENDENCIES_KEY, DateObject, DescriptionFieldProps, ENUM_KEY, ERRORS_KEY, EnumOptionsType, ErrorListProps, ErrorSchema, ErrorSchemaBuilder, 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, TranslatableString, UIOptionsType, UISchemaSubmitButtonOptions, UI_FIELD_KEY, UI_OPTIONS_KEY, UI_WIDGET_KEY, UiSchema, UnsupportedFieldProps, ValidationData, ValidatorType, Widget, WidgetProps, WrapIfAdditionalTemplateProps, allowAdditionalItems, ariaDescribedByIds, asNumber, canExpand, createSchemaUtils, dataURItoBlob, deepEquals, descriptionId, englishStringTranslator, enumOptionsDeselectValue, enumOptionsIndexForValue, enumOptionsIsSelected, enumOptionsSelectValue, enumOptionsValueForIndex, errorId, examplesId, findSchemaDefinition, getClosestMatchingOption, getDefaultFormState, getDisplayLabel, getFirstMatchingOption, getInputProps, getMatchingOption, getSchemaType, getSubmitButtonOptions, getTemplate, getUiOptions, getWidget, guessType, hasWidget, helpId, isConstant, isCustomWidget, isFilesArray, isFixedItems, isMultiSelect, isObject, isSelect, localToUTC, mergeDefaultsWithFormData, mergeObjects, mergeSchemas, mergeValidationData, optionId, optionsList, orderProperties, pad, parseDateString, rangeSpec, replaceStringParameters, retrieveSchema, sanitizeDataForNewSchema, schemaRequiresTrueValue, shouldRender, titleId, toConstant, toDateString, toIdSchema, toPathSchema, utcToLocal };