@mui/material 7.2.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/Accordion/Accordion.d.ts +11 -0
  2. package/Accordion/Accordion.js +19 -5
  3. package/Alert/Alert.js +2 -3
  4. package/Autocomplete/Autocomplete.js +4 -4
  5. package/Button/Button.js +5 -6
  6. package/ButtonGroup/ButtonGroup.js +3 -4
  7. package/CHANGELOG.md +76 -0
  8. package/Checkbox/Checkbox.js +2 -3
  9. package/Chip/Chip.js +10 -11
  10. package/Divider/Divider.js +1 -2
  11. package/FilledInput/FilledInput.js +1 -1
  12. package/IconButton/IconButton.js +2 -3
  13. package/Input/Input.js +1 -1
  14. package/LinearProgress/LinearProgress.js +1 -2
  15. package/Link/Link.js +11 -4
  16. package/Link/getTextDecoration.js +5 -0
  17. package/ListItemButton/ListItemButton.js +4 -5
  18. package/MenuItem/MenuItem.js +4 -5
  19. package/OutlinedInput/OutlinedInput.js +2 -2
  20. package/PaginationItem/PaginationItem.js +7 -8
  21. package/Radio/Radio.js +2 -3
  22. package/Select/SelectInput.js +66 -21
  23. package/Skeleton/Skeleton.js +1 -1
  24. package/Slider/Slider.js +6 -15
  25. package/Snackbar/Snackbar.js +2 -8
  26. package/SpeedDial/SpeedDial.js +20 -6
  27. package/Switch/Switch.js +6 -4
  28. package/TableCell/TableCell.js +1 -2
  29. package/TableRow/TableRow.js +2 -3
  30. package/ToggleButton/ToggleButton.js +7 -8
  31. package/Tooltip/Tooltip.js +2 -3
  32. package/esm/Accordion/Accordion.d.ts +11 -0
  33. package/esm/Accordion/Accordion.js +19 -5
  34. package/esm/Alert/Alert.js +2 -3
  35. package/esm/Autocomplete/Autocomplete.js +4 -4
  36. package/esm/Button/Button.js +5 -6
  37. package/esm/ButtonGroup/ButtonGroup.js +3 -4
  38. package/esm/Checkbox/Checkbox.js +2 -3
  39. package/esm/Chip/Chip.js +10 -11
  40. package/esm/Divider/Divider.js +1 -2
  41. package/esm/FilledInput/FilledInput.js +1 -1
  42. package/esm/IconButton/IconButton.js +2 -3
  43. package/esm/Input/Input.js +1 -1
  44. package/esm/LinearProgress/LinearProgress.js +1 -2
  45. package/esm/Link/Link.js +11 -4
  46. package/esm/Link/getTextDecoration.js +5 -0
  47. package/esm/ListItemButton/ListItemButton.js +4 -5
  48. package/esm/MenuItem/MenuItem.js +4 -5
  49. package/esm/OutlinedInput/OutlinedInput.js +2 -2
  50. package/esm/PaginationItem/PaginationItem.js +7 -8
  51. package/esm/Radio/Radio.js +2 -3
  52. package/esm/Select/SelectInput.js +66 -21
  53. package/esm/Skeleton/Skeleton.js +2 -2
  54. package/esm/Slider/Slider.js +6 -15
  55. package/esm/Snackbar/Snackbar.js +2 -8
  56. package/esm/SpeedDial/SpeedDial.js +20 -6
  57. package/esm/Switch/Switch.js +6 -4
  58. package/esm/TableCell/TableCell.js +1 -2
  59. package/esm/TableRow/TableRow.js +2 -3
  60. package/esm/ToggleButton/ToggleButton.js +7 -8
  61. package/esm/Tooltip/Tooltip.js +2 -3
  62. package/esm/index.js +1 -1
  63. package/esm/styles/createColorScheme.d.ts +3 -1
  64. package/esm/styles/createColorScheme.js +6 -1
  65. package/esm/styles/createPalette.js +29 -2
  66. package/esm/styles/createTheme.d.ts +1 -1
  67. package/esm/styles/createThemeNoVars.d.ts +3 -0
  68. package/esm/styles/createThemeNoVars.js +59 -1
  69. package/esm/styles/createThemeWithVars.d.ts +4 -0
  70. package/esm/styles/createThemeWithVars.js +98 -69
  71. package/esm/useAutocomplete/useAutocomplete.d.ts +1 -0
  72. package/esm/useAutocomplete/useAutocomplete.js +21 -3
  73. package/esm/version/index.js +2 -2
  74. package/index.js +1 -1
  75. package/package.json +9 -11
  76. package/styles/createColorScheme.d.ts +3 -1
  77. package/styles/createColorScheme.js +6 -1
  78. package/styles/createPalette.js +30 -2
  79. package/styles/createTheme.d.ts +1 -1
  80. package/styles/createThemeNoVars.d.ts +3 -0
  81. package/styles/createThemeNoVars.js +59 -1
  82. package/styles/createThemeWithVars.d.ts +4 -0
  83. package/styles/createThemeWithVars.js +98 -69
  84. package/useAutocomplete/useAutocomplete.d.ts +1 -0
  85. package/useAutocomplete/useAutocomplete.js +22 -3
  86. package/version/index.js +2 -2
@@ -57,7 +57,7 @@ const OutlinedInputRoot = (0, _zeroStyled.styled)(_InputBase.InputBaseRoot, {
57
57
  // Reset on touch devices, it doesn't add specificity
58
58
  '@media (hover: none)': {
59
59
  [`&:hover .${_outlinedInputClasses.default.notchedOutline}`]: {
60
- borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
60
+ borderColor: theme.vars ? theme.alpha(theme.vars.palette.common.onBackground, 0.23) : borderColor
61
61
  }
62
62
  },
63
63
  [`&.${_outlinedInputClasses.default.focused} .${_outlinedInputClasses.default.notchedOutline}`]: {
@@ -123,7 +123,7 @@ const NotchedOutlineRoot = (0, _zeroStyled.styled)(_NotchedOutline.default, {
123
123
  }) => {
124
124
  const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
125
125
  return {
126
- borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
126
+ borderColor: theme.vars ? theme.alpha(theme.vars.palette.common.onBackground, 0.23) : borderColor
127
127
  };
128
128
  }));
129
129
  const OutlinedInputInput = (0, _zeroStyled.styled)(_InputBase.InputBaseInput, {
@@ -11,7 +11,6 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
14
- var _colorManipulator = require("@mui/system/colorManipulator");
15
14
  var _RtlProvider = require("@mui/system/RtlProvider");
16
15
  var _paginationItemClasses = _interopRequireWildcard(require("./paginationItemClasses"));
17
16
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
@@ -133,14 +132,14 @@ const PaginationItemPage = (0, _zeroStyled.styled)(_ButtonBase.default, {
133
132
  [`&.${_paginationItemClasses.default.selected}`]: {
134
133
  backgroundColor: (theme.vars || theme).palette.action.selected,
135
134
  '&:hover': {
136
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.selectedChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : (0, _colorManipulator.alpha)(theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),
135
+ backgroundColor: theme.alpha((theme.vars || theme).palette.action.selected, `${(theme.vars || theme).palette.action.selectedOpacity} + ${(theme.vars || theme).palette.action.hoverOpacity}`),
137
136
  // Reset on touch devices, it doesn't add specificity
138
137
  '@media (hover: none)': {
139
138
  backgroundColor: (theme.vars || theme).palette.action.selected
140
139
  }
141
140
  },
142
141
  [`&.${_paginationItemClasses.default.focusVisible}`]: {
143
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.selectedChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : (0, _colorManipulator.alpha)(theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity)
142
+ backgroundColor: theme.alpha((theme.vars || theme).palette.action.selected, `${(theme.vars || theme).palette.action.selectedOpacity} + ${(theme.vars || theme).palette.action.focusOpacity}`)
144
143
  },
145
144
  [`&.${_paginationItemClasses.default.disabled}`]: {
146
145
  opacity: 1,
@@ -182,7 +181,7 @@ const PaginationItemPage = (0, _zeroStyled.styled)(_ButtonBase.default, {
182
181
  variant: 'outlined'
183
182
  },
184
183
  style: {
185
- border: theme.vars ? `1px solid rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : `1px solid ${theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'}`,
184
+ border: theme.vars ? `1px solid ${theme.alpha(theme.vars.palette.common.onBackground, 0.23)}` : `1px solid ${theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'}`,
186
185
  [`&.${_paginationItemClasses.default.selected}`]: {
187
186
  [`&.${_paginationItemClasses.default.disabled}`]: {
188
187
  borderColor: (theme.vars || theme).palette.action.disabledBackground,
@@ -233,17 +232,17 @@ const PaginationItemPage = (0, _zeroStyled.styled)(_ButtonBase.default, {
233
232
  style: {
234
233
  [`&.${_paginationItemClasses.default.selected}`]: {
235
234
  color: (theme.vars || theme).palette[color].main,
236
- border: `1px solid ${theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / 0.5)` : (0, _colorManipulator.alpha)(theme.palette[color].main, 0.5)}`,
237
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.activatedOpacity})` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.activatedOpacity),
235
+ border: `1px solid ${theme.alpha((theme.vars || theme).palette[color].main, 0.5)}`,
236
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.activatedOpacity),
238
237
  '&:hover': {
239
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / calc(${theme.vars.palette.action.activatedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.activatedOpacity + theme.palette.action.focusOpacity),
238
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, `${(theme.vars || theme).palette.action.activatedOpacity} + ${(theme.vars || theme).palette.action.focusOpacity}`),
240
239
  // Reset on touch devices, it doesn't add specificity
241
240
  '@media (hover: none)': {
242
241
  backgroundColor: 'transparent'
243
242
  }
244
243
  },
245
244
  [`&.${_paginationItemClasses.default.focusVisible}`]: {
246
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / calc(${theme.vars.palette.action.activatedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.activatedOpacity + theme.palette.action.focusOpacity)
245
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, `${(theme.vars || theme).palette.action.activatedOpacity} + ${(theme.vars || theme).palette.action.focusOpacity}`)
247
246
  }
248
247
  }
249
248
  }
package/Radio/Radio.js CHANGED
@@ -12,7 +12,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _refType = _interopRequireDefault(require("@mui/utils/refType"));
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
- var _colorManipulator = require("@mui/system/colorManipulator");
16
15
  var _SwitchBase = _interopRequireDefault(require("../internal/SwitchBase"));
17
16
  var _RadioButtonIcon = _interopRequireDefault(require("./RadioButtonIcon"));
18
17
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
@@ -66,7 +65,7 @@ const RadioRoot = (0, _zeroStyled.styled)(_SwitchBase.default, {
66
65
  },
67
66
  style: {
68
67
  '&:hover': {
69
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : (0, _colorManipulator.alpha)(theme.palette.action.active, theme.palette.action.hoverOpacity)
68
+ backgroundColor: theme.alpha((theme.vars || theme).palette.action.active, (theme.vars || theme).palette.action.hoverOpacity)
70
69
  }
71
70
  }
72
71
  }, ...Object.entries(theme.palette).filter((0, _createSimplePaletteValueFilter.default)()).map(([color]) => ({
@@ -77,7 +76,7 @@ const RadioRoot = (0, _zeroStyled.styled)(_SwitchBase.default, {
77
76
  },
78
77
  style: {
79
78
  '&:hover': {
80
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.hoverOpacity)
79
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.hoverOpacity)
81
80
  }
82
81
  }
83
82
  })), ...Object.entries(theme.palette).filter((0, _createSimplePaletteValueFilter.default)()).map(([color]) => ({
@@ -160,12 +160,27 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
160
160
  });
161
161
  const inputRef = React.useRef(null);
162
162
  const displayRef = React.useRef(null);
163
+ const paperRef = React.useRef(null);
164
+ const didPointerDownRef = React.useRef(false);
163
165
  const [displayNode, setDisplayNode] = React.useState(null);
164
166
  const {
165
167
  current: isOpenControlled
166
168
  } = React.useRef(openProp != null);
167
169
  const [menuMinWidthState, setMenuMinWidthState] = React.useState();
170
+ const open = displayNode !== null && openState;
171
+ const ownerState = {
172
+ ...props,
173
+ variant,
174
+ value,
175
+ open,
176
+ error
177
+ };
178
+ const paperProps = {
179
+ ...MenuProps.PaperProps,
180
+ ...(typeof MenuProps.slotProps?.paper === 'function' ? MenuProps.slotProps.paper(ownerState) : MenuProps.slotProps?.paper)
181
+ };
168
182
  const handleRef = (0, _useForkRef.default)(ref, inputRefProp);
183
+ const handlePaperRef = (0, _useForkRef.default)(paperProps.ref, paperRef);
169
184
  const handleDisplayRef = React.useCallback(node => {
170
185
  displayRef.current = node;
171
186
  if (node) {
@@ -215,8 +230,8 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
215
230
  }
216
231
  return undefined;
217
232
  }, [labelId]);
218
- const update = (open, event) => {
219
- if (open) {
233
+ const update = (openParam, event) => {
234
+ if (openParam) {
220
235
  if (onOpen) {
221
236
  onOpen(event);
222
237
  }
@@ -225,7 +240,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
225
240
  }
226
241
  if (!isOpenControlled) {
227
242
  setMenuMinWidthState(autoWidth ? null : anchorElement.clientWidth);
228
- setOpenState(open);
243
+ setOpenState(openParam);
229
244
  }
230
245
  };
231
246
  const handleMouseDown = event => {
@@ -236,6 +251,31 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
236
251
  // Hijack the default focus behavior.
237
252
  event.preventDefault();
238
253
  displayRef.current.focus();
254
+ const doc = (0, _ownerDocument.default)(event.currentTarget);
255
+ function handleMouseUp(mouseEvent) {
256
+ if (!displayRef.current) {
257
+ return;
258
+ }
259
+
260
+ // mouse is over the options/menuitem, don't close the menu
261
+ if (paperRef.current.contains(mouseEvent.target)) {
262
+ return;
263
+ }
264
+ const triggerElement = displayRef.current.getBoundingClientRect();
265
+
266
+ // mouse is inside the trigger, don't close the menu
267
+ if (mouseEvent.clientX >= triggerElement.left && mouseEvent.clientX <= triggerElement.right && mouseEvent.clientY >= triggerElement.top && mouseEvent.clientY <= triggerElement.bottom) {
268
+ return;
269
+ }
270
+
271
+ // close the menu
272
+ update(false, mouseEvent);
273
+ }
274
+
275
+ // `{ once: true }` to automatically remove the listener, see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#once
276
+ doc.addEventListener('mouseup', handleMouseUp, {
277
+ once: true
278
+ });
239
279
  update(true, event);
240
280
  };
241
281
  const handleClose = event => {
@@ -254,7 +294,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
254
294
  onChange(event, child);
255
295
  }
256
296
  };
257
- const handleItemClick = child => event => {
297
+ const handleItemSelect = child => event => {
258
298
  let newValue;
259
299
 
260
300
  // We use the tabindex attribute to signal the available options.
@@ -272,9 +312,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
272
312
  } else {
273
313
  newValue = child.props.value;
274
314
  }
275
- if (child.props.onClick) {
276
- child.props.onClick(event);
277
- }
278
315
  if (value !== newValue) {
279
316
  setValueState(newValue);
280
317
  if (onChange) {
@@ -310,7 +347,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
310
347
  }
311
348
  }
312
349
  };
313
- const open = displayNode !== null && openState;
314
350
  const handleBlur = event => {
315
351
  // if open event.stopImmediatePropagation
316
352
  if (!open && onBlur) {
@@ -371,7 +407,26 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
371
407
  }
372
408
  return /*#__PURE__*/React.cloneElement(child, {
373
409
  'aria-selected': selected ? 'true' : 'false',
374
- onClick: handleItemClick(child),
410
+ onPointerDown: () => {
411
+ didPointerDownRef.current = true;
412
+ },
413
+ onClick: event => {
414
+ didPointerDownRef.current = false;
415
+ if (child.props.onClick) {
416
+ child.props.onClick(event);
417
+ }
418
+ handleItemSelect(child)(event);
419
+ },
420
+ onMouseUp: event => {
421
+ if (didPointerDownRef.current) {
422
+ didPointerDownRef.current = false;
423
+ return;
424
+ }
425
+ if (child.props.onMouseUp) {
426
+ child.props.onMouseUp(event);
427
+ }
428
+ handleItemSelect(child)(event);
429
+ },
375
430
  onKeyUp: event => {
376
431
  if (event.key === ' ') {
377
432
  // otherwise our MenuItems dispatches a click event
@@ -430,21 +485,10 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
430
485
  tabIndex = disabled ? null : 0;
431
486
  }
432
487
  const buttonId = SelectDisplayProps.id || (name ? `mui-component-select-${name}` : undefined);
433
- const ownerState = {
434
- ...props,
435
- variant,
436
- value,
437
- open,
438
- error
439
- };
440
488
  const classes = useUtilityClasses(ownerState);
441
- const paperProps = {
442
- ...MenuProps.PaperProps,
443
- ...MenuProps.slotProps?.paper
444
- };
445
489
  const listProps = {
446
490
  ...MenuProps.MenuListProps,
447
- ...MenuProps.slotProps?.list
491
+ ...(typeof MenuProps.slotProps?.list === 'function' ? MenuProps.slotProps.list(ownerState) : MenuProps.slotProps?.list)
448
492
  };
449
493
  const listboxId = (0, _useId.default)();
450
494
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
@@ -522,6 +566,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
522
566
  },
523
567
  paper: {
524
568
  ...paperProps,
569
+ ref: handlePaperRef,
525
570
  style: {
526
571
  minWidth: menuMinWidth,
527
572
  ...(paperProps != null ? paperProps.style : null)
@@ -87,7 +87,7 @@ const SkeletonRoot = (0, _zeroStyled.styled)('span', {
87
87
  return {
88
88
  display: 'block',
89
89
  // Create a "on paper" color with sufficient contrast retaining the color
90
- backgroundColor: theme.vars ? theme.vars.palette.Skeleton.bg : (0, _styles.alpha)(theme.palette.text.primary, theme.palette.mode === 'light' ? 0.11 : 0.13),
90
+ backgroundColor: theme.vars ? theme.vars.palette.Skeleton.bg : theme.alpha(theme.palette.text.primary, theme.palette.mode === 'light' ? 0.11 : 0.13),
91
91
  height: '1.2em',
92
92
  variants: [{
93
93
  props: {
package/Slider/Slider.js CHANGED
@@ -12,7 +12,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _chainPropTypes = _interopRequireDefault(require("@mui/utils/chainPropTypes"));
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
- var _colorManipulator = require("@mui/system/colorManipulator");
16
15
  var _RtlProvider = require("@mui/system/RtlProvider");
17
16
  var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
18
17
  var _useSlider = require("./useSlider");
@@ -226,13 +225,13 @@ const SliderTrack = exports.SliderTrack = (0, _zeroStyled.styled)('span', {
226
225
  backgroundColor: theme.vars.palette.Slider[`${color}Track`],
227
226
  borderColor: theme.vars.palette.Slider[`${color}Track`]
228
227
  } : {
229
- backgroundColor: (0, _colorManipulator.lighten)(theme.palette[color].main, 0.62),
230
- borderColor: (0, _colorManipulator.lighten)(theme.palette[color].main, 0.62),
228
+ backgroundColor: theme.lighten(theme.palette[color].main, 0.62),
229
+ borderColor: theme.lighten(theme.palette[color].main, 0.62),
231
230
  ...theme.applyStyles('dark', {
232
- backgroundColor: (0, _colorManipulator.darken)(theme.palette[color].main, 0.5)
231
+ backgroundColor: theme.darken(theme.palette[color].main, 0.5)
233
232
  }),
234
233
  ...theme.applyStyles('dark', {
235
- borderColor: (0, _colorManipulator.darken)(theme.palette[color].main, 0.5)
234
+ borderColor: theme.darken(theme.palette[color].main, 0.5)
236
235
  })
237
236
  })
238
237
  }
@@ -321,21 +320,13 @@ const SliderThumb = exports.SliderThumb = (0, _zeroStyled.styled)('span', {
321
320
  },
322
321
  style: {
323
322
  [`&:hover, &.${_sliderClasses.default.focusVisible}`]: {
324
- ...(theme.vars ? {
325
- boxShadow: `0px 0px 0px 8px rgba(${theme.vars.palette[color].mainChannel} / 0.16)`
326
- } : {
327
- boxShadow: `0px 0px 0px 8px ${(0, _colorManipulator.alpha)(theme.palette[color].main, 0.16)}`
328
- }),
323
+ boxShadow: `0px 0px 0px 8px ${theme.alpha((theme.vars || theme).palette[color].main, 0.16)}`,
329
324
  '@media (hover: none)': {
330
325
  boxShadow: 'none'
331
326
  }
332
327
  },
333
328
  [`&.${_sliderClasses.default.active}`]: {
334
- ...(theme.vars ? {
335
- boxShadow: `0px 0px 0px 14px rgba(${theme.vars.palette[color].mainChannel} / 0.16)`
336
- } : {
337
- boxShadow: `0px 0px 0px 14px ${(0, _colorManipulator.alpha)(theme.palette[color].main, 0.16)}`
338
- })
329
+ boxShadow: `0px 0px 0px 14px ${theme.alpha((theme.vars || theme).palette[color].main, 0.16)}`
339
330
  }
340
331
  }
341
332
  }))]
@@ -380,14 +380,8 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
380
380
  * The props used for each slot inside.
381
381
  * @default {}
382
382
  */
383
- slotProps: _propTypes.default.shape({
384
- clickAwayListener: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
385
- children: _propTypes.default.element.isRequired,
386
- disableReactTree: _propTypes.default.bool,
387
- mouseEvent: _propTypes.default.oneOf(['onClick', 'onMouseDown', 'onMouseUp', 'onPointerDown', 'onPointerUp', false]),
388
- onClickAway: _propTypes.default.func,
389
- touchEvent: _propTypes.default.oneOf(['onTouchEnd', 'onTouchStart', false])
390
- })]),
383
+ slotProps: _propTypes.default /* @typescript-to-proptypes-ignore */.shape({
384
+ clickAwayListener: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
391
385
  content: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
392
386
  root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
393
387
  transition: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
@@ -227,13 +227,17 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
227
227
  *
228
228
  * @param dialActionIndex {number}
229
229
  * @param origButtonRef {React.RefObject?}
230
+ * @param fabSlotOrigButtonRef {React.RefObject?}
230
231
  */
231
- const createHandleSpeedDialActionButtonRef = (dialActionIndex, origButtonRef) => {
232
+ const createHandleSpeedDialActionButtonRef = (dialActionIndex, origButtonRef, fabSlotOrigButtonRef) => {
232
233
  return buttonRef => {
233
234
  actions.current[dialActionIndex + 1] = buttonRef;
234
235
  if (origButtonRef) {
235
236
  origButtonRef(buttonRef);
236
237
  }
238
+ if (fabSlotOrigButtonRef) {
239
+ fabSlotOrigButtonRef(buttonRef);
240
+ }
237
241
  };
238
242
  };
239
243
  const handleKeyDown = event => {
@@ -349,16 +353,26 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
349
353
  const children = allItems.map((child, index) => {
350
354
  const {
351
355
  FabProps: {
352
- ref: origButtonRef,
353
- ...ChildFabProps
356
+ ref: origButtonRef
354
357
  } = {},
358
+ slotProps: childSlotProps = {},
355
359
  tooltipPlacement: tooltipPlacementProp
356
360
  } = child.props;
361
+ const {
362
+ fab: {
363
+ ref: fabSlotOrigButtonRef,
364
+ ...fabSlotProps
365
+ } = {},
366
+ ...restOfSlotProps
367
+ } = childSlotProps;
357
368
  const tooltipPlacement = tooltipPlacementProp || (getOrientation(direction) === 'vertical' ? 'left' : 'top');
358
369
  return /*#__PURE__*/React.cloneElement(child, {
359
- FabProps: {
360
- ...ChildFabProps,
361
- ref: createHandleSpeedDialActionButtonRef(index, origButtonRef)
370
+ slotProps: {
371
+ fab: {
372
+ ...fabSlotProps,
373
+ ref: createHandleSpeedDialActionButtonRef(index, origButtonRef, fabSlotOrigButtonRef)
374
+ },
375
+ ...restOfSlotProps
362
376
  },
363
377
  delay: 30 * (open ? index : allItems.length - index),
364
378
  open,
package/Switch/Switch.js CHANGED
@@ -13,7 +13,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _clsx = _interopRequireDefault(require("clsx"));
14
14
  var _refType = _interopRequireDefault(require("@mui/utils/refType"));
15
15
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
16
- var _colorManipulator = require("@mui/system/colorManipulator");
17
16
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
18
17
  var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/createSimplePaletteValueFilter"));
19
18
  var _SwitchBase = _interopRequireDefault(require("../internal/SwitchBase"));
@@ -149,7 +148,7 @@ const SwitchSwitchBase = (0, _zeroStyled.styled)(_SwitchBase.default, {
149
148
  theme
150
149
  }) => ({
151
150
  '&:hover': {
152
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : (0, _colorManipulator.alpha)(theme.palette.action.active, theme.palette.action.hoverOpacity),
151
+ backgroundColor: theme.alpha((theme.vars || theme).palette.action.active, (theme.vars || theme).palette.action.hoverOpacity),
153
152
  // Reset on touch devices, it doesn't add specificity
154
153
  '@media (hover: none)': {
155
154
  backgroundColor: 'transparent'
@@ -164,13 +163,13 @@ const SwitchSwitchBase = (0, _zeroStyled.styled)(_SwitchBase.default, {
164
163
  [`&.${_switchClasses.default.checked}`]: {
165
164
  color: (theme.vars || theme).palette[color].main,
166
165
  '&:hover': {
167
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.hoverOpacity),
166
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.hoverOpacity),
168
167
  '@media (hover: none)': {
169
168
  backgroundColor: 'transparent'
170
169
  }
171
170
  },
172
171
  [`&.${_switchClasses.default.disabled}`]: {
173
- color: theme.vars ? theme.vars.palette.Switch[`${color}DisabledColor`] : `${theme.palette.mode === 'light' ? (0, _colorManipulator.lighten)(theme.palette[color].main, 0.62) : (0, _colorManipulator.darken)(theme.palette[color].main, 0.55)}`
172
+ color: theme.vars ? theme.vars.palette.Switch[`${color}DisabledColor`] : `${theme.palette.mode === 'light' ? theme.lighten(theme.palette[color].main, 0.62) : theme.darken(theme.palette[color].main, 0.55)}`
174
173
  }
175
174
  },
176
175
  [`&.${_switchClasses.default.checked} + .${_switchClasses.default.track}`]: {
@@ -282,6 +281,9 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
282
281
  ...(slotProps.switchBase && {
283
282
  root: typeof slotProps.switchBase === 'function' ? slotProps.switchBase(ownerState) : slotProps.switchBase
284
283
  }),
284
+ input: {
285
+ role: 'switch'
286
+ },
285
287
  ...(slotProps.input && {
286
288
  input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
287
289
  })
@@ -11,7 +11,6 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
14
- var _colorManipulator = require("@mui/system/colorManipulator");
15
14
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
16
15
  var _TableContext = _interopRequireDefault(require("../Table/TableContext"));
17
16
  var _Tablelvl2Context = _interopRequireDefault(require("../Table/Tablelvl2Context"));
@@ -52,7 +51,7 @@ const TableCellRoot = (0, _zeroStyled.styled)('td', {
52
51
  // Workaround for a rendering bug with spanned columns in Chrome 62.0.
53
52
  // Removes the alpha (sets it to 1), and lightens or darkens the theme color.
54
53
  borderBottom: theme.vars ? `1px solid ${theme.vars.palette.TableCell.border}` : `1px solid
55
- ${theme.palette.mode === 'light' ? (0, _colorManipulator.lighten)((0, _colorManipulator.alpha)(theme.palette.divider, 1), 0.88) : (0, _colorManipulator.darken)((0, _colorManipulator.alpha)(theme.palette.divider, 1), 0.68)}`,
54
+ ${theme.palette.mode === 'light' ? theme.lighten(theme.alpha(theme.palette.divider, 1), 0.88) : theme.darken(theme.alpha(theme.palette.divider, 1), 0.68)}`,
56
55
  textAlign: 'left',
57
56
  padding: 16,
58
57
  variants: [{
@@ -11,7 +11,6 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
14
- var _colorManipulator = require("@mui/system/colorManipulator");
15
14
  var _Tablelvl2Context = _interopRequireDefault(require("../Table/Tablelvl2Context"));
16
15
  var _zeroStyled = require("../zero-styled");
17
16
  var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
@@ -52,9 +51,9 @@ const TableRowRoot = (0, _zeroStyled.styled)('tr', {
52
51
  backgroundColor: (theme.vars || theme).palette.action.hover
53
52
  },
54
53
  [`&.${_tableRowClasses.default.selected}`]: {
55
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : (0, _colorManipulator.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity),
54
+ backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.selectedOpacity),
56
55
  '&:hover': {
57
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : (0, _colorManipulator.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity)
56
+ backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, `${(theme.vars || theme).palette.action.selectedOpacity} + ${(theme.vars || theme).palette.action.hoverOpacity}`)
58
57
  }
59
58
  }
60
59
  })));
@@ -13,7 +13,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _clsx = _interopRequireDefault(require("clsx"));
14
14
  var _resolveProps = _interopRequireDefault(require("@mui/utils/resolveProps"));
15
15
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
16
- var _colorManipulator = require("@mui/system/colorManipulator");
17
16
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
18
17
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
19
18
  var _zeroStyled = require("../zero-styled");
@@ -63,7 +62,7 @@ const ToggleButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
63
62
  '&:hover': {
64
63
  textDecoration: 'none',
65
64
  // Reset on mouse devices
66
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : (0, _colorManipulator.alpha)(theme.palette.text.primary, theme.palette.action.hoverOpacity),
65
+ backgroundColor: theme.alpha((theme.vars || theme).palette.text.primary, (theme.vars || theme).palette.action.hoverOpacity),
67
66
  '@media (hover: none)': {
68
67
  backgroundColor: 'transparent'
69
68
  }
@@ -75,12 +74,12 @@ const ToggleButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
75
74
  style: {
76
75
  [`&.${_toggleButtonClasses.default.selected}`]: {
77
76
  color: (theme.vars || theme).palette.text.primary,
78
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.selectedOpacity})` : (0, _colorManipulator.alpha)(theme.palette.text.primary, theme.palette.action.selectedOpacity),
77
+ backgroundColor: theme.alpha((theme.vars || theme).palette.text.primary, (theme.vars || theme).palette.action.selectedOpacity),
79
78
  '&:hover': {
80
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : (0, _colorManipulator.alpha)(theme.palette.text.primary, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),
79
+ backgroundColor: theme.alpha((theme.vars || theme).palette.text.primary, `${(theme.vars || theme).palette.action.selectedOpacity} + ${(theme.vars || theme).palette.action.hoverOpacity}`),
81
80
  // Reset on touch devices, it doesn't add specificity
82
81
  '@media (hover: none)': {
83
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.selectedOpacity})` : (0, _colorManipulator.alpha)(theme.palette.text.primary, theme.palette.action.selectedOpacity)
82
+ backgroundColor: theme.alpha((theme.vars || theme).palette.text.primary, (theme.vars || theme).palette.action.selectedOpacity)
84
83
  }
85
84
  }
86
85
  }
@@ -92,12 +91,12 @@ const ToggleButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
92
91
  style: {
93
92
  [`&.${_toggleButtonClasses.default.selected}`]: {
94
93
  color: (theme.vars || theme).palette[color].main,
95
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.selectedOpacity),
94
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.selectedOpacity),
96
95
  '&:hover': {
97
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),
96
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, `${(theme.vars || theme).palette.action.selectedOpacity} + ${(theme.vars || theme).palette.action.hoverOpacity}`),
98
97
  // Reset on touch devices, it doesn't add specificity
99
98
  '@media (hover: none)': {
100
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : (0, _colorManipulator.alpha)(theme.palette[color].main, theme.palette.action.selectedOpacity)
99
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.selectedOpacity)
101
100
  }
102
101
  }
103
102
  }
@@ -14,7 +14,6 @@ var _clsx = _interopRequireDefault(require("clsx"));
14
14
  var _useTimeout = _interopRequireWildcard(require("@mui/utils/useTimeout"));
15
15
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
16
16
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
17
- var _colorManipulator = require("@mui/system/colorManipulator");
18
17
  var _RtlProvider = require("@mui/system/RtlProvider");
19
18
  var _isFocusVisible = _interopRequireDefault(require("@mui/utils/isFocusVisible"));
20
19
  var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
@@ -165,7 +164,7 @@ const TooltipTooltip = (0, _zeroStyled.styled)('div', {
165
164
  })((0, _memoTheme.default)(({
166
165
  theme
167
166
  }) => ({
168
- backgroundColor: theme.vars ? theme.vars.palette.Tooltip.bg : (0, _colorManipulator.alpha)(theme.palette.grey[700], 0.92),
167
+ backgroundColor: theme.vars ? theme.vars.palette.Tooltip.bg : theme.alpha(theme.palette.grey[700], 0.92),
169
168
  borderRadius: (theme.vars || theme).shape.borderRadius,
170
169
  color: (theme.vars || theme).palette.common.white,
171
170
  fontFamily: theme.typography.fontFamily,
@@ -286,7 +285,7 @@ const TooltipArrow = (0, _zeroStyled.styled)('span', {
286
285
  width: '1em',
287
286
  height: '0.71em' /* = width / sqrt(2) = (length of the hypotenuse) */,
288
287
  boxSizing: 'border-box',
289
- color: theme.vars ? theme.vars.palette.Tooltip.bg : (0, _colorManipulator.alpha)(theme.palette.grey[700], 0.9),
288
+ color: theme.vars ? theme.vars.palette.Tooltip.bg : theme.alpha(theme.palette.grey[700], 0.9),
290
289
  '&::before': {
291
290
  content: '""',
292
291
  margin: 'auto',
@@ -23,10 +23,16 @@ export interface AccordionSlots {
23
23
  * @default Collapse
24
24
  */
25
25
  transition: React.ElementType;
26
+ /**
27
+ * The component that renders the region.
28
+ * @default 'div'
29
+ */
30
+ region: React.ElementType;
26
31
  }
27
32
  export interface AccordionRootSlotPropsOverrides {}
28
33
  export interface AccordionHeadingSlotPropsOverrides {}
29
34
  export interface AccordionTransitionSlotPropsOverrides {}
35
+ export interface AccordionRegionSlotPropsOverrides {}
30
36
  export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<AccordionSlots, {
31
37
  /**
32
38
  * Props forwarded to the root slot.
@@ -43,6 +49,11 @@ export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<AccordionSlots,
43
49
  * By default, the avaible props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component.
44
50
  */
45
51
  transition: SlotComponentProps<React.ElementType, TransitionProps & AccordionTransitionSlotPropsOverrides, AccordionOwnerState>;
52
+ /**
53
+ * Props forwarded to the region slot.
54
+ * By default, the available props are based on the div element.
55
+ */
56
+ region: SlotProps<'div', AccordionRegionSlotPropsOverrides, AccordionOwnerState>;
46
57
  }>;
47
58
  export type AccordionTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div'> = ExtendPaperTypeMap<{
48
59
  props: AdditionalProps & {