material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[wip][system] Try reordering the presedence of variants over base styles

Open mnajdova opened this issue 1 year ago • 1 comments

We discussed internally how the precedence of overrides should work with the new variants API (the discussion started around the Pigment CSS product, see more info here).

From the initial investigation, it is possible for us to dictate how the order of the base styles/variants are handled along one instance of component, styled(), styleOverrides, variants, however, I didn't find a way how to augment the order of how they are added across components, for example using styled(Button). Check the tests for more details (I skipped the one that is not working).

Considering it is not possible to do it consistently between theme vs styled() overrides, I would lean toward not implementing any change and document this as a different behavior between Pigment CSS and MUI System and add instructions around best practices of how the overrides should be written so that people know how to not get into this kind of differences in behavior.

mnajdova avatar May 17 '24 11:05 mnajdova

Netlify deploy preview

https://deploy-preview-42276--material-ui.netlify.app/

packages/material-ui/material-ui.production.min.js: parsed: +0.17% , gzip: +0.09% @material-ui/lab: parsed: +0.31% , gzip: +0.18% @material-ui/system: parsed: +1.09% , gzip: +0.48% @mui/joy/Container: parsed: +1.36% , gzip: +0.62% TextField: parsed: +0.60% , gzip: +0.29% SpeedDialAction: parsed: +0.72% , gzip: +0.31% ToggleButtonGroup: parsed: +1.51% , gzip: +0.59% @mui/joy: parsed: +0.18% , gzip: +0.10% @mui/joy/AccordionGroup: parsed: +1.23% , gzip: +0.52% ListItemButton: parsed: +1.17% , gzip: +0.46% Masonry: parsed: +1.52% , gzip: +0.57% @material-ui/core: parsed: +0.15% , gzip: +0.08% Alert: parsed: +1.02% , gzip: +0.40% ListItemText: parsed: +1.51% , gzip: +0.56% CardHeader: parsed: +1.50% , gzip: +0.56% PaginationItem: parsed: +1.04% , gzip: +0.41% @mui/joy/Switch: parsed: +1.18% , gzip: +0.48% IconButton: parsed: +1.19% , gzip: +0.45% Unstable_Grid2: parsed: +1.46% , gzip: +0.54% Chip: parsed: +1.05% , gzip: +0.41% and 178 more changes

Bundle size report

Details of bundle changes (Toolpad) Details of bundle changes

Generated by :no_entry_sign: dangerJS against c562855a45fa9325a364bdb6c3f8db4c836a16dd

mui-bot avatar May 17 '24 11:05 mui-bot