@mui/system 5.14.10 → 5.14.12

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 +159 -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 +4 -5
  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/cssVars/createCssVarsProvider.js +3 -3
  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/cssVars/createCssVarsProvider.js +3 -3
  32. package/legacy/index.js +1 -1
  33. package/merge.js +1 -2
  34. package/modern/createStyled.js +99 -35
  35. package/modern/cssVars/createCssVarsProvider.js +3 -3
  36. package/modern/index.js +1 -1
  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 +1 -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,164 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.14.12
4
+
5
+ <!-- generated comparing v5.14.11..master -->
6
+
7
+ _Oct 3, 2023_
8
+
9
+ A big thanks to the 17 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🎨 Introduced color inversion utilities to Joy UI (#38916) @siriwatknp
12
+ - 🚀 Added Chip and related TextField components to Material You @DiegoAndai, @mj12albert
13
+
14
+ ### `@mui/material@5.14.12`
15
+
16
+ - [DialogActions] Apply margin-left when children is not of `button` type (#39189) @sai6855
17
+ - [Select] Improve a11y by adding combobox role and aria-controls attribute (#38785) @xulingzhihou
18
+ - [Select] Fix MenuProps slotProps forwarding (#39177) @DiegoAndai
19
+ - [TextField] Polish types in Textfield demo (#39140) @sai6855
20
+ - [ButtonGroup] Fix rendering with conditional elements (#38989) @ZeeshanTamboli
21
+
22
+ ### `@mui/system@5.14.12`
23
+
24
+ - [system] Add support for `variants` in the styled() util (#39073) @mnajdova
25
+ - [Box] Add missing logical spacing property types (#39169) @Semigradsky
26
+
27
+ ### `@mui/base@5.0.0-beta.18`
28
+
29
+ - [useSlider] Align externalProps handling (#38854) @mj12albert
30
+ - [useTabs] Align external props handling for useTab/useTabPanel/useTabsList (#39037) @mj12albert
31
+ - [test] Fix import paths in useTab tests (#39291) @mj12albert
32
+
33
+ ### `@mui/material-next@6.0.0-alpha.104`
34
+
35
+ - [Chip] Add Material You Chip component (#38927) @DiegoAndai
36
+ - [Divider] Copy v5 Divider (#39197) @mj12albert
37
+ - [FilledInput] Copy v5 FilledInput (#39040) @mj12albert
38
+ - [FormControl] Add FormControl component (#39032) @mj12albert
39
+ - [Select] Copy Select files from v5 (#39188) @DiegoAndai
40
+ - [TextField] Copy v5 TextField's inner components (#39166) @mj12albert
41
+
42
+ ### `@mui/joy@5.0.0-beta.9`
43
+
44
+ - Introduce color inversion utilities (#38916) @siriwatknp
45
+ - Replace margin with `gap` property (#39147) @siriwatknp
46
+ - [CssBaseline] use Joy `GlobalStyles` (#39278) @siriwatknp
47
+ - [Drawer] Apply content styles from theme to content slot (#39199) @sai6855
48
+ - [List] Add gap and missing active styles (#39146) @siriwatknp
49
+ - [Switch] Slight adjustments to the design (#39276) @danilo-leal
50
+
51
+ ### Docs
52
+
53
+ - [docs] Update Autocomplete demo for React 18 (#39162) @oliviertassinari
54
+ - [docs-infra] Tweak feedback footer section design (#36556) @danilo-leal
55
+ - [docs-infra] Improve code syntax highlight (#39181) @oliviertassinari
56
+ - [docs][base] Add Tailwind CSS + plain CSS demo on the TextArea page (#39046) @alisasanib
57
+ - [docs][base-ui] Fix style for root div of multiline input (#39182) @ttlpta
58
+ - [docs][base-ui] Improve Select's country select demo (#38983) @oliviertassinari
59
+ - [docs][joy-ui] Add scrollable tabs example (#39260) @siriwatknp
60
+ - [docs][joy-ui] Match `Autocomplete` github label demo to actual github label dropdown (#39228) @sai6855
61
+ - [docs][joy-ui] Refine the Rental dashboard template (#39059) @zanivan
62
+ - [docs][joy-ui] Removed incomplete sentence in the Aspect Ratio page (#39227) @Erik-McKelvey
63
+ - [docs][joy-ui] Fix typo in the Accordion page (#39226) @Erik-McKelvey
64
+ - [docs][joy-ui] Update and standardize template Sidemenus (#39271) @zanivan
65
+ - [docs][joy-ui] Add a roadmap page (#39163) @danilo-leal
66
+ - [docs][material-ui] Replace `Box` with `Stack` in applicable demos (#39174) @sai6855
67
+ - [docs][material-ui] Add small polish to the Templates page (#39224) @danilo-leal
68
+ - [docs][material-ui] Small revision to the Icons page (#38840) @danilo-leal
69
+
70
+ ### Core
71
+
72
+ - Add next lint config to eslint (#39183) @Janpot
73
+ - [core] Update eslint rules (#39178) @romgrk
74
+ - [core] Fix Greg GitHub slug @oliviertassinari
75
+ - [core] Priority Support casing normalization @oliviertassinari
76
+ - [website] Add Heat map in pricing page (#39269) @oliviertassinari
77
+ - [website] Update `React Engineer - xCharts` Ashby link (#39172) @DanailH
78
+ - [website] Add Charts to the pricing table (#38680) @alexfauquette
79
+ - [website] Polish career experience @oliviertassinari
80
+ - [website] Simplify the Core products file (#39194) @danilo-leal
81
+
82
+ 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
83
+
84
+ ## 5.14.11
85
+
86
+ <!-- generated comparing v5.14.10..master -->
87
+
88
+ _Sep 26, 2023_
89
+
90
+ A big thanks to the 23 contributors who made this release possible.
91
+ This release was mostly about 🐛 bug fixes and 📚 documentation improvements.
92
+
93
+ ### `@mui/material@5.14.11`
94
+
95
+ - [Autocomplete] Re-export `AutocompleteValue` to make it available from path import (#38638) @vadimka123
96
+ - [Select][material-ui] Missing aria-multiselectable attribute on multiple Select component (#38855) @gitstart
97
+ - [l10n] labelDisplayedRows is added for trTR localization (#39056) @tebersefa
98
+
99
+ ### `@mui/utils@5.14.11`
100
+
101
+ - Support RSC in `isMuiElement` util (#38129) @sai6855
102
+
103
+ ### `@mui/base@5.0.0-beta.17`
104
+
105
+ - [NumberInput] Support adornments (#38900) @anle9650
106
+ - [Menu] Align external props handling for useMenu/MenuButton/MenuItem (#38946) @mj12albert
107
+ - [Select] Align external props handling (#39038) @mj12albert
108
+ - [TextareaAutosize] Simplify logic and add test (#38728) @oliviertassinari
109
+
110
+ ### `@mui/joy@5.0.0-beta.8`
111
+
112
+ - [Button] Fix disabled button styling when component prop is provided (#38996) @sai6855
113
+ - [Drawer] Add missing `JoyDrawer` in theme components (#39074) @Studio384
114
+
115
+ ### `@mui/material-next@6.0.0-alpha.103`
116
+
117
+ - [FormControl] Copy v5 FormControl (#39039) @mj12albert
118
+
119
+ ### `@mui/lab@5.0.0-alpha.146`
120
+
121
+ - [TreeView] Fix JSDoc comments in TreeView and TreeItem (#38874) @jergason
122
+
123
+ ### Docs
124
+
125
+ - Improve focus trap demo (#38985) @oliviertassinari
126
+ - Add Tailwind CSS + plain CSS demo on the Tabs page (#39000) @alisasanib
127
+ - Improve the default theme viewer design (#39049) @danilo-leal
128
+ - Add live demo with CssVarsProvider (#38792) @oliviertassinari
129
+ - Fix wrong hash on Card's page (#39151) @mnajdova
130
+ - Revise the Drawer page (#38988) @danilo-leal
131
+ - Simplify the button's loading indicator demo (#39082) @danilo-leal
132
+ - Fix the Templates link on the Overview page (#39086) @danilo-leal
133
+ - Refine the Sign in template (#38942) @zanivan
134
+ - Add `use-count-up` integration with the Circular Progress (#38952) @anon-phantom
135
+
136
+ ### Core
137
+
138
+ - [blog] Add a company values blog post (#38802) @mikailaread
139
+ - [core] Downgrade lerna to 7.2.0 (#39149) @michaldudak
140
+ - [core] Simplify docs feedback interaction (#39075) @alexfauquette
141
+ - [core] Improve ref type definition (#38903) @oliviertassinari
142
+ - [core] Simplify career (#39112) @oliviertassinari
143
+ - [core] Update Babel types along with source packages (#39070) @michaldudak
144
+ - [core] Add a comment to explain `useEnhancedEffect` (#39035) @Janpot
145
+ - [docs-infra] Fix code removal in table of content (#39165) @alexfauquette
146
+ - [docs-infra] Improve callouts design (#39084) @danilo-leal
147
+ - [docs-infra] Fix key warning in Base UI Slider slots section (#38954) @ZeeshanTamboli
148
+ - [docs-infra] Fix error when redirecting to the root page (#38451) @maheshguntur
149
+ - [docs-infra] Open demo crash in the right repository (#39006) @oliviertassinari
150
+ - [test] Split the test package (#39061) @michaldudak
151
+ - [website] React Engineer - xCharts role (#38976) @DanailH
152
+ - [website] Improve the highlighter component colors (#39087) @danilo-leal
153
+ - [website] Fix Pricing page row hover (#39097) @danilo-leal
154
+ - [website] Fix typo with straight quote @oliviertassinari
155
+ - [website] Sync about page @oliviertassinari
156
+ - [website] Update the about page (#38733) @danilo-leal
157
+ - [website] Small fixes on the X marketing page (#38975) @flaviendelangle
158
+ - [website] Add stray design tweaks to the X page (#38589) @danilo-leal
159
+
160
+ All contributors of this release in alphabetical order: @alexfauquette, @alisasanib, @anle9650, @anon-phantom, @DanailH, @danilo-leal, @DiegoAndai, @flaviendelangle, @gitstart, @Janpot, @jergason, @maheshguntur, @michaldudak, @mikailaread, @mj12albert, @mnajdova, @oliviertassinari, @sai6855, @Studio384, @tebersefa, @vadimka123, @zanivan, @ZeeshanTamboli
161
+
3
162
  ## 5.14.10
4
163
 
5
164
  <!-- generated comparing v5.14.9..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;