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][LinearProgress] Deprecate composed classes #44933

Merged
merged 28 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
23414c5
feat(docs): Mark deprecated styles in linear progress API
headironc Jan 3, 2025
31aedef
feat(docs): Update migration guide for LinearProgress deprecations
headironc Jan 3, 2025
472bbfe
feat(docs): Add deprecation information for LinearProgress styles
headironc Jan 4, 2025
5617d37
feat(docs): Update README with linear progress classes transformation…
headironc Jan 4, 2025
f8eead7
feat(docs): Add usage example for linear progress classes deprecation…
headironc Jan 4, 2025
76d573a
feat(codemod): Add linear progress classes deprecation plugin and tes…
headironc Jan 4, 2025
14af973
feat(codemod): Integrate linear progress classes transformation into …
headironc Jan 4, 2025
62dd7ee
feat(docs): Update migration guide for LinearProgress class structure…
headironc Jan 4, 2025
768b6c6
feat(docs): Update README with new CSS class structure for LinearProg…
headironc Jan 4, 2025
16d3312
feat(types): Mark deprecated styles in LinearProgressClasses with mig…
headironc Jan 4, 2025
81d958c
Merge branch 'master' into deprecate-composed-classes
headironc Jan 4, 2025
89f5929
Revert "feat(docs): Update README with linear progress classes transf…
headironc Jan 4, 2025
b1f6276
Merge branch 'master' into deprecate-composed-classes
headironc Jan 4, 2025
a3f4aea
Merge branch 'master' into deprecate-composed-classes
headironc Jan 7, 2025
bfcc7f0
Merge branch 'master' into deprecate-composed-classes
headironc Jan 7, 2025
d5bc969
Merge branch 'master' into deprecate-composed-classes
headironc Jan 7, 2025
e0b51bb
Merge branch 'master' into deprecate-composed-classes
headironc Jan 8, 2025
0fb1836
Update packages/mui-codemod/src/deprecations/linear-progress-classes/…
headironc Jan 8, 2025
24867ba
Merge branch 'master' into deprecate-composed-classes
headironc Jan 8, 2025
5fadade
[linear-progress] Add utility classes for bar1 and bar2 elements
headironc Jan 9, 2025
3f3840f
Merge branch 'master' into deprecate-composed-classes
headironc Jan 9, 2025
1a66cd3
Merge branch 'master' into deprecate-composed-classes
headironc Jan 9, 2025
2abd38c
Trigger CI
DiegoAndai Jan 9, 2025
27d216e
[linear-progress] Reintroduce bar2 styles and update deprecation mess…
headironc Jan 9, 2025
0af8bd0
Update packages/mui-material/src/LinearProgress/linearProgressClasses.ts
headironc Jan 9, 2025
a90bf89
Update packages/mui-material/src/LinearProgress/linearProgressClasses.ts
headironc Jan 9, 2025
a751ce6
fix deprecation messages in linear-progress documentation for clarity
headironc Jan 9, 2025
60fe1c3
Trigger CI
DiegoAndai Jan 9, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,70 @@ Here's how to migrate:
},
```

## LinearProgress

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

```bash
npx @mui/codemod@latest deprecations/linear-progress-classes <path>
```

### Composed CSS classes

The CSS classes that composed the `variant` and `color` prop values were deprecated.

Here's how to migrate:

```diff
-.MuiLinearProgress-bar1Buffer
+.MuiLinearProgress-buffer > .MuiLinearProgress-bar1
-.MuiLinearProgress-bar1Determinate
+.MuiLinearProgress-determinate > .MuiLinearProgress-bar1
-.MuiLinearProgress-bar1Indeterminate
+.MuiLinearProgress-indeterminate > .MuiLinearProgress-bar1
-.MuiLinearProgress-bar2Buffer
+.MuiLinearProgress-buffer > .MuiLinearProgress-bar2
-.MuiLinearProgress-bar2Indeterminate
+.MuiLinearProgress-indeterminate > .MuiLinearProgress-bar2
-.MuiLinearProgress-barColorPrimary
+.MuiLinearProgress-colorPrimary > .MuiLinearProgress-bar
-.MuiLinearProgress-barColorSecondary
+.MuiLinearProgress-colorSecondary > .MuiLinearProgress-bar
-.MuiLinearProgress-dashedColorPrimary
+.MuiLinearProgress-colorPrimary > .MuiLinearProgress-dashed
-.MuiLinearProgress-dashedColorSecondary
+.MuiLinearProgress-colorSecondary > .MuiLinearProgress-dashed
```

```diff
import { linearProgressClasses } from '@mui/material/LinearProgress';

MuiLinearProgress: {
styleOverrides: {
root: {
- [`&.${linearProgressClasses.bar1Buffer}`]: {},
+ [`&.${linearProgressClasses.buffer} > .${linearProgressClasses.bar1}`]: {},
- [`&.${linearProgressClasses.bar1Determinate}`]: {},
+ [`&.${linearProgressClasses.determinate} > .${linearProgressClasses.bar1}`]: {},
- [`&.${linearProgressClasses.bar1Indeterminate}`]: {},
+ [`&.${linearProgressClasses.indeterminate} > .${linearProgressClasses.bar1}`]: {},
- [`&.${linearProgressClasses.bar2Buffer}`]: {},
+ [`&.${linearProgressClasses.buffer} > .${linearProgressClasses.bar2}`]: {},
- [`&.${linearProgressClasses.bar2Indeterminate}`]: {},
+ [`&.${linearProgressClasses.indeterminate} > .${linearProgressClasses.bar2}`]: {},
- [`&.${linearProgressClasses.barColorPrimary}`]: {},
+ [`&.${linearProgressClasses.colorPrimary} > .${linearProgressClasses.bar}`]: {},
- [`&.${linearProgressClasses.barColorSecondary}`]: {},
+ [`&.${linearProgressClasses.colorSecondary} > .${linearProgressClasses.bar}`]: {},
- [`&.${linearProgressClasses.dashedColorPrimary}`]: {},
+ [`&.${linearProgressClasses.colorPrimary} > .${linearProgressClasses.dashed}`]: {},
- [`&.${linearProgressClasses.dashedColorSecondary}`]: {},
+ [`&.${linearProgressClasses.colorSecondary} > .${linearProgressClasses.dashed}`]: {},
},
},
}
```

## Modal

Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#modal-props) below to migrate the code as described in the following sections:
Expand Down
27 changes: 18 additions & 9 deletions docs/pages/material-ui/api/linear-progress.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,50 @@
"key": "bar1Buffer",
"className": "MuiLinearProgress-bar1Buffer",
"description": "Styles applied to the bar1 element if `variant=\"buffer\"`.",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "bar1Determinate",
"className": "MuiLinearProgress-bar1Determinate",
"description": "Styles applied to the bar1 element if `variant=\"determinate\"`.",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "bar1Indeterminate",
"className": "MuiLinearProgress-bar1Indeterminate",
"description": "Styles applied to the bar1 element if `variant=\"indeterminate or query\"`.",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "bar2Buffer",
"className": "MuiLinearProgress-bar2Buffer",
"description": "Styles applied to the bar2 element if `variant=\"buffer\"`.",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "bar2Indeterminate",
"className": "MuiLinearProgress-bar2Indeterminate",
"description": "Styles applied to the bar2 element if `variant=\"indeterminate or query\"`.",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "barColorPrimary",
"className": "MuiLinearProgress-barColorPrimary",
"description": "Styles applied to the bar elements if `color=\"primary\"`; bar2 if `variant` not \"buffer\".",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "barColorSecondary",
"className": "MuiLinearProgress-barColorSecondary",
"description": "Styles applied to the bar elements if `color=\"secondary\"`; bar2 if `variant` not \"buffer\".",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "buffer",
Expand Down Expand Up @@ -107,13 +114,15 @@
"key": "dashedColorPrimary",
"className": "MuiLinearProgress-dashedColorPrimary",
"description": "Styles applied to the additional bar element if `variant=\"buffer\"` and `color=\"primary\"`.",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "dashedColorSecondary",
"className": "MuiLinearProgress-dashedColorSecondary",
"description": "Styles applied to the additional bar element if `variant=\"buffer\"` and `color=\"secondary\"`.",
"isGlobal": false
"isGlobal": false,
"isDeprecated": true
},
{
"key": "determinate",
Expand Down
27 changes: 18 additions & 9 deletions docs/translations/api-docs/linear-progress/linear-progress.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,44 @@
"bar1Buffer": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the bar1 element",
"conditions": "<code>variant=\"buffer\"</code>"
"conditions": "<code>variant=\"buffer\"</code>",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-bar1\">.MuiLinearProgress-bar1</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-buffer\">.MuiLinearProgress-buffer</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"bar1Determinate": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the bar1 element",
"conditions": "<code>variant=\"determinate\"</code>"
"conditions": "<code>variant=\"determinate\"</code>",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-bar1\">.MuiLinearProgress-bar1</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-determinate\">.MuiLinearProgress-determinate</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"bar1Indeterminate": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the bar1 element",
"conditions": "<code>variant=\"indeterminate or query\"</code>"
"conditions": "<code>variant=\"indeterminate or query\"</code>",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-bar1\">.MuiLinearProgress-bar1</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-indeterminate\">.MuiLinearProgress-indeterminate</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"bar2Buffer": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the bar2 element",
"conditions": "<code>variant=\"buffer\"</code>"
"conditions": "<code>variant=\"buffer\"</code>",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-bar2\">.MuiLinearProgress-bar2</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-buffer\">.MuiLinearProgress-buffer</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"bar2Indeterminate": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the bar2 element",
"conditions": "<code>variant=\"indeterminate or query\"</code>"
"conditions": "<code>variant=\"indeterminate or query\"</code>",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-bar2\">.MuiLinearProgress-bar2</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-indeterminate\">.MuiLinearProgress-indeterminate</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"barColorPrimary": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the bar elements",
"conditions": "<code>color=\"primary\"</code>; bar2 if <code>variant</code> not &quot;buffer&quot;"
"conditions": "<code>color=\"primary\"</code>; bar2 if <code>variant</code> not &quot;buffer&quot;",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-bar\">.MuiLinearProgress-bar</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-colorPrimary\">.MuiLinearProgress-colorPrimary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"barColorSecondary": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the bar elements",
"conditions": "<code>color=\"secondary\"</code>; bar2 if <code>variant</code> not &quot;buffer&quot;"
"conditions": "<code>color=\"secondary\"</code>; bar2 if <code>variant</code> not &quot;buffer&quot;",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-bar\">.MuiLinearProgress-bar</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-colorSecondary\">.MuiLinearProgress-colorSecondary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"buffer": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
Expand All @@ -79,12 +86,14 @@
"dashedColorPrimary": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the additional bar element",
"conditions": "<code>variant=\"buffer\"</code> and <code>color=\"primary\"</code>"
"conditions": "<code>variant=\"buffer\"</code> and <code>color=\"primary\"</code>",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-dashed\">.MuiLinearProgress-dashed</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-colorPrimary\">.MuiLinearProgress-colorPrimary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"dashedColorSecondary": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the additional bar element",
"conditions": "<code>variant=\"buffer\"</code> and <code>color=\"secondary\"</code>"
"conditions": "<code>variant=\"buffer\"</code> and <code>color=\"secondary\"</code>",
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-dashed\">.MuiLinearProgress-dashed</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-colorSecondary\">.MuiLinearProgress-colorSecondary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
},
"determinate": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
Expand Down
60 changes: 60 additions & 0 deletions packages/mui-codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,66 @@ npx @mui/codemod@latest deprecations/input-base-props <path>
npx @mui/codemod@latest deprecations/input-props <path>
```

#### `linear-progress-classes`

JS transforms:

```diff
import { linearProgressClasses } from '@mui/material/LinearProgress';

MuiLinearProgress: {
styleOverrides: {
root: {
- [`&.${linearProgressClasses.bar1Buffer}`]: {},
+ [`&.${linearProgressClasses.buffer} > .${linearProgressClasses.bar1}`]: {},
- [`&.${linearProgressClasses.bar1Determinate}`]: {},
+ [`&.${linearProgressClasses.determinate} > .${linearProgressClasses.bar1}`]: {},
- [`&.${linearProgressClasses.bar1Indeterminate}`]: {},
+ [`&.${linearProgressClasses.indeterminate} > .${linearProgressClasses.bar1}`]: {},
- [`&.${linearProgressClasses.bar2Buffer}`]: {},
+ [`&.${linearProgressClasses.buffer} > .${linearProgressClasses.bar2}`]: {},
- [`&.${linearProgressClasses.bar2Indeterminate}`]: {},
+ [`&.${linearProgressClasses.indeterminate} > .${linearProgressClasses.bar2}`]: {},
- [`&.${linearProgressClasses.barColorPrimary}`]: {},
+ [`&.${linearProgressClasses.colorPrimary} > .${linearProgressClasses.bar}`]: {},
- [`&.${linearProgressClasses.barColorSecondary}`]: {},
+ [`&.${linearProgressClasses.colorSecondary} > .${linearProgressClasses.bar}`]: {},
- [`&.${linearProgressClasses.dashedColorPrimary}`]: {},
+ [`&.${linearProgressClasses.colorPrimary} > .${linearProgressClasses.dashed}`]: {},
- [`&.${linearProgressClasses.dashedColorSecondary}`]: {},
+ [`&.${linearProgressClasses.colorSecondary} > .${linearProgressClasses.dashed}`]: {},
},
},
}
```

CSS transforms:

```diff
-.MuiLinearProgress-bar1Buffer
+.MuiLinearProgress-buffer > .MuiLinearProgress-bar1
-.MuiLinearProgress-bar1Determinate
+.MuiLinearProgress-determinate > .MuiLinearProgress-bar1
-.MuiLinearProgress-bar1Indeterminate
+.MuiLinearProgress-indeterminate > .MuiLinearProgress-bar1
-.MuiLinearProgress-bar2Buffer
+.MuiLinearProgress-buffer > .MuiLinearProgress-bar2
-.MuiLinearProgress-bar2Indeterminate
+.MuiLinearProgress-indeterminate > .MuiLinearProgress-bar2
-.MuiLinearProgress-barColorPrimary
+.MuiLinearProgress-colorPrimary > .MuiLinearProgress-bar
-.MuiLinearProgress-barColorSecondary
+.MuiLinearProgress-colorSecondary > .MuiLinearProgress-bar
-.MuiLinearProgress-dashedColorPrimary
+.MuiLinearProgress-colorPrimary > .MuiLinearProgress-dashed
-.MuiLinearProgress-dashedColorSecondary
+.MuiLinearProgress-colorSecondary > .MuiLinearProgress-dashed
```

```bash
npx @mui/codemod@latest deprecations/linear-progress-classes <path>
```

#### `modal-props`

```diff
Expand Down
2 changes: 2 additions & 0 deletions packages/mui-codemod/src/deprecations/all/deprecations-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import transformImageListItemBarClasses from '../image-list-item-bar-classes';
import transformInputBaseProps from '../input-base-props';
import transformInputProps from '../input-props';
import transformListItemTextProps from '../list-item-text-props';
import transformLinearProgressClasses from '../linear-progress-classes';
import transformModalProps from '../modal-props';
import transformOutlinedInputProps from '../outlined-input-props';
import transformPaginationItemClasses from '../pagination-item-classes';
Expand Down Expand Up @@ -54,6 +55,7 @@ export default function deprecationsAll(file, api, options) {
file.source = transformInputBaseProps(file, api, options);
file.source = transformInputProps(file, api, options);
file.source = transformListItemTextProps(file, api, options);
file.source = transformLinearProgressClasses(file, api, options);
file.source = transformModalProps(file, api, options);
file.source = transformOutlinedInputProps(file, api, options);
file.source = transformPaginationItemClasses(file, api, options);
Expand Down
4 changes: 4 additions & 0 deletions packages/mui-codemod/src/deprecations/all/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const {
const {
plugin: circularProgressClassesPlugin,
} = require('../circular-progress-classes/postcss-plugin');
const {
plugin: linearProgressClassesPlugin,
} = require('../linear-progress-classes/postcss-plugin');
const { plugin: tabClassesPlugin } = require('../tab-classes/postcss-plugin');
const {
plugin: tableSortLabelClassesPlugin,
Expand All @@ -29,6 +32,7 @@ module.exports = {
buttonGroupClassesPlugin,
chipClassesPlugin,
circularProgressClassesPlugin,
linearProgressClassesPlugin,
paginationItemClassesPlugin,
stepConnectorClassesPlugin,
toggleButtonGroupClassesPlugin,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './linear-progress-classes';
Loading
Loading