@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.
Files changed (117) hide show
  1. package/Autocomplete/Autocomplete.d.ts +3 -1
  2. package/Avatar/Avatar.js +1 -0
  3. package/Backdrop/Backdrop.d.ts +8 -0
  4. package/Backdrop/Backdrop.js +10 -5
  5. package/Badge/Badge.d.ts +0 -1
  6. package/Badge/Badge.js +47 -47
  7. package/CHANGELOG.md +135 -1
  8. package/Container/Container.js +0 -1
  9. package/Dialog/DialogContext.d.ts +2 -2
  10. package/Dialog/DialogContext.js +2 -2
  11. package/InputBase/InputBase.js +2 -2
  12. package/InputLabel/InputLabel.js +3 -1
  13. package/ListSubheader/ListSubheader.js +1 -0
  14. package/MenuList/MenuList.js +7 -0
  15. package/Modal/Modal.d.ts +9 -1
  16. package/Modal/Modal.js +14 -9
  17. package/OutlinedInput/OutlinedInput.js +1 -1
  18. package/README.md +0 -2
  19. package/Rating/Rating.js +2 -2
  20. package/Select/SelectInput.js +2 -22
  21. package/Slider/Slider.d.ts +5 -1
  22. package/Slider/Slider.js +16 -11
  23. package/Snackbar/Snackbar.js +21 -125
  24. package/Stack/Stack.d.ts +0 -1
  25. package/Stack/Stack.js +9 -120
  26. package/Stack/index.d.ts +3 -0
  27. package/Stack/index.js +2 -1
  28. package/Stack/stackClasses.d.ts +6 -0
  29. package/Stack/stackClasses.js +7 -0
  30. package/SwipeableDrawer/SwipeableDrawer.js +3 -3
  31. package/Unstable_Grid2/Grid2.js +2 -3
  32. package/index.js +1 -1
  33. package/internal/SwitchBase.js +1 -1
  34. package/legacy/Avatar/Avatar.js +1 -0
  35. package/legacy/Backdrop/Backdrop.js +9 -3
  36. package/legacy/Badge/Badge.js +48 -48
  37. package/legacy/Container/Container.js +0 -1
  38. package/legacy/Dialog/DialogContext.js +2 -2
  39. package/legacy/InputBase/InputBase.js +2 -2
  40. package/legacy/InputLabel/InputLabel.js +3 -1
  41. package/legacy/ListSubheader/ListSubheader.js +1 -0
  42. package/legacy/MenuList/MenuList.js +7 -0
  43. package/legacy/Modal/Modal.js +14 -9
  44. package/legacy/OutlinedInput/OutlinedInput.js +1 -1
  45. package/legacy/Rating/Rating.js +2 -2
  46. package/legacy/Select/SelectInput.js +2 -22
  47. package/legacy/Slider/Slider.js +16 -12
  48. package/legacy/Snackbar/Snackbar.js +20 -119
  49. package/legacy/Stack/Stack.js +13 -122
  50. package/legacy/Stack/index.js +2 -1
  51. package/legacy/Stack/stackClasses.js +7 -0
  52. package/legacy/SwipeableDrawer/SwipeableDrawer.js +3 -3
  53. package/legacy/Unstable_Grid2/Grid2.js +2 -3
  54. package/legacy/index.js +1 -1
  55. package/legacy/internal/SwitchBase.js +1 -1
  56. package/legacy/styles/createTheme.js +1 -0
  57. package/legacy/useAutocomplete/useAutocomplete.js +2 -2
  58. package/legacy/useMediaQuery/useMediaQuery.js +12 -7
  59. package/modern/Avatar/Avatar.js +1 -0
  60. package/modern/Backdrop/Backdrop.js +10 -5
  61. package/modern/Badge/Badge.js +47 -47
  62. package/modern/Container/Container.js +0 -1
  63. package/modern/Dialog/DialogContext.js +2 -2
  64. package/modern/InputBase/InputBase.js +2 -2
  65. package/modern/InputLabel/InputLabel.js +3 -1
  66. package/modern/ListSubheader/ListSubheader.js +1 -0
  67. package/modern/MenuList/MenuList.js +7 -0
  68. package/modern/Modal/Modal.js +14 -9
  69. package/modern/OutlinedInput/OutlinedInput.js +1 -1
  70. package/modern/Rating/Rating.js +2 -2
  71. package/modern/Select/SelectInput.js +2 -18
  72. package/modern/Slider/Slider.js +16 -11
  73. package/modern/Snackbar/Snackbar.js +21 -125
  74. package/modern/Stack/Stack.js +9 -120
  75. package/modern/Stack/index.js +2 -1
  76. package/modern/Stack/stackClasses.js +7 -0
  77. package/modern/SwipeableDrawer/SwipeableDrawer.js +3 -3
  78. package/modern/Unstable_Grid2/Grid2.js +2 -3
  79. package/modern/index.js +1 -1
  80. package/modern/internal/SwitchBase.js +1 -1
  81. package/modern/styles/createTheme.js +1 -0
  82. package/modern/useAutocomplete/useAutocomplete.js +2 -2
  83. package/modern/useMediaQuery/useMediaQuery.js +9 -7
  84. package/node/Avatar/Avatar.js +1 -0
  85. package/node/Backdrop/Backdrop.js +10 -5
  86. package/node/Badge/Badge.js +46 -47
  87. package/node/Container/Container.js +0 -2
  88. package/node/Dialog/DialogContext.js +4 -2
  89. package/node/InputBase/InputBase.js +2 -2
  90. package/node/InputLabel/InputLabel.js +3 -1
  91. package/node/ListSubheader/ListSubheader.js +1 -0
  92. package/node/MenuList/MenuList.js +7 -0
  93. package/node/Modal/Modal.js +14 -9
  94. package/node/OutlinedInput/OutlinedInput.js +1 -1
  95. package/node/Rating/Rating.js +2 -2
  96. package/node/Select/SelectInput.js +2 -22
  97. package/node/Slider/Slider.js +19 -14
  98. package/node/Snackbar/Snackbar.js +20 -124
  99. package/node/Stack/Stack.js +9 -122
  100. package/node/Stack/index.js +8 -1
  101. package/node/Stack/stackClasses.js +16 -0
  102. package/node/SwipeableDrawer/SwipeableDrawer.js +3 -3
  103. package/node/Unstable_Grid2/Grid2.js +0 -1
  104. package/node/index.js +1 -1
  105. package/node/internal/SwitchBase.js +1 -1
  106. package/node/styles/createTheme.js +1 -0
  107. package/node/useAutocomplete/useAutocomplete.js +8 -6
  108. package/node/useMediaQuery/useMediaQuery.js +9 -7
  109. package/package.json +6 -6
  110. package/styles/createTheme.js +1 -0
  111. package/styles/props.d.ts +2 -2
  112. package/umd/material-ui.development.js +4209 -4241
  113. package/umd/material-ui.production.min.js +21 -21
  114. package/useAutocomplete/useAutocomplete.d.ts +2 -2
  115. package/useAutocomplete/useAutocomplete.js +2 -2
  116. package/useMediaQuery/useMediaQuery.d.ts +19 -4
  117. package/useMediaQuery/useMediaQuery.js +9 -7
@@ -1,2 +1,2 @@
1
- export { useAutocomplete as default } from '@mui/base/AutocompleteUnstyled';
2
- export * from '@mui/base/AutocompleteUnstyled';
1
+ export { default } from '@mui/base/useAutocomplete';
2
+ export * from '@mui/base/useAutocomplete';
@@ -1,2 +1,2 @@
1
- export { useAutocomplete as default } from '@mui/base/AutocompleteUnstyled';
2
- export * from '@mui/base/AutocompleteUnstyled';
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 Options {
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
- * This option is kept for backwards compatibility and has no longer any effect.
24
- * It's previous behavior is now handled automatically.
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?: Options): boolean;
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 && supportMatchMedia) {
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 (!supportMatchMedia) {
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, supportMatchMedia]);
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,