@rjsf/core 5.24.10 → 6.0.0-beta.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.
Files changed (117) hide show
  1. package/dist/core.umd.js +982 -196
  2. package/dist/index.esm.js +1366 -490
  3. package/dist/index.esm.js.map +4 -4
  4. package/dist/index.js +1452 -616
  5. package/dist/index.js.map +4 -4
  6. package/lib/components/Form.d.ts +0 -7
  7. package/lib/components/Form.d.ts.map +1 -1
  8. package/lib/components/Form.js +2 -5
  9. package/lib/components/fields/ArrayField.d.ts +19 -9
  10. package/lib/components/fields/ArrayField.d.ts.map +1 -1
  11. package/lib/components/fields/ArrayField.js +22 -12
  12. package/lib/components/fields/BooleanField.d.ts.map +1 -1
  13. package/lib/components/fields/BooleanField.js +3 -9
  14. package/lib/components/fields/LayoutGridField.d.ts +480 -0
  15. package/lib/components/fields/LayoutGridField.d.ts.map +1 -0
  16. package/lib/components/fields/LayoutGridField.js +711 -0
  17. package/lib/components/fields/LayoutHeaderField.d.ts +12 -0
  18. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -0
  19. package/lib/components/fields/LayoutHeaderField.js +23 -0
  20. package/lib/components/fields/LayoutMultiSchemaField.d.ts +28 -0
  21. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -0
  22. package/lib/components/fields/LayoutMultiSchemaField.js +114 -0
  23. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
  24. package/lib/components/fields/ObjectField.d.ts.map +1 -1
  25. package/lib/components/fields/ObjectField.js +29 -23
  26. package/lib/components/fields/SchemaField.d.ts.map +1 -1
  27. package/lib/components/fields/SchemaField.js +2 -8
  28. package/lib/components/fields/index.d.ts.map +1 -1
  29. package/lib/components/fields/index.js +6 -0
  30. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +8 -0
  31. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -0
  32. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +17 -0
  33. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +3 -3
  34. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
  35. package/lib/components/templates/ArrayFieldItemTemplate.js +7 -5
  36. package/lib/components/templates/ArrayFieldTemplate.d.ts +1 -1
  37. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
  38. package/lib/components/templates/ArrayFieldTemplate.js +3 -3
  39. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -1
  40. package/lib/components/templates/ButtonTemplates/IconButton.js +4 -4
  41. package/lib/components/templates/GridTemplate.d.ts +8 -0
  42. package/lib/components/templates/GridTemplate.d.ts.map +1 -0
  43. package/lib/components/templates/GridTemplate.js +10 -0
  44. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
  45. package/lib/components/templates/ObjectFieldTemplate.js +2 -2
  46. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
  47. package/lib/components/templates/WrapIfAdditionalTemplate.js +9 -4
  48. package/lib/components/templates/index.d.ts.map +1 -1
  49. package/lib/components/templates/index.js +4 -0
  50. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
  51. package/lib/components/widgets/FileWidget.js +1 -1
  52. package/lib/components/widgets/RadioWidget.js +3 -3
  53. package/lib/components/widgets/RatingWidget.d.ts +15 -0
  54. package/lib/components/widgets/RatingWidget.d.ts.map +1 -0
  55. package/lib/components/widgets/RatingWidget.js +63 -0
  56. package/lib/components/widgets/SelectWidget.d.ts.map +1 -1
  57. package/lib/components/widgets/SelectWidget.js +4 -4
  58. package/lib/components/widgets/index.d.ts.map +1 -1
  59. package/lib/components/widgets/index.js +2 -0
  60. package/lib/tsconfig.tsbuildinfo +1 -1
  61. package/lib/withTheme.d.ts.map +1 -1
  62. package/lib/withTheme.js +1 -0
  63. package/package.json +44 -35
  64. package/src/components/Form.tsx +24 -30
  65. package/src/components/fields/ArrayField.tsx +34 -24
  66. package/src/components/fields/BooleanField.tsx +6 -14
  67. package/src/components/fields/LayoutGridField.tsx +967 -0
  68. package/src/components/fields/LayoutHeaderField.tsx +49 -0
  69. package/src/components/fields/LayoutMultiSchemaField.tsx +228 -0
  70. package/src/components/fields/NullField.tsx +1 -1
  71. package/src/components/fields/NumberField.tsx +2 -2
  72. package/src/components/fields/ObjectField.tsx +32 -28
  73. package/src/components/fields/SchemaField.tsx +14 -22
  74. package/src/components/fields/StringField.tsx +2 -2
  75. package/src/components/fields/index.ts +7 -1
  76. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -2
  77. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +85 -0
  78. package/src/components/templates/ArrayFieldItemTemplate.tsx +18 -57
  79. package/src/components/templates/ArrayFieldTemplate.tsx +10 -8
  80. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -2
  81. package/src/components/templates/BaseInputTemplate.tsx +4 -4
  82. package/src/components/templates/ButtonTemplates/IconButton.tsx +9 -36
  83. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +1 -1
  84. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  85. package/src/components/templates/DescriptionField.tsx +1 -1
  86. package/src/components/templates/FieldErrorTemplate.tsx +1 -1
  87. package/src/components/templates/FieldHelpTemplate.tsx +1 -1
  88. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -2
  89. package/src/components/templates/GridTemplate.tsx +15 -0
  90. package/src/components/templates/ObjectFieldTemplate.tsx +5 -3
  91. package/src/components/templates/TitleField.tsx +1 -1
  92. package/src/components/templates/UnsupportedField.tsx +1 -1
  93. package/src/components/templates/WrapIfAdditionalTemplate.tsx +14 -4
  94. package/src/components/templates/index.ts +4 -0
  95. package/src/components/widgets/AltDateWidget.tsx +9 -6
  96. package/src/components/widgets/CheckboxWidget.tsx +4 -4
  97. package/src/components/widgets/CheckboxesWidget.tsx +2 -2
  98. package/src/components/widgets/ColorWidget.tsx +1 -1
  99. package/src/components/widgets/DateTimeWidget.tsx +1 -1
  100. package/src/components/widgets/DateWidget.tsx +1 -1
  101. package/src/components/widgets/EmailWidget.tsx +1 -1
  102. package/src/components/widgets/FileWidget.tsx +4 -4
  103. package/src/components/widgets/PasswordWidget.tsx +1 -1
  104. package/src/components/widgets/RadioWidget.tsx +3 -3
  105. package/src/components/widgets/RangeWidget.tsx +1 -1
  106. package/src/components/widgets/RatingWidget.tsx +129 -0
  107. package/src/components/widgets/SelectWidget.tsx +4 -3
  108. package/src/components/widgets/TextWidget.tsx +1 -1
  109. package/src/components/widgets/TextareaWidget.tsx +3 -3
  110. package/src/components/widgets/TimeWidget.tsx +1 -1
  111. package/src/components/widgets/URLWidget.tsx +1 -1
  112. package/src/components/widgets/UpDownWidget.tsx +1 -1
  113. package/src/components/widgets/index.ts +3 -1
  114. package/src/getDefaultRegistry.ts +1 -1
  115. package/src/tsconfig.json +0 -3
  116. package/src/withTheme.tsx +4 -3
  117. package/LICENSE.md +0 -201
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@rjsf/core",
3
- "version": "5.24.10",
3
+ "version": "6.0.0-beta.1",
4
4
  "description": "A simple React component capable of building HTML forms out of a JSON schema.",
5
5
  "scripts": {
6
- "compileReplacer": "tsc -p tsconfig.replacer.json",
6
+ "compileReplacer": "tsc -p tsconfig.replacer.json && move-file lodashReplacer.js lodashReplacer.cjs",
7
7
  "build:ts": "npm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
8
8
  "build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --sourcemap --packages=external --format=cjs",
9
9
  "build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/index.esm.js --sourcemap --packages=external --format=esm",
@@ -28,6 +28,34 @@
28
28
  "main": "dist/index.js",
29
29
  "module": "lib/index.js",
30
30
  "typings": "lib/index.d.ts",
31
+ "type": "module",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./lib/index.d.ts",
35
+ "require": "./dist/index.js",
36
+ "import": "./lib/index.js"
37
+ },
38
+ "./lib": {
39
+ "types": "./lib/index.d.ts",
40
+ "require": "./dist/index.js",
41
+ "import": "./lib/index.js"
42
+ },
43
+ "./lib/*.js": {
44
+ "types": "./lib/*.d.ts",
45
+ "require": "./dist/*.js",
46
+ "import": "./lib/*.js"
47
+ },
48
+ "./dist": {
49
+ "types": "./lib/index.d.ts",
50
+ "require": "./dist/index.js",
51
+ "import": "./lib/index.js"
52
+ },
53
+ "./dist/*.js": {
54
+ "types": "./lib/*.d.ts",
55
+ "require": "./dist/*.js",
56
+ "import": "./lib/*.js"
57
+ }
58
+ },
31
59
  "files": [
32
60
  "dist",
33
61
  "lib",
@@ -35,53 +63,35 @@
35
63
  ],
36
64
  "engineStrict": false,
37
65
  "engines": {
38
- "node": ">=14"
66
+ "node": ">=20"
39
67
  },
40
68
  "peerDependencies": {
41
- "@rjsf/utils": "^5.24.x",
42
- "react": "^16.14.0 || >=17"
69
+ "@rjsf/utils": "^6.x",
70
+ "react": ">=18"
43
71
  },
44
72
  "dependencies": {
45
73
  "lodash": "^4.17.21",
46
74
  "lodash-es": "^4.17.21",
47
- "markdown-to-jsx": "^7.4.1",
48
- "nanoid": "^3.3.7",
75
+ "markdown-to-jsx": "^7.7.6",
76
+ "nanoid": "^5.1.5",
49
77
  "prop-types": "^15.8.1"
50
78
  },
51
79
  "devDependencies": {
52
- "@babel/core": "^7.23.9",
53
- "@babel/plugin-proposal-class-properties": "^7.18.6",
54
- "@babel/plugin-proposal-optional-chaining": "^7.21.0",
55
- "@babel/preset-env": "^7.23.9",
56
- "@babel/preset-react": "^7.23.3",
57
- "@babel/preset-typescript": "^7.23.3",
58
- "@rjsf/snapshot-tests": "^5.24.10",
59
- "@rjsf/utils": "^5.24.10",
60
- "@rjsf/validator-ajv6": "^5.24.10",
61
- "@rjsf/validator-ajv8": "^5.24.10",
62
- "@types/jest": "^29.5.12",
63
- "@types/lodash": "^4.14.202",
64
- "@types/react": "^18.2.58",
65
- "@types/react-dom": "^18.2.19",
66
- "@types/react-test-renderer": "^18.0.7",
80
+ "@rjsf/snapshot-tests": "^6.0.0-beta.1",
81
+ "@rjsf/utils": "^6.0.0-beta.1",
82
+ "@rjsf/validator-ajv8": "^6.0.0-beta.1",
83
+ "@testing-library/jest-dom": "^6.6.3",
84
+ "@testing-library/react": "^16.2.0",
85
+ "@testing-library/user-event": "^14.6.1",
67
86
  "ajv": "^8.12.0",
68
87
  "atob": "^2.1.2",
69
- "babel-jest": "^29.7.0",
70
88
  "chai": "^3.5.0",
71
89
  "eslint": "^8.56.0",
72
90
  "html": "^1.0.0",
73
- "jest": "^29.7.0",
74
- "jest-environment-jsdom": "^29.7.0",
75
91
  "jsdom": "^20.0.3",
76
92
  "mocha": "^10.2.0",
77
- "react": "^18.2.0",
78
- "react-dom": "^18.2.0",
79
- "react-portal": "^4.2.2",
80
- "react-test-renderer": "^18.2.0",
81
- "rimraf": "^5.0.5",
82
- "rollup": "^3.29.4",
83
- "sinon": "^9.2.4",
84
- "typescript": "^4.9.5"
93
+ "react-portal": "^4.3.0",
94
+ "sinon": "^9.2.4"
85
95
  },
86
96
  "directories": {
87
97
  "test": "test"
@@ -103,6 +113,5 @@
103
113
  "homepage": "https://github.com/rjsf-team/react-jsonschema-form",
104
114
  "publishConfig": {
105
115
  "access": "public"
106
- },
107
- "gitHead": "ad33d7c324cb040d0f34da30a17caea0251f1e3a"
116
+ }
108
117
  }
@@ -116,11 +116,6 @@ export interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
116
116
  * an `onFocus` handler, which will receive the id of the input that is focused and the field value
117
117
  */
118
118
  onFocus?: (id: string, data: any) => void;
119
- // <form /> HTML attributes
120
- /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form
121
- * @deprecated replaced with `acceptCharset` which will supercede this value if both are specified
122
- */
123
- acceptcharset?: string;
124
119
  /** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */
125
120
  acceptCharset?: string;
126
121
  /** The value of this prop will be passed to the `action` HTML attribute on the form
@@ -269,7 +264,7 @@ export interface IChangeEvent<T = any, S extends StrictRJSFSchema = RJSFSchema,
269
264
  export default class Form<
270
265
  T = any,
271
266
  S extends StrictRJSFSchema = RJSFSchema,
272
- F extends FormContextType = any
267
+ F extends FormContextType = any,
273
268
  > extends Component<FormProps<T, S, F>, FormState<T, S, F>> {
274
269
  /** The ref used to hold the `form` element, this needs to be `any` because `tagName` or `_internalFormWrapper` can
275
270
  * provide any possible type here
@@ -316,7 +311,7 @@ export default class Form<
316
311
  */
317
312
  getSnapshotBeforeUpdate(
318
313
  prevProps: FormProps<T, S, F>,
319
- prevState: FormState<T, S, F>
314
+ prevState: FormState<T, S, F>,
320
315
  ): { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false } {
321
316
  if (!deepEquals(this.props, prevProps)) {
322
317
  const formDataChangedFields = getChangedFields(this.props.formData, prevProps.formData);
@@ -333,7 +328,7 @@ export default class Form<
333
328
  // match one of the subSchemas, the retrieved schema must be updated.
334
329
  isSchemaChanged || isFormDataChanged ? undefined : this.state.retrievedSchema,
335
330
  isSchemaChanged,
336
- formDataChangedFields
331
+ formDataChangedFields,
337
332
  );
338
333
  const shouldUpdate = !deepEquals(nextState, prevState);
339
334
  return { nextState, shouldUpdate };
@@ -349,9 +344,6 @@ export default class Form<
349
344
  * If an update is required, it applies the next state and, if needed, triggers the `onChange` handler to inform about
350
345
  * changes.
351
346
  *
352
- * This method effectively replaces the deprecated `UNSAFE_componentWillReceiveProps`, providing a safer alternative
353
- * to handle prop changes and state updates.
354
- *
355
347
  * @param _ - The previous set of props.
356
348
  * @param prevState - The previous state of the component before the update.
357
349
  * @param snapshot - The value returned from `getSnapshotBeforeUpdate`.
@@ -359,7 +351,7 @@ export default class Form<
359
351
  componentDidUpdate(
360
352
  _: FormProps<T, S, F>,
361
353
  prevState: FormState<T, S, F>,
362
- snapshot: { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false }
354
+ snapshot: { nextState: FormState<T, S, F>; shouldUpdate: true } | { shouldUpdate: false },
363
355
  ) {
364
356
  if (snapshot.shouldUpdate) {
365
357
  const { nextState } = snapshot;
@@ -391,7 +383,7 @@ export default class Form<
391
383
  inputFormData?: T,
392
384
  retrievedSchema?: S,
393
385
  isSchemaChanged = false,
394
- formDataChangedFields: string[] = []
386
+ formDataChangedFields: string[] = [],
395
387
  ): FormState<T, S, F> {
396
388
  const state: FormState<T, S, F> = this.state || {};
397
389
  const schema = 'schema' in props ? props.schema : this.props.schema;
@@ -415,19 +407,19 @@ export default class Form<
415
407
  props.validator,
416
408
  rootSchema,
417
409
  experimental_defaultFormStateBehavior,
418
- experimental_customMergeAllOf
410
+ experimental_customMergeAllOf,
419
411
  )
420
412
  ) {
421
413
  schemaUtils = createSchemaUtils<T, S, F>(
422
414
  props.validator,
423
415
  rootSchema,
424
416
  experimental_defaultFormStateBehavior,
425
- experimental_customMergeAllOf
417
+ experimental_customMergeAllOf,
426
418
  );
427
419
  }
428
420
  const formData: T = schemaUtils.getDefaultFormState(schema, inputFormData) as T;
429
421
  const _retrievedSchema = this.updateRetrievedSchema(
430
- retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData)
422
+ retrievedSchema ?? schemaUtils.retrieveSchema(schema, formData),
431
423
  );
432
424
 
433
425
  const getCurrentErrors = (): ValidationData<T> => {
@@ -461,7 +453,7 @@ export default class Form<
461
453
  errorSchema = mergeObjects(
462
454
  this.state?.errorSchema,
463
455
  schemaValidation.errorSchema,
464
- 'preventDuplicates'
456
+ 'preventDuplicates',
465
457
  ) as ErrorSchema<T>;
466
458
  }
467
459
  schemaValidationErrors = errors;
@@ -471,14 +463,17 @@ export default class Form<
471
463
  errors = currentErrors.errors;
472
464
  errorSchema = currentErrors.errorSchema;
473
465
  if (formDataChangedFields.length > 0) {
474
- const newErrorSchema = formDataChangedFields.reduce((acc, key) => {
475
- acc[key] = undefined;
476
- return acc;
477
- }, {} as Record<string, undefined>);
466
+ const newErrorSchema = formDataChangedFields.reduce(
467
+ (acc, key) => {
468
+ acc[key] = undefined;
469
+ return acc;
470
+ },
471
+ {} as Record<string, undefined>,
472
+ );
478
473
  errorSchema = schemaValidationErrorSchema = mergeObjects(
479
474
  currentErrors.errorSchema,
480
475
  newErrorSchema,
481
- 'preventDuplicates'
476
+ 'preventDuplicates',
482
477
  ) as ErrorSchema<T>;
483
478
  }
484
479
  }
@@ -493,7 +488,7 @@ export default class Form<
493
488
  uiSchema['ui:rootFieldId'],
494
489
  formData,
495
490
  props.idPrefix,
496
- props.idSeparator
491
+ props.idSeparator,
497
492
  );
498
493
  const nextState: FormState<T, S, F> = {
499
494
  schemaUtils,
@@ -548,7 +543,7 @@ export default class Form<
548
543
  formData: T | undefined,
549
544
  schema = this.props.schema,
550
545
  altSchemaUtils?: SchemaUtilsType<T, S, F>,
551
- retrievedSchema?: S
546
+ retrievedSchema?: S,
552
547
  ): ValidationData<T> {
553
548
  const schemaUtils = altSchemaUtils ? altSchemaUtils : this.state.schemaUtils;
554
549
  const { customValidate, transformErrors, uiSchema } = this.props;
@@ -677,8 +672,8 @@ export default class Form<
677
672
 
678
673
  // Removing undefined, null and empty errors.
679
674
  const filterNilOrEmptyErrors = (errors: any, previousCustomValidateErrors: any = {}): ErrorSchema<T> => {
680
- _forEach(errors, (errorAtKey, errorKey: keyof typeof errors) => {
681
- const prevCustomValidateErrorAtKey = previousCustomValidateErrors[errorKey];
675
+ _forEach(errors, (errorAtKey: ErrorSchema<T>['__errors'] | undefined, errorKey: keyof typeof errors) => {
676
+ const prevCustomValidateErrorAtKey: ErrorSchema<T> | undefined = previousCustomValidateErrors[errorKey];
682
677
  if (_isNil(errorAtKey) || (Array.isArray(errorAtKey) && errorAtKey.length === 0)) {
683
678
  delete errors[errorKey];
684
679
  } else if (
@@ -866,7 +861,7 @@ export default class Form<
866
861
  if (onSubmit) {
867
862
  onSubmit({ ...this.state, formData: newFormData, status: 'submitted' }, event);
868
863
  }
869
- }
864
+ },
870
865
  );
871
866
  }
872
867
  };
@@ -981,7 +976,7 @@ export default class Form<
981
976
  } else {
982
977
  console.error('Form validation failed', errors);
983
978
  }
984
- }
979
+ },
985
980
  );
986
981
  } else if (prevErrors.length > 0) {
987
982
  this.setState({
@@ -1026,7 +1021,6 @@ export default class Form<
1026
1021
  action,
1027
1022
  autoComplete,
1028
1023
  enctype,
1029
- acceptcharset,
1030
1024
  acceptCharset,
1031
1025
  noHtml5Validate = false,
1032
1026
  disabled,
@@ -1062,7 +1056,7 @@ export default class Form<
1062
1056
  action={action}
1063
1057
  autoComplete={autoComplete}
1064
1058
  encType={enctype}
1065
- acceptCharset={acceptCharset || acceptcharset}
1059
+ acceptCharset={acceptCharset}
1066
1060
  noValidate={noHtml5Validate}
1067
1061
  onSubmit={this.onSubmit}
1068
1062
  as={as}
@@ -97,7 +97,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
97
97
  */
98
98
  static getDerivedStateFromProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
99
99
  nextProps: Readonly<FieldProps<T[], S, F>>,
100
- prevState: Readonly<ArrayFieldState<T>>
100
+ prevState: Readonly<ArrayFieldState<T>>,
101
101
  ) {
102
102
  // Don't call getDerivedStateFromProps if keyed formdata was just updated.
103
103
  if (prevState.updatedKeyedFormData) {
@@ -130,7 +130,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
130
130
  return get(
131
131
  schema,
132
132
  [ITEMS_KEY, 'title'],
133
- get(schema, [ITEMS_KEY, 'description'], translateString(TranslatableString.ArrayItemTitle))
133
+ get(schema, [ITEMS_KEY, 'description'], translateString(TranslatableString.ArrayItemTitle)),
134
134
  );
135
135
  }
136
136
 
@@ -229,7 +229,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
229
229
  keyedFormData: newKeyedFormData,
230
230
  updatedKeyedFormData: true,
231
231
  },
232
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)
232
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>),
233
233
  );
234
234
  }
235
235
 
@@ -298,7 +298,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
298
298
  keyedFormData: newKeyedFormData,
299
299
  updatedKeyedFormData: true,
300
300
  },
301
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)
301
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>),
302
302
  );
303
303
  };
304
304
  };
@@ -335,7 +335,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
335
335
  keyedFormData: newKeyedFormData,
336
336
  updatedKeyedFormData: true,
337
337
  },
338
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)
338
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>),
339
339
  );
340
340
  };
341
341
  };
@@ -385,7 +385,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
385
385
  {
386
386
  keyedFormData: newKeyedFormData,
387
387
  },
388
- () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>)
388
+ () => onChange(keyedToPlainFormData(newKeyedFormData), newErrorSchema as ErrorSchema<T[]>),
389
389
  );
390
390
  };
391
391
  };
@@ -412,7 +412,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
412
412
  ...errorSchema,
413
413
  [index]: newErrorSchema,
414
414
  },
415
- id
415
+ id,
416
416
  );
417
417
  };
418
418
  };
@@ -433,7 +433,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
433
433
  const UnsupportedFieldTemplate = getTemplate<'UnsupportedFieldTemplate', T[], S, F>(
434
434
  'UnsupportedFieldTemplate',
435
435
  registry,
436
- uiOptions
436
+ uiOptions,
437
437
  );
438
438
 
439
439
  return (
@@ -520,7 +520,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
520
520
  totalItems: keyedFormData.length,
521
521
  });
522
522
  }),
523
- className: `field field-array field-array-of-${itemsSchema.type}`,
523
+ className: `rjsf-field rjsf-field-array rjsf-field-array-of-${itemsSchema.type}`,
524
524
  disabled,
525
525
  idSchema,
526
526
  uiSchema,
@@ -612,7 +612,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
612
612
  } = this.props;
613
613
  const { widgets, schemaUtils, formContext, globalUiOptions } = registry;
614
614
  const itemsSchema = schemaUtils.retrieveSchema(schema.items as S, items);
615
- const enumOptions = optionsList<S, T[], F>(itemsSchema, uiSchema);
615
+ const enumOptions = optionsList<T[], S, F>(itemsSchema, uiSchema);
616
616
  const { widget = 'select', title: uiTitle, ...options } = getUiOptions<T[], S, F>(uiSchema, globalUiOptions);
617
617
  const Widget = getWidget<T[], S, F>(schema, widget, widgets);
618
618
  const label = uiTitle ?? schema.title ?? name;
@@ -720,7 +720,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
720
720
  const { schemaUtils, formContext } = registry;
721
721
  const _schemaItems: S[] = isObject(schema.items) ? (schema.items as S[]) : ([] as S[]);
722
722
  const itemSchemas = _schemaItems.map((item: S, index: number) =>
723
- schemaUtils.retrieveSchema(item, formData[index] as unknown as T[])
723
+ schemaUtils.retrieveSchema(item, formData[index] as unknown as T[]),
724
724
  );
725
725
  const additionalSchema = isObject(schema.additionalItems)
726
726
  ? schemaUtils.retrieveSchema(schema.additionalItems as S, formData)
@@ -736,7 +736,7 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
736
736
  const canAdd = this.canAddItem(items) && !!additionalSchema;
737
737
  const arrayProps: ArrayFieldTemplateProps<T[], S, F> = {
738
738
  canAdd,
739
- className: 'field field-array field-array-fixed-items',
739
+ className: 'rjsf-field rjsf-field-array rjsf-field-array-fixed-items',
740
740
  disabled,
741
741
  idSchema,
742
742
  formData,
@@ -754,8 +754,8 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
754
754
  const itemUiSchema = additional
755
755
  ? uiSchema.additionalItems || {}
756
756
  : Array.isArray(uiSchema.items)
757
- ? uiSchema.items[index]
758
- : uiSchema.items || {};
757
+ ? uiSchema.items[index]
758
+ : uiSchema.items || {};
759
759
  const itemErrorSchema = errorSchema ? (errorSchema[index] as ErrorSchema<T[]>) : undefined;
760
760
 
761
761
  return this.renderArrayFieldItem({
@@ -882,21 +882,31 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
882
882
  rawErrors={rawErrors}
883
883
  />
884
884
  ),
885
- className: 'array-item',
885
+ buttonsProps: {
886
+ idSchema: itemIdSchema,
887
+ disabled: disabled,
888
+ readonly: readonly,
889
+ canAdd,
890
+ hasCopy: has.copy,
891
+ hasMoveUp: has.moveUp,
892
+ hasMoveDown: has.moveDown,
893
+ hasRemove: has.remove,
894
+ index: index,
895
+ totalItems: totalItems,
896
+ onAddIndexClick: this.onAddIndexClick,
897
+ onCopyIndexClick: this.onCopyIndexClick,
898
+ onDropIndexClick: this.onDropIndexClick,
899
+ onReorderClick: this.onReorderClick,
900
+ registry: registry,
901
+ schema: itemSchema,
902
+ uiSchema: itemUiSchema,
903
+ },
904
+ className: 'rjsf-array-item',
886
905
  disabled,
887
- canAdd,
888
- hasCopy: has.copy,
889
906
  hasToolbar: has.toolbar,
890
- hasMoveUp: has.moveUp,
891
- hasMoveDown: has.moveDown,
892
- hasRemove: has.remove,
893
907
  index,
894
908
  totalItems,
895
909
  key,
896
- onAddIndexClick: this.onAddIndexClick,
897
- onCopyIndexClick: this.onCopyIndexClick,
898
- onDropIndexClick: this.onDropIndexClick,
899
- onReorderClick: this.onReorderClick,
900
910
  readonly,
901
911
  registry,
902
912
  schema: itemSchema,
@@ -17,7 +17,7 @@ import isObject from 'lodash/isObject';
17
17
  * @param props - The `FieldProps` for this template
18
18
  */
19
19
  function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
20
- props: FieldProps<T, S, F>
20
+ props: FieldProps<T, S, F>,
21
21
  ) {
22
22
  const {
23
23
  schema,
@@ -44,6 +44,7 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
44
44
  title: uiTitle,
45
45
  // Unlike the other fields, don't use `getDisplayLabel()` since it always returns false for the boolean type
46
46
  label: displayLabel = true,
47
+ enumNames,
47
48
  ...options
48
49
  } = getUiOptions<T, S, F>(uiSchema, globalUiOptions);
49
50
  const Widget = getWidget(schema, widget, widgets);
@@ -52,7 +53,7 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
52
53
  let enumOptions: EnumOptionsType<S>[] | undefined;
53
54
  const label = uiTitle ?? schemaTitle ?? title ?? name;
54
55
  if (Array.isArray(schema.oneOf)) {
55
- enumOptions = optionsList<S, T, F>(
56
+ enumOptions = optionsList<T, S, F>(
56
57
  {
57
58
  oneOf: schema.oneOf
58
59
  .map((option) => {
@@ -66,13 +67,11 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
66
67
  })
67
68
  .filter((o: any) => o) as S[], // cast away the error that typescript can't grok is fixed
68
69
  } as unknown as S,
69
- uiSchema
70
+ uiSchema,
70
71
  );
71
72
  } else {
72
- // We deprecated enumNames in v5. It's intentionally omitted from RSJFSchema type, so we need to cast here.
73
- const schemaWithEnumNames = schema as S & { enumNames?: string[] };
74
73
  const enums = schema.enum ?? [true, false];
75
- if (!schemaWithEnumNames.enumNames && enums.length === 2 && enums.every((v: any) => typeof v === 'boolean')) {
74
+ if (!enumNames && enums.length === 2 && enums.every((v: any) => typeof v === 'boolean')) {
76
75
  enumOptions = [
77
76
  {
78
77
  value: enums[0],
@@ -84,14 +83,7 @@ function BooleanField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extend
84
83
  },
85
84
  ];
86
85
  } else {
87
- enumOptions = optionsList<S, T, F>(
88
- {
89
- enum: enums,
90
- // NOTE: enumNames is deprecated, but still supported for now.
91
- enumNames: schemaWithEnumNames.enumNames,
92
- } as unknown as S,
93
- uiSchema
94
- );
86
+ enumOptions = optionsList<T, S, F>({ enum: enums } as S, uiSchema);
95
87
  }
96
88
  }
97
89