@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.
- package/Alert/Alert.d.ts +2 -2
- package/Autocomplete/Autocomplete.js +58 -49
- package/CHANGELOG.md +96 -0
- package/Drawer/Drawer.js +9 -3
- package/LinearProgress/LinearProgress.js +4 -4
- package/Menu/Menu.js +5 -4
- package/MenuList/MenuList.js +4 -2
- package/PaginationItem/PaginationItem.js +3 -3
- package/Rating/Rating.js +3 -3
- package/Slider/Slider.js +2 -3
- package/Switch/Switch.js +61 -41
- package/TabScrollButton/TabScrollButton.js +2 -3
- package/TablePagination/TablePaginationActions.js +14 -14
- package/Tabs/Tabs.js +3 -2
- package/Tooltip/Tooltip.js +5 -4
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +62 -51
- package/legacy/Drawer/Drawer.js +8 -3
- package/legacy/LinearProgress/LinearProgress.js +4 -4
- package/legacy/Menu/Menu.js +5 -4
- package/legacy/MenuList/MenuList.js +3 -2
- package/legacy/PaginationItem/PaginationItem.js +3 -3
- package/legacy/Rating/Rating.js +3 -3
- package/legacy/Slider/Slider.js +2 -3
- package/legacy/Switch/Switch.js +88 -59
- package/legacy/TabScrollButton/TabScrollButton.js +2 -3
- package/legacy/TablePagination/TablePaginationActions.js +14 -14
- package/legacy/Tabs/Tabs.js +3 -2
- package/legacy/Tooltip/Tooltip.js +7 -3
- package/legacy/index.js +1 -1
- package/legacy/styles/experimental_extendTheme.js +3 -0
- package/modern/Autocomplete/Autocomplete.js +58 -49
- package/modern/Drawer/Drawer.js +9 -3
- package/modern/LinearProgress/LinearProgress.js +4 -4
- package/modern/Menu/Menu.js +5 -4
- package/modern/MenuList/MenuList.js +4 -2
- package/modern/PaginationItem/PaginationItem.js +3 -3
- package/modern/Rating/Rating.js +3 -3
- package/modern/Slider/Slider.js +2 -3
- package/modern/Switch/Switch.js +61 -41
- package/modern/TabScrollButton/TabScrollButton.js +2 -3
- package/modern/TablePagination/TablePaginationActions.js +14 -14
- package/modern/Tabs/Tabs.js +3 -2
- package/modern/Tooltip/Tooltip.js +5 -4
- package/modern/index.js +1 -1
- package/modern/styles/experimental_extendTheme.js +3 -0
- package/node/Autocomplete/Autocomplete.js +58 -49
- package/node/Drawer/Drawer.js +9 -3
- package/node/LinearProgress/LinearProgress.js +4 -4
- package/node/Menu/Menu.js +5 -4
- package/node/MenuList/MenuList.js +4 -2
- package/node/PaginationItem/PaginationItem.js +3 -3
- package/node/Rating/Rating.js +3 -3
- package/node/Slider/Slider.js +2 -3
- package/node/Switch/Switch.js +66 -46
- package/node/TabScrollButton/TabScrollButton.js +2 -3
- package/node/TablePagination/TablePaginationActions.js +14 -14
- package/node/Tabs/Tabs.js +3 -2
- package/node/Tooltip/Tooltip.js +5 -4
- package/node/index.js +1 -1
- package/node/styles/experimental_extendTheme.js +3 -0
- package/package.json +5 -5
- package/styles/experimental_extendTheme.d.ts +1 -0
- package/styles/experimental_extendTheme.js +3 -0
- package/umd/material-ui.development.js +356 -286
- package/umd/material-ui.production.min.js +2 -2
package/legacy/Switch/Switch.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// @inheritedComponent IconButton
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
8
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
7
9
|
import * as React from 'react';
|
|
@@ -12,11 +14,11 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
12
14
|
import { alpha, darken, lighten } from '@mui/system/colorManipulator';
|
|
13
15
|
import capitalize from '../utils/capitalize';
|
|
14
16
|
import SwitchBase from '../internal/SwitchBase';
|
|
15
|
-
import
|
|
16
|
-
import styled from '../styles/styled';
|
|
17
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
17
18
|
import switchClasses, { getSwitchUtilityClass } from './switchClasses';
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
var useThemeProps = createUseThemeProps('MuiSwitch');
|
|
20
22
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
21
23
|
var classes = ownerState.classes,
|
|
22
24
|
edge = ownerState.edge,
|
|
@@ -41,40 +43,53 @@ var SwitchRoot = styled('span', {
|
|
|
41
43
|
var ownerState = props.ownerState;
|
|
42
44
|
return [styles.root, ownerState.edge && styles["edge".concat(capitalize(ownerState.edge))], styles["size".concat(capitalize(ownerState.size))]];
|
|
43
45
|
}
|
|
44
|
-
})(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
})({
|
|
47
|
+
display: 'inline-flex',
|
|
48
|
+
width: 34 + 12 * 2,
|
|
49
|
+
height: 14 + 12 * 2,
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
padding: 12,
|
|
52
|
+
boxSizing: 'border-box',
|
|
53
|
+
position: 'relative',
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
zIndex: 0,
|
|
56
|
+
// Reset the stacking context.
|
|
57
|
+
verticalAlign: 'middle',
|
|
58
|
+
// For correct alignment with the text.
|
|
59
|
+
'@media print': {
|
|
60
|
+
colorAdjust: 'exact'
|
|
61
|
+
},
|
|
62
|
+
variants: [{
|
|
63
|
+
props: {
|
|
64
|
+
edge: 'start'
|
|
65
|
+
},
|
|
66
|
+
style: {
|
|
67
|
+
marginLeft: -8
|
|
61
68
|
}
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
}, {
|
|
70
|
+
props: {
|
|
71
|
+
edge: 'end'
|
|
72
|
+
},
|
|
73
|
+
style: {
|
|
74
|
+
marginRight: -8
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
props: {
|
|
78
|
+
size: 'small'
|
|
79
|
+
},
|
|
80
|
+
style: _defineProperty(_defineProperty({
|
|
81
|
+
width: 40,
|
|
82
|
+
height: 24,
|
|
83
|
+
padding: 7
|
|
84
|
+
}, "& .".concat(switchClasses.thumb), {
|
|
85
|
+
width: 16,
|
|
86
|
+
height: 16
|
|
87
|
+
}), "& .".concat(switchClasses.switchBase), _defineProperty({
|
|
88
|
+
padding: 4
|
|
89
|
+
}, "&.".concat(switchClasses.checked), {
|
|
90
|
+
transform: 'translateX(16px)'
|
|
91
|
+
}))
|
|
92
|
+
}]
|
|
78
93
|
});
|
|
79
94
|
var SwitchSwitchBase = styled(SwitchBase, {
|
|
80
95
|
name: 'MuiSwitch',
|
|
@@ -83,8 +98,8 @@ var SwitchSwitchBase = styled(SwitchBase, {
|
|
|
83
98
|
var ownerState = props.ownerState;
|
|
84
99
|
return [styles.switchBase, _defineProperty({}, "& .".concat(switchClasses.input), styles.input), ownerState.color !== 'default' && styles["color".concat(capitalize(ownerState.color))]];
|
|
85
100
|
}
|
|
86
|
-
})(function (
|
|
87
|
-
var theme =
|
|
101
|
+
})(function (_ref2) {
|
|
102
|
+
var theme = _ref2.theme;
|
|
88
103
|
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
89
104
|
position: 'absolute',
|
|
90
105
|
top: 0,
|
|
@@ -107,30 +122,44 @@ var SwitchSwitchBase = styled(SwitchBase, {
|
|
|
107
122
|
left: '-100%',
|
|
108
123
|
width: '300%'
|
|
109
124
|
});
|
|
110
|
-
}, function (
|
|
111
|
-
var theme =
|
|
112
|
-
|
|
113
|
-
return _extends({
|
|
125
|
+
}, function (_ref4) {
|
|
126
|
+
var theme = _ref4.theme;
|
|
127
|
+
return {
|
|
114
128
|
'&:hover': {
|
|
115
129
|
backgroundColor: theme.vars ? "rgba(".concat(theme.vars.palette.action.activeChannel, " / ").concat(theme.vars.palette.action.hoverOpacity, ")") : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),
|
|
116
130
|
// Reset on touch devices, it doesn't add specificity
|
|
117
131
|
'@media (hover: none)': {
|
|
118
132
|
backgroundColor: 'transparent'
|
|
119
133
|
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
},
|
|
135
|
+
variants: _toConsumableArray(Object.entries(theme.palette).filter(function (_ref5) {
|
|
136
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
137
|
+
value = _ref6[1];
|
|
138
|
+
return value.main && value.light;
|
|
139
|
+
}) // check all the used fields in the style below
|
|
140
|
+
.map(function (_ref7) {
|
|
141
|
+
var _ref8 = _slicedToArray(_ref7, 1),
|
|
142
|
+
color = _ref8[0];
|
|
143
|
+
return {
|
|
144
|
+
props: {
|
|
145
|
+
color: color
|
|
146
|
+
},
|
|
147
|
+
style: _defineProperty(_defineProperty({}, "&.".concat(switchClasses.checked), _defineProperty({
|
|
148
|
+
color: (theme.vars || theme).palette[color].main,
|
|
149
|
+
'&:hover': {
|
|
150
|
+
backgroundColor: theme.vars ? "rgba(".concat(theme.vars.palette[color].mainChannel, " / ").concat(theme.vars.palette.action.hoverOpacity, ")") : alpha(theme.palette[color].main, theme.palette.action.hoverOpacity),
|
|
151
|
+
'@media (hover: none)': {
|
|
152
|
+
backgroundColor: 'transparent'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, "&.".concat(switchClasses.disabled), {
|
|
156
|
+
color: theme.vars ? theme.vars.palette.Switch["".concat(color, "DisabledColor")] : "".concat(theme.palette.mode === 'light' ? lighten(theme.palette[color].main, 0.62) : darken(theme.palette[color].main, 0.55))
|
|
157
|
+
})), "&.".concat(switchClasses.checked, " + .").concat(switchClasses.track), {
|
|
158
|
+
backgroundColor: (theme.vars || theme).palette[color].main
|
|
159
|
+
})
|
|
160
|
+
};
|
|
161
|
+
}))
|
|
162
|
+
};
|
|
134
163
|
});
|
|
135
164
|
var SwitchTrack = styled('span', {
|
|
136
165
|
name: 'MuiSwitch',
|
|
@@ -138,8 +167,8 @@ var SwitchTrack = styled('span', {
|
|
|
138
167
|
overridesResolver: function overridesResolver(props, styles) {
|
|
139
168
|
return styles.track;
|
|
140
169
|
}
|
|
141
|
-
})(function (
|
|
142
|
-
var theme =
|
|
170
|
+
})(function (_ref9) {
|
|
171
|
+
var theme = _ref9.theme;
|
|
143
172
|
return {
|
|
144
173
|
height: '100%',
|
|
145
174
|
width: '100%',
|
|
@@ -158,8 +187,8 @@ var SwitchThumb = styled('span', {
|
|
|
158
187
|
overridesResolver: function overridesResolver(props, styles) {
|
|
159
188
|
return styles.thumb;
|
|
160
189
|
}
|
|
161
|
-
})(function (
|
|
162
|
-
var theme =
|
|
190
|
+
})(function (_ref10) {
|
|
191
|
+
var theme = _ref10.theme;
|
|
163
192
|
return {
|
|
164
193
|
boxShadow: (theme.vars || theme).shadows[1],
|
|
165
194
|
backgroundColor: 'currentColor',
|
|
@@ -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';
|
|
@@ -64,8 +64,7 @@ var TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(inP
|
|
|
64
64
|
orientation = props.orientation,
|
|
65
65
|
disabled = props.disabled,
|
|
66
66
|
other = _objectWithoutProperties(props, ["className", "slots", "slotProps", "direction", "orientation", "disabled"]);
|
|
67
|
-
var
|
|
68
|
-
var isRtl = theme.direction === 'rtl';
|
|
67
|
+
var isRtl = useRtl();
|
|
69
68
|
var ownerState = _extends({
|
|
70
69
|
isRtl: isRtl
|
|
71
70
|
}, props);
|
|
@@ -4,9 +4,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
7
8
|
import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
|
|
8
9
|
import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
|
|
9
|
-
import useTheme from '../styles/useTheme';
|
|
10
10
|
import IconButton from '../IconButton';
|
|
11
11
|
import LastPageIconDefault from '../internal/svg-icons/LastPage';
|
|
12
12
|
import FirstPageIconDefault from '../internal/svg-icons/FirstPage';
|
|
@@ -34,7 +34,7 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
|
|
|
34
34
|
_props$slotProps = props.slotProps,
|
|
35
35
|
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
36
36
|
other = _objectWithoutProperties(props, ["backIconButtonProps", "count", "disabled", "getItemAriaLabel", "nextIconButtonProps", "onPageChange", "page", "rowsPerPage", "showFirstButton", "showLastButton", "slots", "slotProps"]);
|
|
37
|
-
var
|
|
37
|
+
var isRtl = useRtl();
|
|
38
38
|
var handleFirstPageButtonClick = function handleFirstPageButtonClick(event) {
|
|
39
39
|
onPageChange(event, 0);
|
|
40
40
|
};
|
|
@@ -55,14 +55,14 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
|
|
|
55
55
|
var LastButtonIcon = (_slots$lastButtonIcon = slots.lastButtonIcon) != null ? _slots$lastButtonIcon : LastPageIconDefault;
|
|
56
56
|
var NextButtonIcon = (_slots$nextButtonIcon = slots.nextButtonIcon) != null ? _slots$nextButtonIcon : KeyboardArrowRight;
|
|
57
57
|
var PreviousButtonIcon = (_slots$previousButton2 = slots.previousButtonIcon) != null ? _slots$previousButton2 : KeyboardArrowLeft;
|
|
58
|
-
var FirstButtonSlot =
|
|
59
|
-
var PreviousButtonSlot =
|
|
60
|
-
var NextButtonSlot =
|
|
61
|
-
var LastButtonSlot =
|
|
62
|
-
var firstButtonSlotProps =
|
|
63
|
-
var previousButtonSlotProps =
|
|
64
|
-
var nextButtonSlotProps =
|
|
65
|
-
var lastButtonSlotProps =
|
|
58
|
+
var FirstButtonSlot = isRtl ? LastButton : FirstButton;
|
|
59
|
+
var PreviousButtonSlot = isRtl ? NextButton : PreviousButton;
|
|
60
|
+
var NextButtonSlot = isRtl ? PreviousButton : NextButton;
|
|
61
|
+
var LastButtonSlot = isRtl ? FirstButton : LastButton;
|
|
62
|
+
var firstButtonSlotProps = isRtl ? slotProps.lastButton : slotProps.firstButton;
|
|
63
|
+
var previousButtonSlotProps = isRtl ? slotProps.nextButton : slotProps.previousButton;
|
|
64
|
+
var nextButtonSlotProps = isRtl ? slotProps.previousButton : slotProps.nextButton;
|
|
65
|
+
var lastButtonSlotProps = isRtl ? slotProps.firstButton : slotProps.lastButton;
|
|
66
66
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
67
67
|
ref: ref
|
|
68
68
|
}, other, {
|
|
@@ -72,7 +72,7 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
|
|
|
72
72
|
"aria-label": getItemAriaLabel('first', page),
|
|
73
73
|
title: getItemAriaLabel('first', page)
|
|
74
74
|
}, firstButtonSlotProps, {
|
|
75
|
-
children:
|
|
75
|
+
children: isRtl ? /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon)) : /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon))
|
|
76
76
|
})), /*#__PURE__*/_jsx(PreviousButtonSlot, _extends({
|
|
77
77
|
onClick: handleBackButtonClick,
|
|
78
78
|
disabled: disabled || page === 0,
|
|
@@ -80,7 +80,7 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
|
|
|
80
80
|
"aria-label": getItemAriaLabel('previous', page),
|
|
81
81
|
title: getItemAriaLabel('previous', page)
|
|
82
82
|
}, previousButtonSlotProps != null ? previousButtonSlotProps : backIconButtonProps, {
|
|
83
|
-
children:
|
|
83
|
+
children: isRtl ? /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon)) : /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon))
|
|
84
84
|
})), /*#__PURE__*/_jsx(NextButtonSlot, _extends({
|
|
85
85
|
onClick: handleNextButtonClick,
|
|
86
86
|
disabled: disabled || (count !== -1 ? page >= Math.ceil(count / rowsPerPage) - 1 : false),
|
|
@@ -88,14 +88,14 @@ var TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginat
|
|
|
88
88
|
"aria-label": getItemAriaLabel('next', page),
|
|
89
89
|
title: getItemAriaLabel('next', page)
|
|
90
90
|
}, nextButtonSlotProps != null ? nextButtonSlotProps : nextIconButtonProps, {
|
|
91
|
-
children:
|
|
91
|
+
children: isRtl ? /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon)) : /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon))
|
|
92
92
|
})), showLastButton && /*#__PURE__*/_jsx(LastButtonSlot, _extends({
|
|
93
93
|
onClick: handleLastPageButtonClick,
|
|
94
94
|
disabled: disabled || page >= Math.ceil(count / rowsPerPage) - 1,
|
|
95
95
|
"aria-label": getItemAriaLabel('last', page),
|
|
96
96
|
title: getItemAriaLabel('last', page)
|
|
97
97
|
}, lastButtonSlotProps, {
|
|
98
|
-
children:
|
|
98
|
+
children: isRtl ? /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon)) : /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon))
|
|
99
99
|
}))]
|
|
100
100
|
}));
|
|
101
101
|
});
|
package/legacy/Tabs/Tabs.js
CHANGED
|
@@ -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';
|
|
@@ -199,7 +200,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
199
200
|
name: 'MuiTabs'
|
|
200
201
|
});
|
|
201
202
|
var theme = useTheme();
|
|
202
|
-
var isRtl =
|
|
203
|
+
var isRtl = useRtl();
|
|
203
204
|
var ariaLabel = props['aria-label'],
|
|
204
205
|
ariaLabelledBy = props['aria-labelledby'],
|
|
205
206
|
action = props.action,
|
|
@@ -311,7 +312,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
311
312
|
clientWidth: tabsNode.clientWidth,
|
|
312
313
|
scrollLeft: tabsNode.scrollLeft,
|
|
313
314
|
scrollTop: tabsNode.scrollTop,
|
|
314
|
-
scrollLeftNormalized: getNormalizedScrollLeft(tabsNode,
|
|
315
|
+
scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, isRtl ? 'rtl' : 'ltr'),
|
|
315
316
|
scrollWidth: tabsNode.scrollWidth,
|
|
316
317
|
top: rect.top,
|
|
317
318
|
bottom: rect.bottom,
|
|
@@ -12,6 +12,7 @@ import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
|
12
12
|
import { appendOwnerState } from '@mui/base/utils';
|
|
13
13
|
import composeClasses from '@mui/utils/composeClasses';
|
|
14
14
|
import { alpha } from '@mui/system/colorManipulator';
|
|
15
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
15
16
|
import styled from '../styles/styled';
|
|
16
17
|
import useTheme from '../styles/useTheme';
|
|
17
18
|
import useThemeProps from '../styles/useThemeProps';
|
|
@@ -197,10 +198,13 @@ export function testReset() {
|
|
|
197
198
|
}
|
|
198
199
|
function composeEventHandler(handler, eventHandler) {
|
|
199
200
|
return function (event) {
|
|
201
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
202
|
+
params[_key - 1] = arguments[_key];
|
|
203
|
+
}
|
|
200
204
|
if (eventHandler) {
|
|
201
|
-
eventHandler(event);
|
|
205
|
+
eventHandler.apply(void 0, [event].concat(params));
|
|
202
206
|
}
|
|
203
|
-
handler(event);
|
|
207
|
+
handler.apply(void 0, [event].concat(params));
|
|
204
208
|
};
|
|
205
209
|
}
|
|
206
210
|
|
|
@@ -263,7 +267,7 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
263
267
|
children: childrenProp
|
|
264
268
|
});
|
|
265
269
|
var theme = useTheme();
|
|
266
|
-
var isRtl =
|
|
270
|
+
var isRtl = useRtl();
|
|
267
271
|
var _React$useState = React.useState(),
|
|
268
272
|
childNode = _React$useState[0],
|
|
269
273
|
setChildNode = _React$useState[1];
|
package/legacy/index.js
CHANGED
|
@@ -267,6 +267,9 @@ export default function extendTheme() {
|
|
|
267
267
|
|
|
268
268
|
// MUI X - DataGrid needs this token.
|
|
269
269
|
setColorChannel(palette.background, 'default');
|
|
270
|
+
|
|
271
|
+
// added for consistency with the `background.default` token
|
|
272
|
+
setColorChannel(palette.background, 'paper');
|
|
270
273
|
setColorChannel(palette.common, 'background');
|
|
271
274
|
setColorChannel(palette.common, 'onBackground');
|
|
272
275
|
setColorChannel(palette, 'divider');
|
|
@@ -550,6 +550,63 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
550
550
|
const paperSlotProps = slotProps.paper ?? componentsProps.paper;
|
|
551
551
|
const popperSlotProps = slotProps.popper ?? componentsProps.popper;
|
|
552
552
|
const popupIndicatorSlotProps = slotProps.popupIndicator ?? componentsProps.popupIndicator;
|
|
553
|
+
const renderAutocompletePopperChildren = children => /*#__PURE__*/_jsx(AutocompletePopper, _extends({
|
|
554
|
+
as: PopperComponent,
|
|
555
|
+
disablePortal: disablePortal,
|
|
556
|
+
style: {
|
|
557
|
+
width: anchorEl ? anchorEl.clientWidth : null
|
|
558
|
+
},
|
|
559
|
+
ownerState: ownerState,
|
|
560
|
+
role: "presentation",
|
|
561
|
+
anchorEl: anchorEl,
|
|
562
|
+
open: popupOpen
|
|
563
|
+
}, popperSlotProps, {
|
|
564
|
+
className: clsx(classes.popper, popperSlotProps?.className),
|
|
565
|
+
children: /*#__PURE__*/_jsx(AutocompletePaper, _extends({
|
|
566
|
+
ownerState: ownerState,
|
|
567
|
+
as: PaperComponent
|
|
568
|
+
}, paperSlotProps, {
|
|
569
|
+
className: clsx(classes.paper, paperSlotProps?.className),
|
|
570
|
+
children: children
|
|
571
|
+
}))
|
|
572
|
+
}));
|
|
573
|
+
let autocompletePopper = null;
|
|
574
|
+
if (!loading && groupedOptions.length > 0) {
|
|
575
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteListbox, _extends({
|
|
576
|
+
as: ListboxComponent,
|
|
577
|
+
className: classes.listbox,
|
|
578
|
+
ownerState: ownerState
|
|
579
|
+
}, otherListboxProps, ListboxProps, {
|
|
580
|
+
ref: combinedListboxRef,
|
|
581
|
+
children: groupedOptions.map((option, index) => {
|
|
582
|
+
if (groupBy) {
|
|
583
|
+
return renderGroup({
|
|
584
|
+
key: option.key,
|
|
585
|
+
group: option.group,
|
|
586
|
+
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
return renderListOption(option, index);
|
|
590
|
+
})
|
|
591
|
+
})));
|
|
592
|
+
} else if (loading && groupedOptions.length === 0) {
|
|
593
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
594
|
+
className: classes.loading,
|
|
595
|
+
ownerState: ownerState,
|
|
596
|
+
children: loadingText
|
|
597
|
+
}));
|
|
598
|
+
} else if (groupedOptions.length === 0 && !freeSolo && !loading) {
|
|
599
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
600
|
+
className: classes.noOptions,
|
|
601
|
+
ownerState: ownerState,
|
|
602
|
+
role: "presentation",
|
|
603
|
+
onMouseDown: event => {
|
|
604
|
+
// Prevent input blur when interacting with the "no options" content
|
|
605
|
+
event.preventDefault();
|
|
606
|
+
},
|
|
607
|
+
children: noOptionsText
|
|
608
|
+
}));
|
|
609
|
+
}
|
|
553
610
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
554
611
|
children: [/*#__PURE__*/_jsx(AutocompleteRoot, _extends({
|
|
555
612
|
ref: ref,
|
|
@@ -599,55 +656,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
599
656
|
readOnly
|
|
600
657
|
}, getInputProps())
|
|
601
658
|
})
|
|
602
|
-
})), anchorEl ?
|
|
603
|
-
as: PopperComponent,
|
|
604
|
-
disablePortal: disablePortal,
|
|
605
|
-
style: {
|
|
606
|
-
width: anchorEl ? anchorEl.clientWidth : null
|
|
607
|
-
},
|
|
608
|
-
ownerState: ownerState,
|
|
609
|
-
role: "presentation",
|
|
610
|
-
anchorEl: anchorEl,
|
|
611
|
-
open: popupOpen
|
|
612
|
-
}, popperSlotProps, {
|
|
613
|
-
className: clsx(classes.popper, popperSlotProps?.className),
|
|
614
|
-
children: /*#__PURE__*/_jsxs(AutocompletePaper, _extends({
|
|
615
|
-
ownerState: ownerState,
|
|
616
|
-
as: PaperComponent
|
|
617
|
-
}, paperSlotProps, {
|
|
618
|
-
className: clsx(classes.paper, paperSlotProps?.className),
|
|
619
|
-
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
620
|
-
className: classes.loading,
|
|
621
|
-
ownerState: ownerState,
|
|
622
|
-
children: loadingText
|
|
623
|
-
}) : null, groupedOptions.length === 0 && !freeSolo && !loading ? /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
624
|
-
className: classes.noOptions,
|
|
625
|
-
ownerState: ownerState,
|
|
626
|
-
role: "presentation",
|
|
627
|
-
onMouseDown: event => {
|
|
628
|
-
// Prevent input blur when interacting with the "no options" content
|
|
629
|
-
event.preventDefault();
|
|
630
|
-
},
|
|
631
|
-
children: noOptionsText
|
|
632
|
-
}) : null, groupedOptions.length > 0 ? /*#__PURE__*/_jsx(AutocompleteListbox, _extends({
|
|
633
|
-
as: ListboxComponent,
|
|
634
|
-
className: classes.listbox,
|
|
635
|
-
ownerState: ownerState
|
|
636
|
-
}, otherListboxProps, ListboxProps, {
|
|
637
|
-
ref: combinedListboxRef,
|
|
638
|
-
children: groupedOptions.map((option, index) => {
|
|
639
|
-
if (groupBy) {
|
|
640
|
-
return renderGroup({
|
|
641
|
-
key: option.key,
|
|
642
|
-
group: option.group,
|
|
643
|
-
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
return renderListOption(option, index);
|
|
647
|
-
})
|
|
648
|
-
})) : null]
|
|
649
|
-
}))
|
|
650
|
-
})) : null]
|
|
659
|
+
})), anchorEl ? autocompletePopper : null]
|
|
651
660
|
});
|
|
652
661
|
});
|
|
653
662
|
process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptypes */ = {
|
package/modern/Drawer/Drawer.js
CHANGED
|
@@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import integerPropType from '@mui/utils/integerPropType';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
13
|
import Modal from '../Modal';
|
|
13
14
|
import Slide from '../Slide';
|
|
14
15
|
import Paper from '../Paper';
|
|
@@ -119,8 +120,10 @@ const oppositeDirection = {
|
|
|
119
120
|
export function isHorizontal(anchor) {
|
|
120
121
|
return ['left', 'right'].indexOf(anchor) !== -1;
|
|
121
122
|
}
|
|
122
|
-
export function getAnchor(
|
|
123
|
-
|
|
123
|
+
export function getAnchor({
|
|
124
|
+
direction
|
|
125
|
+
}, anchor) {
|
|
126
|
+
return direction === 'rtl' && isHorizontal(anchor) ? oppositeDirection[anchor] : anchor;
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
/**
|
|
@@ -133,6 +136,7 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
|
|
|
133
136
|
name: 'MuiDrawer'
|
|
134
137
|
});
|
|
135
138
|
const theme = useTheme();
|
|
139
|
+
const isRtl = useRtl();
|
|
136
140
|
const defaultTransitionDuration = {
|
|
137
141
|
enter: theme.transitions.duration.enteringScreen,
|
|
138
142
|
exit: theme.transitions.duration.leavingScreen
|
|
@@ -166,7 +170,9 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
|
|
|
166
170
|
React.useEffect(() => {
|
|
167
171
|
mounted.current = true;
|
|
168
172
|
}, []);
|
|
169
|
-
const anchorInvariant = getAnchor(
|
|
173
|
+
const anchorInvariant = getAnchor({
|
|
174
|
+
direction: isRtl ? 'rtl' : 'ltr'
|
|
175
|
+
}, anchorProp);
|
|
170
176
|
const anchor = anchorProp;
|
|
171
177
|
const ownerState = _extends({}, props, {
|
|
172
178
|
anchor,
|
|
@@ -9,8 +9,8 @@ import clsx from 'clsx';
|
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { keyframes, css } from '@mui/system';
|
|
11
11
|
import { darken, lighten } from '@mui/system/colorManipulator';
|
|
12
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
13
|
import capitalize from '../utils/capitalize';
|
|
13
|
-
import useTheme from '../styles/useTheme';
|
|
14
14
|
import styled from '../styles/styled';
|
|
15
15
|
import useThemeProps from '../styles/useThemeProps';
|
|
16
16
|
import { getLinearProgressUtilityClass } from './linearProgressClasses';
|
|
@@ -248,7 +248,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
|
|
|
248
248
|
variant
|
|
249
249
|
});
|
|
250
250
|
const classes = useUtilityClasses(ownerState);
|
|
251
|
-
const
|
|
251
|
+
const isRtl = useRtl();
|
|
252
252
|
const rootProps = {};
|
|
253
253
|
const inlineStyles = {
|
|
254
254
|
bar1: {},
|
|
@@ -260,7 +260,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
|
|
|
260
260
|
rootProps['aria-valuemin'] = 0;
|
|
261
261
|
rootProps['aria-valuemax'] = 100;
|
|
262
262
|
let transform = value - 100;
|
|
263
|
-
if (
|
|
263
|
+
if (isRtl) {
|
|
264
264
|
transform = -transform;
|
|
265
265
|
}
|
|
266
266
|
inlineStyles.bar1.transform = `translateX(${transform}%)`;
|
|
@@ -271,7 +271,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
|
|
|
271
271
|
if (variant === 'buffer') {
|
|
272
272
|
if (valueBuffer !== undefined) {
|
|
273
273
|
let transform = (valueBuffer || 0) - 100;
|
|
274
|
-
if (
|
|
274
|
+
if (isRtl) {
|
|
275
275
|
transform = -transform;
|
|
276
276
|
}
|
|
277
277
|
inlineStyles.bar2.transform = `translateX(${transform}%)`;
|
package/modern/Menu/Menu.js
CHANGED
|
@@ -11,10 +11,10 @@ import clsx from 'clsx';
|
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
12
|
import { useSlotProps } from '@mui/base/utils';
|
|
13
13
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
14
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
14
15
|
import MenuList from '../MenuList';
|
|
15
16
|
import Popover, { PopoverPaper } from '../Popover';
|
|
16
17
|
import styled, { rootShouldForwardProp } from '../styles/styled';
|
|
17
|
-
import useTheme from '../styles/useTheme';
|
|
18
18
|
import useThemeProps from '../styles/useThemeProps';
|
|
19
19
|
import { getMenuUtilityClass } from './menuClasses';
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -88,8 +88,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
88
88
|
} = props,
|
|
89
89
|
TransitionProps = _objectWithoutPropertiesLoose(props.TransitionProps, _excluded),
|
|
90
90
|
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
91
|
-
const
|
|
92
|
-
const isRtl = theme.direction === 'rtl';
|
|
91
|
+
const isRtl = useRtl();
|
|
93
92
|
const ownerState = _extends({}, props, {
|
|
94
93
|
autoFocus,
|
|
95
94
|
disableAutoFocusItem,
|
|
@@ -105,7 +104,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
105
104
|
const menuListActionsRef = React.useRef(null);
|
|
106
105
|
const handleEntering = (element, isAppearing) => {
|
|
107
106
|
if (menuListActionsRef.current) {
|
|
108
|
-
menuListActionsRef.current.adjustStyleForScrollbar(element,
|
|
107
|
+
menuListActionsRef.current.adjustStyleForScrollbar(element, {
|
|
108
|
+
direction: isRtl ? 'rtl' : 'ltr'
|
|
109
|
+
});
|
|
109
110
|
}
|
|
110
111
|
if (onEntering) {
|
|
111
112
|
onEntering(element, isAppearing);
|
|
@@ -107,13 +107,15 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
107
107
|
}
|
|
108
108
|
}, [autoFocus]);
|
|
109
109
|
React.useImperativeHandle(actions, () => ({
|
|
110
|
-
adjustStyleForScrollbar: (containerElement,
|
|
110
|
+
adjustStyleForScrollbar: (containerElement, {
|
|
111
|
+
direction
|
|
112
|
+
}) => {
|
|
111
113
|
// Let's ignore that piece of logic if users are already overriding the width
|
|
112
114
|
// of the menu.
|
|
113
115
|
const noExplicitWidth = !listRef.current.style.width;
|
|
114
116
|
if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
|
|
115
117
|
const scrollbarSize = `${getScrollbarSize(ownerDocument(containerElement))}px`;
|
|
116
|
-
listRef.current.style[
|
|
118
|
+
listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
|
|
117
119
|
listRef.current.style.width = `calc(100% + ${scrollbarSize})`;
|
|
118
120
|
}
|
|
119
121
|
return listRef.current;
|