@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
|
@@ -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';
|
|
@@ -34,7 +34,7 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
34
34
|
slotProps = {}
|
|
35
35
|
} = props,
|
|
36
36
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
37
|
-
const
|
|
37
|
+
const isRtl = useRtl();
|
|
38
38
|
const handleFirstPageButtonClick = event => {
|
|
39
39
|
onPageChange(event, 0);
|
|
40
40
|
};
|
|
@@ -55,14 +55,14 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
55
55
|
const LastButtonIcon = (_slots$lastButtonIcon = slots.lastButtonIcon) != null ? _slots$lastButtonIcon : LastPageIconDefault;
|
|
56
56
|
const NextButtonIcon = (_slots$nextButtonIcon = slots.nextButtonIcon) != null ? _slots$nextButtonIcon : KeyboardArrowRight;
|
|
57
57
|
const PreviousButtonIcon = (_slots$previousButton2 = slots.previousButtonIcon) != null ? _slots$previousButton2 : KeyboardArrowLeft;
|
|
58
|
-
const FirstButtonSlot =
|
|
59
|
-
const PreviousButtonSlot =
|
|
60
|
-
const NextButtonSlot =
|
|
61
|
-
const LastButtonSlot =
|
|
62
|
-
const firstButtonSlotProps =
|
|
63
|
-
const previousButtonSlotProps =
|
|
64
|
-
const nextButtonSlotProps =
|
|
65
|
-
const lastButtonSlotProps =
|
|
58
|
+
const FirstButtonSlot = isRtl ? LastButton : FirstButton;
|
|
59
|
+
const PreviousButtonSlot = isRtl ? NextButton : PreviousButton;
|
|
60
|
+
const NextButtonSlot = isRtl ? PreviousButton : NextButton;
|
|
61
|
+
const LastButtonSlot = isRtl ? FirstButton : LastButton;
|
|
62
|
+
const firstButtonSlotProps = isRtl ? slotProps.lastButton : slotProps.firstButton;
|
|
63
|
+
const previousButtonSlotProps = isRtl ? slotProps.nextButton : slotProps.previousButton;
|
|
64
|
+
const nextButtonSlotProps = isRtl ? slotProps.previousButton : slotProps.nextButton;
|
|
65
|
+
const lastButtonSlotProps = isRtl ? slotProps.firstButton : slotProps.lastButton;
|
|
66
66
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
67
67
|
ref: ref
|
|
68
68
|
}, other, {
|
|
@@ -72,7 +72,7 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
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 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
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 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
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/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';
|
|
@@ -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 =
|
|
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,
|
|
301
|
+
scrollLeftNormalized: getNormalizedScrollLeft(tabsNode, isRtl ? 'rtl' : 'ltr'),
|
|
301
302
|
scrollWidth: tabsNode.scrollWidth,
|
|
302
303
|
top: rect.top,
|
|
303
304
|
bottom: rect.bottom,
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -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
|
|
|
@@ -257,7 +258,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
257
258
|
children: childrenProp
|
|
258
259
|
});
|
|
259
260
|
const theme = useTheme();
|
|
260
|
-
const isRtl =
|
|
261
|
+
const isRtl = useRtl();
|
|
261
262
|
const [childNode, setChildNode] = React.useState();
|
|
262
263
|
const [arrowRef, setArrowRef] = React.useState(null);
|
|
263
264
|
const ignoreNonTouchEvents = React.useRef(false);
|
package/index.js
CHANGED
|
@@ -566,6 +566,67 @@ var Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps,
|
|
|
566
566
|
var paperSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : componentsProps.paper;
|
|
567
567
|
var popperSlotProps = (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper;
|
|
568
568
|
var popupIndicatorSlotProps = (_slotProps$popupIndic = slotProps.popupIndicator) != null ? _slotProps$popupIndic : componentsProps.popupIndicator;
|
|
569
|
+
var renderAutocompletePopperChildren = function renderAutocompletePopperChildren(children) {
|
|
570
|
+
return /*#__PURE__*/_jsx(AutocompletePopper, _extends({
|
|
571
|
+
as: PopperComponent,
|
|
572
|
+
disablePortal: disablePortal,
|
|
573
|
+
style: {
|
|
574
|
+
width: anchorEl ? anchorEl.clientWidth : null
|
|
575
|
+
},
|
|
576
|
+
ownerState: ownerState,
|
|
577
|
+
role: "presentation",
|
|
578
|
+
anchorEl: anchorEl,
|
|
579
|
+
open: popupOpen
|
|
580
|
+
}, popperSlotProps, {
|
|
581
|
+
className: clsx(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
|
|
582
|
+
children: /*#__PURE__*/_jsx(AutocompletePaper, _extends({
|
|
583
|
+
ownerState: ownerState,
|
|
584
|
+
as: PaperComponent
|
|
585
|
+
}, paperSlotProps, {
|
|
586
|
+
className: clsx(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
|
|
587
|
+
children: children
|
|
588
|
+
}))
|
|
589
|
+
}));
|
|
590
|
+
};
|
|
591
|
+
var autocompletePopper = null;
|
|
592
|
+
if (!loading && groupedOptions.length > 0) {
|
|
593
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteListbox, _extends({
|
|
594
|
+
as: ListboxComponent,
|
|
595
|
+
className: classes.listbox,
|
|
596
|
+
ownerState: ownerState
|
|
597
|
+
}, otherListboxProps, ListboxProps, {
|
|
598
|
+
ref: combinedListboxRef,
|
|
599
|
+
children: groupedOptions.map(function (option, index) {
|
|
600
|
+
if (groupBy) {
|
|
601
|
+
return renderGroup({
|
|
602
|
+
key: option.key,
|
|
603
|
+
group: option.group,
|
|
604
|
+
children: option.options.map(function (option2, index2) {
|
|
605
|
+
return renderListOption(option2, option.index + index2);
|
|
606
|
+
})
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
return renderListOption(option, index);
|
|
610
|
+
})
|
|
611
|
+
})));
|
|
612
|
+
} else if (loading && groupedOptions.length === 0) {
|
|
613
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
614
|
+
className: classes.loading,
|
|
615
|
+
ownerState: ownerState,
|
|
616
|
+
children: loadingText
|
|
617
|
+
}));
|
|
618
|
+
} else if (groupedOptions.length === 0 && !freeSolo && !loading) {
|
|
619
|
+
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
620
|
+
className: classes.noOptions,
|
|
621
|
+
ownerState: ownerState,
|
|
622
|
+
role: "presentation",
|
|
623
|
+
onMouseDown: function onMouseDown(event) {
|
|
624
|
+
// Prevent input blur when interacting with the "no options" content
|
|
625
|
+
event.preventDefault();
|
|
626
|
+
},
|
|
627
|
+
children: noOptionsText
|
|
628
|
+
}));
|
|
629
|
+
}
|
|
569
630
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
570
631
|
children: [/*#__PURE__*/_jsx(AutocompleteRoot, _extends({
|
|
571
632
|
ref: ref,
|
|
@@ -615,57 +676,7 @@ var Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps,
|
|
|
615
676
|
readOnly: readOnly
|
|
616
677
|
}, getInputProps())
|
|
617
678
|
})
|
|
618
|
-
})), anchorEl ?
|
|
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: clsx(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
|
|
630
|
-
children: /*#__PURE__*/_jsxs(AutocompletePaper, _extends({
|
|
631
|
-
ownerState: ownerState,
|
|
632
|
-
as: PaperComponent
|
|
633
|
-
}, paperSlotProps, {
|
|
634
|
-
className: clsx(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
|
|
635
|
-
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
636
|
-
className: classes.loading,
|
|
637
|
-
ownerState: ownerState,
|
|
638
|
-
children: loadingText
|
|
639
|
-
}) : null, groupedOptions.length === 0 && !freeSolo && !loading ? /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
640
|
-
className: classes.noOptions,
|
|
641
|
-
ownerState: ownerState,
|
|
642
|
-
role: "presentation",
|
|
643
|
-
onMouseDown: function 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__*/_jsx(AutocompleteListbox, _extends({
|
|
649
|
-
as: ListboxComponent,
|
|
650
|
-
className: classes.listbox,
|
|
651
|
-
ownerState: ownerState
|
|
652
|
-
}, otherListboxProps, ListboxProps, {
|
|
653
|
-
ref: combinedListboxRef,
|
|
654
|
-
children: groupedOptions.map(function (option, index) {
|
|
655
|
-
if (groupBy) {
|
|
656
|
-
return renderGroup({
|
|
657
|
-
key: option.key,
|
|
658
|
-
group: option.group,
|
|
659
|
-
children: option.options.map(function (option2, index2) {
|
|
660
|
-
return renderListOption(option2, option.index + index2);
|
|
661
|
-
})
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
return renderListOption(option, index);
|
|
665
|
-
})
|
|
666
|
-
})) : null]
|
|
667
|
-
}))
|
|
668
|
-
})) : null]
|
|
679
|
+
})), anchorEl ? autocompletePopper : null]
|
|
669
680
|
});
|
|
670
681
|
});
|
|
671
682
|
process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptypes */ = {
|
package/legacy/Drawer/Drawer.js
CHANGED
|
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import integerPropType from '@mui/utils/integerPropType';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
10
11
|
import Modal from '../Modal';
|
|
11
12
|
import Slide from '../Slide';
|
|
12
13
|
import Paper from '../Paper';
|
|
@@ -113,8 +114,9 @@ var oppositeDirection = {
|
|
|
113
114
|
export function isHorizontal(anchor) {
|
|
114
115
|
return ['left', 'right'].indexOf(anchor) !== -1;
|
|
115
116
|
}
|
|
116
|
-
export function getAnchor(
|
|
117
|
-
|
|
117
|
+
export function getAnchor(_ref3, anchor) {
|
|
118
|
+
var direction = _ref3.direction;
|
|
119
|
+
return direction === 'rtl' && isHorizontal(anchor) ? oppositeDirection[anchor] : anchor;
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
/**
|
|
@@ -127,6 +129,7 @@ var Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
|
|
|
127
129
|
name: 'MuiDrawer'
|
|
128
130
|
});
|
|
129
131
|
var theme = useTheme();
|
|
132
|
+
var isRtl = useRtl();
|
|
130
133
|
var defaultTransitionDuration = {
|
|
131
134
|
enter: theme.transitions.duration.enteringScreen,
|
|
132
135
|
exit: theme.transitions.duration.leavingScreen
|
|
@@ -163,7 +166,9 @@ var Drawer = /*#__PURE__*/React.forwardRef(function Drawer(inProps, ref) {
|
|
|
163
166
|
React.useEffect(function () {
|
|
164
167
|
mounted.current = true;
|
|
165
168
|
}, []);
|
|
166
|
-
var anchorInvariant = getAnchor(
|
|
169
|
+
var anchorInvariant = getAnchor({
|
|
170
|
+
direction: isRtl ? 'rtl' : 'ltr'
|
|
171
|
+
}, anchorProp);
|
|
167
172
|
var anchor = anchorProp;
|
|
168
173
|
var ownerState = _extends({}, props, {
|
|
169
174
|
anchor: anchor,
|
|
@@ -10,8 +10,8 @@ import clsx from 'clsx';
|
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
11
|
import { keyframes, css } from '@mui/system';
|
|
12
12
|
import { darken, lighten } from '@mui/system/colorManipulator';
|
|
13
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
13
14
|
import capitalize from '../utils/capitalize';
|
|
14
|
-
import useTheme from '../styles/useTheme';
|
|
15
15
|
import styled from '../styles/styled';
|
|
16
16
|
import useThemeProps from '../styles/useThemeProps';
|
|
17
17
|
import { getLinearProgressUtilityClass } from './linearProgressClasses';
|
|
@@ -190,7 +190,7 @@ var LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inPro
|
|
|
190
190
|
variant: variant
|
|
191
191
|
});
|
|
192
192
|
var classes = useUtilityClasses(ownerState);
|
|
193
|
-
var
|
|
193
|
+
var isRtl = useRtl();
|
|
194
194
|
var rootProps = {};
|
|
195
195
|
var inlineStyles = {
|
|
196
196
|
bar1: {},
|
|
@@ -202,7 +202,7 @@ var LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inPro
|
|
|
202
202
|
rootProps['aria-valuemin'] = 0;
|
|
203
203
|
rootProps['aria-valuemax'] = 100;
|
|
204
204
|
var transform = value - 100;
|
|
205
|
-
if (
|
|
205
|
+
if (isRtl) {
|
|
206
206
|
transform = -transform;
|
|
207
207
|
}
|
|
208
208
|
inlineStyles.bar1.transform = "translateX(".concat(transform, "%)");
|
|
@@ -213,7 +213,7 @@ var LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inPro
|
|
|
213
213
|
if (variant === 'buffer') {
|
|
214
214
|
if (valueBuffer !== undefined) {
|
|
215
215
|
var _transform = (valueBuffer || 0) - 100;
|
|
216
|
-
if (
|
|
216
|
+
if (isRtl) {
|
|
217
217
|
_transform = -_transform;
|
|
218
218
|
}
|
|
219
219
|
inlineStyles.bar2.transform = "translateX(".concat(_transform, "%)");
|
package/legacy/Menu/Menu.js
CHANGED
|
@@ -9,10 +9,10 @@ import clsx from 'clsx';
|
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
11
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
12
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
13
|
import MenuList from '../MenuList';
|
|
13
14
|
import Popover, { PopoverPaper } from '../Popover';
|
|
14
15
|
import styled, { rootShouldForwardProp } from '../styles/styled';
|
|
15
|
-
import useTheme from '../styles/useTheme';
|
|
16
16
|
import useThemeProps from '../styles/useThemeProps';
|
|
17
17
|
import { getMenuUtilityClass } from './menuClasses';
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -99,8 +99,7 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
99
99
|
_props$slotProps = props.slotProps,
|
|
100
100
|
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
101
101
|
other = _objectWithoutProperties(props, ["autoFocus", "children", "className", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "PaperProps", "PopoverClasses", "transitionDuration", "TransitionProps", "variant", "slots", "slotProps"]);
|
|
102
|
-
var
|
|
103
|
-
var isRtl = theme.direction === 'rtl';
|
|
102
|
+
var isRtl = useRtl();
|
|
104
103
|
var ownerState = _extends({}, props, {
|
|
105
104
|
autoFocus: autoFocus,
|
|
106
105
|
disableAutoFocusItem: disableAutoFocusItem,
|
|
@@ -116,7 +115,9 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
116
115
|
var menuListActionsRef = React.useRef(null);
|
|
117
116
|
var handleEntering = function handleEntering(element, isAppearing) {
|
|
118
117
|
if (menuListActionsRef.current) {
|
|
119
|
-
menuListActionsRef.current.adjustStyleForScrollbar(element,
|
|
118
|
+
menuListActionsRef.current.adjustStyleForScrollbar(element, {
|
|
119
|
+
direction: isRtl ? 'rtl' : 'ltr'
|
|
120
|
+
});
|
|
120
121
|
}
|
|
121
122
|
if (onEntering) {
|
|
122
123
|
onEntering(element, isAppearing);
|
|
@@ -108,13 +108,14 @@ var MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
108
108
|
}, [autoFocus]);
|
|
109
109
|
React.useImperativeHandle(actions, function () {
|
|
110
110
|
return {
|
|
111
|
-
adjustStyleForScrollbar: function adjustStyleForScrollbar(containerElement,
|
|
111
|
+
adjustStyleForScrollbar: function adjustStyleForScrollbar(containerElement, _ref) {
|
|
112
|
+
var direction = _ref.direction;
|
|
112
113
|
// Let's ignore that piece of logic if users are already overriding the width
|
|
113
114
|
// of the menu.
|
|
114
115
|
var noExplicitWidth = !listRef.current.style.width;
|
|
115
116
|
if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
|
|
116
117
|
var scrollbarSize = "".concat(getScrollbarSize(ownerDocument(containerElement)), "px");
|
|
117
|
-
listRef.current.style[
|
|
118
|
+
listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
|
|
118
119
|
listRef.current.style.width = "calc(100% + ".concat(scrollbarSize, ")");
|
|
119
120
|
}
|
|
120
121
|
return listRef.current;
|
|
@@ -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';
|
|
@@ -226,9 +226,9 @@ var PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inPro
|
|
|
226
226
|
type: type,
|
|
227
227
|
variant: variant
|
|
228
228
|
});
|
|
229
|
-
var
|
|
229
|
+
var isRtl = useRtl();
|
|
230
230
|
var classes = useUtilityClasses(ownerState);
|
|
231
|
-
var normalizedIcons =
|
|
231
|
+
var normalizedIcons = isRtl ? {
|
|
232
232
|
previous: slots.next || components.next || NavigateNextIcon,
|
|
233
233
|
next: slots.previous || components.previous || NavigateBeforeIcon,
|
|
234
234
|
last: slots.first || components.first || FirstPageIcon,
|
package/legacy/Rating/Rating.js
CHANGED
|
@@ -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
|
|
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';
|
|
@@ -306,7 +306,7 @@ var Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
306
306
|
valueDerived = _useControlled2[0],
|
|
307
307
|
setValueState = _useControlled2[1];
|
|
308
308
|
var valueRounded = roundValueToPrecision(valueDerived, precision);
|
|
309
|
-
var
|
|
309
|
+
var isRtl = useRtl();
|
|
310
310
|
var _React$useState = React.useState({
|
|
311
311
|
hover: -1,
|
|
312
312
|
focus: -1
|
|
@@ -342,7 +342,7 @@ var Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
342
342
|
left = _rootNode$getBounding.left,
|
|
343
343
|
containerWidth = _rootNode$getBounding.width;
|
|
344
344
|
var percent;
|
|
345
|
-
if (
|
|
345
|
+
if (isRtl) {
|
|
346
346
|
percent = (right - event.clientX) / containerWidth;
|
|
347
347
|
} else {
|
|
348
348
|
percent = (event.clientX - left) / containerWidth;
|
package/legacy/Slider/Slider.js
CHANGED
|
@@ -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 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
370
370
|
props: inputProps,
|
|
371
371
|
name: 'MuiSlider'
|
|
372
372
|
});
|
|
373
|
-
var
|
|
374
|
-
var isRtl = theme.direction === 'rtl';
|
|
373
|
+
var isRtl = useRtl();
|
|
375
374
|
var ariaLabel = props['aria-label'],
|
|
376
375
|
ariaValuetext = props['aria-valuetext'],
|
|
377
376
|
ariaLabelledby = props['aria-labelledby'],
|