@mui/system 6.1.6 → 6.1.7
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 +58 -4
- package/ThemeProvider/ThemeProvider.js +2 -2
- package/esm/ThemeProvider/ThemeProvider.js +2 -2
- package/esm/useMediaQuery/useMediaQuery.js +44 -32
- package/esm/version/index.js +2 -2
- package/index.js +1 -1
- package/modern/ThemeProvider/ThemeProvider.js +2 -2
- package/modern/index.js +1 -1
- package/modern/useMediaQuery/useMediaQuery.js +44 -32
- package/modern/version/index.js +2 -2
- package/package.json +5 -5
- package/useMediaQuery/useMediaQuery.d.ts +5 -1
- package/useMediaQuery/useMediaQuery.js +46 -33
- package/version/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## v6.1.7
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.1.6..master -->
|
|
6
|
+
|
|
7
|
+
_Nov 13, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 13 contributors who made this release possible.
|
|
10
|
+
This release includes fixes as well as documentation improvements.
|
|
11
|
+
|
|
12
|
+
### `@mui/material@6.1.7`
|
|
13
|
+
|
|
14
|
+
- Fix default props theme scoping (#44340) @siriwatknp
|
|
15
|
+
- Support theme scoping in `useMediaQuery` (#44339) @siriwatknp
|
|
16
|
+
- [Grid] Fix regression spacing prop with string value (#44376) @siriwatknp
|
|
17
|
+
|
|
18
|
+
### `@mui/styled-engine-sc@6.1.7`
|
|
19
|
+
|
|
20
|
+
- Fix missing `@types/hoist-non-react-statics` causing `styled` returns any (#44397) @megos
|
|
21
|
+
|
|
22
|
+
### Docs
|
|
23
|
+
|
|
24
|
+
- Replace 'Experimental APIs - Toolpad' with 'Toolpad (Beta)' (#44388) @prakhargupta1
|
|
25
|
+
- Fix Pigment CSS install (#44353) @oliviertassinari
|
|
26
|
+
- Fix dashboard menu warning (#44317) @siriwatknp
|
|
27
|
+
- Add runtime theme section for Material Pigment CSS (#44137) @siriwatknp
|
|
28
|
+
- Add hash to `key` to remove noise from console (#44289) @sai6855
|
|
29
|
+
- Revise Example Projects and Related Projects pages (#44191) @samuelsycamore
|
|
30
|
+
- [material-ui] Fix typo in typography theme set up for templates (#44338) @navedqb
|
|
31
|
+
- [material-ui] Add StackBlitz/CodeSandbox buttons to template cards (#44253) @zanivan
|
|
32
|
+
- [material-ui] Fix Sign-in/Sign-up templates layout (#44281) @zanivan
|
|
33
|
+
- [material-ui] Remove noise in template (#44260) @oliviertassinari
|
|
34
|
+
- [material-ui][Rating] Add uncontrolled example to Basic Rating demo (#44386) @sai6855
|
|
35
|
+
- [material-ui][TextField] Replace InputProps with slotProps.input in demo (#44288) @sai6855
|
|
36
|
+
|
|
37
|
+
### Core
|
|
38
|
+
|
|
39
|
+
- [blog] Follow media asset guidelines (#44374) @oliviertassinari
|
|
40
|
+
- [code-infra] Changes for test util to work in `vitest` (#43625) @JCQuintas
|
|
41
|
+
- Remove old marked JS options (#44375) @ZeeshanTamboli
|
|
42
|
+
- Fix webpack capitalization (#44352) @oliviertassinari
|
|
43
|
+
- Fix Next.js link 404 (710cd95) @oliviertassinari
|
|
44
|
+
- Update Gold sponsoring backlinks (#44316) @oliviertassinari
|
|
45
|
+
- Fix tools-public.mui.com redirection (9196fa5) @oliviertassinari
|
|
46
|
+
- Remove blank AlertTitle test file (#44282) @ZeeshanTamboli
|
|
47
|
+
- [docs-infra] Fix ad in RTL (#44345) @oliviertassinari
|
|
48
|
+
- [docs-infra] Enforce punctuation on descriptions (#44292) @oliviertassinari
|
|
49
|
+
- [docs-infra] Add CodeSandbox and StackBlitz to vale vocab (6db477a) @oliviertassinari
|
|
50
|
+
- [docs-infra] Fix correct spelling of VS Code (#44277) @oliviertassinari
|
|
51
|
+
- [docs-infra] Add a `rawDescriptions` option (#44390) @vladmoroz
|
|
52
|
+
- [examples] Add missing `clsx` dependency (#43526) @Janpot
|
|
53
|
+
- [infra] Fix @renovate[bot] appearing in changelog (#44275) @mnajdova
|
|
54
|
+
|
|
55
|
+
All contributors of this release in alphabetical order: @Janpot, @JCQuintas, @megos, @mnajdova, @navedqb, @oliviertassinari, @prakhargupta1, @sai6855, @samuelsycamore, @siriwatknp, @vladmoroz, @zanivan, @ZeeshanTamboli
|
|
56
|
+
|
|
57
|
+
## v6.1.6
|
|
4
58
|
|
|
5
59
|
<!-- generated comparing v6.1.5..master -->
|
|
6
60
|
|
|
@@ -52,7 +106,7 @@ A big thanks to the 13 contributors who made this release possible.
|
|
|
52
106
|
|
|
53
107
|
All contributors of this release in alphabetical order: @aarongarciah, @blackcow1987, @DiegoAndai, @jimmycallin, @joshkel, @mnajdova, @navedqb, @nphmuller, @o-alexandrov, @oliviertassinari, @prakhargupta1, @sai6855, @siriwatknp
|
|
54
108
|
|
|
55
|
-
##
|
|
109
|
+
## v6.1.5
|
|
56
110
|
|
|
57
111
|
<!-- generated comparing v6.1.4..master -->
|
|
58
112
|
|
|
@@ -84,7 +138,7 @@ A big thanks to the 9 contributors who made this release possible.
|
|
|
84
138
|
- [material-ui][TextField] Dynamically modify the eye password button aria-label (#44122) @ChinoUkaegbu
|
|
85
139
|
- [icons] Run pnpm docs:mdicons:synonyms (#44098) @oliviertassinari
|
|
86
140
|
- [joy-ui] Update Overview copy to match Readme (#44136) @samuelsycamore
|
|
87
|
-
- Add CodeSandbox/
|
|
141
|
+
- Add CodeSandbox/StackBlitz to the rest of the templates (#43708) @siriwatknp
|
|
88
142
|
- Update Figma link to fix 301 (a7b7d9c) @oliviertassinari
|
|
89
143
|
- Link Toolpad from Core repo (#44111) @prakhargupta1
|
|
90
144
|
- Remove HighlightedCode max-width (#43731) @Janpot
|
|
@@ -254,7 +308,7 @@ A big thanks to the 13 contributors who made this release possible.
|
|
|
254
308
|
- Uniformity in version range @oliviertassinari
|
|
255
309
|
- Replace `toBeAriaHidden` matcher with `toBeInaccessible` in tests (#43870) @ZeeshanTamboli
|
|
256
310
|
- [docs-infra] Strengthen CSP (#43711) @oliviertassinari
|
|
257
|
-
- [docs-infra] Open
|
|
311
|
+
- [docs-infra] Open CodeSandbox demo with fontsize=12 (#43860) @siriwatknp
|
|
258
312
|
- [icons] Reduce Material Icon page size (#43911) @oliviertassinari
|
|
259
313
|
- [test] Point Istanbul to correct URL (#43935) @sai6855
|
|
260
314
|
- [test] Sync React.version parse logic with codebase (#43820) @oliviertassinari
|
|
@@ -65,7 +65,7 @@ function ThemeProvider(props) {
|
|
|
65
65
|
}
|
|
66
66
|
const engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
|
|
67
67
|
const privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
|
|
68
|
-
const rtlValue = engineTheme.direction === 'rtl';
|
|
68
|
+
const rtlValue = (themeId ? engineTheme[themeId] : engineTheme).direction === 'rtl';
|
|
69
69
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_privateTheming.ThemeProvider, {
|
|
70
70
|
theme: privateTheme,
|
|
71
71
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.ThemeContext.Provider, {
|
|
@@ -73,7 +73,7 @@ function ThemeProvider(props) {
|
|
|
73
73
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RtlProvider.default, {
|
|
74
74
|
value: rtlValue,
|
|
75
75
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultPropsProvider.default, {
|
|
76
|
-
value: engineTheme
|
|
76
|
+
value: themeId ? engineTheme[themeId].components : engineTheme.components,
|
|
77
77
|
children: children
|
|
78
78
|
})
|
|
79
79
|
})
|
|
@@ -58,7 +58,7 @@ function ThemeProvider(props) {
|
|
|
58
58
|
}
|
|
59
59
|
const engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
|
|
60
60
|
const privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
|
|
61
|
-
const rtlValue = engineTheme.direction === 'rtl';
|
|
61
|
+
const rtlValue = (themeId ? engineTheme[themeId] : engineTheme).direction === 'rtl';
|
|
62
62
|
return /*#__PURE__*/_jsx(MuiThemeProvider, {
|
|
63
63
|
theme: privateTheme,
|
|
64
64
|
children: /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
|
|
@@ -66,7 +66,7 @@ function ThemeProvider(props) {
|
|
|
66
66
|
children: /*#__PURE__*/_jsx(RtlProvider, {
|
|
67
67
|
value: rtlValue,
|
|
68
68
|
children: /*#__PURE__*/_jsx(DefaultPropsProvider, {
|
|
69
|
-
value: engineTheme
|
|
69
|
+
value: themeId ? engineTheme[themeId].components : engineTheme.components,
|
|
70
70
|
children: children
|
|
71
71
|
})
|
|
72
72
|
})
|
|
@@ -69,38 +69,50 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
69
69
|
const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
70
70
|
return match;
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// All the browsers MUI support have this built-in.
|
|
76
|
-
// This defensive check is here for simplicity.
|
|
77
|
-
// Most of the time, the match media logic isn't central to people tests.
|
|
78
|
-
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
74
|
+
export function unstable_createUseMediaQuery(params = {}) {
|
|
79
75
|
const {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
props: options,
|
|
87
|
-
theme
|
|
88
|
-
});
|
|
89
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
90
|
-
if (typeof queryInput === 'function' && theme === null) {
|
|
91
|
-
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'));
|
|
76
|
+
themeId
|
|
77
|
+
} = params;
|
|
78
|
+
return function useMediaQuery(queryInput, options = {}) {
|
|
79
|
+
let theme = useTheme();
|
|
80
|
+
if (theme && themeId) {
|
|
81
|
+
theme = theme[themeId] || theme;
|
|
92
82
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
83
|
+
// Wait for jsdom to support the match media feature.
|
|
84
|
+
// All the browsers MUI support have this built-in.
|
|
85
|
+
// This defensive check is here for simplicity.
|
|
86
|
+
// Most of the time, the match media logic isn't central to people tests.
|
|
87
|
+
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
88
|
+
const {
|
|
89
|
+
defaultMatches = false,
|
|
90
|
+
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
91
|
+
ssrMatchMedia = null,
|
|
92
|
+
noSsr = false
|
|
93
|
+
} = getThemeProps({
|
|
94
|
+
name: 'MuiUseMediaQuery',
|
|
95
|
+
props: options,
|
|
96
|
+
theme
|
|
103
97
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
99
|
+
if (typeof queryInput === 'function' && theme === null) {
|
|
100
|
+
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'));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
|
104
|
+
query = query.replace(/^@media( ?)/m, '');
|
|
105
|
+
const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
|
106
|
+
const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
|
107
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
108
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
109
|
+
React.useDebugValue({
|
|
110
|
+
query,
|
|
111
|
+
match
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return match;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const useMediaQuery = unstable_createUseMediaQuery();
|
|
118
|
+
export default useMediaQuery;
|
package/esm/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.1.
|
|
1
|
+
export const version = "6.1.7";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("1");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("7");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/index.js
CHANGED
|
@@ -58,7 +58,7 @@ function ThemeProvider(props) {
|
|
|
58
58
|
}
|
|
59
59
|
const engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
|
|
60
60
|
const privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
|
|
61
|
-
const rtlValue = engineTheme.direction === 'rtl';
|
|
61
|
+
const rtlValue = (themeId ? engineTheme[themeId] : engineTheme).direction === 'rtl';
|
|
62
62
|
return /*#__PURE__*/_jsx(MuiThemeProvider, {
|
|
63
63
|
theme: privateTheme,
|
|
64
64
|
children: /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
|
|
@@ -66,7 +66,7 @@ function ThemeProvider(props) {
|
|
|
66
66
|
children: /*#__PURE__*/_jsx(RtlProvider, {
|
|
67
67
|
value: rtlValue,
|
|
68
68
|
children: /*#__PURE__*/_jsx(DefaultPropsProvider, {
|
|
69
|
-
value: engineTheme
|
|
69
|
+
value: themeId ? engineTheme[themeId].components : engineTheme.components,
|
|
70
70
|
children: children
|
|
71
71
|
})
|
|
72
72
|
})
|
package/modern/index.js
CHANGED
|
@@ -69,38 +69,50 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
69
69
|
const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
70
70
|
return match;
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// All the browsers MUI support have this built-in.
|
|
76
|
-
// This defensive check is here for simplicity.
|
|
77
|
-
// Most of the time, the match media logic isn't central to people tests.
|
|
78
|
-
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
74
|
+
export function unstable_createUseMediaQuery(params = {}) {
|
|
79
75
|
const {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
props: options,
|
|
87
|
-
theme
|
|
88
|
-
});
|
|
89
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
90
|
-
if (typeof queryInput === 'function' && theme === null) {
|
|
91
|
-
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'));
|
|
76
|
+
themeId
|
|
77
|
+
} = params;
|
|
78
|
+
return function useMediaQuery(queryInput, options = {}) {
|
|
79
|
+
let theme = useTheme();
|
|
80
|
+
if (theme && themeId) {
|
|
81
|
+
theme = theme[themeId] || theme;
|
|
92
82
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
83
|
+
// Wait for jsdom to support the match media feature.
|
|
84
|
+
// All the browsers MUI support have this built-in.
|
|
85
|
+
// This defensive check is here for simplicity.
|
|
86
|
+
// Most of the time, the match media logic isn't central to people tests.
|
|
87
|
+
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
88
|
+
const {
|
|
89
|
+
defaultMatches = false,
|
|
90
|
+
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
91
|
+
ssrMatchMedia = null,
|
|
92
|
+
noSsr = false
|
|
93
|
+
} = getThemeProps({
|
|
94
|
+
name: 'MuiUseMediaQuery',
|
|
95
|
+
props: options,
|
|
96
|
+
theme
|
|
103
97
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
99
|
+
if (typeof queryInput === 'function' && theme === null) {
|
|
100
|
+
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'));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
|
104
|
+
query = query.replace(/^@media( ?)/m, '');
|
|
105
|
+
const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
|
106
|
+
const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
|
107
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
108
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
109
|
+
React.useDebugValue({
|
|
110
|
+
query,
|
|
111
|
+
match
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return match;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const useMediaQuery = unstable_createUseMediaQuery();
|
|
118
|
+
export default useMediaQuery;
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.1.
|
|
1
|
+
export const version = "6.1.7";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("1");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("7");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"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.",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"csstype": "^3.1.3",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
|
-
"@mui/private-theming": "^6.1.
|
|
34
|
-
"@mui/
|
|
35
|
-
"@mui/styled-engine": "^6.1.
|
|
36
|
-
"@mui/
|
|
33
|
+
"@mui/private-theming": "^6.1.7",
|
|
34
|
+
"@mui/types": "^7.2.19",
|
|
35
|
+
"@mui/styled-engine": "^6.1.7",
|
|
36
|
+
"@mui/utils": "^6.1.7"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@emotion/react": "^11.5.0",
|
|
@@ -25,4 +25,8 @@ export interface UseMediaQueryOptions {
|
|
|
25
25
|
matches: boolean;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export declare function unstable_createUseMediaQuery(params?: {
|
|
29
|
+
themeId?: string;
|
|
30
|
+
}): <Theme = unknown>(queryInput: string | ((theme: Theme) => string), options?: UseMediaQueryOptions) => boolean;
|
|
31
|
+
declare const useMediaQuery: <Theme = unknown>(queryInput: string | ((theme: Theme) => string), options?: UseMediaQueryOptions) => boolean;
|
|
32
|
+
export default useMediaQuery;
|
|
@@ -6,7 +6,8 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.default =
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
exports.unstable_createUseMediaQuery = unstable_createUseMediaQuery;
|
|
10
11
|
var React = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
12
13
|
var _useThemeProps = require("../useThemeProps");
|
|
@@ -76,38 +77,50 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
76
77
|
const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
77
78
|
return match;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// All the browsers MUI support have this built-in.
|
|
83
|
-
// This defensive check is here for simplicity.
|
|
84
|
-
// Most of the time, the match media logic isn't central to people tests.
|
|
85
|
-
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
80
|
+
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
82
|
+
function unstable_createUseMediaQuery(params = {}) {
|
|
86
83
|
const {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
props: options,
|
|
94
|
-
theme
|
|
95
|
-
});
|
|
96
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
97
|
-
if (typeof queryInput === 'function' && theme === null) {
|
|
98
|
-
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'));
|
|
84
|
+
themeId
|
|
85
|
+
} = params;
|
|
86
|
+
return function useMediaQuery(queryInput, options = {}) {
|
|
87
|
+
let theme = (0, _useThemeWithoutDefault.default)();
|
|
88
|
+
if (theme && themeId) {
|
|
89
|
+
theme = theme[themeId] || theme;
|
|
99
90
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
91
|
+
// Wait for jsdom to support the match media feature.
|
|
92
|
+
// All the browsers MUI support have this built-in.
|
|
93
|
+
// This defensive check is here for simplicity.
|
|
94
|
+
// Most of the time, the match media logic isn't central to people tests.
|
|
95
|
+
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
96
|
+
const {
|
|
97
|
+
defaultMatches = false,
|
|
98
|
+
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
99
|
+
ssrMatchMedia = null,
|
|
100
|
+
noSsr = false
|
|
101
|
+
} = (0, _useThemeProps.getThemeProps)({
|
|
102
|
+
name: 'MuiUseMediaQuery',
|
|
103
|
+
props: options,
|
|
104
|
+
theme
|
|
110
105
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
107
|
+
if (typeof queryInput === 'function' && theme === null) {
|
|
108
|
+
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'));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
|
112
|
+
query = query.replace(/^@media( ?)/m, '');
|
|
113
|
+
const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
|
114
|
+
const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
|
115
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
116
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
117
|
+
React.useDebugValue({
|
|
118
|
+
query,
|
|
119
|
+
match
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return match;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const useMediaQuery = unstable_createUseMediaQuery();
|
|
126
|
+
var _default = exports.default = useMediaQuery;
|
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 = "6.1.
|
|
7
|
+
const version = exports.version = "6.1.7";
|
|
8
8
|
const major = exports.major = Number("6");
|
|
9
9
|
const minor = exports.minor = Number("1");
|
|
10
|
-
const patch = exports.patch = Number("
|
|
10
|
+
const patch = exports.patch = Number("7");
|
|
11
11
|
const prerelease = exports.prerelease = undefined;
|
|
12
12
|
var _default = exports.default = version;
|