Skip to content

Commit

Permalink
[material-ui] Revert deprecation warnings for *Components and `*Pro…
Browse files Browse the repository at this point in the history
…ps` for v6 (#42466)
  • Loading branch information
lhilgert9 authored Jul 10, 2024
1 parent bc31b61 commit 0eb2ba1
Show file tree
Hide file tree
Showing 35 changed files with 33 additions and 595 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,6 @@ The composed CSS classes are going to be deprecated and eventually removed in fa
For example, the `.MuiAccordionSummary-contentGutters` class was deprecated in favor of the `.MuiAccordionSummary-gutters` and `.MuiAccordionSummary-content` classes.
This improves the developer experience by reducing bloat and cognitive load.

## Accordion

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

```bash
npx @mui/codemod@latest deprecations/accordion-props <path>
```

### TransitionComponent

The Accordion's `TransitionComponent` prop was deprecated in favor of `slots.transition`:

```diff
<Accordion
- TransitionComponent={CustomTransition}
+ slots={{ transition: CustomTransition }}
/>
```

### TransitionProps

The Accordion's `TransitionProps` prop was deprecated in favor of `slotProps.transition`:

```diff
<Accordion
- TransitionProps={{ unmountOnExit: true }}
+ slotProps={{ transition: { unmountOnExit: true } }}
/>
```

## AccordionSummary

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#accordion-summary-classes) below to migrate the code as described in the following sections:
Expand Down Expand Up @@ -235,38 +205,6 @@ Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-code
npx @mui/codemod@next deprecations/autocomplete-props <path>
```

### \*Component props

All of the Autocomplete's slot (`*Component`) props were deprecated in favor of equivalent `slots` entries:

```diff
<Autocomplete
- ListboxComponent={CustomListboxComponent}
- PaperComponent={CustomPaperComponent}
- PopperComponent={CustomPopperComponent}
+ slots={{
+ listbox: CustomListboxComponent,
+ paper: CustomPaperComponent,
+ popper: CustomPopperComponent,
+ }}
/>
```

### \*Props props

All of the Autocomplete's slot props (`*Props`) props were deprecated in favor of equivalent `slotProps` entries:

```diff
<Autocomplete
- ChipProps={CustomChipProps}
- ListboxProps={CustomListboxProps}
+ slotProps={{
+ chip: CustomChipProps,
+ listbox: CustomListboxProps,
+ }}
/>
```

### componentsProps

The Autocomplete's `componentsProps` prop was deprecated in favor of `slotProps`:
Expand All @@ -287,32 +225,6 @@ The Autocomplete's `componentsProps` prop was deprecated in favor of `slotProps`
/>
```

## Avatar

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

```bash
npx @mui/codemod@latest deprecations/avatar-props <path>
```

### imgProps

The Avatar's `imgProps` prop was deprecated in favor of `slotProps.img`:

```diff
<Avatar
- imgProps={{
- onError: () => {},
- onLoad: () => {},
+ slotProps={{
+ img: {
+ onError: () => {},
+ onLoad: () => {},
+ }
}}
/>;
```

## AvatarGroup

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#avatar-group-props) below to migrate the code as described in the following sections:
Expand Down Expand Up @@ -401,16 +313,6 @@ The Backdrop's `componentsProps` prop was deprecated in favor of `slotProps`:
/>
```

### TransitionComponent

The Backdrop's `TransitionComponent` prop was deprecated in favor of `slots.transition`:

```diff
<Slider
- TransitionComponent={CustomTransition}
+ slots={{ transition: CustomTransition }}
```

## Badge

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#badge-props) below to migrate the code as described in the following sections:
Expand Down Expand Up @@ -1616,28 +1518,6 @@ The StepLabel's `componentsProps` prop was deprecated in favor of `slotProps`:
/>
```

### StepIconComponent

The StepLabel's `StepIconComponent` prop was deprecated in favor of `slots.stepIcon`:

```diff
<StepLabel
- StepIconComponent={StepIconComponent}
+ slots={{ stepIcon: StepIconComponent }}
/>
```

### StepIconProps

The StepLabel's `StepIconProps` prop was deprecated in favor of `slotProps.stepIcon`:

```diff
<StepLabel
- StepIconProps={StepIconProps}
+ slotProps={{ stepIcon: StepIconProps }}
/>
```

## StepConnector

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#step-connector-classes) below to migrate the code as described in the following sections:
Expand Down Expand Up @@ -1677,32 +1557,3 @@ Here's how to migrate:
},
},
```

## SpeedDial

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

```bash
npx @mui/codemod@next deprecations/speed-dial-props <path>
```

### TransitionComponent

The SpeedDial's `TransitionComponent` prop was deprecated in favor of `slots.transition`:

```diff
<SpeedDial
- TransitionComponent={CustomTransition}
+ slots={{ transition: CustomTransition }}
```

### TransitionProps

The SpeedDial's `TransitionProps` prop was deprecated in favor of `slotProps.transition`:

```diff
<SpeedDial
- TransitionProps={{ unmountOnExit: true }}
+ slotProps={{ transition: { unmountOnExit: true } }}
/>
```
12 changes: 2 additions & 10 deletions docs/pages/material-ui/api/accordion.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,8 @@
},
"additionalInfo": { "sx": true }
},
"TransitionComponent": {
"type": { "name": "elementType" },
"deprecated": true,
"deprecationInfo": "Use <code>slots.transition</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"TransitionProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.transition</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
}
"TransitionComponent": { "type": { "name": "elementType" } },
"TransitionProps": { "type": { "name": "object" } }
},
"name": "Accordion",
"imports": [
Expand Down
33 changes: 5 additions & 28 deletions docs/pages/material-ui/api/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
},
"default": "false"
},
"ChipProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.chip</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"ChipProps": { "type": { "name": "object" } },
"classes": { "type": { "name": "object" }, "additionalInfo": { "cssApi": true } },
"clearIcon": { "type": { "name": "node" }, "default": "<ClearIcon fontSize=\"small\" />" },
"clearOnBlur": { "type": { "name": "bool" }, "default": "!props.freeSolo" },
Expand Down Expand Up @@ -97,17 +93,8 @@
}
},
"limitTags": { "type": { "name": "custom", "description": "integer" }, "default": "-1" },
"ListboxComponent": {
"type": { "name": "elementType" },
"default": "'ul'",
"deprecated": true,
"deprecationInfo": "Use <code>slots.listbox</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"ListboxProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.listbox</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"ListboxComponent": { "type": { "name": "elementType" }, "default": "'ul'" },
"ListboxProps": { "type": { "name": "object" } },
"loading": { "type": { "name": "bool" }, "default": "false" },
"loadingText": { "type": { "name": "node" }, "default": "'Loading…'" },
"multiple": { "type": { "name": "bool" }, "default": "false" },
Expand Down Expand Up @@ -150,18 +137,8 @@
"open": { "type": { "name": "bool" } },
"openOnFocus": { "type": { "name": "bool" }, "default": "false" },
"openText": { "type": { "name": "string" }, "default": "'Open'" },
"PaperComponent": {
"type": { "name": "elementType" },
"default": "Paper",
"deprecated": true,
"deprecationInfo": "Use <code>slots.paper</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"PopperComponent": {
"type": { "name": "elementType" },
"default": "Popper",
"deprecated": true,
"deprecationInfo": "Use <code>slots.popper</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"PaperComponent": { "type": { "name": "elementType" }, "default": "Paper" },
"PopperComponent": { "type": { "name": "elementType" }, "default": "Popper" },
"popupIcon": { "type": { "name": "node" }, "default": "<ArrowDropDownIcon />" },
"readOnly": { "type": { "name": "bool" }, "default": "false" },
"renderGroup": {
Expand Down
6 changes: 1 addition & 5 deletions docs/pages/material-ui/api/avatar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
"children": { "type": { "name": "node" } },
"classes": { "type": { "name": "object" }, "additionalInfo": { "cssApi": true } },
"component": { "type": { "name": "elementType" } },
"imgProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.img</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"imgProps": { "type": { "name": "object" } },
"sizes": { "type": { "name": "string" } },
"slotProps": {
"type": { "name": "shape", "description": "{ img?: func<br>&#124;&nbsp;object }" },
Expand Down
7 changes: 1 addition & 6 deletions docs/pages/material-ui/api/backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@
},
"additionalInfo": { "sx": true }
},
"TransitionComponent": {
"type": { "name": "elementType" },
"default": "Fade",
"deprecated": true,
"deprecationInfo": "Use <code>slots.transition</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"TransitionComponent": { "type": { "name": "elementType" }, "default": "Fade" },
"transitionDuration": {
"type": {
"name": "union",
Expand Down
13 changes: 2 additions & 11 deletions docs/pages/material-ui/api/speed-dial.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,15 @@
},
"additionalInfo": { "sx": true }
},
"TransitionComponent": {
"type": { "name": "elementType" },
"default": "Zoom\n* @deprecated Use `slots.transition` instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)",
"deprecated": true,
"deprecationInfo": "Use <code>slots.transition</code> instead. This prop will be removed in v7. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"TransitionComponent": { "type": { "name": "elementType" }, "default": "Zoom" },
"transitionDuration": {
"type": {
"name": "union",
"description": "number<br>&#124;&nbsp;{ appear?: number, enter?: number, exit?: number }"
},
"default": "{\n enter: theme.transitions.duration.enteringScreen,\n exit: theme.transitions.duration.leavingScreen,\n}"
},
"TransitionProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.transition</code> instead. This prop will be removed in v7. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
}
"TransitionProps": { "type": { "name": "object" } }
},
"name": "SpeedDial",
"imports": [
Expand Down
12 changes: 2 additions & 10 deletions docs/pages/material-ui/api/step-label.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,8 @@
"type": { "name": "shape", "description": "{ label?: elementType, stepIcon?: elementType }" },
"default": "{}"
},
"StepIconComponent": {
"type": { "name": "elementType" },
"deprecated": true,
"deprecationInfo": "Use <code>slots.stepIcon</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"StepIconProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.stepIcon</code> instead. This prop will be removed in v7. See <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"StepIconComponent": { "type": { "name": "elementType" } },
"StepIconProps": { "type": { "name": "object" } },
"sx": {
"type": {
"name": "union",
Expand Down
6 changes: 0 additions & 6 deletions packages/mui-codemod/src/deprecations/all/deprecations-all.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import transformAccordionClasses from '../accordion-summary-classes';
import transformAccordionProps from '../accordion-props';
import transformAlertClasses from '../alert-classes';
import transformAvatarGroupProps from '../avatar-group-props';
import transformAutocompleteProps from '../autocomplete-props';
import transformAvatarProps from '../avatar-props';
import transformBackdropProps from '../backdrop-props';
import transformButtonClasses from '../button-classes';
import transformButtonGroupClasses from '../button-group-classes';
Expand All @@ -18,7 +16,6 @@ import transformInputProps from '../input-props';
import transformModalProps from '../modal-props';
import transformOutlinedInputProps from '../outlined-input-props';
import transformPaginationItemClasses from '../pagination-item-classes';
import transformSpeedDialProps from '../speed-dial-props';
import transformTableSortLabelClasses from '../table-sort-label-classes';
import transformStepConnectorClasses from '../step-connector-classes';
import transformStepLabelProps from '../step-label-props';
Expand All @@ -32,11 +29,9 @@ import transformToggleButtonGroupClasses from '../toggle-button-group-classes';
*/
export default function deprecationsAll(file, api, options) {
file.source = transformAccordionClasses(file, api, options);
file.source = transformAccordionProps(file, api, options);
file.source = transformAlertClasses(file, api, options);
file.source = transformAvatarGroupProps(file, api, options);
file.source = transformAutocompleteProps(file, api, options);
file.source = transformAvatarProps(file, api, options);
file.source = transformBackdropProps(file, api, options);
file.source = transformButtonClasses(file, api, options);
file.source = transformButtonGroupClasses(file, api, options);
Expand All @@ -51,7 +46,6 @@ export default function deprecationsAll(file, api, options) {
file.source = transformModalProps(file, api, options);
file.source = transformOutlinedInputProps(file, api, options);
file.source = transformPaginationItemClasses(file, api, options);
file.source = transformSpeedDialProps(file, api, options);
file.source = transformStepConnectorClasses(file, api, options);
file.source = transformStepLabelProps(file, api, options);
file.source = transformTableSortLabelClasses(file, api, options);
Expand Down
Loading

0 comments on commit 0eb2ba1

Please sign in to comment.