@mui/system 5.15.8 → 5.15.11

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 (107) hide show
  1. package/Box/Box.d.ts +2 -3
  2. package/Box/Box.js +2 -2
  3. package/Box/boxClasses.js +3 -2
  4. package/CHANGELOG.md +222 -23
  5. package/Container/containerClasses.js +5 -3
  6. package/Container/createContainer.js +7 -5
  7. package/Stack/createStack.js +5 -3
  8. package/Stack/stackClasses.js +5 -3
  9. package/ThemeProvider/ThemeProvider.js +2 -2
  10. package/Unstable_Grid/createGrid.js +12 -7
  11. package/Unstable_Grid/gridClasses.js +5 -3
  12. package/breakpoints.js +2 -2
  13. package/colorManipulator.js +2 -2
  14. package/createStyled.js +8 -6
  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 +6 -6
  96. package/propsToClassKey.js +3 -3
  97. package/spacing.d.ts +10 -10
  98. package/style.js +2 -2
  99. package/styleFunctionSx/extendSxProp.js +2 -2
  100. package/styleFunctionSx/styleFunctionSx.d.ts +1 -1
  101. package/styleFunctionSx/styleFunctionSx.js +2 -2
  102. package/useMediaQuery/index.d.ts +2 -0
  103. package/useMediaQuery/index.js +26 -0
  104. package/useMediaQuery/package.json +6 -0
  105. package/useMediaQuery/useMediaQuery.d.ts +46 -0
  106. package/useMediaQuery/useMediaQuery.js +133 -0
  107. package/useThemeProps/getThemeProps.js +3 -2
@@ -0,0 +1,126 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
5
+ import { getThemeProps } from '../useThemeProps';
6
+ import useTheme from '../useThemeWithoutDefault';
7
+
8
+ /**
9
+ * @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
10
+ */
11
+
12
+ /**
13
+ * @deprecated Not used internally. Use `MediaQueryList` from lib.dom.d.ts instead.
14
+ */
15
+
16
+ /**
17
+ * @deprecated Not used internally. Use `(event: MediaQueryListEvent) => void` instead.
18
+ */
19
+
20
+ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
21
+ const [match, setMatch] = React.useState(() => {
22
+ if (noSsr && matchMedia) {
23
+ return matchMedia(query).matches;
24
+ }
25
+ if (ssrMatchMedia) {
26
+ return ssrMatchMedia(query).matches;
27
+ }
28
+
29
+ // Once the component is mounted, we rely on the
30
+ // event listeners to return the correct matches value.
31
+ return defaultMatches;
32
+ });
33
+ useEnhancedEffect(() => {
34
+ let active = true;
35
+ if (!matchMedia) {
36
+ return undefined;
37
+ }
38
+ const queryList = matchMedia(query);
39
+ const updateMatch = () => {
40
+ // Workaround Safari wrong implementation of matchMedia
41
+ // TODO can we remove it?
42
+ // https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
43
+ if (active) {
44
+ setMatch(queryList.matches);
45
+ }
46
+ };
47
+ updateMatch();
48
+ // TODO: Use `addEventListener` once support for Safari < 14 is dropped
49
+ queryList.addListener(updateMatch);
50
+ return () => {
51
+ active = false;
52
+ queryList.removeListener(updateMatch);
53
+ };
54
+ }, [query, matchMedia]);
55
+ return match;
56
+ }
57
+
58
+ // eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
59
+ const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
60
+ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
61
+ const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
62
+ const getServerSnapshot = React.useMemo(() => {
63
+ if (noSsr && matchMedia) {
64
+ return () => matchMedia(query).matches;
65
+ }
66
+ if (ssrMatchMedia !== null) {
67
+ const {
68
+ matches
69
+ } = ssrMatchMedia(query);
70
+ return () => matches;
71
+ }
72
+ return getDefaultSnapshot;
73
+ }, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
74
+ const [getSnapshot, subscribe] = React.useMemo(() => {
75
+ if (matchMedia === null) {
76
+ return [getDefaultSnapshot, () => () => {}];
77
+ }
78
+ const mediaQueryList = matchMedia(query);
79
+ return [() => mediaQueryList.matches, notify => {
80
+ // TODO: Use `addEventListener` once support for Safari < 14 is dropped
81
+ mediaQueryList.addListener(notify);
82
+ return () => {
83
+ mediaQueryList.removeListener(notify);
84
+ };
85
+ }];
86
+ }, [getDefaultSnapshot, matchMedia, query]);
87
+ const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
88
+ return match;
89
+ }
90
+ export default function useMediaQuery(queryInput, options = {}) {
91
+ const theme = useTheme();
92
+ // Wait for jsdom to support the match media feature.
93
+ // All the browsers MUI support have this built-in.
94
+ // This defensive check is here for simplicity.
95
+ // Most of the time, the match media logic isn't central to people tests.
96
+ const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
97
+ const {
98
+ defaultMatches = false,
99
+ matchMedia = supportMatchMedia ? window.matchMedia : null,
100
+ ssrMatchMedia = null,
101
+ noSsr = false
102
+ } = getThemeProps({
103
+ name: 'MuiUseMediaQuery',
104
+ props: options,
105
+ theme
106
+ });
107
+ if (process.env.NODE_ENV !== 'production') {
108
+ if (typeof queryInput === 'function' && theme === null) {
109
+ 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'));
110
+ }
111
+ }
112
+ let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
113
+ query = query.replace(/^@media( ?)/m, '');
114
+
115
+ // TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
116
+ const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
117
+ const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
118
+ if (process.env.NODE_ENV !== 'production') {
119
+ // eslint-disable-next-line react-hooks/rules-of-hooks
120
+ React.useDebugValue({
121
+ query,
122
+ match
123
+ });
124
+ }
125
+ return match;
126
+ }
@@ -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
  const {
4
4
  theme,
package/index.d.ts CHANGED
@@ -153,6 +153,9 @@ export * from './useTheme';
153
153
  export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
154
154
  export * from './useThemeWithoutDefault';
155
155
 
156
+ export { default as useMediaQuery } from './useMediaQuery';
157
+ export * from './useMediaQuery';
158
+
156
159
  export * from './colorManipulator';
157
160
 
158
161
  export { default as ThemeProvider } from './ThemeProvider';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v5.15.8
2
+ * @mui/system v5.15.11
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -52,6 +52,7 @@ var _exportNames = {
52
52
  getThemeProps: true,
53
53
  useTheme: true,
54
54
  useThemeWithoutDefault: true,
55
+ useMediaQuery: true,
55
56
  ThemeProvider: true,
56
57
  unstable_createCssVarsProvider: true,
57
58
  unstable_createGetCssVar: true,
@@ -347,6 +348,12 @@ Object.defineProperty(exports, "unstable_styleFunctionSx", {
347
348
  return _styleFunctionSx.default;
348
349
  }
349
350
  });
351
+ Object.defineProperty(exports, "useMediaQuery", {
352
+ enumerable: true,
353
+ get: function () {
354
+ return _useMediaQuery.default;
355
+ }
356
+ });
350
357
  Object.defineProperty(exports, "useTheme", {
351
358
  enumerable: true,
352
359
  get: function () {
@@ -493,6 +500,7 @@ var _shape = _interopRequireDefault(require("./createTheme/shape"));
493
500
  var _useThemeProps = _interopRequireWildcard(require("./useThemeProps"));
494
501
  var _useTheme = _interopRequireDefault(require("./useTheme"));
495
502
  var _useThemeWithoutDefault = _interopRequireDefault(require("./useThemeWithoutDefault"));
503
+ var _useMediaQuery = _interopRequireDefault(require("./useMediaQuery"));
496
504
  var _colorManipulator = require("./colorManipulator");
497
505
  Object.keys(_colorManipulator).forEach(function (key) {
498
506
  if (key === "default" || key === "__esModule") return;
package/legacy/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
  var Box = createBox({
@@ -1,3 +1,3 @@
1
- import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
1
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
2
  var 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 @@ 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 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';
@@ -5,7 +5,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import clsx from 'clsx';
8
- import { deepmerge, unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
8
+ import deepmerge from '@mui/utils/deepmerge';
9
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
10
+ import composeClasses from '@mui/utils/composeClasses';
9
11
  import systemStyled from '../styled';
10
12
  import useThemePropsSystem from '../useThemeProps';
11
13
  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
  }
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
8
- import { exactProp } from '@mui/utils';
8
+ import exactProp from '@mui/utils/exactProp';
9
9
  import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
10
10
  import useThemeWithoutDefault from '../useThemeWithoutDefault';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -5,7 +5,9 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import clsx from 'clsx';
8
- import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_isMuiElement as isMuiElement } from '@mui/utils';
8
+ import isMuiElement from '@mui/utils/isMuiElement';
9
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
10
+ import composeClasses from '@mui/utils/composeClasses';
9
11
  import systemStyled from '../styled';
10
12
  import useThemePropsSystem from '../useThemeProps';
11
13
  import useTheme from '../useTheme';
@@ -38,7 +40,10 @@ export default function createGrid() {
38
40
  useThemeProps = _options$useThemeProp === void 0 ? useThemePropsDefault : _options$useThemeProp,
39
41
  _options$componentNam = options.componentName,
40
42
  componentName = _options$componentNam === void 0 ? 'MuiGrid' : _options$componentNam;
41
- var OverflowContext = /*#__PURE__*/React.createContext(undefined);
43
+ var GridOverflowContext = /*#__PURE__*/React.createContext(undefined);
44
+ if (process.env.NODE_ENV !== 'production') {
45
+ GridOverflowContext.displayName = 'GridOverflowContext';
46
+ }
42
47
  var useUtilityClasses = function useUtilityClasses(ownerState, theme) {
43
48
  var container = ownerState.container,
44
49
  direction = ownerState.direction,
@@ -58,7 +63,7 @@ export default function createGrid() {
58
63
  var theme = useTheme();
59
64
  var themeProps = useThemeProps(inProps);
60
65
  var props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
61
- var overflow = React.useContext(OverflowContext);
66
+ var overflow = React.useContext(GridOverflowContext);
62
67
  var className = props.className,
63
68
  children = props.children,
64
69
  _props$columns = props.columns,
@@ -138,10 +143,10 @@ export default function createGrid() {
138
143
  })
139
144
  }));
140
145
  if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
141
- // There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
146
+ // There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
142
147
  // 1. It is the root grid with `disableEqualOverflow`.
143
148
  // 2. It is a nested grid with different `disableEqualOverflow` from the context.
144
- result = /*#__PURE__*/_jsx(OverflowContext.Provider, {
149
+ result = /*#__PURE__*/_jsx(GridOverflowContext.Provider, {
145
150
  value: disableEqualOverflow,
146
151
  children: result
147
152
  });
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
4
  export function getGridUtilityClass(slot) {
4
5
  return generateUtilityClass('MuiGrid', slot);
5
6
  }
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _typeof from "@babel/runtime/helpers/esm/typeof";
4
4
  import PropTypes from 'prop-types';
5
- import { deepmerge } from '@mui/utils';
5
+ import deepmerge from '@mui/utils/deepmerge';
6
6
  import merge from './merge';
7
7
 
8
8
  // 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 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
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, _ref2) {
69
71
  if (typeof variant.props === 'function') {
70
72
  isMatch = variant.props(_extends({
71
73
  ownerState: ownerState
72
- }, props));
74
+ }, props, ownerState));
73
75
  } else {
74
76
  Object.keys(variant.props).forEach(function (key) {
75
77
  if ((ownerState == null ? void 0 : ownerState[key]) !== variant.props[key] && props[key] !== variant.props[key]) {
@@ -83,7 +85,7 @@ function processStyleArg(callableStyle, _ref2) {
83
85
  }
84
86
  result.push(typeof variant.style === 'function' ? variant.style(_extends({
85
87
  ownerState: ownerState
86
- }, props)) : variant.style);
88
+ }, props, ownerState)) : variant.style);
87
89
  }
88
90
  });
89
91
  return result;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import { deepmerge } from '@mui/utils';
3
+ import deepmerge from '@mui/utils/deepmerge';
4
4
  import createBreakpoints from './createBreakpoints';
5
5
  import shape from './shape';
6
6
  import createSpacing from './createSpacing';
@@ -6,7 +6,7 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
6
6
  import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
- import { deepmerge } from '@mui/utils';
9
+ import deepmerge from '@mui/utils/deepmerge';
10
10
  import { GlobalStyles } from '@mui/styled-engine';
11
11
  import { useTheme as muiUseTheme } from '@mui/private-theming';
12
12
  import ThemeProvider from '../ThemeProvider';
@@ -36,6 +36,9 @@ export default function createCssVarsProvider(options) {
36
36
  console.error("MUI: `".concat(designSystemColorScheme, "` does not exist in `theme.colorSchemes`."));
37
37
  }
38
38
  var ColorSchemeContext = /*#__PURE__*/React.createContext(undefined);
39
+ if (process.env.NODE_ENV !== 'production') {
40
+ ColorSchemeContext.displayName = 'ColorSchemeContext';
41
+ }
39
42
  var useColorScheme = function useColorScheme() {
40
43
  var value = React.useContext(ColorSchemeContext);
41
44
  if (!value) {
@@ -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.8
2
+ * @mui/system v5.15.11
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';