@mui/system 6.1.5 → 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 +111 -5
- package/InitColorSchemeScript/InitColorSchemeScript.d.ts +8 -9
- 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 +6 -6
- 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,112 @@
|
|
|
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
|
|
58
|
+
|
|
59
|
+
<!-- generated comparing v6.1.5..master -->
|
|
60
|
+
|
|
61
|
+
_Oct 30, 2024_
|
|
62
|
+
|
|
63
|
+
A big thanks to the 13 contributors who made this release possible.
|
|
64
|
+
|
|
65
|
+
### `@mui/material@6.1.6`
|
|
66
|
+
|
|
67
|
+
- [Autocomplete] Add missing `onMouseDown` type to AutocompleteRenderInputParams (#44183) @sai6855
|
|
68
|
+
- [Avatar] Fix AvatarGroup spacing (#44208) @aarongarciah
|
|
69
|
+
- [AvatarGroup] Fix spacing CSS variable (#44202) @navedqb
|
|
70
|
+
- [Divider] Fix CSS specificity order (#44204) @o-alexandrov
|
|
71
|
+
- [Slider] Fix value prop type warning (#44131) @joshkel
|
|
72
|
+
- Replace `useThemeProps` with `useDefaultProps` (#44193) @siriwatknp
|
|
73
|
+
|
|
74
|
+
### `@mui/material-nextjs@6.1.6`
|
|
75
|
+
|
|
76
|
+
- Support Next 15.0.0 (#42428) @nphmuller
|
|
77
|
+
|
|
78
|
+
### `@mui/lab@6.0.0-beta.14`
|
|
79
|
+
|
|
80
|
+
- [Tabs] Fix type of TabPanel component (#44207) @blackcow1987
|
|
81
|
+
|
|
82
|
+
### `@mui/codemod@6.1.6`
|
|
83
|
+
|
|
84
|
+
- Fix system props default import specifier (#44170) @siriwatknp
|
|
85
|
+
|
|
86
|
+
### `@mui/utils@6.1.6`
|
|
87
|
+
|
|
88
|
+
- Bring back useIsFocusVisible (#44256) @aarongarciah
|
|
89
|
+
- Bring back getReactNodeRef (#44248) @aarongarciah
|
|
90
|
+
|
|
91
|
+
### Docs
|
|
92
|
+
|
|
93
|
+
- [material-ui][Avatar] Add AvatarGroup spacing demo (#44209) @aarongarciah
|
|
94
|
+
- Fix a typo in CONTRIBUTING.md (#44200) @prakhargupta1
|
|
95
|
+
- Mark the Hidden component as deprecated in the sidenav (#44068) @jimmycallin
|
|
96
|
+
- Use () when referencing functions (#44184) @oliviertassinari
|
|
97
|
+
- Follow types description convention (#44187) @oliviertassinari
|
|
98
|
+
|
|
99
|
+
### Core
|
|
100
|
+
|
|
101
|
+
- Lock file maintenance (#43947)
|
|
102
|
+
- Run @mui/icon-material src:icons (#44097) @oliviertassinari
|
|
103
|
+
- [test][material-ui] Add tests for Pigment Grid and Stack (#44132) @DiegoAndai
|
|
104
|
+
- [test] Distinguish private with public tests API (#44188) @oliviertassinari
|
|
105
|
+
- [docs-infra] Add recursively the relative modules in the demos (#44150) @mnajdova
|
|
106
|
+
|
|
107
|
+
All contributors of this release in alphabetical order: @aarongarciah, @blackcow1987, @DiegoAndai, @jimmycallin, @joshkel, @mnajdova, @navedqb, @nphmuller, @o-alexandrov, @oliviertassinari, @prakhargupta1, @sai6855, @siriwatknp
|
|
108
|
+
|
|
109
|
+
## v6.1.5
|
|
4
110
|
|
|
5
111
|
<!-- generated comparing v6.1.4..master -->
|
|
6
112
|
|
|
@@ -32,7 +138,7 @@ A big thanks to the 9 contributors who made this release possible.
|
|
|
32
138
|
- [material-ui][TextField] Dynamically modify the eye password button aria-label (#44122) @ChinoUkaegbu
|
|
33
139
|
- [icons] Run pnpm docs:mdicons:synonyms (#44098) @oliviertassinari
|
|
34
140
|
- [joy-ui] Update Overview copy to match Readme (#44136) @samuelsycamore
|
|
35
|
-
- Add CodeSandbox/
|
|
141
|
+
- Add CodeSandbox/StackBlitz to the rest of the templates (#43708) @siriwatknp
|
|
36
142
|
- Update Figma link to fix 301 (a7b7d9c) @oliviertassinari
|
|
37
143
|
- Link Toolpad from Core repo (#44111) @prakhargupta1
|
|
38
144
|
- Remove HighlightedCode max-width (#43731) @Janpot
|
|
@@ -202,7 +308,7 @@ A big thanks to the 13 contributors who made this release possible.
|
|
|
202
308
|
- Uniformity in version range @oliviertassinari
|
|
203
309
|
- Replace `toBeAriaHidden` matcher with `toBeInaccessible` in tests (#43870) @ZeeshanTamboli
|
|
204
310
|
- [docs-infra] Strengthen CSP (#43711) @oliviertassinari
|
|
205
|
-
- [docs-infra] Open
|
|
311
|
+
- [docs-infra] Open CodeSandbox demo with fontsize=12 (#43860) @siriwatknp
|
|
206
312
|
- [icons] Reduce Material Icon page size (#43911) @oliviertassinari
|
|
207
313
|
- [test] Point Istanbul to correct URL (#43935) @sai6855
|
|
208
314
|
- [test] Sync React.version parse logic with codebase (#43820) @oliviertassinari
|
|
@@ -358,7 +464,7 @@ A big thanks to the 11 contributors who made this release possible.
|
|
|
358
464
|
|
|
359
465
|
### `@mui/material@6.0.2`
|
|
360
466
|
|
|
361
|
-
- Fix `createTheme` with just color schemes (#43518) @siriwatknp
|
|
467
|
+
- Fix `createTheme()` with just color schemes (#43518) @siriwatknp
|
|
362
468
|
- [Menu,Popover] Fix Backdrop props descriptions (#43503) @Michael-Hutchinson
|
|
363
469
|
- [MenuList] Do not react to an event with modifier key pressed (#43505) @MateuszGroth
|
|
364
470
|
|
|
@@ -1100,7 +1206,7 @@ A big thanks to the 18 contributors who made this release possible.
|
|
|
1100
1206
|
|
|
1101
1207
|
### Docs
|
|
1102
1208
|
|
|
1103
|
-
- Add `theme.applyStyles` and migrate docs (#42498) @siriwatknp
|
|
1209
|
+
- Add `theme.applyStyles()` and migrate docs (#42498) @siriwatknp
|
|
1104
1210
|
- Fix dashboard template console error (#42594) @oliviertassinari
|
|
1105
1211
|
- Migrate system props to `sx` prop (#42475) @siriwatknp
|
|
1106
1212
|
- [material-ui]Fix duplicated sentence (#42521) @alexfauquette
|
|
@@ -7,45 +7,44 @@ export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
|
|
|
7
7
|
export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
|
|
8
8
|
export interface InitColorSchemeScriptProps {
|
|
9
9
|
/**
|
|
10
|
-
* The default mode when the storage is empty (user's first visit)
|
|
10
|
+
* The default mode when the storage is empty (user's first visit).
|
|
11
11
|
* @default 'system'
|
|
12
12
|
*/
|
|
13
13
|
defaultMode?: 'system' | 'light' | 'dark';
|
|
14
14
|
/**
|
|
15
|
-
* The default color scheme to be used on the light mode
|
|
15
|
+
* The default color scheme to be used on the light mode.
|
|
16
16
|
* @default 'light'
|
|
17
17
|
*/
|
|
18
18
|
defaultLightColorScheme?: string;
|
|
19
19
|
/**
|
|
20
|
-
* The default color scheme to be used on the dark mode
|
|
20
|
+
* The default color scheme to be used on the dark mode.
|
|
21
21
|
* * @default 'dark'
|
|
22
22
|
*/
|
|
23
23
|
defaultDarkColorScheme?: string;
|
|
24
24
|
/**
|
|
25
|
-
* The node (provided as string) used to attach the color-scheme attribute
|
|
25
|
+
* The node (provided as string) used to attach the color-scheme attribute.
|
|
26
26
|
* @default 'document.documentElement'
|
|
27
27
|
*/
|
|
28
28
|
colorSchemeNode?: string;
|
|
29
29
|
/**
|
|
30
|
-
* localStorage key used to store `mode
|
|
30
|
+
* localStorage key used to store `mode`.
|
|
31
31
|
* @default 'mode'
|
|
32
32
|
*/
|
|
33
33
|
modeStorageKey?: string;
|
|
34
34
|
/**
|
|
35
|
-
* localStorage key used to store `colorScheme
|
|
35
|
+
* localStorage key used to store `colorScheme`.
|
|
36
36
|
* @default 'color-scheme'
|
|
37
37
|
*/
|
|
38
38
|
colorSchemeStorageKey?: string;
|
|
39
39
|
/**
|
|
40
|
-
* DOM attribute for applying color scheme
|
|
40
|
+
* DOM attribute for applying color scheme.
|
|
41
41
|
* @default 'data-color-scheme'
|
|
42
|
-
*
|
|
43
42
|
* @example '.mode-%s' // for class based color scheme
|
|
44
43
|
* @example '[data-mode-%s]' // for data-attribute without '='
|
|
45
44
|
*/
|
|
46
45
|
attribute?: 'class' | 'data' | string;
|
|
47
46
|
/**
|
|
48
|
-
* Nonce string to pass to the inline script for CSP headers
|
|
47
|
+
* Nonce string to pass to the inline script for CSP headers.
|
|
49
48
|
*/
|
|
50
49
|
nonce?: string | undefined;
|
|
51
50
|
}
|
|
@@ -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.",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.
|
|
29
|
+
"@babel/runtime": "^7.26.0",
|
|
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/
|
|
36
|
-
"@mui/utils": "^6.1.
|
|
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;
|