@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.
- package/Autocomplete/Autocomplete.d.ts +5 -0
- package/Autocomplete/Autocomplete.js +12 -4
- package/AvatarGroup/AvatarGroup.d.ts +10 -0
- package/AvatarGroup/AvatarGroup.js +19 -7
- package/Badge/Badge.js +3 -2
- package/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/Button/buttonClasses.d.ts +1 -1
- package/ButtonBase/ButtonBase.d.ts +5 -1
- package/ButtonBase/ButtonBase.js +15 -2
- package/ButtonBase/TouchRipple.js +1 -2
- package/CHANGELOG.md +300 -28
- package/Fab/Fab.d.ts +4 -1
- package/Fab/Fab.js +8 -20
- package/Fab/fabClasses.js +1 -1
- package/FormControlLabel/FormControlLabel.js +11 -3
- package/FormControlLabel/formControlLabelClasses.d.ts +2 -0
- package/FormControlLabel/formControlLabelClasses.js +1 -1
- package/FormGroup/FormGroup.js +14 -3
- package/FormGroup/formGroupClasses.d.ts +2 -0
- package/FormGroup/formGroupClasses.js +1 -1
- package/FormHelperText/FormHelperText.js +7 -9
- package/Grid/Grid.js +2 -4
- package/ImageList/ImageList.js +3 -1
- package/InputAdornment/InputAdornment.js +6 -9
- package/Modal/Modal.js +1 -1
- package/OutlinedInput/NotchedOutline.js +14 -16
- package/OutlinedInput/OutlinedInput.js +1 -1
- package/README.md +6 -6
- package/Radio/RadioButtonIcon.js +2 -6
- package/Rating/Rating.js +1 -1
- package/Select/Select.js +19 -7
- package/Select/SelectInput.js +12 -10
- package/Slider/Slider.js +3 -1
- package/Snackbar/Snackbar.js +4 -1
- package/SvgIcon/SvgIcon.js +9 -9
- package/SwipeableDrawer/SwipeArea.js +1 -3
- package/TextField/TextField.js +1 -1
- package/ToggleButton/ToggleButton.d.ts +15 -0
- package/ToggleButton/ToggleButton.js +8 -2
- package/index.d.ts +11 -3
- package/index.js +8 -3
- package/internal/SwitchBase.js +2 -6
- package/legacy/Autocomplete/Autocomplete.js +13 -4
- package/legacy/AvatarGroup/AvatarGroup.js +20 -7
- package/legacy/Badge/Badge.js +4 -2
- package/legacy/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/legacy/ButtonBase/ButtonBase.js +15 -2
- package/legacy/ButtonBase/TouchRipple.js +1 -2
- package/legacy/Fab/Fab.js +8 -20
- package/legacy/Fab/fabClasses.js +1 -1
- package/legacy/FormControlLabel/FormControlLabel.js +11 -3
- package/legacy/FormControlLabel/formControlLabelClasses.js +1 -1
- package/legacy/FormGroup/FormGroup.js +14 -3
- package/legacy/FormGroup/formGroupClasses.js +1 -1
- package/legacy/FormHelperText/FormHelperText.js +7 -9
- package/legacy/Grid/Grid.js +2 -4
- package/legacy/ImageList/ImageList.js +3 -1
- package/legacy/InputAdornment/InputAdornment.js +6 -9
- package/legacy/Modal/Modal.js +1 -1
- package/legacy/OutlinedInput/NotchedOutline.js +14 -16
- package/legacy/OutlinedInput/OutlinedInput.js +1 -1
- package/legacy/Radio/RadioButtonIcon.js +2 -6
- package/legacy/Rating/Rating.js +1 -1
- package/legacy/Select/Select.js +23 -7
- package/legacy/Select/SelectInput.js +12 -10
- package/legacy/Slider/Slider.js +3 -1
- package/legacy/Snackbar/Snackbar.js +4 -1
- package/legacy/SvgIcon/SvgIcon.js +9 -9
- package/legacy/SwipeableDrawer/SwipeArea.js +1 -3
- package/legacy/TextField/TextField.js +1 -1
- package/legacy/ToggleButton/ToggleButton.js +8 -2
- package/legacy/index.js +8 -3
- package/legacy/internal/SwitchBase.js +2 -6
- package/legacy/styles/makeStyles.js +1 -1
- package/legacy/styles/withStyles.js +1 -1
- package/legacy/styles/withTheme.js +1 -1
- package/legacy/useMediaQuery/useMediaQuery.js +87 -32
- package/modern/Autocomplete/Autocomplete.js +12 -4
- package/modern/AvatarGroup/AvatarGroup.js +17 -7
- package/modern/Badge/Badge.js +3 -2
- package/modern/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/modern/ButtonBase/ButtonBase.js +15 -2
- package/modern/ButtonBase/TouchRipple.js +1 -2
- package/modern/Fab/Fab.js +8 -20
- package/modern/Fab/fabClasses.js +1 -1
- package/modern/FormControlLabel/FormControlLabel.js +11 -3
- package/modern/FormControlLabel/formControlLabelClasses.js +1 -1
- package/modern/FormGroup/FormGroup.js +14 -3
- package/modern/FormGroup/formGroupClasses.js +1 -1
- package/modern/FormHelperText/FormHelperText.js +7 -9
- package/modern/Grid/Grid.js +2 -4
- package/modern/ImageList/ImageList.js +3 -1
- package/modern/InputAdornment/InputAdornment.js +6 -9
- package/modern/Modal/Modal.js +1 -1
- package/modern/OutlinedInput/NotchedOutline.js +14 -16
- package/modern/OutlinedInput/OutlinedInput.js +1 -1
- package/modern/Radio/RadioButtonIcon.js +2 -6
- package/modern/Rating/Rating.js +1 -1
- package/modern/Select/Select.js +19 -7
- package/modern/Select/SelectInput.js +12 -10
- package/modern/Slider/Slider.js +3 -1
- package/modern/Snackbar/Snackbar.js +4 -1
- package/modern/SvgIcon/SvgIcon.js +8 -8
- package/modern/SwipeableDrawer/SwipeArea.js +1 -3
- package/modern/TextField/TextField.js +1 -1
- package/modern/ToggleButton/ToggleButton.js +8 -2
- package/modern/index.js +8 -3
- package/modern/internal/SwitchBase.js +2 -6
- package/modern/styles/makeStyles.js +1 -1
- package/modern/styles/withStyles.js +1 -1
- package/modern/styles/withTheme.js +1 -1
- package/modern/useMediaQuery/useMediaQuery.js +69 -27
- package/node/Autocomplete/Autocomplete.js +12 -4
- package/node/AvatarGroup/AvatarGroup.js +19 -7
- package/node/Badge/Badge.js +3 -2
- package/node/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/node/ButtonBase/ButtonBase.js +15 -2
- package/node/ButtonBase/TouchRipple.js +1 -2
- package/node/Fab/Fab.js +8 -20
- package/node/Fab/fabClasses.js +1 -1
- package/node/FormControlLabel/FormControlLabel.js +12 -3
- package/node/FormControlLabel/formControlLabelClasses.js +1 -1
- package/node/FormGroup/FormGroup.js +15 -3
- package/node/FormGroup/formGroupClasses.js +1 -1
- package/node/FormHelperText/FormHelperText.js +6 -9
- package/node/Grid/Grid.js +2 -4
- package/node/ImageList/ImageList.js +3 -1
- package/node/InputAdornment/InputAdornment.js +5 -9
- package/node/Modal/Modal.js +1 -1
- package/node/OutlinedInput/NotchedOutline.js +12 -16
- package/node/OutlinedInput/OutlinedInput.js +1 -1
- package/node/Radio/RadioButtonIcon.js +2 -6
- package/node/Rating/Rating.js +1 -1
- package/node/Select/Select.js +22 -9
- package/node/Select/SelectInput.js +11 -10
- package/node/Slider/Slider.js +3 -1
- package/node/Snackbar/Snackbar.js +4 -1
- package/node/SvgIcon/SvgIcon.js +9 -9
- package/node/SwipeableDrawer/SwipeArea.js +1 -3
- package/node/TextField/TextField.js +1 -1
- package/node/ToggleButton/ToggleButton.js +8 -2
- package/node/index.js +62 -16
- package/node/internal/SwitchBase.js +2 -6
- package/node/styles/makeStyles.js +1 -1
- package/node/styles/withStyles.js +1 -1
- package/node/styles/withTheme.js +1 -1
- package/node/useMediaQuery/useMediaQuery.js +69 -27
- package/package.json +8 -8
- package/styles/ThemeProvider.d.ts +1 -1
- package/styles/index.d.ts +3 -0
- package/styles/makeStyles.js +1 -1
- package/styles/withStyles.js +1 -1
- package/styles/withTheme.js +1 -1
- package/umd/material-ui.development.js +5056 -7204
- package/umd/material-ui.production.min.js +21 -21
- package/useMediaQuery/useMediaQuery.d.ts +4 -0
- 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
|
|
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
|
|
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
|
+
"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
|
|
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
|
|
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.
|
|
49
|
-
"@mui/base": "5.0.0-alpha.
|
|
50
|
-
"@mui/system": "^5.
|
|
51
|
-
"@mui/types": "^7.1.
|
|
52
|
-
"@mui/utils": "^5.
|
|
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](
|
|
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
package/styles/makeStyles.js
CHANGED
|
@@ -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-
|
|
5
|
+
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(14));
|
|
6
6
|
}
|
package/styles/withStyles.js
CHANGED
|
@@ -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-
|
|
5
|
+
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(15));
|
|
6
6
|
}
|
package/styles/withTheme.js
CHANGED
|
@@ -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-
|
|
5
|
+
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(16));
|
|
6
6
|
}
|