@rjsf/mui 6.6.1 → 6.6.2

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 (108) hide show
  1. package/dist/index.cjs +90 -71
  2. package/dist/index.cjs.map +3 -3
  3. package/dist/mui.esm.js +103 -145
  4. package/dist/mui.esm.js.map +3 -3
  5. package/dist/mui.umd.js +85 -67
  6. package/lib/AddButton/AddButton.d.ts +1 -1
  7. package/lib/AddButton/AddButton.js +1 -1
  8. package/lib/AddButton/AddButton.js.map +1 -1
  9. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +4 -4
  10. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
  11. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  12. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +4 -4
  13. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
  14. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  15. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +3 -3
  16. package/lib/BaseInputTemplate/BaseInputTemplate.js +7 -7
  17. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  18. package/lib/CheckboxWidget/CheckboxWidget.d.ts +3 -3
  19. package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
  20. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  21. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +4 -4
  22. package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
  23. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  24. package/lib/DescriptionField/DescriptionField.d.ts +2 -2
  25. package/lib/DescriptionField/DescriptionField.js +1 -1
  26. package/lib/DescriptionField/DescriptionField.js.map +1 -1
  27. package/lib/ErrorList/ErrorList.d.ts +8 -8
  28. package/lib/ErrorList/ErrorList.js +2 -4
  29. package/lib/ErrorList/ErrorList.js.map +1 -1
  30. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +4 -4
  31. package/lib/FieldErrorTemplate/FieldErrorTemplate.js +2 -4
  32. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  33. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +2 -2
  34. package/lib/FieldHelpTemplate/FieldHelpTemplate.js +1 -1
  35. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  36. package/lib/FieldTemplate/FieldTemplate.d.ts +3 -3
  37. package/lib/FieldTemplate/FieldTemplate.js +2 -2
  38. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  39. package/lib/GridTemplate/GridTemplate.d.ts +1 -1
  40. package/lib/IconButton/IconButton.d.ts +14 -7
  41. package/lib/IconButton/IconButton.js +15 -7
  42. package/lib/IconButton/IconButton.js.map +1 -1
  43. package/lib/MuiForm/MuiForm.d.ts +3 -3
  44. package/lib/MuiForm/MuiForm.js.map +1 -1
  45. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +3 -3
  46. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +1 -1
  47. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -1
  48. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +2 -2
  49. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +3 -3
  50. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  51. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
  52. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
  53. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
  54. package/lib/RadioWidget/RadioWidget.d.ts +4 -4
  55. package/lib/RadioWidget/RadioWidget.js +6 -6
  56. package/lib/RadioWidget/RadioWidget.js.map +1 -1
  57. package/lib/RangeWidget/RangeWidget.d.ts +2 -2
  58. package/lib/RangeWidget/RangeWidget.js +6 -6
  59. package/lib/RangeWidget/RangeWidget.js.map +1 -1
  60. package/lib/SelectWidget/SelectWidget.d.ts +3 -3
  61. package/lib/SelectWidget/SelectWidget.js +7 -7
  62. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  63. package/lib/SubmitButton/SubmitButton.d.ts +3 -3
  64. package/lib/SubmitButton/SubmitButton.js +1 -1
  65. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  66. package/lib/Templates/Templates.d.ts +1 -1
  67. package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
  68. package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
  69. package/lib/Theme/Theme.d.ts +2 -2
  70. package/lib/TitleField/TitleField.d.ts +5 -5
  71. package/lib/TitleField/TitleField.js +1 -1
  72. package/lib/TitleField/TitleField.js.map +1 -1
  73. package/lib/Widgets/Widgets.d.ts +1 -1
  74. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +2 -2
  75. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
  76. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  77. package/lib/tsconfig.tsbuildinfo +1 -1
  78. package/lib/util.d.ts +2 -2
  79. package/lib/util.js +3 -3
  80. package/package.json +6 -6
  81. package/src/AddButton/AddButton.tsx +4 -9
  82. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +9 -7
  83. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +8 -7
  84. package/src/BaseInputTemplate/BaseInputTemplate.tsx +17 -18
  85. package/src/CheckboxWidget/CheckboxWidget.tsx +12 -20
  86. package/src/CheckboxesWidget/CheckboxesWidget.tsx +16 -17
  87. package/src/DescriptionField/DescriptionField.tsx +4 -3
  88. package/src/ErrorList/ErrorList.tsx +26 -27
  89. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +17 -22
  90. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +4 -10
  91. package/src/FieldTemplate/FieldTemplate.tsx +8 -13
  92. package/src/GridTemplate/GridTemplate.tsx +1 -1
  93. package/src/IconButton/IconButton.tsx +20 -19
  94. package/src/MuiForm/MuiForm.tsx +4 -3
  95. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +6 -4
  96. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +6 -10
  97. package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
  98. package/src/RadioWidget/RadioWidget.tsx +17 -18
  99. package/src/RangeWidget/RangeWidget.tsx +12 -19
  100. package/src/SelectWidget/SelectWidget.tsx +21 -20
  101. package/src/SubmitButton/SubmitButton.tsx +6 -11
  102. package/src/Templates/Templates.ts +1 -1
  103. package/src/TextareaWidget/TextareaWidget.tsx +2 -1
  104. package/src/Theme/Theme.tsx +2 -2
  105. package/src/TitleField/TitleField.tsx +11 -13
  106. package/src/Widgets/Widgets.ts +1 -1
  107. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -8
  108. package/src/util.ts +5 -5
@@ -1,13 +1,15 @@
1
- import Box, { BoxProps } from '@mui/material/Box';
2
- import FormControl, { FormControlProps } from '@mui/material/FormControl';
3
- import {
1
+ import type { BoxProps } from '@mui/material/Box';
2
+ import Box from '@mui/material/Box';
3
+ import type { FormControlProps } from '@mui/material/FormControl';
4
+ import FormControl from '@mui/material/FormControl';
5
+ import type {
4
6
  FormContextType,
5
7
  GenericObjectType,
6
8
  MultiSchemaFieldTemplateProps,
7
9
  RJSFSchema,
8
10
  StrictRJSFSchema,
9
- getUiOptions,
10
11
  } from '@rjsf/utils';
12
+ import { getUiOptions } from '@rjsf/utils';
11
13
 
12
14
  import { getMuiProps } from '../util';
13
15
 
@@ -1,17 +1,13 @@
1
- import Grid, { GridProps } from '@mui/material/Grid';
2
- import {
1
+ import type { GridProps } from '@mui/material/Grid';
2
+ import Grid from '@mui/material/Grid';
3
+ import type {
3
4
  FormContextType,
4
5
  GenericObjectType,
5
6
  ObjectFieldTemplateProps,
6
7
  RJSFSchema,
7
8
  StrictRJSFSchema,
8
- canExpand,
9
- descriptionId,
10
- getTemplate,
11
- getUiOptions,
12
- titleId,
13
- buttonId,
14
9
  } from '@rjsf/utils';
10
+ import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, buttonId } from '@rjsf/utils';
15
11
 
16
12
  import { computeSxProps, getMuiProps } from '../util';
17
13
 
@@ -102,7 +98,7 @@ export default function ObjectFieldTemplate<
102
98
  sx={computeSxProps<GridProps>({ mt: 1.25 }, objectGridContainer)}
103
99
  >
104
100
  {!showOptionalDataControlInTitle ? optionalDataControl : undefined}
105
- {properties.map((element, index) =>
101
+ {properties.map((element) =>
106
102
  // Remove the <Grid> if the inner element is hidden as the <Grid>
107
103
  // itself would otherwise still take up space.
108
104
  element.hidden ? (
@@ -110,7 +106,7 @@ export default function ObjectFieldTemplate<
110
106
  ) : (
111
107
  <Grid
112
108
  size={{ xs: 12 }}
113
- key={index}
109
+ key={element.name}
114
110
  {...objectGridItem}
115
111
  sx={computeSxProps<GridProps>({ mb: 1.25 }, objectGridItem)}
116
112
  >
@@ -1,5 +1,5 @@
1
1
  import AddIcon from '@mui/icons-material/Add';
2
- import { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import type { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
3
 
4
4
  import IconButton, { RemoveButton } from '../IconButton';
5
5
 
@@ -29,7 +29,8 @@ export default function OptionalDataControlsTemplate<
29
29
  icon={<AddIcon fontSize='small' />}
30
30
  />
31
31
  );
32
- } else if (onRemoveClick) {
32
+ }
33
+ if (onRemoveClick) {
33
34
  return (
34
35
  <RemoveButton
35
36
  id={id}
@@ -1,8 +1,12 @@
1
- import { FocusEvent } from 'react';
2
- import FormControlLabel, { FormControlLabelProps } from '@mui/material/FormControlLabel';
1
+ import type { FocusEvent } from 'react';
2
+ import type { FormControlLabelProps } from '@mui/material/FormControlLabel';
3
+ import FormControlLabel from '@mui/material/FormControlLabel';
3
4
  import FormLabel from '@mui/material/FormLabel';
4
- import Radio, { RadioProps } from '@mui/material/Radio';
5
- import RadioGroup, { RadioGroupProps } from '@mui/material/RadioGroup';
5
+ import type { RadioProps } from '@mui/material/Radio';
6
+ import Radio from '@mui/material/Radio';
7
+ import type { RadioGroupProps } from '@mui/material/RadioGroup';
8
+ import RadioGroup from '@mui/material/RadioGroup';
9
+ import type { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
6
10
  import {
7
11
  ariaDescribedByIds,
8
12
  enumOptionSelectedValue,
@@ -11,11 +15,6 @@ import {
11
15
  getOptionValueFormat,
12
16
  labelValue,
13
17
  optionId,
14
- FormContextType,
15
- GenericObjectType,
16
- RJSFSchema,
17
- StrictRJSFSchema,
18
- WidgetProps,
19
18
  } from '@rjsf/utils';
20
19
 
21
20
  import { getMuiProps } from '../util';
@@ -46,11 +45,11 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
46
45
  const { enumOptions, enumDisabled, emptyValue } = options;
47
46
  const optionValueFormat = getOptionValueFormat(options);
48
47
 
49
- const _onChange = (_: any, value: any) =>
50
- onChange(enumOptionValueDecoder<S>(value, enumOptions, optionValueFormat, emptyValue));
51
- const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
48
+ const handleChange = (_: any, enumValue: any) =>
49
+ onChange(enumOptionValueDecoder<S>(enumValue, enumOptions, optionValueFormat, emptyValue));
50
+ const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
52
51
  onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
53
- const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
52
+ const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
54
53
  onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
55
54
 
56
55
  const row = options ? options.inline : false;
@@ -73,14 +72,14 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
73
72
  name={htmlName || id}
74
73
  value={selectValue}
75
74
  row={row as boolean}
76
- onChange={_onChange}
77
- onBlur={_onBlur}
78
- onFocus={_onFocus}
75
+ onChange={handleChange}
76
+ onBlur={handleBlur}
77
+ onFocus={handleFocus}
79
78
  aria-describedby={ariaDescribedByIds(id)}
80
79
  >
81
80
  {Array.isArray(enumOptions) &&
82
81
  enumOptions.map((option, index) => {
83
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
82
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
84
83
  const radio = (
85
84
  <FormControlLabel
86
85
  {...muiSlotProps?.formControlLabel}
@@ -89,7 +88,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
89
88
  }
90
89
  label={option.label}
91
90
  value={enumOptionValueEncoder(option.value, index, optionValueFormat)}
92
- key={index}
91
+ key={String(option.value)}
93
92
  disabled={disabled || itemDisabled || readonly}
94
93
  />
95
94
  );
@@ -1,16 +1,9 @@
1
- import { FocusEvent } from 'react';
1
+ import type { FocusEvent } from 'react';
2
2
  import FormLabel from '@mui/material/FormLabel';
3
- import Slider, { SliderProps } from '@mui/material/Slider';
4
- import {
5
- ariaDescribedByIds,
6
- labelValue,
7
- FormContextType,
8
- GenericObjectType,
9
- RJSFSchema,
10
- StrictRJSFSchema,
11
- WidgetProps,
12
- rangeSpec,
13
- } from '@rjsf/utils';
3
+ import type { SliderProps } from '@mui/material/Slider';
4
+ import Slider from '@mui/material/Slider';
5
+ import type { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
6
+ import { ariaDescribedByIds, labelValue, rangeSpec } from '@rjsf/utils';
14
7
 
15
8
  import { getMuiProps } from '../util';
16
9
 
@@ -35,11 +28,11 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
35
28
  props;
36
29
  const sliderProps = { value, label, id, name: id, ...rangeSpec<S>(schema) };
37
30
 
38
- const _onChange = (_: any, value?: number | number[]) => {
39
- onChange(value ?? options.emptyValue);
31
+ const handleChange = (_: any, newValue?: number | number[]) => {
32
+ onChange(newValue ?? options.emptyValue);
40
33
  };
41
- const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value);
42
- const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value);
34
+ const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value);
35
+ const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value);
43
36
 
44
37
  const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps<T, S, F, RangeWidgetMuiProps>(options);
45
38
 
@@ -53,9 +46,9 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
53
46
  )}
54
47
  <Slider
55
48
  disabled={disabled || readonly}
56
- onChange={_onChange}
57
- onBlur={_onBlur}
58
- onFocus={_onFocus}
49
+ onChange={handleChange}
50
+ onBlur={handleBlur}
51
+ onFocus={handleFocus}
59
52
  valueLabelDisplay='auto'
60
53
  {...otherMuiProps}
61
54
  {...muiSlotProps?.slider}
@@ -1,8 +1,10 @@
1
- import { ChangeEvent, FocusEvent } from 'react';
2
- import { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';
1
+ import type { ChangeEvent, FocusEvent } from 'react';
2
+ import type { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';
3
3
  import MenuItem from '@mui/material/MenuItem';
4
- import { SelectProps as MuiSelectProps } from '@mui/material/Select';
5
- import TextField, { TextFieldProps } from '@mui/material/TextField';
4
+ import type { SelectProps as MuiSelectProps } from '@mui/material/Select';
5
+ import type { TextFieldProps } from '@mui/material/TextField';
6
+ import TextField from '@mui/material/TextField';
7
+ import type { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
6
8
  import {
7
9
  ariaDescribedByIds,
8
10
  enumOptionSelectedValue,
@@ -10,11 +12,6 @@ import {
10
12
  enumOptionValueEncoder,
11
13
  getOptionValueFormat,
12
14
  labelValue,
13
- FormContextType,
14
- GenericObjectType,
15
- RJSFSchema,
16
- StrictRJSFSchema,
17
- WidgetProps,
18
15
  } from '@rjsf/utils';
19
16
 
20
17
  import { getMuiProps } from '../util';
@@ -72,11 +69,11 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
72
69
  const isEmpty =
73
70
  typeof value === 'undefined' || (isMultiple && value.length < 1) || (!isMultiple && value === emptyValue);
74
71
 
75
- const _onChange = ({ target: { value } }: ChangeEvent<{ value: string }>) =>
76
- onChange(enumOptionValueDecoder<S>(value, enumOptions, optionValueFormat, optEmptyVal));
77
- const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
72
+ const handleChange = ({ target: { value: newValue } }: ChangeEvent<{ value: string }>) =>
73
+ onChange(enumOptionValueDecoder<S>(newValue, enumOptions, optionValueFormat, optEmptyVal));
74
+ const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
78
75
  onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
79
- const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
76
+ const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
80
77
  onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
81
78
  const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps<T, S, F, SelectWidgetMuiProps>(options);
82
79
 
@@ -95,9 +92,9 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
95
92
  autoComplete={autocomplete}
96
93
  placeholder={placeholder}
97
94
  error={rawErrors.length > 0}
98
- onChange={_onChange}
99
- onBlur={_onBlur}
100
- onFocus={_onFocus}
95
+ onChange={handleChange}
96
+ onBlur={handleBlur}
97
+ onFocus={handleFocus}
101
98
  {...({ ...otherMuiProps, ...textFieldRemainingProps } as TextFieldProps)}
102
99
  select // Apply this and the following props after the potential overrides defined in textFieldProps
103
100
  slotProps={{
@@ -115,11 +112,15 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
115
112
  >
116
113
  {showPlaceholderOption && <MenuItem value=''>{placeholder}</MenuItem>}
117
114
  {Array.isArray(enumOptions) &&
118
- enumOptions.map(({ value, label }, i: number) => {
119
- const disabled: boolean = Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1;
115
+ enumOptions.map(({ value: enumValue, label: enumLabel }, i: number) => {
116
+ const isDisabled: boolean = Array.isArray(enumDisabled) && enumDisabled.includes(enumValue);
120
117
  return (
121
- <MenuItem key={i} value={enumOptionValueEncoder(value, i, optionValueFormat)} disabled={disabled}>
122
- {label}
118
+ <MenuItem
119
+ key={String(enumValue)}
120
+ value={enumOptionValueEncoder(enumValue, i, optionValueFormat)}
121
+ disabled={isDisabled}
122
+ >
123
+ {enumLabel}
123
124
  </MenuItem>
124
125
  );
125
126
  })}
@@ -1,14 +1,9 @@
1
- import Box, { BoxProps } from '@mui/material/Box';
2
- import Button, { ButtonProps } from '@mui/material/Button';
3
- import {
4
- getSubmitButtonOptions,
5
- GenericObjectType,
6
- FormContextType,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- SubmitButtonProps,
10
- getUiOptions,
11
- } from '@rjsf/utils';
1
+ import type { BoxProps } from '@mui/material/Box';
2
+ import Box from '@mui/material/Box';
3
+ import type { ButtonProps } from '@mui/material/Button';
4
+ import Button from '@mui/material/Button';
5
+ import type { GenericObjectType, FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
6
+ import { getSubmitButtonOptions, getUiOptions } from '@rjsf/utils';
12
7
 
13
8
  import { computeSxProps, getMuiProps } from '../util';
14
9
 
@@ -1,4 +1,4 @@
1
- import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
2
 
3
3
  import AddButton from '../AddButton';
4
4
  import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate';
@@ -1,4 +1,5 @@
1
- import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps, getTemplate } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
2
+ import { getTemplate } from '@rjsf/utils';
2
3
 
3
4
  /** The `TextareaWidget` is a widget for rendering input fields as textarea.
4
5
  *
@@ -1,5 +1,5 @@
1
- import { ThemeProps } from '@rjsf/core';
2
- import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { ThemeProps } from '@rjsf/core';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
3
 
4
4
  import { generateTemplates } from '../Templates';
5
5
  import { generateWidgets } from '../Widgets';
@@ -1,15 +1,13 @@
1
- import Box, { BoxProps } from '@mui/material/Box';
2
- import Divider, { DividerProps } from '@mui/material/Divider';
3
- import Grid, { GridProps } from '@mui/material/Grid';
4
- import Typography, { TypographyProps } from '@mui/material/Typography';
5
- import {
6
- FormContextType,
7
- GenericObjectType,
8
- TitleFieldProps,
9
- RJSFSchema,
10
- StrictRJSFSchema,
11
- getUiOptions,
12
- } from '@rjsf/utils';
1
+ import type { BoxProps } from '@mui/material/Box';
2
+ import Box from '@mui/material/Box';
3
+ import type { DividerProps } from '@mui/material/Divider';
4
+ import Divider from '@mui/material/Divider';
5
+ import type { GridProps } from '@mui/material/Grid';
6
+ import Grid from '@mui/material/Grid';
7
+ import type { TypographyProps } from '@mui/material/Typography';
8
+ import Typography from '@mui/material/Typography';
9
+ import type { FormContextType, GenericObjectType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
10
+ import { getUiOptions } from '@rjsf/utils';
13
11
 
14
12
  import { computeSxProps, getMuiProps } from '../util';
15
13
 
@@ -60,7 +58,7 @@ export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSch
60
58
  );
61
59
  if (optionalDataControl) {
62
60
  heading = (
63
- <Grid container={true} spacing={0} {...titleGridContainer}>
61
+ <Grid container spacing={0} {...titleGridContainer}>
64
62
  <Grid size='grow' {...titleGridItem}>
65
63
  {heading}
66
64
  </Grid>
@@ -1,4 +1,4 @@
1
- import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
3
  import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget';
4
4
  import CheckboxWidget from '../CheckboxWidget/CheckboxWidget';
@@ -1,17 +1,15 @@
1
- import { CSSProperties } from 'react';
2
- import Grid, { GridProps } from '@mui/material/Grid';
1
+ import type { CSSProperties } from 'react';
2
+ import type { GridProps } from '@mui/material/Grid';
3
+ import Grid from '@mui/material/Grid';
3
4
  import TextField from '@mui/material/TextField';
4
- import {
5
- ADDITIONAL_PROPERTY_FLAG,
5
+ import type {
6
6
  GenericObjectType,
7
- buttonId,
8
7
  FormContextType,
9
8
  RJSFSchema,
10
9
  StrictRJSFSchema,
11
- TranslatableString,
12
10
  WrapIfAdditionalTemplateProps,
13
- getUiOptions,
14
11
  } from '@rjsf/utils';
12
+ import { ADDITIONAL_PROPERTY_FLAG, buttonId, TranslatableString, getUiOptions } from '@rjsf/utils';
15
13
 
16
14
  import { computeSxProps, getMuiProps } from '../util';
17
15
  /** Properties available for the `rjsfSlotProps` target of the WrapIfAdditionalTemplate. */
@@ -92,7 +90,7 @@ export default function WrapIfAdditionalTemplate<
92
90
  <Grid size={5.5} {...wrapKeyGridItem}>
93
91
  <TextField
94
92
  key={label}
95
- fullWidth={true}
93
+ fullWidth
96
94
  required={required}
97
95
  label={displayLabel ? keyLabel : undefined}
98
96
  defaultValue={label}
package/src/util.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { BoxProps, FormHelperTextProps, GridProps, PaperProps, SxProps, TypographyProps } from '@mui/material';
2
- import { FormContextType, RJSFSchema, StrictRJSFSchema, UIOptionsType, GenericObjectType } from '@rjsf/utils';
1
+ import type { BoxProps, FormHelperTextProps, GridProps, PaperProps, SxProps, TypographyProps } from '@mui/material';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, UIOptionsType, GenericObjectType } from '@rjsf/utils';
3
3
 
4
4
  /**
5
5
  * Extract props meant for MUI components from the `options` field of the `uiSchema`.
@@ -22,9 +22,9 @@ export function getMuiProps<
22
22
  if (propsToFilter) {
23
23
  return Object.keys(muiProps)
24
24
  .filter((key) => propsToFilter.includes(key))
25
- .reduce((obj, key) => {
26
- obj[key as keyof P] = muiProps[key as keyof P];
27
- return obj;
25
+ .reduce((acc, key) => {
26
+ acc[key as keyof P] = muiProps[key as keyof P];
27
+ return acc;
28
28
  }, {} as P);
29
29
  }
30
30
  return muiProps;