@rjsf/mui 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 (57) hide show
  1. package/README.md +4 -4
  2. package/dist/index.js +201 -238
  3. package/dist/index.js.map +4 -4
  4. package/dist/mui.esm.js +99 -130
  5. package/dist/mui.esm.js.map +4 -4
  6. package/dist/mui.umd.js +36 -78
  7. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
  8. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +7 -5
  9. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  10. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
  11. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +4 -4
  12. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  13. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  14. package/lib/DescriptionField/DescriptionField.js.map +1 -1
  15. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  16. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  17. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  18. package/lib/GridTemplate/GridTemplate.d.ts +7 -0
  19. package/lib/GridTemplate/GridTemplate.js +12 -0
  20. package/lib/GridTemplate/GridTemplate.js.map +1 -0
  21. package/lib/GridTemplate/index.d.ts +2 -0
  22. package/lib/GridTemplate/index.js +3 -0
  23. package/lib/GridTemplate/index.js.map +1 -0
  24. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +5 -5
  25. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  26. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  27. package/lib/Templates/Templates.js +2 -0
  28. package/lib/Templates/Templates.js.map +1 -1
  29. package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
  30. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +3 -3
  31. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  32. package/lib/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +44 -38
  34. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +25 -63
  35. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +15 -13
  36. package/src/BaseInputTemplate/BaseInputTemplate.tsx +1 -1
  37. package/src/CheckboxWidget/CheckboxWidget.tsx +2 -2
  38. package/src/CheckboxesWidget/CheckboxesWidget.tsx +2 -2
  39. package/src/DescriptionField/DescriptionField.tsx +1 -1
  40. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +1 -1
  41. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +1 -1
  42. package/src/FieldTemplate/FieldTemplate.tsx +2 -2
  43. package/src/GridTemplate/GridTemplate.tsx +16 -0
  44. package/src/GridTemplate/index.ts +2 -0
  45. package/src/IconButton/IconButton.tsx +5 -5
  46. package/src/MuiForm/MuiForm.tsx +1 -1
  47. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +16 -14
  48. package/src/RadioWidget/RadioWidget.tsx +1 -1
  49. package/src/RangeWidget/RangeWidget.tsx +2 -2
  50. package/src/SelectWidget/SelectWidget.tsx +1 -1
  51. package/src/SubmitButton/SubmitButton.tsx +1 -1
  52. package/src/Templates/Templates.ts +3 -1
  53. package/src/TextareaWidget/TextareaWidget.tsx +1 -1
  54. package/src/Theme/Theme.tsx +1 -1
  55. package/src/Widgets/Widgets.ts +1 -1
  56. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +12 -11
  57. package/LICENSE.md +0 -201
package/package.json CHANGED
@@ -1,17 +1,45 @@
1
1
  {
2
2
  "name": "@rjsf/mui",
3
- "version": "5.24.10",
3
+ "version": "6.0.0-beta.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
+ "type": "module",
7
8
  "description": "Material UI 5 theme, fields and widgets for react-jsonschema-form",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./lib/index.d.ts",
12
+ "require": "./dist/index.js",
13
+ "import": "./lib/index.js"
14
+ },
15
+ "./lib": {
16
+ "types": "./lib/index.d.ts",
17
+ "require": "./dist/index.js",
18
+ "import": "./lib/index.js"
19
+ },
20
+ "./lib/*.js": {
21
+ "types": "./lib/*.d.ts",
22
+ "require": "./dist/*.js",
23
+ "import": "./lib/*.js"
24
+ },
25
+ "./dist": {
26
+ "types": "./lib/index.d.ts",
27
+ "require": "./dist/index.js",
28
+ "import": "./lib/index.js"
29
+ },
30
+ "./dist/*.js": {
31
+ "types": "./lib/*.d.ts",
32
+ "require": "./dist/*.js",
33
+ "import": "./lib/*.js"
34
+ }
35
+ },
8
36
  "files": [
9
37
  "dist",
10
38
  "lib",
11
39
  "src"
12
40
  ],
13
41
  "scripts": {
14
- "compileReplacer": "tsc -p tsconfig.replacer.json",
42
+ "compileReplacer": "tsc -p tsconfig.replacer.json && move-file muiReplacer.js muiReplacer.cjs",
15
43
  "build:ts": "npm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
16
44
  "build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --sourcemap --packages=external --format=cjs",
17
45
  "build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/mui.esm.js --sourcemap --packages=external --format=esm",
@@ -30,49 +58,28 @@
30
58
  ]
31
59
  },
32
60
  "engines": {
33
- "node": ">=14"
61
+ "node": ">=20"
34
62
  },
35
63
  "peerDependencies": {
36
64
  "@emotion/react": "^11.7.0",
37
65
  "@emotion/styled": "^11.6.0",
38
- "@mui/icons-material": "^5.2.0 || ^6.0.0",
39
- "@mui/material": "^5.2.2 || ^6.0.0",
40
- "@rjsf/core": "^5.24.x",
41
- "@rjsf/utils": "^5.24.x",
42
- "react": ">=17"
66
+ "@mui/icons-material": "^6.0.0",
67
+ "@mui/material": "^6.0.0",
68
+ "@rjsf/core": "^6.x",
69
+ "@rjsf/utils": "^6.x",
70
+ "react": ">=18"
43
71
  },
44
72
  "devDependencies": {
45
- "@babel/core": "^7.23.9",
46
- "@babel/plugin-proposal-class-properties": "^7.18.6",
47
- "@babel/plugin-proposal-optional-chaining": "^7.21.0",
48
- "@babel/preset-env": "^7.23.9",
49
- "@babel/preset-react": "^7.23.3",
50
- "@babel/preset-typescript": "^7.23.3",
51
73
  "@emotion/jest": "^11.11.0",
52
74
  "@emotion/react": "^11.11.3",
53
75
  "@emotion/styled": "^11.11.0",
54
- "@mui/base": "5.0.0-beta.28",
55
- "@mui/icons-material": "6.0.2",
56
- "@mui/material": "6.0.2",
57
- "@rjsf/core": "^5.24.10",
58
- "@rjsf/snapshot-tests": "^5.24.10",
59
- "@rjsf/utils": "^5.24.10",
60
- "@rjsf/validator-ajv8": "^5.24.10",
61
- "@types/jest": "^29.5.12",
62
- "@types/react": "^18.2.58",
63
- "@types/react-dom": "^18.2.19",
64
- "@types/react-test-renderer": "^18.0.7",
65
- "babel-jest": "^29.7.0",
66
- "eslint": "^8.56.0",
67
- "jest": "^29.7.0",
68
- "jest-environment-jsdom": "^29.7.0",
69
- "jest-watch-typeahead": "^2.2.2",
70
- "react": "^18.2.0",
71
- "react-dom": "^18.2.0",
72
- "react-test-renderer": "^18.2.0",
73
- "rimraf": "^5.0.5",
74
- "rollup": "^3.29.4",
75
- "typescript": "^4.9.5"
76
+ "@mui/icons-material": "^6.4.11",
77
+ "@mui/material": "^6.4.11",
78
+ "@rjsf/core": "^6.0.0-beta.1",
79
+ "@rjsf/snapshot-tests": "^6.0.0-beta.1",
80
+ "@rjsf/utils": "^6.0.0-beta.1",
81
+ "@rjsf/validator-ajv8": "^6.0.0-beta.1",
82
+ "eslint": "^8.56.0"
76
83
  },
77
84
  "publishConfig": {
78
85
  "access": "public"
@@ -99,6 +106,5 @@
99
106
  "type": "git",
100
107
  "url": "git+https://github.com/rjsf-team/react-jsonschema-form.git"
101
108
  },
102
- "license": "Apache-2.0",
103
- "gitHead": "ad33d7c324cb040d0f34da30a17caea0251f1e3a"
109
+ "license": "Apache-2.0"
104
110
  }
@@ -1,35 +1,32 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import Box from '@mui/material/Box';
3
- import Grid from '@mui/material/Grid';
3
+ import Grid2 from '@mui/material/Grid2';
4
4
  import Paper from '@mui/material/Paper';
5
- import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
5
+ import {
6
+ ArrayFieldItemTemplateType,
7
+ FormContextType,
8
+ getUiOptions,
9
+ getTemplate,
10
+ RJSFSchema,
11
+ StrictRJSFSchema,
12
+ } from '@rjsf/utils';
6
13
 
7
14
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
8
15
  *
9
- * @param props - The `ArrayFieldTemplateItemType` props for the component
16
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
10
17
  */
11
18
  export default function ArrayFieldItemTemplate<
12
19
  T = any,
13
20
  S extends StrictRJSFSchema = RJSFSchema,
14
- F extends FormContextType = any
15
- >(props: ArrayFieldTemplateItemType<T, S, F>) {
16
- const {
17
- children,
18
- disabled,
19
- hasToolbar,
20
- hasCopy,
21
- hasMoveDown,
22
- hasMoveUp,
23
- hasRemove,
24
- index,
25
- onCopyIndexClick,
26
- onDropIndexClick,
27
- onReorderClick,
28
- readonly,
29
- uiSchema,
21
+ F extends FormContextType = any,
22
+ >(props: ArrayFieldItemTemplateType<T, S, F>) {
23
+ const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
24
+ const uiOptions = getUiOptions<T, S, F>(uiSchema);
25
+ const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
26
+ 'ArrayFieldItemButtonsTemplate',
30
27
  registry,
31
- } = props;
32
- const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
28
+ uiOptions,
29
+ );
33
30
  const btnStyle: CSSProperties = {
34
31
  flex: 1,
35
32
  paddingLeft: 6,
@@ -38,54 +35,19 @@ export default function ArrayFieldItemTemplate<
38
35
  minWidth: 0,
39
36
  };
40
37
  return (
41
- <Grid container={true} alignItems='center'>
42
- <Grid item={true} xs style={{ overflow: 'auto' }}>
38
+ <Grid2 container={true} alignItems='center'>
39
+ <Grid2 size='auto' style={{ overflow: 'auto' }}>
43
40
  <Box mb={2}>
44
41
  <Paper elevation={2}>
45
42
  <Box p={2}>{children}</Box>
46
43
  </Paper>
47
44
  </Box>
48
- </Grid>
45
+ </Grid2>
49
46
  {hasToolbar && (
50
- <Grid item={true}>
51
- {(hasMoveUp || hasMoveDown) && (
52
- <MoveUpButton
53
- style={btnStyle}
54
- disabled={disabled || readonly || !hasMoveUp}
55
- onClick={onReorderClick(index, index - 1)}
56
- uiSchema={uiSchema}
57
- registry={registry}
58
- />
59
- )}
60
- {(hasMoveUp || hasMoveDown) && (
61
- <MoveDownButton
62
- style={btnStyle}
63
- disabled={disabled || readonly || !hasMoveDown}
64
- onClick={onReorderClick(index, index + 1)}
65
- uiSchema={uiSchema}
66
- registry={registry}
67
- />
68
- )}
69
- {hasCopy && (
70
- <CopyButton
71
- style={btnStyle}
72
- disabled={disabled || readonly}
73
- onClick={onCopyIndexClick(index)}
74
- uiSchema={uiSchema}
75
- registry={registry}
76
- />
77
- )}
78
- {hasRemove && (
79
- <RemoveButton
80
- style={btnStyle}
81
- disabled={disabled || readonly}
82
- onClick={onDropIndexClick(index)}
83
- uiSchema={uiSchema}
84
- registry={registry}
85
- />
86
- )}
87
- </Grid>
47
+ <Grid2>
48
+ <ArrayFieldItemButtonsTemplate {...buttonsProps} style={btnStyle} />
49
+ </Grid2>
88
50
  )}
89
- </Grid>
51
+ </Grid2>
90
52
  );
91
53
  }
@@ -1,24 +1,25 @@
1
1
  import Box from '@mui/material/Box';
2
- import Grid from '@mui/material/Grid';
2
+ import Grid2 from '@mui/material/Grid2';
3
3
  import Paper from '@mui/material/Paper';
4
4
  import {
5
5
  getTemplate,
6
6
  getUiOptions,
7
7
  ArrayFieldTemplateProps,
8
- ArrayFieldTemplateItemType,
8
+ ArrayFieldItemTemplateType,
9
9
  FormContextType,
10
10
  RJSFSchema,
11
11
  StrictRJSFSchema,
12
+ buttonId,
12
13
  } from '@rjsf/utils';
13
14
 
14
15
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
15
16
  *
16
- * @param props - The `ArrayFieldTemplateItemType` props for the component
17
+ * @param props - The `ArrayFieldItemTemplateType` props for the component
17
18
  */
18
19
  export default function ArrayFieldTemplate<
19
20
  T = any,
20
21
  S extends StrictRJSFSchema = RJSFSchema,
21
- F extends FormContextType = any
22
+ F extends FormContextType = any,
22
23
  >(props: ArrayFieldTemplateProps<T, S, F>) {
23
24
  const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } =
24
25
  props;
@@ -26,17 +27,17 @@ export default function ArrayFieldTemplate<
26
27
  const ArrayFieldDescriptionTemplate = getTemplate<'ArrayFieldDescriptionTemplate', T, S, F>(
27
28
  'ArrayFieldDescriptionTemplate',
28
29
  registry,
29
- uiOptions
30
+ uiOptions,
30
31
  );
31
32
  const ArrayFieldItemTemplate = getTemplate<'ArrayFieldItemTemplate', T, S, F>(
32
33
  'ArrayFieldItemTemplate',
33
34
  registry,
34
- uiOptions
35
+ uiOptions,
35
36
  );
36
37
  const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(
37
38
  'ArrayFieldTitleTemplate',
38
39
  registry,
39
- uiOptions
40
+ uiOptions,
40
41
  );
41
42
  // Button templates are not overridden in the uiSchema
42
43
  const {
@@ -61,23 +62,24 @@ export default function ArrayFieldTemplate<
61
62
  registry={registry}
62
63
  />
63
64
  {items &&
64
- items.map(({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (
65
+ items.map(({ key, ...itemProps }: ArrayFieldItemTemplateType<T, S, F>) => (
65
66
  <ArrayFieldItemTemplate key={key} {...itemProps} />
66
67
  ))}
67
68
  {canAdd && (
68
- <Grid container justifyContent='flex-end'>
69
- <Grid item={true}>
69
+ <Grid2 container justifyContent='flex-end'>
70
+ <Grid2>
70
71
  <Box mt={2}>
71
72
  <AddButton
72
- className='array-item-add'
73
+ id={buttonId<T>(idSchema, 'add')}
74
+ className='rjsf-array-item-add'
73
75
  onClick={onAddClick}
74
76
  disabled={disabled || readonly}
75
77
  uiSchema={uiSchema}
76
78
  registry={registry}
77
79
  />
78
80
  </Box>
79
- </Grid>
80
- </Grid>
81
+ </Grid2>
82
+ </Grid2>
81
83
  )}
82
84
  </Box>
83
85
  </Paper>
@@ -22,7 +22,7 @@ const TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
22
22
  export default function BaseInputTemplate<
23
23
  T = any,
24
24
  S extends StrictRJSFSchema = RJSFSchema,
25
- F extends FormContextType = any
25
+ F extends FormContextType = any,
26
26
  >(props: BaseInputTemplateProps<T, S, F>) {
27
27
  const {
28
28
  id,
@@ -21,7 +21,7 @@ import {
21
21
  export default function CheckboxWidget<
22
22
  T = any,
23
23
  S extends StrictRJSFSchema = RJSFSchema,
24
- F extends FormContextType = any
24
+ F extends FormContextType = any,
25
25
  >(props: WidgetProps<T, S, F>) {
26
26
  const {
27
27
  schema,
@@ -42,7 +42,7 @@ export default function CheckboxWidget<
42
42
  const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
43
43
  'DescriptionFieldTemplate',
44
44
  registry,
45
- options
45
+ options,
46
46
  );
47
47
  // Because an unchecked checkbox will cause html5 validation to fail, only add
48
48
  // the "required" attribute if the field value must be "true", due to the
@@ -25,7 +25,7 @@ import {
25
25
  export default function CheckboxesWidget<
26
26
  T = any,
27
27
  S extends StrictRJSFSchema = RJSFSchema,
28
- F extends FormContextType = any
28
+ F extends FormContextType = any,
29
29
  >({
30
30
  label,
31
31
  hideLabel,
@@ -64,7 +64,7 @@ export default function CheckboxesWidget<
64
64
  <FormLabel required={required} htmlFor={id}>
65
65
  {label || undefined}
66
66
  </FormLabel>,
67
- hideLabel
67
+ hideLabel,
68
68
  )}
69
69
  <FormGroup id={id} row={!!inline}>
70
70
  {Array.isArray(enumOptions) &&
@@ -8,7 +8,7 @@ import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema }
8
8
  export default function DescriptionField<
9
9
  T = any,
10
10
  S extends StrictRJSFSchema = RJSFSchema,
11
- F extends FormContextType = any
11
+ F extends FormContextType = any,
12
12
  >(props: DescriptionFieldProps<T, S, F>) {
13
13
  const { id, description } = props;
14
14
  if (description) {
@@ -10,7 +10,7 @@ import { errorId, FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema
10
10
  export default function FieldErrorTemplate<
11
11
  T = any,
12
12
  S extends StrictRJSFSchema = RJSFSchema,
13
- F extends FormContextType = any
13
+ F extends FormContextType = any,
14
14
  >(props: FieldErrorProps<T, S, F>) {
15
15
  const { errors = [], idSchema } = props;
16
16
  if (errors.length === 0) {
@@ -8,7 +8,7 @@ import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema }
8
8
  export default function FieldHelpTemplate<
9
9
  T = any,
10
10
  S extends StrictRJSFSchema = RJSFSchema,
11
- F extends FormContextType = any
11
+ F extends FormContextType = any,
12
12
  >(props: FieldHelpProps<T, S, F>) {
13
13
  const { idSchema, help } = props;
14
14
  if (!help) {
@@ -17,7 +17,7 @@ import {
17
17
  export default function FieldTemplate<
18
18
  T = any,
19
19
  S extends StrictRJSFSchema = RJSFSchema,
20
- F extends FormContextType = any
20
+ F extends FormContextType = any,
21
21
  >(props: FieldTemplateProps<T, S, F>) {
22
22
  const {
23
23
  id,
@@ -45,7 +45,7 @@ export default function FieldTemplate<
45
45
  const WrapIfAdditionalTemplate = getTemplate<'WrapIfAdditionalTemplate', T, S, F>(
46
46
  'WrapIfAdditionalTemplate',
47
47
  registry,
48
- uiOptions
48
+ uiOptions,
49
49
  );
50
50
 
51
51
  if (hidden) {
@@ -0,0 +1,16 @@
1
+ import Grid2 from '@mui/material/Grid2';
2
+ import { GridTemplateProps } from '@rjsf/utils';
3
+
4
+ /** Renders a `GridTemplate` for mui, which is expecting the column sizing information coming in via the
5
+ * extra props provided by the caller, which are spread directly on the `Grid2`.
6
+ *
7
+ * @param props - The GridTemplateProps, including the extra props containing the mui grid positioning details
8
+ */
9
+ export default function GridTemplate(props: GridTemplateProps) {
10
+ const { children, column, ...rest } = props;
11
+ return (
12
+ <Grid2 container={!column} {...rest}>
13
+ {children}
14
+ </Grid2>
15
+ );
16
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from './GridTemplate';
2
+ export * from './GridTemplate';
@@ -8,7 +8,7 @@ import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, Transla
8
8
  export default function MuiIconButton<
9
9
  T = any,
10
10
  S extends StrictRJSFSchema = RJSFSchema,
11
- F extends FormContextType = any
11
+ F extends FormContextType = any,
12
12
  >(props: IconButtonProps<T, S, F>) {
13
13
  const { icon, color, uiSchema, registry, ...otherProps } = props;
14
14
  return (
@@ -19,7 +19,7 @@ export default function MuiIconButton<
19
19
  }
20
20
 
21
21
  export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
22
- props: IconButtonProps<T, S, F>
22
+ props: IconButtonProps<T, S, F>,
23
23
  ) {
24
24
  const {
25
25
  registry: { translateString },
@@ -34,7 +34,7 @@ export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
34
34
  }
35
35
 
36
36
  export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
37
- props: IconButtonProps<T, S, F>
37
+ props: IconButtonProps<T, S, F>,
38
38
  ) {
39
39
  const {
40
40
  registry: { translateString },
@@ -49,7 +49,7 @@ export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema,
49
49
  }
50
50
 
51
51
  export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
52
- props: IconButtonProps<T, S, F>
52
+ props: IconButtonProps<T, S, F>,
53
53
  ) {
54
54
  const {
55
55
  registry: { translateString },
@@ -64,7 +64,7 @@ export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
64
64
  }
65
65
 
66
66
  export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
67
- props: IconButtonProps<T, S, F>
67
+ props: IconButtonProps<T, S, F>,
68
68
  ) {
69
69
  const { iconType, ...otherProps } = props;
70
70
  const {
@@ -7,7 +7,7 @@ import { generateTheme } from '../Theme';
7
7
  export function generateForm<
8
8
  T = any,
9
9
  S extends StrictRJSFSchema = RJSFSchema,
10
- F extends FormContextType = any
10
+ F extends FormContextType = any,
11
11
  >(): ComponentType<FormProps<T, S, F>> {
12
12
  return withTheme<T, S, F>(generateTheme<T, S, F>());
13
13
  }
@@ -1,4 +1,4 @@
1
- import Grid from '@mui/material/Grid';
1
+ import Grid2 from '@mui/material/Grid2';
2
2
  import {
3
3
  FormContextType,
4
4
  ObjectFieldTemplateProps,
@@ -9,6 +9,7 @@ import {
9
9
  getTemplate,
10
10
  getUiOptions,
11
11
  titleId,
12
+ buttonId,
12
13
  } from '@rjsf/utils';
13
14
 
14
15
  /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
@@ -20,7 +21,7 @@ import {
20
21
  export default function ObjectFieldTemplate<
21
22
  T = any,
22
23
  S extends StrictRJSFSchema = RJSFSchema,
23
- F extends FormContextType = any
24
+ F extends FormContextType = any,
24
25
  >(props: ObjectFieldTemplateProps<T, S, F>) {
25
26
  const {
26
27
  description,
@@ -41,7 +42,7 @@ export default function ObjectFieldTemplate<
41
42
  const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
42
43
  'DescriptionFieldTemplate',
43
44
  registry,
44
- uiOptions
45
+ uiOptions,
45
46
  );
46
47
  // Button templates are not overridden in the uiSchema
47
48
  const {
@@ -68,32 +69,33 @@ export default function ObjectFieldTemplate<
68
69
  registry={registry}
69
70
  />
70
71
  )}
71
- <Grid container={true} spacing={2} style={{ marginTop: '10px' }}>
72
+ <Grid2 container={true} spacing={2} style={{ marginTop: '10px' }}>
72
73
  {properties.map((element, index) =>
73
- // Remove the <Grid> if the inner element is hidden as the <Grid>
74
+ // Remove the <Grid2> if the inner element is hidden as the <Grid2>
74
75
  // itself would otherwise still take up space.
75
76
  element.hidden ? (
76
77
  element.content
77
78
  ) : (
78
- <Grid item={true} xs={12} key={index} style={{ marginBottom: '10px' }}>
79
+ <Grid2 size={{ xs: 12 }} key={index} style={{ marginBottom: '10px' }}>
79
80
  {element.content}
80
- </Grid>
81
- )
81
+ </Grid2>
82
+ ),
82
83
  )}
83
84
  {canExpand<T, S, F>(schema, uiSchema, formData) && (
84
- <Grid container justifyContent='flex-end'>
85
- <Grid item={true}>
85
+ <Grid2 container justifyContent='flex-end'>
86
+ <Grid2>
86
87
  <AddButton
87
- className='object-property-expand'
88
+ id={buttonId<T>(idSchema, 'add')}
89
+ className='rjsf-object-property-expand'
88
90
  onClick={onAddClick(schema)}
89
91
  disabled={disabled || readonly}
90
92
  uiSchema={uiSchema}
91
93
  registry={registry}
92
94
  />
93
- </Grid>
94
- </Grid>
95
+ </Grid2>
96
+ </Grid2>
95
97
  )}
96
- </Grid>
98
+ </Grid2>
97
99
  </>
98
100
  );
99
101
  }
@@ -50,7 +50,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
50
50
  <FormLabel required={required} htmlFor={id}>
51
51
  {label || undefined}
52
52
  </FormLabel>,
53
- hideLabel
53
+ hideLabel,
54
54
  )}
55
55
  <RadioGroup
56
56
  id={id}
@@ -17,7 +17,7 @@ import {
17
17
  * @param props - The `WidgetProps` for this component
18
18
  */
19
19
  export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
20
- props: WidgetProps<T, S, F>
20
+ props: WidgetProps<T, S, F>,
21
21
  ) {
22
22
  const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } =
23
23
  props;
@@ -35,7 +35,7 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
35
35
  <FormLabel required={required} htmlFor={id}>
36
36
  {label || undefined}
37
37
  </FormLabel>,
38
- hideLabel
38
+ hideLabel,
39
39
  )}
40
40
  <Slider
41
41
  disabled={disabled || readonly}
@@ -20,7 +20,7 @@ import {
20
20
  export default function SelectWidget<
21
21
  T = any,
22
22
  S extends StrictRJSFSchema = RJSFSchema,
23
- F extends FormContextType = any
23
+ F extends FormContextType = any,
24
24
  >({
25
25
  schema,
26
26
  id,
@@ -7,7 +7,7 @@ import { getSubmitButtonOptions, FormContextType, RJSFSchema, StrictRJSFSchema,
7
7
  export default function SubmitButton<
8
8
  T = any,
9
9
  S extends StrictRJSFSchema = RJSFSchema,
10
- F extends FormContextType = any
10
+ F extends FormContextType = any,
11
11
  >({ uiSchema }: SubmitButtonProps<T, S, F>) {
12
12
  const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions<T, S, F>(uiSchema);
13
13
  if (norender) {
@@ -10,6 +10,7 @@ import { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from '../IconB
10
10
  import FieldErrorTemplate from '../FieldErrorTemplate';
11
11
  import FieldHelpTemplate from '../FieldHelpTemplate';
12
12
  import FieldTemplate from '../FieldTemplate';
13
+ import GridTemplate from '../GridTemplate';
13
14
  import ObjectFieldTemplate from '../ObjectFieldTemplate';
14
15
  import SubmitButton from '../SubmitButton';
15
16
  import TitleField from '../TitleField';
@@ -18,7 +19,7 @@ import WrapIfAdditionalTemplate from '../WrapIfAdditionalTemplate';
18
19
  export function generateTemplates<
19
20
  T = any,
20
21
  S extends StrictRJSFSchema = RJSFSchema,
21
- F extends FormContextType = any
22
+ F extends FormContextType = any,
22
23
  >(): Partial<TemplatesType<T, S, F>> {
23
24
  return {
24
25
  ArrayFieldItemTemplate,
@@ -37,6 +38,7 @@ export function generateTemplates<
37
38
  FieldErrorTemplate,
38
39
  FieldHelpTemplate,
39
40
  FieldTemplate,
41
+ GridTemplate,
40
42
  ObjectFieldTemplate,
41
43
  TitleFieldTemplate: TitleField,
42
44
  WrapIfAdditionalTemplate,
@@ -7,7 +7,7 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps, getTemplate
7
7
  export default function TextareaWidget<
8
8
  T = any,
9
9
  S extends StrictRJSFSchema = RJSFSchema,
10
- F extends FormContextType = any
10
+ F extends FormContextType = any,
11
11
  >(props: WidgetProps<T, S, F>) {
12
12
  const { options, registry } = props;
13
13
  const BaseInputTemplate = getTemplate<'BaseInputTemplate', T, S, F>('BaseInputTemplate', registry, options);
@@ -7,7 +7,7 @@ import { generateWidgets } from '../Widgets';
7
7
  export function generateTheme<
8
8
  T = any,
9
9
  S extends StrictRJSFSchema = RJSFSchema,
10
- F extends FormContextType = any
10
+ F extends FormContextType = any,
11
11
  >(): ThemeProps<T, S, F> {
12
12
  return {
13
13
  templates: generateTemplates<T, S, F>(),