-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
Description
Left over components
- Stack: @brijeshb42
- Container: @brijeshb42
- Grid: @DiegoAndai
- CssBaseline [material-ui] Support Pigment CSS for
CssBaseline,ScopedCssBaselineandPopper#42640 - ScopedCssBaseline [material-ui] Support Pigment CSS for
CssBaseline,ScopedCssBaselineandPopper#42640 - Popper [material-ui] Support Pigment CSS for
CssBaseline,ScopedCssBaselineandPopper#42640 - Hidden: needs atomics because of breakpoints related
Thank you for past contributions
Contribution is welcome
The focus of Material UI v6 is to support static CSS extraction, and we are excited to invite the community to be a part of it!
For short context, the static extraction is done by our in-house styling-engine package, aka Pigment CSS. You can think of it as a replacement for Emotion/Styled-components. We must add an intermediate path to let the components support both Pigment CSS and Emotion.
The goal of this issue is to track the progress of the work with guidance on how to contribute and check the result. Explanation about Pigment CSS is out-of-scope. But you can visit the README for more info.
Contributing
-
Pick a component from the Ready-to-take section below. Tag @siriwatknp in the comment to assign to you (for example, if you take Accordion, Accordion* must be included in your PR).
-
Fork the repo (if you are a new contributor, please check the contributing first) and open the component implementation, e.g.
packages/mui-material/src/Avatar/Avatar.js. -
Change the path import of these APIs,
styled,useThemeProps,keyframesto../zero-styled:… - import styled from '../styles/styled'; - import useThemeProps from '../styles/useThemeProps'; + import { styled, createUseThemeProps } from '../zero-styled'; …the rest of the imports const useThemeProps = createUseThemeProps('MuiAvatar'); …
💡 For
useThemeProps, replace it withcreateUseThemePropsand call the function with a string that has the same value asuseThemeProps({ props: inProps, name: <string> })in the component implementation. Take a look at the Alert PR for example. -
Ensure that the
Component.propTypesis followed by/* remove-proptypes */directive. -
Check the component before attaching properties, e.g. in Divider:
// packages/mui-material/src/Divider/Divider.js:222 - Divider.muiSkipListHighlight = true; + if (Divider) { + Divider.muiSkipListHighlight = true; + }
-
Update styles implementation, see Converting styles below
Converting styles
Most of the time, you will have to convert styles interpolation to variants.
Move ownerState from the root style argument callback to variants
Before:
const AccordionRoot = styled(Paper, {
…
})({ theme, ownerState }) => ({
...(!ownerState.square && {
borderRadius: 0,
'&:first-of-type': {
borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
},
'&:last-of-type': {
borderBottomLeftRadius: (theme.vars || theme).shape.borderRadius,
borderBottomRightRadius: (theme.vars || theme).shape.borderRadius,
// Fix a rendering issue on Edge
'@supports (-ms-ime-align: auto)': {
borderBottomLeftRadius: 0,
borderBottomRightRadius: 0,
},
},
}),
...(!ownerState.disableGutters && {
[`&.${accordionClasses.expanded}`]: {
margin: '16px 0',
},
}),
})After:
const AccordionRoot = styled(Paper, {
…
})({ theme }) => ({ // there must be NO `ownerState` here.
variants: [
{
props: { square: false },
style: {
borderRadius: 0,
'&:first-of-type': {
borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
},
'&:last-of-type': {
borderBottomLeftRadius: (theme.vars || theme).shape.borderRadius,
borderBottomRightRadius: (theme.vars || theme).shape.borderRadius,
// Fix a rendering issue on Edge
'@supports (-ms-ime-align: auto)': {
borderBottomLeftRadius: 0,
borderBottomRightRadius: 0,
},
},
},
},
{
props: { disableGutters: false },
style: {
[`&.${accordionClasses.expanded}`]: {
margin: '16px 0',
}
}
}
]
})Use Object.entries(theme.palette) to populate colors
Before:
({ theme, ownerState }) => {
return {
...theme.typography.body2,
backgroundColor: 'transparent',
display: 'flex',
padding: '6px 16px',
...(ownerState.color &&
ownerState.variant === 'standard' && {
color: theme.vars
? theme.vars.palette.Alert[`${color}Color`]
: getColor(theme.palette[color].light, 0.6),
backgroundColor: theme.vars
? theme.vars.palette.Alert[`${color}StandardBg`]
: getBackgroundColor(theme.palette[color].light, 0.9),
[`& .${alertClasses.icon}`]: theme.vars
? { color: theme.vars.palette.Alert[`${color}IconColor`] }
: {
color: theme.palette[color].main,
},
}),
}After:
({ theme }) => {
return {
...theme.typography.body2,
backgroundColor: 'transparent',
display: 'flex',
padding: '6px 16px',
variants: [
...Object.entries(theme.palette)
.filter(([, value]) => value.main && value.light) // check all the used fields in the style below
.map(([color]) => ({
props: { colorSeverity: color, variant: 'standard' },
style: {
color: theme.vars
? theme.vars.palette.Alert[`${color}Color`]
: getColor(theme.palette[color].light, 0.6),
backgroundColor: theme.vars
? theme.vars.palette.Alert[`${color}StandardBg`]
: getBackgroundColor(theme.palette[color].light, 0.9),
[`& .${alertClasses.icon}`]: theme.vars
? { color: theme.vars.palette.Alert[`${color}IconColor`] }
: {
color: theme.palette[color].main,
},
},
})),
]
}Render demos
pnpm installonce- Run the script using
node scripts/pigmentcss-render-mui-demos.mjs react-alert(replacereact-alertwith the component you are working on; thereact-*must be one of https://mui.com/material-ui/* - Update the component and build all packages once with
pnpm build. (If you update the component again, you only need to build mui-material package withpnpm --filter @mui/material run build) cd apps/pigment-css-next-app && pnpm dev- Open
localhost:3000/material-ui/react-<component>to check the result - Attach the screenshot or recording to the PR.
- If you encounter any errors, please attach a screenshot of the error in the PR comment. (Feel free to open the PR even if you got an error)
Open a PR
- using a title
[material-ui][<Component>] Convert to support CSS extraction - Tag @siriwatknp to review
- The argos CI should be green (this ensures that it still works with emotion/styled-components)
Ready-to-take Components
- Accordion [Accordion] Convert to support CSS extraction #41221
- AccordionActions
- AccordionDetails
- AccordionSummary
- Alert [material-ui][Alert] Convert to support zero runtime #41230
- AlertTitle
- AppBar [AppBar] Convert to support CSS extraction #41247
- Autocomplete [Autocomplete] Convert to support CSS extraction #40330
- Avatar [Avatar] Use variants api #40324
- AvatarGroup [material-ui][AvatarGroup] Convert to support CSS extraction #41485
- Backdrop [material-ui][Backdrop] Convert to support CSS extraction #41581
- Badge [Badge] Use the variants API in the styled call #40213
- render demos [pigment-css][material-ui] Render badge demos #41353
- BottomNavigation [material-ui][BottomNavigation] Convert to support CSS extraction #41612
- BottomNavigationAction
- Breadcrumbs (assigned to @aacevski) [material-ui][Breadcrumbs] Convert to support CSS extraction #41496
- Button (assigned to @siriwatknp) [material-ui][Button] Convert to support CSS extraction #41378
- ButtonBase
- TouchRipple
- ButtonGroup (assigned to @zanivan) [material-ui][ButtonGroup] Convert to support CSS extraction #41666
- Card (assigned to @aacevski) [material-ui][Card] Convert to support CSS extraction #41580
- CardActionArea
- CardActions
- CardContent
- CardHeader
- CardMedia
- Checkbox (assigned to @lhilgert9) [material-ui][Checkbox] Convert to support CSS extraction #41957
- Chip (assigned to @DiegoAndai) [material-ui][Chip] Convert to support CSS extraction #41592
- CircularProgress (assigned to @siriwatknp) [material-ui] Convert
CircularProgressto support Pigment CSS #41776 - Divider [material-ui][Divider] Convert to support CSS extraction #41366
- Fab [material-ui][FloatingActionButton] Convert to support CSS extraction #41851
- FormControl [material-ui][FormControl] Convert to support CSS extraction #41613
- FormControlLabel
- FormGroup [material-ui][FormGroup] Convert to support CSS extraction #41614
- IconButton [material-ui][IconButton] Convert to support CSS extraction #41850
- MobileStepper [material-ui][MobileStepper] Convert to support CSS extraction #41533
- Modal [material-ui][Modal] Support CSS extraction #41483
- PaginationItem [material-ui][PaginationItem] Convert to support CSS extraction #41848
- Radio [material-ui][Radio] Convert to support CSS extraction #41840
- Stepper [material-ui][Stepper] Convert to support CSS extraction #41546
- StepButton
- StepConnector
- StepContent
- StepIcon
- StepLabel
- Step
- SvgIcon [material-ui][SvgIcon] Convert to support CSS extraction #41779 (@aarongarciah, has
.muiNameattached) - Switch [material-ui][Switch] Convert to support CSS extraction #41367 (@alexfauquette)
- ToggleButton (assigned to @lhilgert9) [material-ui][ToggleButton] Convert to support CSS extraction #41782
- ToggleButtonGroup
Will be done by a Codemod
- FormHelperText [material-ui] Support CSS Extraction using codemod #41935
- ImageList [material-ui] Support CSS Extraction using codemod #41935
- ImageListItem
- ImageListItemBar
- ListItem [material-ui] Support CSS Extraction using codemod #41935
- ListItemAvatar
- ListItemButton
- ListItemIcon
- ListItemSecondaryAction
- ListItemText
- ListSubheader
- Rating [material-ui] Support CSS Extraction using codemod #41935
- Table [material-ui] Support CSS Extraction using codemod #41935
- TableBody
- TableCell
- TableContainer
- TableFooter
- TableHead
- TablePagination
- TableRow
- TableSortLabel
- Toolbar [material-ui] Support CSS Extraction using codemod #41935
- Icon (has
.muiNameattached) - Dialog (contains
useTheme())- DialogActions
- DialogContent
- DialogContentText
- DialogTitle
- Drawer (contains RTL logic)
- Input (has
.muiNameattached)- InputAdornment
- InputBase << needs GlobalStyles
- FilledInput (has
.muiNameattached) [material-ui][FilledInput] Convert to support CSS extraction #41663 @mj12albert - OutlinedInput (has
.muiNameattached) - TextField
- TablePagination
- FilledInput (has
- InputLabel
- Menu (contains
useTheme())- MenuItem
- MenuList
- LinearProgress (wait for POC from CircularProgress) [material-ui] Convert
LinearProgressto support Pigment CSS #41816 - Paper - uses
useTheme - Skeleton (wait for POC from CircularProgress)
- Snackbar (contains
useTheme())- SnackbarContent
- SpeedDial (contains
useTheme())- SpeedDialAction
- SpeedDialIcon
- Tabs (contains RTL logic)
- TabScrollButton
- Tab
- Tooltip (contains RTL logic)
Waiting for 👍
- Link
- Need solution for
extendSxProp
- Need solution for
- Typography
- Need solution for
extendSxProp
- Need solution for
Box- SwipeableDrawer
Metadata
Metadata
Assignees
Labels
Projects
Status