Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Sep 27, 2023
1 parent 6ce9f78 commit c91f973
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
1 change: 0 additions & 1 deletion packages/mui-base/src/FormControl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export type {
FormControlRootSlotPropsOverrides,
FormControlState,
UseFormControlContextReturnValue,
// for material-next
FormControlOwnProps,
} from './FormControl.types';

Expand Down
11 changes: 11 additions & 0 deletions packages/mui-material-next/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ If you need to prevent default on a `key-up` and/or `key-down` event, then besid

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`.

## FormControl

### Renamed `FormControlState`

The `FormControlState` interface was renamed to `FormControlContextValue`:

```diff
-import { FormControlState } from '@mui/material';
+import { FormControlContextValue } from '@mui/material-next';
```

## InputBase

### Removed `inputProps`
Expand Down
17 changes: 8 additions & 9 deletions packages/mui-material-next/src/FormControl/FormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const FormControlRoot = styled('div', {
name: 'MuiFormControl',
slot: 'Root',
overridesResolver: ({ ownerState }, styles) => {
return {
...(styles.root as Record<string, unknown>),
...(styles[`margin${capitalize(ownerState.margin)}`] as Record<string, unknown>),
...(ownerState.fullWidth && styles.fullWidth),
};
return [
styles.root,
styles[`margin${capitalize(ownerState.margin)}`],
ownerState.fullWidth && styles.fullWidth,
];
},
})<{ ownerState: FormControlOwnerState }>(({ ownerState }) => ({
display: 'inline-flex',
Expand Down Expand Up @@ -87,8 +87,7 @@ const FormControl = React.forwardRef(function FormControl<
const props = useThemeProps({ props: inProps, name: 'MuiFormControl' });
const {
children,
className,
classes: classesProp,
classes: classesProp = {},
color = 'primary',
component: componentProp,
disabled = false,
Expand Down Expand Up @@ -182,7 +181,7 @@ const FormControl = React.forwardRef(function FormControl<

const ownerState = {
...props,
classes: props.classes ?? {},
classes: classesProp,
color,
component: componentProp,
disabled,
Expand Down Expand Up @@ -252,7 +251,7 @@ const FormControl = React.forwardRef(function FormControl<
as: componentProp,
},
ownerState,
className: [classes.root, className],
className: classes.root,
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export type FormControlProps<
component?: React.ElementType;
};

type MaterialYouOwnerStateKeys =
type MaterialDesignOwnerStateKeys =
| 'classes'
| 'color'
| 'margin'
Expand All @@ -89,5 +89,5 @@ type MaterialYouOwnerStateKeys =
| 'variant';

export type FormControlOwnerState = Simplify<
Required<Pick<FormControlOwnProps, MaterialYouOwnerStateKeys>> & FormControlProps
Required<Pick<FormControlOwnProps, MaterialDesignOwnerStateKeys>> & FormControlProps
>;

0 comments on commit c91f973

Please sign in to comment.