@mui/material 5.15.12 → 5.15.13

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 (66) hide show
  1. package/Alert/Alert.d.ts +2 -2
  2. package/Autocomplete/Autocomplete.js +58 -49
  3. package/CHANGELOG.md +96 -0
  4. package/Drawer/Drawer.js +9 -3
  5. package/LinearProgress/LinearProgress.js +4 -4
  6. package/Menu/Menu.js +5 -4
  7. package/MenuList/MenuList.js +4 -2
  8. package/PaginationItem/PaginationItem.js +3 -3
  9. package/Rating/Rating.js +3 -3
  10. package/Slider/Slider.js +2 -3
  11. package/Switch/Switch.js +61 -41
  12. package/TabScrollButton/TabScrollButton.js +2 -3
  13. package/TablePagination/TablePaginationActions.js +14 -14
  14. package/Tabs/Tabs.js +3 -2
  15. package/Tooltip/Tooltip.js +5 -4
  16. package/index.js +1 -1
  17. package/legacy/Autocomplete/Autocomplete.js +62 -51
  18. package/legacy/Drawer/Drawer.js +8 -3
  19. package/legacy/LinearProgress/LinearProgress.js +4 -4
  20. package/legacy/Menu/Menu.js +5 -4
  21. package/legacy/MenuList/MenuList.js +3 -2
  22. package/legacy/PaginationItem/PaginationItem.js +3 -3
  23. package/legacy/Rating/Rating.js +3 -3
  24. package/legacy/Slider/Slider.js +2 -3
  25. package/legacy/Switch/Switch.js +88 -59
  26. package/legacy/TabScrollButton/TabScrollButton.js +2 -3
  27. package/legacy/TablePagination/TablePaginationActions.js +14 -14
  28. package/legacy/Tabs/Tabs.js +3 -2
  29. package/legacy/Tooltip/Tooltip.js +7 -3
  30. package/legacy/index.js +1 -1
  31. package/legacy/styles/experimental_extendTheme.js +3 -0
  32. package/modern/Autocomplete/Autocomplete.js +58 -49
  33. package/modern/Drawer/Drawer.js +9 -3
  34. package/modern/LinearProgress/LinearProgress.js +4 -4
  35. package/modern/Menu/Menu.js +5 -4
  36. package/modern/MenuList/MenuList.js +4 -2
  37. package/modern/PaginationItem/PaginationItem.js +3 -3
  38. package/modern/Rating/Rating.js +3 -3
  39. package/modern/Slider/Slider.js +2 -3
  40. package/modern/Switch/Switch.js +61 -41
  41. package/modern/TabScrollButton/TabScrollButton.js +2 -3
  42. package/modern/TablePagination/TablePaginationActions.js +14 -14
  43. package/modern/Tabs/Tabs.js +3 -2
  44. package/modern/Tooltip/Tooltip.js +5 -4
  45. package/modern/index.js +1 -1
  46. package/modern/styles/experimental_extendTheme.js +3 -0
  47. package/node/Autocomplete/Autocomplete.js +58 -49
  48. package/node/Drawer/Drawer.js +9 -3
  49. package/node/LinearProgress/LinearProgress.js +4 -4
  50. package/node/Menu/Menu.js +5 -4
  51. package/node/MenuList/MenuList.js +4 -2
  52. package/node/PaginationItem/PaginationItem.js +3 -3
  53. package/node/Rating/Rating.js +3 -3
  54. package/node/Slider/Slider.js +2 -3
  55. package/node/Switch/Switch.js +66 -46
  56. package/node/TabScrollButton/TabScrollButton.js +2 -3
  57. package/node/TablePagination/TablePaginationActions.js +14 -14
  58. package/node/Tabs/Tabs.js +3 -2
  59. package/node/Tooltip/Tooltip.js +5 -4
  60. package/node/index.js +1 -1
  61. package/node/styles/experimental_extendTheme.js +3 -0
  62. package/package.json +5 -5
  63. package/styles/experimental_extendTheme.d.ts +1 -0
  64. package/styles/experimental_extendTheme.js +3 -0
  65. package/umd/material-ui.development.js +356 -286
  66. package/umd/material-ui.production.min.js +2 -2
@@ -8,9 +8,9 @@ import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
9
  import composeClasses from '@mui/utils/composeClasses';
10
10
  import { alpha } from '@mui/system/colorManipulator';
11
+ import { useRtl } from '@mui/system/RtlProvider';
11
12
  import useThemeProps from '../styles/useThemeProps';
12
13
  import paginationItemClasses, { getPaginationItemUtilityClass } from './paginationItemClasses';
13
- import useTheme from '../styles/useTheme';
14
14
  import ButtonBase from '../ButtonBase';
15
15
  import capitalize from '../utils/capitalize';
16
16
  import FirstPageIcon from '../internal/svg-icons/FirstPage';
@@ -234,9 +234,9 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
234
234
  type,
235
235
  variant
236
236
  });
237
- const theme = useTheme();
237
+ const isRtl = useRtl();
238
238
  const classes = useUtilityClasses(ownerState);
239
- const normalizedIcons = theme.direction === 'rtl' ? {
239
+ const normalizedIcons = isRtl ? {
240
240
  previous: slots.next || components.next || NavigateNextIcon,
241
241
  next: slots.previous || components.previous || NavigateBeforeIcon,
242
242
  last: slots.first || components.first || FirstPageIcon,
@@ -11,7 +11,7 @@ import clamp from '@mui/utils/clamp';
11
11
  import visuallyHidden from '@mui/utils/visuallyHidden';
12
12
  import chainPropTypes from '@mui/utils/chainPropTypes';
13
13
  import composeClasses from '@mui/utils/composeClasses';
14
- import useTheme from '../styles/useTheme';
14
+ import { useRtl } from '@mui/system/RtlProvider';
15
15
  import { capitalize, useForkRef, useIsFocusVisible, useControlled, unstable_useId as useId } from '../utils';
16
16
  import Star from '../internal/svg-icons/Star';
17
17
  import StarBorder from '../internal/svg-icons/StarBorder';
@@ -300,7 +300,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
300
300
  name: 'Rating'
301
301
  });
302
302
  const valueRounded = roundValueToPrecision(valueDerived, precision);
303
- const theme = useTheme();
303
+ const isRtl = useRtl();
304
304
  const [{
305
305
  hover,
306
306
  focus
@@ -335,7 +335,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
335
335
  width: containerWidth
336
336
  } = rootNode.getBoundingClientRect();
337
337
  let percent;
338
- if (theme.direction === 'rtl') {
338
+ if (isRtl) {
339
339
  percent = (right - event.clientX) / containerWidth;
340
340
  } else {
341
341
  percent = (event.clientX - left) / containerWidth;
@@ -11,9 +11,9 @@ import { isHostComponent, useSlotProps } from '@mui/base/utils';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
12
  import { useSlider, valueToPercent } from '@mui/base/useSlider';
13
13
  import { alpha, lighten, darken } from '@mui/system/colorManipulator';
14
+ import { useRtl } from '@mui/system/RtlProvider';
14
15
  import useThemeProps from '../styles/useThemeProps';
15
16
  import styled, { slotShouldForwardProp } from '../styles/styled';
16
- import useTheme from '../styles/useTheme';
17
17
  import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
18
18
  import capitalize from '../utils/capitalize';
19
19
  import BaseSliderValueLabel from './SliderValueLabel';
@@ -370,8 +370,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
370
370
  props: inputProps,
371
371
  name: 'MuiSlider'
372
372
  });
373
- const theme = useTheme();
374
- const isRtl = theme.direction === 'rtl';
373
+ const isRtl = useRtl();
375
374
  const {
376
375
  'aria-label': ariaLabel,
377
376
  'aria-valuetext': ariaValuetext,
@@ -12,11 +12,11 @@ import composeClasses from '@mui/utils/composeClasses';
12
12
  import { alpha, darken, lighten } from '@mui/system/colorManipulator';
13
13
  import capitalize from '../utils/capitalize';
14
14
  import SwitchBase from '../internal/SwitchBase';
15
- import useThemeProps from '../styles/useThemeProps';
16
- import styled from '../styles/styled';
15
+ import { styled, createUseThemeProps } from '../zero-styled';
17
16
  import switchClasses, { getSwitchUtilityClass } from './switchClasses';
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
19
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ const useThemeProps = createUseThemeProps('MuiSwitch');
20
20
  const useUtilityClasses = ownerState => {
21
21
  const {
22
22
  classes,
@@ -45,9 +45,7 @@ const SwitchRoot = styled('span', {
45
45
  } = props;
46
46
  return [styles.root, ownerState.edge && styles[`edge${capitalize(ownerState.edge)}`], styles[`size${capitalize(ownerState.size)}`]];
47
47
  }
48
- })(({
49
- ownerState
50
- }) => _extends({
48
+ })({
51
49
  display: 'inline-flex',
52
50
  width: 34 + 12 * 2,
53
51
  height: 14 + 12 * 2,
@@ -62,26 +60,42 @@ const SwitchRoot = styled('span', {
62
60
  // For correct alignment with the text.
63
61
  '@media print': {
64
62
  colorAdjust: 'exact'
65
- }
66
- }, ownerState.edge === 'start' && {
67
- marginLeft: -8
68
- }, ownerState.edge === 'end' && {
69
- marginRight: -8
70
- }, ownerState.size === 'small' && {
71
- width: 40,
72
- height: 24,
73
- padding: 7,
74
- [`& .${switchClasses.thumb}`]: {
75
- width: 16,
76
- height: 16
77
63
  },
78
- [`& .${switchClasses.switchBase}`]: {
79
- padding: 4,
80
- [`&.${switchClasses.checked}`]: {
81
- transform: 'translateX(16px)'
64
+ variants: [{
65
+ props: {
66
+ edge: 'start'
67
+ },
68
+ style: {
69
+ marginLeft: -8
82
70
  }
83
- }
84
- }));
71
+ }, {
72
+ props: {
73
+ edge: 'end'
74
+ },
75
+ style: {
76
+ marginRight: -8
77
+ }
78
+ }, {
79
+ props: {
80
+ size: 'small'
81
+ },
82
+ style: {
83
+ width: 40,
84
+ height: 24,
85
+ padding: 7,
86
+ [`& .${switchClasses.thumb}`]: {
87
+ width: 16,
88
+ height: 16
89
+ },
90
+ [`& .${switchClasses.switchBase}`]: {
91
+ padding: 4,
92
+ [`&.${switchClasses.checked}`]: {
93
+ transform: 'translateX(16px)'
94
+ }
95
+ }
96
+ }
97
+ }]
98
+ });
85
99
  const SwitchSwitchBase = styled(SwitchBase, {
86
100
  name: 'MuiSwitch',
87
101
  slot: 'SwitchBase',
@@ -122,32 +136,38 @@ const SwitchSwitchBase = styled(SwitchBase, {
122
136
  width: '300%'
123
137
  }
124
138
  }), ({
125
- theme,
126
- ownerState
127
- }) => _extends({
139
+ theme
140
+ }) => ({
128
141
  '&:hover': {
129
142
  backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),
130
143
  // Reset on touch devices, it doesn't add specificity
131
144
  '@media (hover: none)': {
132
145
  backgroundColor: 'transparent'
133
146
  }
134
- }
135
- }, ownerState.color !== 'default' && {
136
- [`&.${switchClasses.checked}`]: {
137
- color: (theme.vars || theme).palette[ownerState.color].main,
138
- '&:hover': {
139
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
140
- '@media (hover: none)': {
141
- backgroundColor: 'transparent'
142
- }
147
+ },
148
+ variants: [...Object.entries(theme.palette).filter(([, value]) => value.main && value.light) // check all the used fields in the style below
149
+ .map(([color]) => ({
150
+ props: {
151
+ color
143
152
  },
144
- [`&.${switchClasses.disabled}`]: {
145
- color: theme.vars ? theme.vars.palette.Switch[`${ownerState.color}DisabledColor`] : `${theme.palette.mode === 'light' ? lighten(theme.palette[ownerState.color].main, 0.62) : darken(theme.palette[ownerState.color].main, 0.55)}`
153
+ style: {
154
+ [`&.${switchClasses.checked}`]: {
155
+ color: (theme.vars || theme).palette[color].main,
156
+ '&:hover': {
157
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity),
158
+ '@media (hover: none)': {
159
+ backgroundColor: 'transparent'
160
+ }
161
+ },
162
+ [`&.${switchClasses.disabled}`]: {
163
+ color: theme.vars ? theme.vars.palette.Switch[`${color}DisabledColor`] : `${theme.palette.mode === 'light' ? lighten(theme.palette[color].main, 0.62) : darken(theme.palette[color].main, 0.55)}`
164
+ }
165
+ },
166
+ [`&.${switchClasses.checked} + .${switchClasses.track}`]: {
167
+ backgroundColor: (theme.vars || theme).palette[color].main
168
+ }
146
169
  }
147
- },
148
- [`&.${switchClasses.checked} + .${switchClasses.track}`]: {
149
- backgroundColor: (theme.vars || theme).palette[ownerState.color].main
150
- }
170
+ }))]
151
171
  }));
152
172
  const SwitchTrack = styled('span', {
153
173
  name: 'MuiSwitch',
@@ -9,10 +9,10 @@ import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
+ import { useRtl } from '@mui/system/RtlProvider';
12
13
  import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
13
14
  import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
14
15
  import ButtonBase from '../ButtonBase';
15
- import useTheme from '../styles/useTheme';
16
16
  import useThemeProps from '../styles/useThemeProps';
17
17
  import styled from '../styles/styled';
18
18
  import tabScrollButtonClasses, { getTabScrollButtonUtilityClass } from './tabScrollButtonClasses';
@@ -65,8 +65,7 @@ const TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(i
65
65
  direction
66
66
  } = props,
67
67
  other = _objectWithoutPropertiesLoose(props, _excluded);
68
- const theme = useTheme();
69
- const isRtl = theme.direction === 'rtl';
68
+ const isRtl = useRtl();
70
69
  const ownerState = _extends({
71
70
  isRtl
72
71
  }, props);
@@ -5,9 +5,9 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
5
5
  const _excluded = ["backIconButtonProps", "count", "disabled", "getItemAriaLabel", "nextIconButtonProps", "onPageChange", "page", "rowsPerPage", "showFirstButton", "showLastButton", "slots", "slotProps"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { useRtl } from '@mui/system/RtlProvider';
8
9
  import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
9
10
  import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
10
- import useTheme from '../styles/useTheme';
11
11
  import IconButton from '../IconButton';
12
12
  import LastPageIconDefault from '../internal/svg-icons/LastPage';
13
13
  import FirstPageIconDefault from '../internal/svg-icons/FirstPage';
@@ -33,7 +33,7 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
33
33
  slotProps = {}
34
34
  } = props,
35
35
  other = _objectWithoutPropertiesLoose(props, _excluded);
36
- const theme = useTheme();
36
+ const isRtl = useRtl();
37
37
  const handleFirstPageButtonClick = event => {
38
38
  onPageChange(event, 0);
39
39
  };
@@ -54,14 +54,14 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
54
54
  const LastButtonIcon = slots.lastButtonIcon ?? LastPageIconDefault;
55
55
  const NextButtonIcon = slots.nextButtonIcon ?? KeyboardArrowRight;
56
56
  const PreviousButtonIcon = slots.previousButtonIcon ?? KeyboardArrowLeft;
57
- const FirstButtonSlot = theme.direction === 'rtl' ? LastButton : FirstButton;
58
- const PreviousButtonSlot = theme.direction === 'rtl' ? NextButton : PreviousButton;
59
- const NextButtonSlot = theme.direction === 'rtl' ? PreviousButton : NextButton;
60
- const LastButtonSlot = theme.direction === 'rtl' ? FirstButton : LastButton;
61
- const firstButtonSlotProps = theme.direction === 'rtl' ? slotProps.lastButton : slotProps.firstButton;
62
- const previousButtonSlotProps = theme.direction === 'rtl' ? slotProps.nextButton : slotProps.previousButton;
63
- const nextButtonSlotProps = theme.direction === 'rtl' ? slotProps.previousButton : slotProps.nextButton;
64
- const lastButtonSlotProps = theme.direction === 'rtl' ? slotProps.firstButton : slotProps.lastButton;
57
+ const FirstButtonSlot = isRtl ? LastButton : FirstButton;
58
+ const PreviousButtonSlot = isRtl ? NextButton : PreviousButton;
59
+ const NextButtonSlot = isRtl ? PreviousButton : NextButton;
60
+ const LastButtonSlot = isRtl ? FirstButton : LastButton;
61
+ const firstButtonSlotProps = isRtl ? slotProps.lastButton : slotProps.firstButton;
62
+ const previousButtonSlotProps = isRtl ? slotProps.nextButton : slotProps.previousButton;
63
+ const nextButtonSlotProps = isRtl ? slotProps.previousButton : slotProps.nextButton;
64
+ const lastButtonSlotProps = isRtl ? slotProps.firstButton : slotProps.lastButton;
65
65
  return /*#__PURE__*/_jsxs("div", _extends({
66
66
  ref: ref
67
67
  }, other, {
@@ -71,7 +71,7 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
71
71
  "aria-label": getItemAriaLabel('first', page),
72
72
  title: getItemAriaLabel('first', page)
73
73
  }, firstButtonSlotProps, {
74
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon)) : /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon))
74
+ children: isRtl ? /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon)) : /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon))
75
75
  })), /*#__PURE__*/_jsx(PreviousButtonSlot, _extends({
76
76
  onClick: handleBackButtonClick,
77
77
  disabled: disabled || page === 0,
@@ -79,7 +79,7 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
79
79
  "aria-label": getItemAriaLabel('previous', page),
80
80
  title: getItemAriaLabel('previous', page)
81
81
  }, previousButtonSlotProps ?? backIconButtonProps, {
82
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon)) : /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon))
82
+ children: isRtl ? /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon)) : /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon))
83
83
  })), /*#__PURE__*/_jsx(NextButtonSlot, _extends({
84
84
  onClick: handleNextButtonClick,
85
85
  disabled: disabled || (count !== -1 ? page >= Math.ceil(count / rowsPerPage) - 1 : false),
@@ -87,14 +87,14 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
87
87
  "aria-label": getItemAriaLabel('next', page),
88
88
  title: getItemAriaLabel('next', page)
89
89
  }, nextButtonSlotProps ?? nextIconButtonProps, {
90
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon)) : /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon))
90
+ children: isRtl ? /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon)) : /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon))
91
91
  })), showLastButton && /*#__PURE__*/_jsx(LastButtonSlot, _extends({
92
92
  onClick: handleLastPageButtonClick,
93
93
  disabled: disabled || page >= Math.ceil(count / rowsPerPage) - 1,
94
94
  "aria-label": getItemAriaLabel('last', page),
95
95
  title: getItemAriaLabel('last', page)
96
96
  }, lastButtonSlotProps, {
97
- children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon)) : /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon))
97
+ children: isRtl ? /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon)) : /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon))
98
98
  }))]
99
99
  }));
100
100
  });
@@ -10,6 +10,7 @@ import clsx from 'clsx';
10
10
  import refType from '@mui/utils/refType';
11
11
  import { useSlotProps } from '@mui/base/utils';
12
12
  import composeClasses from '@mui/utils/composeClasses';
13
+ import { useRtl } from '@mui/system/RtlProvider';
13
14
  import styled from '../styles/styled';
14
15
  import useThemeProps from '../styles/useThemeProps';
15
16
  import useTheme from '../styles/useTheme';
@@ -209,7 +210,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
209
210
  name: 'MuiTabs'
210
211
  });
211
212
  const theme = useTheme();
212
- const isRtl = theme.direction === 'rtl';
213
+ const isRtl = useRtl();
213
214
  const {
214
215
  'aria-label': ariaLabel,
215
216
  'aria-labelledby': ariaLabelledBy,
@@ -297,7 +298,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
297
298
  clientWidth: tabsNode.clientWidth,
298
299
  scrollLeft: tabsNode.scrollLeft,
299
300
  scrollTop: tabsNode.scrollTop,
300
- scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, theme.direction),
301
+ scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, isRtl ? 'rtl' : 'ltr'),
301
302
  scrollWidth: tabsNode.scrollWidth,
302
303
  top: rect.top,
303
304
  bottom: rect.bottom,
@@ -11,6 +11,7 @@ import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
11
11
  import { appendOwnerState } from '@mui/base/utils';
12
12
  import composeClasses from '@mui/utils/composeClasses';
13
13
  import { alpha } from '@mui/system/colorManipulator';
14
+ import { useRtl } from '@mui/system/RtlProvider';
14
15
  import styled from '../styles/styled';
15
16
  import useTheme from '../styles/useTheme';
16
17
  import useThemeProps from '../styles/useThemeProps';
@@ -206,11 +207,11 @@ export function testReset() {
206
207
  hystersisTimer.clear();
207
208
  }
208
209
  function composeEventHandler(handler, eventHandler) {
209
- return event => {
210
+ return (event, ...params) => {
210
211
  if (eventHandler) {
211
- eventHandler(event);
212
+ eventHandler(event, ...params);
212
213
  }
213
- handler(event);
214
+ handler(event, ...params);
214
215
  };
215
216
  }
216
217
 
@@ -256,7 +257,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
256
257
  children: childrenProp
257
258
  });
258
259
  const theme = useTheme();
259
- const isRtl = theme.direction === 'rtl';
260
+ const isRtl = useRtl();
260
261
  const [childNode, setChildNode] = React.useState();
261
262
  const [arrowRef, setArrowRef] = React.useState(null);
262
263
  const ignoreNonTouchEvents = React.useRef(false);
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.15.12
2
+ * @mui/material v5.15.13
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -244,6 +244,9 @@ export default function extendTheme(options = {}, ...args) {
244
244
 
245
245
  // MUI X - DataGrid needs this token.
246
246
  setColorChannel(palette.background, 'default');
247
+
248
+ // added for consistency with the `background.default` token
249
+ setColorChannel(palette.background, 'paper');
247
250
  setColorChannel(palette.common, 'background');
248
251
  setColorChannel(palette.common, 'onBackground');
249
252
  setColorChannel(palette, 'divider');
@@ -566,6 +566,63 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
566
566
  const paperSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : componentsProps.paper;
567
567
  const popperSlotProps = (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper;
568
568
  const popupIndicatorSlotProps = (_slotProps$popupIndic = slotProps.popupIndicator) != null ? _slotProps$popupIndic : componentsProps.popupIndicator;
569
+ const renderAutocompletePopperChildren = children => /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePopper, (0, _extends2.default)({
570
+ as: PopperComponent,
571
+ disablePortal: disablePortal,
572
+ style: {
573
+ width: anchorEl ? anchorEl.clientWidth : null
574
+ },
575
+ ownerState: ownerState,
576
+ role: "presentation",
577
+ anchorEl: anchorEl,
578
+ open: popupOpen
579
+ }, popperSlotProps, {
580
+ className: (0, _clsx.default)(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
581
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePaper, (0, _extends2.default)({
582
+ ownerState: ownerState,
583
+ as: PaperComponent
584
+ }, paperSlotProps, {
585
+ className: (0, _clsx.default)(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
586
+ children: children
587
+ }))
588
+ }));
589
+ let autocompletePopper = null;
590
+ if (!loading && groupedOptions.length > 0) {
591
+ autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteListbox, (0, _extends2.default)({
592
+ as: ListboxComponent,
593
+ className: classes.listbox,
594
+ ownerState: ownerState
595
+ }, otherListboxProps, ListboxProps, {
596
+ ref: combinedListboxRef,
597
+ children: groupedOptions.map((option, index) => {
598
+ if (groupBy) {
599
+ return renderGroup({
600
+ key: option.key,
601
+ group: option.group,
602
+ children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
603
+ });
604
+ }
605
+ return renderListOption(option, index);
606
+ })
607
+ })));
608
+ } else if (loading && groupedOptions.length === 0) {
609
+ autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteLoading, {
610
+ className: classes.loading,
611
+ ownerState: ownerState,
612
+ children: loadingText
613
+ }));
614
+ } else if (groupedOptions.length === 0 && !freeSolo && !loading) {
615
+ autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteNoOptions, {
616
+ className: classes.noOptions,
617
+ ownerState: ownerState,
618
+ role: "presentation",
619
+ onMouseDown: event => {
620
+ // Prevent input blur when interacting with the "no options" content
621
+ event.preventDefault();
622
+ },
623
+ children: noOptionsText
624
+ }));
625
+ }
569
626
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
570
627
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteRoot, (0, _extends2.default)({
571
628
  ref: ref,
@@ -615,55 +672,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
615
672
  readOnly
616
673
  }, getInputProps())
617
674
  })
618
- })), anchorEl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePopper, (0, _extends2.default)({
619
- as: PopperComponent,
620
- disablePortal: disablePortal,
621
- style: {
622
- width: anchorEl ? anchorEl.clientWidth : null
623
- },
624
- ownerState: ownerState,
625
- role: "presentation",
626
- anchorEl: anchorEl,
627
- open: popupOpen
628
- }, popperSlotProps, {
629
- className: (0, _clsx.default)(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
630
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(AutocompletePaper, (0, _extends2.default)({
631
- ownerState: ownerState,
632
- as: PaperComponent
633
- }, paperSlotProps, {
634
- className: (0, _clsx.default)(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
635
- children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteLoading, {
636
- className: classes.loading,
637
- ownerState: ownerState,
638
- children: loadingText
639
- }) : null, groupedOptions.length === 0 && !freeSolo && !loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteNoOptions, {
640
- className: classes.noOptions,
641
- ownerState: ownerState,
642
- role: "presentation",
643
- onMouseDown: event => {
644
- // Prevent input blur when interacting with the "no options" content
645
- event.preventDefault();
646
- },
647
- children: noOptionsText
648
- }) : null, groupedOptions.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteListbox, (0, _extends2.default)({
649
- as: ListboxComponent,
650
- className: classes.listbox,
651
- ownerState: ownerState
652
- }, otherListboxProps, ListboxProps, {
653
- ref: combinedListboxRef,
654
- children: groupedOptions.map((option, index) => {
655
- if (groupBy) {
656
- return renderGroup({
657
- key: option.key,
658
- group: option.group,
659
- children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
660
- });
661
- }
662
- return renderListOption(option, index);
663
- })
664
- })) : null]
665
- }))
666
- })) : null]
675
+ })), anchorEl ? autocompletePopper : null]
667
676
  });
668
677
  });
669
678
  process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptypes */ = {
@@ -15,6 +15,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
  var _clsx = _interopRequireDefault(require("clsx"));
16
16
  var _integerPropType = _interopRequireDefault(require("@mui/utils/integerPropType"));
17
17
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
18
+ var _RtlProvider = require("@mui/system/RtlProvider");
18
19
  var _Modal = _interopRequireDefault(require("../Modal"));
19
20
  var _Slide = _interopRequireDefault(require("../Slide"));
20
21
  var _Paper = _interopRequireDefault(require("../Paper"));
@@ -129,8 +130,10 @@ const oppositeDirection = {
129
130
  function isHorizontal(anchor) {
130
131
  return ['left', 'right'].indexOf(anchor) !== -1;
131
132
  }
132
- function getAnchor(theme, anchor) {
133
- return theme.direction === 'rtl' && isHorizontal(anchor) ? oppositeDirection[anchor] : anchor;
133
+ function getAnchor({
134
+ direction
135
+ }, anchor) {
136
+ return direction === 'rtl' && isHorizontal(anchor) ? oppositeDirection[anchor] : anchor;
134
137
  }
135
138
 
136
139
  /**
@@ -143,6 +146,7 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
143
146
  name: 'MuiDrawer'
144
147
  });
145
148
  const theme = (0, _useTheme.default)();
149
+ const isRtl = (0, _RtlProvider.useRtl)();
146
150
  const defaultTransitionDuration = {
147
151
  enter: theme.transitions.duration.enteringScreen,
148
152
  exit: theme.transitions.duration.leavingScreen
@@ -176,7 +180,9 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
176
180
  React.useEffect(() => {
177
181
  mounted.current = true;
178
182
  }, []);
179
- const anchorInvariant = getAnchor(theme, anchorProp);
183
+ const anchorInvariant = getAnchor({
184
+ direction: isRtl ? 'rtl' : 'ltr'
185
+ }, anchorProp);
180
186
  const anchor = anchorProp;
181
187
  const ownerState = (0, _extends2.default)({}, props, {
182
188
  anchor,
@@ -14,8 +14,8 @@ var _clsx = _interopRequireDefault(require("clsx"));
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
15
  var _system = require("@mui/system");
16
16
  var _colorManipulator = require("@mui/system/colorManipulator");
17
+ var _RtlProvider = require("@mui/system/RtlProvider");
17
18
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
18
- var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
19
19
  var _styled = _interopRequireDefault(require("../styles/styled"));
20
20
  var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
21
21
  var _linearProgressClasses = require("./linearProgressClasses");
@@ -255,7 +255,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
255
255
  variant
256
256
  });
257
257
  const classes = useUtilityClasses(ownerState);
258
- const theme = (0, _useTheme.default)();
258
+ const isRtl = (0, _RtlProvider.useRtl)();
259
259
  const rootProps = {};
260
260
  const inlineStyles = {
261
261
  bar1: {},
@@ -267,7 +267,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
267
267
  rootProps['aria-valuemin'] = 0;
268
268
  rootProps['aria-valuemax'] = 100;
269
269
  let transform = value - 100;
270
- if (theme.direction === 'rtl') {
270
+ if (isRtl) {
271
271
  transform = -transform;
272
272
  }
273
273
  inlineStyles.bar1.transform = `translateX(${transform}%)`;
@@ -278,7 +278,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
278
278
  if (variant === 'buffer') {
279
279
  if (valueBuffer !== undefined) {
280
280
  let transform = (valueBuffer || 0) - 100;
281
- if (theme.direction === 'rtl') {
281
+ if (isRtl) {
282
282
  transform = -transform;
283
283
  }
284
284
  inlineStyles.bar2.transform = `translateX(${transform}%)`;
package/node/Menu/Menu.js CHANGED
@@ -15,10 +15,10 @@ var _clsx = _interopRequireDefault(require("clsx"));
15
15
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
16
16
  var _utils = require("@mui/base/utils");
17
17
  var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
18
+ var _RtlProvider = require("@mui/system/RtlProvider");
18
19
  var _MenuList = _interopRequireDefault(require("../MenuList"));
19
20
  var _Popover = _interopRequireWildcard(require("../Popover"));
20
21
  var _styled = _interopRequireWildcard(require("../styles/styled"));
21
- var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
22
22
  var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
23
23
  var _menuClasses = require("./menuClasses");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
@@ -97,8 +97,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
97
97
  } = props,
98
98
  TransitionProps = (0, _objectWithoutPropertiesLoose2.default)(props.TransitionProps, _excluded),
99
99
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded2);
100
- const theme = (0, _useTheme.default)();
101
- const isRtl = theme.direction === 'rtl';
100
+ const isRtl = (0, _RtlProvider.useRtl)();
102
101
  const ownerState = (0, _extends2.default)({}, props, {
103
102
  autoFocus,
104
103
  disableAutoFocusItem,
@@ -114,7 +113,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
114
113
  const menuListActionsRef = React.useRef(null);
115
114
  const handleEntering = (element, isAppearing) => {
116
115
  if (menuListActionsRef.current) {
117
- menuListActionsRef.current.adjustStyleForScrollbar(element, theme);
116
+ menuListActionsRef.current.adjustStyleForScrollbar(element, {
117
+ direction: isRtl ? 'rtl' : 'ltr'
118
+ });
118
119
  }
119
120
  if (onEntering) {
120
121
  onEntering(element, isAppearing);
@@ -115,13 +115,15 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
115
115
  }
116
116
  }, [autoFocus]);
117
117
  React.useImperativeHandle(actions, () => ({
118
- adjustStyleForScrollbar: (containerElement, theme) => {
118
+ adjustStyleForScrollbar: (containerElement, {
119
+ direction
120
+ }) => {
119
121
  // Let's ignore that piece of logic if users are already overriding the width
120
122
  // of the menu.
121
123
  const noExplicitWidth = !listRef.current.style.width;
122
124
  if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
123
125
  const scrollbarSize = `${(0, _getScrollbarSize.default)((0, _ownerDocument.default)(containerElement))}px`;
124
- listRef.current.style[theme.direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
126
+ listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
125
127
  listRef.current.style.width = `calc(100% + ${scrollbarSize})`;
126
128
  }
127
129
  return listRef.current;