Skip to content

Commit 28ab395

Browse files
committed
Merge branch 'next' into template-page-polishing
2 parents 36d4205 + f9de2dd commit 28ab395

File tree

32 files changed

+657
-502
lines changed

32 files changed

+657
-502
lines changed

docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Bear in mind that the `.MuiAccordionSummary-gutters` class is applied to the com
5656
```diff
5757
-.MuiAccordionSummary-root .MuiAccordionSummary-contentGutters
5858
+.MuiAccordionSummary-root.MuiAccordionSummary-gutters .MuiAccordionSummary-content
59-
/>
6059
```
6160

6261
```diff
@@ -221,7 +220,7 @@ The Autocomplete's `componentsProps` prop was deprecated in favor of `slotProps`
221220
+ paper: { width: 12 },
222221
+ popper: { width: 14 },
223222
+ popupIndicator: { width: 16 },
224-
}}
223+
}}
225224
/>
226225
```
227226

@@ -240,18 +239,18 @@ The AvatarGroup's `slotProps.additionalAvatar` was deprecated in favor of `slotP
240239
```diff
241240
<AvatarGroup
242241
slotProps={{
243-
- additionalAvatar: {color: "red"}
244-
+ surplus: {color: "red"}
242+
- additionalAvatar: { color: 'red' },
243+
+ surplus: { color: 'red' },
245244
}}
246-
/>;
245+
>
247246
```
248247

249248
```diff
250249
MuiAvatarGroup: {
251250
defaultProps: {
252251
slotProps: {
253-
- additionalAvatar: {color: "red"}
254-
+ surplus: {color: "red"}
252+
- additionalAvatar: { color: 'red' },
253+
+ surplus: { color: 'red' },
255254
},
256255
},
257256
},
@@ -264,11 +263,11 @@ The AvatarGroup's `componentsProps` was deprecated in favor of `slotProps`:
264263
```diff
265264
<AvatarGroup
266265
- componentsProps={{
267-
- additionalAvatar: {color: "red"}
266+
- additionalAvatar: { color: 'red' },
268267
+ slotProps={{
269-
+ surplus: {color: "red"}
268+
+ surplus: { color: 'red' },
270269
}}
271-
/>;
270+
>
272271
```
273272

274273
```diff
@@ -329,7 +328,7 @@ The Badge's `components` prop was deprecated in favor of `slots`:
329328
<Badge
330329
- components={{ root: CustomRoot }}
331330
+ slots={{ root: CustomRoot }}
332-
/>
331+
>
333332
```
334333

335334
### componentsProps
@@ -340,7 +339,7 @@ The Badge's `componentsProps` prop was deprecated in favor of `slotProps`:
340339
<Badge
341340
- componentsProps={{ root: { testid: 'test-id' } }}
342341
+ slotProps={{ root: { testid: 'test-id' } }}
343-
/>
342+
>
344343
```
345344

346345
## Button
@@ -782,7 +781,7 @@ Here's how to migrate:
782781

783782
import { chipClasses } from '@mui/material/Chip';
784783

785-
MuiChip: {
784+
MuiChip: {
786785
styleOverrides: {
787786
root: {
788787
- [`&.${chipClasses.clickableColorPrimary}`]: {
@@ -888,11 +887,10 @@ Here's how to migrate:
888887
- [`& .${chipClasses.deleteIconFilledColorSecondary}`]: {
889888
+ [`&.${chipClasses.filled}.${chipClasses.colorSecondary} > .${chipClasses.deleteIcon}`]: {
890889
color: 'red',
891-
},
890+
},
892891
},
893892
},
894-
},
895-
893+
},
896894
```
897895

898896
## CircularProgress
@@ -910,9 +908,9 @@ The CSS classes that composed the `circle` CSS class and `variant` prop values w
910908
Here's how to migrate:
911909

912910
```diff
913-
- .MuiCircularProgress-circleDeterminate
911+
-.MuiCircularProgress-circleDeterminate
912+
-.MuiCircularProgress-circleIndeterminate
914913
+.MuiCircularProgress-determinate > .MuiCircularProgress-circle
915-
- .MuiCircularProgress-circleIndeterminate
916914
+.MuiCircularProgress-indeterminate > .MuiCircularProgress-circle
917915
```
918916

@@ -929,7 +927,7 @@ Here's how to migrate:
929927
- [`& .${circularProgressClasses.circleIndeterminate}`]: {
930928
+ [`&.${circularProgressClasses.indeterminate} > .${circularProgressClasses.circle}`]: {
931929
color: 'red',
932-
},
930+
},
933931
},
934932
},
935933
},
@@ -1141,7 +1139,7 @@ The Grid's `wrap` prop was deprecated in favor of `flexWrap` MUI System prop:
11411139
<Grid
11421140
- wrap="nowrap"
11431141
+ flexWrap="nowrap"
1144-
/>;
1142+
>
11451143
```
11461144

11471145
## ImageListItemBar
@@ -1163,13 +1161,13 @@ The CSS classes that composed the following props were deprecated:
11631161
Here's how to migrate:
11641162

11651163
```diff
1166-
- .MuiImageListItemBar-titleWrapBelow
1164+
-.MuiImageListItemBar-titleWrapBelow
11671165
+.MuiImageListItemBar-positionBelow > .MuiImageListItemBar-titleWrap
1168-
- .MuiImageListItemBar-titleWrapActionPosLeft
1166+
-.MuiImageListItemBar-titleWrapActionPosLeft
11691167
+.MuiImageListItemBar-actionPositionLeft > .MuiImageListItemBar-titleWrap
1170-
- .MuiImageListItemBar-titleWrapActionPosRight
1168+
-.MuiImageListItemBar-titleWrapActionPosRight
11711169
+.MuiImageListItemBar-actionPositionRight > .MuiImageListItemBar-titleWrap
1172-
- .MuiImageListItemBar-actionIconActionPosLeft
1170+
-.MuiImageListItemBar-actionIconActionPosLeft
11731171
+.MuiImageListItemBar-actionPositionLeft > .MuiImageListItemBar-actionIcon
11741172
```
11751173

@@ -1216,7 +1214,7 @@ The Modal's `components` prop was deprecated in favor of `slots`:
12161214
<Modal
12171215
- components={{ Root: CustomRoot, Backdrop: CustomBackdrop }}
12181216
+ slots={{ root: CustomRoot, backdrop: CustomBackdrop }}
1219-
/>
1217+
>
12201218
```
12211219

12221220
### componentsProps
@@ -1227,7 +1225,7 @@ The Modal's `componentsProps` prop was deprecated in favor of `slotProps`:
12271225
<Modal
12281226
- componentsProps={{ root: { testid: 'root-id' }, backdrop: { testid: 'backdrop-id' } }}
12291227
+ slotProps={{ root: { testid: 'root-id' }, backdrop: { testid: 'backdrop-id' } }}
1230-
/>
1228+
>
12311229
```
12321230

12331231
## OutlinedInput
@@ -1408,7 +1406,7 @@ Here's how to migrate:
14081406

14091407
import { toggleButtonGroupClasses } from '@mui/material/ToggleButtonGroup';
14101408

1411-
MuiButtonGroup: {
1409+
MuiButtonGroup: {
14121410
styleOverrides: {
14131411
root: {
14141412
- [`& .${toggleButtonGroupClasses.groupedHorizontal}`]: {
@@ -1418,9 +1416,10 @@ Here's how to migrate:
14181416
- [`& .${toggleButtonGroupClasses.groupedVertical}`]: {
14191417
+ [`&.${toggleButtonGroupClasses.vertical} > .${toggleButtonGroupClasses.grouped}`]: {
14201418
color: 'red',
1421-
},
1419+
},
1420+
},
14221421
},
1423-
},
1422+
},
14241423
```
14251424

14261425
## Tab
@@ -1451,7 +1450,8 @@ Here's how to migrate:
14511450
- [`& .${tabClasses.iconWrapper}`]: {
14521451
+ [`& .${tabClasses.icon}`]: {
14531452
color: 'red',
1454-
},
1453+
},
1454+
},
14551455
},
14561456
},
14571457
```
@@ -1471,9 +1471,9 @@ The CSS classes that composed the `direction` prop and `icon` prop were removed.
14711471
Here's how to migrate:
14721472

14731473
```diff
1474-
- .MuiTableSortLabel-iconDirectionDesc
1474+
-.MuiTableSortLabel-iconDirectionDesc
14751475
+.MuiTableSortLabel-directionDesc > .MuiTableSortLabel-icon
1476-
- .MuiTableSortLabel-iconDirectionAsc
1476+
-.MuiTableSortLabel-iconDirectionAsc
14771477
+.MuiTableSortLabel-directionAsc > .MuiTableSortLabel-icon
14781478
```
14791479

@@ -1490,7 +1490,7 @@ Here's how to migrate:
14901490
- [`& .${tableSortLabelClasses.iconDirectionAsc}`]: {
14911491
+ [`&.${tableSortLabelClasses.directionAsc} > .${tableSortLabelClasses.icon}`]: {
14921492
color: 'red',
1493-
},
1493+
},
14941494
},
14951495
},
14961496
},
@@ -1510,18 +1510,18 @@ All of the TextField's slot props (`*Props`) props were deprecated in favor of e
15101510

15111511
```diff
15121512
<TextField
1513-
- InputProps={CustomInputProps}
1514-
- inputProps={CustomHtmlInputProps}
1515-
- SelectProps={CustomSelectProps}
1516-
- InputLabelProps={CustomInputLabelProps}
1517-
- FormHelperTextProps={CustomFormHelperProps}
1518-
+ slotProps={{
1519-
+ input: CustomInputProps
1520-
+ htmlInput: CustomHtmlInputProps
1521-
+ select: CustomSelectProps
1522-
+ inputLabel: CustomInputLabelProps
1523-
+ formHelper: CustomFormHelperProps
1524-
+ }}
1513+
- InputProps={CustomInputProps}
1514+
- inputProps={CustomHtmlInputProps}
1515+
- SelectProps={CustomSelectProps}
1516+
- InputLabelProps={CustomInputLabelProps}
1517+
- FormHelperTextProps={CustomFormHelperProps}
1518+
+ slotProps={{
1519+
+ input: CustomInputProps
1520+
+ htmlInput: CustomHtmlInputProps
1521+
+ select: CustomSelectProps
1522+
+ inputLabel: CustomInputLabelProps
1523+
+ formHelper: CustomFormHelperProps
1524+
+ }}
15251525
/>
15261526
```
15271527

@@ -1615,9 +1615,9 @@ The CSS classes that composed the `line` CSS class and `orientation` prop values
16151615
Here's how to migrate:
16161616

16171617
```diff
1618-
- .MuiStepConnector-lineHorizontal
1618+
-.MuiStepConnector-lineHorizontal
16191619
+.MuiStepConnector-horizontal > .MuiStepConnector-line
1620-
- .MuiStepConnector-lineVertical
1620+
-.MuiStepConnector-lineVertical
16211621
+.MuiStepConnector-vertical > .MuiStepConnector-line
16221622
```
16231623

docs/data/material/migration/migrating-to-v6/migrating-to-pigment-css.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Before going through this guide, make sure you have [migrated to Material UI v6
66

77
## Introduction
88

9-
The default styling engine of Material UI v6 is [Emotion](https://emotion.sh/docs/introduction). It lets you write styles in a CSS-in-JS fashion, which is great for dynamic styles that depend on states and props. However, it has some performance drawbacks when it comes to frequent re-renders because the style recalculation happens on the client-side. It also does not fully support [React Server Components](https://react.dev/reference/rsc/server-components), a new rendering paradigm that renders components ahead of time on the server.
9+
The default styling engine of Material UI v6 is [Emotion](https://emotion.sh/docs/introduction).
10+
It lets you write styles in a CSS-in-JS fashion, which is great for dynamic styles that depend on states and props. However, it has some performance drawbacks when it comes to frequent re-renders because the style recalculation happens on the client-side.
11+
It also does not fully support [React Server Components](https://react.dev/reference/rsc/server-components), a new rendering paradigm that renders components ahead of time on the server.
1012

1113
Pigment CSS aims to solve these problems while keeping the same developer experience of writing styles in a CSS-in-JS fashion.
1214
It can work alongside Emotion to ease the migration process, but it is recommended to fully migrate to Pigment CSS in the end.
@@ -15,7 +17,7 @@ It can work alongside Emotion to ease the migration process, but it is recommend
1517

1618
Pigment CSS can be used with one of the following frameworks:
1719

18-
- [Next.js App Router](https://nextjs.org/docs/app) with Webpack 5 (Turbo is not supported yet)
20+
- [Next.js App Router](https://nextjs.org/docs/app) with Webpack v5 (Turbopack is not supported yet)
1921
- [Vite](https://vitejs.dev/)
2022

2123
## Installation
@@ -102,7 +104,7 @@ Finally, import the stylesheet at the top of the layout file.
102104
import type { Metadata } from 'next';
103105
import { Inter } from 'next/font/google';
104106

105-
+ import '@mui/material-pigment-css/styles.css';
107+
+import '@mui/material-pigment-css/styles.css';
106108

107109
export default function RootLayout(props) {
108110
return (
@@ -155,7 +157,7 @@ Finally, add the Pigment CSS stylesheet to the top of the main file.
155157

156158
```diff title="src/main.(js|tsx)"
157159
import * as React from 'react';
158-
+ import '@mui/material-pigment-css/styles.css';
160+
+import '@mui/material-pigment-css/styles.css';
159161
import App from './App';
160162

161163
ReactDOM.createRoot(document.getElementById('root')).render(
@@ -171,11 +173,11 @@ Integrating Pigment CSS with Material UI requires you to configure the theme t
171173
Add the following code to your [Next.js](#nextjs) or [Vite](#vite) config file:
172174

173175
```diff
174-
+ import { extendTheme } from '@mui/material';
176+
+import { extendTheme } from '@mui/material';
175177

176-
+ const pigmentConfig = {
177-
+ theme: extendTheme(),
178-
+ };
178+
+const pigmentConfig = {
179+
+ theme: extendTheme(),
180+
+};
179181
```
180182

181183
If you don't have a custom theme, you are ready to go. Start a development server by running:
@@ -211,6 +213,7 @@ import Card from '@mui/material/Card';
211213

212214
function App() {
213215
const [color, setColor] = useState('#000000');
216+
214217
return (
215218
<Card
216219
sx={{
@@ -434,8 +437,8 @@ With Pigment CSS, any JSX element can accept the `sx` prop so it is **no** long
434437
If you have custom components that are using `styled` from `@mui/material/styles`, change the import source to `@mui/material-pigment-css`:
435438
436439
```diff
437-
- import { styled } from '@mui/material/styles';
438-
+ import { styled } from '@mui/material-pigment-css';
440+
-import { styled } from '@mui/material/styles';
441+
+import { styled } from '@mui/material-pigment-css';
439442
```
440443
441444
Then, run the following codemod:
@@ -506,17 +509,17 @@ export default FlashCode;
506509
To use layout components that are compatible with Pigment CSS, replace the following components with those from the adapter package:
507510
508511
```diff
509-
- import Container from '@mui/material/Container';
510-
+ import Container from '@mui/material-pigment-css/Container';
512+
-import Container from '@mui/material/Container';
513+
+import Container from '@mui/material-pigment-css/Container';
511514

512-
- import Grid from '@mui/material/Grid';
513-
+ import Grid from '@mui/material-pigment-css/Grid';
515+
-import Grid from '@mui/material/Grid';
516+
+import Grid from '@mui/material-pigment-css/Grid';
514517

515-
- import Stack from '@mui/material/Stack';
516-
+ import Stack from '@mui/material-pigment-css/Stack';
518+
-import Stack from '@mui/material/Stack';
519+
+import Stack from '@mui/material-pigment-css/Stack';
517520

518-
- import Hidden from '@mui/material/Hidden';
519-
+ import Hidden from '@mui/material-pigment-css/Hidden';
521+
-import Hidden from '@mui/material/Hidden';
522+
+import Hidden from '@mui/material-pigment-css/Hidden';
520523
```
521524
522525
:::info
@@ -533,16 +536,16 @@ Choose one of the following approaches:
533536
Replace the `Box` component with the one from the adapter package:
534537
535538
```diff
536-
- import Box from '@mui/material/Box';
537-
+ import Box from '@mui/material-pigment-css/Box';
539+
-import Box from '@mui/material/Box';
540+
+import Box from '@mui/material-pigment-css/Box';
538541
```
539542
540543
### Use HTML element
541544
542545
Pigment CSS can extract the `sx` prop from any JSX element, so there is no need to use the Box component.
543546
544547
```diff
545-
- import Box from '@mui/material/Box';
548+
-import Box from '@mui/material/Box';
546549

547550
function CustomCard() {
548551
return (
@@ -554,7 +557,7 @@ Pigment CSS can extract the `sx` prop from any JSX element, so there is no need
554557
+ <img src="..." sx={{ width: 24, height: 24 }}>
555558
+ ...
556559
+ </div>
557-
)
560+
);
558561
}
559562
```
560563
@@ -577,8 +580,8 @@ declare global {
577580
If you are using the `useTheme` hook, replace the import source:
578581
579582
```diff
580-
- import { useTheme } from '@mui/material/styles';
581-
+ import { useTheme } from '@mui/material-pigment-css';
583+
-import { useTheme } from '@mui/material/styles';
584+
+import { useTheme } from '@mui/material-pigment-css';
582585
```
583586
584587
:::info

0 commit comments

Comments
 (0)