[material-ui] Add DefaultPropsProvider for Pigment CSS integration#42638
[material-ui] Add DefaultPropsProvider for Pigment CSS integration#42638siriwatknp merged 24 commits intomui:nextfrom
DefaultPropsProvider for Pigment CSS integration#42638Conversation
PropsProvider for Pigment CSSPropsProvider for Pigment CSS integration
Netlify deploy previewhttps://deploy-preview-42638--material-ui.netlify.app/ DefaultPropsProvider: parsed: +Infinity% , gzip: +Infinity% Bundle size reportDetails of bundle changes (Toolpad) |
9e6f101 to
4b89434
Compare
mnajdova
left a comment
There was a problem hiding this comment.
We have a bit of misalignment in the names:
PropsProvidervsuseDefaultProps- we should either haveDefaultPropsProvideranduseDefaultProps, orPropsProvideranduseProps
I like that the API is identical as before, but in ideal scenario this API in my opinion should be:
<DefaultPropsProvider
value={{
MuiButton: { disableRipple: true }, // note that I removed the defaultProps key
}}
>
I would prefer this API ☝️
PropsProvider for Pigment CSS integrationDefaultPropsProvider for Pigment CSS integration
Changed to |
| .MuiTab-root .MuiTab-icon { | ||
| color: red; | ||
| } | ||
|
|
There was a problem hiding this comment.
This is not related to this PR. I have no idea how this passed the check before merging to next.
| } | ||
|
|
||
| if (!config.styleOverrides && !config.variants) { | ||
| // v6 signature, no property 'defaultProps' |
There was a problem hiding this comment.
Good call for adding both APIs 👌
mnajdova
left a comment
There was a problem hiding this comment.
Nice work, let's merge this before the beta 🎉 This was the last missing part for interoperability, right?
No. There are 2 more, left over components and Pigment layout components (need decision on mui/pigment-css#144 (comment)) |
| import PropTypes from 'prop-types'; | ||
| import resolveProps from '@mui/utils/resolveProps'; | ||
|
|
||
| const PropsContext = React.createContext<Record<string, any> | undefined>(undefined); |
There was a problem hiding this comment.
We are missing the codebase guideline for React context here:
| const PropsContext = React.createContext<Record<string, any> | undefined>(undefined); | |
| const PropsContext = React.createContext<Record<string, any> | undefined>(undefined); | |
| if (process.env.NODE_ENV !== 'production') { | |
| PropsContext.displayName = 'DefaultProps'; |
It's for the dev tools.
There was a problem hiding this comment.
Also, the name of the variable looks inaccurate:
| const PropsContext = React.createContext<Record<string, any> | undefined>(undefined); | |
| const DefaultPropsContext = React.createContext<Record<string, any> | undefined>(undefined); |
closes #42635
The gist is https://github.com/mui/material-ui/pull/42638/files#diff-532de7437125015b5ab87338e5e5950bc513e99fc7d987838a0f3755ee01408b, the rests are replacing
createUseThemePropswithuseDefaultProps.The signature changes but still support v5:
Testing
Only the spec is added because the logic is already tested by
describeConformancefrom all the components.