@mui/material 5.11.9 → 5.11.11

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 (117) hide show
  1. package/Autocomplete/Autocomplete.d.ts +3 -1
  2. package/Avatar/Avatar.js +1 -0
  3. package/Backdrop/Backdrop.d.ts +8 -0
  4. package/Backdrop/Backdrop.js +10 -5
  5. package/Badge/Badge.d.ts +0 -1
  6. package/Badge/Badge.js +47 -47
  7. package/CHANGELOG.md +135 -1
  8. package/Container/Container.js +0 -1
  9. package/Dialog/DialogContext.d.ts +2 -2
  10. package/Dialog/DialogContext.js +2 -2
  11. package/InputBase/InputBase.js +2 -2
  12. package/InputLabel/InputLabel.js +3 -1
  13. package/ListSubheader/ListSubheader.js +1 -0
  14. package/MenuList/MenuList.js +7 -0
  15. package/Modal/Modal.d.ts +9 -1
  16. package/Modal/Modal.js +14 -9
  17. package/OutlinedInput/OutlinedInput.js +1 -1
  18. package/README.md +0 -2
  19. package/Rating/Rating.js +2 -2
  20. package/Select/SelectInput.js +2 -22
  21. package/Slider/Slider.d.ts +5 -1
  22. package/Slider/Slider.js +16 -11
  23. package/Snackbar/Snackbar.js +21 -125
  24. package/Stack/Stack.d.ts +0 -1
  25. package/Stack/Stack.js +9 -120
  26. package/Stack/index.d.ts +3 -0
  27. package/Stack/index.js +2 -1
  28. package/Stack/stackClasses.d.ts +6 -0
  29. package/Stack/stackClasses.js +7 -0
  30. package/SwipeableDrawer/SwipeableDrawer.js +3 -3
  31. package/Unstable_Grid2/Grid2.js +2 -3
  32. package/index.js +1 -1
  33. package/internal/SwitchBase.js +1 -1
  34. package/legacy/Avatar/Avatar.js +1 -0
  35. package/legacy/Backdrop/Backdrop.js +9 -3
  36. package/legacy/Badge/Badge.js +48 -48
  37. package/legacy/Container/Container.js +0 -1
  38. package/legacy/Dialog/DialogContext.js +2 -2
  39. package/legacy/InputBase/InputBase.js +2 -2
  40. package/legacy/InputLabel/InputLabel.js +3 -1
  41. package/legacy/ListSubheader/ListSubheader.js +1 -0
  42. package/legacy/MenuList/MenuList.js +7 -0
  43. package/legacy/Modal/Modal.js +14 -9
  44. package/legacy/OutlinedInput/OutlinedInput.js +1 -1
  45. package/legacy/Rating/Rating.js +2 -2
  46. package/legacy/Select/SelectInput.js +2 -22
  47. package/legacy/Slider/Slider.js +16 -12
  48. package/legacy/Snackbar/Snackbar.js +20 -119
  49. package/legacy/Stack/Stack.js +13 -122
  50. package/legacy/Stack/index.js +2 -1
  51. package/legacy/Stack/stackClasses.js +7 -0
  52. package/legacy/SwipeableDrawer/SwipeableDrawer.js +3 -3
  53. package/legacy/Unstable_Grid2/Grid2.js +2 -3
  54. package/legacy/index.js +1 -1
  55. package/legacy/internal/SwitchBase.js +1 -1
  56. package/legacy/styles/createTheme.js +1 -0
  57. package/legacy/useAutocomplete/useAutocomplete.js +2 -2
  58. package/legacy/useMediaQuery/useMediaQuery.js +12 -7
  59. package/modern/Avatar/Avatar.js +1 -0
  60. package/modern/Backdrop/Backdrop.js +10 -5
  61. package/modern/Badge/Badge.js +47 -47
  62. package/modern/Container/Container.js +0 -1
  63. package/modern/Dialog/DialogContext.js +2 -2
  64. package/modern/InputBase/InputBase.js +2 -2
  65. package/modern/InputLabel/InputLabel.js +3 -1
  66. package/modern/ListSubheader/ListSubheader.js +1 -0
  67. package/modern/MenuList/MenuList.js +7 -0
  68. package/modern/Modal/Modal.js +14 -9
  69. package/modern/OutlinedInput/OutlinedInput.js +1 -1
  70. package/modern/Rating/Rating.js +2 -2
  71. package/modern/Select/SelectInput.js +2 -18
  72. package/modern/Slider/Slider.js +16 -11
  73. package/modern/Snackbar/Snackbar.js +21 -125
  74. package/modern/Stack/Stack.js +9 -120
  75. package/modern/Stack/index.js +2 -1
  76. package/modern/Stack/stackClasses.js +7 -0
  77. package/modern/SwipeableDrawer/SwipeableDrawer.js +3 -3
  78. package/modern/Unstable_Grid2/Grid2.js +2 -3
  79. package/modern/index.js +1 -1
  80. package/modern/internal/SwitchBase.js +1 -1
  81. package/modern/styles/createTheme.js +1 -0
  82. package/modern/useAutocomplete/useAutocomplete.js +2 -2
  83. package/modern/useMediaQuery/useMediaQuery.js +9 -7
  84. package/node/Avatar/Avatar.js +1 -0
  85. package/node/Backdrop/Backdrop.js +10 -5
  86. package/node/Badge/Badge.js +46 -47
  87. package/node/Container/Container.js +0 -2
  88. package/node/Dialog/DialogContext.js +4 -2
  89. package/node/InputBase/InputBase.js +2 -2
  90. package/node/InputLabel/InputLabel.js +3 -1
  91. package/node/ListSubheader/ListSubheader.js +1 -0
  92. package/node/MenuList/MenuList.js +7 -0
  93. package/node/Modal/Modal.js +14 -9
  94. package/node/OutlinedInput/OutlinedInput.js +1 -1
  95. package/node/Rating/Rating.js +2 -2
  96. package/node/Select/SelectInput.js +2 -22
  97. package/node/Slider/Slider.js +19 -14
  98. package/node/Snackbar/Snackbar.js +20 -124
  99. package/node/Stack/Stack.js +9 -122
  100. package/node/Stack/index.js +8 -1
  101. package/node/Stack/stackClasses.js +16 -0
  102. package/node/SwipeableDrawer/SwipeableDrawer.js +3 -3
  103. package/node/Unstable_Grid2/Grid2.js +0 -1
  104. package/node/index.js +1 -1
  105. package/node/internal/SwitchBase.js +1 -1
  106. package/node/styles/createTheme.js +1 -0
  107. package/node/useAutocomplete/useAutocomplete.js +8 -6
  108. package/node/useMediaQuery/useMediaQuery.js +9 -7
  109. package/package.json +6 -6
  110. package/styles/createTheme.js +1 -0
  111. package/styles/props.d.ts +2 -2
  112. package/umd/material-ui.development.js +4209 -4241
  113. package/umd/material-ui.production.min.js +21 -21
  114. package/useAutocomplete/useAutocomplete.d.ts +2 -2
  115. package/useAutocomplete/useAutocomplete.js +2 -2
  116. package/useMediaQuery/useMediaQuery.d.ts +19 -4
  117. package/useMediaQuery/useMediaQuery.js +9 -7
@@ -46,7 +46,7 @@ const useUtilityClasses = ownerState => {
46
46
  focusVisible
47
47
  } = ownerState;
48
48
  const slots = {
49
- root: ['root', `size${capitalize(size)}`, disabled && 'disabled', focusVisible && 'focusVisible', readOnly && 'readyOnly'],
49
+ root: ['root', `size${capitalize(size)}`, disabled && 'disabled', focusVisible && 'focusVisible', readOnly && 'readOnly'],
50
50
  label: ['label', 'pristine'],
51
51
  labelEmptyValue: [emptyValueFocused && 'labelEmptyValueActive'],
52
52
  icon: ['icon'],
@@ -444,7 +444,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
444
444
  ref: handleRef,
445
445
  onMouseMove: handleMouseMove,
446
446
  onMouseLeave: handleMouseLeave,
447
- className: clsx(classes.root, className),
447
+ className: clsx(classes.root, className, readOnly && 'MuiRating-readOnly'),
448
448
  ownerState: ownerState,
449
449
  role: readOnly ? 'img' : null,
450
450
  "aria-label": readOnly ? getLabelText(value) : null
@@ -329,7 +329,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
329
329
  computeDisplay = true;
330
330
  }
331
331
  }
332
- const items = childrenArray.map((child, index, arr) => {
332
+ const items = childrenArray.map(child => {
333
333
  if (! /*#__PURE__*/React.isValidElement(child)) {
334
334
  return null;
335
335
  }
@@ -356,22 +356,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
356
356
  if (selected) {
357
357
  foundMatch = true;
358
358
  }
359
- if (child.props.value === undefined) {
360
- return /*#__PURE__*/React.cloneElement(child, {
361
- 'aria-readonly': true,
362
- role: 'option'
363
- });
364
- }
365
- const isFirstSelectableElement = () => {
366
- if (value) {
367
- return selected;
368
- }
369
- const firstSelectableElement = arr.find(item => item?.props?.value !== undefined && item.props.disabled !== true);
370
- if (child === firstSelectableElement) {
371
- return true;
372
- }
373
- return selected;
374
- };
375
359
  return /*#__PURE__*/React.cloneElement(child, {
376
360
  'aria-selected': selected ? 'true' : 'false',
377
361
  onClick: handleItemClick(child),
@@ -387,7 +371,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
387
371
  }
388
372
  },
389
373
  role: 'option',
390
- selected: arr[0]?.props?.value === undefined || arr[0]?.props?.disabled === true ? isFirstSelectableElement() : selected,
374
+ selected,
391
375
  value: undefined,
392
376
  // The value is most likely not a valid HTML attribute.
393
377
  'data-value': child.props.value // Instead, we provide it as a data attribute.
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { chainPropTypes } from '@mui/utils';
8
8
  import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
9
- import { useSlider } from '@mui/base/SliderUnstyled';
9
+ import useSlider, { valueToPercent } from '@mui/base/useSlider';
10
10
  import { alpha, lighten, darken } from '@mui/system';
11
11
  import useThemeProps from '../styles/useThemeProps';
12
12
  import styled, { slotShouldForwardProp } from '../styles/styled';
@@ -17,7 +17,6 @@ import SliderValueLabel from './SliderValueLabel';
17
17
  import sliderClasses, { getSliderUtilityClass } from './sliderClasses';
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
- const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
21
20
  function Identity(x) {
22
21
  return x;
23
22
  }
@@ -457,7 +456,6 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
457
456
  componentsProps = {},
458
457
  color = 'primary',
459
458
  classes: classesProp,
460
- // eslint-disable-next-line react/prop-types
461
459
  className,
462
460
  disableSwap = false,
463
461
  disabled = false,
@@ -564,7 +562,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
564
562
  elementType: ThumbSlot,
565
563
  getSlotProps: getThumbProps,
566
564
  externalSlotProps: thumbSlotProps,
567
- ownerState: _extends({}, ownerState, thumbSlotProps?.ownerState)
565
+ ownerState: _extends({}, ownerState, thumbSlotProps?.ownerState),
566
+ className: classes.thumb
568
567
  });
569
568
  const valueLabelProps = useSlotProps({
570
569
  elementType: ValueLabelSlot,
@@ -581,7 +580,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
581
580
  const markLabelProps = useSlotProps({
582
581
  elementType: MarkLabelSlot,
583
582
  externalSlotProps: markLabelSlotProps,
584
- ownerState
583
+ ownerState,
584
+ className: classes.markLabel
585
585
  });
586
586
  const inputSliderProps = useSlotProps({
587
587
  elementType: InputSlot,
@@ -622,8 +622,10 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
622
622
  const percent = valueToPercent(value, min, max);
623
623
  const style = axisProps[axis].offset(percent);
624
624
  const ValueLabelComponent = valueLabelDisplay === 'off' ? Forward : ValueLabelSlot;
625
- return /*#__PURE__*/_jsx(React.Fragment, {
626
- children: /*#__PURE__*/_jsx(ValueLabelComponent, _extends({}, !isHostComponent(ValueLabelComponent) && {
625
+ return (
626
+ /*#__PURE__*/
627
+ /* TODO v6: Change component structure. It will help in avoiding the complicated React.cloneElement API added in SliderValueLabel component. Should be: Thumb -> Input, ValueLabel. Follow Joy UI's Slider structure. */
628
+ _jsx(ValueLabelComponent, _extends({}, !isHostComponent(ValueLabelComponent) && {
627
629
  valueLabelFormat,
628
630
  valueLabelDisplay,
629
631
  value: typeof valueLabelFormat === 'function' ? valueLabelFormat(scale(value), index) : valueLabelFormat,
@@ -632,8 +634,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
632
634
  disabled
633
635
  }, valueLabelProps, {
634
636
  children: /*#__PURE__*/_jsx(ThumbSlot, _extends({
635
- "data-index": index,
636
- "data-focusvisible": focusedThumbIndex === index
637
+ "data-index": index
637
638
  }, thumbProps, {
638
639
  className: clsx(classes.thumb, thumbProps.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible),
639
640
  style: _extends({}, style, {
@@ -648,8 +649,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
648
649
  value: values[index]
649
650
  }, inputSliderProps))
650
651
  }))
651
- }))
652
- }, index);
652
+ }), index)
653
+ );
653
654
  })]
654
655
  }));
655
656
  });
@@ -690,6 +691,10 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
690
691
  * Override or extend the styles applied to the component.
691
692
  */
692
693
  classes: PropTypes.object,
694
+ /**
695
+ * @ignore
696
+ */
697
+ className: PropTypes.string,
693
698
  /**
694
699
  * The color of the component.
695
700
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -4,13 +4,12 @@ const _excluded = ["onEnter", "onExited"],
4
4
  _excluded2 = ["action", "anchorOrigin", "autoHideDuration", "children", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
- import clsx from 'clsx';
8
- import { unstable_composeClasses as composeClasses } from '@mui/base';
7
+ import { unstable_composeClasses as composeClasses, useSlotProps } from '@mui/base';
9
8
  import ClickAwayListener from '@mui/base/ClickAwayListener';
9
+ import useSnackbar from '@mui/base/useSnackbar';
10
10
  import styled from '../styles/styled';
11
11
  import useTheme from '../styles/useTheme';
12
12
  import useThemeProps from '../styles/useThemeProps';
13
- import useEventCallback from '../utils/useEventCallback';
14
13
  import capitalize from '../utils/capitalize';
15
14
  import Grow from '../Grow';
16
15
  import SnackbarContent from '../SnackbarContent';
@@ -100,13 +99,7 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
100
99
  ContentProps,
101
100
  disableWindowBlurListener = false,
102
101
  message,
103
- onBlur,
104
- onClose,
105
- onFocus,
106
- onMouseEnter,
107
- onMouseLeave,
108
102
  open,
109
- resumeHideDuration,
110
103
  TransitionComponent = Grow,
111
104
  transitionDuration = defaultTransitionDuration,
112
105
  TransitionProps: {
@@ -120,76 +113,27 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
120
113
  anchorOrigin: {
121
114
  vertical,
122
115
  horizontal
123
- }
116
+ },
117
+ autoHideDuration,
118
+ disableWindowBlurListener,
119
+ TransitionComponent,
120
+ transitionDuration
124
121
  });
125
122
  const classes = useUtilityClasses(ownerState);
126
- const timerAutoHide = React.useRef();
123
+ const {
124
+ getRootProps,
125
+ onClickAway
126
+ } = useSnackbar(_extends({}, ownerState, {
127
+ ref
128
+ }));
127
129
  const [exited, setExited] = React.useState(true);
128
- const handleClose = useEventCallback((...args) => {
129
- if (onClose) {
130
- onClose(...args);
131
- }
130
+ const rootProps = useSlotProps({
131
+ elementType: SnackbarRoot,
132
+ getSlotProps: getRootProps,
133
+ externalForwardedProps: other,
134
+ ownerState,
135
+ className: [classes.root, className]
132
136
  });
133
- const setAutoHideTimer = useEventCallback(autoHideDurationParam => {
134
- if (!onClose || autoHideDurationParam == null) {
135
- return;
136
- }
137
- clearTimeout(timerAutoHide.current);
138
- timerAutoHide.current = setTimeout(() => {
139
- handleClose(null, 'timeout');
140
- }, autoHideDurationParam);
141
- });
142
- React.useEffect(() => {
143
- if (open) {
144
- setAutoHideTimer(autoHideDuration);
145
- }
146
- return () => {
147
- clearTimeout(timerAutoHide.current);
148
- };
149
- }, [open, autoHideDuration, setAutoHideTimer]);
150
-
151
- // Pause the timer when the user is interacting with the Snackbar
152
- // or when the user hide the window.
153
- const handlePause = () => {
154
- clearTimeout(timerAutoHide.current);
155
- };
156
-
157
- // Restart the timer when the user is no longer interacting with the Snackbar
158
- // or when the window is shown back.
159
- const handleResume = React.useCallback(() => {
160
- if (autoHideDuration != null) {
161
- setAutoHideTimer(resumeHideDuration != null ? resumeHideDuration : autoHideDuration * 0.5);
162
- }
163
- }, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);
164
- const handleFocus = event => {
165
- if (onFocus) {
166
- onFocus(event);
167
- }
168
- handlePause();
169
- };
170
- const handleMouseEnter = event => {
171
- if (onMouseEnter) {
172
- onMouseEnter(event);
173
- }
174
- handlePause();
175
- };
176
- const handleBlur = event => {
177
- if (onBlur) {
178
- onBlur(event);
179
- }
180
- handleResume();
181
- };
182
- const handleMouseLeave = event => {
183
- if (onMouseLeave) {
184
- onMouseLeave(event);
185
- }
186
- handleResume();
187
- };
188
- const handleClickAway = event => {
189
- if (onClose) {
190
- onClose(event, 'clickaway');
191
- }
192
- };
193
137
  const handleExited = node => {
194
138
  setExited(true);
195
139
  if (onExited) {
@@ -202,63 +146,15 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
202
146
  onEnter(node, isAppearing);
203
147
  }
204
148
  };
205
- React.useEffect(() => {
206
- // TODO: window global should be refactored here
207
- if (!disableWindowBlurListener && open) {
208
- window.addEventListener('focus', handleResume);
209
- window.addEventListener('blur', handlePause);
210
- return () => {
211
- window.removeEventListener('focus', handleResume);
212
- window.removeEventListener('blur', handlePause);
213
- };
214
- }
215
- return undefined;
216
- }, [disableWindowBlurListener, handleResume, open]);
217
- React.useEffect(() => {
218
- if (!open) {
219
- return undefined;
220
- }
221
-
222
- /**
223
- * @param {KeyboardEvent} nativeEvent
224
- */
225
- function handleKeyDown(nativeEvent) {
226
- if (!nativeEvent.defaultPrevented) {
227
- // IE11, Edge (prior to using Bink?) use 'Esc'
228
- if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') {
229
- // not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar
230
- if (onClose) {
231
- onClose(nativeEvent, 'escapeKeyDown');
232
- }
233
- }
234
- }
235
- }
236
- document.addEventListener('keydown', handleKeyDown);
237
- return () => {
238
- document.removeEventListener('keydown', handleKeyDown);
239
- };
240
- }, [exited, open, onClose]);
241
149
 
242
150
  // So we only render active snackbars.
243
151
  if (!open && exited) {
244
152
  return null;
245
153
  }
246
154
  return /*#__PURE__*/_jsx(ClickAwayListener, _extends({
247
- onClickAway: handleClickAway
155
+ onClickAway: onClickAway
248
156
  }, ClickAwayListenerProps, {
249
- children: /*#__PURE__*/_jsx(SnackbarRoot, _extends({
250
- className: clsx(classes.root, className),
251
- onBlur: handleBlur,
252
- onFocus: handleFocus,
253
- onMouseEnter: handleMouseEnter,
254
- onMouseLeave: handleMouseLeave,
255
- ownerState: ownerState,
256
- ref: ref
257
- // ClickAwayListener adds an `onClick` prop which results in the alert not being announced.
258
- // See https://github.com/mui/material-ui/issues/29080
259
- ,
260
- role: "presentation"
261
- }, other, {
157
+ children: /*#__PURE__*/_jsx(SnackbarRoot, _extends({}, rootProps, {
262
158
  children: /*#__PURE__*/_jsx(TransitionComponent, _extends({
263
159
  appear: true,
264
160
  in: open,
@@ -1,128 +1,17 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["component", "direction", "spacing", "divider", "children"];
4
- import * as React from 'react';
5
1
  import PropTypes from 'prop-types';
6
- import { createUnarySpacing, getValue, handleBreakpoints, mergeBreakpointsInOrder, unstable_extendSxProp as extendSxProp, unstable_resolveBreakpointValues as resolveBreakpointValues } from '@mui/system';
7
- import { deepmerge } from '@mui/utils';
2
+ import { createStack } from '@mui/system';
8
3
  import styled from '../styles/styled';
9
4
  import useThemeProps from '../styles/useThemeProps';
10
-
11
- /**
12
- * Return an array with the separator React element interspersed between
13
- * each React node of the input children.
14
- *
15
- * > joinChildren([1,2,3], 0)
16
- * [1,0,2,0,3]
17
- */
18
- import { jsx as _jsx } from "react/jsx-runtime";
19
- function joinChildren(children, separator) {
20
- const childrenArray = React.Children.toArray(children).filter(Boolean);
21
- return childrenArray.reduce((output, child, index) => {
22
- output.push(child);
23
- if (index < childrenArray.length - 1) {
24
- output.push( /*#__PURE__*/React.cloneElement(separator, {
25
- key: `separator-${index}`
26
- }));
27
- }
28
- return output;
29
- }, []);
30
- }
31
- const getSideFromDirection = direction => {
32
- return {
33
- row: 'Left',
34
- 'row-reverse': 'Right',
35
- column: 'Top',
36
- 'column-reverse': 'Bottom'
37
- }[direction];
38
- };
39
- export const style = ({
40
- ownerState,
41
- theme
42
- }) => {
43
- let styles = _extends({
44
- display: 'flex',
45
- flexDirection: 'column'
46
- }, handleBreakpoints({
47
- theme
48
- }, resolveBreakpointValues({
49
- values: ownerState.direction,
50
- breakpoints: theme.breakpoints.values
51
- }), propValue => ({
52
- flexDirection: propValue
53
- })));
54
- if (ownerState.spacing) {
55
- const transformer = createUnarySpacing(theme);
56
- const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
57
- if (typeof ownerState.spacing === 'object' && ownerState.spacing[breakpoint] != null || typeof ownerState.direction === 'object' && ownerState.direction[breakpoint] != null) {
58
- acc[breakpoint] = true;
59
- }
60
- return acc;
61
- }, {});
62
- const directionValues = resolveBreakpointValues({
63
- values: ownerState.direction,
64
- base
65
- });
66
- const spacingValues = resolveBreakpointValues({
67
- values: ownerState.spacing,
68
- base
69
- });
70
- if (typeof directionValues === 'object') {
71
- Object.keys(directionValues).forEach((breakpoint, index, breakpoints) => {
72
- const directionValue = directionValues[breakpoint];
73
- if (!directionValue) {
74
- const previousDirectionValue = index > 0 ? directionValues[breakpoints[index - 1]] : 'column';
75
- directionValues[breakpoint] = previousDirectionValue;
76
- }
77
- });
78
- }
79
- const styleFromPropValue = (propValue, breakpoint) => {
80
- return {
81
- '& > :not(style) + :not(style)': {
82
- margin: 0,
83
- [`margin${getSideFromDirection(breakpoint ? directionValues[breakpoint] : ownerState.direction)}`]: getValue(transformer, propValue)
84
- }
85
- };
86
- };
87
- styles = deepmerge(styles, handleBreakpoints({
88
- theme
89
- }, spacingValues, styleFromPropValue));
90
- }
91
- styles = mergeBreakpointsInOrder(theme.breakpoints, styles);
92
- return styles;
93
- };
94
- const StackRoot = styled('div', {
95
- name: 'MuiStack',
96
- slot: 'Root',
97
- overridesResolver: (props, styles) => {
98
- return [styles.root];
99
- }
100
- })(style);
101
- const Stack = /*#__PURE__*/React.forwardRef(function Stack(inProps, ref) {
102
- const themeProps = useThemeProps({
5
+ const Stack = createStack({
6
+ createStyledComponent: styled('div', {
7
+ name: 'MuiStack',
8
+ slot: 'Root',
9
+ overridesResolver: (props, styles) => styles.root
10
+ }),
11
+ useThemeProps: inProps => useThemeProps({
103
12
  props: inProps,
104
13
  name: 'MuiStack'
105
- });
106
- const props = extendSxProp(themeProps);
107
- const {
108
- component = 'div',
109
- direction = 'column',
110
- spacing = 0,
111
- divider,
112
- children
113
- } = props,
114
- other = _objectWithoutPropertiesLoose(props, _excluded);
115
- const ownerState = {
116
- direction,
117
- spacing
118
- };
119
- return /*#__PURE__*/_jsx(StackRoot, _extends({
120
- as: component,
121
- ownerState: ownerState,
122
- ref: ref
123
- }, other, {
124
- children: divider ? joinChildren(children, divider) : children
125
- }));
14
+ })
126
15
  });
127
16
  process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
128
17
  // ----------------------------- Warning --------------------------------
@@ -1 +1,2 @@
1
- export { default } from './Stack';
1
+ export { default } from './Stack';
2
+ export { default as stackClasses } from './stackClasses';
@@ -0,0 +1,7 @@
1
+ import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
+ import generateUtilityClass from '../generateUtilityClass';
3
+ export function getStackUtilityClass(slot) {
4
+ return generateUtilityClass('MuiStack', slot);
5
+ }
6
+ const stackClasses = generateUtilityClasses('MuiStack', ['root']);
7
+ export default stackClasses;
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["BackdropProps"],
4
4
  _excluded2 = ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "allowSwipeInChildren", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"];
5
5
  import * as React from 'react';
6
- import { flushSync } from 'react-dom';
6
+ import * as ReactDOM from 'react-dom';
7
7
  import PropTypes from 'prop-types';
8
8
  import { elementTypeAcceptingRef } from '@mui/utils';
9
9
  import { useThemeProps } from '@mui/system';
@@ -207,7 +207,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
207
207
  }
208
208
  claimedSwipeInstance = null;
209
209
  touchDetected.current = false;
210
- flushSync(() => {
210
+ ReactDOM.flushSync(() => {
211
211
  setMaybeSwiping(false);
212
212
  });
213
213
 
@@ -259,7 +259,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
259
259
  // this is because Safari Mobile will not fire any mouse events (still fires touch though) if the DOM changes during mousemove.
260
260
  // so do this change on first touchmove instead of touchstart
261
261
  if (force || !(disableDiscovery && allowSwipeInChildren)) {
262
- flushSync(() => {
262
+ ReactDOM.flushSync(() => {
263
263
  setMaybeSwiping(true);
264
264
  });
265
265
  }
@@ -1,13 +1,12 @@
1
1
  import PropTypes from 'prop-types';
2
- import { createGrid } from '@mui/system/Unstable_Grid';
2
+ import { createGrid as createGrid2 } from '@mui/system/Unstable_Grid';
3
3
  import { styled, useThemeProps } from '../styles';
4
- const Grid2 = createGrid({
4
+ const Grid2 = createGrid2({
5
5
  createStyledComponent: styled('div', {
6
6
  name: 'MuiGrid2',
7
7
  overridesResolver: (props, styles) => styles.root
8
8
  }),
9
9
  componentName: 'MuiGrid2',
10
- // eslint-disable-next-line material-ui/mui-name-matches-component-name
11
10
  useThemeProps: inProps => useThemeProps({
12
11
  props: inProps,
13
12
  name: 'MuiGrid2'
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.11.9
2
+ * @mui/material v5.11.11
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -146,7 +146,7 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
146
146
  defaultChecked: defaultChecked,
147
147
  className: classes.input,
148
148
  disabled: disabled,
149
- id: hasLabelFor && id,
149
+ id: hasLabelFor ? id : undefined,
150
150
  name: name,
151
151
  onChange: handleInputChange,
152
152
  readOnly: readOnly,
@@ -37,6 +37,7 @@ Please use another name.` : _formatMuiErrorMessage(18));
37
37
  muiTheme = deepmerge(muiTheme, other);
38
38
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
39
39
  if (process.env.NODE_ENV !== 'production') {
40
+ // TODO v6: Refactor to use globalStateClassesMapping from @mui/utils once `readOnly` state class is used in Rating component.
40
41
  const stateClasses = ['active', 'checked', 'completed', 'disabled', 'error', 'expanded', 'focused', 'focusVisible', 'required', 'selected'];
41
42
  const traverse = (node, component) => {
42
43
  let key;
@@ -1,2 +1,2 @@
1
- export { useAutocomplete as default } from '@mui/base/AutocompleteUnstyled';
2
- export * from '@mui/base/AutocompleteUnstyled';
1
+ export { default } from '@mui/base/useAutocomplete';
2
+ export * from '@mui/base/useAutocomplete';
@@ -7,9 +7,8 @@ import useEnhancedEffect from '../utils/useEnhancedEffect';
7
7
  */
8
8
 
9
9
  function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
10
- const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
11
10
  const [match, setMatch] = React.useState(() => {
12
- if (noSsr && supportMatchMedia) {
11
+ if (noSsr && matchMedia) {
13
12
  return matchMedia(query).matches;
14
13
  }
15
14
  if (ssrMatchMedia) {
@@ -22,7 +21,7 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
22
21
  });
23
22
  useEnhancedEffect(() => {
24
23
  let active = true;
25
- if (!supportMatchMedia) {
24
+ if (!matchMedia) {
26
25
  return undefined;
27
26
  }
28
27
  const queryList = matchMedia(query);
@@ -41,15 +40,18 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
41
40
  active = false;
42
41
  queryList.removeListener(updateMatch);
43
42
  };
44
- }, [query, matchMedia, supportMatchMedia]);
43
+ }, [query, matchMedia]);
45
44
  return match;
46
45
  }
47
46
 
48
47
  // eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
49
48
  const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
50
- function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
49
+ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
51
50
  const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
52
51
  const getServerSnapshot = React.useMemo(() => {
52
+ if (noSsr && matchMedia) {
53
+ return () => matchMedia(query).matches;
54
+ }
53
55
  if (ssrMatchMedia !== null) {
54
56
  const {
55
57
  matches
@@ -57,7 +59,7 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
57
59
  return () => matches;
58
60
  }
59
61
  return getDefaultSnapshot;
60
- }, [getDefaultSnapshot, query, ssrMatchMedia]);
62
+ }, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
61
63
  const [getSnapshot, subscribe] = React.useMemo(() => {
62
64
  if (matchMedia === null) {
63
65
  return [getDefaultSnapshot, () => () => {}];
@@ -85,7 +87,7 @@ export default function useMediaQuery(queryInput, options = {}) {
85
87
  defaultMatches = false,
86
88
  matchMedia = supportMatchMedia ? window.matchMedia : null,
87
89
  ssrMatchMedia = null,
88
- noSsr
90
+ noSsr = false
89
91
  } = getThemeProps({
90
92
  name: 'MuiUseMediaQuery',
91
93
  props: options,
@@ -177,6 +177,7 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
177
177
  children = alt[0];
178
178
  } else {
179
179
  children = /*#__PURE__*/(0, _jsxRuntime.jsx)(AvatarFallback, {
180
+ ownerState: ownerState,
180
181
  className: classes.fallback
181
182
  });
182
183
  }