@mui/system 5.15.9 → 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.
- package/Box/Box.js +2 -2
- package/Box/boxClasses.js +3 -2
- package/CHANGELOG.md +187 -23
- 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/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 +5 -5
- 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/createStyled.js
CHANGED
|
@@ -10,7 +10,9 @@ exports.systemDefaultTheme = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var _styledEngine = _interopRequireWildcard(require("@mui/styled-engine"));
|
|
13
|
-
var
|
|
13
|
+
var _deepmerge = require("@mui/utils/deepmerge");
|
|
14
|
+
var _capitalize = _interopRequireDefault(require("@mui/utils/capitalize"));
|
|
15
|
+
var _getDisplayName = _interopRequireDefault(require("@mui/utils/getDisplayName"));
|
|
14
16
|
var _createTheme = _interopRequireDefault(require("./createTheme"));
|
|
15
17
|
var _styleFunctionSx = _interopRequireDefault(require("./styleFunctionSx"));
|
|
16
18
|
const _excluded = ["ownerState"],
|
|
@@ -80,7 +82,7 @@ function processStyleArg(callableStyle, _ref) {
|
|
|
80
82
|
if (typeof variant.props === 'function') {
|
|
81
83
|
isMatch = variant.props((0, _extends2.default)({
|
|
82
84
|
ownerState
|
|
83
|
-
}, props));
|
|
85
|
+
}, props, ownerState));
|
|
84
86
|
} else {
|
|
85
87
|
Object.keys(variant.props).forEach(key => {
|
|
86
88
|
if ((ownerState == null ? void 0 : ownerState[key]) !== variant.props[key] && props[key] !== variant.props[key]) {
|
|
@@ -94,7 +96,7 @@ function processStyleArg(callableStyle, _ref) {
|
|
|
94
96
|
}
|
|
95
97
|
result.push(typeof variant.style === 'function' ? variant.style((0, _extends2.default)({
|
|
96
98
|
ownerState
|
|
97
|
-
}, props)) : variant.style);
|
|
99
|
+
}, props, ownerState)) : variant.style);
|
|
98
100
|
}
|
|
99
101
|
});
|
|
100
102
|
return result;
|
|
@@ -166,7 +168,7 @@ function createStyled(input = {}) {
|
|
|
166
168
|
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
167
169
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
168
170
|
// which are basically components used as a selectors.
|
|
169
|
-
if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg || (0,
|
|
171
|
+
if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg || (0, _deepmerge.isPlainObject)(stylesArg)) {
|
|
170
172
|
return props => processStyleArg(stylesArg, (0, _extends2.default)({}, props, {
|
|
171
173
|
theme: resolveTheme({
|
|
172
174
|
theme: props.theme,
|
|
@@ -229,10 +231,10 @@ function createStyled(input = {}) {
|
|
|
229
231
|
if (process.env.NODE_ENV !== 'production') {
|
|
230
232
|
let displayName;
|
|
231
233
|
if (componentName) {
|
|
232
|
-
displayName = `${componentName}${(0,
|
|
234
|
+
displayName = `${componentName}${(0, _capitalize.default)(componentSlot || '')}`;
|
|
233
235
|
}
|
|
234
236
|
if (displayName === undefined) {
|
|
235
|
-
displayName = `Styled(${(0,
|
|
237
|
+
displayName = `Styled(${(0, _getDisplayName.default)(tag)})`;
|
|
236
238
|
}
|
|
237
239
|
Component.displayName = displayName;
|
|
238
240
|
}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
-
var
|
|
10
|
+
var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
|
|
11
11
|
var _createBreakpoints = _interopRequireDefault(require("./createBreakpoints"));
|
|
12
12
|
var _shape = _interopRequireDefault(require("./shape"));
|
|
13
13
|
var _createSpacing = _interopRequireDefault(require("./createSpacing"));
|
|
@@ -25,7 +25,7 @@ function createTheme(options = {}, ...args) {
|
|
|
25
25
|
other = (0, _objectWithoutPropertiesLoose2.default)(options, _excluded);
|
|
26
26
|
const breakpoints = (0, _createBreakpoints.default)(breakpointsInput);
|
|
27
27
|
const spacing = (0, _createSpacing.default)(spacingInput);
|
|
28
|
-
let muiTheme = (0,
|
|
28
|
+
let muiTheme = (0, _deepmerge.default)({
|
|
29
29
|
breakpoints,
|
|
30
30
|
direction: 'ltr',
|
|
31
31
|
components: {},
|
|
@@ -37,7 +37,7 @@ function createTheme(options = {}, ...args) {
|
|
|
37
37
|
shape: (0, _extends2.default)({}, _shape.default, shapeInput)
|
|
38
38
|
}, other);
|
|
39
39
|
muiTheme.applyStyles = _applyStyles.default;
|
|
40
|
-
muiTheme = args.reduce((acc, argument) => (0,
|
|
40
|
+
muiTheme = args.reduce((acc, argument) => (0, _deepmerge.default)(acc, argument), muiTheme);
|
|
41
41
|
muiTheme.unstable_sxConfig = (0, _extends2.default)({}, _defaultSxConfig.default, other == null ? void 0 : other.unstable_sxConfig);
|
|
42
42
|
muiTheme.unstable_sx = function sx(props) {
|
|
43
43
|
return (0, _styleFunctionSx.default)({
|
|
@@ -11,7 +11,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var
|
|
14
|
+
var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
|
|
15
15
|
var _styledEngine = require("@mui/styled-engine");
|
|
16
16
|
var _privateTheming = require("@mui/private-theming");
|
|
17
17
|
var _ThemeProvider = _interopRequireDefault(require("../ThemeProvider"));
|
|
@@ -45,6 +45,9 @@ function createCssVarsProvider(options) {
|
|
|
45
45
|
console.error(`MUI: \`${designSystemColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
|
46
46
|
}
|
|
47
47
|
const ColorSchemeContext = /*#__PURE__*/React.createContext(undefined);
|
|
48
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
49
|
+
ColorSchemeContext.displayName = 'ColorSchemeContext';
|
|
50
|
+
}
|
|
48
51
|
const useColorScheme = () => {
|
|
49
52
|
const value = React.useContext(ColorSchemeContext);
|
|
50
53
|
if (!value) {
|
|
@@ -159,7 +162,7 @@ function createCssVarsProvider(options) {
|
|
|
159
162
|
css,
|
|
160
163
|
vars
|
|
161
164
|
} = generateCssVars(key);
|
|
162
|
-
theme.vars = (0,
|
|
165
|
+
theme.vars = (0, _deepmerge.default)(theme.vars, vars);
|
|
163
166
|
if (key === calculatedColorScheme) {
|
|
164
167
|
// 4.1 Merge the selected color scheme to the theme
|
|
165
168
|
Object.keys(scheme).forEach(schemeKey => {
|
|
@@ -197,7 +200,7 @@ function createCssVarsProvider(options) {
|
|
|
197
200
|
otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
|
|
198
201
|
}
|
|
199
202
|
});
|
|
200
|
-
theme.vars = (0,
|
|
203
|
+
theme.vars = (0, _deepmerge.default)(theme.vars, rootVars);
|
|
201
204
|
|
|
202
205
|
// 5. Declaring effects
|
|
203
206
|
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export interface DefaultCssVarsTheme {
|
|
2
|
-
colorSchemes
|
|
2
|
+
colorSchemes?: Record<string, any>;
|
|
3
|
+
defaultColorScheme?: string;
|
|
3
4
|
}
|
|
4
|
-
declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any
|
|
5
|
+
declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any>, Selector = any>(theme: T, parserConfig?: {
|
|
5
6
|
prefix?: string;
|
|
6
7
|
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
8
|
+
getSelector?: (colorScheme: string | undefined, css: Record<string, any>) => Selector;
|
|
7
9
|
}): {
|
|
8
10
|
vars: ThemeVars;
|
|
9
11
|
generateCssVars: (colorScheme?: string) => {
|
|
@@ -11,6 +13,7 @@ declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends
|
|
|
11
13
|
[x: string]: string | number;
|
|
12
14
|
};
|
|
13
15
|
vars: ThemeVars;
|
|
16
|
+
selector: string | NonNullable<Selector>;
|
|
14
17
|
};
|
|
15
18
|
};
|
|
16
19
|
export default prepareCssVars;
|
|
@@ -6,15 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _toPropertyKey2 = _interopRequireDefault(require("@babel/runtime/helpers/toPropertyKey"));
|
|
9
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
-
var
|
|
11
|
+
var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
|
|
11
12
|
var _cssVarsParser = _interopRequireDefault(require("./cssVarsParser"));
|
|
12
|
-
const _excluded = ["colorSchemes", "components"]
|
|
13
|
-
_excluded2 = ["light"];
|
|
13
|
+
const _excluded = ["colorSchemes", "components", "defaultColorScheme"];
|
|
14
14
|
function prepareCssVars(theme, parserConfig) {
|
|
15
15
|
// @ts-ignore - ignore components do not exist
|
|
16
16
|
const {
|
|
17
|
-
colorSchemes = {}
|
|
17
|
+
colorSchemes = {},
|
|
18
|
+
defaultColorScheme = 'light'
|
|
18
19
|
} = theme,
|
|
19
20
|
otherTheme = (0, _objectWithoutPropertiesLoose2.default)(theme, _excluded);
|
|
20
21
|
const {
|
|
@@ -25,44 +26,50 @@ function prepareCssVars(theme, parserConfig) {
|
|
|
25
26
|
let themeVars = rootVarsWithDefaults;
|
|
26
27
|
const colorSchemesMap = {};
|
|
27
28
|
const {
|
|
28
|
-
light
|
|
29
|
+
[defaultColorScheme]: light
|
|
29
30
|
} = colorSchemes,
|
|
30
|
-
otherColorSchemes = (0, _objectWithoutPropertiesLoose2.default)(colorSchemes,
|
|
31
|
+
otherColorSchemes = (0, _objectWithoutPropertiesLoose2.default)(colorSchemes, [defaultColorScheme].map(_toPropertyKey2.default));
|
|
31
32
|
Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
|
|
32
33
|
const {
|
|
33
34
|
vars,
|
|
34
35
|
css,
|
|
35
36
|
varsWithDefaults
|
|
36
37
|
} = (0, _cssVarsParser.default)(scheme, parserConfig);
|
|
37
|
-
themeVars = (0,
|
|
38
|
+
themeVars = (0, _deepmerge.default)(themeVars, varsWithDefaults);
|
|
38
39
|
colorSchemesMap[key] = {
|
|
39
40
|
css,
|
|
40
41
|
vars
|
|
41
42
|
};
|
|
42
43
|
});
|
|
43
44
|
if (light) {
|
|
44
|
-
//
|
|
45
|
+
// default color scheme vars should be merged last to set as default
|
|
45
46
|
const {
|
|
46
47
|
css,
|
|
47
48
|
vars,
|
|
48
49
|
varsWithDefaults
|
|
49
50
|
} = (0, _cssVarsParser.default)(light, parserConfig);
|
|
50
|
-
themeVars = (0,
|
|
51
|
-
colorSchemesMap
|
|
51
|
+
themeVars = (0, _deepmerge.default)(themeVars, varsWithDefaults);
|
|
52
|
+
colorSchemesMap[defaultColorScheme] = {
|
|
52
53
|
css,
|
|
53
54
|
vars
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
const generateCssVars = colorScheme => {
|
|
58
|
+
var _parserConfig$getSele2;
|
|
57
59
|
if (!colorScheme) {
|
|
60
|
+
var _parserConfig$getSele;
|
|
61
|
+
const css = (0, _extends2.default)({}, rootCss);
|
|
58
62
|
return {
|
|
59
|
-
css
|
|
60
|
-
vars: rootVars
|
|
63
|
+
css,
|
|
64
|
+
vars: rootVars,
|
|
65
|
+
selector: (parserConfig == null || (_parserConfig$getSele = parserConfig.getSelector) == null ? void 0 : _parserConfig$getSele.call(parserConfig, colorScheme, css)) || ':root'
|
|
61
66
|
};
|
|
62
67
|
}
|
|
68
|
+
const css = (0, _extends2.default)({}, colorSchemesMap[colorScheme].css);
|
|
63
69
|
return {
|
|
64
|
-
css
|
|
65
|
-
vars: colorSchemesMap[colorScheme].vars
|
|
70
|
+
css,
|
|
71
|
+
vars: colorSchemesMap[colorScheme].vars,
|
|
72
|
+
selector: (parserConfig == null || (_parserConfig$getSele2 = parserConfig.getSelector) == null ? void 0 : _parserConfig$getSele2.call(parserConfig, colorScheme, css)) || ':root'
|
|
66
73
|
};
|
|
67
74
|
};
|
|
68
75
|
return {
|
package/esm/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
|
const Box = createBox({
|
package/esm/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 @@ 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
|
|
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';
|
package/esm/Stack/createStack.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
@@ -54,7 +59,7 @@ export default function createGrid(options = {}) {
|
|
|
54
59
|
const theme = useTheme();
|
|
55
60
|
const themeProps = useThemeProps(inProps);
|
|
56
61
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
57
|
-
const overflow = React.useContext(
|
|
62
|
+
const overflow = React.useContext(GridOverflowContext);
|
|
58
63
|
const {
|
|
59
64
|
className,
|
|
60
65
|
children,
|
|
@@ -125,10 +130,10 @@ export default function createGrid(options = {}) {
|
|
|
125
130
|
})
|
|
126
131
|
}));
|
|
127
132
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
128
|
-
// There are 2 possibilities that should wrap with the
|
|
133
|
+
// There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
|
|
129
134
|
// 1. It is the root grid with `disableEqualOverflow`.
|
|
130
135
|
// 2. It is a nested grid with different `disableEqualOverflow` from the context.
|
|
131
|
-
result = /*#__PURE__*/_jsx(
|
|
136
|
+
result = /*#__PURE__*/_jsx(GridOverflowContext.Provider, {
|
|
132
137
|
value: disableEqualOverflow,
|
|
133
138
|
children: result
|
|
134
139
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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
|
}
|
package/esm/breakpoints.js
CHANGED
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';
|