@mui/system 6.1.6 → 6.1.8

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 CHANGED
@@ -1,6 +1,113 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
- ## 6.1.6
3
+ ## v6.1.8
4
+
5
+ <!-- generated comparing v6.1.7..master -->
6
+
7
+ _Nov 20, 2024_
8
+
9
+ A big thanks to the 10 contributors who made this release possible.
10
+
11
+ TODO INSERT HIGHLIGHTS
12
+
13
+ ### `@mui/material@6.1.8`
14
+
15
+ - [Autocomplete] Use `ul` element for the listbox (#44422) @DiegoAndai
16
+ - [Grid2] Remove item and zeroMinWidth classes from grid2Classes (#44419) @sai6855
17
+ - [StepIcon] Add SvgIconOwnProps type to StepIcon props (#44337) @sai6855
18
+ - Add generic back to `useMediaQuery` to prevent a breaking change (#44455) @siriwatknp
19
+ - [Tooltip] Deprecate `*Component` and `*Props` for v6 (#44350) @siriwatknp
20
+
21
+ ### `@mui/system@6.1.8`
22
+
23
+ - Warn when calling `setMode` without configuring `colorSchemeSelector` (#43783) @siriwatknp
24
+
25
+ ### `@mui/styled-engine@6.1.8`
26
+
27
+ - Add back removed internal function (#44421) @mnajdova
28
+
29
+ ### `@mui/utils@6.1.8`
30
+
31
+ - Skip deep clone React element (#44400) @siriwatknp
32
+ - Add documentation to `useForkRef` (#44410) @JCQuintas
33
+
34
+ ### Docs
35
+
36
+ - [Accordion] Replace hardcoded classes with constants in demos (#44453) @ZeeshanTamboli
37
+ - [material-ui][Autocomplete] Fix virtualization demo (#44382) @DiegoAndai
38
+ - Revert #44388 (#44454) @prakhargupta1
39
+ - Add App starters in related-projects.md (#44315) @oliviertassinari
40
+ - Bring back `*Component` and `*Props` codemods and deprecation messages (#44383) @DiegoAndai
41
+ - [docs] Copyedit Templates page (#44461) @samuelsycamore
42
+
43
+ ### Core
44
+
45
+ - Remove `stylis-plugin-rtl-sc` (#44447) @renovate[bot]
46
+ - [test][Autocomplete] Make virtualize regression screenshots deterministic (#44425) @DiegoAndai
47
+ - [blog] Fix reference to subdomain on MUI X v8 alpha zero post (#44416) @joserodolfofreitas
48
+ - [blog] MUI X v8 alpha zero blog post (#44377) @joserodolfofreitas
49
+ - [code-infra] Use vitest-compatible skip in `describeConformance` (#44412) @JCQuintas
50
+ - Keep OpenSSF badge up-to-date (aef2bf2) @oliviertassinari
51
+ - Polish useForkRef docs (#44424) @oliviertassinari
52
+ - [infra] Upgrade Cherry-pick workflow to latest (#44448) @oliviertassinari
53
+
54
+ All contributors of this release in alphabetical order: @DiegoAndai, @JCQuintas, @joserodolfofreitas, @mnajdova, @oliviertassinari, @prakhargupta1, @sai6855, samuelsycamore, @siriwatknp, @ZeeshanTamboli
55
+
56
+ ## v6.1.7
57
+
58
+ <!-- generated comparing v6.1.6..master -->
59
+
60
+ _Nov 13, 2024_
61
+
62
+ A big thanks to the 13 contributors who made this release possible.
63
+ This release includes fixes as well as documentation improvements.
64
+
65
+ ### `@mui/material@6.1.7`
66
+
67
+ - Fix default props theme scoping (#44340) @siriwatknp
68
+ - Support theme scoping in `useMediaQuery` (#44339) @siriwatknp
69
+ - [Grid] Fix regression spacing prop with string value (#44376) @siriwatknp
70
+
71
+ ### `@mui/styled-engine-sc@6.1.7`
72
+
73
+ - Fix missing `@types/hoist-non-react-statics` causing `styled` returns any (#44397) @megos
74
+
75
+ ### Docs
76
+
77
+ - Replace 'Experimental APIs - Toolpad' with 'Toolpad (Beta)' (#44388) @prakhargupta1
78
+ - Fix Pigment CSS install (#44353) @oliviertassinari
79
+ - Fix dashboard menu warning (#44317) @siriwatknp
80
+ - Add runtime theme section for Material Pigment CSS (#44137) @siriwatknp
81
+ - Add hash to `key` to remove noise from console (#44289) @sai6855
82
+ - Revise Example Projects and Related Projects pages (#44191) @samuelsycamore
83
+ - [material-ui] Fix typo in typography theme set up for templates (#44338) @navedqb
84
+ - [material-ui] Add StackBlitz/CodeSandbox buttons to template cards (#44253) @zanivan
85
+ - [material-ui] Fix Sign-in/Sign-up templates layout (#44281) @zanivan
86
+ - [material-ui] Remove noise in template (#44260) @oliviertassinari
87
+ - [material-ui][Rating] Add uncontrolled example to Basic Rating demo (#44386) @sai6855
88
+ - [material-ui][TextField] Replace InputProps with slotProps.input in demo (#44288) @sai6855
89
+
90
+ ### Core
91
+
92
+ - [blog] Follow media asset guidelines (#44374) @oliviertassinari
93
+ - [code-infra] Changes for test util to work in `vitest` (#43625) @JCQuintas
94
+ - Remove old marked JS options (#44375) @ZeeshanTamboli
95
+ - Fix webpack capitalization (#44352) @oliviertassinari
96
+ - Fix Next.js link 404 (710cd95) @oliviertassinari
97
+ - Update Gold sponsoring backlinks (#44316) @oliviertassinari
98
+ - Fix tools-public.mui.com redirection (9196fa5) @oliviertassinari
99
+ - Remove blank AlertTitle test file (#44282) @ZeeshanTamboli
100
+ - [docs-infra] Fix ad in RTL (#44345) @oliviertassinari
101
+ - [docs-infra] Enforce punctuation on descriptions (#44292) @oliviertassinari
102
+ - [docs-infra] Add CodeSandbox and StackBlitz to vale vocab (6db477a) @oliviertassinari
103
+ - [docs-infra] Fix correct spelling of VS Code (#44277) @oliviertassinari
104
+ - [docs-infra] Add a `rawDescriptions` option (#44390) @vladmoroz
105
+ - [examples] Add missing `clsx` dependency (#43526) @Janpot
106
+ - [infra] Fix @renovate[bot] appearing in changelog (#44275) @mnajdova
107
+
108
+ All contributors of this release in alphabetical order: @Janpot, @JCQuintas, @megos, @mnajdova, @navedqb, @oliviertassinari, @prakhargupta1, @sai6855, @samuelsycamore, @siriwatknp, @vladmoroz, @zanivan, @ZeeshanTamboli
109
+
110
+ ## v6.1.6
4
111
 
5
112
  <!-- generated comparing v6.1.5..master -->
6
113
 
@@ -52,7 +159,7 @@ A big thanks to the 13 contributors who made this release possible.
52
159
 
53
160
  All contributors of this release in alphabetical order: @aarongarciah, @blackcow1987, @DiegoAndai, @jimmycallin, @joshkel, @mnajdova, @navedqb, @nphmuller, @o-alexandrov, @oliviertassinari, @prakhargupta1, @sai6855, @siriwatknp
54
161
 
55
- ## 6.1.5
162
+ ## v6.1.5
56
163
 
57
164
  <!-- generated comparing v6.1.4..master -->
58
165
 
@@ -84,7 +191,7 @@ A big thanks to the 9 contributors who made this release possible.
84
191
  - [material-ui][TextField] Dynamically modify the eye password button aria-label (#44122) @ChinoUkaegbu
85
192
  - [icons] Run pnpm docs:mdicons:synonyms (#44098) @oliviertassinari
86
193
  - [joy-ui] Update Overview copy to match Readme (#44136) @samuelsycamore
87
- - Add CodeSandbox/Stackblitz to the rest of the templates (#43708) @siriwatknp
194
+ - Add CodeSandbox/StackBlitz to the rest of the templates (#43708) @siriwatknp
88
195
  - Update Figma link to fix 301 (a7b7d9c) @oliviertassinari
89
196
  - Link Toolpad from Core repo (#44111) @prakhargupta1
90
197
  - Remove HighlightedCode max-width (#43731) @Janpot
@@ -254,7 +361,7 @@ A big thanks to the 13 contributors who made this release possible.
254
361
  - Uniformity in version range @oliviertassinari
255
362
  - Replace `toBeAriaHidden` matcher with `toBeInaccessible` in tests (#43870) @ZeeshanTamboli
256
363
  - [docs-infra] Strengthen CSP (#43711) @oliviertassinari
257
- - [docs-infra] Open Codesandbox demo with fontsize=12 (#43860) @siriwatknp
364
+ - [docs-infra] Open CodeSandbox demo with fontsize=12 (#43860) @siriwatknp
258
365
  - [icons] Reduce Material Icon page size (#43911) @oliviertassinari
259
366
  - [test] Point Istanbul to correct URL (#43935) @sai6855
260
367
  - [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?.components,
76
+ value: themeId ? engineTheme[themeId].components : engineTheme.components,
77
77
  children: children
78
78
  })
79
79
  })
@@ -217,9 +217,14 @@ function createCssVarsProvider(options) {
217
217
  lightColorScheme,
218
218
  mode,
219
219
  setColorScheme,
220
- setMode,
220
+ setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
221
+ if (theme.colorSchemeSelector === 'media') {
222
+ 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'));
223
+ }
224
+ setMode(newMode);
225
+ },
221
226
  systemMode
222
- }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
227
+ }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, theme.colorSchemeSelector]);
223
228
  let shouldGenerateStyleSheet = true;
224
229
  if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
225
230
  shouldGenerateStyleSheet = false;
@@ -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?.components,
69
+ value: themeId ? engineTheme[themeId].components : engineTheme.components,
70
70
  children: children
71
71
  })
72
72
  })
@@ -208,9 +208,14 @@ export default function createCssVarsProvider(options) {
208
208
  lightColorScheme,
209
209
  mode,
210
210
  setColorScheme,
211
- setMode,
211
+ setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
212
+ if (theme.colorSchemeSelector === 'media') {
213
+ 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'));
214
+ }
215
+ setMode(newMode);
216
+ },
212
217
  systemMode
213
- }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
218
+ }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, theme.colorSchemeSelector]);
214
219
  let shouldGenerateStyleSheet = true;
215
220
  if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
216
221
  shouldGenerateStyleSheet = false;
@@ -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
- export default function useMediaQuery(queryInput, options = {}) {
73
- const theme = useTheme();
74
- // Wait for jsdom to support the match media feature.
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
- defaultMatches = false,
81
- matchMedia = supportMatchMedia ? window.matchMedia : null,
82
- ssrMatchMedia = null,
83
- noSsr = false
84
- } = getThemeProps({
85
- name: 'MuiUseMediaQuery',
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
- let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
95
- query = query.replace(/^@media( ?)/m, '');
96
- const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
97
- const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
98
- if (process.env.NODE_ENV !== 'production') {
99
- // eslint-disable-next-line react-hooks/rules-of-hooks
100
- React.useDebugValue({
101
- query,
102
- match
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
- return match;
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;
@@ -1,6 +1,6 @@
1
- export const version = "6.1.6";
1
+ export const version = "6.1.8";
2
2
  export const major = Number("6");
3
3
  export const minor = Number("1");
4
- export const patch = Number("6");
4
+ export const patch = Number("8");
5
5
  export const prerelease = undefined;
6
6
  export default version;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v6.1.6
2
+ * @mui/system v6.1.8
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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?.components,
69
+ value: themeId ? engineTheme[themeId].components : engineTheme.components,
70
70
  children: children
71
71
  })
72
72
  })
@@ -208,9 +208,14 @@ export default function createCssVarsProvider(options) {
208
208
  lightColorScheme,
209
209
  mode,
210
210
  setColorScheme,
211
- setMode,
211
+ setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
212
+ if (theme.colorSchemeSelector === 'media') {
213
+ 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'));
214
+ }
215
+ setMode(newMode);
216
+ },
212
217
  systemMode
213
- }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
218
+ }), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, theme.colorSchemeSelector]);
214
219
  let shouldGenerateStyleSheet = true;
215
220
  if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
216
221
  shouldGenerateStyleSheet = false;
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v6.1.6
2
+ * @mui/system v6.1.8
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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
- export default function useMediaQuery(queryInput, options = {}) {
73
- const theme = useTheme();
74
- // Wait for jsdom to support the match media feature.
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
- defaultMatches = false,
81
- matchMedia = supportMatchMedia ? window.matchMedia : null,
82
- ssrMatchMedia = null,
83
- noSsr = false
84
- } = getThemeProps({
85
- name: 'MuiUseMediaQuery',
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
- let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
95
- query = query.replace(/^@media( ?)/m, '');
96
- const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
97
- const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
98
- if (process.env.NODE_ENV !== 'production') {
99
- // eslint-disable-next-line react-hooks/rules-of-hooks
100
- React.useDebugValue({
101
- query,
102
- match
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
- return match;
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;
@@ -1,6 +1,6 @@
1
- export const version = "6.1.6";
1
+ export const version = "6.1.8";
2
2
  export const major = Number("6");
3
3
  export const minor = Number("1");
4
- export const patch = Number("6");
4
+ export const patch = Number("8");
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.6",
3
+ "version": "6.1.8",
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.6",
34
- "@mui/utils": "^6.1.6",
35
- "@mui/styled-engine": "^6.1.6",
36
- "@mui/types": "^7.2.19"
33
+ "@mui/private-theming": "^6.1.8",
34
+ "@mui/types": "^7.2.19",
35
+ "@mui/utils": "^6.1.8",
36
+ "@mui/styled-engine": "^6.1.8"
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 default function useMediaQuery<Theme = unknown>(queryInput: string | ((theme: Theme) => string), options?: UseMediaQueryOptions): boolean;
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 = useMediaQuery;
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
- function useMediaQuery(queryInput, options = {}) {
80
- const theme = (0, _useThemeWithoutDefault.default)();
81
- // Wait for jsdom to support the match media feature.
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
- defaultMatches = false,
88
- matchMedia = supportMatchMedia ? window.matchMedia : null,
89
- ssrMatchMedia = null,
90
- noSsr = false
91
- } = (0, _useThemeProps.getThemeProps)({
92
- name: 'MuiUseMediaQuery',
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
- let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
102
- query = query.replace(/^@media( ?)/m, '');
103
- const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
104
- const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
105
- if (process.env.NODE_ENV !== 'production') {
106
- // eslint-disable-next-line react-hooks/rules-of-hooks
107
- React.useDebugValue({
108
- query,
109
- match
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
- return match;
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.6";
7
+ const version = exports.version = "6.1.8";
8
8
  const major = exports.major = Number("6");
9
9
  const minor = exports.minor = Number("1");
10
- const patch = exports.patch = Number("6");
10
+ const patch = exports.patch = Number("8");
11
11
  const prerelease = exports.prerelease = undefined;
12
12
  var _default = exports.default = version;