Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,25 @@ The following deprecated props have been removed:
/>
```

#### FormControlLabel deprecated props removed

Use the [form-control-label-props codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#form-control-label-props) below to migrate the code as described in the following section:

```bash
npx @mui/codemod@latest deprecations/form-control-label-props <path>
```

The following deprecated prop has been removed:

- `componentsProps` — use `slotProps` instead

```diff
<FormControlLabel
- componentsProps={{ typography: { fontWeight: 'bold' } }}
+ slotProps={{ typography: { fontWeight: 'bold' } }}
/>
```

#### Typography deprecated CSS classes removed

The deprecated `paragraph` CSS class has been removed.
Expand Down
6 changes: 0 additions & 6 deletions docs/pages/material-ui/api/form-control-label.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
"control": { "type": { "name": "element" }, "required": true },
"checked": { "type": { "name": "bool" } },
"classes": { "type": { "name": "object" }, "additionalInfo": { "cssApi": true } },
"componentsProps": {
"type": { "name": "shape", "description": "{ typography?: object }" },
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slotProps</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"disabled": { "type": { "name": "bool" } },
"disableTypography": { "type": { "name": "bool" } },
"inputRef": { "type": { "name": "custom", "description": "ref" } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"propDescriptions": {
"checked": { "description": "If <code>true</code>, the component appears selected." },
"classes": { "description": "Override or extend the styles applied to the component." },
"componentsProps": { "description": "The props used for each slot inside." },
"control": {
"description": "A control element. For instance, it can be a <code>Radio</code>, a <code>Switch</code> or a <code>Checkbox</code>."
},
Expand Down
17 changes: 1 addition & 16 deletions packages/mui-material/src/FormControlLabel/FormControlLabel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '../styles';
import { InternalStandardProps as StandardProps } from '../internal';
import Typography, { TypographyProps } from '../Typography';
import Typography from '../Typography';
import { FormControlLabelClasses } from './formControlLabelClasses';
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';

Expand Down Expand Up @@ -34,21 +34,6 @@ export interface FormControlLabelProps
* Override or extend the styles applied to the component.
*/
classes?: Partial<FormControlLabelClasses> | undefined;
/**
* The props used for each slot inside.
* @default {}
* @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
componentsProps?:
| {
/**
* Props applied to the Typography wrapper of the passed label.
* This is unused if disableTypography is true.
* @default {}
*/
typography?: TypographyProps | undefined;
}
| undefined;
/**
* A control element. For instance, it can be a `Radio`, a `Switch` or a `Checkbox`.
*/
Expand Down
14 changes: 1 addition & 13 deletions packages/mui-material/src/FormControlLabel/FormControlLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ const FormControlLabel = React.forwardRef(function FormControlLabel(inProps, ref
const {
checked,
className,
componentsProps = {},
control,
disabled: disabledProp,
disableTypography,
Expand Down Expand Up @@ -164,10 +163,7 @@ const FormControlLabel = React.forwardRef(function FormControlLabel(inProps, ref

const externalForwardedProps = {
slots,
slotProps: {
...componentsProps,
...slotProps,
},
slotProps,
};

const [TypographySlot, typographySlotProps] = useSlot('typography', {
Expand Down Expand Up @@ -228,14 +224,6 @@ FormControlLabel.propTypes /* remove-proptypes */ = {
* @ignore
*/
className: PropTypes.string,
/**
* The props used for each slot inside.
* @default {}
* @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
componentsProps: PropTypes.shape({
typography: PropTypes.object,
}),
/**
* A control element. For instance, it can be a `Radio`, a `Switch` or a `Checkbox`.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ describe('<FormControlLabel />', () => {
});
});

describe('componentsProps: typography', () => {
describe('slotProps: typography', () => {
it('should spread its contents to the typography element', () => {
render(
<FormControlLabel
label="Pizza"
componentsProps={{
slotProps={{
typography: {
'data-testid': 'labelTypography',
name: 'test',
Expand Down
Loading