@mui/material 5.2.8 → 5.4.1
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 +7 -0
- package/Autocomplete/Autocomplete.js +20 -10
- package/AvatarGroup/AvatarGroup.d.ts +10 -0
- package/AvatarGroup/AvatarGroup.js +19 -7
- package/Badge/Badge.js +5 -8
- 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 +308 -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 +9 -9
- package/Radio/RadioButtonIcon.js +2 -6
- package/Rating/Rating.js +1 -1
- package/Select/Select.d.ts +9 -1
- package/Select/Select.js +10 -1
- package/Select/SelectInput.d.ts +1 -0
- package/Select/SelectInput.js +37 -14
- package/Slider/Slider.js +112 -55
- 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/index.d.ts +8 -3
- package/index.js +6 -3
- package/internal/SwitchBase.js +2 -6
- package/legacy/Autocomplete/Autocomplete.js +21 -10
- package/legacy/AvatarGroup/AvatarGroup.js +20 -7
- package/legacy/Badge/Badge.js +6 -8
- 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 +11 -1
- package/legacy/Select/SelectInput.js +41 -17
- package/legacy/Slider/Slider.js +113 -56
- 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/index.js +6 -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/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
- package/modern/Autocomplete/Autocomplete.js +19 -9
- package/modern/AvatarGroup/AvatarGroup.js +17 -7
- package/modern/Badge/Badge.js +5 -8
- 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 +10 -1
- package/modern/Select/SelectInput.js +37 -14
- package/modern/Slider/Slider.js +112 -55
- 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/index.js +6 -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/modern/utils/shouldSpreadAdditionalProps.js +7 -0
- package/node/Autocomplete/Autocomplete.js +20 -10
- package/node/AvatarGroup/AvatarGroup.js +19 -7
- package/node/Badge/Badge.js +7 -9
- 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 +10 -1
- package/node/Select/SelectInput.js +36 -14
- package/node/Slider/Slider.js +98 -47
- 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/index.js +41 -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/node/utils/shouldSpreadAdditionalProps.js +15 -0
- package/package.json +10 -10
- package/styles/ThemeProvider.d.ts +1 -1
- package/styles/components.d.ts +452 -113
- package/styles/createTheme.d.ts +12 -6
- package/styles/makeStyles.js +1 -1
- package/styles/overrides.d.ts +16 -4
- package/styles/useThemeProps.d.ts +2 -1
- package/styles/withStyles.js +1 -1
- package/styles/withTheme.js +1 -1
- package/umd/material-ui.development.js +5099 -7092
- package/umd/material-ui.production.min.js +21 -21
- package/useMediaQuery/useMediaQuery.d.ts +4 -0
- package/useMediaQuery/useMediaQuery.js +69 -27
- package/utils/shouldSpreadAdditionalProps.js +7 -0
package/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.4.1
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -144,7 +144,10 @@ var _exportNames = {
|
|
|
144
144
|
useScrollTrigger: true,
|
|
145
145
|
Zoom: true,
|
|
146
146
|
useAutocomplete: true,
|
|
147
|
-
GlobalStyles: true
|
|
147
|
+
GlobalStyles: true,
|
|
148
|
+
unstable_composeClasses: true,
|
|
149
|
+
generateUtilityClass: true,
|
|
150
|
+
generateUtilityClasses: true
|
|
148
151
|
};
|
|
149
152
|
Object.defineProperty(exports, "Accordion", {
|
|
150
153
|
enumerable: true,
|
|
@@ -921,6 +924,24 @@ Object.defineProperty(exports, "darkScrollbar", {
|
|
|
921
924
|
return _darkScrollbar.default;
|
|
922
925
|
}
|
|
923
926
|
});
|
|
927
|
+
Object.defineProperty(exports, "generateUtilityClass", {
|
|
928
|
+
enumerable: true,
|
|
929
|
+
get: function () {
|
|
930
|
+
return _generateUtilityClass.default;
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
Object.defineProperty(exports, "generateUtilityClasses", {
|
|
934
|
+
enumerable: true,
|
|
935
|
+
get: function () {
|
|
936
|
+
return _generateUtilityClasses.default;
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
Object.defineProperty(exports, "unstable_composeClasses", {
|
|
940
|
+
enumerable: true,
|
|
941
|
+
get: function () {
|
|
942
|
+
return _composeClasses.default;
|
|
943
|
+
}
|
|
944
|
+
});
|
|
924
945
|
Object.defineProperty(exports, "useAutocomplete", {
|
|
925
946
|
enumerable: true,
|
|
926
947
|
get: function () {
|
|
@@ -978,20 +999,6 @@ Object.keys(_utils).forEach(function (key) {
|
|
|
978
999
|
});
|
|
979
1000
|
});
|
|
980
1001
|
|
|
981
|
-
var _base = require("@mui/base");
|
|
982
|
-
|
|
983
|
-
Object.keys(_base).forEach(function (key) {
|
|
984
|
-
if (key === "default" || key === "__esModule") return;
|
|
985
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
986
|
-
if (key in exports && exports[key] === _base[key]) return;
|
|
987
|
-
Object.defineProperty(exports, key, {
|
|
988
|
-
enumerable: true,
|
|
989
|
-
get: function () {
|
|
990
|
-
return _base[key];
|
|
991
|
-
}
|
|
992
|
-
});
|
|
993
|
-
});
|
|
994
|
-
|
|
995
1002
|
var _Accordion = _interopRequireWildcard(require("./Accordion"));
|
|
996
1003
|
|
|
997
1004
|
Object.keys(_Accordion).forEach(function (key) {
|
|
@@ -2828,6 +2835,24 @@ Object.keys(_GlobalStyles).forEach(function (key) {
|
|
|
2828
2835
|
});
|
|
2829
2836
|
});
|
|
2830
2837
|
|
|
2838
|
+
var _composeClasses = _interopRequireDefault(require("@mui/base/composeClasses"));
|
|
2839
|
+
|
|
2840
|
+
var _generateUtilityClass = _interopRequireWildcard(require("@mui/base/generateUtilityClass"));
|
|
2841
|
+
|
|
2842
|
+
Object.keys(_generateUtilityClass).forEach(function (key) {
|
|
2843
|
+
if (key === "default" || key === "__esModule") return;
|
|
2844
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
2845
|
+
if (key in exports && exports[key] === _generateUtilityClass[key]) return;
|
|
2846
|
+
Object.defineProperty(exports, key, {
|
|
2847
|
+
enumerable: true,
|
|
2848
|
+
get: function () {
|
|
2849
|
+
return _generateUtilityClass[key];
|
|
2850
|
+
}
|
|
2851
|
+
});
|
|
2852
|
+
});
|
|
2853
|
+
|
|
2854
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/base/generateUtilityClasses"));
|
|
2855
|
+
|
|
2831
2856
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
2832
2857
|
|
|
2833
2858
|
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; }
|
|
@@ -55,9 +55,7 @@ const useUtilityClasses = ownerState => {
|
|
|
55
55
|
return (0, _base.unstable_composeClasses)(slots, _switchBaseClasses.getSwitchBaseUtilityClass, classes);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
const SwitchBaseRoot = (0, _styled.default)(_ButtonBase.default
|
|
59
|
-
skipSx: true
|
|
60
|
-
})(({
|
|
58
|
+
const SwitchBaseRoot = (0, _styled.default)(_ButtonBase.default)(({
|
|
61
59
|
ownerState
|
|
62
60
|
}) => (0, _extends2.default)({
|
|
63
61
|
padding: 9,
|
|
@@ -67,9 +65,7 @@ const SwitchBaseRoot = (0, _styled.default)(_ButtonBase.default, {
|
|
|
67
65
|
}, ownerState.edge === 'end' && {
|
|
68
66
|
marginRight: ownerState.size === 'small' ? -3 : -12
|
|
69
67
|
}));
|
|
70
|
-
const SwitchBaseInput = (0, _styled.default)('input'
|
|
71
|
-
skipSx: true
|
|
72
|
-
})({
|
|
68
|
+
const SwitchBaseInput = (0, _styled.default)('input')({
|
|
73
69
|
cursor: 'inherit',
|
|
74
70
|
position: 'absolute',
|
|
75
71
|
opacity: 0,
|
|
@@ -10,5 +10,5 @@ var _utils = require("@mui/utils");
|
|
|
10
10
|
function makeStyles() {
|
|
11
11
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: makeStyles is not longer exported from @mui/material/styles.
|
|
12
12
|
You have to import it from @mui/styles.
|
|
13
|
-
See https://mui.com/r/migration-v4/#material-
|
|
13
|
+
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : (0, _utils.formatMuiErrorMessage)(14));
|
|
14
14
|
}
|
|
@@ -10,5 +10,5 @@ var _utils = require("@mui/utils");
|
|
|
10
10
|
function withStyles() {
|
|
11
11
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withStyles is not longer exported from @mui/material/styles.
|
|
12
12
|
You have to import it from @mui/styles.
|
|
13
|
-
See https://mui.com/r/migration-v4/#material-
|
|
13
|
+
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : (0, _utils.formatMuiErrorMessage)(15));
|
|
14
14
|
}
|
package/node/styles/withTheme.js
CHANGED
|
@@ -10,5 +10,5 @@ var _utils = require("@mui/utils");
|
|
|
10
10
|
function withTheme() {
|
|
11
11
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withTheme is not longer exported from @mui/material/styles.
|
|
12
12
|
You have to import it from @mui/styles.
|
|
13
|
-
See https://mui.com/r/migration-v4/#material-
|
|
13
|
+
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : (0, _utils.formatMuiErrorMessage)(16));
|
|
14
14
|
}
|
|
@@ -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
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _base = require("@mui/base");
|
|
9
|
+
|
|
10
|
+
const shouldSpreadAdditionalProps = Slot => {
|
|
11
|
+
return !Slot || !(0, _base.isHostComponent)(Slot);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var _default = shouldSpreadAdditionalProps;
|
|
15
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
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": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@emotion/react": "^11.5.0",
|
|
31
31
|
"@emotion/styled": "^11.3.0",
|
|
32
32
|
"@types/react": "^16.8.6 || ^17.0.0",
|
|
33
|
-
"react": "^17.0.
|
|
34
|
-
"react-dom": "^17.0.
|
|
33
|
+
"react": "^17.0.0",
|
|
34
|
+
"react-dom": "^17.0.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@types/react": {
|
|
@@ -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.68",
|
|
50
|
+
"@mui/system": "^5.4.1",
|
|
51
|
+
"@mui/types": "^7.1.1",
|
|
52
|
+
"@mui/utils": "^5.4.1",
|
|
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>,
|