@mui/system 5.12.1 → 5.13.1

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 (105) hide show
  1. package/CHANGELOG.md +312 -0
  2. package/Container/Container.d.ts +13 -13
  3. package/Container/ContainerProps.d.ts +40 -40
  4. package/Container/containerClasses.d.ts +22 -22
  5. package/Container/createContainer.d.ts +18 -18
  6. package/Container/createContainer.js +41 -35
  7. package/GlobalStyles/GlobalStyles.d.ts +13 -13
  8. package/GlobalStyles/index.d.ts +2 -2
  9. package/Stack/Stack.d.ts +14 -14
  10. package/Stack/Stack.js +1 -1
  11. package/Stack/StackProps.d.ts +53 -53
  12. package/Stack/createStack.d.ts +21 -21
  13. package/Stack/createStack.js +24 -26
  14. package/Stack/index.d.ts +5 -5
  15. package/Stack/stackClasses.d.ts +8 -8
  16. package/ThemeProvider/ThemeProvider.js +9 -5
  17. package/Unstable_Grid/Grid.d.ts +12 -12
  18. package/Unstable_Grid/GridProps.d.ts +185 -185
  19. package/Unstable_Grid/createGrid.d.ts +11 -11
  20. package/Unstable_Grid/createGrid.js +21 -23
  21. package/Unstable_Grid/gridClasses.d.ts +20 -20
  22. package/Unstable_Grid/gridGenerator.d.ts +38 -38
  23. package/Unstable_Grid/gridGenerator.js +20 -18
  24. package/Unstable_Grid/index.d.ts +5 -5
  25. package/breakpoints.js +7 -6
  26. package/colorManipulator.js +2 -0
  27. package/createBox.js +9 -12
  28. package/createStyled.js +40 -31
  29. package/createTheme/createBreakpoints.js +24 -26
  30. package/createTheme/createSpacing.d.ts +10 -10
  31. package/createTheme/createSpacing.js +3 -1
  32. package/createTheme/createTheme.js +18 -14
  33. package/cssVars/createCssVarsProvider.js +21 -20
  34. package/cssVars/createCssVarsTheme.d.ts +15 -15
  35. package/cssVars/createCssVarsTheme.js +10 -10
  36. package/cssVars/createGetCssVar.d.ts +5 -5
  37. package/cssVars/cssVarsParser.d.ts +64 -64
  38. package/cssVars/getInitColorSchemeScript.d.ts +42 -42
  39. package/cssVars/index.d.ts +5 -5
  40. package/cssVars/prepareCssVars.d.ts +16 -16
  41. package/cssVars/prepareCssVars.js +13 -12
  42. package/cssVars/useCurrentColorScheme.d.ts +53 -53
  43. package/cssVars/useCurrentColorScheme.js +17 -11
  44. package/esm/Container/createContainer.js +41 -35
  45. package/esm/Stack/Stack.js +1 -1
  46. package/esm/Stack/createStack.js +24 -26
  47. package/esm/ThemeProvider/ThemeProvider.js +9 -5
  48. package/esm/Unstable_Grid/createGrid.js +21 -23
  49. package/esm/Unstable_Grid/gridGenerator.js +20 -17
  50. package/esm/breakpoints.js +7 -6
  51. package/esm/colorManipulator.js +1 -0
  52. package/esm/createBox.js +9 -12
  53. package/esm/createStyled.js +38 -31
  54. package/esm/createTheme/createBreakpoints.js +24 -25
  55. package/esm/createTheme/createSpacing.js +4 -0
  56. package/esm/createTheme/createTheme.js +18 -14
  57. package/esm/cssVars/createCssVarsProvider.js +21 -20
  58. package/esm/cssVars/createCssVarsTheme.js +10 -10
  59. package/esm/cssVars/prepareCssVars.js +13 -12
  60. package/esm/cssVars/useCurrentColorScheme.js +17 -10
  61. package/esm/propsToClassKey.js +3 -5
  62. package/esm/styleFunctionSx/extendSxProp.js +14 -10
  63. package/index.js +5 -2
  64. package/legacy/Container/createContainer.js +7 -6
  65. package/legacy/Stack/Stack.js +1 -1
  66. package/legacy/Stack/createStack.js +6 -5
  67. package/legacy/ThemeProvider/ThemeProvider.js +4 -3
  68. package/legacy/Unstable_Grid/createGrid.js +6 -4
  69. package/legacy/Unstable_Grid/gridGenerator.js +6 -4
  70. package/legacy/breakpoints.js +5 -3
  71. package/legacy/colorManipulator.js +1 -0
  72. package/legacy/createBox.js +4 -2
  73. package/legacy/createStyled.js +13 -11
  74. package/legacy/createTheme/createBreakpoints.js +4 -3
  75. package/legacy/createTheme/createSpacing.js +4 -0
  76. package/legacy/createTheme/createTheme.js +6 -4
  77. package/legacy/cssVars/createCssVarsProvider.js +6 -5
  78. package/legacy/cssVars/createCssVarsTheme.js +4 -2
  79. package/legacy/cssVars/prepareCssVars.js +5 -3
  80. package/legacy/cssVars/useCurrentColorScheme.js +9 -7
  81. package/legacy/index.js +1 -1
  82. package/legacy/styleFunctionSx/extendSxProp.js +6 -4
  83. package/modern/Container/createContainer.js +41 -35
  84. package/modern/Stack/Stack.js +1 -1
  85. package/modern/Stack/createStack.js +24 -26
  86. package/modern/ThemeProvider/ThemeProvider.js +9 -5
  87. package/modern/Unstable_Grid/createGrid.js +21 -23
  88. package/modern/Unstable_Grid/gridGenerator.js +20 -17
  89. package/modern/breakpoints.js +7 -6
  90. package/modern/colorManipulator.js +1 -0
  91. package/modern/createBox.js +9 -12
  92. package/modern/createStyled.js +38 -31
  93. package/modern/createTheme/createBreakpoints.js +24 -25
  94. package/modern/createTheme/createSpacing.js +4 -0
  95. package/modern/createTheme/createTheme.js +18 -14
  96. package/modern/cssVars/createCssVarsProvider.js +21 -20
  97. package/modern/cssVars/createCssVarsTheme.js +10 -10
  98. package/modern/cssVars/prepareCssVars.js +13 -12
  99. package/modern/cssVars/useCurrentColorScheme.js +17 -10
  100. package/modern/index.js +1 -1
  101. package/modern/propsToClassKey.js +3 -5
  102. package/modern/styleFunctionSx/extendSxProp.js +14 -10
  103. package/package.json +4 -4
  104. package/propsToClassKey.js +3 -6
  105. package/styleFunctionSx/extendSxProp.js +14 -10
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import PropTypes from 'prop-types';
3
2
  import { deepmerge } from '@mui/utils';
4
3
  import merge from './merge';
@@ -59,21 +58,23 @@ function breakpoints(styleFunction) {
59
58
  const extended = themeBreakpoints.keys.reduce((acc, key) => {
60
59
  if (props[key]) {
61
60
  acc = acc || {};
62
- acc[themeBreakpoints.up(key)] = styleFunction(_extends({
63
- theme
64
- }, props[key]));
61
+ acc[themeBreakpoints.up(key)] = styleFunction({
62
+ theme,
63
+ ...props[key]
64
+ });
65
65
  }
66
66
  return acc;
67
67
  }, null);
68
68
  return merge(base, extended);
69
69
  };
70
- newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? _extends({}, styleFunction.propTypes, {
70
+ newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? {
71
+ ...styleFunction.propTypes,
71
72
  xs: PropTypes.object,
72
73
  sm: PropTypes.object,
73
74
  md: PropTypes.object,
74
75
  lg: PropTypes.object,
75
76
  xl: PropTypes.object
76
- }) : {};
77
+ } : {};
77
78
  newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
78
79
  return newStyleFunction;
79
80
  }
@@ -1,4 +1,5 @@
1
1
  import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
2
+ /* eslint-disable @typescript-eslint/naming-convention */
2
3
  /**
3
4
  * Returns a number whose value is limited to the given range.
4
5
  * @param {number} value The value to be clamped
@@ -1,6 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "component"];
4
1
  import * as React from 'react';
5
2
  import clsx from 'clsx';
6
3
  import styled from '@mui/styled-engine';
@@ -19,18 +16,18 @@ export default function createBox(options = {}) {
19
16
  })(styleFunctionSx);
20
17
  const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
21
18
  const theme = useTheme(defaultTheme);
22
- const _extendSxProp = extendSxProp(inProps),
23
- {
24
- className,
25
- component = 'div'
26
- } = _extendSxProp,
27
- other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded);
28
- return /*#__PURE__*/_jsx(BoxRoot, _extends({
19
+ const {
20
+ className,
21
+ component = 'div',
22
+ ...other
23
+ } = extendSxProp(inProps);
24
+ return /*#__PURE__*/_jsx(BoxRoot, {
29
25
  as: component,
30
26
  ref: ref,
31
27
  className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
32
- theme: themeId ? theme[themeId] || theme : theme
33
- }, other));
28
+ theme: themeId ? theme[themeId] || theme : theme,
29
+ ...other
30
+ });
34
31
  });
35
32
  return Box;
36
33
  }
@@ -1,6 +1,3 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
4
1
  /* eslint-disable no-underscore-dangle */
5
2
  import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
6
3
  import { getDisplayName } from '@mui/utils';
@@ -82,25 +79,27 @@ export default function createStyled(input = {}) {
82
79
  slotShouldForwardProp = shouldForwardProp
83
80
  } = input;
84
81
  const systemSx = props => {
85
- return styleFunctionSx(_extends({}, props, {
86
- theme: resolveTheme(_extends({}, props, {
82
+ return styleFunctionSx({
83
+ ...props,
84
+ theme: resolveTheme({
85
+ ...props,
87
86
  defaultTheme,
88
87
  themeId
89
- }))
90
- }));
88
+ })
89
+ });
91
90
  };
92
91
  systemSx.__mui_systemSx = true;
93
92
  return (tag, inputOptions = {}) => {
94
93
  // Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
95
94
  processStyles(tag, styles => styles.filter(style => !style?.__mui_systemSx));
96
95
  const {
97
- name: componentName,
98
- slot: componentSlot,
99
- skipVariantsResolver: inputSkipVariantsResolver,
100
- skipSx: inputSkipSx,
101
- overridesResolver
102
- } = inputOptions,
103
- options = _objectWithoutPropertiesLoose(inputOptions, _excluded);
96
+ name: componentName,
97
+ slot: componentSlot,
98
+ skipVariantsResolver: inputSkipVariantsResolver,
99
+ skipSx: inputSkipSx,
100
+ overridesResolver,
101
+ ...options
102
+ } = inputOptions;
104
103
 
105
104
  // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
106
105
  const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
@@ -121,38 +120,43 @@ export default function createStyled(input = {}) {
121
120
  // for string (html) tag, preserve the behavior in emotion & styled-components.
122
121
  shouldForwardPropOption = undefined;
123
122
  }
124
- const defaultStyledResolver = styledEngineStyled(tag, _extends({
123
+ const defaultStyledResolver = styledEngineStyled(tag, {
125
124
  shouldForwardProp: shouldForwardPropOption,
126
- label
127
- }, options));
125
+ label,
126
+ ...options
127
+ });
128
128
  const muiStyledResolver = (styleArg, ...expressions) => {
129
129
  const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
130
130
  // On the server Emotion doesn't use React.forwardRef for creating components, so the created
131
131
  // component stays as a function. This condition makes sure that we do not interpolate functions
132
132
  // which are basically components used as a selectors.
133
133
  return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? props => {
134
- return stylesArg(_extends({}, props, {
135
- theme: resolveTheme(_extends({}, props, {
134
+ return stylesArg({
135
+ ...props,
136
+ theme: resolveTheme({
137
+ ...props,
136
138
  defaultTheme,
137
139
  themeId
138
- }))
139
- }));
140
+ })
141
+ });
140
142
  } : stylesArg;
141
143
  }) : [];
142
144
  let transformedStyleArg = styleArg;
143
145
  if (componentName && overridesResolver) {
144
146
  expressionsWithDefaultTheme.push(props => {
145
- const theme = resolveTheme(_extends({}, props, {
147
+ const theme = resolveTheme({
148
+ ...props,
146
149
  defaultTheme,
147
150
  themeId
148
- }));
151
+ });
149
152
  const styleOverrides = getStyleOverrides(componentName, theme);
150
153
  if (styleOverrides) {
151
154
  const resolvedStyleOverrides = {};
152
155
  Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
153
- resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(_extends({}, props, {
156
+ resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle({
157
+ ...props,
154
158
  theme
155
- })) : slotStyle;
159
+ }) : slotStyle;
156
160
  });
157
161
  return overridesResolver(props, resolvedStyleOverrides);
158
162
  }
@@ -161,10 +165,11 @@ export default function createStyled(input = {}) {
161
165
  }
162
166
  if (componentName && !skipVariantsResolver) {
163
167
  expressionsWithDefaultTheme.push(props => {
164
- const theme = resolveTheme(_extends({}, props, {
168
+ const theme = resolveTheme({
169
+ ...props,
165
170
  defaultTheme,
166
171
  themeId
167
- }));
172
+ });
168
173
  return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
169
174
  });
170
175
  }
@@ -183,12 +188,14 @@ export default function createStyled(input = {}) {
183
188
  // which are basically components used as a selectors.
184
189
  styleArg.__emotion_real !== styleArg) {
185
190
  // If the type is function, we need to define the default theme.
186
- transformedStyleArg = props => styleArg(_extends({}, props, {
187
- theme: resolveTheme(_extends({}, props, {
191
+ transformedStyleArg = props => styleArg({
192
+ ...props,
193
+ theme: resolveTheme({
194
+ ...props,
188
195
  defaultTheme,
189
196
  themeId
190
- }))
191
- }));
197
+ })
198
+ });
192
199
  }
193
200
  const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
194
201
  if (process.env.NODE_ENV !== 'production') {
@@ -1,6 +1,3 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["values", "unit", "step"];
4
1
  // Sorted ASC by size. That's important.
5
2
  // It can't be configured as it's used statically for propTypes.
6
3
  export const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
@@ -12,33 +9,34 @@ const sortBreakpointsValues = values => {
12
9
  // Sort in ascending order
13
10
  breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
14
11
  return breakpointsAsArray.reduce((acc, obj) => {
15
- return _extends({}, acc, {
12
+ return {
13
+ ...acc,
16
14
  [obj.key]: obj.val
17
- });
15
+ };
18
16
  }, {});
19
17
  };
20
18
 
21
19
  // Keep in mind that @media is inclusive by the CSS specification.
22
20
  export default function createBreakpoints(breakpoints) {
23
21
  const {
24
- // The breakpoint **start** at this value.
25
- // For instance with the first breakpoint xs: [xs, sm).
26
- values = {
27
- xs: 0,
28
- // phone
29
- sm: 600,
30
- // tablet
31
- md: 900,
32
- // small laptop
33
- lg: 1200,
34
- // desktop
35
- xl: 1536 // large screen
36
- },
22
+ // The breakpoint **start** at this value.
23
+ // For instance with the first breakpoint xs: [xs, sm).
24
+ values = {
25
+ xs: 0,
26
+ // phone
27
+ sm: 600,
28
+ // tablet
29
+ md: 900,
30
+ // small laptop
31
+ lg: 1200,
32
+ // desktop
33
+ xl: 1536 // large screen
34
+ },
37
35
 
38
- unit = 'px',
39
- step = 5
40
- } = breakpoints,
41
- other = _objectWithoutPropertiesLoose(breakpoints, _excluded);
36
+ unit = 'px',
37
+ step = 5,
38
+ ...other
39
+ } = breakpoints;
42
40
  const sortedValues = sortBreakpointsValues(values);
43
41
  const keys = Object.keys(sortedValues);
44
42
  function up(key) {
@@ -70,7 +68,7 @@ export default function createBreakpoints(breakpoints) {
70
68
  }
71
69
  return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
72
70
  }
73
- return _extends({
71
+ return {
74
72
  keys,
75
73
  values: sortedValues,
76
74
  up,
@@ -78,6 +76,7 @@ export default function createBreakpoints(breakpoints) {
78
76
  between,
79
77
  only,
80
78
  not,
81
- unit
82
- }, other);
79
+ unit,
80
+ ...other
81
+ };
83
82
  }
@@ -1,4 +1,8 @@
1
1
  import { createUnarySpacing } from '../spacing';
2
+
3
+ // The different signatures imply different meaning for their arguments that can't be expressed structurally.
4
+ // We express the difference with variable names.
5
+ /* tslint:disable:unified-signatures */
2
6
  /* tslint:enable:unified-signatures */
3
7
 
4
8
  export default function createSpacing(spacingInput = 8) {
@@ -1,6 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["breakpoints", "palette", "spacing", "shape"];
4
1
  import { deepmerge } from '@mui/utils';
5
2
  import createBreakpoints from './createBreakpoints';
6
3
  import shape from './shape';
@@ -9,12 +6,12 @@ import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
9
6
  import defaultSxConfig from '../styleFunctionSx/defaultSxConfig';
10
7
  function createTheme(options = {}, ...args) {
11
8
  const {
12
- breakpoints: breakpointsInput = {},
13
- palette: paletteInput = {},
14
- spacing: spacingInput,
15
- shape: shapeInput = {}
16
- } = options,
17
- other = _objectWithoutPropertiesLoose(options, _excluded);
9
+ breakpoints: breakpointsInput = {},
10
+ palette: paletteInput = {},
11
+ spacing: spacingInput,
12
+ shape: shapeInput = {},
13
+ ...other
14
+ } = options;
18
15
  const breakpoints = createBreakpoints(breakpointsInput);
19
16
  const spacing = createSpacing(spacingInput);
20
17
  let muiTheme = deepmerge({
@@ -22,14 +19,21 @@ function createTheme(options = {}, ...args) {
22
19
  direction: 'ltr',
23
20
  components: {},
24
21
  // Inject component definitions.
25
- palette: _extends({
26
- mode: 'light'
27
- }, paletteInput),
22
+ palette: {
23
+ mode: 'light',
24
+ ...paletteInput
25
+ },
28
26
  spacing,
29
- shape: _extends({}, shape, shapeInput)
27
+ shape: {
28
+ ...shape,
29
+ ...shapeInput
30
+ }
30
31
  }, other);
31
32
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
32
- muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other?.unstable_sxConfig);
33
+ muiTheme.unstable_sxConfig = {
34
+ ...defaultSxConfig,
35
+ ...other?.unstable_sxConfig
36
+ };
33
37
  muiTheme.unstable_sx = function sx(props) {
34
38
  return styleFunctionSx({
35
39
  sx: props,
@@ -1,7 +1,4 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
1
  import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
4
- const _excluded = ["colorSchemes", "components", "generateCssVars", "cssVarPrefix"];
5
2
  import * as React from 'react';
6
3
  import PropTypes from 'prop-types';
7
4
  import { deepmerge } from '@mui/utils';
@@ -58,17 +55,16 @@ export default function createCssVarsProvider(options) {
58
55
  const ctx = React.useContext(ColorSchemeContext);
59
56
  const nested = !!ctx && !disableNestedContext;
60
57
  const scopedTheme = themeProp[themeId];
61
- const _ref = scopedTheme || themeProp,
62
- {
63
- colorSchemes = {},
64
- components = {},
65
- generateCssVars = () => ({
66
- vars: {},
67
- css: {}
68
- }),
69
- cssVarPrefix
70
- } = _ref,
71
- restThemeProp = _objectWithoutPropertiesLoose(_ref, _excluded);
58
+ const {
59
+ colorSchemes = {},
60
+ components = {},
61
+ generateCssVars = () => ({
62
+ vars: {},
63
+ css: {}
64
+ }),
65
+ cssVarPrefix,
66
+ ...restThemeProp
67
+ } = scopedTheme || themeProp;
72
68
  const allColorSchemes = Object.keys(colorSchemes);
73
69
  const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
74
70
  const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
@@ -126,13 +122,14 @@ export default function createCssVarsProvider(options) {
126
122
  } = generateCssVars();
127
123
 
128
124
  // 3. Start composing the theme object
129
- const theme = _extends({}, restThemeProp, {
125
+ const theme = {
126
+ ...restThemeProp,
130
127
  components,
131
128
  colorSchemes,
132
129
  cssVarPrefix,
133
130
  vars: rootVars,
134
131
  getColorSchemeSelector: targetColorScheme => `[${attribute}="${targetColorScheme}"] &`
135
- });
132
+ };
136
133
 
137
134
  // 4. Create color CSS variables and store them in objects (to be generated in stylesheets in the final step)
138
135
  // The default color scheme stylesheet is constructed to have the least CSS specificity.
@@ -150,7 +147,10 @@ export default function createCssVarsProvider(options) {
150
147
  Object.keys(scheme).forEach(schemeKey => {
151
148
  if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
152
149
  // shallow merge the 1st level structure of the theme.
153
- theme[schemeKey] = _extends({}, theme[schemeKey], scheme[schemeKey]);
150
+ theme[schemeKey] = {
151
+ ...theme[schemeKey],
152
+ ...scheme[schemeKey]
153
+ };
154
154
  } else {
155
155
  theme[schemeKey] = scheme[schemeKey];
156
156
  }
@@ -320,14 +320,15 @@ export default function createCssVarsProvider(options) {
320
320
  } : void 0;
321
321
  const defaultLightColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.light;
322
322
  const defaultDarkColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.dark;
323
- const getInitColorSchemeScript = params => systemGetInitColorSchemeScript(_extends({
323
+ const getInitColorSchemeScript = params => systemGetInitColorSchemeScript({
324
324
  attribute: defaultAttribute,
325
325
  colorSchemeStorageKey: defaultColorSchemeStorageKey,
326
326
  defaultMode: designSystemMode,
327
327
  defaultLightColorScheme,
328
328
  defaultDarkColorScheme,
329
- modeStorageKey: defaultModeStorageKey
330
- }, params));
329
+ modeStorageKey: defaultModeStorageKey,
330
+ ...params
331
+ });
331
332
  return {
332
333
  CssVarsProvider,
333
334
  useColorScheme,
@@ -1,16 +1,16 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["cssVarPrefix", "shouldSkipGeneratingVar"];
4
1
  import prepareCssVars from './prepareCssVars';
5
2
  function createCssVarsTheme(theme) {
6
3
  const {
7
- cssVarPrefix,
4
+ cssVarPrefix,
5
+ shouldSkipGeneratingVar,
6
+ ...otherTheme
7
+ } = theme;
8
+ return {
9
+ ...theme,
10
+ ...prepareCssVars(otherTheme, {
11
+ prefix: cssVarPrefix,
8
12
  shouldSkipGeneratingVar
9
- } = theme,
10
- otherTheme = _objectWithoutPropertiesLoose(theme, _excluded);
11
- return _extends({}, theme, prepareCssVars(otherTheme, {
12
- prefix: cssVarPrefix,
13
- shouldSkipGeneratingVar
14
- }));
13
+ })
14
+ };
15
15
  }
16
16
  export default createCssVarsTheme;
@@ -1,15 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["colorSchemes", "components"],
4
- _excluded2 = ["light"];
5
1
  import { deepmerge } from '@mui/utils';
6
2
  import cssVarsParser from './cssVarsParser';
7
3
  function prepareCssVars(theme, parserConfig) {
8
4
  // @ts-ignore - ignore components do not exist
9
5
  const {
10
- colorSchemes = {}
11
- } = theme,
12
- otherTheme = _objectWithoutPropertiesLoose(theme, _excluded);
6
+ colorSchemes = {},
7
+ components,
8
+ ...otherTheme
9
+ } = theme;
13
10
  const {
14
11
  vars: rootVars,
15
12
  css: rootCss,
@@ -18,9 +15,9 @@ function prepareCssVars(theme, parserConfig) {
18
15
  let themeVars = rootVarsWithDefaults;
19
16
  const colorSchemesMap = {};
20
17
  const {
21
- light
22
- } = colorSchemes,
23
- otherColorSchemes = _objectWithoutPropertiesLoose(colorSchemes, _excluded2);
18
+ light,
19
+ ...otherColorSchemes
20
+ } = colorSchemes;
24
21
  Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
25
22
  const {
26
23
  vars,
@@ -49,12 +46,16 @@ function prepareCssVars(theme, parserConfig) {
49
46
  const generateCssVars = colorScheme => {
50
47
  if (!colorScheme) {
51
48
  return {
52
- css: _extends({}, rootCss),
49
+ css: {
50
+ ...rootCss
51
+ },
53
52
  vars: rootVars
54
53
  };
55
54
  }
56
55
  return {
57
- css: _extends({}, colorSchemesMap[colorScheme].css),
56
+ css: {
57
+ ...colorSchemesMap[colorScheme].css
58
+ },
58
59
  vars: colorSchemesMap[colorScheme].vars
59
60
  };
60
61
  };
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import * as React from 'react';
3
2
  import { DEFAULT_MODE_STORAGE_KEY, DEFAULT_COLOR_SCHEME_STORAGE_KEY } from './getInitColorSchemeScript';
4
3
  export function getSystemMode(mode) {
@@ -82,10 +81,11 @@ export default function useCurrentColorScheme(options) {
82
81
  } catch (e) {
83
82
  // Unsupported
84
83
  }
85
- return _extends({}, currentState, {
84
+ return {
85
+ ...currentState,
86
86
  mode: newMode,
87
87
  systemMode: getSystemMode(newMode)
88
- });
88
+ };
89
89
  });
90
90
  }, [modeStorageKey, defaultMode]);
91
91
  const setColorScheme = React.useCallback(value => {
@@ -97,17 +97,20 @@ export default function useCurrentColorScheme(options) {
97
97
  } catch (e) {
98
98
  // Unsupported
99
99
  }
100
- return _extends({}, currentState, {
100
+ return {
101
+ ...currentState,
101
102
  lightColorScheme: defaultLightColorScheme,
102
103
  darkColorScheme: defaultDarkColorScheme
103
- });
104
+ };
104
105
  });
105
106
  } else if (typeof value === 'string') {
106
107
  if (value && !joinedColorSchemes.includes(value)) {
107
108
  console.error(`\`${value}\` does not exist in \`theme.colorSchemes\`.`);
108
109
  } else {
109
110
  setState(currentState => {
110
- const newState = _extends({}, currentState);
111
+ const newState = {
112
+ ...currentState
113
+ };
111
114
  processState(currentState, mode => {
112
115
  try {
113
116
  localStorage.setItem(`${colorSchemeStorageKey}-${mode}`, value);
@@ -126,7 +129,9 @@ export default function useCurrentColorScheme(options) {
126
129
  }
127
130
  } else {
128
131
  setState(currentState => {
129
- const newState = _extends({}, currentState);
132
+ const newState = {
133
+ ...currentState
134
+ };
130
135
  const newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
131
136
  const newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
132
137
  if (newLightColorScheme) {
@@ -159,7 +164,8 @@ export default function useCurrentColorScheme(options) {
159
164
  }, [joinedColorSchemes, colorSchemeStorageKey, defaultLightColorScheme, defaultDarkColorScheme]);
160
165
  const handleMediaQuery = React.useCallback(e => {
161
166
  if (state.mode === 'system') {
162
- setState(currentState => _extends({}, currentState, {
167
+ setState(currentState => ({
168
+ ...currentState,
163
169
  systemMode: e?.matches ? 'dark' : 'light'
164
170
  }));
165
171
  }
@@ -208,9 +214,10 @@ export default function useCurrentColorScheme(options) {
208
214
  }
209
215
  return undefined;
210
216
  }, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow]);
211
- return _extends({}, state, {
217
+ return {
218
+ ...state,
212
219
  colorScheme,
213
220
  setMode,
214
221
  setColorScheme
215
- });
222
+ };
216
223
  }
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.12.1
2
+ * @mui/system v5.13.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,5 +1,3 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- const _excluded = ["variant"];
3
1
  import { unstable_capitalize as capitalize } from '@mui/utils';
4
2
  function isEmpty(string) {
5
3
  return string.length === 0;
@@ -12,9 +10,9 @@ function isEmpty(string) {
12
10
  */
13
11
  export default function propsToClassKey(props) {
14
12
  const {
15
- variant
16
- } = props,
17
- other = _objectWithoutPropertiesLoose(props, _excluded);
13
+ variant,
14
+ ...other
15
+ } = props;
18
16
  let classKey = variant || '';
19
17
  Object.keys(other).sort().forEach(key => {
20
18
  if (key === 'color') {
@@ -1,6 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["sx"];
4
1
  import { isPlainObject } from '@mui/utils';
5
2
  import defaultSxConfig from './defaultSxConfig';
6
3
  const splitProps = props => {
@@ -20,9 +17,9 @@ const splitProps = props => {
20
17
  };
21
18
  export default function extendSxProp(props) {
22
19
  const {
23
- sx: inSx
24
- } = props,
25
- other = _objectWithoutPropertiesLoose(props, _excluded);
20
+ sx: inSx,
21
+ ...other
22
+ } = props;
26
23
  const {
27
24
  systemProps,
28
25
  otherProps
@@ -36,12 +33,19 @@ export default function extendSxProp(props) {
36
33
  if (!isPlainObject(result)) {
37
34
  return systemProps;
38
35
  }
39
- return _extends({}, systemProps, result);
36
+ return {
37
+ ...systemProps,
38
+ ...result
39
+ };
40
40
  };
41
41
  } else {
42
- finalSx = _extends({}, systemProps, inSx);
42
+ finalSx = {
43
+ ...systemProps,
44
+ ...inSx
45
+ };
43
46
  }
44
- return _extends({}, otherProps, {
47
+ return {
48
+ ...otherProps,
45
49
  sx: finalSx
46
- });
50
+ };
47
51
  }