@mui/material 5.2.0 → 5.2.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.
Files changed (152) hide show
  1. package/Accordion/accordionClasses.d.ts +18 -18
  2. package/AccordionActions/accordionActionsClasses.d.ts +10 -10
  3. package/AccordionDetails/accordionDetailsClasses.d.ts +8 -8
  4. package/AccordionSummary/accordionSummaryClasses.d.ts +22 -22
  5. package/Alert/alertClasses.d.ts +44 -44
  6. package/AlertTitle/alertTitleClasses.d.ts +8 -8
  7. package/AppBar/appBarClasses.d.ts +28 -28
  8. package/Autocomplete/autocompleteClasses.d.ts +54 -54
  9. package/Avatar/avatarClasses.d.ts +20 -20
  10. package/AvatarGroup/avatarGroupClasses.d.ts +10 -10
  11. package/BottomNavigation/BottomNavigation.js +0 -0
  12. package/BottomNavigation/bottomNavigationClasses.d.ts +8 -8
  13. package/BottomNavigationAction/bottomNavigationActionClasses.d.ts +14 -14
  14. package/Breadcrumbs/breadcrumbsClasses.d.ts +14 -14
  15. package/Button/buttonClasses.d.ts +76 -76
  16. package/ButtonBase/buttonBaseClasses.d.ts +12 -12
  17. package/ButtonBase/touchRippleClasses.d.ts +20 -20
  18. package/ButtonGroup/ButtonGroupContext.d.ts +18 -18
  19. package/ButtonGroup/buttonGroupClasses.d.ts +58 -58
  20. package/CHANGELOG.md +23 -0
  21. package/Card/cardClasses.d.ts +8 -8
  22. package/CardActionArea/cardActionAreaClasses.d.ts +12 -12
  23. package/CardActions/cardActionsClasses.d.ts +10 -10
  24. package/CardContent/cardContentClasses.d.ts +8 -8
  25. package/CardHeader/cardHeaderClasses.d.ts +18 -18
  26. package/CardMedia/cardMediaClasses.d.ts +12 -12
  27. package/Checkbox/checkboxClasses.d.ts +18 -18
  28. package/Chip/chipClasses.d.ts +80 -80
  29. package/CircularProgress/circularProgressClasses.d.ts +26 -26
  30. package/ClickAwayListener/index.d.ts +2 -2
  31. package/Collapse/collapseClasses.d.ts +18 -18
  32. package/Container/containerClasses.d.ts +22 -22
  33. package/Dialog/DialogContext.d.ts +6 -6
  34. package/Dialog/dialogClasses.d.ts +36 -36
  35. package/DialogActions/dialogActionsClasses.d.ts +10 -10
  36. package/DialogContent/dialogContentClasses.d.ts +10 -10
  37. package/DialogContentText/dialogContentTextClasses.d.ts +8 -8
  38. package/DialogTitle/dialogTitleClasses.d.ts +8 -8
  39. package/Divider/dividerClasses.d.ts +34 -34
  40. package/Drawer/drawerClasses.d.ts +30 -30
  41. package/Fab/fabClasses.d.ts +26 -26
  42. package/FilledInput/filledInputClasses.d.ts +40 -40
  43. package/FormControl/formControlClasses.d.ts +14 -14
  44. package/FormControlLabel/formControlLabelClasses.d.ts +18 -18
  45. package/FormGroup/formGroupClasses.d.ts +10 -10
  46. package/FormHelperText/formHelperTextClasses.d.ts +22 -22
  47. package/FormLabel/formLabelClasses.d.ts +22 -22
  48. package/Grid/gridClasses.d.ts +48 -48
  49. package/Icon/iconClasses.d.ts +24 -24
  50. package/IconButton/iconButtonClasses.d.ts +26 -26
  51. package/ImageList/imageListClasses.d.ts +16 -16
  52. package/ImageListItem/imageListItemClasses.d.ts +18 -18
  53. package/ImageListItemBar/imageListItemBarClasses.d.ts +30 -30
  54. package/Input/inputClasses.d.ts +34 -34
  55. package/InputAdornment/inputAdornmentClasses.d.ts +24 -24
  56. package/InputBase/inputBaseClasses.d.ts +44 -44
  57. package/InputLabel/inputLabelClasses.d.ts +32 -32
  58. package/LinearProgress/linearProgressClasses.d.ts +42 -42
  59. package/Link/linkClasses.d.ts +18 -18
  60. package/List/listClasses.d.ts +14 -14
  61. package/ListItem/listItemClasses.d.ts +30 -30
  62. package/ListItemAvatar/listItemAvatarClasses.d.ts +10 -10
  63. package/ListItemButton/listItemButtonClasses.d.ts +22 -22
  64. package/ListItemIcon/listItemIconClasses.d.ts +10 -10
  65. package/ListItemSecondaryAction/listItemSecondaryActionClasses.d.ts +10 -10
  66. package/ListItemText/listItemTextClasses.d.ts +18 -18
  67. package/ListSubheader/listSubheaderClasses.d.ts +18 -18
  68. package/Menu/menuClasses.d.ts +12 -12
  69. package/MenuItem/menuItemClasses.d.ts +20 -20
  70. package/MobileStepper/mobileStepperClasses.d.ts +22 -22
  71. package/NativeSelect/nativeSelectClasses.d.ts +32 -32
  72. package/OutlinedInput/outlinedInputClasses.d.ts +36 -36
  73. package/Pagination/paginationClasses.d.ts +14 -14
  74. package/PaginationItem/paginationItemClasses.d.ts +42 -42
  75. package/Paper/paperClasses.d.ts +39 -39
  76. package/Popover/popoverClasses.d.ts +10 -10
  77. package/Popper/Popper.d.ts +17 -17
  78. package/Radio/radioClasses.d.ts +16 -16
  79. package/RadioGroup/RadioGroupContext.d.ts +11 -11
  80. package/RadioGroup/useRadioGroup.d.ts +4 -4
  81. package/Rating/ratingClasses.d.ts +40 -40
  82. package/ScopedCssBaseline/scopedCssBaselineClasses.d.ts +8 -8
  83. package/Select/SelectInput.js +5 -1
  84. package/Select/selectClasses.d.ts +30 -30
  85. package/Skeleton/skeletonClasses.d.ts +24 -24
  86. package/Snackbar/snackbarClasses.d.ts +20 -20
  87. package/SnackbarContent/snackbarContentClasses.d.ts +12 -12
  88. package/SpeedDial/speedDialClasses.d.ts +22 -22
  89. package/SpeedDialAction/speedDialActionClasses.d.ts +20 -20
  90. package/SpeedDialIcon/speedDialIconClasses.d.ts +18 -18
  91. package/Step/stepClasses.d.ts +16 -16
  92. package/StepButton/stepButtonClasses.d.ts +14 -14
  93. package/StepConnector/stepConnectorClasses.d.ts +26 -26
  94. package/StepContent/stepContentClasses.d.ts +12 -12
  95. package/StepIcon/stepIconClasses.d.ts +16 -16
  96. package/StepLabel/stepLabelClasses.d.ts +28 -28
  97. package/Stepper/stepperClasses.d.ts +14 -14
  98. package/SvgIcon/svgIconClasses.d.ts +24 -24
  99. package/Switch/switchClasses.d.ts +32 -32
  100. package/Tab/tabClasses.d.ts +26 -26
  101. package/TabScrollButton/tabScrollButtonClasses.d.ts +12 -12
  102. package/Table/tableClasses.d.ts +10 -10
  103. package/TableBody/tableBodyClasses.d.ts +8 -8
  104. package/TableCell/tableCellClasses.d.ts +32 -32
  105. package/TableContainer/tableContainerClasses.d.ts +8 -8
  106. package/TableFooter/tableFooterClasses.d.ts +8 -8
  107. package/TableHead/tableHeadClasses.d.ts +8 -8
  108. package/TablePagination/tablePaginationClasses.d.ts +28 -28
  109. package/TableRow/tableRowClasses.d.ts +16 -16
  110. package/TableSortLabel/tableSortLabelClasses.d.ts +16 -16
  111. package/Tabs/tabsClasses.d.ts +32 -32
  112. package/TextField/textFieldClasses.d.ts +8 -8
  113. package/ToggleButton/toggleButtonClasses.d.ts +24 -24
  114. package/ToggleButtonGroup/toggleButtonGroupClasses.d.ts +18 -18
  115. package/Toolbar/toolbarClasses.d.ts +14 -14
  116. package/Tooltip/tooltipClasses.d.ts +30 -30
  117. package/Typography/typographyClasses.d.ts +50 -50
  118. package/darkScrollbar/index.d.ts +28 -28
  119. package/index.js +1 -1
  120. package/internal/switchBaseClasses.d.ts +12 -12
  121. package/legacy/BottomNavigation/BottomNavigation.js +0 -0
  122. package/legacy/Select/SelectInput.js +7 -1
  123. package/legacy/index.js +1 -1
  124. package/legacy/styles/index.js +1 -1
  125. package/legacy/useMediaQuery/useMediaQuery.js +31 -83
  126. package/locale/index.d.ts +66 -66
  127. package/modern/BottomNavigation/BottomNavigation.js +0 -0
  128. package/modern/Select/SelectInput.js +5 -1
  129. package/modern/index.js +1 -1
  130. package/modern/styles/index.js +1 -1
  131. package/modern/useMediaQuery/useMediaQuery.js +26 -65
  132. package/node/BottomNavigation/BottomNavigation.js +0 -0
  133. package/node/Select/SelectInput.js +5 -1
  134. package/node/index.js +1 -1
  135. package/node/styles/index.js +6 -0
  136. package/node/useMediaQuery/useMediaQuery.js +26 -65
  137. package/package.json +4 -4
  138. package/styles/index.d.ts +1 -0
  139. package/styles/index.js +1 -1
  140. package/transitions/index.d.ts +1 -1
  141. package/transitions/transition.d.ts +14 -14
  142. package/transitions/utils.d.ts +23 -23
  143. package/umd/material-ui.development.js +53 -96
  144. package/umd/material-ui.production.min.js +13 -13
  145. package/useMediaQuery/useMediaQuery.d.ts +27 -31
  146. package/useMediaQuery/useMediaQuery.js +26 -65
  147. package/useTouchRipple/index.d.ts +1 -1
  148. package/useTouchRipple/useTouchRipple.d.ts +28 -28
  149. package/utils/getScrollbarSize.d.ts +2 -2
  150. package/utils/ownerDocument.d.ts +2 -2
  151. package/utils/ownerWindow.d.ts +2 -2
  152. package/utils/setRef.d.ts +2 -2
@@ -1,4 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
1
  import * as React from 'react';
3
2
  import { getThemeProps, useThemeWithoutDefault as useTheme } from '@mui/system';
4
3
  import useEnhancedEffect from '../utils/useEnhancedEffect';
@@ -6,9 +5,38 @@ import useEnhancedEffect from '../utils/useEnhancedEffect';
6
5
  * @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
7
6
  */
8
7
 
9
- function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
8
+ export default function useMediaQuery(queryInput) {
9
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10
+ var theme = useTheme(); // Wait for jsdom to support the match media feature.
11
+ // All the browsers MUI support have this built-in.
12
+ // This defensive check is here for simplicity.
13
+ // Most of the time, the match media logic isn't central to people tests.
14
+
10
15
  var supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
11
16
 
17
+ var _getThemeProps = getThemeProps({
18
+ name: 'MuiUseMediaQuery',
19
+ props: options,
20
+ theme: theme
21
+ }),
22
+ _getThemeProps$defaul = _getThemeProps.defaultMatches,
23
+ defaultMatches = _getThemeProps$defaul === void 0 ? false : _getThemeProps$defaul,
24
+ _getThemeProps$matchM = _getThemeProps.matchMedia,
25
+ matchMedia = _getThemeProps$matchM === void 0 ? supportMatchMedia ? window.matchMedia : null : _getThemeProps$matchM,
26
+ _getThemeProps$noSsr = _getThemeProps.noSsr,
27
+ noSsr = _getThemeProps$noSsr === void 0 ? false : _getThemeProps$noSsr,
28
+ _getThemeProps$ssrMat = _getThemeProps.ssrMatchMedia,
29
+ ssrMatchMedia = _getThemeProps$ssrMat === void 0 ? null : _getThemeProps$ssrMat;
30
+
31
+ if (process.env.NODE_ENV !== 'production') {
32
+ if (typeof queryInput === 'function' && theme === null) {
33
+ 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'));
34
+ }
35
+ }
36
+
37
+ var query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
38
+ query = query.replace(/^@media( ?)/m, '');
39
+
12
40
  var _React$useState = React.useState(function () {
13
41
  if (noSsr && supportMatchMedia) {
14
42
  return matchMedia(query).matches;
@@ -45,93 +73,13 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
45
73
  }
46
74
  };
47
75
 
48
- updateMatch(); // TODO: Use `addEventListener` once support for Safari < 14 is dropped
49
-
76
+ updateMatch();
50
77
  queryList.addListener(updateMatch);
51
78
  return function () {
52
79
  active = false;
53
80
  queryList.removeListener(updateMatch);
54
81
  };
55
82
  }, [query, matchMedia, supportMatchMedia]);
56
- return match;
57
- }
58
-
59
- function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
60
- var getDefaultSnapshot = React.useCallback(function () {
61
- return defaultMatches;
62
- }, [defaultMatches]);
63
- var getServerSnapshot = React.useMemo(function () {
64
- if (ssrMatchMedia !== null) {
65
- var _ssrMatchMedia = ssrMatchMedia(query),
66
- matches = _ssrMatchMedia.matches;
67
-
68
- return function () {
69
- return matches;
70
- };
71
- }
72
-
73
- return getDefaultSnapshot;
74
- }, [getDefaultSnapshot, query, ssrMatchMedia]);
75
-
76
- var _React$useMemo = React.useMemo(function () {
77
- if (matchMedia === null) {
78
- return [getDefaultSnapshot, function () {
79
- return function () {};
80
- }];
81
- }
82
-
83
- var mediaQueryList = matchMedia(query);
84
- return [function () {
85
- return mediaQueryList.matches;
86
- }, function (notify) {
87
- // TODO: Use `addEventListener` once support for Safari < 14 is dropped
88
- mediaQueryList.addListener(notify);
89
- return function () {
90
- mediaQueryList.removeListener(notify);
91
- };
92
- }];
93
- }, [getDefaultSnapshot, matchMedia, query]),
94
- _React$useMemo2 = _slicedToArray(_React$useMemo, 2),
95
- getSnapshot = _React$useMemo2[0],
96
- subscribe = _React$useMemo2[1];
97
-
98
- var match = React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
99
- return match;
100
- }
101
-
102
- export default function useMediaQuery(queryInput) {
103
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
104
- var theme = useTheme(); // Wait for jsdom to support the match media feature.
105
- // All the browsers MUI support have this built-in.
106
- // This defensive check is here for simplicity.
107
- // Most of the time, the match media logic isn't central to people tests.
108
-
109
- var supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
110
-
111
- var _getThemeProps = getThemeProps({
112
- name: 'MuiUseMediaQuery',
113
- props: options,
114
- theme: theme
115
- }),
116
- _getThemeProps$defaul = _getThemeProps.defaultMatches,
117
- defaultMatches = _getThemeProps$defaul === void 0 ? false : _getThemeProps$defaul,
118
- _getThemeProps$matchM = _getThemeProps.matchMedia,
119
- matchMedia = _getThemeProps$matchM === void 0 ? supportMatchMedia ? window.matchMedia : null : _getThemeProps$matchM,
120
- _getThemeProps$ssrMat = _getThemeProps.ssrMatchMedia,
121
- ssrMatchMedia = _getThemeProps$ssrMat === void 0 ? null : _getThemeProps$ssrMat,
122
- noSsr = _getThemeProps.noSsr;
123
-
124
- if (process.env.NODE_ENV !== 'production') {
125
- if (typeof queryInput === 'function' && theme === null) {
126
- 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'));
127
- }
128
- }
129
-
130
- var query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
131
- query = query.replace(/^@media( ?)/m, ''); // TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
132
-
133
- var useMediaQueryImplementation = React.useSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
134
- var match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
135
83
 
136
84
  if (process.env.NODE_ENV !== 'production') {
137
85
  // eslint-disable-next-line react-hooks/rules-of-hooks
package/locale/index.d.ts CHANGED
@@ -1,66 +1,66 @@
1
- import { ComponentsPropsList } from '../styles/props';
2
- export interface Localization {
3
- components?: {
4
- MuiAlert?: {
5
- defaultProps: Pick<ComponentsPropsList['MuiAlert'], 'closeText'>;
6
- };
7
- MuiBreadcrumbs?: {
8
- defaultProps: Pick<ComponentsPropsList['MuiBreadcrumbs'], 'expandText'>;
9
- };
10
- MuiTablePagination?: {
11
- defaultProps: Pick<ComponentsPropsList['MuiTablePagination'], 'labelRowsPerPage' | 'labelDisplayedRows' | 'getItemAriaLabel'>;
12
- };
13
- MuiRating?: {
14
- defaultProps: Pick<ComponentsPropsList['MuiRating'], 'emptyLabelText' | 'getLabelText'>;
15
- };
16
- MuiAutocomplete?: {
17
- defaultProps: Pick<ComponentsPropsList['MuiAutocomplete'], 'clearText' | 'closeText' | 'loadingText' | 'noOptionsText' | 'openText'>;
18
- };
19
- MuiPagination?: {
20
- defaultProps: Pick<ComponentsPropsList['MuiPagination'], 'aria-label' | 'getItemAriaLabel'>;
21
- };
22
- };
23
- }
24
- export declare const amET: Localization;
25
- export declare const arEG: Localization;
26
- export declare const arSD: Localization;
27
- export declare const azAZ: Localization;
28
- export declare const bnBD: Localization;
29
- export declare const bgBG: Localization;
30
- export declare const caES: Localization;
31
- export declare const csCZ: Localization;
32
- export declare const deDE: Localization;
33
- export declare const elGR: Localization;
34
- export declare const enUS: Localization;
35
- export declare const esES: Localization;
36
- export declare const etEE: Localization;
37
- export declare const faIR: Localization;
38
- export declare const fiFI: Localization;
39
- export declare const frFR: Localization;
40
- export declare const heIL: Localization;
41
- export declare const hiIN: Localization;
42
- export declare const huHU: Localization;
43
- export declare const hyAM: Localization;
44
- export declare const idID: Localization;
45
- export declare const isIS: Localization;
46
- export declare const itIT: Localization;
47
- export declare const jaJP: Localization;
48
- export declare const khKH: Localization;
49
- export declare const koKR: Localization;
50
- export declare const kzKZ: Localization;
51
- export declare const nlNL: Localization;
52
- export declare const plPL: Localization;
53
- export declare const ptBR: Localization;
54
- export declare const ptPT: Localization;
55
- export declare const roRO: Localization;
56
- export declare const ruRU: Localization;
57
- export declare const siLK: Localization;
58
- export declare const skSK: Localization;
59
- export declare const svSE: Localization;
60
- export declare const thTH: Localization;
61
- export declare const trTR: Localization;
62
- export declare const ukUA: Localization;
63
- export declare const viVN: Localization;
64
- export declare const zhCN: Localization;
65
- export declare const zhHK: Localization;
66
- export declare const zhTW: Localization;
1
+ import { ComponentsPropsList } from '../styles/props';
2
+ export interface Localization {
3
+ components?: {
4
+ MuiAlert?: {
5
+ defaultProps: Pick<ComponentsPropsList['MuiAlert'], 'closeText'>;
6
+ };
7
+ MuiBreadcrumbs?: {
8
+ defaultProps: Pick<ComponentsPropsList['MuiBreadcrumbs'], 'expandText'>;
9
+ };
10
+ MuiTablePagination?: {
11
+ defaultProps: Pick<ComponentsPropsList['MuiTablePagination'], 'labelRowsPerPage' | 'labelDisplayedRows' | 'getItemAriaLabel'>;
12
+ };
13
+ MuiRating?: {
14
+ defaultProps: Pick<ComponentsPropsList['MuiRating'], 'emptyLabelText' | 'getLabelText'>;
15
+ };
16
+ MuiAutocomplete?: {
17
+ defaultProps: Pick<ComponentsPropsList['MuiAutocomplete'], 'clearText' | 'closeText' | 'loadingText' | 'noOptionsText' | 'openText'>;
18
+ };
19
+ MuiPagination?: {
20
+ defaultProps: Pick<ComponentsPropsList['MuiPagination'], 'aria-label' | 'getItemAriaLabel'>;
21
+ };
22
+ };
23
+ }
24
+ export declare const amET: Localization;
25
+ export declare const arEG: Localization;
26
+ export declare const arSD: Localization;
27
+ export declare const azAZ: Localization;
28
+ export declare const bnBD: Localization;
29
+ export declare const bgBG: Localization;
30
+ export declare const caES: Localization;
31
+ export declare const csCZ: Localization;
32
+ export declare const deDE: Localization;
33
+ export declare const elGR: Localization;
34
+ export declare const enUS: Localization;
35
+ export declare const esES: Localization;
36
+ export declare const etEE: Localization;
37
+ export declare const faIR: Localization;
38
+ export declare const fiFI: Localization;
39
+ export declare const frFR: Localization;
40
+ export declare const heIL: Localization;
41
+ export declare const hiIN: Localization;
42
+ export declare const huHU: Localization;
43
+ export declare const hyAM: Localization;
44
+ export declare const idID: Localization;
45
+ export declare const isIS: Localization;
46
+ export declare const itIT: Localization;
47
+ export declare const jaJP: Localization;
48
+ export declare const khKH: Localization;
49
+ export declare const koKR: Localization;
50
+ export declare const kzKZ: Localization;
51
+ export declare const nlNL: Localization;
52
+ export declare const plPL: Localization;
53
+ export declare const ptBR: Localization;
54
+ export declare const ptPT: Localization;
55
+ export declare const roRO: Localization;
56
+ export declare const ruRU: Localization;
57
+ export declare const siLK: Localization;
58
+ export declare const skSK: Localization;
59
+ export declare const svSE: Localization;
60
+ export declare const thTH: Localization;
61
+ export declare const trTR: Localization;
62
+ export declare const ukUA: Localization;
63
+ export declare const viVN: Localization;
64
+ export declare const zhCN: Localization;
65
+ export declare const zhHK: Localization;
66
+ export declare const zhTW: Localization;
File without changes
@@ -404,7 +404,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
404
404
  }
405
405
 
406
406
  if (computeDisplay) {
407
- display = multiple ? displayMultiple.join(', ') : displaySingle;
407
+ if (multiple) {
408
+ display = displayMultiple.reduce((prev, curr) => [prev, ', ', curr]);
409
+ } else {
410
+ display = displaySingle;
411
+ }
408
412
  } // Avoid performing a layout computation in the render method.
409
413
 
410
414
 
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.2.0
1
+ /** @license MUI v5.2.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.
@@ -1,5 +1,5 @@
1
1
  export { default as adaptV4Theme } from './adaptV4Theme';
2
- export { hexToRgb, rgbToHex, hslToRgb, decomposeColor, recomposeColor, getContrastRatio, getLuminance, emphasize, alpha, darken, lighten, css, keyframes } from '@mui/system';
2
+ export { hexToRgb, rgbToHex, hslToRgb, decomposeColor, recomposeColor, getContrastRatio, getLuminance, emphasize, alpha, darken, lighten, css, keyframes, experimental_sx } from '@mui/system';
3
3
  export { default as createTheme, createMuiTheme } from './createTheme';
4
4
  export { default as unstable_createMuiStrictModeTheme } from './createMuiStrictModeTheme';
5
5
  export { default as createStyles } from './createStyles';
@@ -5,8 +5,32 @@ import useEnhancedEffect from '../utils/useEnhancedEffect';
5
5
  * @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
6
6
  */
7
7
 
8
- function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
8
+ export default function useMediaQuery(queryInput, options = {}) {
9
+ const theme = useTheme(); // Wait for jsdom to support the match media feature.
10
+ // All the browsers MUI support have this built-in.
11
+ // This defensive check is here for simplicity.
12
+ // Most of the time, the match media logic isn't central to people tests.
13
+
9
14
  const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
15
+ const {
16
+ defaultMatches = false,
17
+ matchMedia = supportMatchMedia ? window.matchMedia : null,
18
+ noSsr = false,
19
+ ssrMatchMedia = null
20
+ } = getThemeProps({
21
+ name: 'MuiUseMediaQuery',
22
+ props: options,
23
+ theme
24
+ });
25
+
26
+ if (process.env.NODE_ENV !== 'production') {
27
+ if (typeof queryInput === 'function' && theme === null) {
28
+ 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'));
29
+ }
30
+ }
31
+
32
+ let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
33
+ query = query.replace(/^@media( ?)/m, '');
10
34
  const [match, setMatch] = React.useState(() => {
11
35
  if (noSsr && supportMatchMedia) {
12
36
  return matchMedia(query).matches;
@@ -38,76 +62,13 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
38
62
  }
39
63
  };
40
64
 
41
- updateMatch(); // TODO: Use `addEventListener` once support for Safari < 14 is dropped
42
-
65
+ updateMatch();
43
66
  queryList.addListener(updateMatch);
44
67
  return () => {
45
68
  active = false;
46
69
  queryList.removeListener(updateMatch);
47
70
  };
48
71
  }, [query, matchMedia, supportMatchMedia]);
49
- return match;
50
- }
51
-
52
- function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
53
- const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
54
- const getServerSnapshot = React.useMemo(() => {
55
- if (ssrMatchMedia !== null) {
56
- const {
57
- matches
58
- } = ssrMatchMedia(query);
59
- return () => matches;
60
- }
61
-
62
- return getDefaultSnapshot;
63
- }, [getDefaultSnapshot, query, ssrMatchMedia]);
64
- const [getSnapshot, subscribe] = React.useMemo(() => {
65
- if (matchMedia === null) {
66
- return [getDefaultSnapshot, () => () => {}];
67
- }
68
-
69
- const mediaQueryList = matchMedia(query);
70
- return [() => mediaQueryList.matches, notify => {
71
- // TODO: Use `addEventListener` once support for Safari < 14 is dropped
72
- mediaQueryList.addListener(notify);
73
- return () => {
74
- mediaQueryList.removeListener(notify);
75
- };
76
- }];
77
- }, [getDefaultSnapshot, matchMedia, query]);
78
- const match = React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
79
- return match;
80
- }
81
-
82
- export default function useMediaQuery(queryInput, options = {}) {
83
- const theme = useTheme(); // Wait for jsdom to support the match media feature.
84
- // All the browsers MUI support have this built-in.
85
- // This defensive check is here for simplicity.
86
- // Most of the time, the match media logic isn't central to people tests.
87
-
88
- const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
89
- const {
90
- defaultMatches = false,
91
- matchMedia = supportMatchMedia ? window.matchMedia : null,
92
- ssrMatchMedia = null,
93
- noSsr
94
- } = getThemeProps({
95
- name: 'MuiUseMediaQuery',
96
- props: options,
97
- theme
98
- });
99
-
100
- if (process.env.NODE_ENV !== 'production') {
101
- if (typeof queryInput === 'function' && theme === null) {
102
- 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'));
103
- }
104
- }
105
-
106
- let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
107
- query = query.replace(/^@media( ?)/m, ''); // TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
108
-
109
- const useMediaQueryImplementation = React.useSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
110
- const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
111
72
 
112
73
  if (process.env.NODE_ENV !== 'production') {
113
74
  // eslint-disable-next-line react-hooks/rules-of-hooks
File without changes
@@ -433,7 +433,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
433
433
  }
434
434
 
435
435
  if (computeDisplay) {
436
- display = multiple ? displayMultiple.join(', ') : displaySingle;
436
+ if (multiple) {
437
+ display = displayMultiple.reduce((prev, curr) => [prev, ', ', curr]);
438
+ } else {
439
+ display = displaySingle;
440
+ }
437
441
  } // Avoid performing a layout computation in the render method.
438
442
 
439
443
 
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.2.0
1
+ /** @license MUI v5.2.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.
@@ -89,6 +89,12 @@ Object.defineProperty(exports, "experimentalStyled", {
89
89
  return _styled.default;
90
90
  }
91
91
  });
92
+ Object.defineProperty(exports, "experimental_sx", {
93
+ enumerable: true,
94
+ get: function () {
95
+ return _system.experimental_sx;
96
+ }
97
+ });
92
98
  Object.defineProperty(exports, "getContrastRatio", {
93
99
  enumerable: true,
94
100
  get: function () {
@@ -17,8 +17,32 @@ 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 useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
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
+
21
26
  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, '');
22
46
  const [match, setMatch] = React.useState(() => {
23
47
  if (noSsr && supportMatchMedia) {
24
48
  return matchMedia(query).matches;
@@ -50,76 +74,13 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
50
74
  }
51
75
  };
52
76
 
53
- updateMatch(); // TODO: Use `addEventListener` once support for Safari < 14 is dropped
54
-
77
+ updateMatch();
55
78
  queryList.addListener(updateMatch);
56
79
  return () => {
57
80
  active = false;
58
81
  queryList.removeListener(updateMatch);
59
82
  };
60
83
  }, [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);
123
84
 
124
85
  if (process.env.NODE_ENV !== 'production') {
125
86
  // 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.2.0",
3
+ "version": "5.2.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.",
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.16.3",
49
- "@mui/base": "5.0.0-alpha.56",
50
- "@mui/system": "^5.2.0",
49
+ "@mui/base": "5.0.0-alpha.57",
50
+ "@mui/system": "^5.2.1",
51
51
  "@mui/types": "^7.1.0",
52
- "@mui/utils": "^5.2.0",
52
+ "@mui/utils": "^5.2.1",
53
53
  "@types/react-transition-group": "^4.4.4",
54
54
  "clsx": "^1.1.1",
55
55
  "csstype": "^3.0.10",
package/styles/index.d.ts CHANGED
@@ -55,6 +55,7 @@ export {
55
55
  lighten,
56
56
  ColorFormat,
57
57
  ColorObject,
58
+ experimental_sx,
58
59
  } from '@mui/system';
59
60
  export { default as useTheme } from './useTheme';
60
61
  export { default as useThemeProps } from './useThemeProps';
package/styles/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { default as adaptV4Theme } from './adaptV4Theme';
2
- export { hexToRgb, rgbToHex, hslToRgb, decomposeColor, recomposeColor, getContrastRatio, getLuminance, emphasize, alpha, darken, lighten, css, keyframes } from '@mui/system';
2
+ export { hexToRgb, rgbToHex, hslToRgb, decomposeColor, recomposeColor, getContrastRatio, getLuminance, emphasize, alpha, darken, lighten, css, keyframes, experimental_sx } from '@mui/system';
3
3
  export { default as createTheme, createMuiTheme } from './createTheme';
4
4
  export { default as unstable_createMuiStrictModeTheme } from './createMuiStrictModeTheme';
5
5
  export { default as createStyles } from './createStyles';
@@ -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
+ }