@mui/material 5.1.1 → 5.2.0
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/Accordion/accordionClasses.d.ts +18 -18
- package/AccordionActions/accordionActionsClasses.d.ts +10 -10
- package/AccordionDetails/accordionDetailsClasses.d.ts +8 -8
- package/AccordionSummary/accordionSummaryClasses.d.ts +22 -22
- package/Alert/alertClasses.d.ts +44 -44
- package/AlertTitle/alertTitleClasses.d.ts +8 -8
- package/AppBar/appBarClasses.d.ts +28 -28
- package/Autocomplete/autocompleteClasses.d.ts +54 -54
- package/Avatar/avatarClasses.d.ts +20 -20
- package/AvatarGroup/avatarGroupClasses.d.ts +10 -10
- package/BottomNavigation/BottomNavigation.js +0 -0
- package/BottomNavigation/bottomNavigationClasses.d.ts +8 -8
- package/BottomNavigationAction/bottomNavigationActionClasses.d.ts +14 -14
- package/Breadcrumbs/breadcrumbsClasses.d.ts +14 -14
- package/Button/buttonClasses.d.ts +76 -76
- package/ButtonBase/buttonBaseClasses.d.ts +12 -12
- package/ButtonBase/touchRippleClasses.d.ts +20 -20
- package/ButtonGroup/ButtonGroupContext.d.ts +18 -18
- package/ButtonGroup/buttonGroupClasses.d.ts +58 -58
- package/CHANGELOG.md +93 -2
- package/Card/cardClasses.d.ts +8 -8
- package/CardActionArea/cardActionAreaClasses.d.ts +12 -12
- package/CardActions/cardActionsClasses.d.ts +10 -10
- package/CardContent/cardContentClasses.d.ts +8 -8
- package/CardHeader/cardHeaderClasses.d.ts +18 -18
- package/CardMedia/cardMediaClasses.d.ts +12 -12
- package/Checkbox/checkboxClasses.d.ts +18 -18
- package/Chip/chipClasses.d.ts +80 -80
- package/CircularProgress/circularProgressClasses.d.ts +26 -26
- package/ClickAwayListener/index.d.ts +2 -2
- package/Collapse/collapseClasses.d.ts +18 -18
- package/Container/containerClasses.d.ts +22 -22
- package/Dialog/DialogContext.d.ts +6 -6
- package/Dialog/dialogClasses.d.ts +36 -36
- package/DialogActions/dialogActionsClasses.d.ts +10 -10
- package/DialogContent/dialogContentClasses.d.ts +10 -10
- package/DialogContentText/dialogContentTextClasses.d.ts +8 -8
- package/DialogTitle/dialogTitleClasses.d.ts +8 -8
- package/Divider/dividerClasses.d.ts +34 -34
- package/Drawer/drawerClasses.d.ts +30 -30
- package/Fab/fabClasses.d.ts +26 -26
- package/FilledInput/filledInputClasses.d.ts +40 -40
- package/FormControl/formControlClasses.d.ts +14 -14
- package/FormControlLabel/formControlLabelClasses.d.ts +18 -18
- package/FormGroup/formGroupClasses.d.ts +10 -10
- package/FormHelperText/formHelperTextClasses.d.ts +22 -22
- package/FormLabel/formLabelClasses.d.ts +22 -22
- package/Grid/gridClasses.d.ts +48 -48
- package/Icon/iconClasses.d.ts +24 -24
- package/IconButton/IconButton.js +6 -4
- package/IconButton/iconButtonClasses.d.ts +26 -26
- package/ImageList/imageListClasses.d.ts +16 -16
- package/ImageListItem/imageListItemClasses.d.ts +18 -18
- package/ImageListItemBar/imageListItemBarClasses.d.ts +30 -30
- package/Input/inputClasses.d.ts +34 -34
- package/InputAdornment/inputAdornmentClasses.d.ts +24 -24
- package/InputBase/inputBaseClasses.d.ts +44 -44
- package/InputLabel/inputLabelClasses.d.ts +32 -32
- package/LinearProgress/linearProgressClasses.d.ts +42 -42
- package/Link/linkClasses.d.ts +18 -18
- package/List/listClasses.d.ts +14 -14
- package/ListItem/listItemClasses.d.ts +30 -30
- package/ListItemAvatar/listItemAvatarClasses.d.ts +10 -10
- package/ListItemButton/listItemButtonClasses.d.ts +22 -22
- package/ListItemIcon/listItemIconClasses.d.ts +10 -10
- package/ListItemSecondaryAction/listItemSecondaryActionClasses.d.ts +10 -10
- package/ListItemText/listItemTextClasses.d.ts +18 -18
- package/ListSubheader/listSubheaderClasses.d.ts +18 -18
- package/Menu/menuClasses.d.ts +12 -12
- package/MenuItem/menuItemClasses.d.ts +20 -20
- package/MobileStepper/mobileStepperClasses.d.ts +22 -22
- package/NativeSelect/nativeSelectClasses.d.ts +32 -32
- package/OutlinedInput/outlinedInputClasses.d.ts +36 -36
- package/Pagination/paginationClasses.d.ts +14 -14
- package/PaginationItem/paginationItemClasses.d.ts +42 -42
- package/Paper/paperClasses.d.ts +39 -39
- package/Popover/popoverClasses.d.ts +10 -10
- package/Popper/Popper.d.ts +17 -17
- package/Popper/Popper.js +4 -23
- package/Radio/radioClasses.d.ts +16 -16
- package/RadioGroup/RadioGroupContext.d.ts +11 -11
- package/RadioGroup/useRadioGroup.d.ts +4 -4
- package/Rating/ratingClasses.d.ts +40 -40
- package/ScopedCssBaseline/scopedCssBaselineClasses.d.ts +8 -8
- package/Select/SelectInput.js +1 -1
- package/Select/selectClasses.d.ts +30 -30
- package/Skeleton/skeletonClasses.d.ts +24 -24
- package/Snackbar/snackbarClasses.d.ts +20 -20
- package/SnackbarContent/snackbarContentClasses.d.ts +12 -12
- package/SpeedDial/speedDialClasses.d.ts +22 -22
- package/SpeedDialAction/speedDialActionClasses.d.ts +20 -20
- package/SpeedDialIcon/speedDialIconClasses.d.ts +18 -18
- package/Step/stepClasses.d.ts +16 -16
- package/StepButton/stepButtonClasses.d.ts +14 -14
- package/StepConnector/stepConnectorClasses.d.ts +26 -26
- package/StepContent/stepContentClasses.d.ts +12 -12
- package/StepIcon/stepIconClasses.d.ts +16 -16
- package/StepLabel/stepLabelClasses.d.ts +28 -28
- package/Stepper/stepperClasses.d.ts +14 -14
- package/SvgIcon/svgIconClasses.d.ts +24 -24
- package/Switch/switchClasses.d.ts +32 -32
- package/Tab/tabClasses.d.ts +26 -26
- package/TabScrollButton/tabScrollButtonClasses.d.ts +12 -12
- package/Table/tableClasses.d.ts +10 -10
- package/TableBody/tableBodyClasses.d.ts +8 -8
- package/TableCell/tableCellClasses.d.ts +32 -32
- package/TableContainer/tableContainerClasses.d.ts +8 -8
- package/TableFooter/tableFooterClasses.d.ts +8 -8
- package/TableHead/tableHeadClasses.d.ts +8 -8
- package/TablePagination/tablePaginationClasses.d.ts +28 -28
- package/TableRow/tableRowClasses.d.ts +16 -16
- package/TableSortLabel/tableSortLabelClasses.d.ts +16 -16
- package/Tabs/tabsClasses.d.ts +32 -32
- package/TextField/textFieldClasses.d.ts +8 -8
- package/ToggleButton/toggleButtonClasses.d.ts +24 -24
- package/ToggleButtonGroup/toggleButtonGroupClasses.d.ts +18 -18
- package/Toolbar/toolbarClasses.d.ts +14 -14
- package/Tooltip/tooltipClasses.d.ts +30 -30
- package/Typography/typographyClasses.d.ts +50 -50
- package/darkScrollbar/index.d.ts +28 -28
- package/index.js +1 -1
- package/internal/switchBaseClasses.d.ts +12 -12
- package/legacy/BottomNavigation/BottomNavigation.js +0 -0
- package/legacy/IconButton/IconButton.js +6 -4
- package/legacy/Popper/Popper.js +4 -23
- package/legacy/Select/SelectInput.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/locale/index.js +191 -108
- package/legacy/useMediaQuery/useMediaQuery.js +83 -31
- package/locale/index.d.ts +66 -65
- package/locale/index.js +80 -0
- package/modern/BottomNavigation/BottomNavigation.js +0 -0
- package/modern/IconButton/IconButton.js +6 -4
- package/modern/Popper/Popper.js +4 -23
- package/modern/Select/SelectInput.js +1 -1
- package/modern/index.js +1 -1
- package/modern/locale/index.js +80 -0
- package/modern/useMediaQuery/useMediaQuery.js +65 -26
- package/node/BottomNavigation/BottomNavigation.js +0 -0
- package/node/IconButton/IconButton.js +6 -4
- package/node/Popper/Popper.js +3 -22
- package/node/Select/SelectInput.js +1 -1
- package/node/index.js +1 -1
- package/node/locale/index.js +82 -1
- package/node/useMediaQuery/useMediaQuery.js +65 -26
- package/package.json +5 -5
- package/styles/variants.d.ts +3 -2
- package/transitions/index.d.ts +1 -1
- package/transitions/transition.d.ts +14 -14
- package/transitions/utils.d.ts +23 -23
- package/umd/material-ui.development.js +1086 -137
- package/umd/material-ui.production.min.js +21 -21
- package/useMediaQuery/useMediaQuery.d.ts +31 -27
- package/useMediaQuery/useMediaQuery.js +65 -26
- package/useTouchRipple/index.d.ts +1 -1
- package/useTouchRipple/useTouchRipple.d.ts +28 -28
- package/utils/getScrollbarSize.d.ts +2 -2
- package/utils/ownerDocument.d.ts +2 -2
- package/utils/ownerWindow.d.ts +2 -2
- package/utils/setRef.d.ts +2 -2
|
@@ -78,7 +78,8 @@ const IconButtonRoot = (0, _styled.default)(_ButtonBase.default, {
|
|
|
78
78
|
color: theme.palette.action.active,
|
|
79
79
|
transition: theme.transitions.create('background-color', {
|
|
80
80
|
duration: theme.transitions.duration.shortest
|
|
81
|
-
})
|
|
81
|
+
})
|
|
82
|
+
}, !ownerState.disableRipple && {
|
|
82
83
|
'&:hover': {
|
|
83
84
|
backgroundColor: (0, _system.alpha)(theme.palette.action.active, theme.palette.action.hoverOpacity),
|
|
84
85
|
// Reset on touch devices, it doesn't add specificity
|
|
@@ -95,8 +96,9 @@ const IconButtonRoot = (0, _styled.default)(_ButtonBase.default, {
|
|
|
95
96
|
ownerState
|
|
96
97
|
}) => (0, _extends2.default)({}, ownerState.color === 'inherit' && {
|
|
97
98
|
color: 'inherit'
|
|
98
|
-
}, ownerState.color !== 'inherit' && ownerState.color !== 'default' && {
|
|
99
|
-
color: theme.palette[ownerState.color].main
|
|
99
|
+
}, ownerState.color !== 'inherit' && ownerState.color !== 'default' && (0, _extends2.default)({
|
|
100
|
+
color: theme.palette[ownerState.color].main
|
|
101
|
+
}, !ownerState.disableRipple && {
|
|
100
102
|
'&:hover': {
|
|
101
103
|
backgroundColor: (0, _system.alpha)(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
|
|
102
104
|
// Reset on touch devices, it doesn't add specificity
|
|
@@ -104,7 +106,7 @@ const IconButtonRoot = (0, _styled.default)(_ButtonBase.default, {
|
|
|
104
106
|
backgroundColor: 'transparent'
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
|
-
}, ownerState.size === 'small' && {
|
|
109
|
+
}), ownerState.size === 'small' && {
|
|
108
110
|
padding: 5,
|
|
109
111
|
fontSize: theme.typography.pxToRem(18)
|
|
110
112
|
}, ownerState.size === 'large' && {
|
package/node/Popper/Popper.js
CHANGED
|
@@ -45,11 +45,6 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(props, ref) {
|
|
|
45
45
|
ref: ref
|
|
46
46
|
}));
|
|
47
47
|
});
|
|
48
|
-
|
|
49
|
-
function resolveAnchorEl(anchorEl) {
|
|
50
|
-
return typeof anchorEl === 'function' ? anchorEl() : anchorEl;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
48
|
process.env.NODE_ENV !== "production" ? Popper.propTypes
|
|
54
49
|
/* remove-proptypes */
|
|
55
50
|
= {
|
|
@@ -64,23 +59,9 @@ process.env.NODE_ENV !== "production" ? Popper.propTypes
|
|
|
64
59
|
* It's used to set the position of the popper.
|
|
65
60
|
* The return value will passed as the reference object of the Popper instance.
|
|
66
61
|
*/
|
|
67
|
-
anchorEl:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (resolvedAnchorEl && resolvedAnchorEl.nodeType === 1) {
|
|
72
|
-
const box = resolvedAnchorEl.getBoundingClientRect();
|
|
73
|
-
|
|
74
|
-
if (process.env.NODE_ENV !== 'test' && box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
|
|
75
|
-
return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', "Make sure the element is present in the document or that it's not display none."].join('\n'));
|
|
76
|
-
}
|
|
77
|
-
} else if (!resolvedAnchorEl || typeof resolvedAnchorEl.getBoundingClientRect !== 'function' || resolvedAnchorEl.contextElement != null && resolvedAnchorEl.contextElement.nodeType !== 1) {
|
|
78
|
-
return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'It should be an HTML element instance or a virtualElement ', '(https://popper.js.org/docs/v2/virtual-elements/).'].join('\n'));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return null;
|
|
83
|
-
}),
|
|
62
|
+
anchorEl: _propTypes.default
|
|
63
|
+
/* @typescript-to-proptypes-ignore */
|
|
64
|
+
.oneOfType([_utils.HTMLElementType, _propTypes.default.object, _propTypes.default.func]),
|
|
84
65
|
|
|
85
66
|
/**
|
|
86
67
|
* Popper render function or node.
|
|
@@ -399,7 +399,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
402
|
-
'aria-selected': selected ? 'true' :
|
|
402
|
+
'aria-selected': selected ? 'true' : 'false',
|
|
403
403
|
onClick: handleItemClick(child),
|
|
404
404
|
onKeyUp: event => {
|
|
405
405
|
if (event.key === ' ') {
|
package/node/index.js
CHANGED
package/node/locale/index.js
CHANGED
|
@@ -3,7 +3,88 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.zhTW = exports.zhHK = exports.zhCN = exports.viVN = exports.ukUA = exports.trTR = exports.thTH = exports.svSE = exports.skSK = exports.siLK = exports.ruRU = exports.roRO = exports.ptPT = exports.ptBR = exports.plPL = exports.nlNL = exports.kzKZ = exports.koKR = exports.khKH = exports.jaJP = exports.itIT = exports.isIS = exports.idID = exports.hyAM = exports.huHU = exports.hiIN = exports.heIL = exports.frFR = exports.fiFI = exports.faIR = exports.etEE = exports.esES = exports.enUS = exports.elGR = exports.deDE = exports.csCZ = exports.caES = exports.bnBD = exports.bgBG = exports.azAZ = exports.arSD = exports.arEG = void 0;
|
|
6
|
+
exports.zhTW = exports.zhHK = exports.zhCN = exports.viVN = exports.ukUA = exports.trTR = exports.thTH = exports.svSE = exports.skSK = exports.siLK = exports.ruRU = exports.roRO = exports.ptPT = exports.ptBR = exports.plPL = exports.nlNL = exports.kzKZ = exports.koKR = exports.khKH = exports.jaJP = exports.itIT = exports.isIS = exports.idID = exports.hyAM = exports.huHU = exports.hiIN = exports.heIL = exports.frFR = exports.fiFI = exports.faIR = exports.etEE = exports.esES = exports.enUS = exports.elGR = exports.deDE = exports.csCZ = exports.caES = exports.bnBD = exports.bgBG = exports.azAZ = exports.arSD = exports.arEG = exports.amET = void 0;
|
|
7
|
+
const amET = {
|
|
8
|
+
components: {
|
|
9
|
+
MuiBreadcrumbs: {
|
|
10
|
+
defaultProps: {
|
|
11
|
+
expandText: 'መንገድ አሳይ'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
MuiTablePagination: {
|
|
15
|
+
defaultProps: {
|
|
16
|
+
getItemAriaLabel: type => {
|
|
17
|
+
if (type === 'first') {
|
|
18
|
+
return 'ወደ መጀመሪያው ገጽ ይሂዱ';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (type === 'last') {
|
|
22
|
+
return 'ወደ መጨረሻው ገጽ ይሂዱ';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (type === 'next') {
|
|
26
|
+
return 'ወደ ቀጣዩ ገጽ ይሂዱ';
|
|
27
|
+
} // if (type === 'previous') {
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
return 'ወደ ቀዳሚው ገጽ ይሂዱ';
|
|
31
|
+
},
|
|
32
|
+
labelRowsPerPage: 'ረድፎች በአንድ ገጽ:',
|
|
33
|
+
labelDisplayedRows: ({
|
|
34
|
+
from,
|
|
35
|
+
to,
|
|
36
|
+
count
|
|
37
|
+
}) => `${from}-${to} ከ ${count !== -1 ? count : `${to} በላይ`}`
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
MuiRating: {
|
|
41
|
+
defaultProps: {
|
|
42
|
+
getLabelText: value => `${value} ኮከ${value !== 1 ? 'ቦች' : 'ብ'}`,
|
|
43
|
+
emptyLabelText: 'ባዶ'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
MuiAutocomplete: {
|
|
47
|
+
defaultProps: {
|
|
48
|
+
clearText: 'አጽዳ',
|
|
49
|
+
closeText: 'ዝጋ',
|
|
50
|
+
loadingText: 'በመጫን ላይ…',
|
|
51
|
+
noOptionsText: 'አማራጮች የሉም',
|
|
52
|
+
openText: 'ክፈት'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
MuiAlert: {
|
|
56
|
+
defaultProps: {
|
|
57
|
+
closeText: 'ዝጋ'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
MuiPagination: {
|
|
61
|
+
defaultProps: {
|
|
62
|
+
'aria-label': 'የገጽ አሰሳ',
|
|
63
|
+
getItemAriaLabel: (type, page, selected) => {
|
|
64
|
+
if (type === 'page') {
|
|
65
|
+
return `${selected ? '' : 'ወደ '}ገጽ ${page}${selected ? '' : ' ሂድ'}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (type === 'first') {
|
|
69
|
+
return 'ወደ መጀመሪያው ገጽ ይሂዱ';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (type === 'last') {
|
|
73
|
+
return 'ወደ መጨረሻው ገጽ ይሂዱ';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (type === 'next') {
|
|
77
|
+
return 'ወደ ቀጣዩ ገጽ ይሂዱ';
|
|
78
|
+
} // if (type === 'previous') {
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
return 'ወደ ቀዳሚው ገጽ ይሂዱ';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.amET = amET;
|
|
7
88
|
const arEG = {
|
|
8
89
|
components: {
|
|
9
90
|
MuiBreadcrumbs: {
|
|
@@ -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;
|
|
@@ -74,13 +50,76 @@ function useMediaQuery(queryInput, options = {}) {
|
|
|
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
|
+
}
|
|
63
|
+
|
|
64
|
+
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
|
|
65
|
+
const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
|
|
66
|
+
const getServerSnapshot = React.useMemo(() => {
|
|
67
|
+
if (ssrMatchMedia !== null) {
|
|
68
|
+
const {
|
|
69
|
+
matches
|
|
70
|
+
} = ssrMatchMedia(query);
|
|
71
|
+
return () => matches;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return getDefaultSnapshot;
|
|
75
|
+
}, [getDefaultSnapshot, query, ssrMatchMedia]);
|
|
76
|
+
const [getSnapshot, subscribe] = React.useMemo(() => {
|
|
77
|
+
if (matchMedia === null) {
|
|
78
|
+
return [getDefaultSnapshot, () => () => {}];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const mediaQueryList = matchMedia(query);
|
|
82
|
+
return [() => mediaQueryList.matches, notify => {
|
|
83
|
+
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
84
|
+
mediaQueryList.addListener(notify);
|
|
85
|
+
return () => {
|
|
86
|
+
mediaQueryList.removeListener(notify);
|
|
87
|
+
};
|
|
88
|
+
}];
|
|
89
|
+
}, [getDefaultSnapshot, matchMedia, query]);
|
|
90
|
+
const match = React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
91
|
+
return match;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function useMediaQuery(queryInput, options = {}) {
|
|
95
|
+
const theme = (0, _system.useThemeWithoutDefault)(); // Wait for jsdom to support the match media feature.
|
|
96
|
+
// All the browsers MUI support have this built-in.
|
|
97
|
+
// This defensive check is here for simplicity.
|
|
98
|
+
// Most of the time, the match media logic isn't central to people tests.
|
|
99
|
+
|
|
100
|
+
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
101
|
+
const {
|
|
102
|
+
defaultMatches = false,
|
|
103
|
+
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
104
|
+
ssrMatchMedia = null,
|
|
105
|
+
noSsr
|
|
106
|
+
} = (0, _system.getThemeProps)({
|
|
107
|
+
name: 'MuiUseMediaQuery',
|
|
108
|
+
props: options,
|
|
109
|
+
theme
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
113
|
+
if (typeof queryInput === 'function' && theme === null) {
|
|
114
|
+
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'));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
|
119
|
+
query = query.replace(/^@media( ?)/m, ''); // TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
|
|
120
|
+
|
|
121
|
+
const useMediaQueryImplementation = React.useSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
|
122
|
+
const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
|
84
123
|
|
|
85
124
|
if (process.env.NODE_ENV !== 'production') {
|
|
86
125
|
// 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.2.0",
|
|
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.",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/runtime": "^7.16.3",
|
|
49
|
-
"@mui/base": "5.0.0-alpha.
|
|
50
|
-
"@mui/system": "^5.
|
|
49
|
+
"@mui/base": "5.0.0-alpha.56",
|
|
50
|
+
"@mui/system": "^5.2.0",
|
|
51
51
|
"@mui/types": "^7.1.0",
|
|
52
|
-
"@mui/utils": "^5.
|
|
52
|
+
"@mui/utils": "^5.2.0",
|
|
53
53
|
"@types/react-transition-group": "^4.4.4",
|
|
54
54
|
"clsx": "^1.1.1",
|
|
55
|
-
"csstype": "^3.0.
|
|
55
|
+
"csstype": "^3.0.10",
|
|
56
56
|
"hoist-non-react-statics": "^3.3.2",
|
|
57
57
|
"prop-types": "^15.7.2",
|
|
58
58
|
"react-is": "^17.0.2",
|
package/styles/variants.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Interpolation } from '@mui/system';
|
|
2
|
+
import { Theme } from './createTheme';
|
|
2
3
|
import { ComponentsPropsList } from './props';
|
|
3
4
|
|
|
4
5
|
export type ComponentsVariants = {
|
|
5
6
|
[Name in keyof ComponentsPropsList]?: Array<{
|
|
6
7
|
props: Partial<ComponentsPropsList[Name]>;
|
|
7
|
-
style:
|
|
8
|
+
style: Interpolation<{ theme: Theme }>;
|
|
8
9
|
}>;
|
|
9
10
|
};
|
package/transitions/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './transition';
|
|
1
|
+
export * from './transition';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { TransitionProps as _TransitionProps, TransitionActions } from 'react-transition-group/Transition';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
export declare type TransitionHandlerKeys = 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited';
|
|
4
|
-
export declare type TransitionHandlerProps = Pick<_TransitionProps, TransitionHandlerKeys>;
|
|
5
|
-
export interface EasingProps {
|
|
6
|
-
easing: string | {
|
|
7
|
-
enter?: string;
|
|
8
|
-
exit?: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare type TransitionKeys = 'in' | 'mountOnEnter' | 'unmountOnExit' | 'timeout' | 'easing' | 'addEndListener' | TransitionHandlerKeys;
|
|
12
|
-
export interface TransitionProps extends TransitionActions, Partial<Pick<_TransitionProps & EasingProps, TransitionKeys>> {
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
}
|
|
1
|
+
import { TransitionProps as _TransitionProps, TransitionActions } from 'react-transition-group/Transition';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export declare type TransitionHandlerKeys = 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited';
|
|
4
|
+
export declare type TransitionHandlerProps = Pick<_TransitionProps, TransitionHandlerKeys>;
|
|
5
|
+
export interface EasingProps {
|
|
6
|
+
easing: string | {
|
|
7
|
+
enter?: string;
|
|
8
|
+
exit?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare type TransitionKeys = 'in' | 'mountOnEnter' | 'unmountOnExit' | 'timeout' | 'easing' | 'addEndListener' | TransitionHandlerKeys;
|
|
12
|
+
export interface TransitionProps extends TransitionActions, Partial<Pick<_TransitionProps & EasingProps, TransitionKeys>> {
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
}
|
package/transitions/utils.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const reflow: (node: Element) => number;
|
|
3
|
-
interface ComponentProps {
|
|
4
|
-
easing: string | {
|
|
5
|
-
enter?: string;
|
|
6
|
-
exit?: string;
|
|
7
|
-
} | undefined;
|
|
8
|
-
style: React.CSSProperties | undefined;
|
|
9
|
-
timeout: number | {
|
|
10
|
-
enter?: number;
|
|
11
|
-
exit?: number;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
interface Options {
|
|
15
|
-
mode: 'enter' | 'exit';
|
|
16
|
-
}
|
|
17
|
-
interface TransitionProps {
|
|
18
|
-
duration: string | number;
|
|
19
|
-
easing: string | undefined;
|
|
20
|
-
delay: string | undefined;
|
|
21
|
-
}
|
|
22
|
-
export declare function getTransitionProps(props: ComponentProps, options: Options): TransitionProps;
|
|
23
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const reflow: (node: Element) => number;
|
|
3
|
+
interface ComponentProps {
|
|
4
|
+
easing: string | {
|
|
5
|
+
enter?: string;
|
|
6
|
+
exit?: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
style: React.CSSProperties | undefined;
|
|
9
|
+
timeout: number | {
|
|
10
|
+
enter?: number;
|
|
11
|
+
exit?: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface Options {
|
|
15
|
+
mode: 'enter' | 'exit';
|
|
16
|
+
}
|
|
17
|
+
interface TransitionProps {
|
|
18
|
+
duration: string | number;
|
|
19
|
+
easing: string | undefined;
|
|
20
|
+
delay: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
export declare function getTransitionProps(props: ComponentProps, options: Options): TransitionProps;
|
|
23
|
+
export {};
|