@mui/system 5.11.16 → 5.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +147 -22
- package/Container/Container.d.ts +13 -13
- package/Container/ContainerProps.d.ts +40 -40
- package/Container/containerClasses.d.ts +22 -22
- package/Container/createContainer.d.ts +18 -18
- package/GlobalStyles/GlobalStyles.d.ts +13 -0
- package/GlobalStyles/GlobalStyles.js +45 -0
- package/GlobalStyles/index.d.ts +2 -0
- package/GlobalStyles/index.js +26 -0
- package/GlobalStyles/package.json +6 -0
- package/Stack/Stack.d.ts +14 -13
- package/Stack/Stack.js +2 -1
- package/Stack/StackProps.d.ts +53 -53
- package/Stack/createStack.d.ts +21 -21
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +8 -8
- package/ThemeProvider/ThemeProvider.d.ts +4 -0
- package/ThemeProvider/ThemeProvider.js +43 -17
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +185 -173
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/createGrid.js +18 -11
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +38 -38
- package/Unstable_Grid/gridGenerator.js +12 -12
- package/Unstable_Grid/index.d.ts +5 -5
- package/createBox.d.ts +1 -0
- package/createBox.js +2 -1
- package/createStyled.d.ts +1 -0
- package/createStyled.js +37 -24
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.d.ts +22 -7
- package/cssVars/createCssVarsProvider.js +7 -3
- package/cssVars/createCssVarsTheme.d.ts +15 -13
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +64 -64
- package/cssVars/getInitColorSchemeScript.d.ts +42 -42
- package/cssVars/index.d.ts +5 -5
- package/cssVars/prepareCssVars.d.ts +16 -14
- package/cssVars/prepareCssVars.js +6 -2
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/esm/GlobalStyles/GlobalStyles.js +35 -0
- package/esm/GlobalStyles/index.js +2 -0
- package/esm/Stack/Stack.js +2 -1
- package/esm/ThemeProvider/ThemeProvider.js +44 -18
- package/esm/Unstable_Grid/createGrid.js +19 -12
- package/esm/Unstable_Grid/gridGenerator.js +12 -12
- package/esm/createBox.js +2 -1
- package/esm/createStyled.js +37 -24
- package/esm/cssVars/createCssVarsProvider.js +7 -3
- package/esm/cssVars/prepareCssVars.js +6 -2
- package/esm/index.js +2 -1
- package/esm/useThemeProps/useThemeProps.js +6 -2
- package/esm/useThemeWithoutDefault.js +3 -2
- package/index.d.ts +2 -2
- package/index.js +4 -3
- package/legacy/GlobalStyles/GlobalStyles.js +35 -0
- package/legacy/GlobalStyles/index.js +2 -0
- package/legacy/Stack/Stack.js +2 -1
- package/legacy/ThemeProvider/ThemeProvider.js +44 -19
- package/legacy/Unstable_Grid/createGrid.js +19 -11
- package/legacy/Unstable_Grid/gridGenerator.js +12 -12
- package/legacy/createBox.js +3 -2
- package/legacy/createStyled.js +37 -17
- package/legacy/cssVars/createCssVarsProvider.js +18 -14
- package/legacy/cssVars/prepareCssVars.js +6 -2
- package/legacy/index.js +3 -2
- package/legacy/useThemeProps/useThemeProps.js +5 -1
- package/legacy/useThemeWithoutDefault.js +3 -2
- package/modern/GlobalStyles/GlobalStyles.js +35 -0
- package/modern/GlobalStyles/index.js +2 -0
- package/modern/Stack/Stack.js +2 -1
- package/modern/ThemeProvider/ThemeProvider.js +44 -18
- package/modern/Unstable_Grid/createGrid.js +18 -12
- package/modern/Unstable_Grid/gridGenerator.js +12 -12
- package/modern/createBox.js +2 -1
- package/modern/createStyled.js +37 -24
- package/modern/cssVars/createCssVarsProvider.js +7 -3
- package/modern/cssVars/prepareCssVars.js +6 -2
- package/modern/index.js +3 -2
- package/modern/useThemeProps/useThemeProps.js +6 -2
- package/modern/useThemeWithoutDefault.js +3 -2
- package/package.json +5 -5
- package/useThemeProps/useThemeProps.d.ts +6 -1
- package/useThemeProps/useThemeProps.js +6 -2
- package/useThemeWithoutDefault.js +5 -2
- package/Box/Box.spec.d.ts +0 -1
- package/createBox.spec.d.ts +0 -1
- package/cssVars/createCssVarsProvider.spec.d.ts +0 -1
- package/index.spec.d.ts +0 -1
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +0 -1
package/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
|
|
2
|
-
export { css, keyframes,
|
|
2
|
+
export { css, keyframes, StyledEngineProvider } from '@mui/styled-engine';
|
|
3
|
+
export { default as GlobalStyles } from './GlobalStyles';
|
|
3
4
|
export { default as borders } from './borders';
|
|
4
5
|
export * from './borders';
|
|
5
6
|
export { default as breakpoints } from './breakpoints';
|
|
@@ -3,9 +3,13 @@ import useTheme from '../useTheme';
|
|
|
3
3
|
export default function useThemeProps({
|
|
4
4
|
props,
|
|
5
5
|
name,
|
|
6
|
-
defaultTheme
|
|
6
|
+
defaultTheme,
|
|
7
|
+
themeId
|
|
7
8
|
}) {
|
|
8
|
-
|
|
9
|
+
let theme = useTheme(defaultTheme);
|
|
10
|
+
if (themeId) {
|
|
11
|
+
theme = theme[themeId] || theme;
|
|
12
|
+
}
|
|
9
13
|
const mergedProps = getThemeProps({
|
|
10
14
|
theme,
|
|
11
15
|
name,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ThemeContext } from '@mui/styled-engine';
|
|
2
3
|
function isObjectEmpty(obj) {
|
|
3
4
|
return Object.keys(obj).length === 0;
|
|
4
5
|
}
|
|
5
6
|
function useTheme(defaultTheme = null) {
|
|
6
|
-
const contextTheme =
|
|
7
|
+
const contextTheme = React.useContext(ThemeContext);
|
|
7
8
|
return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme;
|
|
8
9
|
}
|
|
9
10
|
export default useTheme;
|
package/index.d.ts
CHANGED
|
@@ -104,13 +104,13 @@ export { DefaultTheme } from '@mui/private-theming';
|
|
|
104
104
|
export {
|
|
105
105
|
css,
|
|
106
106
|
keyframes,
|
|
107
|
-
GlobalStyles,
|
|
108
|
-
GlobalStylesProps,
|
|
109
107
|
StyledEngineProvider,
|
|
110
108
|
Interpolation,
|
|
111
109
|
CSSInterpolation,
|
|
112
110
|
CSSObject,
|
|
113
111
|
} from '@mui/styled-engine';
|
|
112
|
+
export { default as GlobalStyles } from './GlobalStyles';
|
|
113
|
+
export type { GlobalStylesProps } from './GlobalStyles';
|
|
114
114
|
|
|
115
115
|
export * from './style';
|
|
116
116
|
export * from './spacing';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/system v5.
|
|
2
|
+
* @mui/system v5.12.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -15,8 +15,8 @@ var _exportNames = {
|
|
|
15
15
|
experimental_sx: true,
|
|
16
16
|
css: true,
|
|
17
17
|
keyframes: true,
|
|
18
|
-
GlobalStyles: true,
|
|
19
18
|
StyledEngineProvider: true,
|
|
19
|
+
GlobalStyles: true,
|
|
20
20
|
borders: true,
|
|
21
21
|
breakpoints: true,
|
|
22
22
|
handleBreakpoints: true,
|
|
@@ -79,7 +79,7 @@ Object.defineProperty(exports, "Container", {
|
|
|
79
79
|
Object.defineProperty(exports, "GlobalStyles", {
|
|
80
80
|
enumerable: true,
|
|
81
81
|
get: function () {
|
|
82
|
-
return
|
|
82
|
+
return _GlobalStyles.default;
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "Stack", {
|
|
@@ -367,6 +367,7 @@ Object.defineProperty(exports, "useThemeWithoutDefault", {
|
|
|
367
367
|
});
|
|
368
368
|
var _utils = require("@mui/utils");
|
|
369
369
|
var _styledEngine = require("@mui/styled-engine");
|
|
370
|
+
var _GlobalStyles = _interopRequireDefault(require("./GlobalStyles"));
|
|
370
371
|
var _borders = _interopRequireWildcard(require("./borders"));
|
|
371
372
|
Object.keys(_borders).forEach(function (key) {
|
|
372
373
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { GlobalStyles as MuiGlobalStyles } from '@mui/styled-engine';
|
|
4
|
+
import useTheme from '../useTheme';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
function GlobalStyles(_ref) {
|
|
7
|
+
var styles = _ref.styles,
|
|
8
|
+
themeId = _ref.themeId,
|
|
9
|
+
_ref$defaultTheme = _ref.defaultTheme,
|
|
10
|
+
defaultTheme = _ref$defaultTheme === void 0 ? {} : _ref$defaultTheme;
|
|
11
|
+
var upperTheme = useTheme(defaultTheme);
|
|
12
|
+
var globalStyles = typeof styles === 'function' ? styles(themeId ? upperTheme[themeId] || upperTheme : upperTheme) : styles;
|
|
13
|
+
return /*#__PURE__*/_jsx(MuiGlobalStyles, {
|
|
14
|
+
styles: globalStyles
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes /* remove-proptypes */ = {
|
|
18
|
+
// ----------------------------- Warning --------------------------------
|
|
19
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
20
|
+
// | To update them edit TypeScript types and run "yarn proptypes" |
|
|
21
|
+
// ----------------------------------------------------------------------
|
|
22
|
+
/**
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
defaultTheme: PropTypes.object,
|
|
26
|
+
/**
|
|
27
|
+
* @ignore
|
|
28
|
+
*/
|
|
29
|
+
styles: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.array, PropTypes.func, PropTypes.number, PropTypes.object, PropTypes.string, PropTypes.bool]),
|
|
30
|
+
/**
|
|
31
|
+
* @ignore
|
|
32
|
+
*/
|
|
33
|
+
themeId: PropTypes.string
|
|
34
|
+
} : void 0;
|
|
35
|
+
export default GlobalStyles;
|
package/legacy/Stack/Stack.js
CHANGED
|
@@ -4,6 +4,7 @@ import createStack from './createStack';
|
|
|
4
4
|
*
|
|
5
5
|
* Demos:
|
|
6
6
|
*
|
|
7
|
+
* - [Stack (Joy UI)](https://mui.com/joy/react-stack/)
|
|
7
8
|
* - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
|
|
8
9
|
* - [Stack (MUI System)](https://mui.com/system/react-stack/)
|
|
9
10
|
*
|
|
@@ -48,7 +49,7 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
|
|
|
48
49
|
/**
|
|
49
50
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
50
51
|
*
|
|
51
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
52
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
52
53
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
53
54
|
*
|
|
54
55
|
* To enable this flag globally, follow the theme's default props configuration.
|
|
@@ -1,36 +1,57 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { ThemeProvider as MuiThemeProvider } from '@mui/private-theming';
|
|
5
|
+
import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
|
|
5
6
|
import { exactProp } from '@mui/utils';
|
|
6
7
|
import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
|
|
7
|
-
import
|
|
8
|
+
import useThemeWithoutDefault from '../useThemeWithoutDefault';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
var EMPTY_THEME = {};
|
|
10
|
-
function
|
|
11
|
-
var
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
function useThemeScoping(themeId, upperTheme, localTheme) {
|
|
12
|
+
var isPrivate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
13
|
+
return React.useMemo(function () {
|
|
14
|
+
var resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
|
15
|
+
if (typeof localTheme === 'function') {
|
|
16
|
+
var mergedTheme = localTheme(resolvedTheme);
|
|
17
|
+
var result = themeId ? _extends({}, upperTheme, _defineProperty({}, themeId, mergedTheme)) : mergedTheme;
|
|
18
|
+
// must return a function for the private theme to NOT merge with the upper theme.
|
|
19
|
+
// see the test case "use provided theme from a callback" in ThemeProvider.test.js
|
|
20
|
+
if (isPrivate) {
|
|
21
|
+
return function () {
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
return themeId ? _extends({}, upperTheme, _defineProperty({}, themeId, localTheme)) : _extends({}, upperTheme, localTheme);
|
|
28
|
+
}, [themeId, upperTheme, localTheme, isPrivate]);
|
|
16
29
|
}
|
|
17
|
-
process.env.NODE_ENV !== "production" ? InnerThemeProvider.propTypes = {
|
|
18
|
-
/**
|
|
19
|
-
* Your component tree.
|
|
20
|
-
*/
|
|
21
|
-
children: PropTypes.node
|
|
22
|
-
} : void 0;
|
|
23
30
|
|
|
24
31
|
/**
|
|
25
32
|
* This component makes the `theme` available down the React tree.
|
|
26
33
|
* It should preferably be used at **the root of your component tree**.
|
|
34
|
+
*
|
|
35
|
+
* <ThemeProvider theme={theme}> // existing use case
|
|
36
|
+
* <ThemeProvider theme={{ id: theme }}> // theme scoping
|
|
27
37
|
*/
|
|
28
38
|
function ThemeProvider(props) {
|
|
29
39
|
var children = props.children,
|
|
30
|
-
localTheme = props.theme
|
|
40
|
+
localTheme = props.theme,
|
|
41
|
+
themeId = props.themeId;
|
|
42
|
+
var upperTheme = useThemeWithoutDefault(EMPTY_THEME);
|
|
43
|
+
var upperPrivateTheme = usePrivateTheme() || EMPTY_THEME;
|
|
44
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
45
|
+
if (upperTheme === null && typeof localTheme === 'function' || themeId && upperTheme && !upperTheme[themeId] && typeof localTheme === 'function') {
|
|
46
|
+
console.error(['MUI: You are providing a theme function prop to the ThemeProvider component:', '<ThemeProvider theme={outerTheme => outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\n'));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
var engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
|
|
50
|
+
var privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
|
|
31
51
|
return /*#__PURE__*/_jsx(MuiThemeProvider, {
|
|
32
|
-
theme:
|
|
33
|
-
children: /*#__PURE__*/_jsx(
|
|
52
|
+
theme: privateTheme,
|
|
53
|
+
children: /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
|
|
54
|
+
value: engineTheme,
|
|
34
55
|
children: children
|
|
35
56
|
})
|
|
36
57
|
});
|
|
@@ -47,7 +68,11 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes /* remove-propty
|
|
|
47
68
|
/**
|
|
48
69
|
* A theme object. You can provide a function to extend the outer theme.
|
|
49
70
|
*/
|
|
50
|
-
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired
|
|
71
|
+
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired,
|
|
72
|
+
/**
|
|
73
|
+
* The design system's unique id for getting the corresponded theme when there are multiple design systems.
|
|
74
|
+
*/
|
|
75
|
+
themeId: PropTypes.string
|
|
51
76
|
} : void 0;
|
|
52
77
|
if (process.env.NODE_ENV !== 'production') {
|
|
53
78
|
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
|
|
@@ -5,7 +5,7 @@ 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 } from '@mui/utils';
|
|
8
|
+
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_isMuiElement as isMuiElement } from '@mui/utils';
|
|
9
9
|
import systemStyled from '../styled';
|
|
10
10
|
import useThemePropsSystem from '../useThemeProps';
|
|
11
11
|
import useTheme from '../useTheme';
|
|
@@ -38,7 +38,6 @@ export default function createGrid() {
|
|
|
38
38
|
useThemeProps = _options$useThemeProp === void 0 ? useThemePropsDefault : _options$useThemeProp,
|
|
39
39
|
_options$componentNam = options.componentName,
|
|
40
40
|
componentName = _options$componentNam === void 0 ? 'MuiGrid' : _options$componentNam;
|
|
41
|
-
var NestedContext = /*#__PURE__*/React.createContext(0);
|
|
42
41
|
var OverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
43
42
|
var useUtilityClasses = function useUtilityClasses(ownerState, theme) {
|
|
44
43
|
var container = ownerState.container,
|
|
@@ -59,9 +58,9 @@ export default function createGrid() {
|
|
|
59
58
|
var theme = useTheme();
|
|
60
59
|
var themeProps = useThemeProps(inProps);
|
|
61
60
|
var props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
62
|
-
var level = React.useContext(NestedContext);
|
|
63
61
|
var overflow = React.useContext(OverflowContext);
|
|
64
62
|
var className = props.className,
|
|
63
|
+
children = props.children,
|
|
65
64
|
_props$columns = props.columns,
|
|
66
65
|
columnsProp = _props$columns === void 0 ? 12 : _props$columns,
|
|
67
66
|
_props$container = props.container,
|
|
@@ -79,7 +78,9 @@ export default function createGrid() {
|
|
|
79
78
|
_props$columnSpacing = props.columnSpacing,
|
|
80
79
|
columnSpacingProp = _props$columnSpacing === void 0 ? spacingProp : _props$columnSpacing,
|
|
81
80
|
themeDisableEqualOverflow = props.disableEqualOverflow,
|
|
82
|
-
|
|
81
|
+
_props$unstable_level = props.unstable_level,
|
|
82
|
+
level = _props$unstable_level === void 0 ? 0 : _props$unstable_level,
|
|
83
|
+
rest = _objectWithoutProperties(props, ["className", "children", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow", "unstable_level"]); // Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
83
84
|
var disableEqualOverflow = themeDisableEqualOverflow;
|
|
84
85
|
if (level && themeDisableEqualOverflow !== undefined) {
|
|
85
86
|
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
@@ -126,13 +127,17 @@ export default function createGrid() {
|
|
|
126
127
|
as: component,
|
|
127
128
|
ownerState: ownerState,
|
|
128
129
|
className: clsx(classes.root, className)
|
|
129
|
-
}, other
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
}, other, {
|
|
131
|
+
children: React.Children.map(children, function (child) {
|
|
132
|
+
if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
|
133
|
+
var _child$props$unstable;
|
|
134
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
135
|
+
unstable_level: (_child$props$unstable = child.props.unstable_level) != null ? _child$props$unstable : level + 1
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return child;
|
|
139
|
+
})
|
|
140
|
+
}));
|
|
136
141
|
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow != null ? overflow : false)) {
|
|
137
142
|
// There are 2 possibilities that should wrap with the OverflowContext to communicate with the nested grids:
|
|
138
143
|
// 1. It is the root grid with `disableEqualOverflow`.
|
|
@@ -168,5 +173,8 @@ export default function createGrid() {
|
|
|
168
173
|
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
169
174
|
xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
|
|
170
175
|
} : void 0;
|
|
176
|
+
|
|
177
|
+
// @ts-ignore internal logic for nested grid
|
|
178
|
+
Grid.muiName = 'Grid';
|
|
171
179
|
return Grid;
|
|
172
180
|
}
|
|
@@ -9,26 +9,26 @@ function appendLevel(level) {
|
|
|
9
9
|
return "Level".concat(level);
|
|
10
10
|
}
|
|
11
11
|
function isNestedContainer(ownerState) {
|
|
12
|
-
return ownerState.
|
|
12
|
+
return ownerState.unstable_level > 0 && ownerState.container;
|
|
13
13
|
}
|
|
14
14
|
function createGetSelfSpacing(ownerState) {
|
|
15
15
|
return function getSelfSpacing(axis) {
|
|
16
|
-
return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.
|
|
16
|
+
return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.unstable_level), ")");
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
function createGetParentSpacing(ownerState) {
|
|
20
20
|
return function getParentSpacing(axis) {
|
|
21
|
-
if (ownerState.
|
|
21
|
+
if (ownerState.unstable_level === 0) {
|
|
22
22
|
return "var(--Grid-".concat(axis, "Spacing)");
|
|
23
23
|
}
|
|
24
|
-
return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.
|
|
24
|
+
return "var(--Grid-".concat(axis, "Spacing").concat(appendLevel(ownerState.unstable_level - 1), ")");
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
function getParentColumns(ownerState) {
|
|
28
|
-
if (ownerState.
|
|
28
|
+
if (ownerState.unstable_level === 0) {
|
|
29
29
|
return "var(--Grid-columns)";
|
|
30
30
|
}
|
|
31
|
-
return "var(--Grid-columns".concat(appendLevel(ownerState.
|
|
31
|
+
return "var(--Grid-columns".concat(appendLevel(ownerState.unstable_level - 1), ")");
|
|
32
32
|
}
|
|
33
33
|
export var filterBreakpointKeys = function filterBreakpointKeys(breakpointsKeys, responsiveKeys) {
|
|
34
34
|
return breakpointsKeys.filter(function (key) {
|
|
@@ -136,11 +136,11 @@ export var generateGridColumnsStyles = function generateGridColumnsStyles(_ref3)
|
|
|
136
136
|
if (!ownerState.container) {
|
|
137
137
|
return {};
|
|
138
138
|
}
|
|
139
|
-
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.
|
|
139
|
+
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.unstable_level)), getParentColumns(ownerState)) : {
|
|
140
140
|
'--Grid-columns': 12
|
|
141
141
|
};
|
|
142
142
|
traverseBreakpoints(theme.breakpoints, ownerState.columns, function (appendStyle, value) {
|
|
143
|
-
appendStyle(styles, _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.
|
|
143
|
+
appendStyle(styles, _defineProperty({}, "--Grid-columns".concat(appendLevel(ownerState.unstable_level)), value));
|
|
144
144
|
});
|
|
145
145
|
return styles;
|
|
146
146
|
};
|
|
@@ -151,10 +151,10 @@ export var generateGridRowSpacingStyles = function generateGridRowSpacingStyles(
|
|
|
151
151
|
return {};
|
|
152
152
|
}
|
|
153
153
|
var getParentSpacing = createGetParentSpacing(ownerState);
|
|
154
|
-
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.
|
|
154
|
+
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.unstable_level)), getParentSpacing('row')) : {};
|
|
155
155
|
traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, function (appendStyle, value) {
|
|
156
156
|
var _theme$spacing;
|
|
157
|
-
appendStyle(styles, _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.
|
|
157
|
+
appendStyle(styles, _defineProperty({}, "--Grid-rowSpacing".concat(appendLevel(ownerState.unstable_level)), typeof value === 'string' ? value : (_theme$spacing = theme.spacing) == null ? void 0 : _theme$spacing.call(theme, value)));
|
|
158
158
|
});
|
|
159
159
|
return styles;
|
|
160
160
|
};
|
|
@@ -165,10 +165,10 @@ export var generateGridColumnSpacingStyles = function generateGridColumnSpacingS
|
|
|
165
165
|
return {};
|
|
166
166
|
}
|
|
167
167
|
var getParentSpacing = createGetParentSpacing(ownerState);
|
|
168
|
-
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.
|
|
168
|
+
var styles = isNestedContainer(ownerState) ? _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.unstable_level)), getParentSpacing('column')) : {};
|
|
169
169
|
traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, function (appendStyle, value) {
|
|
170
170
|
var _theme$spacing2;
|
|
171
|
-
appendStyle(styles, _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.
|
|
171
|
+
appendStyle(styles, _defineProperty({}, "--Grid-columnSpacing".concat(appendLevel(ownerState.unstable_level)), typeof value === 'string' ? value : (_theme$spacing2 = theme.spacing) == null ? void 0 : _theme$spacing2.call(theme, value)));
|
|
172
172
|
});
|
|
173
173
|
return styles;
|
|
174
174
|
};
|
package/legacy/createBox.js
CHANGED
|
@@ -8,7 +8,8 @@ import useTheme from './useTheme';
|
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
export default function createBox() {
|
|
10
10
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
-
var
|
|
11
|
+
var themeId = options.themeId,
|
|
12
|
+
defaultTheme = options.defaultTheme,
|
|
12
13
|
_options$defaultClass = options.defaultClassName,
|
|
13
14
|
defaultClassName = _options$defaultClass === void 0 ? 'MuiBox-root' : _options$defaultClass,
|
|
14
15
|
generateClassName = options.generateClassName;
|
|
@@ -28,7 +29,7 @@ export default function createBox() {
|
|
|
28
29
|
as: component,
|
|
29
30
|
ref: ref,
|
|
30
31
|
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
31
|
-
theme: theme
|
|
32
|
+
theme: themeId ? theme[themeId] || theme : theme
|
|
32
33
|
}, other));
|
|
33
34
|
});
|
|
34
35
|
return Box;
|
package/legacy/createStyled.js
CHANGED
|
@@ -68,18 +68,27 @@ export var systemDefaultTheme = createTheme();
|
|
|
68
68
|
var lowercaseFirstLetter = function lowercaseFirstLetter(string) {
|
|
69
69
|
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
70
70
|
};
|
|
71
|
+
function resolveTheme(_ref) {
|
|
72
|
+
var defaultTheme = _ref.defaultTheme,
|
|
73
|
+
theme = _ref.theme,
|
|
74
|
+
themeId = _ref.themeId;
|
|
75
|
+
return isEmpty(theme) ? defaultTheme : theme[themeId] || theme;
|
|
76
|
+
}
|
|
71
77
|
export default function createStyled() {
|
|
72
78
|
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
73
|
-
var
|
|
79
|
+
var themeId = input.themeId,
|
|
80
|
+
_input$defaultTheme = input.defaultTheme,
|
|
74
81
|
defaultTheme = _input$defaultTheme === void 0 ? systemDefaultTheme : _input$defaultTheme,
|
|
75
82
|
_input$rootShouldForw = input.rootShouldForwardProp,
|
|
76
83
|
rootShouldForwardProp = _input$rootShouldForw === void 0 ? shouldForwardProp : _input$rootShouldForw,
|
|
77
84
|
_input$slotShouldForw = input.slotShouldForwardProp,
|
|
78
85
|
slotShouldForwardProp = _input$slotShouldForw === void 0 ? shouldForwardProp : _input$slotShouldForw;
|
|
79
86
|
var systemSx = function systemSx(props) {
|
|
80
|
-
var theme = isEmpty(props.theme) ? defaultTheme : props.theme;
|
|
81
87
|
return styleFunctionSx(_extends({}, props, {
|
|
82
|
-
theme:
|
|
88
|
+
theme: resolveTheme(_extends({}, props, {
|
|
89
|
+
defaultTheme: defaultTheme,
|
|
90
|
+
themeId: themeId
|
|
91
|
+
}))
|
|
83
92
|
}));
|
|
84
93
|
};
|
|
85
94
|
systemSx.__mui_systemSx = true;
|
|
@@ -127,18 +136,22 @@ export default function createStyled() {
|
|
|
127
136
|
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
128
137
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
129
138
|
// which are basically components used as a selectors.
|
|
130
|
-
return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? function (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? function (props) {
|
|
140
|
+
return stylesArg(_extends({}, props, {
|
|
141
|
+
theme: resolveTheme(_extends({}, props, {
|
|
142
|
+
defaultTheme: defaultTheme,
|
|
143
|
+
themeId: themeId
|
|
144
|
+
}))
|
|
145
|
+
}));
|
|
136
146
|
} : stylesArg;
|
|
137
147
|
}) : [];
|
|
138
148
|
var transformedStyleArg = styleArg;
|
|
139
149
|
if (componentName && overridesResolver) {
|
|
140
150
|
expressionsWithDefaultTheme.push(function (props) {
|
|
141
|
-
var theme =
|
|
151
|
+
var theme = resolveTheme(_extends({}, props, {
|
|
152
|
+
defaultTheme: defaultTheme,
|
|
153
|
+
themeId: themeId
|
|
154
|
+
}));
|
|
142
155
|
var styleOverrides = getStyleOverrides(componentName, theme);
|
|
143
156
|
if (styleOverrides) {
|
|
144
157
|
var resolvedStyleOverrides = {};
|
|
@@ -157,7 +170,10 @@ export default function createStyled() {
|
|
|
157
170
|
}
|
|
158
171
|
if (componentName && !skipVariantsResolver) {
|
|
159
172
|
expressionsWithDefaultTheme.push(function (props) {
|
|
160
|
-
var theme =
|
|
173
|
+
var theme = resolveTheme(_extends({}, props, {
|
|
174
|
+
defaultTheme: defaultTheme,
|
|
175
|
+
themeId: themeId
|
|
176
|
+
}));
|
|
161
177
|
return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
|
|
162
178
|
});
|
|
163
179
|
}
|
|
@@ -176,12 +192,13 @@ export default function createStyled() {
|
|
|
176
192
|
// which are basically components used as a selectors.
|
|
177
193
|
styleArg.__emotion_real !== styleArg) {
|
|
178
194
|
// If the type is function, we need to define the default theme.
|
|
179
|
-
transformedStyleArg = function transformedStyleArg(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
195
|
+
transformedStyleArg = function transformedStyleArg(props) {
|
|
196
|
+
return styleArg(_extends({}, props, {
|
|
197
|
+
theme: resolveTheme(_extends({}, props, {
|
|
198
|
+
defaultTheme: defaultTheme,
|
|
199
|
+
themeId: themeId
|
|
200
|
+
}))
|
|
201
|
+
}));
|
|
185
202
|
};
|
|
186
203
|
}
|
|
187
204
|
var Component = defaultStyledResolver.apply(void 0, [transformedStyleArg].concat(_toConsumableArray(expressionsWithDefaultTheme)));
|
|
@@ -195,6 +212,9 @@ export default function createStyled() {
|
|
|
195
212
|
}
|
|
196
213
|
Component.displayName = displayName;
|
|
197
214
|
}
|
|
215
|
+
if (tag.muiName) {
|
|
216
|
+
Component.muiName = tag.muiName;
|
|
217
|
+
}
|
|
198
218
|
return Component;
|
|
199
219
|
};
|
|
200
220
|
if (defaultStyledResolver.withConfig) {
|
|
@@ -16,7 +16,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
export var DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
|
18
18
|
export default function createCssVarsProvider(options) {
|
|
19
|
-
var
|
|
19
|
+
var themeId = options.themeId,
|
|
20
|
+
_options$theme = options.theme,
|
|
20
21
|
defaultTheme = _options$theme === void 0 ? {} : _options$theme,
|
|
21
22
|
_options$attribute = options.attribute,
|
|
22
23
|
defaultAttribute = _options$attribute === void 0 ? DEFAULT_ATTRIBUTE : _options$attribute,
|
|
@@ -74,19 +75,21 @@ export default function createCssVarsProvider(options) {
|
|
|
74
75
|
var upperTheme = muiUseTheme();
|
|
75
76
|
var ctx = React.useContext(ColorSchemeContext);
|
|
76
77
|
var nested = !!ctx && !disableNestedContext;
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
var scopedTheme = themeProp[themeId];
|
|
79
|
+
var _ref2 = scopedTheme || themeProp,
|
|
80
|
+
_ref2$colorSchemes = _ref2.colorSchemes,
|
|
81
|
+
colorSchemes = _ref2$colorSchemes === void 0 ? {} : _ref2$colorSchemes,
|
|
82
|
+
_ref2$components = _ref2.components,
|
|
83
|
+
components = _ref2$components === void 0 ? {} : _ref2$components,
|
|
84
|
+
_ref2$generateCssVars = _ref2.generateCssVars,
|
|
85
|
+
generateCssVars = _ref2$generateCssVars === void 0 ? function () {
|
|
83
86
|
return {
|
|
84
87
|
vars: {},
|
|
85
88
|
css: {}
|
|
86
89
|
};
|
|
87
|
-
} :
|
|
88
|
-
cssVarPrefix =
|
|
89
|
-
restThemeProp = _objectWithoutProperties(
|
|
90
|
+
} : _ref2$generateCssVars,
|
|
91
|
+
cssVarPrefix = _ref2.cssVarPrefix,
|
|
92
|
+
restThemeProp = _objectWithoutProperties(_ref2, ["colorSchemes", "components", "generateCssVars", "cssVarPrefix"]);
|
|
90
93
|
var allColorSchemes = Object.keys(colorSchemes);
|
|
91
94
|
var defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
92
95
|
var defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
@@ -155,10 +158,10 @@ export default function createCssVarsProvider(options) {
|
|
|
155
158
|
// The other color schemes uses selector, default as data attribute, to increase the CSS specificity so that they can override the default color scheme stylesheet.
|
|
156
159
|
var defaultColorSchemeStyleSheet = {};
|
|
157
160
|
var otherColorSchemesStyleSheet = {};
|
|
158
|
-
Object.entries(colorSchemes).forEach(function (
|
|
159
|
-
var
|
|
160
|
-
key =
|
|
161
|
-
scheme =
|
|
161
|
+
Object.entries(colorSchemes).forEach(function (_ref3) {
|
|
162
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
163
|
+
key = _ref4[0],
|
|
164
|
+
scheme = _ref4[1];
|
|
162
165
|
var _generateCssVars2 = generateCssVars(key),
|
|
163
166
|
css = _generateCssVars2.css,
|
|
164
167
|
vars = _generateCssVars2.vars;
|
|
@@ -264,6 +267,7 @@ export default function createCssVarsProvider(options) {
|
|
|
264
267
|
styles: otherColorSchemesStyleSheet
|
|
265
268
|
})]
|
|
266
269
|
}), /*#__PURE__*/_jsx(ThemeProvider, {
|
|
270
|
+
themeId: scopedTheme ? themeId : undefined,
|
|
267
271
|
theme: resolveTheme ? resolveTheme(theme) : theme,
|
|
268
272
|
children: children
|
|
269
273
|
})]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
4
|
import { deepmerge } from '@mui/utils';
|
|
@@ -45,11 +46,14 @@ function prepareCssVars(theme, parserConfig) {
|
|
|
45
46
|
var generateCssVars = function generateCssVars(colorScheme) {
|
|
46
47
|
if (!colorScheme) {
|
|
47
48
|
return {
|
|
48
|
-
css: rootCss,
|
|
49
|
+
css: _extends({}, rootCss),
|
|
49
50
|
vars: rootVars
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
return
|
|
53
|
+
return {
|
|
54
|
+
css: _extends({}, colorSchemesMap[colorScheme].css),
|
|
55
|
+
vars: colorSchemesMap[colorScheme].vars
|
|
56
|
+
};
|
|
53
57
|
};
|
|
54
58
|
return {
|
|
55
59
|
vars: themeVars,
|
package/legacy/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/system v5.
|
|
2
|
+
* @mui/system v5.12.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
|
|
9
|
-
export { css, keyframes,
|
|
9
|
+
export { css, keyframes, StyledEngineProvider } from '@mui/styled-engine';
|
|
10
|
+
export { default as GlobalStyles } from './GlobalStyles';
|
|
10
11
|
export { default as borders } from './borders';
|
|
11
12
|
export * from './borders';
|
|
12
13
|
export { default as breakpoints } from './breakpoints';
|
|
@@ -3,8 +3,12 @@ import useTheme from '../useTheme';
|
|
|
3
3
|
export default function useThemeProps(_ref) {
|
|
4
4
|
var props = _ref.props,
|
|
5
5
|
name = _ref.name,
|
|
6
|
-
defaultTheme = _ref.defaultTheme
|
|
6
|
+
defaultTheme = _ref.defaultTheme,
|
|
7
|
+
themeId = _ref.themeId;
|
|
7
8
|
var theme = useTheme(defaultTheme);
|
|
9
|
+
if (themeId) {
|
|
10
|
+
theme = theme[themeId] || theme;
|
|
11
|
+
}
|
|
8
12
|
var mergedProps = getThemeProps({
|
|
9
13
|
theme: theme,
|
|
10
14
|
name: name,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ThemeContext } from '@mui/styled-engine';
|
|
2
3
|
function isObjectEmpty(obj) {
|
|
3
4
|
return Object.keys(obj).length === 0;
|
|
4
5
|
}
|
|
5
6
|
function useTheme() {
|
|
6
7
|
var defaultTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
7
|
-
var contextTheme =
|
|
8
|
+
var contextTheme = React.useContext(ThemeContext);
|
|
8
9
|
return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme;
|
|
9
10
|
}
|
|
10
11
|
export default useTheme;
|