Skip to content

Commit 43de09e

Browse files
authored
[linear progress] Remove deprecated CSS classes (#48068)
1 parent 3ce44b3 commit 43de09e

6 files changed

Lines changed: 90 additions & 233 deletions

File tree

docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,61 @@ The following deprecated prop has been removed:
10501050
/>
10511051
```
10521052

1053+
#### LinearProgress deprecated CSS classes removed
1054+
1055+
Use the [linear-progress-classes 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 section:
1056+
1057+
```bash
1058+
npx @mui/codemod@latest deprecations/linear-progress-classes <path>
1059+
```
1060+
1061+
The following deprecated `LinearProgress` CSS classes have been removed:
1062+
1063+
- `bar1Buffer` → use `.MuiLinearProgress-buffer > .MuiLinearProgress-bar1`
1064+
- `bar1Determinate` → use `.MuiLinearProgress-determinate > .MuiLinearProgress-bar1`
1065+
- `bar1Indeterminate` → use `.MuiLinearProgress-indeterminate > .MuiLinearProgress-bar1`
1066+
- `bar2Buffer` → use `.MuiLinearProgress-buffer > .MuiLinearProgress-bar2`
1067+
- `bar2Indeterminate` → use `.MuiLinearProgress-indeterminate > .MuiLinearProgress-bar2`
1068+
- `barColorPrimary` → use `.MuiLinearProgress-colorPrimary > .MuiLinearProgress-bar`
1069+
- `barColorSecondary` → use `.MuiLinearProgress-colorSecondary > .MuiLinearProgress-bar`
1070+
- `dashedColorPrimary` → use `.MuiLinearProgress-colorPrimary > .MuiLinearProgress-dashed`
1071+
- `dashedColorSecondary` → use `.MuiLinearProgress-colorSecondary > .MuiLinearProgress-dashed`
1072+
1073+
If you were using these deprecated class names as `styleOverrides` keys in your theme, use the `variants` array in the appropriate slot override instead:
1074+
1075+
```diff
1076+
const theme = createTheme({
1077+
components: {
1078+
MuiLinearProgress: {
1079+
styleOverrides: {
1080+
- bar1Determinate: { transition: 'none' },
1081+
- bar1Indeterminate: { width: 'auto' },
1082+
- bar1Buffer: { zIndex: 1 },
1083+
- barColorPrimary: { backgroundColor: 'red' },
1084+
- dashedColorPrimary: { backgroundSize: '10px 10px' },
1085+
+ bar1: {
1086+
+ variants: [
1087+
+ { props: { variant: 'determinate' }, style: { transition: 'none' } },
1088+
+ { props: { variant: 'indeterminate' }, style: { width: 'auto' } },
1089+
+ { props: { variant: 'buffer' }, style: { zIndex: 1 } },
1090+
+ ],
1091+
+ },
1092+
+ bar: {
1093+
+ variants: [
1094+
+ { props: { color: 'primary' }, style: { backgroundColor: 'red' } },
1095+
+ ],
1096+
+ },
1097+
+ dashed: {
1098+
+ variants: [
1099+
+ { props: { color: 'primary' }, style: { backgroundSize: '10px 10px' } },
1100+
+ ],
1101+
+ },
1102+
},
1103+
},
1104+
},
1105+
});
1106+
```
1107+
10531108
#### ListItem deprecated props removed
10541109

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

docs/pages/material-ui/api/linear-progress.json

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -43,61 +43,12 @@
4343
"description": "Styles applied to the bar1 element.",
4444
"isGlobal": false
4545
},
46-
{
47-
"key": "bar1Buffer",
48-
"className": "MuiLinearProgress-bar1Buffer",
49-
"description": "Styles applied to the bar1 element if `variant=\"buffer\"`.",
50-
"isGlobal": false,
51-
"isDeprecated": true
52-
},
53-
{
54-
"key": "bar1Determinate",
55-
"className": "MuiLinearProgress-bar1Determinate",
56-
"description": "Styles applied to the bar1 element if `variant=\"determinate\"`.",
57-
"isGlobal": false,
58-
"isDeprecated": true
59-
},
60-
{
61-
"key": "bar1Indeterminate",
62-
"className": "MuiLinearProgress-bar1Indeterminate",
63-
"description": "Styles applied to the bar1 element if `variant=\"indeterminate or query\"`.",
64-
"isGlobal": false,
65-
"isDeprecated": true
66-
},
6746
{
6847
"key": "bar2",
6948
"className": "MuiLinearProgress-bar2",
7049
"description": "Styles applied to the bar2 element.",
7150
"isGlobal": false
7251
},
73-
{
74-
"key": "bar2Buffer",
75-
"className": "MuiLinearProgress-bar2Buffer",
76-
"description": "Styles applied to the bar2 element if `variant=\"buffer\"`.",
77-
"isGlobal": false,
78-
"isDeprecated": true
79-
},
80-
{
81-
"key": "bar2Indeterminate",
82-
"className": "MuiLinearProgress-bar2Indeterminate",
83-
"description": "Styles applied to the bar2 element if `variant=\"indeterminate or query\"`.",
84-
"isGlobal": false,
85-
"isDeprecated": true
86-
},
87-
{
88-
"key": "barColorPrimary",
89-
"className": "MuiLinearProgress-barColorPrimary",
90-
"description": "Styles applied to the bar elements if `color=\"primary\"`; bar2 if `variant` not \"buffer\".",
91-
"isGlobal": false,
92-
"isDeprecated": true
93-
},
94-
{
95-
"key": "barColorSecondary",
96-
"className": "MuiLinearProgress-barColorSecondary",
97-
"description": "Styles applied to the bar elements if `color=\"secondary\"`; bar2 if `variant` not \"buffer\".",
98-
"isGlobal": false,
99-
"isDeprecated": true
100-
},
10152
{
10253
"key": "buffer",
10354
"className": "MuiLinearProgress-buffer",
@@ -122,20 +73,6 @@
12273
"description": "Styles applied to the additional bar element if `variant=\"buffer\"`.",
12374
"isGlobal": false
12475
},
125-
{
126-
"key": "dashedColorPrimary",
127-
"className": "MuiLinearProgress-dashedColorPrimary",
128-
"description": "Styles applied to the additional bar element if `variant=\"buffer\"` and `color=\"primary\"`.",
129-
"isGlobal": false,
130-
"isDeprecated": true
131-
},
132-
{
133-
"key": "dashedColorSecondary",
134-
"className": "MuiLinearProgress-dashedColorSecondary",
135-
"description": "Styles applied to the additional bar element if `variant=\"buffer\"` and `color=\"secondary\"`.",
136-
"isGlobal": false,
137-
"isDeprecated": true
138-
},
13976
{
14077
"key": "determinate",
14178
"className": "MuiLinearProgress-determinate",

docs/translations/api-docs/linear-progress/linear-progress.json

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,7 @@
2222
"nodeName": "the layered bar1 and bar2 elements"
2323
},
2424
"bar1": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the bar1 element" },
25-
"bar1Buffer": {
26-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
27-
"nodeName": "the bar1 element",
28-
"conditions": "<code>variant=\"buffer\"</code>",
29-
"deprecationInfo": "Use the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-bar1\">.MuiLinearProgress-bar1</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-buffer\">.MuiLinearProgress-buffer</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
30-
},
31-
"bar1Determinate": {
32-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
33-
"nodeName": "the bar1 element",
34-
"conditions": "<code>variant=\"determinate\"</code>",
35-
"deprecationInfo": "Use the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-bar1\">.MuiLinearProgress-bar1</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-determinate\">.MuiLinearProgress-determinate</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
36-
},
37-
"bar1Indeterminate": {
38-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
39-
"nodeName": "the bar1 element",
40-
"conditions": "<code>variant=\"indeterminate or query\"</code>",
41-
"deprecationInfo": "Use the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-bar1\">.MuiLinearProgress-bar1</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-indeterminate\">.MuiLinearProgress-indeterminate</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
42-
},
4325
"bar2": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the bar2 element" },
44-
"bar2Buffer": {
45-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
46-
"nodeName": "the bar2 element",
47-
"conditions": "<code>variant=\"buffer\"</code>",
48-
"deprecationInfo": "Use the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-bar2\">.MuiLinearProgress-bar2</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-buffer\">.MuiLinearProgress-buffer</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
49-
},
50-
"bar2Indeterminate": {
51-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
52-
"nodeName": "the bar2 element",
53-
"conditions": "<code>variant=\"indeterminate or query\"</code>",
54-
"deprecationInfo": "Use the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-bar2\">.MuiLinearProgress-bar2</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-indeterminate\">.MuiLinearProgress-indeterminate</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
55-
},
56-
"barColorPrimary": {
57-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
58-
"nodeName": "the bar elements",
59-
"conditions": "<code>color=\"primary\"</code>; bar2 if <code>variant</code> not &quot;buffer&quot;",
60-
"deprecationInfo": "Use the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-bar\">.MuiLinearProgress-bar</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-colorPrimary\">.MuiLinearProgress-colorPrimary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
61-
},
62-
"barColorSecondary": {
63-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
64-
"nodeName": "the bar elements",
65-
"conditions": "<code>color=\"secondary\"</code>; bar2 if <code>variant</code> not &quot;buffer&quot;",
66-
"deprecationInfo": "Use the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-bar\">.MuiLinearProgress-bar</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-colorSecondary\">.MuiLinearProgress-colorSecondary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
67-
},
6826
"buffer": {
6927
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
7028
"nodeName": "the root element",
@@ -85,18 +43,6 @@
8543
"nodeName": "the additional bar element",
8644
"conditions": "<code>variant=\"buffer\"</code>"
8745
},
88-
"dashedColorPrimary": {
89-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
90-
"nodeName": "the additional bar element",
91-
"conditions": "<code>variant=\"buffer\"</code> and <code>color=\"primary\"</code>",
92-
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-dashed\">.MuiLinearProgress-dashed</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-colorPrimary\">.MuiLinearProgress-colorPrimary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
93-
},
94-
"dashedColorSecondary": {
95-
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
96-
"nodeName": "the additional bar element",
97-
"conditions": "<code>variant=\"buffer\"</code> and <code>color=\"secondary\"</code>",
98-
"deprecationInfo": "Combine the <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-dashed\">.MuiLinearProgress-dashed</a> and <a href=\"/material-ui/api/linear-progress/#linear-progress-classes-MuiLinearProgress-colorSecondary\">.MuiLinearProgress-colorSecondary</a> classes instead. <a href=\"/material-ui/migration/migrating-from-deprecated-apis/\">How to migrate</a>"
99-
},
10046
"determinate": {
10147
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
10248
"nodeName": "the root element",

packages/mui-material/src/LinearProgress/LinearProgress.js

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,9 @@ const useUtilityClasses = (ownerState) => {
9090

9191
const slots = {
9292
root: ['root', `color${capitalize(color)}`, variant],
93-
dashed: ['dashed', `dashedColor${capitalize(color)}`],
94-
bar1: [
95-
'bar',
96-
'bar1',
97-
`barColor${capitalize(color)}`,
98-
(variant === 'indeterminate' || variant === 'query') && 'bar1Indeterminate',
99-
variant === 'determinate' && 'bar1Determinate',
100-
variant === 'buffer' && 'bar1Buffer',
101-
],
102-
bar2: [
103-
'bar',
104-
'bar2',
105-
variant !== 'buffer' && `barColor${capitalize(color)}`,
106-
variant === 'buffer' && `color${capitalize(color)}`,
107-
(variant === 'indeterminate' || variant === 'query') && 'bar2Indeterminate',
108-
variant === 'buffer' && 'bar2Buffer',
109-
],
93+
dashed: ['dashed'],
94+
bar1: ['bar', 'bar1'],
95+
bar2: ['bar', 'bar2', variant === 'buffer' && `color${capitalize(color)}`],
11096
};
11197

11298
return composeClasses(slots, getLinearProgressUtilityClass, classes);
@@ -185,9 +171,7 @@ const LinearProgressDashed = styled('span', {
185171
name: 'MuiLinearProgress',
186172
slot: 'Dashed',
187173
overridesResolver: (props, styles) => {
188-
const { ownerState } = props;
189-
190-
return [styles.dashed, styles[`dashedColor${capitalize(ownerState.color)}`]];
174+
return [styles.dashed];
191175
},
192176
})(
193177
memoTheme(({ theme }) => ({
@@ -228,17 +212,7 @@ const LinearProgressBar1 = styled('span', {
228212
name: 'MuiLinearProgress',
229213
slot: 'Bar1',
230214
overridesResolver: (props, styles) => {
231-
const { ownerState } = props;
232-
233-
return [
234-
styles.bar,
235-
styles.bar1,
236-
styles[`barColor${capitalize(ownerState.color)}`],
237-
(ownerState.variant === 'indeterminate' || ownerState.variant === 'query') &&
238-
styles.bar1Indeterminate,
239-
ownerState.variant === 'determinate' && styles.bar1Determinate,
240-
ownerState.variant === 'buffer' && styles.bar1Buffer,
241-
];
215+
return [styles.bar, styles.bar1];
242216
},
243217
})(
244218
memoTheme(({ theme }) => ({
@@ -305,16 +279,7 @@ const LinearProgressBar2 = styled('span', {
305279
name: 'MuiLinearProgress',
306280
slot: 'Bar2',
307281
overridesResolver: (props, styles) => {
308-
const { ownerState } = props;
309-
310-
return [
311-
styles.bar,
312-
styles.bar2,
313-
styles[`barColor${capitalize(ownerState.color)}`],
314-
(ownerState.variant === 'indeterminate' || ownerState.variant === 'query') &&
315-
styles.bar2Indeterminate,
316-
ownerState.variant === 'buffer' && styles.bar2Buffer,
317-
];
282+
return [styles.bar, styles.bar2];
318283
},
319284
})(
320285
memoTheme(({ theme }) => ({

0 commit comments

Comments
 (0)