@mui/material 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.d.mts +2 -2
- package/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.js +3 -2
- package/Accordion/Accordion.mjs +3 -2
- package/AccordionSummary/AccordionSummary.js +27 -29
- package/AccordionSummary/AccordionSummary.mjs +27 -29
- package/Autocomplete/Autocomplete.js +73 -17
- package/Autocomplete/Autocomplete.mjs +73 -17
- package/Avatar/Avatar.js +4 -0
- package/Avatar/Avatar.mjs +4 -0
- package/Backdrop/Backdrop.d.mts +2 -2
- package/Backdrop/Backdrop.d.ts +2 -2
- package/Badge/Badge.js +31 -24
- package/Badge/Badge.mjs +31 -24
- package/BottomNavigationAction/BottomNavigationAction.js +6 -2
- package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
- package/Button/Button.js +19 -6
- package/Button/Button.mjs +19 -6
- package/ButtonBase/ButtonBase.d.mts +7 -0
- package/ButtonBase/ButtonBase.d.ts +7 -0
- package/ButtonBase/ButtonBase.js +5 -2
- package/ButtonBase/ButtonBase.mjs +5 -2
- package/ButtonBase/Ripple.js +21 -11
- package/ButtonBase/Ripple.mjs +21 -11
- package/ButtonBase/TouchRipple.js +252 -116
- package/ButtonBase/TouchRipple.mjs +253 -117
- package/CHANGELOG.md +216 -1245
- package/CardActionArea/CardActionArea.js +2 -1
- package/CardActionArea/CardActionArea.mjs +2 -1
- package/Checkbox/Checkbox.js +2 -1
- package/Checkbox/Checkbox.mjs +2 -1
- package/Chip/Chip.js +2 -1
- package/Chip/Chip.mjs +2 -1
- package/CircularProgress/CircularProgress.d.mts +12 -2
- package/CircularProgress/CircularProgress.d.ts +12 -2
- package/CircularProgress/CircularProgress.js +115 -58
- package/CircularProgress/CircularProgress.mjs +114 -58
- package/ClickAwayListener/ClickAwayListener.js +3 -6
- package/ClickAwayListener/ClickAwayListener.mjs +3 -6
- package/Collapse/Collapse.d.mts +15 -3
- package/Collapse/Collapse.d.ts +15 -3
- package/Collapse/Collapse.js +44 -31
- package/Collapse/Collapse.mjs +43 -30
- package/Dialog/Dialog.d.mts +2 -2
- package/Dialog/Dialog.d.ts +2 -2
- package/Dialog/Dialog.js +13 -6
- package/Dialog/Dialog.mjs +13 -6
- package/Drawer/Drawer.d.mts +2 -2
- package/Drawer/Drawer.d.ts +2 -2
- package/Drawer/Drawer.js +18 -4
- package/Drawer/Drawer.mjs +18 -4
- package/Fab/Fab.js +9 -2
- package/Fab/Fab.mjs +9 -2
- package/Fade/Fade.d.mts +15 -2
- package/Fade/Fade.d.ts +15 -2
- package/Fade/Fade.js +46 -19
- package/Fade/Fade.mjs +45 -18
- package/FilledInput/FilledInput.d.mts +4 -0
- package/FilledInput/FilledInput.d.ts +4 -0
- package/FilledInput/FilledInput.js +22 -23
- package/FilledInput/FilledInput.mjs +22 -23
- package/FormControl/useFormControl.d.mts +12 -2
- package/FormControl/useFormControl.d.ts +12 -2
- package/FormControl/useFormControl.js +13 -0
- package/FormControl/useFormControl.mjs +12 -0
- package/FormControlLabel/FormControlLabel.js +5 -8
- package/FormControlLabel/FormControlLabel.mjs +5 -8
- package/FormGroup/FormGroup.js +2 -5
- package/FormGroup/FormGroup.mjs +2 -5
- package/FormHelperText/FormHelperText.js +2 -5
- package/FormHelperText/FormHelperText.mjs +2 -5
- package/FormLabel/FormLabel.js +2 -5
- package/FormLabel/FormLabel.mjs +2 -5
- package/Grow/Grow.d.mts +15 -2
- package/Grow/Grow.d.ts +15 -2
- package/Grow/Grow.js +45 -28
- package/Grow/Grow.mjs +44 -27
- package/IconButton/IconButton.js +3 -9
- package/IconButton/IconButton.mjs +3 -9
- package/Input/Input.d.mts +4 -0
- package/Input/Input.d.ts +4 -0
- package/Input/Input.js +9 -2
- package/Input/Input.mjs +9 -2
- package/InputBase/InputBase.d.mts +2 -1
- package/InputBase/InputBase.d.ts +2 -1
- package/InputBase/InputBase.js +52 -16
- package/InputBase/InputBase.mjs +52 -16
- package/InputLabel/InputLabel.js +7 -9
- package/InputLabel/InputLabel.mjs +7 -9
- package/LICENSE +1 -1
- package/LinearProgress/LinearProgress.d.mts +12 -2
- package/LinearProgress/LinearProgress.d.ts +12 -2
- package/LinearProgress/LinearProgress.js +225 -126
- package/LinearProgress/LinearProgress.mjs +224 -126
- package/List/List.js +2 -1
- package/List/List.mjs +2 -1
- package/ListItem/ListItem.js +2 -1
- package/ListItem/ListItem.mjs +2 -1
- package/ListItemButton/ListItemButton.js +9 -2
- package/ListItemButton/ListItemButton.mjs +9 -2
- package/Menu/Menu.d.mts +1 -1
- package/Menu/Menu.d.ts +1 -1
- package/MenuItem/MenuItem.js +7 -1
- package/MenuItem/MenuItem.mjs +7 -1
- package/MenuList/MenuList.js +2 -1
- package/MenuList/MenuList.mjs +2 -1
- package/MobileStepper/MobileStepper.js +2 -1
- package/MobileStepper/MobileStepper.mjs +2 -1
- package/NativeSelect/NativeSelect.js +2 -5
- package/NativeSelect/NativeSelect.mjs +2 -5
- package/OutlinedInput/NotchedOutline.js +4 -3
- package/OutlinedInput/NotchedOutline.mjs +4 -3
- package/OutlinedInput/OutlinedInput.js +13 -23
- package/OutlinedInput/OutlinedInput.mjs +13 -23
- package/PaginationItem/PaginationItem.js +2 -1
- package/PaginationItem/PaginationItem.mjs +2 -1
- package/Paper/Paper.js +2 -1
- package/Paper/Paper.mjs +2 -1
- package/PigmentContainer/PigmentContainer.js +0 -1
- package/PigmentContainer/PigmentContainer.mjs +0 -1
- package/Popover/Popover.d.mts +1 -1
- package/Popover/Popover.d.ts +1 -1
- package/Popper/BasePopper.js +23 -1
- package/Popper/BasePopper.mjs +23 -1
- package/README.md +3 -2
- package/Radio/RadioButtonIcon.js +3 -2
- package/Radio/RadioButtonIcon.mjs +3 -2
- package/Rating/Rating.js +2 -1
- package/Rating/Rating.mjs +2 -1
- package/Select/Select.js +2 -5
- package/Select/Select.mjs +2 -5
- package/Select/SelectInput.js +276 -24
- package/Select/SelectInput.mjs +276 -24
- package/Select/utils/closedTypeahead.js +73 -0
- package/Select/utils/closedTypeahead.mjs +63 -0
- package/Skeleton/Skeleton.js +22 -2
- package/Skeleton/Skeleton.mjs +22 -2
- package/Slide/Slide.d.mts +15 -2
- package/Slide/Slide.d.ts +15 -2
- package/Slide/Slide.js +97 -47
- package/Slide/Slide.mjs +97 -47
- package/Slider/Slider.js +14 -4
- package/Slider/Slider.mjs +14 -4
- package/Slider/useSlider.js +4 -3
- package/Slider/useSlider.mjs +4 -3
- package/Snackbar/Snackbar.d.mts +2 -2
- package/Snackbar/Snackbar.d.ts +2 -2
- package/SpeedDial/SpeedDial.d.mts +1 -1
- package/SpeedDial/SpeedDial.d.ts +1 -1
- package/SpeedDial/SpeedDial.js +6 -2
- package/SpeedDial/SpeedDial.mjs +6 -2
- package/SpeedDialAction/SpeedDialAction.js +11 -2
- package/SpeedDialAction/SpeedDialAction.mjs +12 -3
- package/SpeedDialIcon/SpeedDialIcon.js +40 -37
- package/SpeedDialIcon/SpeedDialIcon.mjs +40 -37
- package/Step/Step.js +47 -15
- package/Step/Step.mjs +47 -15
- package/StepButton/StepButton.js +9 -3
- package/StepButton/StepButton.mjs +9 -3
- package/StepConnector/StepConnector.js +10 -0
- package/StepConnector/StepConnector.mjs +10 -0
- package/StepContent/StepContent.d.mts +2 -2
- package/StepContent/StepContent.d.ts +2 -2
- package/StepContent/StepContent.js +26 -2
- package/StepContent/StepContent.mjs +26 -2
- package/StepIcon/StepIcon.js +2 -1
- package/StepIcon/StepIcon.mjs +2 -1
- package/StepLabel/StepLabel.js +52 -7
- package/StepLabel/StepLabel.mjs +52 -7
- package/Stepper/Stepper.d.mts +2 -0
- package/Stepper/Stepper.d.ts +2 -0
- package/Stepper/Stepper.js +18 -0
- package/Stepper/Stepper.mjs +18 -0
- package/SvgIcon/SvgIcon.js +2 -1
- package/SvgIcon/SvgIcon.mjs +2 -1
- package/SwipeableDrawer/SwipeableDrawer.js +21 -6
- package/SwipeableDrawer/SwipeableDrawer.mjs +21 -6
- package/Switch/Switch.js +10 -8
- package/Switch/Switch.mjs +10 -8
- package/TableSortLabel/TableSortLabel.js +2 -1
- package/TableSortLabel/TableSortLabel.mjs +2 -1
- package/Tabs/ScrollbarSize.js +2 -1
- package/Tabs/ScrollbarSize.mjs +2 -1
- package/Tabs/Tabs.js +16 -4
- package/Tabs/Tabs.mjs +16 -4
- package/Tooltip/Tooltip.d.mts +2 -2
- package/Tooltip/Tooltip.d.ts +2 -2
- package/Tooltip/Tooltip.js +29 -108
- package/Tooltip/Tooltip.mjs +29 -108
- package/Unstable_TrapFocus/FocusTrap.js +60 -22
- package/Unstable_TrapFocus/FocusTrap.mjs +60 -22
- package/Zoom/Zoom.d.mts +15 -2
- package/Zoom/Zoom.d.ts +15 -2
- package/Zoom/Zoom.js +43 -16
- package/Zoom/Zoom.mjs +42 -15
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internal/Transition.d.mts +34 -0
- package/internal/Transition.d.ts +34 -0
- package/internal/Transition.js +444 -0
- package/internal/Transition.mjs +436 -0
- package/internal/react-transition-group.d.mts +8 -0
- package/internal/react-transition-group.d.ts +8 -0
- package/package.json +50 -50
- package/styles/createMotion.d.mts +8 -0
- package/styles/createMotion.d.ts +8 -0
- package/styles/createMotion.js +13 -0
- package/styles/createMotion.mjs +7 -0
- package/styles/createThemeFoundation.d.mts +2 -0
- package/styles/createThemeFoundation.d.ts +2 -0
- package/styles/createThemeNoVars.d.mts +3 -0
- package/styles/createThemeNoVars.d.ts +3 -0
- package/styles/createThemeNoVars.js +5 -0
- package/styles/createThemeNoVars.mjs +5 -0
- package/styles/createTransitions.d.mts +6 -2
- package/styles/createTransitions.d.ts +6 -2
- package/styles/createTransitions.js +12 -4
- package/styles/createTransitions.mjs +12 -4
- package/styles/enhanceHighContrast.d.mts +70 -0
- package/styles/enhanceHighContrast.d.ts +70 -0
- package/styles/enhanceHighContrast.js +502 -0
- package/styles/enhanceHighContrast.mjs +495 -0
- package/styles/index.d.mts +2 -0
- package/styles/index.d.ts +2 -0
- package/styles/index.js +8 -0
- package/styles/index.mjs +1 -0
- package/styles/reducedMotion.d.mts +7 -0
- package/styles/reducedMotion.d.ts +7 -0
- package/styles/reducedMotion.js +21 -0
- package/styles/reducedMotion.mjs +14 -0
- package/styles/responsiveFontSizes.js +19 -8
- package/styles/responsiveFontSizes.mjs +19 -8
- package/styles/shouldSkipGeneratingVar.js +1 -1
- package/styles/shouldSkipGeneratingVar.mjs +1 -1
- package/styles/stringifyTheme.js +1 -0
- package/styles/stringifyTheme.mjs +1 -0
- package/styles/useThemeProps.d.mts +3 -3
- package/styles/useThemeProps.d.ts +3 -3
- package/transitions/index.d.mts +1 -1
- package/transitions/index.d.ts +1 -1
- package/transitions/index.js +0 -11
- package/transitions/index.mjs +1 -1
- package/transitions/transition.d.mts +1 -12
- package/transitions/transition.d.ts +1 -12
- package/transitions/types.d.mts +73 -0
- package/transitions/types.d.ts +73 -0
- package/transitions/useReducedMotion.d.mts +14 -0
- package/transitions/useReducedMotion.d.ts +14 -0
- package/transitions/useReducedMotion.js +117 -0
- package/transitions/useReducedMotion.mjs +110 -0
- package/transitions/utils.d.mts +51 -2
- package/transitions/utils.d.ts +51 -2
- package/transitions/utils.js +97 -4
- package/transitions/utils.mjs +94 -4
- package/useAutocomplete/useAutocomplete.d.mts +12 -6
- package/useAutocomplete/useAutocomplete.d.ts +12 -6
- package/useAutocomplete/useAutocomplete.js +230 -55
- package/useAutocomplete/useAutocomplete.mjs +230 -55
- package/utils/contains.d.mts +2 -0
- package/utils/contains.d.ts +2 -0
- package/utils/contains.js +9 -0
- package/utils/contains.mjs +2 -0
- package/utils/focusable.d.mts +7 -0
- package/utils/focusable.d.ts +7 -0
- package/utils/focusable.js +20 -0
- package/utils/focusable.mjs +13 -0
- package/utils/getEventTarget.d.mts +2 -0
- package/utils/getEventTarget.d.ts +2 -0
- package/utils/getEventTarget.js +9 -0
- package/utils/getEventTarget.mjs +2 -0
- package/utils/mergeSlotProps.js +2 -8
- package/utils/mergeSlotProps.mjs +1 -8
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
- package/FormControl/formControlState.js +0 -21
- package/FormControl/formControlState.mjs +0 -15
- /package/transitions/{transition.js → types.js} +0 -0
- /package/transitions/{transition.mjs → types.mjs} +0 -0
package/Tooltip/Tooltip.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PopperProps } from "../Popper/index.js";
|
|
|
4
4
|
import { Theme } from "../styles/index.js";
|
|
5
5
|
import { InternalStandardProps as StandardProps } from "../internal/index.js";
|
|
6
6
|
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
7
|
-
import { TransitionProps } from "../transitions/
|
|
7
|
+
import { TransitionProps } from "../transitions/types.js";
|
|
8
8
|
import { TooltipClasses } from "./tooltipClasses.js";
|
|
9
9
|
export interface TooltipPopperSlotPropsOverrides {}
|
|
10
10
|
export interface TooltipTransitionSlotPropsOverrides {}
|
|
@@ -18,7 +18,7 @@ export interface TooltipSlots {
|
|
|
18
18
|
popper: React.ElementType;
|
|
19
19
|
/**
|
|
20
20
|
* The component used for the transition.
|
|
21
|
-
* [Follow this guide](
|
|
21
|
+
* [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
|
|
22
22
|
* @default Grow
|
|
23
23
|
*/
|
|
24
24
|
transition: React.ElementType;
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -14,7 +14,6 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
14
14
|
var _useTimeout = _interopRequireWildcard(require("@mui/utils/useTimeout"));
|
|
15
15
|
var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
|
|
16
16
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
17
|
-
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
18
17
|
var _isFocusVisible = _interopRequireDefault(require("@mui/utils/isFocusVisible"));
|
|
19
18
|
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
20
19
|
var _zeroStyled = require("../zero-styled");
|
|
@@ -64,17 +63,11 @@ const TooltipPopper = (0, _zeroStyled.styled)(_Popper.default, {
|
|
|
64
63
|
pointerEvents: 'none',
|
|
65
64
|
variants: [{
|
|
66
65
|
props: ({
|
|
67
|
-
ownerState
|
|
68
|
-
}) => !ownerState.disableInteractive,
|
|
69
|
-
style: {
|
|
70
|
-
pointerEvents: 'auto'
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
props: ({
|
|
66
|
+
ownerState,
|
|
74
67
|
open
|
|
75
|
-
}) => !
|
|
68
|
+
}) => open && !ownerState.disableInteractive,
|
|
76
69
|
style: {
|
|
77
|
-
pointerEvents: '
|
|
70
|
+
pointerEvents: 'auto'
|
|
78
71
|
}
|
|
79
72
|
}, {
|
|
80
73
|
props: ({
|
|
@@ -98,6 +91,8 @@ const TooltipPopper = (0, _zeroStyled.styled)(_Popper.default, {
|
|
|
98
91
|
[`&[data-popper-placement*="right"] .${_tooltipClasses.default.arrow}`]: {
|
|
99
92
|
height: '1em',
|
|
100
93
|
width: '0.71em',
|
|
94
|
+
insetInlineStart: 0,
|
|
95
|
+
marginInlineStart: '-0.71em',
|
|
101
96
|
'&::before': {
|
|
102
97
|
transformOrigin: '100% 100%'
|
|
103
98
|
}
|
|
@@ -105,51 +100,13 @@ const TooltipPopper = (0, _zeroStyled.styled)(_Popper.default, {
|
|
|
105
100
|
[`&[data-popper-placement*="left"] .${_tooltipClasses.default.arrow}`]: {
|
|
106
101
|
height: '1em',
|
|
107
102
|
width: '0.71em',
|
|
103
|
+
insetInlineEnd: 0,
|
|
104
|
+
marginInlineEnd: '-0.71em',
|
|
108
105
|
'&::before': {
|
|
109
106
|
transformOrigin: '0 0'
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
|
-
}, {
|
|
114
|
-
props: ({
|
|
115
|
-
ownerState
|
|
116
|
-
}) => ownerState.arrow && !ownerState.isRtl,
|
|
117
|
-
style: {
|
|
118
|
-
[`&[data-popper-placement*="right"] .${_tooltipClasses.default.arrow}`]: {
|
|
119
|
-
left: 0,
|
|
120
|
-
marginLeft: '-0.71em'
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
props: ({
|
|
125
|
-
ownerState
|
|
126
|
-
}) => ownerState.arrow && !!ownerState.isRtl,
|
|
127
|
-
style: {
|
|
128
|
-
[`&[data-popper-placement*="right"] .${_tooltipClasses.default.arrow}`]: {
|
|
129
|
-
right: 0,
|
|
130
|
-
marginRight: '-0.71em'
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}, {
|
|
134
|
-
props: ({
|
|
135
|
-
ownerState
|
|
136
|
-
}) => ownerState.arrow && !ownerState.isRtl,
|
|
137
|
-
style: {
|
|
138
|
-
[`&[data-popper-placement*="left"] .${_tooltipClasses.default.arrow}`]: {
|
|
139
|
-
right: 0,
|
|
140
|
-
marginRight: '-0.71em'
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}, {
|
|
144
|
-
props: ({
|
|
145
|
-
ownerState
|
|
146
|
-
}) => ownerState.arrow && !!ownerState.isRtl,
|
|
147
|
-
style: {
|
|
148
|
-
[`&[data-popper-placement*="left"] .${_tooltipClasses.default.arrow}`]: {
|
|
149
|
-
left: 0,
|
|
150
|
-
marginLeft: '-0.71em'
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
110
|
}]
|
|
154
111
|
})));
|
|
155
112
|
const TooltipTooltip = (0, _zeroStyled.styled)('div', {
|
|
@@ -175,10 +132,12 @@ const TooltipTooltip = (0, _zeroStyled.styled)('div', {
|
|
|
175
132
|
wordWrap: 'break-word',
|
|
176
133
|
fontWeight: theme.typography.fontWeightMedium,
|
|
177
134
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="left"] &`]: {
|
|
178
|
-
transformOrigin: 'right center'
|
|
135
|
+
transformOrigin: 'right center',
|
|
136
|
+
marginInlineEnd: '14px'
|
|
179
137
|
},
|
|
180
138
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="right"] &`]: {
|
|
181
|
-
transformOrigin: 'left center'
|
|
139
|
+
transformOrigin: 'left center',
|
|
140
|
+
marginInlineStart: '14px'
|
|
182
141
|
},
|
|
183
142
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="top"] &`]: {
|
|
184
143
|
transformOrigin: 'center bottom',
|
|
@@ -194,7 +153,7 @@ const TooltipTooltip = (0, _zeroStyled.styled)('div', {
|
|
|
194
153
|
}) => ownerState.arrow,
|
|
195
154
|
style: {
|
|
196
155
|
position: 'relative',
|
|
197
|
-
|
|
156
|
+
marginBlock: 0
|
|
198
157
|
}
|
|
199
158
|
}, {
|
|
200
159
|
props: ({
|
|
@@ -209,65 +168,17 @@ const TooltipTooltip = (0, _zeroStyled.styled)('div', {
|
|
|
209
168
|
}, {
|
|
210
169
|
props: ({
|
|
211
170
|
ownerState
|
|
212
|
-
}) =>
|
|
213
|
-
style: {
|
|
214
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="left"] &`]: {
|
|
215
|
-
marginRight: '14px'
|
|
216
|
-
},
|
|
217
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="right"] &`]: {
|
|
218
|
-
marginLeft: '14px'
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}, {
|
|
222
|
-
props: ({
|
|
223
|
-
ownerState
|
|
224
|
-
}) => !ownerState.isRtl && ownerState.touch,
|
|
225
|
-
style: {
|
|
226
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="left"] &`]: {
|
|
227
|
-
marginRight: '24px'
|
|
228
|
-
},
|
|
229
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="right"] &`]: {
|
|
230
|
-
marginLeft: '24px'
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
props: ({
|
|
235
|
-
ownerState
|
|
236
|
-
}) => !!ownerState.isRtl,
|
|
171
|
+
}) => ownerState.touch,
|
|
237
172
|
style: {
|
|
238
173
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="left"] &`]: {
|
|
239
|
-
|
|
174
|
+
marginInlineEnd: '24px'
|
|
240
175
|
},
|
|
241
176
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="right"] &`]: {
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}, {
|
|
246
|
-
props: ({
|
|
247
|
-
ownerState
|
|
248
|
-
}) => !!ownerState.isRtl && ownerState.touch,
|
|
249
|
-
style: {
|
|
250
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="left"] &`]: {
|
|
251
|
-
marginLeft: '24px'
|
|
177
|
+
marginInlineStart: '24px'
|
|
252
178
|
},
|
|
253
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="right"] &`]: {
|
|
254
|
-
marginRight: '24px'
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}, {
|
|
258
|
-
props: ({
|
|
259
|
-
ownerState
|
|
260
|
-
}) => ownerState.touch,
|
|
261
|
-
style: {
|
|
262
179
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="top"] &`]: {
|
|
263
180
|
marginBottom: '24px'
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}, {
|
|
267
|
-
props: ({
|
|
268
|
-
ownerState
|
|
269
|
-
}) => ownerState.touch,
|
|
270
|
-
style: {
|
|
181
|
+
},
|
|
271
182
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="bottom"] &`]: {
|
|
272
183
|
marginTop: '24px'
|
|
273
184
|
}
|
|
@@ -350,7 +261,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
350
261
|
children: childrenProp
|
|
351
262
|
});
|
|
352
263
|
const theme = (0, _zeroStyled.useTheme)();
|
|
353
|
-
const isRtl = (0, _RtlProvider.useRtl)();
|
|
354
264
|
const [childNode, setChildNode] = React.useState();
|
|
355
265
|
const [arrowRef, setArrowRef] = React.useState(null);
|
|
356
266
|
const ignoreNonTouchEvents = React.useRef(false);
|
|
@@ -420,6 +330,9 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
420
330
|
});
|
|
421
331
|
});
|
|
422
332
|
const handleMouseOver = event => {
|
|
333
|
+
if (childNode?.disabled) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
423
336
|
if (ignoreNonTouchEvents.current && event.type !== 'touchstart') {
|
|
424
337
|
return;
|
|
425
338
|
}
|
|
@@ -450,7 +363,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
450
363
|
const handleBlur = event => {
|
|
451
364
|
// Needed for https://github.com/mui/material-ui/issues/45373
|
|
452
365
|
const target = event?.target ?? childNode;
|
|
453
|
-
if (!target || !(0, _isFocusVisible.default)(target)) {
|
|
366
|
+
if (!target || target.disabled || !(0, _isFocusVisible.default)(target)) {
|
|
454
367
|
setChildIsFocusVisible(false);
|
|
455
368
|
|
|
456
369
|
// InputBase can call onBlur() without an event when the input becomes disabled.
|
|
@@ -478,6 +391,15 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
478
391
|
setChildNode(event.currentTarget);
|
|
479
392
|
}
|
|
480
393
|
if ((0, _isFocusVisible.default)(event.target)) {
|
|
394
|
+
// Workaround for https://github.com/facebook/react/issues/9142.
|
|
395
|
+
// React does not fire blur when a focused element becomes disabled.
|
|
396
|
+
const handleNativeBlur = blurEvent => {
|
|
397
|
+
if (blurEvent.target.disabled) {
|
|
398
|
+
handleBlur(blurEvent);
|
|
399
|
+
}
|
|
400
|
+
blurEvent.target.removeEventListener('blur', handleNativeBlur);
|
|
401
|
+
};
|
|
402
|
+
event.target.addEventListener('blur', handleNativeBlur);
|
|
481
403
|
setChildIsFocusVisible(true);
|
|
482
404
|
handleMouseOver(event);
|
|
483
405
|
}
|
|
@@ -609,7 +531,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
609
531
|
}
|
|
610
532
|
const ownerState = {
|
|
611
533
|
...props,
|
|
612
|
-
isRtl,
|
|
613
534
|
arrow,
|
|
614
535
|
disableInteractive,
|
|
615
536
|
placement,
|
package/Tooltip/Tooltip.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import clsx from 'clsx';
|
|
|
6
6
|
import useTimeout, { Timeout } from '@mui/utils/useTimeout';
|
|
7
7
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
-
import { useRtl } from '@mui/system/RtlProvider';
|
|
10
9
|
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
11
10
|
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
12
11
|
import { styled, useTheme } from "../zero-styled/index.mjs";
|
|
@@ -56,17 +55,11 @@ const TooltipPopper = styled(Popper, {
|
|
|
56
55
|
pointerEvents: 'none',
|
|
57
56
|
variants: [{
|
|
58
57
|
props: ({
|
|
59
|
-
ownerState
|
|
60
|
-
}) => !ownerState.disableInteractive,
|
|
61
|
-
style: {
|
|
62
|
-
pointerEvents: 'auto'
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
props: ({
|
|
58
|
+
ownerState,
|
|
66
59
|
open
|
|
67
|
-
}) => !
|
|
60
|
+
}) => open && !ownerState.disableInteractive,
|
|
68
61
|
style: {
|
|
69
|
-
pointerEvents: '
|
|
62
|
+
pointerEvents: 'auto'
|
|
70
63
|
}
|
|
71
64
|
}, {
|
|
72
65
|
props: ({
|
|
@@ -90,6 +83,8 @@ const TooltipPopper = styled(Popper, {
|
|
|
90
83
|
[`&[data-popper-placement*="right"] .${tooltipClasses.arrow}`]: {
|
|
91
84
|
height: '1em',
|
|
92
85
|
width: '0.71em',
|
|
86
|
+
insetInlineStart: 0,
|
|
87
|
+
marginInlineStart: '-0.71em',
|
|
93
88
|
'&::before': {
|
|
94
89
|
transformOrigin: '100% 100%'
|
|
95
90
|
}
|
|
@@ -97,51 +92,13 @@ const TooltipPopper = styled(Popper, {
|
|
|
97
92
|
[`&[data-popper-placement*="left"] .${tooltipClasses.arrow}`]: {
|
|
98
93
|
height: '1em',
|
|
99
94
|
width: '0.71em',
|
|
95
|
+
insetInlineEnd: 0,
|
|
96
|
+
marginInlineEnd: '-0.71em',
|
|
100
97
|
'&::before': {
|
|
101
98
|
transformOrigin: '0 0'
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
|
-
}, {
|
|
106
|
-
props: ({
|
|
107
|
-
ownerState
|
|
108
|
-
}) => ownerState.arrow && !ownerState.isRtl,
|
|
109
|
-
style: {
|
|
110
|
-
[`&[data-popper-placement*="right"] .${tooltipClasses.arrow}`]: {
|
|
111
|
-
left: 0,
|
|
112
|
-
marginLeft: '-0.71em'
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
props: ({
|
|
117
|
-
ownerState
|
|
118
|
-
}) => ownerState.arrow && !!ownerState.isRtl,
|
|
119
|
-
style: {
|
|
120
|
-
[`&[data-popper-placement*="right"] .${tooltipClasses.arrow}`]: {
|
|
121
|
-
right: 0,
|
|
122
|
-
marginRight: '-0.71em'
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}, {
|
|
126
|
-
props: ({
|
|
127
|
-
ownerState
|
|
128
|
-
}) => ownerState.arrow && !ownerState.isRtl,
|
|
129
|
-
style: {
|
|
130
|
-
[`&[data-popper-placement*="left"] .${tooltipClasses.arrow}`]: {
|
|
131
|
-
right: 0,
|
|
132
|
-
marginRight: '-0.71em'
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
props: ({
|
|
137
|
-
ownerState
|
|
138
|
-
}) => ownerState.arrow && !!ownerState.isRtl,
|
|
139
|
-
style: {
|
|
140
|
-
[`&[data-popper-placement*="left"] .${tooltipClasses.arrow}`]: {
|
|
141
|
-
left: 0,
|
|
142
|
-
marginLeft: '-0.71em'
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
102
|
}]
|
|
146
103
|
})));
|
|
147
104
|
const TooltipTooltip = styled('div', {
|
|
@@ -167,10 +124,12 @@ const TooltipTooltip = styled('div', {
|
|
|
167
124
|
wordWrap: 'break-word',
|
|
168
125
|
fontWeight: theme.typography.fontWeightMedium,
|
|
169
126
|
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
170
|
-
transformOrigin: 'right center'
|
|
127
|
+
transformOrigin: 'right center',
|
|
128
|
+
marginInlineEnd: '14px'
|
|
171
129
|
},
|
|
172
130
|
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
|
|
173
|
-
transformOrigin: 'left center'
|
|
131
|
+
transformOrigin: 'left center',
|
|
132
|
+
marginInlineStart: '14px'
|
|
174
133
|
},
|
|
175
134
|
[`.${tooltipClasses.popper}[data-popper-placement*="top"] &`]: {
|
|
176
135
|
transformOrigin: 'center bottom',
|
|
@@ -186,7 +145,7 @@ const TooltipTooltip = styled('div', {
|
|
|
186
145
|
}) => ownerState.arrow,
|
|
187
146
|
style: {
|
|
188
147
|
position: 'relative',
|
|
189
|
-
|
|
148
|
+
marginBlock: 0
|
|
190
149
|
}
|
|
191
150
|
}, {
|
|
192
151
|
props: ({
|
|
@@ -201,65 +160,17 @@ const TooltipTooltip = styled('div', {
|
|
|
201
160
|
}, {
|
|
202
161
|
props: ({
|
|
203
162
|
ownerState
|
|
204
|
-
}) =>
|
|
205
|
-
style: {
|
|
206
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
207
|
-
marginRight: '14px'
|
|
208
|
-
},
|
|
209
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
|
|
210
|
-
marginLeft: '14px'
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}, {
|
|
214
|
-
props: ({
|
|
215
|
-
ownerState
|
|
216
|
-
}) => !ownerState.isRtl && ownerState.touch,
|
|
217
|
-
style: {
|
|
218
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
219
|
-
marginRight: '24px'
|
|
220
|
-
},
|
|
221
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
|
|
222
|
-
marginLeft: '24px'
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}, {
|
|
226
|
-
props: ({
|
|
227
|
-
ownerState
|
|
228
|
-
}) => !!ownerState.isRtl,
|
|
163
|
+
}) => ownerState.touch,
|
|
229
164
|
style: {
|
|
230
165
|
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
231
|
-
|
|
166
|
+
marginInlineEnd: '24px'
|
|
232
167
|
},
|
|
233
168
|
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}, {
|
|
238
|
-
props: ({
|
|
239
|
-
ownerState
|
|
240
|
-
}) => !!ownerState.isRtl && ownerState.touch,
|
|
241
|
-
style: {
|
|
242
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
243
|
-
marginLeft: '24px'
|
|
169
|
+
marginInlineStart: '24px'
|
|
244
170
|
},
|
|
245
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
|
|
246
|
-
marginRight: '24px'
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}, {
|
|
250
|
-
props: ({
|
|
251
|
-
ownerState
|
|
252
|
-
}) => ownerState.touch,
|
|
253
|
-
style: {
|
|
254
171
|
[`.${tooltipClasses.popper}[data-popper-placement*="top"] &`]: {
|
|
255
172
|
marginBottom: '24px'
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}, {
|
|
259
|
-
props: ({
|
|
260
|
-
ownerState
|
|
261
|
-
}) => ownerState.touch,
|
|
262
|
-
style: {
|
|
173
|
+
},
|
|
263
174
|
[`.${tooltipClasses.popper}[data-popper-placement*="bottom"] &`]: {
|
|
264
175
|
marginTop: '24px'
|
|
265
176
|
}
|
|
@@ -342,7 +253,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
342
253
|
children: childrenProp
|
|
343
254
|
});
|
|
344
255
|
const theme = useTheme();
|
|
345
|
-
const isRtl = useRtl();
|
|
346
256
|
const [childNode, setChildNode] = React.useState();
|
|
347
257
|
const [arrowRef, setArrowRef] = React.useState(null);
|
|
348
258
|
const ignoreNonTouchEvents = React.useRef(false);
|
|
@@ -412,6 +322,9 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
412
322
|
});
|
|
413
323
|
});
|
|
414
324
|
const handleMouseOver = event => {
|
|
325
|
+
if (childNode?.disabled) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
415
328
|
if (ignoreNonTouchEvents.current && event.type !== 'touchstart') {
|
|
416
329
|
return;
|
|
417
330
|
}
|
|
@@ -442,7 +355,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
442
355
|
const handleBlur = event => {
|
|
443
356
|
// Needed for https://github.com/mui/material-ui/issues/45373
|
|
444
357
|
const target = event?.target ?? childNode;
|
|
445
|
-
if (!target || !isFocusVisible(target)) {
|
|
358
|
+
if (!target || target.disabled || !isFocusVisible(target)) {
|
|
446
359
|
setChildIsFocusVisible(false);
|
|
447
360
|
|
|
448
361
|
// InputBase can call onBlur() without an event when the input becomes disabled.
|
|
@@ -470,6 +383,15 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
470
383
|
setChildNode(event.currentTarget);
|
|
471
384
|
}
|
|
472
385
|
if (isFocusVisible(event.target)) {
|
|
386
|
+
// Workaround for https://github.com/facebook/react/issues/9142.
|
|
387
|
+
// React does not fire blur when a focused element becomes disabled.
|
|
388
|
+
const handleNativeBlur = blurEvent => {
|
|
389
|
+
if (blurEvent.target.disabled) {
|
|
390
|
+
handleBlur(blurEvent);
|
|
391
|
+
}
|
|
392
|
+
blurEvent.target.removeEventListener('blur', handleNativeBlur);
|
|
393
|
+
};
|
|
394
|
+
event.target.addEventListener('blur', handleNativeBlur);
|
|
473
395
|
setChildIsFocusVisible(true);
|
|
474
396
|
handleMouseOver(event);
|
|
475
397
|
}
|
|
@@ -601,7 +523,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
601
523
|
}
|
|
602
524
|
const ownerState = {
|
|
603
525
|
...props,
|
|
604
|
-
isRtl,
|
|
605
526
|
arrow,
|
|
606
527
|
disableInteractive,
|
|
607
528
|
placement,
|
|
@@ -15,7 +15,9 @@ var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"))
|
|
|
15
15
|
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
16
16
|
var _exactProp = _interopRequireDefault(require("@mui/utils/exactProp"));
|
|
17
17
|
var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
|
|
18
|
+
var _contains = _interopRequireDefault(require("../utils/contains"));
|
|
18
19
|
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
20
|
+
var _focusable = require("../utils/focusable");
|
|
19
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
22
|
// Inspired by https://github.com/focus-trap/tabbable
|
|
21
23
|
const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
|
|
@@ -114,34 +116,36 @@ function FocusTrap(props) {
|
|
|
114
116
|
activated.current = !disableAutoFocus;
|
|
115
117
|
}, [disableAutoFocus, open]);
|
|
116
118
|
React.useEffect(() => {
|
|
119
|
+
// Reset on every mount — React 18 Strict Mode double-mounts leave this
|
|
120
|
+
// stuck at `true` after the cleanup of the previous mount set it.
|
|
121
|
+
ignoreNextEnforceFocus.current = false;
|
|
122
|
+
|
|
117
123
|
// We might render an empty child.
|
|
118
124
|
if (!open || !rootRef.current) {
|
|
119
125
|
return;
|
|
120
126
|
}
|
|
121
127
|
const doc = (0, _ownerDocument.default)(rootRef.current);
|
|
122
128
|
const activeElement = (0, _getActiveElement.default)(doc);
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
|
|
130
|
+
// Prefer the explicitly marked focusable element. Fall back to the root
|
|
131
|
+
// element for generic FocusTrap usage.
|
|
132
|
+
const focusTarget = (0, _focusable.getFocusTarget)(rootRef.current) ?? rootRef.current;
|
|
133
|
+
if (!(0, _contains.default)(rootRef.current, activeElement)) {
|
|
134
|
+
if (!focusTarget.hasAttribute('tabIndex')) {
|
|
125
135
|
if (process.env.NODE_ENV !== 'production') {
|
|
126
136
|
console.error(['MUI: The modal content node does not accept focus.', 'For the benefit of assistive technologies, ' + 'the tabIndex of the node is being set to "-1".'].join('\n'));
|
|
127
137
|
}
|
|
128
|
-
|
|
138
|
+
focusTarget.setAttribute('tabIndex', '-1');
|
|
129
139
|
}
|
|
130
140
|
if (activated.current) {
|
|
131
|
-
|
|
141
|
+
focusTarget.focus();
|
|
132
142
|
}
|
|
133
143
|
}
|
|
134
144
|
return () => {
|
|
135
145
|
// restoreLastFocus()
|
|
136
|
-
if (!disableRestoreFocus) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// Not all elements in IE11 have a focus method.
|
|
140
|
-
// Once IE11 support is dropped the focus() call can be unconditional.
|
|
141
|
-
if (nodeToRestore.current && nodeToRestore.current.focus) {
|
|
142
|
-
ignoreNextEnforceFocus.current = true;
|
|
143
|
-
nodeToRestore.current.focus();
|
|
144
|
-
}
|
|
146
|
+
if (!disableRestoreFocus && nodeToRestore.current) {
|
|
147
|
+
ignoreNextEnforceFocus.current = true;
|
|
148
|
+
nodeToRestore.current.focus();
|
|
145
149
|
nodeToRestore.current = null;
|
|
146
150
|
}
|
|
147
151
|
};
|
|
@@ -160,17 +164,51 @@ function FocusTrap(props) {
|
|
|
160
164
|
if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {
|
|
161
165
|
return;
|
|
162
166
|
}
|
|
167
|
+
const rootElement = rootRef.current;
|
|
163
168
|
const activeElement = (0, _getActiveElement.default)(doc);
|
|
169
|
+
if (rootElement === null) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const focusTarget = (0, _focusable.getFocusTarget)(rootElement);
|
|
173
|
+
const isFocusStart = activeElement === rootElement || activeElement === focusTarget;
|
|
164
174
|
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
// Marked focus targets can be non-tabbable, but should start tabbing
|
|
176
|
+
// from the first/last tabbable child.
|
|
177
|
+
if (isFocusStart) {
|
|
178
|
+
const tabbable = getTabbable(rootElement);
|
|
179
|
+
if (tabbable.length === 0) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
nativeEvent.preventDefault();
|
|
183
|
+
if (nativeEvent.shiftKey) {
|
|
184
|
+
tabbable[tabbable.length - 1].focus();
|
|
185
|
+
} else {
|
|
186
|
+
tabbable[0].focus();
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if ((0, _contains.default)(rootElement, activeElement)) {
|
|
191
|
+
const tabbable = getTabbable(rootElement);
|
|
192
|
+
const currentIndex = tabbable.indexOf(activeElement);
|
|
193
|
+
if (currentIndex === -1) {
|
|
194
|
+
// Leave shadow-root descendants to native tab handling.
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const hasPositiveTabIndex = tabbable.some(node => getTabIndex(node) > 0);
|
|
198
|
+
|
|
199
|
+
// Positive tabIndex needs the computed order; regular tabIndex=0 can
|
|
200
|
+
// use native tab handling.
|
|
201
|
+
if (!hasPositiveTabIndex) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
nativeEvent.preventDefault();
|
|
205
|
+
let nextIndex = 0;
|
|
206
|
+
if (nativeEvent.shiftKey) {
|
|
207
|
+
nextIndex = currentIndex <= 0 ? tabbable.length - 1 : currentIndex - 1;
|
|
208
|
+
} else {
|
|
209
|
+
nextIndex = currentIndex === tabbable.length - 1 ? 0 : currentIndex + 1;
|
|
173
210
|
}
|
|
211
|
+
tabbable[nextIndex].focus();
|
|
174
212
|
}
|
|
175
213
|
};
|
|
176
214
|
const contain = () => {
|
|
@@ -188,7 +226,7 @@ function FocusTrap(props) {
|
|
|
188
226
|
}
|
|
189
227
|
|
|
190
228
|
// The focus is already inside
|
|
191
|
-
if (
|
|
229
|
+
if ((0, _contains.default)(rootElement, activeEl)) {
|
|
192
230
|
return;
|
|
193
231
|
}
|
|
194
232
|
|