@mui/system 5.15.9 → 5.15.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 (105) hide show
  1. package/Box/Box.js +2 -2
  2. package/Box/boxClasses.js +3 -2
  3. package/CHANGELOG.md +375 -133
  4. package/Container/containerClasses.js +5 -3
  5. package/Container/createContainer.js +7 -5
  6. package/Stack/createStack.js +5 -3
  7. package/Stack/stackClasses.js +5 -3
  8. package/ThemeProvider/ThemeProvider.js +2 -2
  9. package/Unstable_Grid/createGrid.js +12 -7
  10. package/Unstable_Grid/gridClasses.js +5 -3
  11. package/breakpoints.js +2 -2
  12. package/colorManipulator.js +2 -2
  13. package/createStyled.js +8 -6
  14. package/createTheme/createSpacing.d.ts +1 -1
  15. package/createTheme/createTheme.js +3 -3
  16. package/cssVars/createCssVarsProvider.js +6 -3
  17. package/cssVars/createCssVarsTheme.d.ts +1 -0
  18. package/cssVars/prepareCssVars.d.ts +5 -2
  19. package/cssVars/prepareCssVars.js +21 -14
  20. package/esm/Box/Box.js +1 -1
  21. package/esm/Box/boxClasses.js +1 -1
  22. package/esm/Container/containerClasses.js +2 -1
  23. package/esm/Container/createContainer.js +3 -1
  24. package/esm/Stack/createStack.js +3 -1
  25. package/esm/Stack/stackClasses.js +2 -1
  26. package/esm/ThemeProvider/ThemeProvider.js +1 -1
  27. package/esm/Unstable_Grid/createGrid.js +10 -5
  28. package/esm/Unstable_Grid/gridClasses.js +2 -1
  29. package/esm/breakpoints.js +1 -1
  30. package/esm/colorManipulator.js +1 -1
  31. package/esm/createStyled.js +5 -3
  32. package/esm/createTheme/createTheme.js +1 -1
  33. package/esm/cssVars/createCssVarsProvider.js +4 -1
  34. package/esm/cssVars/prepareCssVars.js +19 -12
  35. package/esm/index.js +1 -0
  36. package/esm/merge.js +1 -1
  37. package/esm/propsToClassKey.js +1 -1
  38. package/esm/style.js +1 -1
  39. package/esm/styleFunctionSx/extendSxProp.js +1 -1
  40. package/esm/styleFunctionSx/styleFunctionSx.js +1 -1
  41. package/esm/useMediaQuery/index.js +2 -0
  42. package/esm/useMediaQuery/useMediaQuery.js +126 -0
  43. package/esm/useThemeProps/getThemeProps.js +1 -1
  44. package/index.d.ts +3 -0
  45. package/index.js +9 -1
  46. package/legacy/Box/Box.js +1 -1
  47. package/legacy/Box/boxClasses.js +1 -1
  48. package/legacy/Container/containerClasses.js +2 -1
  49. package/legacy/Container/createContainer.js +3 -1
  50. package/legacy/Stack/createStack.js +3 -1
  51. package/legacy/Stack/stackClasses.js +2 -1
  52. package/legacy/ThemeProvider/ThemeProvider.js +1 -1
  53. package/legacy/Unstable_Grid/createGrid.js +10 -5
  54. package/legacy/Unstable_Grid/gridClasses.js +2 -1
  55. package/legacy/breakpoints.js +1 -1
  56. package/legacy/colorManipulator.js +1 -1
  57. package/legacy/createStyled.js +5 -3
  58. package/legacy/createTheme/createTheme.js +1 -1
  59. package/legacy/cssVars/createCssVarsProvider.js +4 -1
  60. package/legacy/cssVars/prepareCssVars.js +21 -12
  61. package/legacy/index.js +2 -1
  62. package/legacy/merge.js +1 -1
  63. package/legacy/propsToClassKey.js +1 -1
  64. package/legacy/style.js +1 -1
  65. package/legacy/styleFunctionSx/extendSxProp.js +1 -1
  66. package/legacy/styleFunctionSx/styleFunctionSx.js +1 -1
  67. package/legacy/useMediaQuery/index.js +2 -0
  68. package/legacy/useMediaQuery/useMediaQuery.js +145 -0
  69. package/legacy/useThemeProps/getThemeProps.js +1 -1
  70. package/merge.js +3 -2
  71. package/modern/Box/Box.js +1 -1
  72. package/modern/Box/boxClasses.js +1 -1
  73. package/modern/Container/containerClasses.js +2 -1
  74. package/modern/Container/createContainer.js +3 -1
  75. package/modern/Stack/createStack.js +3 -1
  76. package/modern/Stack/stackClasses.js +2 -1
  77. package/modern/ThemeProvider/ThemeProvider.js +1 -1
  78. package/modern/Unstable_Grid/createGrid.js +10 -5
  79. package/modern/Unstable_Grid/gridClasses.js +2 -1
  80. package/modern/breakpoints.js +1 -1
  81. package/modern/colorManipulator.js +1 -1
  82. package/modern/createStyled.js +5 -3
  83. package/modern/createTheme/createTheme.js +1 -1
  84. package/modern/cssVars/createCssVarsProvider.js +4 -1
  85. package/modern/cssVars/prepareCssVars.js +17 -12
  86. package/modern/index.js +2 -1
  87. package/modern/merge.js +1 -1
  88. package/modern/propsToClassKey.js +1 -1
  89. package/modern/style.js +1 -1
  90. package/modern/styleFunctionSx/extendSxProp.js +1 -1
  91. package/modern/styleFunctionSx/styleFunctionSx.js +1 -1
  92. package/modern/useMediaQuery/index.js +2 -0
  93. package/modern/useMediaQuery/useMediaQuery.js +126 -0
  94. package/modern/useThemeProps/getThemeProps.js +1 -1
  95. package/package.json +4 -4
  96. package/propsToClassKey.js +3 -3
  97. package/style.js +2 -2
  98. package/styleFunctionSx/extendSxProp.js +2 -2
  99. package/styleFunctionSx/styleFunctionSx.js +2 -2
  100. package/useMediaQuery/index.d.ts +2 -0
  101. package/useMediaQuery/index.js +26 -0
  102. package/useMediaQuery/package.json +6 -0
  103. package/useMediaQuery/useMediaQuery.d.ts +46 -0
  104. package/useMediaQuery/useMediaQuery.js +133 -0
  105. package/useThemeProps/getThemeProps.js +3 -2
@@ -1,22 +1,25 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
3
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- import { deepmerge } from '@mui/utils';
5
+ import deepmerge from '@mui/utils/deepmerge';
5
6
  import cssVarsParser from './cssVarsParser';
6
7
  function prepareCssVars(theme, parserConfig) {
7
8
  // @ts-ignore - ignore components do not exist
8
9
  var _theme$colorSchemes = theme.colorSchemes,
9
10
  colorSchemes = _theme$colorSchemes === void 0 ? {} : _theme$colorSchemes,
10
11
  components = theme.components,
11
- otherTheme = _objectWithoutProperties(theme, ["colorSchemes", "components"]);
12
+ _theme$defaultColorSc = theme.defaultColorScheme,
13
+ defaultColorScheme = _theme$defaultColorSc === void 0 ? 'light' : _theme$defaultColorSc,
14
+ otherTheme = _objectWithoutProperties(theme, ["colorSchemes", "components", "defaultColorScheme"]);
12
15
  var _cssVarsParser = cssVarsParser(otherTheme, parserConfig),
13
16
  rootVars = _cssVarsParser.vars,
14
17
  rootCss = _cssVarsParser.css,
15
18
  rootVarsWithDefaults = _cssVarsParser.varsWithDefaults;
16
19
  var themeVars = rootVarsWithDefaults;
17
20
  var colorSchemesMap = {};
18
- var light = colorSchemes.light,
19
- otherColorSchemes = _objectWithoutProperties(colorSchemes, ["light"]);
21
+ var light = colorSchemes[defaultColorScheme],
22
+ otherColorSchemes = _objectWithoutProperties(colorSchemes, [defaultColorScheme].map(_toPropertyKey));
20
23
  Object.entries(otherColorSchemes || {}).forEach(function (_ref) {
21
24
  var _ref2 = _slicedToArray(_ref, 2),
22
25
  key = _ref2[0],
@@ -32,27 +35,33 @@ function prepareCssVars(theme, parserConfig) {
32
35
  };
33
36
  });
34
37
  if (light) {
35
- // light color scheme vars should be merged last to set as default
38
+ // default color scheme vars should be merged last to set as default
36
39
  var _cssVarsParser3 = cssVarsParser(light, parserConfig),
37
- css = _cssVarsParser3.css,
40
+ _css = _cssVarsParser3.css,
38
41
  vars = _cssVarsParser3.vars,
39
42
  varsWithDefaults = _cssVarsParser3.varsWithDefaults;
40
43
  themeVars = deepmerge(themeVars, varsWithDefaults);
41
- colorSchemesMap.light = {
42
- css: css,
44
+ colorSchemesMap[defaultColorScheme] = {
45
+ css: _css,
43
46
  vars: vars
44
47
  };
45
48
  }
46
49
  var generateCssVars = function generateCssVars(colorScheme) {
50
+ var _parserConfig$getSele2;
47
51
  if (!colorScheme) {
52
+ var _parserConfig$getSele;
53
+ var _css2 = _extends({}, rootCss);
48
54
  return {
49
- css: _extends({}, rootCss),
50
- vars: rootVars
55
+ css: _css2,
56
+ vars: rootVars,
57
+ selector: (parserConfig == null || (_parserConfig$getSele = parserConfig.getSelector) == null ? void 0 : _parserConfig$getSele.call(parserConfig, colorScheme, _css2)) || ':root'
51
58
  };
52
59
  }
60
+ var css = _extends({}, colorSchemesMap[colorScheme].css);
53
61
  return {
54
- css: _extends({}, colorSchemesMap[colorScheme].css),
55
- vars: colorSchemesMap[colorScheme].vars
62
+ css: css,
63
+ vars: colorSchemesMap[colorScheme].vars,
64
+ selector: (parserConfig == null || (_parserConfig$getSele2 = parserConfig.getSelector) == null ? void 0 : _parserConfig$getSele2.call(parserConfig, colorScheme, css)) || ':root'
56
65
  };
57
66
  };
58
67
  return {
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.15.9
2
+ * @mui/system v5.15.12
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -49,6 +49,7 @@ export { default as shape } from './createTheme/shape';
49
49
  export { default as useThemeProps, getThemeProps } from './useThemeProps';
50
50
  export { default as useTheme } from './useTheme';
51
51
  export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
52
+ export { default as useMediaQuery } from './useMediaQuery';
52
53
  export * from './colorManipulator';
53
54
  export { default as ThemeProvider } from './ThemeProvider';
54
55
  export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
package/legacy/merge.js CHANGED
@@ -1,4 +1,4 @@
1
- import { deepmerge } from '@mui/utils';
1
+ import deepmerge from '@mui/utils/deepmerge';
2
2
  function merge(acc, item) {
3
3
  if (!item) {
4
4
  return acc;
@@ -1,5 +1,5 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import { unstable_capitalize as capitalize } from '@mui/utils';
2
+ import capitalize from '@mui/utils/capitalize';
3
3
  function isEmpty(string) {
4
4
  return string.length === 0;
5
5
  }
package/legacy/style.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { unstable_capitalize as capitalize } from '@mui/utils';
2
+ import capitalize from '@mui/utils/capitalize';
3
3
  import responsivePropType from './responsivePropType';
4
4
  import { handleBreakpoints } from './breakpoints';
5
5
  export function getPath(obj, path) {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- import { isPlainObject } from '@mui/utils';
4
+ import { isPlainObject } from '@mui/utils/deepmerge';
5
5
  import defaultSxConfig from './defaultSxConfig';
6
6
  var splitProps = function splitProps(props) {
7
7
  var _props$theme$unstable, _props$theme;
@@ -1,6 +1,6 @@
1
1
  import _typeof from "@babel/runtime/helpers/esm/typeof";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import { unstable_capitalize as capitalize } from '@mui/utils';
3
+ import capitalize from '@mui/utils/capitalize';
4
4
  import merge from '../merge';
5
5
  import { getPath, getStyleValue as getValue } from '../style';
6
6
  import { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from '../breakpoints';
@@ -0,0 +1,2 @@
1
+ export { default } from './useMediaQuery';
2
+ export * from './useMediaQuery';
@@ -0,0 +1,145 @@
1
+ 'use client';
2
+
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import * as React from 'react';
5
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
6
+ import { getThemeProps } from '../useThemeProps';
7
+ import useTheme from '../useThemeWithoutDefault';
8
+
9
+ /**
10
+ * @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
11
+ */
12
+
13
+ /**
14
+ * @deprecated Not used internally. Use `MediaQueryList` from lib.dom.d.ts instead.
15
+ */
16
+
17
+ /**
18
+ * @deprecated Not used internally. Use `(event: MediaQueryListEvent) => void` instead.
19
+ */
20
+
21
+ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
22
+ var _React$useState = React.useState(function () {
23
+ if (noSsr && matchMedia) {
24
+ return matchMedia(query).matches;
25
+ }
26
+ if (ssrMatchMedia) {
27
+ return ssrMatchMedia(query).matches;
28
+ }
29
+
30
+ // Once the component is mounted, we rely on the
31
+ // event listeners to return the correct matches value.
32
+ return defaultMatches;
33
+ }),
34
+ match = _React$useState[0],
35
+ setMatch = _React$useState[1];
36
+ useEnhancedEffect(function () {
37
+ var active = true;
38
+ if (!matchMedia) {
39
+ return undefined;
40
+ }
41
+ var queryList = matchMedia(query);
42
+ var updateMatch = function updateMatch() {
43
+ // Workaround Safari wrong implementation of matchMedia
44
+ // TODO can we remove it?
45
+ // https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
46
+ if (active) {
47
+ setMatch(queryList.matches);
48
+ }
49
+ };
50
+ updateMatch();
51
+ // TODO: Use `addEventListener` once support for Safari < 14 is dropped
52
+ queryList.addListener(updateMatch);
53
+ return function () {
54
+ active = false;
55
+ queryList.removeListener(updateMatch);
56
+ };
57
+ }, [query, matchMedia]);
58
+ return match;
59
+ }
60
+
61
+ // eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
62
+ var maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
63
+ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
64
+ var getDefaultSnapshot = React.useCallback(function () {
65
+ return defaultMatches;
66
+ }, [defaultMatches]);
67
+ var getServerSnapshot = React.useMemo(function () {
68
+ if (noSsr && matchMedia) {
69
+ return function () {
70
+ return matchMedia(query).matches;
71
+ };
72
+ }
73
+ if (ssrMatchMedia !== null) {
74
+ var _ssrMatchMedia = ssrMatchMedia(query),
75
+ matches = _ssrMatchMedia.matches;
76
+ return function () {
77
+ return matches;
78
+ };
79
+ }
80
+ return getDefaultSnapshot;
81
+ }, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
82
+ var _React$useMemo = React.useMemo(function () {
83
+ if (matchMedia === null) {
84
+ return [getDefaultSnapshot, function () {
85
+ return function () {};
86
+ }];
87
+ }
88
+ var mediaQueryList = matchMedia(query);
89
+ return [function () {
90
+ return mediaQueryList.matches;
91
+ }, function (notify) {
92
+ // TODO: Use `addEventListener` once support for Safari < 14 is dropped
93
+ mediaQueryList.addListener(notify);
94
+ return function () {
95
+ mediaQueryList.removeListener(notify);
96
+ };
97
+ }];
98
+ }, [getDefaultSnapshot, matchMedia, query]),
99
+ _React$useMemo2 = _slicedToArray(_React$useMemo, 2),
100
+ getSnapshot = _React$useMemo2[0],
101
+ subscribe = _React$useMemo2[1];
102
+ var match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
103
+ return match;
104
+ }
105
+ export default function useMediaQuery(queryInput) {
106
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
107
+ var theme = useTheme();
108
+ // Wait for jsdom to support the match media feature.
109
+ // All the browsers MUI support have this built-in.
110
+ // This defensive check is here for simplicity.
111
+ // Most of the time, the match media logic isn't central to people tests.
112
+ var supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
113
+ var _getThemeProps = getThemeProps({
114
+ name: 'MuiUseMediaQuery',
115
+ props: options,
116
+ theme: theme
117
+ }),
118
+ _getThemeProps$defaul = _getThemeProps.defaultMatches,
119
+ defaultMatches = _getThemeProps$defaul === void 0 ? false : _getThemeProps$defaul,
120
+ _getThemeProps$matchM = _getThemeProps.matchMedia,
121
+ matchMedia = _getThemeProps$matchM === void 0 ? supportMatchMedia ? window.matchMedia : null : _getThemeProps$matchM,
122
+ _getThemeProps$ssrMat = _getThemeProps.ssrMatchMedia,
123
+ ssrMatchMedia = _getThemeProps$ssrMat === void 0 ? null : _getThemeProps$ssrMat,
124
+ _getThemeProps$noSsr = _getThemeProps.noSsr,
125
+ noSsr = _getThemeProps$noSsr === void 0 ? false : _getThemeProps$noSsr;
126
+ if (process.env.NODE_ENV !== 'production') {
127
+ if (typeof queryInput === 'function' && theme === null) {
128
+ console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
129
+ }
130
+ }
131
+ var query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
132
+ query = query.replace(/^@media( ?)/m, '');
133
+
134
+ // TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
135
+ var useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
136
+ var match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
137
+ if (process.env.NODE_ENV !== 'production') {
138
+ // eslint-disable-next-line react-hooks/rules-of-hooks
139
+ React.useDebugValue({
140
+ query: query,
141
+ match: match
142
+ });
143
+ }
144
+ return match;
145
+ }
@@ -1,4 +1,4 @@
1
- import { internal_resolveProps as resolveProps } from '@mui/utils';
1
+ import resolveProps from '@mui/utils/resolveProps';
2
2
  export default function getThemeProps(params) {
3
3
  var theme = params.theme,
4
4
  name = params.name,
package/merge.js CHANGED
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
- var _utils = require("@mui/utils");
8
+ var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
8
9
  function merge(acc, item) {
9
10
  if (!item) {
10
11
  return acc;
11
12
  }
12
- return (0, _utils.deepmerge)(acc, item, {
13
+ return (0, _deepmerge.default)(acc, item, {
13
14
  clone: false // No need to clone deep, it's way faster.
14
15
  });
15
16
  }
package/modern/Box/Box.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import PropTypes from 'prop-types';
4
- import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/utils';
4
+ import ClassNameGenerator from '@mui/utils/ClassNameGenerator';
5
5
  import createBox from '../createBox';
6
6
  import boxClasses from './boxClasses';
7
7
  const Box = createBox({
@@ -1,3 +1,3 @@
1
- import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
1
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
2
  const boxClasses = generateUtilityClasses('MuiBox', ['root']);
3
3
  export default boxClasses;
@@ -1,4 +1,5 @@
1
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
1
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
3
  export function getContainerUtilityClass(slot) {
3
4
  return generateUtilityClass('MuiContainer', slot);
4
5
  }
@@ -4,7 +4,9 @@ const _excluded = ["className", "component", "disableGutters", "fixed", "maxWidt
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
- import { unstable_capitalize as capitalize, unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
7
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
+ import composeClasses from '@mui/utils/composeClasses';
9
+ import capitalize from '@mui/utils/capitalize';
8
10
  import useThemePropsSystem from '../useThemeProps';
9
11
  import systemStyled from '../styled';
10
12
  import createTheme from '../createTheme';
@@ -4,7 +4,9 @@ const _excluded = ["component", "direction", "spacing", "divider", "children", "
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
- import { deepmerge, unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
7
+ import deepmerge from '@mui/utils/deepmerge';
8
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
9
+ import composeClasses from '@mui/utils/composeClasses';
8
10
  import systemStyled from '../styled';
9
11
  import useThemePropsSystem from '../useThemeProps';
10
12
  import { extendSxProp } from '../styleFunctionSx';
@@ -1,4 +1,5 @@
1
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
1
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
3
  export function getStackUtilityClass(slot) {
3
4
  return generateUtilityClass('MuiStack', slot);
4
5
  }
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
7
- import { exactProp } from '@mui/utils';
7
+ import exactProp from '@mui/utils/exactProp';
8
8
  import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
9
9
  import useThemeWithoutDefault from '../useThemeWithoutDefault';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -4,7 +4,9 @@ const _excluded = ["className", "children", "columns", "container", "component",
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
- import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_isMuiElement as isMuiElement } from '@mui/utils';
7
+ import isMuiElement from '@mui/utils/isMuiElement';
8
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
9
+ import composeClasses from '@mui/utils/composeClasses';
8
10
  import systemStyled from '../styled';
9
11
  import useThemePropsSystem from '../useThemeProps';
10
12
  import useTheme from '../useTheme';
@@ -34,7 +36,10 @@ export default function createGrid(options = {}) {
34
36
  useThemeProps = useThemePropsDefault,
35
37
  componentName = 'MuiGrid'
36
38
  } = options;
37
- const OverflowContext = /*#__PURE__*/React.createContext(undefined);
39
+ const GridOverflowContext = /*#__PURE__*/React.createContext(undefined);
40
+ if (process.env.NODE_ENV !== 'production') {
41
+ GridOverflowContext.displayName = 'GridOverflowContext';
42
+ }
38
43
  const useUtilityClasses = (ownerState, theme) => {
39
44
  const {
40
45
  container,
@@ -53,7 +58,7 @@ export default function createGrid(options = {}) {
53
58
  const theme = useTheme();
54
59
  const themeProps = useThemeProps(inProps);
55
60
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
56
- const overflow = React.useContext(OverflowContext);
61
+ const overflow = React.useContext(GridOverflowContext);
57
62
  const {
58
63
  className,
59
64
  children,
@@ -123,10 +128,10 @@ export default function createGrid(options = {}) {
123
128
  })
124
129
  }));
125
130
  if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
126
- // There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
131
+ // There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
127
132
  // 1. It is the root grid with `disableEqualOverflow`.
128
133
  // 2. It is a nested grid with different `disableEqualOverflow` from the context.
129
- result = /*#__PURE__*/_jsx(OverflowContext.Provider, {
134
+ result = /*#__PURE__*/_jsx(GridOverflowContext.Provider, {
130
135
  value: disableEqualOverflow,
131
136
  children: result
132
137
  });
@@ -1,4 +1,5 @@
1
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
1
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
3
  export function getGridUtilityClass(slot) {
3
4
  return generateUtilityClass('MuiGrid', slot);
4
5
  }
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import PropTypes from 'prop-types';
3
- import { deepmerge } from '@mui/utils';
3
+ import deepmerge from '@mui/utils/deepmerge';
4
4
  import merge from './merge';
5
5
 
6
6
  // The breakpoint **start** at this value.
@@ -1,6 +1,6 @@
1
1
  import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
- import { clamp } from '@mui/utils';
3
+ import clamp from '@mui/utils/clamp';
4
4
  /**
5
5
  * Returns a number whose value is limited to the given range.
6
6
  * @param {number} value The value to be clamped
@@ -5,7 +5,9 @@ const _excluded = ["ownerState"],
5
5
  _excluded3 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
6
6
  /* eslint-disable no-underscore-dangle */
7
7
  import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
8
- import { getDisplayName, unstable_capitalize as capitalize, isPlainObject } from '@mui/utils';
8
+ import { isPlainObject } from '@mui/utils/deepmerge';
9
+ import capitalize from '@mui/utils/capitalize';
10
+ import getDisplayName from '@mui/utils/getDisplayName';
9
11
  import createTheme from './createTheme';
10
12
  import styleFunctionSx from './styleFunctionSx';
11
13
  function isEmpty(obj) {
@@ -69,7 +71,7 @@ function processStyleArg(callableStyle, _ref) {
69
71
  if (typeof variant.props === 'function') {
70
72
  isMatch = variant.props(_extends({
71
73
  ownerState
72
- }, props));
74
+ }, props, ownerState));
73
75
  } else {
74
76
  Object.keys(variant.props).forEach(key => {
75
77
  if (ownerState?.[key] !== variant.props[key] && props[key] !== variant.props[key]) {
@@ -83,7 +85,7 @@ function processStyleArg(callableStyle, _ref) {
83
85
  }
84
86
  result.push(typeof variant.style === 'function' ? variant.style(_extends({
85
87
  ownerState
86
- }, props)) : variant.style);
88
+ }, props, ownerState)) : variant.style);
87
89
  }
88
90
  });
89
91
  return result;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["breakpoints", "palette", "spacing", "shape"];
4
- import { deepmerge } from '@mui/utils';
4
+ import deepmerge from '@mui/utils/deepmerge';
5
5
  import createBreakpoints from './createBreakpoints';
6
6
  import shape from './shape';
7
7
  import createSpacing from './createSpacing';
@@ -4,7 +4,7 @@ import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
4
4
  const _excluded = ["colorSchemes", "components", "generateCssVars", "cssVarPrefix"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
- import { deepmerge } from '@mui/utils';
7
+ import deepmerge from '@mui/utils/deepmerge';
8
8
  import { GlobalStyles } from '@mui/styled-engine';
9
9
  import { useTheme as muiUseTheme } from '@mui/private-theming';
10
10
  import ThemeProvider from '../ThemeProvider';
@@ -36,6 +36,9 @@ export default function createCssVarsProvider(options) {
36
36
  console.error(`MUI: \`${designSystemColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
37
37
  }
38
38
  const ColorSchemeContext = /*#__PURE__*/React.createContext(undefined);
39
+ if (process.env.NODE_ENV !== 'production') {
40
+ ColorSchemeContext.displayName = 'ColorSchemeContext';
41
+ }
39
42
  const useColorScheme = () => {
40
43
  const value = React.useContext(ColorSchemeContext);
41
44
  if (!value) {
@@ -1,13 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
2
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["colorSchemes", "components"],
4
- _excluded2 = ["light"];
5
- import { deepmerge } from '@mui/utils';
4
+ const _excluded = ["colorSchemes", "components", "defaultColorScheme"];
5
+ import deepmerge from '@mui/utils/deepmerge';
6
6
  import cssVarsParser from './cssVarsParser';
7
7
  function prepareCssVars(theme, parserConfig) {
8
8
  // @ts-ignore - ignore components do not exist
9
9
  const {
10
- colorSchemes = {}
10
+ colorSchemes = {},
11
+ defaultColorScheme = 'light'
11
12
  } = theme,
12
13
  otherTheme = _objectWithoutPropertiesLoose(theme, _excluded);
13
14
  const {
@@ -18,9 +19,9 @@ function prepareCssVars(theme, parserConfig) {
18
19
  let themeVars = rootVarsWithDefaults;
19
20
  const colorSchemesMap = {};
20
21
  const {
21
- light
22
+ [defaultColorScheme]: light
22
23
  } = colorSchemes,
23
- otherColorSchemes = _objectWithoutPropertiesLoose(colorSchemes, _excluded2);
24
+ otherColorSchemes = _objectWithoutPropertiesLoose(colorSchemes, [defaultColorScheme].map(_toPropertyKey));
24
25
  Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
25
26
  const {
26
27
  vars,
@@ -34,28 +35,32 @@ function prepareCssVars(theme, parserConfig) {
34
35
  };
35
36
  });
36
37
  if (light) {
37
- // light color scheme vars should be merged last to set as default
38
+ // default color scheme vars should be merged last to set as default
38
39
  const {
39
40
  css,
40
41
  vars,
41
42
  varsWithDefaults
42
43
  } = cssVarsParser(light, parserConfig);
43
44
  themeVars = deepmerge(themeVars, varsWithDefaults);
44
- colorSchemesMap.light = {
45
+ colorSchemesMap[defaultColorScheme] = {
45
46
  css,
46
47
  vars
47
48
  };
48
49
  }
49
50
  const generateCssVars = colorScheme => {
50
51
  if (!colorScheme) {
52
+ const css = _extends({}, rootCss);
51
53
  return {
52
- css: _extends({}, rootCss),
53
- vars: rootVars
54
+ css,
55
+ vars: rootVars,
56
+ selector: parserConfig?.getSelector?.(colorScheme, css) || ':root'
54
57
  };
55
58
  }
59
+ const css = _extends({}, colorSchemesMap[colorScheme].css);
56
60
  return {
57
- css: _extends({}, colorSchemesMap[colorScheme].css),
58
- vars: colorSchemesMap[colorScheme].vars
61
+ css,
62
+ vars: colorSchemesMap[colorScheme].vars,
63
+ selector: parserConfig?.getSelector?.(colorScheme, css) || ':root'
59
64
  };
60
65
  };
61
66
  return {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.15.9
2
+ * @mui/system v5.15.12
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -49,6 +49,7 @@ export { default as shape } from './createTheme/shape';
49
49
  export { default as useThemeProps, getThemeProps } from './useThemeProps';
50
50
  export { default as useTheme } from './useTheme';
51
51
  export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
52
+ export { default as useMediaQuery } from './useMediaQuery';
52
53
  export * from './colorManipulator';
53
54
  export { default as ThemeProvider } from './ThemeProvider';
54
55
  export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
package/modern/merge.js CHANGED
@@ -1,4 +1,4 @@
1
- import { deepmerge } from '@mui/utils';
1
+ import deepmerge from '@mui/utils/deepmerge';
2
2
  function merge(acc, item) {
3
3
  if (!item) {
4
4
  return acc;
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  const _excluded = ["variant"];
3
- import { unstable_capitalize as capitalize } from '@mui/utils';
3
+ import capitalize from '@mui/utils/capitalize';
4
4
  function isEmpty(string) {
5
5
  return string.length === 0;
6
6
  }
package/modern/style.js CHANGED
@@ -1,4 +1,4 @@
1
- import { unstable_capitalize as capitalize } from '@mui/utils';
1
+ import capitalize from '@mui/utils/capitalize';
2
2
  import responsivePropType from './responsivePropType';
3
3
  import { handleBreakpoints } from './breakpoints';
4
4
  export function getPath(obj, path, checkVars = true) {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["sx"];
4
- import { isPlainObject } from '@mui/utils';
4
+ import { isPlainObject } from '@mui/utils/deepmerge';
5
5
  import defaultSxConfig from './defaultSxConfig';
6
6
  const splitProps = props => {
7
7
  const result = {
@@ -1,4 +1,4 @@
1
- import { unstable_capitalize as capitalize } from '@mui/utils';
1
+ import capitalize from '@mui/utils/capitalize';
2
2
  import merge from '../merge';
3
3
  import { getPath, getStyleValue as getValue } from '../style';
4
4
  import { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from '../breakpoints';
@@ -0,0 +1,2 @@
1
+ export { default } from './useMediaQuery';
2
+ export * from './useMediaQuery';