@mui/system 9.0.0 → 9.0.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 +132 -1245
- package/Grid/createGrid.js +1 -1
- package/Grid/createGrid.mjs +1 -1
- package/ThemeProvider/ThemeProvider.d.mts +1 -0
- package/ThemeProvider/ThemeProvider.d.ts +1 -0
- package/breakpoints/breakpoints.d.mts +1 -1
- package/breakpoints/breakpoints.d.ts +1 -1
- package/cssContainerQueries/cssContainerQueries.js +2 -0
- package/cssContainerQueries/cssContainerQueries.mjs +2 -0
- package/cssVars/createCssVarsProvider.js +1 -0
- package/cssVars/createCssVarsProvider.mjs +1 -0
- package/cssVars/prepareCssVars.js +1 -1
- package/cssVars/prepareCssVars.mjs +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +4 -4
- package/styleFunctionSx/styleFunctionSx.js +1 -1
- package/styleFunctionSx/styleFunctionSx.mjs +1 -1
- package/useMediaQuery/useMediaQuery.js +11 -1
- package/useMediaQuery/useMediaQuery.mjs +11 -1
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
package/Grid/createGrid.js
CHANGED
|
@@ -150,7 +150,7 @@ function createGrid(options = {}) {
|
|
|
150
150
|
wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
151
151
|
} : void 0;
|
|
152
152
|
|
|
153
|
-
// @ts-
|
|
153
|
+
// @ts-expect-error internal logic for nested grid
|
|
154
154
|
Grid.muiName = 'Grid';
|
|
155
155
|
return Grid;
|
|
156
156
|
}
|
package/Grid/createGrid.mjs
CHANGED
|
@@ -143,7 +143,7 @@ export default function createGrid(options = {}) {
|
|
|
143
143
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
144
144
|
} : void 0;
|
|
145
145
|
|
|
146
|
-
// @ts-
|
|
146
|
+
// @ts-expect-error internal logic for nested grid
|
|
147
147
|
Grid.muiName = 'Grid';
|
|
148
148
|
return Grid;
|
|
149
149
|
}
|
|
@@ -14,6 +14,7 @@ export interface ThemeProviderProps<Theme = DefaultTheme> {
|
|
|
14
14
|
theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// #host-reference
|
|
17
18
|
/**
|
|
18
19
|
* This component makes the `theme` available down the React tree.
|
|
19
20
|
* It should preferably be used at **the root of your component tree**.
|
|
@@ -14,6 +14,7 @@ export interface ThemeProviderProps<Theme = DefaultTheme> {
|
|
|
14
14
|
theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// #host-reference
|
|
17
18
|
/**
|
|
18
19
|
* This component makes the `theme` available down the React tree.
|
|
19
20
|
* It should preferably be used at **the root of your component tree**.
|
|
@@ -19,4 +19,4 @@ type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
|
19
19
|
/**
|
|
20
20
|
* @returns An enhanced stylefunction that considers breakpoints
|
|
21
21
|
*/
|
|
22
|
-
export default function breakpoints<Props,
|
|
22
|
+
export default function breakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
|
|
@@ -19,4 +19,4 @@ type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
|
19
19
|
/**
|
|
20
20
|
* @returns An enhanced stylefunction that considers breakpoints
|
|
21
21
|
*/
|
|
22
|
-
export default function breakpoints<Props,
|
|
22
|
+
export default function breakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
|
|
@@ -53,6 +53,8 @@ function getContainerQuery(theme, shorthand) {
|
|
|
53
53
|
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
54
54
|
if (!matches) {
|
|
55
55
|
if (process.env.NODE_ENV !== 'production') {
|
|
56
|
+
// TODO: avoid throwing during React render only in development.
|
|
57
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
56
58
|
throw /* minify-error */new Error(`MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.');
|
|
57
59
|
}
|
|
58
60
|
return null;
|
|
@@ -44,6 +44,8 @@ export function getContainerQuery(theme, shorthand) {
|
|
|
44
44
|
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
45
45
|
if (!matches) {
|
|
46
46
|
if (process.env.NODE_ENV !== 'production') {
|
|
47
|
+
// TODO: avoid throwing during React render only in development.
|
|
48
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
47
49
|
throw /* minify-error */new Error(`MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.');
|
|
48
50
|
}
|
|
49
51
|
return null;
|
|
@@ -238,6 +238,7 @@ function createCssVarsProvider(options) {
|
|
|
238
238
|
setColorScheme,
|
|
239
239
|
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
240
240
|
if (memoTheme.colorSchemeSelector === 'media') {
|
|
241
|
+
// #host-reference
|
|
241
242
|
console.error(['MUI: The `setMode` function has no effect if `colorSchemeSelector` is `media` (`media` is the default value).', 'To toggle the mode manually, please configure `colorSchemeSelector` to use a class or data attribute.', 'To learn more, visit https://mui.com/material-ui/customization/css-theme-variables/configuration/#toggling-dark-mode-manually'].join('\n'));
|
|
242
243
|
}
|
|
243
244
|
setMode(newMode);
|
|
@@ -230,6 +230,7 @@ export default function createCssVarsProvider(options) {
|
|
|
230
230
|
setColorScheme,
|
|
231
231
|
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
232
232
|
if (memoTheme.colorSchemeSelector === 'media') {
|
|
233
|
+
// #host-reference
|
|
233
234
|
console.error(['MUI: The `setMode` function has no effect if `colorSchemeSelector` is `media` (`media` is the default value).', 'To toggle the mode manually, please configure `colorSchemeSelector` to use a class or data attribute.', 'To learn more, visit https://mui.com/material-ui/customization/css-theme-variables/configuration/#toggling-dark-mode-manually'].join('\n'));
|
|
234
235
|
}
|
|
235
236
|
setMode(newMode);
|
|
@@ -14,7 +14,7 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
14
14
|
colorSchemeSelector: selector,
|
|
15
15
|
enableContrastVars
|
|
16
16
|
} = parserConfig;
|
|
17
|
-
// @ts-
|
|
17
|
+
// @ts-expect-error - ignore components do not exist
|
|
18
18
|
const {
|
|
19
19
|
colorSchemes = {},
|
|
20
20
|
components,
|
|
@@ -7,7 +7,7 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
7
7
|
colorSchemeSelector: selector,
|
|
8
8
|
enableContrastVars
|
|
9
9
|
} = parserConfig;
|
|
10
|
-
// @ts-
|
|
10
|
+
// @ts-expect-error - ignore components do not exist
|
|
11
11
|
const {
|
|
12
12
|
colorSchemes = {},
|
|
13
13
|
components,
|
package/index.js
CHANGED
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "MUI System is a set of CSS utilities to help you build custom designs more efficiently. It makes it possible to rapidly lay out custom designs.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"clsx": "^2.1.1",
|
|
29
29
|
"csstype": "^3.2.3",
|
|
30
30
|
"prop-types": "^15.8.1",
|
|
31
|
-
"@mui/private-theming": "^9.0.
|
|
31
|
+
"@mui/private-theming": "^9.0.1",
|
|
32
32
|
"@mui/styled-engine": "^9.0.0",
|
|
33
|
-
"@mui/
|
|
34
|
-
"@mui/
|
|
33
|
+
"@mui/types": "^9.0.0",
|
|
34
|
+
"@mui/utils": "^9.0.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@emotion/react": "^11.5.0",
|
|
@@ -118,7 +118,7 @@ function setThemeValue(css, prop, value, theme, config) {
|
|
|
118
118
|
const finalValue = (0, _style.getStyleValue2)(themeMapping, transform, valueFinal, prop);
|
|
119
119
|
if (cssProperty === false) {
|
|
120
120
|
if (mediaKey) {
|
|
121
|
-
css[mediaKey]
|
|
121
|
+
(0, _fastDeepAssign.default)(css[mediaKey], finalValue);
|
|
122
122
|
} else {
|
|
123
123
|
(0, _fastDeepAssign.default)(css, finalValue);
|
|
124
124
|
}
|
|
@@ -111,7 +111,7 @@ function setThemeValue(css, prop, value, theme, config) {
|
|
|
111
111
|
const finalValue = getStyleValue2(themeMapping, transform, valueFinal, prop);
|
|
112
112
|
if (cssProperty === false) {
|
|
113
113
|
if (mediaKey) {
|
|
114
|
-
css[mediaKey]
|
|
114
|
+
merge(css[mediaKey], finalValue);
|
|
115
115
|
} else {
|
|
116
116
|
merge(css, finalValue);
|
|
117
117
|
}
|
|
@@ -93,9 +93,10 @@ function unstable_createUseMediaQuery(params = {}) {
|
|
|
93
93
|
// This defensive check is here for simplicity.
|
|
94
94
|
// Most of the time, the match media logic isn't central to people tests.
|
|
95
95
|
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
96
|
+
const fallbackMatchMedia = supportMatchMedia ? window.matchMedia : null;
|
|
96
97
|
const {
|
|
97
98
|
defaultMatches = false,
|
|
98
|
-
matchMedia
|
|
99
|
+
matchMedia: customMatchMedia,
|
|
99
100
|
ssrMatchMedia = null,
|
|
100
101
|
noSsr = false
|
|
101
102
|
} = (0, _useThemeProps.getThemeProps)({
|
|
@@ -103,6 +104,15 @@ function unstable_createUseMediaQuery(params = {}) {
|
|
|
103
104
|
props: options,
|
|
104
105
|
theme
|
|
105
106
|
});
|
|
107
|
+
const matchMedia = React.useMemo(() => {
|
|
108
|
+
if (customMatchMedia !== undefined) {
|
|
109
|
+
return customMatchMedia;
|
|
110
|
+
}
|
|
111
|
+
if (fallbackMatchMedia === null) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return fallbackMatchMedia.bind(window);
|
|
115
|
+
}, [customMatchMedia, fallbackMatchMedia]);
|
|
106
116
|
if (process.env.NODE_ENV !== 'production') {
|
|
107
117
|
if (typeof queryInput === 'function' && theme === null) {
|
|
108
118
|
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'));
|
|
@@ -85,9 +85,10 @@ export function unstable_createUseMediaQuery(params = {}) {
|
|
|
85
85
|
// This defensive check is here for simplicity.
|
|
86
86
|
// Most of the time, the match media logic isn't central to people tests.
|
|
87
87
|
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
88
|
+
const fallbackMatchMedia = supportMatchMedia ? window.matchMedia : null;
|
|
88
89
|
const {
|
|
89
90
|
defaultMatches = false,
|
|
90
|
-
matchMedia
|
|
91
|
+
matchMedia: customMatchMedia,
|
|
91
92
|
ssrMatchMedia = null,
|
|
92
93
|
noSsr = false
|
|
93
94
|
} = getThemeProps({
|
|
@@ -95,6 +96,15 @@ export function unstable_createUseMediaQuery(params = {}) {
|
|
|
95
96
|
props: options,
|
|
96
97
|
theme
|
|
97
98
|
});
|
|
99
|
+
const matchMedia = React.useMemo(() => {
|
|
100
|
+
if (customMatchMedia !== undefined) {
|
|
101
|
+
return customMatchMedia;
|
|
102
|
+
}
|
|
103
|
+
if (fallbackMatchMedia === null) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return fallbackMatchMedia.bind(window);
|
|
107
|
+
}, [customMatchMedia, fallbackMatchMedia]);
|
|
98
108
|
if (process.env.NODE_ENV !== 'production') {
|
|
99
109
|
if (typeof queryInput === 'function' && theme === null) {
|
|
100
110
|
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'));
|
package/version/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
|
|
7
|
-
const version = exports.version = "9.0.
|
|
7
|
+
const version = exports.version = "9.0.1";
|
|
8
8
|
const major = exports.major = Number("9");
|
|
9
9
|
const minor = exports.minor = Number("0");
|
|
10
|
-
const patch = exports.patch = Number("
|
|
10
|
+
const patch = exports.patch = Number("1");
|
|
11
11
|
const prerelease = exports.prerelease = undefined;
|
|
12
12
|
var _default = exports.default = version;
|
package/version/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "9.0.
|
|
1
|
+
export const version = "9.0.1";
|
|
2
2
|
export const major = Number("9");
|
|
3
3
|
export const minor = Number("0");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("1");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|