@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.
- package/Box/Box.js +2 -2
- package/Box/boxClasses.js +3 -2
- package/CHANGELOG.md +375 -133
- package/Container/containerClasses.js +5 -3
- package/Container/createContainer.js +7 -5
- package/Stack/createStack.js +5 -3
- package/Stack/stackClasses.js +5 -3
- package/ThemeProvider/ThemeProvider.js +2 -2
- package/Unstable_Grid/createGrid.js +12 -7
- package/Unstable_Grid/gridClasses.js +5 -3
- package/breakpoints.js +2 -2
- package/colorManipulator.js +2 -2
- package/createStyled.js +8 -6
- package/createTheme/createSpacing.d.ts +1 -1
- package/createTheme/createTheme.js +3 -3
- package/cssVars/createCssVarsProvider.js +6 -3
- package/cssVars/createCssVarsTheme.d.ts +1 -0
- package/cssVars/prepareCssVars.d.ts +5 -2
- package/cssVars/prepareCssVars.js +21 -14
- package/esm/Box/Box.js +1 -1
- package/esm/Box/boxClasses.js +1 -1
- package/esm/Container/containerClasses.js +2 -1
- package/esm/Container/createContainer.js +3 -1
- package/esm/Stack/createStack.js +3 -1
- package/esm/Stack/stackClasses.js +2 -1
- package/esm/ThemeProvider/ThemeProvider.js +1 -1
- package/esm/Unstable_Grid/createGrid.js +10 -5
- package/esm/Unstable_Grid/gridClasses.js +2 -1
- package/esm/breakpoints.js +1 -1
- package/esm/colorManipulator.js +1 -1
- package/esm/createStyled.js +5 -3
- package/esm/createTheme/createTheme.js +1 -1
- package/esm/cssVars/createCssVarsProvider.js +4 -1
- package/esm/cssVars/prepareCssVars.js +19 -12
- package/esm/index.js +1 -0
- package/esm/merge.js +1 -1
- package/esm/propsToClassKey.js +1 -1
- package/esm/style.js +1 -1
- package/esm/styleFunctionSx/extendSxProp.js +1 -1
- package/esm/styleFunctionSx/styleFunctionSx.js +1 -1
- package/esm/useMediaQuery/index.js +2 -0
- package/esm/useMediaQuery/useMediaQuery.js +126 -0
- package/esm/useThemeProps/getThemeProps.js +1 -1
- package/index.d.ts +3 -0
- package/index.js +9 -1
- package/legacy/Box/Box.js +1 -1
- package/legacy/Box/boxClasses.js +1 -1
- package/legacy/Container/containerClasses.js +2 -1
- package/legacy/Container/createContainer.js +3 -1
- package/legacy/Stack/createStack.js +3 -1
- package/legacy/Stack/stackClasses.js +2 -1
- package/legacy/ThemeProvider/ThemeProvider.js +1 -1
- package/legacy/Unstable_Grid/createGrid.js +10 -5
- package/legacy/Unstable_Grid/gridClasses.js +2 -1
- package/legacy/breakpoints.js +1 -1
- package/legacy/colorManipulator.js +1 -1
- package/legacy/createStyled.js +5 -3
- package/legacy/createTheme/createTheme.js +1 -1
- package/legacy/cssVars/createCssVarsProvider.js +4 -1
- package/legacy/cssVars/prepareCssVars.js +21 -12
- package/legacy/index.js +2 -1
- package/legacy/merge.js +1 -1
- package/legacy/propsToClassKey.js +1 -1
- package/legacy/style.js +1 -1
- package/legacy/styleFunctionSx/extendSxProp.js +1 -1
- package/legacy/styleFunctionSx/styleFunctionSx.js +1 -1
- package/legacy/useMediaQuery/index.js +2 -0
- package/legacy/useMediaQuery/useMediaQuery.js +145 -0
- package/legacy/useThemeProps/getThemeProps.js +1 -1
- package/merge.js +3 -2
- package/modern/Box/Box.js +1 -1
- package/modern/Box/boxClasses.js +1 -1
- package/modern/Container/containerClasses.js +2 -1
- package/modern/Container/createContainer.js +3 -1
- package/modern/Stack/createStack.js +3 -1
- package/modern/Stack/stackClasses.js +2 -1
- package/modern/ThemeProvider/ThemeProvider.js +1 -1
- package/modern/Unstable_Grid/createGrid.js +10 -5
- package/modern/Unstable_Grid/gridClasses.js +2 -1
- package/modern/breakpoints.js +1 -1
- package/modern/colorManipulator.js +1 -1
- package/modern/createStyled.js +5 -3
- package/modern/createTheme/createTheme.js +1 -1
- package/modern/cssVars/createCssVarsProvider.js +4 -1
- package/modern/cssVars/prepareCssVars.js +17 -12
- package/modern/index.js +2 -1
- package/modern/merge.js +1 -1
- package/modern/propsToClassKey.js +1 -1
- package/modern/style.js +1 -1
- package/modern/styleFunctionSx/extendSxProp.js +1 -1
- package/modern/styleFunctionSx/styleFunctionSx.js +1 -1
- package/modern/useMediaQuery/index.js +2 -0
- package/modern/useMediaQuery/useMediaQuery.js +126 -0
- package/modern/useThemeProps/getThemeProps.js +1 -1
- package/package.json +4 -4
- package/propsToClassKey.js +3 -3
- package/style.js +2 -2
- package/styleFunctionSx/extendSxProp.js +2 -2
- package/styleFunctionSx/styleFunctionSx.js +2 -2
- package/useMediaQuery/index.d.ts +2 -0
- package/useMediaQuery/index.js +26 -0
- package/useMediaQuery/package.json +6 -0
- package/useMediaQuery/useMediaQuery.d.ts +46 -0
- package/useMediaQuery/useMediaQuery.js +133 -0
- package/useThemeProps/getThemeProps.js +3 -2
package/esm/colorManipulator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
import
|
|
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
|
package/esm/createStyled.js
CHANGED
|
@@ -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 {
|
|
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 == null ? void 0 : 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
|
|
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
|
|
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
|
-
|
|
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,
|
|
24
|
+
otherColorSchemes = _objectWithoutPropertiesLoose(colorSchemes, [defaultColorScheme].map(_toPropertyKey));
|
|
24
25
|
Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
|
|
25
26
|
const {
|
|
26
27
|
vars,
|
|
@@ -34,28 +35,34 @@ function prepareCssVars(theme, parserConfig) {
|
|
|
34
35
|
};
|
|
35
36
|
});
|
|
36
37
|
if (light) {
|
|
37
|
-
//
|
|
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
|
|
45
|
+
colorSchemesMap[defaultColorScheme] = {
|
|
45
46
|
css,
|
|
46
47
|
vars
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
const generateCssVars = colorScheme => {
|
|
51
|
+
var _parserConfig$getSele2;
|
|
50
52
|
if (!colorScheme) {
|
|
53
|
+
var _parserConfig$getSele;
|
|
54
|
+
const css = _extends({}, rootCss);
|
|
51
55
|
return {
|
|
52
|
-
css
|
|
53
|
-
vars: rootVars
|
|
56
|
+
css,
|
|
57
|
+
vars: rootVars,
|
|
58
|
+
selector: (parserConfig == null || (_parserConfig$getSele = parserConfig.getSelector) == null ? void 0 : _parserConfig$getSele.call(parserConfig, colorScheme, css)) || ':root'
|
|
54
59
|
};
|
|
55
60
|
}
|
|
61
|
+
const css = _extends({}, colorSchemesMap[colorScheme].css);
|
|
56
62
|
return {
|
|
57
|
-
css
|
|
58
|
-
vars: colorSchemesMap[colorScheme].vars
|
|
63
|
+
css,
|
|
64
|
+
vars: colorSchemesMap[colorScheme].vars,
|
|
65
|
+
selector: (parserConfig == null || (_parserConfig$getSele2 = parserConfig.getSelector) == null ? void 0 : _parserConfig$getSele2.call(parserConfig, colorScheme, css)) || ':root'
|
|
59
66
|
};
|
|
60
67
|
};
|
|
61
68
|
return {
|
package/esm/index.js
CHANGED
|
@@ -42,6 +42,7 @@ export { default as shape } from './createTheme/shape';
|
|
|
42
42
|
export { default as useThemeProps, getThemeProps } from './useThemeProps';
|
|
43
43
|
export { default as useTheme } from './useTheme';
|
|
44
44
|
export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
|
|
45
|
+
export { default as useMediaQuery } from './useMediaQuery';
|
|
45
46
|
export * from './colorManipulator';
|
|
46
47
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
47
48
|
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
package/esm/merge.js
CHANGED
package/esm/propsToClassKey.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
const _excluded = ["variant"];
|
|
3
|
-
import
|
|
3
|
+
import capitalize from '@mui/utils/capitalize';
|
|
4
4
|
function isEmpty(string) {
|
|
5
5
|
return string.length === 0;
|
|
6
6
|
}
|
package/esm/style.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
var _props$theme$unstable, _props$theme;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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,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
|
+
}
|
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.
|
|
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
|
|
@@ -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
|
|
4
|
+
import ClassNameGenerator from '@mui/utils/ClassNameGenerator';
|
|
5
5
|
import createBox from '../createBox';
|
|
6
6
|
import boxClasses from './boxClasses';
|
|
7
7
|
var Box = createBox({
|
package/legacy/Box/boxClasses.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
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
|
}
|
package/legacy/breakpoints.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
package/legacy/createStyled.js
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
|
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) {
|