Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][Grid] Revert wrap deprecation (#42363) #43459

Merged
merged 2 commits into from
Sep 6, 2024
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
6 changes: 3 additions & 3 deletions docs/data/material/components/grid/AutoGridNoWrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function AutoGridNoWrap() {
return (
<Box sx={{ flexGrow: 1, overflow: 'hidden', px: 3 }}>
<StyledPaper sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container spacing={2} sx={{ flexWrap: 'nowrap' }}>
<Grid container spacing={2} wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
Expand All @@ -34,7 +34,7 @@ export default function AutoGridNoWrap() {
</Grid>
</StyledPaper>
<StyledPaper sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container spacing={2} sx={{ flexWrap: 'nowrap' }}>
<Grid container spacing={2} wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
Expand All @@ -44,7 +44,7 @@ export default function AutoGridNoWrap() {
</Grid>
</StyledPaper>
<StyledPaper sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container spacing={2} sx={{ flexWrap: 'nowrap' }}>
<Grid container spacing={2} wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
Expand Down
6 changes: 3 additions & 3 deletions docs/data/material/components/grid/AutoGridNoWrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function AutoGridNoWrap() {
return (
<Box sx={{ flexGrow: 1, overflow: 'hidden', px: 3 }}>
<StyledPaper sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container spacing={2} sx={{ flexWrap: 'nowrap' }}>
<Grid container spacing={2} wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
Expand All @@ -34,7 +34,7 @@ export default function AutoGridNoWrap() {
</Grid>
</StyledPaper>
<StyledPaper sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container spacing={2} sx={{ flexWrap: 'nowrap' }}>
<Grid container spacing={2} wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
Expand All @@ -44,7 +44,7 @@ export default function AutoGridNoWrap() {
</Grid>
</StyledPaper>
<StyledPaper sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container spacing={2} sx={{ flexWrap: 'nowrap' }}>
<Grid container spacing={2} wrap="nowrap">
<Grid item>
<Avatar>W</Avatar>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/components/skeleton/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Media(props) {
const { loading = false } = props;

return (
<Grid container sx={{ flexWrap: 'nowrap' }}>
<Grid container wrap="nowrap">
{(loading ? Array.from(new Array(3)) : data).map((item, index) => (
<Box key={index} sx={{ width: 210, marginRight: 0.5, my: 5 }}>
{item ? (
Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/components/skeleton/YouTube.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Media(props: MediaProps) {
const { loading = false } = props;

return (
<Grid container sx={{ flexWrap: 'nowrap' }}>
<Grid container wrap="nowrap">
{(loading ? Array.from(new Array(3)) : data).map((item, index) => (
<Box key={index} sx={{ width: 210, marginRight: 0.5, my: 5 }}>
{item ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1166,25 +1166,6 @@ The ListItemSecondaryAction component was deprecated in favor of the `secondaryA
</ListItem>
```

## Grid

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

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

### wrap prop

The Grid's `wrap` prop was deprecated in favor of `flexWrap` MUI System prop:

```diff
<Grid
- wrap="nowrap"
+ flexWrap="nowrap"
>
```

## ImageListItemBar

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#image-list-item-bar-classes) below to migrate the code as described in the following sections:
Expand Down
4 changes: 1 addition & 3 deletions docs/pages/material-ui/api/grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@
"name": "enum",
"description": "'nowrap'<br>&#124;&nbsp;'wrap-reverse'<br>&#124;&nbsp;'wrap'"
},
"default": "'wrap'",
"deprecated": true,
"deprecationInfo": "Use <code>flexWrap</code> instead. This prop will be removed in v7. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
"default": "'wrap'"
},
"xl": {
"type": {
Expand Down
13 changes: 0 additions & 13 deletions packages/mui-codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1103,19 +1103,6 @@ npx @mui/codemod@latest deprecations/form-control-label-props <path>
npx @mui/codemod@latest deprecations/list-item-props <path>
```

#### `grid-props`

```diff
<Grid
- wrap="nowrap"
+ flexWrap="nowrap"
/>
```

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

#### `image-list-item-bar-classes`

JS transforms:
Expand Down
2 changes: 0 additions & 2 deletions packages/mui-codemod/src/deprecations/all/deprecations-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import transformCircularProgressClasses from '../circular-progress-classes';
import transformDividerProps from '../divider-props';
import transformFilledInputProps from '../filled-input-props';
import transformFormControlLabelProps from '../form-control-label-props';
import transformGridProps from '../grid-props';
import transformImageListItemBarClasses from '../image-list-item-bar-classes';
import transformInputBaseProps from '../input-base-props';
import transformInputProps from '../input-props';
Expand Down Expand Up @@ -41,7 +40,6 @@ export default function deprecationsAll(file, api, options) {
file.source = transformDividerProps(file, api, options);
file.source = transformFilledInputProps(file, api, options);
file.source = transformFormControlLabelProps(file, api, options);
file.source = transformGridProps(file, api, options);
file.source = transformImageListItemBarClasses(file, api, options);
file.source = transformInputBaseProps(file, api, options);
file.source = transformInputProps(file, api, options);
Expand Down
42 changes: 0 additions & 42 deletions packages/mui-codemod/src/deprecations/grid-props/grid-props.js

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/mui-codemod/src/deprecations/grid-props/index.js

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/mui-material/src/Grid/Grid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export interface GridOwnProps extends SystemProps<Theme>, Breakpoints {
* Defines the `flex-wrap` style property.
* It's applied for all screen sizes.
* @default 'wrap'
* @deprecated Use `flexWrap` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
wrap?: GridWrap;
/**
Expand Down
1 change: 0 additions & 1 deletion packages/mui-material/src/Grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,6 @@ Grid.propTypes /* remove-proptypes */ = {
* Defines the `flex-wrap` style property.
* It's applied for all screen sizes.
* @default 'wrap'
* @deprecated Use `flexWrap` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
/**
Expand Down