@mui/system 5.14.11 → 5.14.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/Box/Box.d.ts +12 -0
  2. package/Box/Box.js +1 -2
  3. package/CHANGELOG.md +147 -0
  4. package/Container/Container.js +1 -2
  5. package/Container/containerClasses.js +1 -2
  6. package/GlobalStyles/GlobalStyles.js +1 -2
  7. package/Stack/Stack.js +1 -2
  8. package/Stack/stackClasses.js +1 -2
  9. package/ThemeProvider/ThemeProvider.js +1 -2
  10. package/Unstable_Grid/Grid.js +1 -2
  11. package/Unstable_Grid/gridClasses.js +1 -2
  12. package/borders.js +11 -22
  13. package/breakpoints.js +3 -4
  14. package/compose.js +1 -2
  15. package/createStyled.js +100 -37
  16. package/createTheme/createBreakpoints.js +1 -2
  17. package/createTheme/createTheme.js +1 -2
  18. package/createTheme/shape.js +1 -2
  19. package/cssGrid.js +10 -20
  20. package/cssVars/createCssVarsProvider.js +1 -2
  21. package/cssVars/createCssVarsTheme.js +1 -2
  22. package/cssVars/getInitColorSchemeScript.js +3 -6
  23. package/cssVars/prepareCssVars.js +1 -2
  24. package/display.js +7 -14
  25. package/esm/createStyled.js +100 -36
  26. package/esm/style.js +5 -0
  27. package/flexbox.js +14 -28
  28. package/getThemeValue.js +3 -6
  29. package/index.js +1 -1
  30. package/legacy/createStyled.js +106 -41
  31. package/legacy/index.js +1 -1
  32. package/legacy/style.js +6 -0
  33. package/merge.js +1 -2
  34. package/modern/createStyled.js +99 -35
  35. package/modern/index.js +1 -1
  36. package/modern/style.js +5 -0
  37. package/package.json +6 -6
  38. package/palette.js +4 -8
  39. package/positions.js +7 -14
  40. package/responsivePropType.js +1 -2
  41. package/shadows.js +1 -2
  42. package/sizing.js +9 -18
  43. package/spacing.js +3 -6
  44. package/style.js +6 -2
  45. package/styleFunctionSx/defaultSxConfig.js +1 -2
  46. package/styleFunctionSx/styleFunctionSx.js +1 -2
  47. package/styled.js +1 -2
  48. package/typography.js +10 -20
  49. package/useTheme.js +2 -4
  50. package/useThemeWithoutDefault.js +1 -2
package/Box/Box.d.ts CHANGED
@@ -105,6 +105,12 @@ export declare const spacing: SimpleStyleFunction<
105
105
  | 'marginLeft'
106
106
  | 'marginX'
107
107
  | 'marginY'
108
+ | 'marginInline'
109
+ | 'marginInlineStart'
110
+ | 'marginInlineEnd'
111
+ | 'marginBlock'
112
+ | 'marginBlockStart'
113
+ | 'marginBlockEnd'
108
114
  | 'padding'
109
115
  | 'paddingTop'
110
116
  | 'paddingRight'
@@ -112,6 +118,12 @@ export declare const spacing: SimpleStyleFunction<
112
118
  | 'paddingLeft'
113
119
  | 'paddingX'
114
120
  | 'paddingY'
121
+ | 'paddingInline'
122
+ | 'paddingInlineStart'
123
+ | 'paddingInlineEnd'
124
+ | 'paddingBlock'
125
+ | 'paddingBlockStart'
126
+ | 'paddingBlockEnd'
115
127
  >;
116
128
 
117
129
  export declare const typography: SimpleStyleFunction<
package/Box/Box.js CHANGED
@@ -28,5 +28,4 @@ process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
28
28
  */
29
29
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
30
30
  } : void 0;
31
- var _default = Box;
32
- exports.default = _default;
31
+ var _default = exports.default = Box;
package/CHANGELOG.md CHANGED
@@ -1,5 +1,152 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.14.13
4
+
5
+ <!-- generated comparing v5.14.12..master -->
6
+
7
+ _Oct 10, 2023_
8
+
9
+ A big thanks to the 22 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🚀 Added support for `styled-components` v6 (#39042) @mnajdova
12
+
13
+ ### `@mui/material@5.14.13`
14
+
15
+ - [Checkbox] Fix checkbox hover bg with extendTheme (#39319) @brijeshb42
16
+ - [Chip] Outlined Chip variant is wider than the Filled counterpart (#39342) @chirag3003
17
+ - [Select] Add notice about select's a11y improvement on v5.14.12 changelog (#39310) @DiegoAndai
18
+ - [Typography] Color prop check for primitive type (#39071) @DarhkVoyd
19
+ - [Pagination] Fix background color on hover and keyboard focus when using CSS theme variables (#39220) @ValkonX33
20
+ - [Popper] Add missing `styleOverrides` Popper type in theme (#39154) @axelbostrom
21
+ - [Slider] Support all default palette colors in TypeScript (#39058) @gugudwt
22
+
23
+ ### `@mui/base@5.0.0-beta.19`
24
+
25
+ - [Menu] Add the anchor prop (#39297) @michaldudak
26
+
27
+ ### `@mui/material-next@6.0.0-alpha.105`
28
+
29
+ - [Menu] Copy v5 Menu components (#39301) @mnajdova
30
+
31
+ ### `@mui/joy@5.0.0-beta.10`
32
+
33
+ - [Autocomplete] Add `type=button` to clear button (#39263) @brijeshb42
34
+ - [Button] Fix the text wrap issue (#38696) @atharva3333
35
+ - [Drawer] Apply color inversion to content slot instead (#39312) @siriwatknp
36
+ - [Switch] Fix missing class name (#39327) @Bestwebdesign
37
+
38
+ ### `@mui/styled-engine-sc@6.0.0-alpha.1`
39
+
40
+ - &#8203;<!-- 03 -->[system] Add support for `styled-components` v6 (#39042) @mnajdova
41
+
42
+ ### Docs
43
+
44
+ - [joy-ui] Adjust the templates page card design (#39369) @danilo-leal
45
+ - Rename the Data Grid "Quick filter" to "Search" (#37724) @alexfauquette
46
+ - Remove obsolete translations (#39221) @mbrookes
47
+ - Update link to add custom color in palette (#39359) @ZeeshanTamboli
48
+ - Denser code demo @oliviertassinari
49
+ - Set up MD3 experiments pages (#39323) @mj12albert
50
+ - [Drawer] Fix right anchored persistent drawer intercepts click when it is closed (#39318) @ZeeshanTamboli
51
+ - [joy-ui] Revise the Color Inversion page (#39306) @danilo-leal
52
+ - [joy-ui] Remove redundant `error` prop from input validation demo (#39280) @sai6855
53
+ - [material-ui] Rename themed components doc, fix typos (#39368) @samuelsycamore
54
+ - [material-ui] Adjust the Material You Chip section (#39325) @danilo-leal
55
+ - [system] Add documentation on how to augment custom theme types for the `sx` prop callback (#39259) @3xp10it3r
56
+ - [joy-ui][Input] Add debounce input demo (#39300) @sai6855
57
+
58
+ ### Core
59
+
60
+ - [docs-infra] Improve the open diamond sponsor spot callout (#39332) @danilo-leal
61
+ - [docs-infra] Fix Code Sandbox download issue (#39317) @ARJ2160
62
+ - [docs-infra] Remove overflow: hidden for demo gradient bg (#39225) @oliviertassinari
63
+ - [website] Fix footer responsiveness (#39355) @danilo-leal
64
+ - [website] Host Figma redirections in the store for now @oliviertassinari
65
+
66
+ All contributors of this release in alphabetical order: @3xp10it3r, @alexfauquette, @ARJ2160, @atharva3333, @axelbostrom, @Bestwebdesign, @brijeshb42, @chirag3003, @danilo-leal, @DarhkVoyd, @DiegoAndai, @gugudwt, @mbrookes, @michaldudak, @mj12albert, @mnajdova, @oliviertassinari, @sai6855, @samuelsycamore, @siriwatknp, @ValkonX33, @ZeeshanTamboli
67
+
68
+ ## 5.14.12
69
+
70
+ <!-- generated comparing v5.14.11..master -->
71
+
72
+ _Oct 3, 2023_
73
+
74
+ A big thanks to the 17 contributors who made this release possible. Here are some highlights ✨:
75
+
76
+ - 🎨 Introduced color inversion utilities to Joy UI (#38916) @siriwatknp
77
+ - 🚀 Added Chip and related TextField components to Material You @DiegoAndai, @mj12albert
78
+ - 🏗️ Improve the Select's component a11y by adding the combobox role and aria-controls attribute (#38785) @xulingzhihou. If your tests require selecting the trigger element by the "button" role, then you'll have to change it to use the "combobox" role instead
79
+
80
+ ### `@mui/material@5.14.12`
81
+
82
+ - [DialogActions] Apply margin-left when children is not of `button` type (#39189) @sai6855
83
+ - [Select] Improve a11y by adding combobox role and aria-controls attribute (#38785) @xulingzhihou
84
+ - [Select] Fix MenuProps slotProps forwarding (#39177) @DiegoAndai
85
+ - [TextField] Polish types in Textfield demo (#39140) @sai6855
86
+ - [ButtonGroup] Fix rendering with conditional elements (#38989) @ZeeshanTamboli
87
+
88
+ ### `@mui/system@5.14.12`
89
+
90
+ - [system] Add support for `variants` in the styled() util (#39073) @mnajdova
91
+ - [Box] Add missing logical spacing property types (#39169) @Semigradsky
92
+
93
+ ### `@mui/base@5.0.0-beta.18`
94
+
95
+ - [useSlider] Align externalProps handling (#38854) @mj12albert
96
+ - [useTabs] Align external props handling for useTab/useTabPanel/useTabsList (#39037) @mj12albert
97
+ - [test] Fix import paths in useTab tests (#39291) @mj12albert
98
+
99
+ ### `@mui/material-next@6.0.0-alpha.104`
100
+
101
+ - [Chip] Add Material You Chip component (#38927) @DiegoAndai
102
+ - [Divider] Copy v5 Divider (#39197) @mj12albert
103
+ - [FilledInput] Copy v5 FilledInput (#39040) @mj12albert
104
+ - [FormControl] Add FormControl component (#39032) @mj12albert
105
+ - [Select] Copy Select files from v5 (#39188) @DiegoAndai
106
+ - [TextField] Copy v5 TextField's inner components (#39166) @mj12albert
107
+
108
+ ### `@mui/joy@5.0.0-beta.9`
109
+
110
+ - Introduce color inversion utilities (#38916) @siriwatknp
111
+ - Replace margin with `gap` property (#39147) @siriwatknp
112
+ - [CssBaseline] use Joy `GlobalStyles` (#39278) @siriwatknp
113
+ - [Drawer] Apply content styles from theme to content slot (#39199) @sai6855
114
+ - [List] Add gap and missing active styles (#39146) @siriwatknp
115
+ - [Switch] Slight adjustments to the design (#39276) @danilo-leal
116
+
117
+ ### Docs
118
+
119
+ - [docs] Update Autocomplete demo for React 18 (#39162) @oliviertassinari
120
+ - [docs-infra] Tweak feedback footer section design (#36556) @danilo-leal
121
+ - [docs-infra] Improve code syntax highlight (#39181) @oliviertassinari
122
+ - [docs][base] Add Tailwind CSS + plain CSS demo on the TextArea page (#39046) @alisasanib
123
+ - [docs][base-ui] Fix style for root div of multiline input (#39182) @ttlpta
124
+ - [docs][base-ui] Improve Select's country select demo (#38983) @oliviertassinari
125
+ - [docs][joy-ui] Add scrollable tabs example (#39260) @siriwatknp
126
+ - [docs][joy-ui] Match `Autocomplete` github label demo to actual github label dropdown (#39228) @sai6855
127
+ - [docs][joy-ui] Refine the Rental dashboard template (#39059) @zanivan
128
+ - [docs][joy-ui] Removed incomplete sentence in the Aspect Ratio page (#39227) @Erik-McKelvey
129
+ - [docs][joy-ui] Fix typo in the Accordion page (#39226) @Erik-McKelvey
130
+ - [docs][joy-ui] Update and standardize template Sidemenus (#39271) @zanivan
131
+ - [docs][joy-ui] Add a roadmap page (#39163) @danilo-leal
132
+ - [docs][material-ui] Replace `Box` with `Stack` in applicable demos (#39174) @sai6855
133
+ - [docs][material-ui] Add small polish to the Templates page (#39224) @danilo-leal
134
+ - [docs][material-ui] Small revision to the Icons page (#38840) @danilo-leal
135
+
136
+ ### Core
137
+
138
+ - Add next lint config to eslint (#39183) @Janpot
139
+ - [core] Update eslint rules (#39178) @romgrk
140
+ - [core] Fix Greg GitHub slug @oliviertassinari
141
+ - [core] Priority Support casing normalization @oliviertassinari
142
+ - [website] Add Heat map in pricing page (#39269) @oliviertassinari
143
+ - [website] Update `React Engineer - xCharts` Ashby link (#39172) @DanailH
144
+ - [website] Add Charts to the pricing table (#38680) @alexfauquette
145
+ - [website] Polish career experience @oliviertassinari
146
+ - [website] Simplify the Core products file (#39194) @danilo-leal
147
+
148
+ All contributors of this release in alphabetical order: @alexfauquette, @brijeshb42, @DanailH, @danilo-leal, @DiegoAndai, @Erik-McKelvey, @Janpot, @mj12albert, @mnajdova, @oliviertassinari, @romgrk, @sai6855, @Semigradsky, @siriwatknp, @xulingzhihou, @zanivan, @ZeeshanTamboli
149
+
3
150
  ## 5.14.11
4
151
 
5
152
  <!-- generated comparing v5.14.10..master -->
@@ -63,5 +63,4 @@ process.env.NODE_ENV !== "production" ? Container.propTypes /* remove-proptypes
63
63
  */
64
64
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
65
65
  } : void 0;
66
- var _default = Container;
67
- exports.default = _default;
66
+ var _default = exports.default = Container;
@@ -10,5 +10,4 @@ function getContainerUtilityClass(slot) {
10
10
  return (0, _utils.unstable_generateUtilityClass)('MuiContainer', slot);
11
11
  }
12
12
  const containerClasses = (0, _utils.unstable_generateUtilityClasses)('MuiContainer', ['root', 'disableGutters', 'fixed', 'maxWidthXs', 'maxWidthSm', 'maxWidthMd', 'maxWidthLg', 'maxWidthXl']);
13
- var _default = containerClasses;
14
- exports.default = _default;
13
+ var _default = exports.default = containerClasses;
@@ -42,5 +42,4 @@ process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes /* remove-proptyp
42
42
  */
43
43
  themeId: _propTypes.default.string
44
44
  } : void 0;
45
- var _default = GlobalStyles;
46
- exports.default = _default;
45
+ var _default = exports.default = GlobalStyles;
package/Stack/Stack.js CHANGED
@@ -65,5 +65,4 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
65
65
  */
66
66
  useFlexGap: _propTypes.default.bool
67
67
  } : void 0;
68
- var _default = Stack;
69
- exports.default = _default;
68
+ var _default = exports.default = Stack;
@@ -10,5 +10,4 @@ function getStackUtilityClass(slot) {
10
10
  return (0, _utils.unstable_generateUtilityClass)('MuiStack', slot);
11
11
  }
12
12
  const stackClasses = (0, _utils.unstable_generateUtilityClasses)('MuiStack', ['root']);
13
- var _default = stackClasses;
14
- exports.default = _default;
13
+ var _default = exports.default = stackClasses;
@@ -89,5 +89,4 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes /* remove-propty
89
89
  if (process.env.NODE_ENV !== 'production') {
90
90
  process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = (0, _utils.exactProp)(ThemeProvider.propTypes) : void 0;
91
91
  }
92
- var _default = ThemeProvider;
93
- exports.default = _default;
92
+ var _default = exports.default = ThemeProvider;
@@ -179,5 +179,4 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
179
179
  */
180
180
  xsOffset: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number])
181
181
  } : void 0;
182
- var _default = Grid;
183
- exports.default = _default;
182
+ var _default = exports.default = Grid;
@@ -22,5 +22,4 @@ const gridClasses = (0, _utils.unstable_generateUtilityClasses)('MuiGrid', ['roo
22
22
  ...WRAPS.map(wrap => `wrap-xs-${wrap}`),
23
23
  // grid sizes for all breakpoints
24
24
  ...GRID_SIZES.map(size => `grid-xs-${size}`), ...GRID_SIZES.map(size => `grid-sm-${size}`), ...GRID_SIZES.map(size => `grid-md-${size}`), ...GRID_SIZES.map(size => `grid-lg-${size}`), ...GRID_SIZES.map(size => `grid-xl-${size}`)]);
25
- var _default = gridClasses;
26
- exports.default = _default;
25
+ var _default = exports.default = gridClasses;
package/borders.js CHANGED
@@ -18,64 +18,54 @@ function borderTransform(value) {
18
18
  }
19
19
  return `${value}px solid`;
20
20
  }
21
- const border = (0, _style.default)({
21
+ const border = exports.border = (0, _style.default)({
22
22
  prop: 'border',
23
23
  themeKey: 'borders',
24
24
  transform: borderTransform
25
25
  });
26
- exports.border = border;
27
- const borderTop = (0, _style.default)({
26
+ const borderTop = exports.borderTop = (0, _style.default)({
28
27
  prop: 'borderTop',
29
28
  themeKey: 'borders',
30
29
  transform: borderTransform
31
30
  });
32
- exports.borderTop = borderTop;
33
- const borderRight = (0, _style.default)({
31
+ const borderRight = exports.borderRight = (0, _style.default)({
34
32
  prop: 'borderRight',
35
33
  themeKey: 'borders',
36
34
  transform: borderTransform
37
35
  });
38
- exports.borderRight = borderRight;
39
- const borderBottom = (0, _style.default)({
36
+ const borderBottom = exports.borderBottom = (0, _style.default)({
40
37
  prop: 'borderBottom',
41
38
  themeKey: 'borders',
42
39
  transform: borderTransform
43
40
  });
44
- exports.borderBottom = borderBottom;
45
- const borderLeft = (0, _style.default)({
41
+ const borderLeft = exports.borderLeft = (0, _style.default)({
46
42
  prop: 'borderLeft',
47
43
  themeKey: 'borders',
48
44
  transform: borderTransform
49
45
  });
50
- exports.borderLeft = borderLeft;
51
- const borderColor = (0, _style.default)({
46
+ const borderColor = exports.borderColor = (0, _style.default)({
52
47
  prop: 'borderColor',
53
48
  themeKey: 'palette'
54
49
  });
55
- exports.borderColor = borderColor;
56
- const borderTopColor = (0, _style.default)({
50
+ const borderTopColor = exports.borderTopColor = (0, _style.default)({
57
51
  prop: 'borderTopColor',
58
52
  themeKey: 'palette'
59
53
  });
60
- exports.borderTopColor = borderTopColor;
61
- const borderRightColor = (0, _style.default)({
54
+ const borderRightColor = exports.borderRightColor = (0, _style.default)({
62
55
  prop: 'borderRightColor',
63
56
  themeKey: 'palette'
64
57
  });
65
- exports.borderRightColor = borderRightColor;
66
- const borderBottomColor = (0, _style.default)({
58
+ const borderBottomColor = exports.borderBottomColor = (0, _style.default)({
67
59
  prop: 'borderBottomColor',
68
60
  themeKey: 'palette'
69
61
  });
70
- exports.borderBottomColor = borderBottomColor;
71
- const borderLeftColor = (0, _style.default)({
62
+ const borderLeftColor = exports.borderLeftColor = (0, _style.default)({
72
63
  prop: 'borderLeftColor',
73
64
  themeKey: 'palette'
74
65
  });
75
66
 
76
67
  // false positive
77
68
  // eslint-disable-next-line react/function-component-definition
78
- exports.borderLeftColor = borderLeftColor;
79
69
  const borderRadius = props => {
80
70
  if (props.borderRadius !== undefined && props.borderRadius !== null) {
81
71
  const transformer = (0, _spacing.createUnaryUnit)(props.theme, 'shape.borderRadius', 4, 'borderRadius');
@@ -92,5 +82,4 @@ borderRadius.propTypes = process.env.NODE_ENV !== 'production' ? {
92
82
  } : {};
93
83
  borderRadius.filterProps = ['borderRadius'];
94
84
  const borders = (0, _compose.default)(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius);
95
- var _default = borders;
96
- exports.default = _default;
85
+ var _default = exports.default = borders;
package/breakpoints.js CHANGED
@@ -18,7 +18,7 @@ var _utils = require("@mui/utils");
18
18
  var _merge = _interopRequireDefault(require("./merge"));
19
19
  // The breakpoint **start** at this value.
20
20
  // For instance with the first breakpoint xs: [xs, sm[.
21
- const values = {
21
+ const values = exports.values = {
22
22
  xs: 0,
23
23
  // phone
24
24
  sm: 600,
@@ -29,7 +29,7 @@ const values = {
29
29
  // desktop
30
30
  xl: 1536 // large screen
31
31
  };
32
- exports.values = values;
32
+
33
33
  const defaultBreakpoints = {
34
34
  // Sorted ASC by size. That's important.
35
35
  // It can't be configured as it's used statically for propTypes.
@@ -164,5 +164,4 @@ function resolveBreakpointValues({
164
164
  return acc;
165
165
  }, {});
166
166
  }
167
- var _default = breakpoints;
168
- exports.default = _default;
167
+ var _default = exports.default = breakpoints;
package/compose.js CHANGED
@@ -28,5 +28,4 @@ function compose(...styles) {
28
28
  fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []);
29
29
  return fn;
30
30
  }
31
- var _default = compose;
32
- exports.default = _default;
31
+ var _default = exports.default = compose;
package/createStyled.js CHANGED
@@ -36,47 +36,54 @@ const getStyleOverrides = (name, theme) => {
36
36
  }
37
37
  return null;
38
38
  };
39
+ const transformVariants = variants => {
40
+ const variantsStyles = {};
41
+ if (variants) {
42
+ variants.forEach(definition => {
43
+ const key = (0, _propsToClassKey.default)(definition.props);
44
+ variantsStyles[key] = definition.style;
45
+ });
46
+ }
47
+ return variantsStyles;
48
+ };
39
49
  const getVariantStyles = (name, theme) => {
40
50
  let variants = [];
41
51
  if (theme && theme.components && theme.components[name] && theme.components[name].variants) {
42
52
  variants = theme.components[name].variants;
43
53
  }
44
- const variantsStyles = {};
45
- variants.forEach(definition => {
46
- const key = (0, _propsToClassKey.default)(definition.props);
47
- variantsStyles[key] = definition.style;
48
- });
49
- return variantsStyles;
54
+ return transformVariants(variants);
50
55
  };
51
- const variantsResolver = (props, styles, theme, name) => {
52
- var _theme$components;
56
+ const variantsResolver = (props, styles, variants) => {
53
57
  const {
54
58
  ownerState = {}
55
59
  } = props;
56
60
  const variantsStyles = [];
57
- const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
58
- if (themeVariants) {
59
- themeVariants.forEach(themeVariant => {
61
+ if (variants) {
62
+ variants.forEach(variant => {
60
63
  let isMatch = true;
61
- Object.keys(themeVariant.props).forEach(key => {
62
- if (ownerState[key] !== themeVariant.props[key] && props[key] !== themeVariant.props[key]) {
64
+ Object.keys(variant.props).forEach(key => {
65
+ if (ownerState[key] !== variant.props[key] && props[key] !== variant.props[key]) {
63
66
  isMatch = false;
64
67
  }
65
68
  });
66
69
  if (isMatch) {
67
- variantsStyles.push(styles[(0, _propsToClassKey.default)(themeVariant.props)]);
70
+ variantsStyles.push(styles[(0, _propsToClassKey.default)(variant.props)]);
68
71
  }
69
72
  });
70
73
  }
71
74
  return variantsStyles;
72
75
  };
76
+ const themeVariantsResolver = (props, styles, theme, name) => {
77
+ var _theme$components;
78
+ const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
79
+ return variantsResolver(props, styles, themeVariants);
80
+ };
73
81
 
74
82
  // Update /system/styled/#api in case if this changes
75
83
  function shouldForwardProp(prop) {
76
84
  return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
77
85
  }
78
- const systemDefaultTheme = (0, _createTheme.default)();
79
- exports.systemDefaultTheme = systemDefaultTheme;
86
+ const systemDefaultTheme = exports.systemDefaultTheme = (0, _createTheme.default)();
80
87
  const lowercaseFirstLetter = string => {
81
88
  if (!string) {
82
89
  return string;
@@ -96,6 +103,29 @@ function defaultOverridesResolver(slot) {
96
103
  }
97
104
  return (props, styles) => styles[slot];
98
105
  }
106
+ const muiStyledFunctionResolver = ({
107
+ styledArg,
108
+ props,
109
+ defaultTheme,
110
+ themeId
111
+ }) => {
112
+ const resolvedStyles = styledArg((0, _extends2.default)({}, props, {
113
+ theme: resolveTheme((0, _extends2.default)({}, props, {
114
+ defaultTheme,
115
+ themeId
116
+ }))
117
+ }));
118
+ let optionalVariants;
119
+ if (resolvedStyles && resolvedStyles.variants) {
120
+ optionalVariants = resolvedStyles.variants;
121
+ delete resolvedStyles.variants;
122
+ }
123
+ if (optionalVariants) {
124
+ const variantsStyles = variantsResolver(props, transformVariants(optionalVariants), optionalVariants);
125
+ return [resolvedStyles, ...variantsStyles];
126
+ }
127
+ return resolvedStyles;
128
+ };
99
129
  function createStyled(input = {}) {
100
130
  const {
101
131
  themeId,
@@ -162,16 +192,61 @@ function createStyled(input = {}) {
162
192
  // On the server Emotion doesn't use React.forwardRef for creating components, so the created
163
193
  // component stays as a function. This condition makes sure that we do not interpolate functions
164
194
  // which are basically components used as a selectors.
165
- return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? props => {
166
- return stylesArg((0, _extends2.default)({}, props, {
167
- theme: resolveTheme((0, _extends2.default)({}, props, {
168
- defaultTheme,
169
- themeId
170
- }))
171
- }));
172
- } : stylesArg;
195
+ if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg) {
196
+ return props => muiStyledFunctionResolver({
197
+ styledArg: stylesArg,
198
+ props,
199
+ defaultTheme,
200
+ themeId
201
+ });
202
+ }
203
+ if ((0, _utils.isPlainObject)(stylesArg)) {
204
+ let transformedStylesArg = stylesArg;
205
+ let styledArgVariants;
206
+ if (stylesArg && stylesArg.variants) {
207
+ styledArgVariants = stylesArg.variants;
208
+ delete transformedStylesArg.variants;
209
+ transformedStylesArg = props => {
210
+ let result = stylesArg;
211
+ const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
212
+ variantStyles.forEach(variantStyle => {
213
+ result = (0, _utils.deepmerge)(result, variantStyle);
214
+ });
215
+ return result;
216
+ };
217
+ }
218
+ return transformedStylesArg;
219
+ }
220
+ return stylesArg;
173
221
  }) : [];
174
222
  let transformedStyleArg = styleArg;
223
+ if ((0, _utils.isPlainObject)(styleArg)) {
224
+ let styledArgVariants;
225
+ if (styleArg && styleArg.variants) {
226
+ styledArgVariants = styleArg.variants;
227
+ delete transformedStyleArg.variants;
228
+ transformedStyleArg = props => {
229
+ let result = styleArg;
230
+ const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
231
+ variantStyles.forEach(variantStyle => {
232
+ result = (0, _utils.deepmerge)(result, variantStyle);
233
+ });
234
+ return result;
235
+ };
236
+ }
237
+ } else if (typeof styleArg === 'function' &&
238
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
239
+ // component stays as a function. This condition makes sure that we do not interpolate functions
240
+ // which are basically components used as a selectors.
241
+ styleArg.__emotion_real !== styleArg) {
242
+ // If the type is function, we need to define the default theme.
243
+ transformedStyleArg = props => muiStyledFunctionResolver({
244
+ styledArg: styleArg,
245
+ props,
246
+ defaultTheme,
247
+ themeId
248
+ });
249
+ }
175
250
  if (componentName && overridesResolver) {
176
251
  expressionsWithDefaultTheme.push(props => {
177
252
  const theme = resolveTheme((0, _extends2.default)({}, props, {
@@ -197,7 +272,7 @@ function createStyled(input = {}) {
197
272
  defaultTheme,
198
273
  themeId
199
274
  }));
200
- return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
275
+ return themeVariantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
201
276
  });
202
277
  }
203
278
  if (!skipSx) {
@@ -209,18 +284,6 @@ function createStyled(input = {}) {
209
284
  // If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
210
285
  transformedStyleArg = [...styleArg, ...placeholders];
211
286
  transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
212
- } else if (typeof styleArg === 'function' &&
213
- // On the server Emotion doesn't use React.forwardRef for creating components, so the created
214
- // component stays as a function. This condition makes sure that we do not interpolate functions
215
- // which are basically components used as a selectors.
216
- styleArg.__emotion_real !== styleArg) {
217
- // If the type is function, we need to define the default theme.
218
- transformedStyleArg = props => styleArg((0, _extends2.default)({}, props, {
219
- theme: resolveTheme((0, _extends2.default)({}, props, {
220
- defaultTheme,
221
- themeId
222
- }))
223
- }));
224
287
  }
225
288
  const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
226
289
  if (process.env.NODE_ENV !== 'production') {
@@ -11,8 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  const _excluded = ["values", "unit", "step"];
12
12
  // Sorted ASC by size. That's important.
13
13
  // It can't be configured as it's used statically for propTypes.
14
- const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
15
- exports.breakpointKeys = breakpointKeys;
14
+ const breakpointKeys = exports.breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
16
15
  const sortBreakpointsValues = values => {
17
16
  const breakpointsAsArray = Object.keys(values).map(key => ({
18
17
  key,
@@ -45,5 +45,4 @@ function createTheme(options = {}, ...args) {
45
45
  };
46
46
  return muiTheme;
47
47
  }
48
- var _default = createTheme;
49
- exports.default = _default;
48
+ var _default = exports.default = createTheme;
@@ -7,5 +7,4 @@ exports.default = void 0;
7
7
  const shape = {
8
8
  borderRadius: 4
9
9
  };
10
- var _default = shape;
11
- exports.default = _default;
10
+ var _default = exports.default = shape;
package/cssGrid.js CHANGED
@@ -63,42 +63,32 @@ rowGap.propTypes = process.env.NODE_ENV !== 'production' ? {
63
63
  rowGap: _responsivePropType.default
64
64
  } : {};
65
65
  rowGap.filterProps = ['rowGap'];
66
- const gridColumn = (0, _style.default)({
66
+ const gridColumn = exports.gridColumn = (0, _style.default)({
67
67
  prop: 'gridColumn'
68
68
  });
69
- exports.gridColumn = gridColumn;
70
- const gridRow = (0, _style.default)({
69
+ const gridRow = exports.gridRow = (0, _style.default)({
71
70
  prop: 'gridRow'
72
71
  });
73
- exports.gridRow = gridRow;
74
- const gridAutoFlow = (0, _style.default)({
72
+ const gridAutoFlow = exports.gridAutoFlow = (0, _style.default)({
75
73
  prop: 'gridAutoFlow'
76
74
  });
77
- exports.gridAutoFlow = gridAutoFlow;
78
- const gridAutoColumns = (0, _style.default)({
75
+ const gridAutoColumns = exports.gridAutoColumns = (0, _style.default)({
79
76
  prop: 'gridAutoColumns'
80
77
  });
81
- exports.gridAutoColumns = gridAutoColumns;
82
- const gridAutoRows = (0, _style.default)({
78
+ const gridAutoRows = exports.gridAutoRows = (0, _style.default)({
83
79
  prop: 'gridAutoRows'
84
80
  });
85
- exports.gridAutoRows = gridAutoRows;
86
- const gridTemplateColumns = (0, _style.default)({
81
+ const gridTemplateColumns = exports.gridTemplateColumns = (0, _style.default)({
87
82
  prop: 'gridTemplateColumns'
88
83
  });
89
- exports.gridTemplateColumns = gridTemplateColumns;
90
- const gridTemplateRows = (0, _style.default)({
84
+ const gridTemplateRows = exports.gridTemplateRows = (0, _style.default)({
91
85
  prop: 'gridTemplateRows'
92
86
  });
93
- exports.gridTemplateRows = gridTemplateRows;
94
- const gridTemplateAreas = (0, _style.default)({
87
+ const gridTemplateAreas = exports.gridTemplateAreas = (0, _style.default)({
95
88
  prop: 'gridTemplateAreas'
96
89
  });
97
- exports.gridTemplateAreas = gridTemplateAreas;
98
- const gridArea = (0, _style.default)({
90
+ const gridArea = exports.gridArea = (0, _style.default)({
99
91
  prop: 'gridArea'
100
92
  });
101
- exports.gridArea = gridArea;
102
93
  const grid = (0, _compose.default)(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
103
- var _default = grid;
104
- exports.default = _default;
94
+ var _default = exports.default = grid;
@@ -20,8 +20,7 @@ var _jsxRuntime = require("react/jsx-runtime");
20
20
  const _excluded = ["colorSchemes", "components", "generateCssVars", "cssVarPrefix"];
21
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
- const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
24
- exports.DISABLE_CSS_TRANSITION = DISABLE_CSS_TRANSITION;
23
+ const DISABLE_CSS_TRANSITION = exports.DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
25
24
  function createCssVarsProvider(options) {
26
25
  const {
27
26
  themeId,