@mui/system 6.1.7 → 6.1.9
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 +99 -0
- package/cssVars/createCssVarsProvider.js +16 -4
- package/cssVars/useCurrentColorScheme.d.ts +1 -0
- package/cssVars/useCurrentColorScheme.js +8 -12
- package/esm/cssVars/createCssVarsProvider.js +16 -4
- package/esm/cssVars/useCurrentColorScheme.js +8 -12
- package/esm/version/index.js +2 -2
- package/index.js +1 -1
- package/modern/cssVars/createCssVarsProvider.js +16 -4
- package/modern/cssVars/useCurrentColorScheme.js +8 -12
- package/modern/index.js +1 -1
- package/modern/version/index.js +2 -2
- package/package.json +4 -4
- package/version/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,104 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 6.1.9
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.1.8..master -->
|
|
6
|
+
|
|
7
|
+
_Nov 27, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 8 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@6.1.9`
|
|
12
|
+
|
|
13
|
+
- [Select] Omit `placeholder` from props (#44502) @Juneezee
|
|
14
|
+
- [Grid2] Add container class to `Grid2Classes` (#44562) @sai6855
|
|
15
|
+
|
|
16
|
+
### `@mui/system@6.1.9`
|
|
17
|
+
|
|
18
|
+
- Add ThemeProvider `noSsr` to prevent double rendering (#44451) @siriwatknp
|
|
19
|
+
|
|
20
|
+
### `@mui/codemod@6.1.9`
|
|
21
|
+
|
|
22
|
+
- [codemod] Fix handling of computed `paragraph` props (#44195) @joshkel
|
|
23
|
+
|
|
24
|
+
### `@mui/material-pigment-css@6.1.9`
|
|
25
|
+
|
|
26
|
+
- Make @pigment-css/react as peer dependency (#44498) @brijeshb42
|
|
27
|
+
|
|
28
|
+
### Docs
|
|
29
|
+
|
|
30
|
+
- [material-ui] Add missing required dependencies in dashboard template README (#44476) @mesqueeb
|
|
31
|
+
- [material-ui] Add missing Roboto import to Next.js integration docs (#44462) @StaceyD22
|
|
32
|
+
- [material-ui][Dialog] Fix padding in SimpleDialog demo (#44467) @oliviertassinari
|
|
33
|
+
- Fix template page issues (#44466) @oliviertassinari
|
|
34
|
+
- [examples] Add dark mode example for Material UI + Pigment CSS (#44480) @mnajdova
|
|
35
|
+
|
|
36
|
+
### Core
|
|
37
|
+
|
|
38
|
+
- Remove TODO line in the changelog (#44484) @mnajdova
|
|
39
|
+
- Polish image display (418e888) @oliviertassinari
|
|
40
|
+
- [core-infra] Add no-relative-packages (#44489) @oliviertassinari
|
|
41
|
+
- [docs-infra] Support CSS variables API info (#44559) @mnajdova
|
|
42
|
+
- [docs-infra] Fix display when ad-block triggers (#44567) @oliviertassinari
|
|
43
|
+
- [docs-infra] Improve locator finding using visible option (#44541) @siriwatknp
|
|
44
|
+
- [docs-infra] Correctly flatten the pages tree (#44514) @oliviertassinari
|
|
45
|
+
- [docs-infra] Fix Sponsor design regression (#44515) @oliviertassinari
|
|
46
|
+
- [test] Remove React.ReactElement<any> from describeConformance.tsx (#44318) @sai6855
|
|
47
|
+
- [test] Do not enforce the presence of `ownerState.className` in `describeConformance` (#44479) @flaviendelangle
|
|
48
|
+
|
|
49
|
+
All contributors of this release in alphabetical order: @brijeshb42, @flaviendelangle, @joshkel, @Juneezee, @mesqueeb, @mnajdova, @oliviertassinari, @sai6855, @siriwatknp, @StaceyD22
|
|
50
|
+
|
|
51
|
+
## v6.1.8
|
|
52
|
+
|
|
53
|
+
<!-- generated comparing v6.1.7..master -->
|
|
54
|
+
|
|
55
|
+
_Nov 20, 2024_
|
|
56
|
+
|
|
57
|
+
A big thanks to the 10 contributors who made this release possible.
|
|
58
|
+
|
|
59
|
+
### `@mui/material@6.1.8`
|
|
60
|
+
|
|
61
|
+
- [Autocomplete] Use `ul` element for the listbox (#44422) @DiegoAndai
|
|
62
|
+
- [Grid2] Remove item and zeroMinWidth classes from grid2Classes (#44419) @sai6855
|
|
63
|
+
- [StepIcon] Add SvgIconOwnProps type to StepIcon props (#44337) @sai6855
|
|
64
|
+
- Add generic back to `useMediaQuery` to prevent a breaking change (#44455) @siriwatknp
|
|
65
|
+
- [Tooltip] Deprecate `*Component` and `*Props` for v6 (#44350) @siriwatknp
|
|
66
|
+
|
|
67
|
+
### `@mui/system@6.1.8`
|
|
68
|
+
|
|
69
|
+
- Warn when calling `setMode` without configuring `colorSchemeSelector` (#43783) @siriwatknp
|
|
70
|
+
|
|
71
|
+
### `@mui/styled-engine@6.1.8`
|
|
72
|
+
|
|
73
|
+
- Add back removed internal function (#44421) @mnajdova
|
|
74
|
+
|
|
75
|
+
### `@mui/utils@6.1.8`
|
|
76
|
+
|
|
77
|
+
- Skip deep clone React element (#44400) @siriwatknp
|
|
78
|
+
- Add documentation to `useForkRef` (#44410) @JCQuintas
|
|
79
|
+
|
|
80
|
+
### Docs
|
|
81
|
+
|
|
82
|
+
- [Accordion] Replace hardcoded classes with constants in demos (#44453) @ZeeshanTamboli
|
|
83
|
+
- [material-ui][Autocomplete] Fix virtualization demo (#44382) @DiegoAndai
|
|
84
|
+
- Revert #44388 (#44454) @prakhargupta1
|
|
85
|
+
- Add App starters in related-projects.md (#44315) @oliviertassinari
|
|
86
|
+
- Bring back `*Component` and `*Props` codemods and deprecation messages (#44383) @DiegoAndai
|
|
87
|
+
- [docs] Copyedit Templates page (#44461) @samuelsycamore
|
|
88
|
+
|
|
89
|
+
### Core
|
|
90
|
+
|
|
91
|
+
- Remove `stylis-plugin-rtl-sc` (#44447) @renovate[bot]
|
|
92
|
+
- [test][Autocomplete] Make virtualize regression screenshots deterministic (#44425) @DiegoAndai
|
|
93
|
+
- [blog] Fix reference to subdomain on MUI X v8 alpha zero post (#44416) @joserodolfofreitas
|
|
94
|
+
- [blog] MUI X v8 alpha zero blog post (#44377) @joserodolfofreitas
|
|
95
|
+
- [code-infra] Use vitest-compatible skip in `describeConformance` (#44412) @JCQuintas
|
|
96
|
+
- Keep OpenSSF badge up-to-date (aef2bf2) @oliviertassinari
|
|
97
|
+
- Polish useForkRef docs (#44424) @oliviertassinari
|
|
98
|
+
- [infra] Upgrade Cherry-pick workflow to latest (#44448) @oliviertassinari
|
|
99
|
+
|
|
100
|
+
All contributors of this release in alphabetical order: @DiegoAndai, @JCQuintas, @joserodolfofreitas, @mnajdova, @oliviertassinari, @prakhargupta1, @sai6855, samuelsycamore, @siriwatknp, @ZeeshanTamboli
|
|
101
|
+
|
|
3
102
|
## v6.1.7
|
|
4
103
|
|
|
5
104
|
<!-- generated comparing v6.1.6..master -->
|
|
@@ -59,7 +59,8 @@ function createCssVarsProvider(options) {
|
|
|
59
59
|
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
|
60
60
|
disableNestedContext = false,
|
|
61
61
|
disableStyleSheetGeneration = false,
|
|
62
|
-
defaultMode: initialMode = 'system'
|
|
62
|
+
defaultMode: initialMode = 'system',
|
|
63
|
+
noSsr
|
|
63
64
|
} = props;
|
|
64
65
|
const hasMounted = React.useRef(false);
|
|
65
66
|
const upperTheme = (0, _privateTheming.useTheme)();
|
|
@@ -100,7 +101,8 @@ function createCssVarsProvider(options) {
|
|
|
100
101
|
modeStorageKey,
|
|
101
102
|
colorSchemeStorageKey,
|
|
102
103
|
defaultMode,
|
|
103
|
-
storageWindow
|
|
104
|
+
storageWindow,
|
|
105
|
+
noSsr
|
|
104
106
|
});
|
|
105
107
|
let mode = stateMode;
|
|
106
108
|
let colorScheme = stateColorScheme;
|
|
@@ -217,9 +219,14 @@ function createCssVarsProvider(options) {
|
|
|
217
219
|
lightColorScheme,
|
|
218
220
|
mode,
|
|
219
221
|
setColorScheme,
|
|
220
|
-
setMode
|
|
222
|
+
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
223
|
+
if (theme.colorSchemeSelector === 'media') {
|
|
224
|
+
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'));
|
|
225
|
+
}
|
|
226
|
+
setMode(newMode);
|
|
227
|
+
},
|
|
221
228
|
systemMode
|
|
222
|
-
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
|
|
229
|
+
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, theme.colorSchemeSelector]);
|
|
223
230
|
let shouldGenerateStyleSheet = true;
|
|
224
231
|
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
225
232
|
shouldGenerateStyleSheet = false;
|
|
@@ -281,6 +288,11 @@ function createCssVarsProvider(options) {
|
|
|
281
288
|
* The key in the local storage used to store current color scheme.
|
|
282
289
|
*/
|
|
283
290
|
modeStorageKey: _propTypes.default.string,
|
|
291
|
+
/**
|
|
292
|
+
* If `true`, the mode will be the same value as the storage without an extra rerendering after the hydration.
|
|
293
|
+
* You should use this option in conjuction with `InitColorSchemeScript` component.
|
|
294
|
+
*/
|
|
295
|
+
noSsr: _propTypes.default.bool,
|
|
284
296
|
/**
|
|
285
297
|
* The window that attaches the 'storage' event listener.
|
|
286
298
|
* @default window
|
|
@@ -48,6 +48,7 @@ interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
|
|
|
48
48
|
modeStorageKey?: string;
|
|
49
49
|
colorSchemeStorageKey?: string;
|
|
50
50
|
storageWindow?: Window | null;
|
|
51
|
+
noSsr?: boolean;
|
|
51
52
|
}
|
|
52
53
|
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
|
|
53
54
|
export {};
|
|
@@ -64,7 +64,8 @@ function useCurrentColorScheme(options) {
|
|
|
64
64
|
supportedColorSchemes = [],
|
|
65
65
|
modeStorageKey = _InitColorSchemeScript.DEFAULT_MODE_STORAGE_KEY,
|
|
66
66
|
colorSchemeStorageKey = _InitColorSchemeScript.DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
67
|
-
storageWindow = typeof window === 'undefined' ? undefined : window
|
|
67
|
+
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
68
|
+
noSsr = false
|
|
68
69
|
} = options;
|
|
69
70
|
const joinedColorSchemes = supportedColorSchemes.join(',');
|
|
70
71
|
const isMultiSchemes = supportedColorSchemes.length > 1;
|
|
@@ -79,15 +80,10 @@ function useCurrentColorScheme(options) {
|
|
|
79
80
|
darkColorScheme
|
|
80
81
|
};
|
|
81
82
|
});
|
|
82
|
-
|
|
83
|
-
const [, setHasMounted] = React.useState(false);
|
|
84
|
-
const hasMounted = React.useRef(false);
|
|
83
|
+
const [isClient, setIsClient] = React.useState(noSsr || !isMultiSchemes);
|
|
85
84
|
React.useEffect(() => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
hasMounted.current = true;
|
|
90
|
-
}, [isMultiSchemes]);
|
|
85
|
+
setIsClient(true); // to rerender the component after hydration
|
|
86
|
+
}, []);
|
|
91
87
|
const colorScheme = getColorScheme(state);
|
|
92
88
|
const setMode = React.useCallback(mode => {
|
|
93
89
|
setState(currentState => {
|
|
@@ -251,9 +247,9 @@ function useCurrentColorScheme(options) {
|
|
|
251
247
|
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow, isMultiSchemes]);
|
|
252
248
|
return {
|
|
253
249
|
...state,
|
|
254
|
-
mode:
|
|
255
|
-
systemMode:
|
|
256
|
-
colorScheme:
|
|
250
|
+
mode: isClient ? state.mode : undefined,
|
|
251
|
+
systemMode: isClient ? state.systemMode : undefined,
|
|
252
|
+
colorScheme: isClient ? colorScheme : undefined,
|
|
257
253
|
setMode,
|
|
258
254
|
setColorScheme
|
|
259
255
|
};
|
|
@@ -50,7 +50,8 @@ export default function createCssVarsProvider(options) {
|
|
|
50
50
|
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
|
51
51
|
disableNestedContext = false,
|
|
52
52
|
disableStyleSheetGeneration = false,
|
|
53
|
-
defaultMode: initialMode = 'system'
|
|
53
|
+
defaultMode: initialMode = 'system',
|
|
54
|
+
noSsr
|
|
54
55
|
} = props;
|
|
55
56
|
const hasMounted = React.useRef(false);
|
|
56
57
|
const upperTheme = muiUseTheme();
|
|
@@ -91,7 +92,8 @@ export default function createCssVarsProvider(options) {
|
|
|
91
92
|
modeStorageKey,
|
|
92
93
|
colorSchemeStorageKey,
|
|
93
94
|
defaultMode,
|
|
94
|
-
storageWindow
|
|
95
|
+
storageWindow,
|
|
96
|
+
noSsr
|
|
95
97
|
});
|
|
96
98
|
let mode = stateMode;
|
|
97
99
|
let colorScheme = stateColorScheme;
|
|
@@ -208,9 +210,14 @@ export default function createCssVarsProvider(options) {
|
|
|
208
210
|
lightColorScheme,
|
|
209
211
|
mode,
|
|
210
212
|
setColorScheme,
|
|
211
|
-
setMode
|
|
213
|
+
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
214
|
+
if (theme.colorSchemeSelector === 'media') {
|
|
215
|
+
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'));
|
|
216
|
+
}
|
|
217
|
+
setMode(newMode);
|
|
218
|
+
},
|
|
212
219
|
systemMode
|
|
213
|
-
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
|
|
220
|
+
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, theme.colorSchemeSelector]);
|
|
214
221
|
let shouldGenerateStyleSheet = true;
|
|
215
222
|
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
216
223
|
shouldGenerateStyleSheet = false;
|
|
@@ -272,6 +279,11 @@ export default function createCssVarsProvider(options) {
|
|
|
272
279
|
* The key in the local storage used to store current color scheme.
|
|
273
280
|
*/
|
|
274
281
|
modeStorageKey: PropTypes.string,
|
|
282
|
+
/**
|
|
283
|
+
* If `true`, the mode will be the same value as the storage without an extra rerendering after the hydration.
|
|
284
|
+
* You should use this option in conjuction with `InitColorSchemeScript` component.
|
|
285
|
+
*/
|
|
286
|
+
noSsr: PropTypes.bool,
|
|
275
287
|
/**
|
|
276
288
|
* The window that attaches the 'storage' event listener.
|
|
277
289
|
* @default window
|
|
@@ -56,7 +56,8 @@ export default function useCurrentColorScheme(options) {
|
|
|
56
56
|
supportedColorSchemes = [],
|
|
57
57
|
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
58
58
|
colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
59
|
-
storageWindow = typeof window === 'undefined' ? undefined : window
|
|
59
|
+
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
60
|
+
noSsr = false
|
|
60
61
|
} = options;
|
|
61
62
|
const joinedColorSchemes = supportedColorSchemes.join(',');
|
|
62
63
|
const isMultiSchemes = supportedColorSchemes.length > 1;
|
|
@@ -71,15 +72,10 @@ export default function useCurrentColorScheme(options) {
|
|
|
71
72
|
darkColorScheme
|
|
72
73
|
};
|
|
73
74
|
});
|
|
74
|
-
|
|
75
|
-
const [, setHasMounted] = React.useState(false);
|
|
76
|
-
const hasMounted = React.useRef(false);
|
|
75
|
+
const [isClient, setIsClient] = React.useState(noSsr || !isMultiSchemes);
|
|
77
76
|
React.useEffect(() => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
hasMounted.current = true;
|
|
82
|
-
}, [isMultiSchemes]);
|
|
77
|
+
setIsClient(true); // to rerender the component after hydration
|
|
78
|
+
}, []);
|
|
83
79
|
const colorScheme = getColorScheme(state);
|
|
84
80
|
const setMode = React.useCallback(mode => {
|
|
85
81
|
setState(currentState => {
|
|
@@ -243,9 +239,9 @@ export default function useCurrentColorScheme(options) {
|
|
|
243
239
|
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow, isMultiSchemes]);
|
|
244
240
|
return {
|
|
245
241
|
...state,
|
|
246
|
-
mode:
|
|
247
|
-
systemMode:
|
|
248
|
-
colorScheme:
|
|
242
|
+
mode: isClient ? state.mode : undefined,
|
|
243
|
+
systemMode: isClient ? state.systemMode : undefined,
|
|
244
|
+
colorScheme: isClient ? colorScheme : undefined,
|
|
249
245
|
setMode,
|
|
250
246
|
setColorScheme
|
|
251
247
|
};
|
package/esm/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.1.
|
|
1
|
+
export const version = "6.1.9";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("1");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("9");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/index.js
CHANGED
|
@@ -50,7 +50,8 @@ export default function createCssVarsProvider(options) {
|
|
|
50
50
|
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
|
51
51
|
disableNestedContext = false,
|
|
52
52
|
disableStyleSheetGeneration = false,
|
|
53
|
-
defaultMode: initialMode = 'system'
|
|
53
|
+
defaultMode: initialMode = 'system',
|
|
54
|
+
noSsr
|
|
54
55
|
} = props;
|
|
55
56
|
const hasMounted = React.useRef(false);
|
|
56
57
|
const upperTheme = muiUseTheme();
|
|
@@ -91,7 +92,8 @@ export default function createCssVarsProvider(options) {
|
|
|
91
92
|
modeStorageKey,
|
|
92
93
|
colorSchemeStorageKey,
|
|
93
94
|
defaultMode,
|
|
94
|
-
storageWindow
|
|
95
|
+
storageWindow,
|
|
96
|
+
noSsr
|
|
95
97
|
});
|
|
96
98
|
let mode = stateMode;
|
|
97
99
|
let colorScheme = stateColorScheme;
|
|
@@ -208,9 +210,14 @@ export default function createCssVarsProvider(options) {
|
|
|
208
210
|
lightColorScheme,
|
|
209
211
|
mode,
|
|
210
212
|
setColorScheme,
|
|
211
|
-
setMode
|
|
213
|
+
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
214
|
+
if (theme.colorSchemeSelector === 'media') {
|
|
215
|
+
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'));
|
|
216
|
+
}
|
|
217
|
+
setMode(newMode);
|
|
218
|
+
},
|
|
212
219
|
systemMode
|
|
213
|
-
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
|
|
220
|
+
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, theme.colorSchemeSelector]);
|
|
214
221
|
let shouldGenerateStyleSheet = true;
|
|
215
222
|
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
216
223
|
shouldGenerateStyleSheet = false;
|
|
@@ -272,6 +279,11 @@ export default function createCssVarsProvider(options) {
|
|
|
272
279
|
* The key in the local storage used to store current color scheme.
|
|
273
280
|
*/
|
|
274
281
|
modeStorageKey: PropTypes.string,
|
|
282
|
+
/**
|
|
283
|
+
* If `true`, the mode will be the same value as the storage without an extra rerendering after the hydration.
|
|
284
|
+
* You should use this option in conjuction with `InitColorSchemeScript` component.
|
|
285
|
+
*/
|
|
286
|
+
noSsr: PropTypes.bool,
|
|
275
287
|
/**
|
|
276
288
|
* The window that attaches the 'storage' event listener.
|
|
277
289
|
* @default window
|
|
@@ -56,7 +56,8 @@ export default function useCurrentColorScheme(options) {
|
|
|
56
56
|
supportedColorSchemes = [],
|
|
57
57
|
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
58
58
|
colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
59
|
-
storageWindow = typeof window === 'undefined' ? undefined : window
|
|
59
|
+
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
60
|
+
noSsr = false
|
|
60
61
|
} = options;
|
|
61
62
|
const joinedColorSchemes = supportedColorSchemes.join(',');
|
|
62
63
|
const isMultiSchemes = supportedColorSchemes.length > 1;
|
|
@@ -71,15 +72,10 @@ export default function useCurrentColorScheme(options) {
|
|
|
71
72
|
darkColorScheme
|
|
72
73
|
};
|
|
73
74
|
});
|
|
74
|
-
|
|
75
|
-
const [, setHasMounted] = React.useState(false);
|
|
76
|
-
const hasMounted = React.useRef(false);
|
|
75
|
+
const [isClient, setIsClient] = React.useState(noSsr || !isMultiSchemes);
|
|
77
76
|
React.useEffect(() => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
hasMounted.current = true;
|
|
82
|
-
}, [isMultiSchemes]);
|
|
77
|
+
setIsClient(true); // to rerender the component after hydration
|
|
78
|
+
}, []);
|
|
83
79
|
const colorScheme = getColorScheme(state);
|
|
84
80
|
const setMode = React.useCallback(mode => {
|
|
85
81
|
setState(currentState => {
|
|
@@ -243,9 +239,9 @@ export default function useCurrentColorScheme(options) {
|
|
|
243
239
|
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow, isMultiSchemes]);
|
|
244
240
|
return {
|
|
245
241
|
...state,
|
|
246
|
-
mode:
|
|
247
|
-
systemMode:
|
|
248
|
-
colorScheme:
|
|
242
|
+
mode: isClient ? state.mode : undefined,
|
|
243
|
+
systemMode: isClient ? state.systemMode : undefined,
|
|
244
|
+
colorScheme: isClient ? colorScheme : undefined,
|
|
249
245
|
setMode,
|
|
250
246
|
setColorScheme
|
|
251
247
|
};
|
package/modern/index.js
CHANGED
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.1.
|
|
1
|
+
export const version = "6.1.9";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("1");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("9");
|
|
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.9",
|
|
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.
|
|
33
|
+
"@mui/private-theming": "^6.1.9",
|
|
34
34
|
"@mui/types": "^7.2.19",
|
|
35
|
-
"@mui/styled-engine": "^6.1.
|
|
36
|
-
"@mui/utils": "^6.1.
|
|
35
|
+
"@mui/styled-engine": "^6.1.9",
|
|
36
|
+
"@mui/utils": "^6.1.9"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@emotion/react": "^11.5.0",
|
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.9";
|
|
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("9");
|
|
11
11
|
const prerelease = exports.prerelease = undefined;
|
|
12
12
|
var _default = exports.default = version;
|