@mui/material 5.3.0 → 5.4.2

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 (157) hide show
  1. package/Autocomplete/Autocomplete.d.ts +5 -0
  2. package/Autocomplete/Autocomplete.js +12 -4
  3. package/AvatarGroup/AvatarGroup.d.ts +10 -0
  4. package/AvatarGroup/AvatarGroup.js +19 -7
  5. package/Badge/Badge.js +3 -2
  6. package/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  7. package/Button/buttonClasses.d.ts +1 -1
  8. package/ButtonBase/ButtonBase.d.ts +5 -1
  9. package/ButtonBase/ButtonBase.js +15 -2
  10. package/ButtonBase/TouchRipple.js +1 -2
  11. package/CHANGELOG.md +300 -28
  12. package/Fab/Fab.d.ts +4 -1
  13. package/Fab/Fab.js +8 -20
  14. package/Fab/fabClasses.js +1 -1
  15. package/FormControlLabel/FormControlLabel.js +11 -3
  16. package/FormControlLabel/formControlLabelClasses.d.ts +2 -0
  17. package/FormControlLabel/formControlLabelClasses.js +1 -1
  18. package/FormGroup/FormGroup.js +14 -3
  19. package/FormGroup/formGroupClasses.d.ts +2 -0
  20. package/FormGroup/formGroupClasses.js +1 -1
  21. package/FormHelperText/FormHelperText.js +7 -9
  22. package/Grid/Grid.js +2 -4
  23. package/ImageList/ImageList.js +3 -1
  24. package/InputAdornment/InputAdornment.js +6 -9
  25. package/Modal/Modal.js +1 -1
  26. package/OutlinedInput/NotchedOutline.js +14 -16
  27. package/OutlinedInput/OutlinedInput.js +1 -1
  28. package/README.md +6 -6
  29. package/Radio/RadioButtonIcon.js +2 -6
  30. package/Rating/Rating.js +1 -1
  31. package/Select/Select.js +19 -7
  32. package/Select/SelectInput.js +12 -10
  33. package/Slider/Slider.js +3 -1
  34. package/Snackbar/Snackbar.js +4 -1
  35. package/SvgIcon/SvgIcon.js +9 -9
  36. package/SwipeableDrawer/SwipeArea.js +1 -3
  37. package/TextField/TextField.js +1 -1
  38. package/ToggleButton/ToggleButton.d.ts +15 -0
  39. package/ToggleButton/ToggleButton.js +8 -2
  40. package/index.d.ts +11 -3
  41. package/index.js +8 -3
  42. package/internal/SwitchBase.js +2 -6
  43. package/legacy/Autocomplete/Autocomplete.js +13 -4
  44. package/legacy/AvatarGroup/AvatarGroup.js +20 -7
  45. package/legacy/Badge/Badge.js +4 -2
  46. package/legacy/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  47. package/legacy/ButtonBase/ButtonBase.js +15 -2
  48. package/legacy/ButtonBase/TouchRipple.js +1 -2
  49. package/legacy/Fab/Fab.js +8 -20
  50. package/legacy/Fab/fabClasses.js +1 -1
  51. package/legacy/FormControlLabel/FormControlLabel.js +11 -3
  52. package/legacy/FormControlLabel/formControlLabelClasses.js +1 -1
  53. package/legacy/FormGroup/FormGroup.js +14 -3
  54. package/legacy/FormGroup/formGroupClasses.js +1 -1
  55. package/legacy/FormHelperText/FormHelperText.js +7 -9
  56. package/legacy/Grid/Grid.js +2 -4
  57. package/legacy/ImageList/ImageList.js +3 -1
  58. package/legacy/InputAdornment/InputAdornment.js +6 -9
  59. package/legacy/Modal/Modal.js +1 -1
  60. package/legacy/OutlinedInput/NotchedOutline.js +14 -16
  61. package/legacy/OutlinedInput/OutlinedInput.js +1 -1
  62. package/legacy/Radio/RadioButtonIcon.js +2 -6
  63. package/legacy/Rating/Rating.js +1 -1
  64. package/legacy/Select/Select.js +23 -7
  65. package/legacy/Select/SelectInput.js +12 -10
  66. package/legacy/Slider/Slider.js +3 -1
  67. package/legacy/Snackbar/Snackbar.js +4 -1
  68. package/legacy/SvgIcon/SvgIcon.js +9 -9
  69. package/legacy/SwipeableDrawer/SwipeArea.js +1 -3
  70. package/legacy/TextField/TextField.js +1 -1
  71. package/legacy/ToggleButton/ToggleButton.js +8 -2
  72. package/legacy/index.js +8 -3
  73. package/legacy/internal/SwitchBase.js +2 -6
  74. package/legacy/styles/makeStyles.js +1 -1
  75. package/legacy/styles/withStyles.js +1 -1
  76. package/legacy/styles/withTheme.js +1 -1
  77. package/legacy/useMediaQuery/useMediaQuery.js +87 -32
  78. package/modern/Autocomplete/Autocomplete.js +12 -4
  79. package/modern/AvatarGroup/AvatarGroup.js +17 -7
  80. package/modern/Badge/Badge.js +3 -2
  81. package/modern/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  82. package/modern/ButtonBase/ButtonBase.js +15 -2
  83. package/modern/ButtonBase/TouchRipple.js +1 -2
  84. package/modern/Fab/Fab.js +8 -20
  85. package/modern/Fab/fabClasses.js +1 -1
  86. package/modern/FormControlLabel/FormControlLabel.js +11 -3
  87. package/modern/FormControlLabel/formControlLabelClasses.js +1 -1
  88. package/modern/FormGroup/FormGroup.js +14 -3
  89. package/modern/FormGroup/formGroupClasses.js +1 -1
  90. package/modern/FormHelperText/FormHelperText.js +7 -9
  91. package/modern/Grid/Grid.js +2 -4
  92. package/modern/ImageList/ImageList.js +3 -1
  93. package/modern/InputAdornment/InputAdornment.js +6 -9
  94. package/modern/Modal/Modal.js +1 -1
  95. package/modern/OutlinedInput/NotchedOutline.js +14 -16
  96. package/modern/OutlinedInput/OutlinedInput.js +1 -1
  97. package/modern/Radio/RadioButtonIcon.js +2 -6
  98. package/modern/Rating/Rating.js +1 -1
  99. package/modern/Select/Select.js +19 -7
  100. package/modern/Select/SelectInput.js +12 -10
  101. package/modern/Slider/Slider.js +3 -1
  102. package/modern/Snackbar/Snackbar.js +4 -1
  103. package/modern/SvgIcon/SvgIcon.js +8 -8
  104. package/modern/SwipeableDrawer/SwipeArea.js +1 -3
  105. package/modern/TextField/TextField.js +1 -1
  106. package/modern/ToggleButton/ToggleButton.js +8 -2
  107. package/modern/index.js +8 -3
  108. package/modern/internal/SwitchBase.js +2 -6
  109. package/modern/styles/makeStyles.js +1 -1
  110. package/modern/styles/withStyles.js +1 -1
  111. package/modern/styles/withTheme.js +1 -1
  112. package/modern/useMediaQuery/useMediaQuery.js +69 -27
  113. package/node/Autocomplete/Autocomplete.js +12 -4
  114. package/node/AvatarGroup/AvatarGroup.js +19 -7
  115. package/node/Badge/Badge.js +3 -2
  116. package/node/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  117. package/node/ButtonBase/ButtonBase.js +15 -2
  118. package/node/ButtonBase/TouchRipple.js +1 -2
  119. package/node/Fab/Fab.js +8 -20
  120. package/node/Fab/fabClasses.js +1 -1
  121. package/node/FormControlLabel/FormControlLabel.js +12 -3
  122. package/node/FormControlLabel/formControlLabelClasses.js +1 -1
  123. package/node/FormGroup/FormGroup.js +15 -3
  124. package/node/FormGroup/formGroupClasses.js +1 -1
  125. package/node/FormHelperText/FormHelperText.js +6 -9
  126. package/node/Grid/Grid.js +2 -4
  127. package/node/ImageList/ImageList.js +3 -1
  128. package/node/InputAdornment/InputAdornment.js +5 -9
  129. package/node/Modal/Modal.js +1 -1
  130. package/node/OutlinedInput/NotchedOutline.js +12 -16
  131. package/node/OutlinedInput/OutlinedInput.js +1 -1
  132. package/node/Radio/RadioButtonIcon.js +2 -6
  133. package/node/Rating/Rating.js +1 -1
  134. package/node/Select/Select.js +22 -9
  135. package/node/Select/SelectInput.js +11 -10
  136. package/node/Slider/Slider.js +3 -1
  137. package/node/Snackbar/Snackbar.js +4 -1
  138. package/node/SvgIcon/SvgIcon.js +9 -9
  139. package/node/SwipeableDrawer/SwipeArea.js +1 -3
  140. package/node/TextField/TextField.js +1 -1
  141. package/node/ToggleButton/ToggleButton.js +8 -2
  142. package/node/index.js +62 -16
  143. package/node/internal/SwitchBase.js +2 -6
  144. package/node/styles/makeStyles.js +1 -1
  145. package/node/styles/withStyles.js +1 -1
  146. package/node/styles/withTheme.js +1 -1
  147. package/node/useMediaQuery/useMediaQuery.js +69 -27
  148. package/package.json +8 -8
  149. package/styles/ThemeProvider.d.ts +1 -1
  150. package/styles/index.d.ts +3 -0
  151. package/styles/makeStyles.js +1 -1
  152. package/styles/withStyles.js +1 -1
  153. package/styles/withTheme.js +1 -1
  154. package/umd/material-ui.development.js +5056 -7204
  155. package/umd/material-ui.production.min.js +21 -21
  156. package/useMediaQuery/useMediaQuery.d.ts +4 -0
  157. package/useMediaQuery/useMediaQuery.js +69 -27
@@ -17,32 +17,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17
17
 
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
- function useMediaQuery(queryInput, options = {}) {
21
- const theme = (0, _system.useThemeWithoutDefault)(); // Wait for jsdom to support the match media feature.
22
- // All the browsers MUI support have this built-in.
23
- // This defensive check is here for simplicity.
24
- // Most of the time, the match media logic isn't central to people tests.
25
-
20
+ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
26
21
  const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
27
- const {
28
- defaultMatches = false,
29
- matchMedia = supportMatchMedia ? window.matchMedia : null,
30
- noSsr = false,
31
- ssrMatchMedia = null
32
- } = (0, _system.getThemeProps)({
33
- name: 'MuiUseMediaQuery',
34
- props: options,
35
- theme
36
- });
37
-
38
- if (process.env.NODE_ENV !== 'production') {
39
- if (typeof queryInput === 'function' && theme === null) {
40
- 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'));
41
- }
42
- }
43
-
44
- let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
45
- query = query.replace(/^@media( ?)/m, '');
46
22
  const [match, setMatch] = React.useState(() => {
47
23
  if (noSsr && supportMatchMedia) {
48
24
  return matchMedia(query).matches;
@@ -68,19 +44,85 @@ function useMediaQuery(queryInput, options = {}) {
68
44
  const updateMatch = () => {
69
45
  // Workaround Safari wrong implementation of matchMedia
70
46
  // TODO can we remove it?
71
- // https://github.com/mui-org/material-ui/pull/17315#issuecomment-528286677
47
+ // https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
72
48
  if (active) {
73
49
  setMatch(queryList.matches);
74
50
  }
75
51
  };
76
52
 
77
- updateMatch();
53
+ updateMatch(); // TODO: Use `addEventListener` once support for Safari < 14 is dropped
54
+
78
55
  queryList.addListener(updateMatch);
79
56
  return () => {
80
57
  active = false;
81
58
  queryList.removeListener(updateMatch);
82
59
  };
83
60
  }, [query, matchMedia, supportMatchMedia]);
61
+ return match;
62
+ } // eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
63
+
64
+
65
+ const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
66
+
67
+ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
68
+ const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
69
+ const getServerSnapshot = React.useMemo(() => {
70
+ if (ssrMatchMedia !== null) {
71
+ const {
72
+ matches
73
+ } = ssrMatchMedia(query);
74
+ return () => matches;
75
+ }
76
+
77
+ return getDefaultSnapshot;
78
+ }, [getDefaultSnapshot, query, ssrMatchMedia]);
79
+ const [getSnapshot, subscribe] = React.useMemo(() => {
80
+ if (matchMedia === null) {
81
+ return [getDefaultSnapshot, () => () => {}];
82
+ }
83
+
84
+ const mediaQueryList = matchMedia(query);
85
+ return [() => mediaQueryList.matches, notify => {
86
+ // TODO: Use `addEventListener` once support for Safari < 14 is dropped
87
+ mediaQueryList.addListener(notify);
88
+ return () => {
89
+ mediaQueryList.removeListener(notify);
90
+ };
91
+ }];
92
+ }, [getDefaultSnapshot, matchMedia, query]);
93
+ const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
94
+ return match;
95
+ }
96
+
97
+ function useMediaQuery(queryInput, options = {}) {
98
+ const theme = (0, _system.useThemeWithoutDefault)(); // Wait for jsdom to support the match media feature.
99
+ // All the browsers MUI support have this built-in.
100
+ // This defensive check is here for simplicity.
101
+ // Most of the time, the match media logic isn't central to people tests.
102
+
103
+ const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
104
+ const {
105
+ defaultMatches = false,
106
+ matchMedia = supportMatchMedia ? window.matchMedia : null,
107
+ ssrMatchMedia = null,
108
+ noSsr
109
+ } = (0, _system.getThemeProps)({
110
+ name: 'MuiUseMediaQuery',
111
+ props: options,
112
+ theme
113
+ });
114
+
115
+ if (process.env.NODE_ENV !== 'production') {
116
+ if (typeof queryInput === 'function' && theme === null) {
117
+ 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'));
118
+ }
119
+ }
120
+
121
+ let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
122
+ query = query.replace(/^@media( ?)/m, ''); // TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
123
+
124
+ const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
125
+ const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
84
126
 
85
127
  if (process.env.NODE_ENV !== 'production') {
86
128
  // eslint-disable-next-line react-hooks/rules-of-hooks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "5.3.0",
3
+ "version": "5.4.2",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Quickly build beautiful React apps. MUI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.",
@@ -14,12 +14,12 @@
14
14
  ],
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/mui-org/material-ui.git",
17
+ "url": "https://github.com/mui/material-ui.git",
18
18
  "directory": "packages/mui-material"
19
19
  },
20
20
  "license": "MIT",
21
21
  "bugs": {
22
- "url": "https://github.com/mui-org/material-ui/issues"
22
+ "url": "https://github.com/mui/material-ui/issues"
23
23
  },
24
24
  "homepage": "https://mui.com/",
25
25
  "funding": {
@@ -45,11 +45,11 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@babel/runtime": "^7.16.7",
49
- "@mui/base": "5.0.0-alpha.65",
50
- "@mui/system": "^5.3.0",
51
- "@mui/types": "^7.1.0",
52
- "@mui/utils": "^5.3.0",
48
+ "@babel/runtime": "^7.17.0",
49
+ "@mui/base": "5.0.0-alpha.69",
50
+ "@mui/system": "^5.4.2",
51
+ "@mui/types": "^7.1.2",
52
+ "@mui/utils": "^5.4.2",
53
53
  "@types/react-transition-group": "^4.4.4",
54
54
  "clsx": "^1.1.1",
55
55
  "csstype": "^3.0.10",
@@ -10,7 +10,7 @@ export interface ThemeProviderProps<Theme = DefaultTheme> {
10
10
  * It should preferably be used at **the root of your component tree**.
11
11
  * API:
12
12
  *
13
- * - [ThemeProvider API](https://mui.com/api/theme-provider/)
13
+ * - [ThemeProvider API](/customization/theming/#themeprovider)
14
14
  */
15
15
  export default function ThemeProvider<T = DefaultTheme>(
16
16
  props: ThemeProviderProps<T>,
package/styles/index.d.ts CHANGED
@@ -12,6 +12,9 @@ export {
12
12
  PaletteColorOptions,
13
13
  PaletteOptions,
14
14
  SimplePaletteColorOptions,
15
+ TypeText,
16
+ TypeAction,
17
+ TypeBackground,
15
18
  } from './createPalette';
16
19
  export { default as createStyles } from './createStyles';
17
20
  export {
@@ -2,5 +2,5 @@ import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
2
2
  export default function makeStyles() {
3
3
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI: makeStyles is not longer exported from @mui/material/styles.
4
4
  You have to import it from @mui/styles.
5
- See https://mui.com/r/migration-v4/#material-ui-core-styles for more details.` : _formatMuiErrorMessage(14));
5
+ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(14));
6
6
  }
@@ -2,5 +2,5 @@ import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
2
2
  export default function withStyles() {
3
3
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withStyles is not longer exported from @mui/material/styles.
4
4
  You have to import it from @mui/styles.
5
- See https://mui.com/r/migration-v4/#material-ui-core-styles for more details.` : _formatMuiErrorMessage(15));
5
+ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(15));
6
6
  }
@@ -2,5 +2,5 @@ import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
2
2
  export default function withTheme() {
3
3
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withTheme is not longer exported from @mui/material/styles.
4
4
  You have to import it from @mui/styles.
5
- See https://mui.com/r/migration-v4/#material-ui-core-styles for more details.` : _formatMuiErrorMessage(16));
5
+ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(16));
6
6
  }