@mui/material 6.1.1 → 6.1.3

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 (129) hide show
  1. package/Autocomplete/Autocomplete.js +1 -5
  2. package/Badge/Badge.d.ts +2 -2
  3. package/Badge/Badge.js +12 -8
  4. package/Button/Button.js +3 -4
  5. package/CHANGELOG.md +136 -0
  6. package/ClickAwayListener/ClickAwayListener.js +2 -2
  7. package/Fade/Fade.js +2 -2
  8. package/Grid2/Grid2.d.ts +16 -11
  9. package/Grid2/Grid2.js +29 -11
  10. package/Grow/Grow.js +2 -2
  11. package/Icon/Icon.js +1 -1
  12. package/InputBase/InputBase.js +1 -1
  13. package/LinearProgress/LinearProgress.js +7 -0
  14. package/MenuList/MenuList.js +2 -1
  15. package/Modal/Modal.js +3 -3
  16. package/Modal/ModalManager.d.ts +1 -1
  17. package/Modal/ModalManager.js +5 -5
  18. package/Modal/useModal.js +9 -5
  19. package/OutlinedInput/OutlinedInput.js +6 -6
  20. package/PigmentGrid/PigmentGrid.d.ts +0 -23
  21. package/PigmentGrid/PigmentGrid.js +0 -23
  22. package/Portal/Portal.js +2 -2
  23. package/Rating/Rating.d.ts +1 -1
  24. package/Rating/Rating.js +7 -2
  25. package/Select/Select.js +2 -2
  26. package/Select/SelectInput.js +1 -1
  27. package/Slide/Slide.js +2 -2
  28. package/SwipeableDrawer/SwipeableDrawer.d.ts +1 -1
  29. package/Tooltip/Tooltip.js +2 -2
  30. package/Unstable_TrapFocus/FocusTrap.js +3 -3
  31. package/Zoom/Zoom.js +2 -2
  32. package/index.js +1 -1
  33. package/modern/Autocomplete/Autocomplete.js +1 -5
  34. package/modern/Badge/Badge.js +12 -8
  35. package/modern/Button/Button.js +3 -4
  36. package/modern/ClickAwayListener/ClickAwayListener.js +2 -2
  37. package/modern/Fade/Fade.js +2 -2
  38. package/modern/Grid2/Grid2.js +29 -11
  39. package/modern/Grow/Grow.js +2 -2
  40. package/modern/Icon/Icon.js +1 -1
  41. package/modern/InputBase/InputBase.js +1 -1
  42. package/modern/LinearProgress/LinearProgress.js +7 -0
  43. package/modern/MenuList/MenuList.js +2 -1
  44. package/modern/Modal/Modal.js +3 -3
  45. package/modern/Modal/ModalManager.js +5 -5
  46. package/modern/Modal/useModal.js +9 -5
  47. package/modern/OutlinedInput/OutlinedInput.js +6 -6
  48. package/modern/PigmentGrid/PigmentGrid.js +0 -23
  49. package/modern/Portal/Portal.js +2 -2
  50. package/modern/Rating/Rating.js +7 -2
  51. package/modern/Select/Select.js +2 -2
  52. package/modern/Select/SelectInput.js +1 -1
  53. package/modern/Slide/Slide.js +2 -2
  54. package/modern/Tooltip/Tooltip.js +2 -2
  55. package/modern/Unstable_TrapFocus/FocusTrap.js +3 -3
  56. package/modern/Zoom/Zoom.js +2 -2
  57. package/modern/index.js +1 -1
  58. package/modern/styles/createGetSelector.js +8 -7
  59. package/modern/styles/createPalette.js +2 -16
  60. package/modern/styles/createThemeNoVars.js +1 -2
  61. package/modern/styles/createThemeWithVars.js +2 -0
  62. package/modern/styles/index.js +1 -1
  63. package/modern/styles/makeStyles.js +1 -3
  64. package/modern/styles/responsiveFontSizes.js +1 -2
  65. package/modern/styles/shouldSkipGeneratingVar.js +1 -1
  66. package/modern/styles/withStyles.js +1 -3
  67. package/modern/styles/withTheme.js +1 -3
  68. package/modern/useAutocomplete/useAutocomplete.js +3 -1
  69. package/modern/utils/memoTheme.js +3 -24
  70. package/modern/version/index.js +2 -2
  71. package/node/Autocomplete/Autocomplete.js +1 -5
  72. package/node/Badge/Badge.js +12 -8
  73. package/node/Button/Button.js +3 -4
  74. package/node/ClickAwayListener/ClickAwayListener.js +2 -2
  75. package/node/Fade/Fade.js +2 -2
  76. package/node/Grid2/Grid2.js +29 -11
  77. package/node/Grow/Grow.js +2 -2
  78. package/node/Icon/Icon.js +1 -1
  79. package/node/InputBase/InputBase.js +1 -1
  80. package/node/LinearProgress/LinearProgress.js +7 -0
  81. package/node/MenuList/MenuList.js +2 -1
  82. package/node/Modal/Modal.js +3 -3
  83. package/node/Modal/ModalManager.js +5 -5
  84. package/node/Modal/useModal.js +9 -5
  85. package/node/OutlinedInput/OutlinedInput.js +6 -6
  86. package/node/PigmentGrid/PigmentGrid.js +0 -23
  87. package/node/Portal/Portal.js +1 -1
  88. package/node/Rating/Rating.js +7 -2
  89. package/node/Select/Select.js +2 -2
  90. package/node/Select/SelectInput.js +1 -1
  91. package/node/Slide/Slide.js +2 -2
  92. package/node/Tooltip/Tooltip.js +2 -2
  93. package/node/Unstable_TrapFocus/FocusTrap.js +2 -2
  94. package/node/Zoom/Zoom.js +2 -2
  95. package/node/index.js +1 -1
  96. package/node/styles/createGetSelector.js +8 -7
  97. package/node/styles/createPalette.js +2 -16
  98. package/node/styles/createThemeNoVars.js +1 -2
  99. package/node/styles/createThemeWithVars.js +2 -0
  100. package/node/styles/index.js +1 -1
  101. package/node/styles/makeStyles.js +1 -3
  102. package/node/styles/responsiveFontSizes.js +1 -2
  103. package/node/styles/shouldSkipGeneratingVar.js +1 -1
  104. package/node/styles/withStyles.js +1 -3
  105. package/node/styles/withTheme.js +1 -3
  106. package/node/useAutocomplete/useAutocomplete.js +3 -1
  107. package/node/utils/memoTheme.js +4 -25
  108. package/node/version/index.js +2 -2
  109. package/package.json +6 -6
  110. package/styles/ThemeProvider.d.ts +6 -0
  111. package/styles/ThemeProviderWithVars.d.ts +2 -1
  112. package/styles/createGetSelector.d.ts +3 -8
  113. package/styles/createGetSelector.js +8 -7
  114. package/styles/createPalette.js +2 -16
  115. package/styles/createTheme.d.ts +1 -1
  116. package/styles/createThemeNoVars.d.ts +1 -0
  117. package/styles/createThemeNoVars.js +1 -2
  118. package/styles/createThemeWithVars.d.ts +8 -0
  119. package/styles/createThemeWithVars.js +2 -0
  120. package/styles/index.js +1 -1
  121. package/styles/makeStyles.js +1 -3
  122. package/styles/responsiveFontSizes.js +1 -2
  123. package/styles/shouldSkipGeneratingVar.js +1 -1
  124. package/styles/withStyles.js +1 -3
  125. package/styles/withTheme.js +1 -3
  126. package/useAutocomplete/useAutocomplete.js +3 -1
  127. package/utils/memoTheme.d.ts +4 -10
  128. package/utils/memoTheme.js +3 -24
  129. package/version/index.js +2 -2
@@ -300,6 +300,13 @@ const LinearProgressBar2 = (0, _zeroStyled.styled)('span', {
300
300
  style: {
301
301
  backgroundColor: 'var(--LinearProgressBar2-barColor, currentColor)'
302
302
  }
303
+ }, {
304
+ props: ({
305
+ ownerState
306
+ }) => ownerState.variant !== 'buffer' && ownerState.color === 'inherit',
307
+ style: {
308
+ backgroundColor: 'currentColor'
309
+ }
303
310
  }, {
304
311
  props: {
305
312
  color: 'inherit'
@@ -15,6 +15,7 @@ var _List = _interopRequireDefault(require("../List"));
15
15
  var _getScrollbarSize = _interopRequireDefault(require("../utils/getScrollbarSize"));
16
16
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
17
17
  var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEffect"));
18
+ var _utils = require("../utils");
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
20
  function nextItem(list, item, disableListWrap) {
20
21
  if (list === item) {
@@ -118,7 +119,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
118
119
  // of the menu.
119
120
  const noExplicitWidth = !listRef.current.style.width;
120
121
  if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
121
- const scrollbarSize = `${(0, _getScrollbarSize.default)((0, _ownerDocument.default)(containerElement))}px`;
122
+ const scrollbarSize = `${(0, _getScrollbarSize.default)((0, _utils.ownerWindow)(containerElement))}px`;
122
123
  listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
123
124
  listRef.current.style.width = `calc(100% + ${scrollbarSize})`;
124
125
  }
@@ -194,12 +194,12 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
194
194
  getSlotProps: otherHandlers => {
195
195
  return getBackdropProps({
196
196
  ...otherHandlers,
197
- onClick: e => {
197
+ onClick: event => {
198
198
  if (onBackdropClick) {
199
- onBackdropClick(e);
199
+ onBackdropClick(event);
200
200
  }
201
201
  if (otherHandlers?.onClick) {
202
- otherHandlers.onClick(e);
202
+ otherHandlers.onClick(event);
203
203
  }
204
204
  }
205
205
  });
@@ -14,8 +14,8 @@ function isOverflowing(container) {
14
14
  }
15
15
  return container.scrollHeight > container.clientHeight;
16
16
  }
17
- function ariaHidden(element, show) {
18
- if (show) {
17
+ function ariaHidden(element, hide) {
18
+ if (hide) {
19
19
  element.setAttribute('aria-hidden', 'true');
20
20
  } else {
21
21
  element.removeAttribute('aria-hidden');
@@ -33,13 +33,13 @@ function isAriaHiddenForbiddenOnElement(element) {
33
33
  const isInputHidden = element.tagName === 'INPUT' && element.getAttribute('type') === 'hidden';
34
34
  return isForbiddenTagName || isInputHidden;
35
35
  }
36
- function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, show) {
36
+ function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, hide) {
37
37
  const blacklist = [mountElement, currentElement, ...elementsToExclude];
38
38
  [].forEach.call(container.children, element => {
39
39
  const isNotExcludedElement = !blacklist.includes(element);
40
40
  const isNotForbiddenElement = !isAriaHiddenForbiddenOnElement(element);
41
41
  if (isNotExcludedElement && isNotForbiddenElement) {
42
- ariaHidden(element, show);
42
+ ariaHidden(element, hide);
43
43
  }
44
44
  });
45
45
  }
@@ -60,7 +60,7 @@ function handleContainer(containerInfo, props) {
60
60
  if (!props.disableScrollLock) {
61
61
  if (isOverflowing(container)) {
62
62
  // Compute the size before applying overflow hidden to avoid any scroll jumps.
63
- const scrollbarSize = (0, _utils.unstable_getScrollbarSize)((0, _utils.unstable_ownerDocument)(container));
63
+ const scrollbarSize = (0, _utils.unstable_getScrollbarSize)((0, _utils.unstable_ownerWindow)(container));
64
64
  restoreStyle.push({
65
65
  value: container.style.paddingRight,
66
66
  property: 'padding-right',
@@ -20,7 +20,7 @@ function getHasTransition(children) {
20
20
 
21
21
  // A modal manager used to track and manage the state of open Modals.
22
22
  // Modals don't open on the server so this won't conflict with concurrent requests.
23
- const defaultManager = new _ModalManager.ModalManager();
23
+ const manager = new _ModalManager.ModalManager();
24
24
  /**
25
25
  *
26
26
  * Demos:
@@ -36,8 +36,6 @@ function useModal(parameters) {
36
36
  container,
37
37
  disableEscapeKeyDown = false,
38
38
  disableScrollLock = false,
39
- // @ts-ignore internal logic - Base UI supports the manager as a prop too
40
- manager = defaultManager,
41
39
  closeAfterTransition = false,
42
40
  onTransitionEnter,
43
41
  onTransitionExited,
@@ -83,7 +81,7 @@ function useModal(parameters) {
83
81
  handleMounted();
84
82
  }
85
83
  });
86
- const isTopModal = React.useCallback(() => manager.isTopModal(getModal()), [manager]);
84
+ const isTopModal = () => manager.isTopModal(getModal());
87
85
  const handlePortalRef = (0, _utils.unstable_useEventCallback)(node => {
88
86
  mountNodeRef.current = node;
89
87
  if (!node) {
@@ -97,7 +95,7 @@ function useModal(parameters) {
97
95
  });
98
96
  const handleClose = React.useCallback(() => {
99
97
  manager.remove(getModal(), ariaHiddenProp);
100
- }, [ariaHiddenProp, manager]);
98
+ }, [ariaHiddenProp]);
101
99
  React.useEffect(() => {
102
100
  return () => {
103
101
  handleClose();
@@ -152,6 +150,12 @@ function useModal(parameters) {
152
150
  ...otherHandlers
153
151
  };
154
152
  return {
153
+ /*
154
+ * Marking an element with the role presentation indicates to assistive technology
155
+ * that this element should be ignored; it exists to support the web application and
156
+ * is not meant for humans to interact with directly.
157
+ * https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
158
+ */
155
159
  role: 'presentation',
156
160
  ...externalEventHandlers,
157
161
  onKeyDown: createHandleKeyDown(externalEventHandlers),
@@ -53,6 +53,12 @@ const OutlinedInputRoot = (0, _zeroStyled.styled)(_InputBase.InputBaseRoot, {
53
53
  [`&:hover .${_outlinedInputClasses.default.notchedOutline}`]: {
54
54
  borderColor: (theme.vars || theme).palette.text.primary
55
55
  },
56
+ // Reset on touch devices, it doesn't add specificity
57
+ '@media (hover: none)': {
58
+ [`&:hover .${_outlinedInputClasses.default.notchedOutline}`]: {
59
+ borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
60
+ }
61
+ },
56
62
  [`&.${_outlinedInputClasses.default.focused} .${_outlinedInputClasses.default.notchedOutline}`]: {
57
63
  borderWidth: 2
58
64
  },
@@ -69,12 +75,6 @@ const OutlinedInputRoot = (0, _zeroStyled.styled)(_InputBase.InputBaseRoot, {
69
75
  props: {},
70
76
  // to overide the above style
71
77
  style: {
72
- // Reset on touch devices, it doesn't add specificity
73
- '@media (hover: none)': {
74
- [`&:hover .${_outlinedInputClasses.default.notchedOutline}`]: {
75
- borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
76
- }
77
- },
78
78
  [`&.${_outlinedInputClasses.default.error} .${_outlinedInputClasses.default.notchedOutline}`]: {
79
79
  borderColor: (theme.vars || theme).palette.error.main
80
80
  },
@@ -122,29 +122,6 @@ process.env.NODE_ENV !== "production" ? PigmentGrid.propTypes /* remove-proptype
122
122
  * @ignore
123
123
  */
124
124
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
125
- /**
126
- * @internal
127
- * The level of the grid starts from `0`
128
- * and increases when the grid nests inside another grid regardless of container or item.
129
- *
130
- * ```js
131
- * <Grid> // level 0
132
- * <Grid> // level 1
133
- * <Grid> // level 2
134
- * <Grid> // level 1
135
- * ```
136
- *
137
- * Only consecutive grid is considered nesting.
138
- * A grid container will start at `0` if there are non-Grid element above it.
139
- *
140
- * ```js
141
- * <Grid> // level 0
142
- * <div>
143
- * <Grid> // level 0
144
- * <Grid> // level 1
145
- * ```
146
- */
147
- unstable_level: _propTypes.default.number,
148
125
  /**
149
126
  * Defines the `flex-wrap` style property.
150
127
  * It's applied for all screen sizes.
@@ -35,7 +35,7 @@ const Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef
35
35
  disablePortal = false
36
36
  } = props;
37
37
  const [mountNode, setMountNode] = React.useState(null);
38
- const handleRef = (0, _utils.unstable_useForkRef)((0, _utils.unstable_getReactNodeRef)(children), forwardedRef);
38
+ const handleRef = (0, _utils.unstable_useForkRef)(/*#__PURE__*/React.isValidElement(children) ? (0, _utils.unstable_getReactElementRef)(children) : null, forwardedRef);
39
39
  (0, _utils.unstable_useEnhancedEffect)(() => {
40
40
  if (!disablePortal) {
41
41
  setMountNode(getContainer(container) || document.body);
@@ -233,7 +233,12 @@ function RatingItem(props) {
233
233
  const isHovered = itemValue <= hover;
234
234
  const isFocused = itemValue <= focus;
235
235
  const isChecked = itemValue === ratingValueRounded;
236
- const id = (0, _utils.unstable_useId)();
236
+
237
+ // "name" ensures unique IDs across different Rating components in React 17,
238
+ // preventing one component from affecting another. React 18's useId already handles this.
239
+ // Update to const id = useId(); when React 17 support is dropped.
240
+ // More details: https://github.com/mui/material-ui/issues/40997
241
+ const id = `${name}-${(0, _utils.unstable_useId)()}`;
237
242
  const container = /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingIcon, {
238
243
  as: IconContainerComponent,
239
244
  value: itemValue,
@@ -626,7 +631,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
626
631
  /**
627
632
  * The name attribute of the radio `input` elements.
628
633
  * This input `name` should be unique within the page.
629
- * Being unique within a form is insufficient since the `name` is used to generated IDs.
634
+ * Being unique within a form is insufficient since the `name` is used to generate IDs.
630
635
  */
631
636
  name: _propTypes.default.string,
632
637
  /**
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
14
- var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
14
+ var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
15
15
  var _SelectInput = _interopRequireDefault(require("./SelectInput"));
16
16
  var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
17
17
  var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
@@ -99,7 +99,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
99
99
  ownerState: ownerState
100
100
  })
101
101
  }[variant];
102
- const inputComponentRef = (0, _useForkRef.default)(ref, (0, _getReactNodeRef.default)(InputComponent));
102
+ const inputComponentRef = (0, _useForkRef.default)(ref, (0, _getReactElementRef.default)(InputComponent));
103
103
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
104
104
  children: /*#__PURE__*/React.cloneElement(InputComponent, {
105
105
  // Most of the logic is implemented in `SelectInput`.
@@ -354,7 +354,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
354
354
  let selected;
355
355
  if (multiple) {
356
356
  if (!Array.isArray(value)) {
357
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`value\` prop must be an array when using the \`Select\` component with \`multiple\`.` : (0, _formatMuiErrorMessage2.default)(2));
357
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `value` prop must be an array ' + 'when using the `Select` component with `multiple`.' : (0, _formatMuiErrorMessage2.default)(2));
358
358
  }
359
359
  selected = value.some(v => areEqualValues(v, child.props.value));
360
360
  if (selected && computeDisplay) {
@@ -14,7 +14,7 @@ var _reactTransitionGroup = require("react-transition-group");
14
14
  var _chainPropTypes = _interopRequireDefault(require("@mui/utils/chainPropTypes"));
15
15
  var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
16
16
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
17
- var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
17
+ var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
18
18
  var _debounce = _interopRequireDefault(require("../utils/debounce"));
19
19
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
20
20
  var _zeroStyled = require("../zero-styled");
@@ -113,7 +113,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
113
113
  ...other
114
114
  } = props;
115
115
  const childrenRef = React.useRef(null);
116
- const handleRef = (0, _useForkRef.default)((0, _getReactNodeRef.default)(children), childrenRef, ref);
116
+ const handleRef = (0, _useForkRef.default)((0, _getReactElementRef.default)(children), childrenRef, ref);
117
117
  const normalizedTransitionCallback = callback => isAppearing => {
118
118
  if (callback) {
119
119
  // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
@@ -18,7 +18,7 @@ var _colorManipulator = require("@mui/system/colorManipulator");
18
18
  var _RtlProvider = require("@mui/system/RtlProvider");
19
19
  var _isFocusVisible = _interopRequireDefault(require("@mui/utils/isFocusVisible"));
20
20
  var _appendOwnerState = _interopRequireDefault(require("@mui/utils/appendOwnerState"));
21
- var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
21
+ var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
22
22
  var _zeroStyled = require("../zero-styled");
23
23
  var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
24
24
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
@@ -522,7 +522,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
522
522
  document.removeEventListener('keydown', handleKeyDown);
523
523
  };
524
524
  }, [handleClose, open]);
525
- const handleRef = (0, _useForkRef.default)((0, _getReactNodeRef.default)(children), setChildNode, ref);
525
+ const handleRef = (0, _useForkRef.default)((0, _getReactElementRef.default)(children), setChildNode, ref);
526
526
 
527
527
  // There is no point in displaying an empty tooltip.
528
528
  // So we exclude all falsy values, except 0, which is valid.
@@ -21,7 +21,7 @@ function getTabIndex(node) {
21
21
  }
22
22
 
23
23
  // Browsers do not return `tabIndex` correctly for contentEditable nodes;
24
- // https://bugs.chromium.org/p/chromium/issues/detail?id=661108&q=contenteditable%20tabindex&can=2
24
+ // https://issues.chromium.org/issues/41283952
25
25
  // so if they don't have a tabindex attribute specifically set, assume it's 0.
26
26
  // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
27
27
  // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
@@ -99,7 +99,7 @@ function FocusTrap(props) {
99
99
  // It waits for the active element to move into the component to activate.
100
100
  const activated = React.useRef(false);
101
101
  const rootRef = React.useRef(null);
102
- const handleRef = (0, _utils.unstable_useForkRef)((0, _utils.unstable_getReactNodeRef)(children), rootRef);
102
+ const handleRef = (0, _utils.unstable_useForkRef)((0, _utils.unstable_getReactElementRef)(children), rootRef);
103
103
  const lastKeydown = React.useRef(null);
104
104
  React.useEffect(() => {
105
105
  // We might render an empty child.
package/node/Zoom/Zoom.js CHANGED
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _reactTransitionGroup = require("react-transition-group");
13
13
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
14
- var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
14
+ var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
15
15
  var _zeroStyled = require("../zero-styled");
16
16
  var _utils = require("../transitions/utils");
17
17
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
@@ -55,7 +55,7 @@ const Zoom = /*#__PURE__*/React.forwardRef(function Zoom(props, ref) {
55
55
  ...other
56
56
  } = props;
57
57
  const nodeRef = React.useRef(null);
58
- const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactNodeRef.default)(children), ref);
58
+ const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactElementRef.default)(children), ref);
59
59
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
60
60
  if (callback) {
61
61
  const node = nodeRef.current;
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.1.1
2
+ * @mui/material v6.1.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _excludeVariablesFromRoot = _interopRequireDefault(require("./excludeVariablesFromRoot"));
9
9
  var _default = theme => (colorScheme, css) => {
10
+ const root = theme.rootSelector || ':root';
10
11
  const selector = theme.colorSchemeSelector;
11
12
  let rule = selector;
12
13
  if (selector === 'class') {
@@ -28,33 +29,33 @@ var _default = theme => (colorScheme, css) => {
28
29
  });
29
30
  if (rule === 'media') {
30
31
  return {
31
- ':root': css,
32
+ [root]: css,
32
33
  [`@media (prefers-color-scheme: dark)`]: {
33
- ':root': excludedVariables
34
+ [root]: excludedVariables
34
35
  }
35
36
  };
36
37
  }
37
38
  if (rule) {
38
39
  return {
39
40
  [rule.replace('%s', colorScheme)]: excludedVariables,
40
- [`:root, ${rule.replace('%s', colorScheme)}`]: css
41
+ [`${root}, ${rule.replace('%s', colorScheme)}`]: css
41
42
  };
42
43
  }
43
44
  return {
44
- ':root': {
45
+ [root]: {
45
46
  ...css,
46
47
  ...excludedVariables
47
48
  }
48
49
  };
49
50
  }
50
51
  if (rule && rule !== 'media') {
51
- return `:root, ${rule.replace('%s', String(colorScheme))}`;
52
+ return `${root}, ${rule.replace('%s', String(colorScheme))}`;
52
53
  }
53
54
  } else if (colorScheme) {
54
55
  if (rule === 'media') {
55
56
  return {
56
57
  [`@media (prefers-color-scheme: ${String(colorScheme)})`]: {
57
- ':root': css
58
+ [root]: css
58
59
  }
59
60
  };
60
61
  }
@@ -62,6 +63,6 @@ var _default = theme => (colorScheme, css) => {
62
63
  return rule.replace('%s', String(colorScheme));
63
64
  }
64
65
  }
65
- return ':root';
66
+ return root;
66
67
  };
67
68
  exports.default = _default;
@@ -221,24 +221,10 @@ function createPalette(palette) {
221
221
  color.main = color[mainShade];
222
222
  }
223
223
  if (!color.hasOwnProperty('main')) {
224
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
225
- The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : (0, _formatMuiErrorMessage2.default)(11, name ? ` (${name})` : '', mainShade));
224
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : (0, _formatMuiErrorMessage2.default)(11, name ? ` (${name})` : '', mainShade));
226
225
  }
227
226
  if (typeof color.main !== 'string') {
228
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
229
- \`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.
230
-
231
- Did you intend to use one of the following approaches?
232
-
233
- import { green } from "@mui/material/colors";
234
-
235
- const theme1 = createTheme({ palette: {
236
- primary: green,
237
- } });
238
-
239
- const theme2 = createTheme({ palette: {
240
- primary: { main: green[500] },
241
- } });` : (0, _formatMuiErrorMessage2.default)(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
227
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : (0, _formatMuiErrorMessage2.default)(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
242
228
  }
243
229
  addLightOrDark(color, 'light', lightShade, tonalOffset);
244
230
  addLightOrDark(color, 'dark', darkShade, tonalOffset);
@@ -30,8 +30,7 @@ function createThemeNoVars(options = {}, ...args) {
30
30
  ...other
31
31
  } = options;
32
32
  if (options.vars) {
33
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`vars\` is a private field used for CSS variables support.
34
- Please use another name.` : (0, _formatMuiErrorMessage2.default)(20));
33
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' + 'Please use another name.' : (0, _formatMuiErrorMessage2.default)(20));
35
34
  }
36
35
  const palette = (0, _createPalette.default)(paletteInput);
37
36
  const systemTheme = (0, _createTheme.default)(options);
@@ -119,6 +119,7 @@ function createThemeWithVars(options = {}, ...args) {
119
119
  cssVarPrefix = 'mui',
120
120
  shouldSkipGeneratingVar = _shouldSkipGeneratingVar.default,
121
121
  colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? 'media' : undefined,
122
+ rootSelector = ':root',
122
123
  ...input
123
124
  } = options;
124
125
  const firstColorScheme = Object.keys(colorSchemesInput)[0];
@@ -156,6 +157,7 @@ function createThemeWithVars(options = {}, ...args) {
156
157
  ...muiTheme,
157
158
  cssVarPrefix,
158
159
  colorSchemeSelector: selector,
160
+ rootSelector,
159
161
  getCssVar,
160
162
  colorSchemes,
161
163
  font: {
@@ -351,7 +351,7 @@ var _excludeVariablesFromRoot = _interopRequireDefault(require("./excludeVariabl
351
351
  // TODO: Remove this function in v6.
352
352
  // eslint-disable-next-line @typescript-eslint/naming-convention
353
353
  function experimental_sx() {
354
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`experimental_sx\` has been moved to \`theme.unstable_sx\`.For more details, see https://github.com/mui/material-ui/pull/35150.` : (0, _formatMuiErrorMessage2.default)(19));
354
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : (0, _formatMuiErrorMessage2.default)(19));
355
355
  }
356
356
 
357
357
  // The legacy utilities from @mui/styles
@@ -7,7 +7,5 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = makeStyles;
8
8
  var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
9
9
  function makeStyles() {
10
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: makeStyles is no longer exported from @mui/material/styles.
11
- You have to import it from @mui/styles.
12
- See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : (0, _formatMuiErrorMessage2.default)(14));
10
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0, _formatMuiErrorMessage2.default)(14));
13
11
  }
@@ -41,8 +41,7 @@ function responsiveFontSizes(themeInput, options = {}) {
41
41
  lineHeight
42
42
  } = style;
43
43
  if (!(0, _cssUtils.isUnitless)(lineHeight) && !disableAlign) {
44
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported non-unitless line height with grid alignment.
45
- Use unitless line heights instead.` : (0, _formatMuiErrorMessage2.default)(6));
44
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : (0, _formatMuiErrorMessage2.default)(6));
46
45
  }
47
46
  if (!(0, _cssUtils.isUnitless)(lineHeight)) {
48
47
  // make it unitless
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = shouldSkipGeneratingVar;
7
7
  function shouldSkipGeneratingVar(keys) {
8
- return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
8
+ return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
9
9
  // ends with sxConfig
10
10
  keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
11
11
  }
@@ -7,7 +7,5 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = withStyles;
8
8
  var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
9
9
  function withStyles() {
10
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withStyles is no longer exported from @mui/material/styles.
11
- You have to import it from @mui/styles.
12
- See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : (0, _formatMuiErrorMessage2.default)(15));
10
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0, _formatMuiErrorMessage2.default)(15));
13
11
  }
@@ -7,7 +7,5 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = withTheme;
8
8
  var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
9
9
  function withTheme() {
10
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withTheme is no longer exported from @mui/material/styles.
11
- You have to import it from @mui/styles.
12
- See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : (0, _formatMuiErrorMessage2.default)(16));
10
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0, _formatMuiErrorMessage2.default)(16));
13
11
  }
@@ -844,6 +844,7 @@ function useAutocomplete(props) {
844
844
  const handleInputMouseDown = event => {
845
845
  if (!disabledProp && (inputValue === '' || !open)) {
846
846
  handlePopupIndicator(event);
847
+ event.stopPropagation();
847
848
  }
848
849
  };
849
850
  let dirty = freeSolo && inputValue.length > 0;
@@ -920,7 +921,8 @@ function useAutocomplete(props) {
920
921
  getPopupIndicatorProps: () => ({
921
922
  tabIndex: -1,
922
923
  type: 'button',
923
- onClick: handlePopupIndicator
924
+ onClick: handlePopupIndicator,
925
+ onMouseDown: event => event.stopPropagation()
924
926
  }),
925
927
  getTagProps: ({
926
928
  index
@@ -3,28 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = memoTheme;
7
- // We need to pass an argument as `{ theme }` for PigmentCSS, but we don't want to
8
- // allocate more objects.
9
- const arg = {
10
- theme: undefined
11
- };
12
-
13
- /**
14
- * Memoize style function on theme.
15
- * Intended to be used in styled() calls that only need access to the theme.
16
- */
17
- function memoTheme(styleFn) {
18
- let lastValue;
19
- let lastTheme;
20
- return props => {
21
- let value = lastValue;
22
- if (value === undefined || props.theme !== lastTheme) {
23
- arg.theme = props.theme;
24
- value = styleFn(arg);
25
- lastValue = value;
26
- lastTheme = props.theme;
27
- }
28
- return value;
29
- };
30
- }
6
+ exports.default = void 0;
7
+ var _system = require("@mui/system");
8
+ const memoTheme = _system.unstable_memoTheme;
9
+ var _default = exports.default = memoTheme;
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
7
- const version = exports.version = "6.1.1";
7
+ const version = exports.version = "6.1.3";
8
8
  const major = exports.major = Number("6");
9
9
  const minor = exports.minor = Number("1");
10
- const patch = exports.patch = Number("1");
10
+ const patch = exports.patch = Number("3");
11
11
  const prerelease = exports.prerelease = undefined;
12
12
  var _default = exports.default = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "6.1.1",
3
+ "version": "6.1.3",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
@@ -35,10 +35,10 @@
35
35
  "prop-types": "^15.8.1",
36
36
  "react-is": "^18.3.1",
37
37
  "react-transition-group": "^4.4.5",
38
- "@mui/core-downloads-tracker": "^6.1.1",
39
- "@mui/utils": "^6.1.1",
40
- "@mui/system": "^6.1.1",
41
- "@mui/types": "^7.2.17"
38
+ "@mui/core-downloads-tracker": "^6.1.3",
39
+ "@mui/system": "^6.1.3",
40
+ "@mui/types": "^7.2.18",
41
+ "@mui/utils": "^6.1.3"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.5.0",
@@ -46,7 +46,7 @@
46
46
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
47
47
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
48
48
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
49
- "@mui/material-pigment-css": "^6.1.1"
49
+ "@mui/material-pigment-css": "^6.1.3"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@types/react": {
@@ -29,6 +29,12 @@ export interface ThemeProviderProps<Theme = DefaultTheme> extends ThemeProviderC
29
29
  * @default document
30
30
  */
31
31
  documentNode?: Document | null;
32
+ /**
33
+ * The default mode when the local storage has no mode yet,
34
+ * requires the theme to have `colorSchemes` with light and dark.
35
+ * @default 'system'
36
+ */
37
+ defaultMode?: 'light' | 'dark' | 'system';
32
38
  /**
33
39
  * The window that attaches the 'storage' event listener
34
40
  * @default window