Skip to content

Commit c91f973

Browse files
committed
Fix review comments
1 parent 6ce9f78 commit c91f973

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

packages/mui-base/src/FormControl/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export type {
88
FormControlRootSlotPropsOverrides,
99
FormControlState,
1010
UseFormControlContextReturnValue,
11-
// for material-next
1211
FormControlOwnProps,
1312
} from './FormControl.types';
1413

packages/mui-material-next/migration.md

+11
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ If you need to prevent default on a `key-up` and/or `key-down` event, then besid
132132

133133
This is to ensure that default is prevented when the `ButtonBase` root is not a native button, for example, when the root element used is a `span`.
134134

135+
## FormControl
136+
137+
### Renamed `FormControlState`
138+
139+
The `FormControlState` interface was renamed to `FormControlContextValue`:
140+
141+
```diff
142+
-import { FormControlState } from '@mui/material';
143+
+import { FormControlContextValue } from '@mui/material-next';
144+
```
145+
135146
## InputBase
136147

137148
### Removed `inputProps`

packages/mui-material-next/src/FormControl/FormControl.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ const FormControlRoot = styled('div', {
2828
name: 'MuiFormControl',
2929
slot: 'Root',
3030
overridesResolver: ({ ownerState }, styles) => {
31-
return {
32-
...(styles.root as Record<string, unknown>),
33-
...(styles[`margin${capitalize(ownerState.margin)}`] as Record<string, unknown>),
34-
...(ownerState.fullWidth && styles.fullWidth),
35-
};
31+
return [
32+
styles.root,
33+
styles[`margin${capitalize(ownerState.margin)}`],
34+
ownerState.fullWidth && styles.fullWidth,
35+
];
3636
},
3737
})<{ ownerState: FormControlOwnerState }>(({ ownerState }) => ({
3838
display: 'inline-flex',
@@ -87,8 +87,7 @@ const FormControl = React.forwardRef(function FormControl<
8787
const props = useThemeProps({ props: inProps, name: 'MuiFormControl' });
8888
const {
8989
children,
90-
className,
91-
classes: classesProp,
90+
classes: classesProp = {},
9291
color = 'primary',
9392
component: componentProp,
9493
disabled = false,
@@ -182,7 +181,7 @@ const FormControl = React.forwardRef(function FormControl<
182181

183182
const ownerState = {
184183
...props,
185-
classes: props.classes ?? {},
184+
classes: classesProp,
186185
color,
187186
component: componentProp,
188187
disabled,
@@ -252,7 +251,7 @@ const FormControl = React.forwardRef(function FormControl<
252251
as: componentProp,
253252
},
254253
ownerState,
255-
className: [classes.root, className],
254+
className: classes.root,
256255
});
257256

258257
return (

packages/mui-material-next/src/FormControl/FormControl.types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export type FormControlProps<
7979
component?: React.ElementType;
8080
};
8181

82-
type MaterialYouOwnerStateKeys =
82+
type MaterialDesignOwnerStateKeys =
8383
| 'classes'
8484
| 'color'
8585
| 'margin'
@@ -89,5 +89,5 @@ type MaterialYouOwnerStateKeys =
8989
| 'variant';
9090

9191
export type FormControlOwnerState = Simplify<
92-
Required<Pick<FormControlOwnProps, MaterialYouOwnerStateKeys>> & FormControlProps
92+
Required<Pick<FormControlOwnProps, MaterialDesignOwnerStateKeys>> & FormControlProps
9393
>;

0 commit comments

Comments
 (0)