@mui/material 5.11.9 → 5.11.11
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/Autocomplete/Autocomplete.d.ts +3 -1
- package/Avatar/Avatar.js +1 -0
- package/Backdrop/Backdrop.d.ts +8 -0
- package/Backdrop/Backdrop.js +10 -5
- package/Badge/Badge.d.ts +0 -1
- package/Badge/Badge.js +47 -47
- package/CHANGELOG.md +135 -1
- package/Container/Container.js +0 -1
- package/Dialog/DialogContext.d.ts +2 -2
- package/Dialog/DialogContext.js +2 -2
- package/InputBase/InputBase.js +2 -2
- package/InputLabel/InputLabel.js +3 -1
- package/ListSubheader/ListSubheader.js +1 -0
- package/MenuList/MenuList.js +7 -0
- package/Modal/Modal.d.ts +9 -1
- package/Modal/Modal.js +14 -9
- package/OutlinedInput/OutlinedInput.js +1 -1
- package/README.md +0 -2
- package/Rating/Rating.js +2 -2
- package/Select/SelectInput.js +2 -22
- package/Slider/Slider.d.ts +5 -1
- package/Slider/Slider.js +16 -11
- package/Snackbar/Snackbar.js +21 -125
- package/Stack/Stack.d.ts +0 -1
- package/Stack/Stack.js +9 -120
- package/Stack/index.d.ts +3 -0
- package/Stack/index.js +2 -1
- package/Stack/stackClasses.d.ts +6 -0
- package/Stack/stackClasses.js +7 -0
- package/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/Unstable_Grid2/Grid2.js +2 -3
- package/index.js +1 -1
- package/internal/SwitchBase.js +1 -1
- package/legacy/Avatar/Avatar.js +1 -0
- package/legacy/Backdrop/Backdrop.js +9 -3
- package/legacy/Badge/Badge.js +48 -48
- package/legacy/Container/Container.js +0 -1
- package/legacy/Dialog/DialogContext.js +2 -2
- package/legacy/InputBase/InputBase.js +2 -2
- package/legacy/InputLabel/InputLabel.js +3 -1
- package/legacy/ListSubheader/ListSubheader.js +1 -0
- package/legacy/MenuList/MenuList.js +7 -0
- package/legacy/Modal/Modal.js +14 -9
- package/legacy/OutlinedInput/OutlinedInput.js +1 -1
- package/legacy/Rating/Rating.js +2 -2
- package/legacy/Select/SelectInput.js +2 -22
- package/legacy/Slider/Slider.js +16 -12
- package/legacy/Snackbar/Snackbar.js +20 -119
- package/legacy/Stack/Stack.js +13 -122
- package/legacy/Stack/index.js +2 -1
- package/legacy/Stack/stackClasses.js +7 -0
- package/legacy/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/legacy/Unstable_Grid2/Grid2.js +2 -3
- package/legacy/index.js +1 -1
- package/legacy/internal/SwitchBase.js +1 -1
- package/legacy/styles/createTheme.js +1 -0
- package/legacy/useAutocomplete/useAutocomplete.js +2 -2
- package/legacy/useMediaQuery/useMediaQuery.js +12 -7
- package/modern/Avatar/Avatar.js +1 -0
- package/modern/Backdrop/Backdrop.js +10 -5
- package/modern/Badge/Badge.js +47 -47
- package/modern/Container/Container.js +0 -1
- package/modern/Dialog/DialogContext.js +2 -2
- package/modern/InputBase/InputBase.js +2 -2
- package/modern/InputLabel/InputLabel.js +3 -1
- package/modern/ListSubheader/ListSubheader.js +1 -0
- package/modern/MenuList/MenuList.js +7 -0
- package/modern/Modal/Modal.js +14 -9
- package/modern/OutlinedInput/OutlinedInput.js +1 -1
- package/modern/Rating/Rating.js +2 -2
- package/modern/Select/SelectInput.js +2 -18
- package/modern/Slider/Slider.js +16 -11
- package/modern/Snackbar/Snackbar.js +21 -125
- package/modern/Stack/Stack.js +9 -120
- package/modern/Stack/index.js +2 -1
- package/modern/Stack/stackClasses.js +7 -0
- package/modern/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/modern/Unstable_Grid2/Grid2.js +2 -3
- package/modern/index.js +1 -1
- package/modern/internal/SwitchBase.js +1 -1
- package/modern/styles/createTheme.js +1 -0
- package/modern/useAutocomplete/useAutocomplete.js +2 -2
- package/modern/useMediaQuery/useMediaQuery.js +9 -7
- package/node/Avatar/Avatar.js +1 -0
- package/node/Backdrop/Backdrop.js +10 -5
- package/node/Badge/Badge.js +46 -47
- package/node/Container/Container.js +0 -2
- package/node/Dialog/DialogContext.js +4 -2
- package/node/InputBase/InputBase.js +2 -2
- package/node/InputLabel/InputLabel.js +3 -1
- package/node/ListSubheader/ListSubheader.js +1 -0
- package/node/MenuList/MenuList.js +7 -0
- package/node/Modal/Modal.js +14 -9
- package/node/OutlinedInput/OutlinedInput.js +1 -1
- package/node/Rating/Rating.js +2 -2
- package/node/Select/SelectInput.js +2 -22
- package/node/Slider/Slider.js +19 -14
- package/node/Snackbar/Snackbar.js +20 -124
- package/node/Stack/Stack.js +9 -122
- package/node/Stack/index.js +8 -1
- package/node/Stack/stackClasses.js +16 -0
- package/node/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/node/Unstable_Grid2/Grid2.js +0 -1
- package/node/index.js +1 -1
- package/node/internal/SwitchBase.js +1 -1
- package/node/styles/createTheme.js +1 -0
- package/node/useAutocomplete/useAutocomplete.js +8 -6
- package/node/useMediaQuery/useMediaQuery.js +9 -7
- package/package.json +6 -6
- package/styles/createTheme.js +1 -0
- package/styles/props.d.ts +2 -2
- package/umd/material-ui.development.js +4209 -4241
- package/umd/material-ui.production.min.js +21 -21
- package/useAutocomplete/useAutocomplete.d.ts +2 -2
- package/useAutocomplete/useAutocomplete.js +2 -2
- package/useMediaQuery/useMediaQuery.d.ts +19 -4
- package/useMediaQuery/useMediaQuery.js +9 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export * from '@mui/base/
|
|
1
|
+
export { default } from '@mui/base/useAutocomplete';
|
|
2
|
+
export * from '@mui/base/useAutocomplete';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export * from '@mui/base/
|
|
1
|
+
export { default } from '@mui/base/useAutocomplete';
|
|
2
|
+
export * from '@mui/base/useAutocomplete';
|
|
@@ -16,16 +16,31 @@ export interface MuiMediaQueryList {
|
|
|
16
16
|
* @deprecated Not used internally. Use `(event: MediaQueryListEvent) => void` instead.
|
|
17
17
|
*/
|
|
18
18
|
export type MuiMediaQueryListListener = (event: MuiMediaQueryListEvent) => void;
|
|
19
|
-
export interface
|
|
19
|
+
export interface UseMediaQueryOptions {
|
|
20
|
+
/**
|
|
21
|
+
* As `window.matchMedia()` is unavailable on the server,
|
|
22
|
+
* it returns a default matches during the first mount.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
20
25
|
defaultMatches?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* You can provide your own implementation of matchMedia.
|
|
28
|
+
* This can be used for handling an iframe content window.
|
|
29
|
+
*/
|
|
21
30
|
matchMedia?: typeof window.matchMedia;
|
|
22
31
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
32
|
+
* To perform the server-side hydration, the hook needs to render twice.
|
|
33
|
+
* A first time with `defaultMatches`, the value of the server, and a second time with the resolved value.
|
|
34
|
+
* This double pass rendering cycle comes with a drawback: it's slower.
|
|
35
|
+
* You can set this option to `true` if you use the returned value **only** client-side.
|
|
36
|
+
* @default false
|
|
25
37
|
*/
|
|
26
38
|
noSsr?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* You can provide your own implementation of `matchMedia`, it's used when rendering server-side.
|
|
41
|
+
*/
|
|
27
42
|
ssrMatchMedia?: (query: string) => {
|
|
28
43
|
matches: boolean;
|
|
29
44
|
};
|
|
30
45
|
}
|
|
31
|
-
export default function useMediaQuery<Theme = unknown>(queryInput: string | ((theme: Theme) => string), options?:
|
|
46
|
+
export default function useMediaQuery<Theme = unknown>(queryInput: string | ((theme: Theme) => string), options?: UseMediaQueryOptions): boolean;
|
|
@@ -7,9 +7,8 @@ import useEnhancedEffect from '../utils/useEnhancedEffect';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
10
|
-
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
11
10
|
const [match, setMatch] = React.useState(() => {
|
|
12
|
-
if (noSsr &&
|
|
11
|
+
if (noSsr && matchMedia) {
|
|
13
12
|
return matchMedia(query).matches;
|
|
14
13
|
}
|
|
15
14
|
if (ssrMatchMedia) {
|
|
@@ -22,7 +21,7 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
22
21
|
});
|
|
23
22
|
useEnhancedEffect(() => {
|
|
24
23
|
let active = true;
|
|
25
|
-
if (!
|
|
24
|
+
if (!matchMedia) {
|
|
26
25
|
return undefined;
|
|
27
26
|
}
|
|
28
27
|
const queryList = matchMedia(query);
|
|
@@ -41,15 +40,18 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
41
40
|
active = false;
|
|
42
41
|
queryList.removeListener(updateMatch);
|
|
43
42
|
};
|
|
44
|
-
}, [query, matchMedia
|
|
43
|
+
}, [query, matchMedia]);
|
|
45
44
|
return match;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
49
48
|
const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
|
|
50
|
-
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
|
|
49
|
+
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
51
50
|
const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
|
|
52
51
|
const getServerSnapshot = React.useMemo(() => {
|
|
52
|
+
if (noSsr && matchMedia) {
|
|
53
|
+
return () => matchMedia(query).matches;
|
|
54
|
+
}
|
|
53
55
|
if (ssrMatchMedia !== null) {
|
|
54
56
|
const {
|
|
55
57
|
matches
|
|
@@ -57,7 +59,7 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
|
|
|
57
59
|
return () => matches;
|
|
58
60
|
}
|
|
59
61
|
return getDefaultSnapshot;
|
|
60
|
-
}, [getDefaultSnapshot, query, ssrMatchMedia]);
|
|
62
|
+
}, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
|
|
61
63
|
const [getSnapshot, subscribe] = React.useMemo(() => {
|
|
62
64
|
if (matchMedia === null) {
|
|
63
65
|
return [getDefaultSnapshot, () => () => {}];
|
|
@@ -85,7 +87,7 @@ export default function useMediaQuery(queryInput, options = {}) {
|
|
|
85
87
|
defaultMatches = false,
|
|
86
88
|
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
87
89
|
ssrMatchMedia = null,
|
|
88
|
-
noSsr
|
|
90
|
+
noSsr = false
|
|
89
91
|
} = getThemeProps({
|
|
90
92
|
name: 'MuiUseMediaQuery',
|
|
91
93
|
props: options,
|