@mui/material 9.0.0 → 9.0.1
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/Autocomplete/Autocomplete.js +65 -11
- package/Autocomplete/Autocomplete.mjs +65 -11
- package/Avatar/Avatar.js +4 -0
- package/Avatar/Avatar.mjs +4 -0
- package/Badge/Badge.js +3 -0
- package/Badge/Badge.mjs +3 -0
- package/Button/Button.js +19 -2
- package/Button/Button.mjs +19 -2
- 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/CHANGELOG.md +132 -1245
- package/Checkbox/Checkbox.js +2 -1
- package/Checkbox/Checkbox.mjs +2 -1
- package/CircularProgress/CircularProgress.d.mts +12 -2
- package/CircularProgress/CircularProgress.d.ts +12 -2
- package/CircularProgress/CircularProgress.js +33 -6
- package/CircularProgress/CircularProgress.mjs +33 -6
- package/ClickAwayListener/ClickAwayListener.js +3 -6
- package/ClickAwayListener/ClickAwayListener.mjs +3 -6
- package/Dialog/Dialog.js +11 -6
- package/Dialog/Dialog.mjs +11 -6
- package/Drawer/Drawer.js +18 -4
- package/Drawer/Drawer.mjs +18 -4
- package/Fab/Fab.js +7 -1
- package/Fab/Fab.mjs +7 -1
- package/FilledInput/FilledInput.d.mts +4 -0
- package/FilledInput/FilledInput.d.ts +4 -0
- package/FilledInput/FilledInput.js +18 -20
- package/FilledInput/FilledInput.mjs +18 -20
- 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/IconButton/IconButton.js +1 -8
- package/IconButton/IconButton.mjs +1 -8
- package/Input/Input.d.mts +4 -0
- package/Input/Input.d.ts +4 -0
- package/Input/Input.js +6 -0
- package/Input/Input.mjs +6 -0
- package/InputBase/InputBase.d.mts +2 -1
- package/InputBase/InputBase.d.ts +2 -1
- package/InputBase/InputBase.js +50 -15
- package/InputBase/InputBase.mjs +50 -15
- package/InputLabel/InputLabel.js +5 -8
- package/InputLabel/InputLabel.mjs +5 -8
- package/LinearProgress/LinearProgress.d.mts +12 -2
- package/LinearProgress/LinearProgress.d.ts +12 -2
- package/LinearProgress/LinearProgress.js +42 -10
- package/LinearProgress/LinearProgress.mjs +42 -10
- package/List/List.js +2 -1
- package/List/List.mjs +2 -1
- package/ListItemButton/ListItemButton.js +7 -1
- package/ListItemButton/ListItemButton.mjs +7 -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/NativeSelect/NativeSelect.js +2 -5
- package/NativeSelect/NativeSelect.mjs +2 -5
- package/OutlinedInput/OutlinedInput.js +13 -23
- package/OutlinedInput/OutlinedInput.mjs +13 -23
- package/PigmentContainer/PigmentContainer.js +0 -1
- package/PigmentContainer/PigmentContainer.mjs +0 -1
- package/Popper/BasePopper.js +23 -1
- package/Popper/BasePopper.mjs +23 -1
- package/Select/Select.js +2 -5
- package/Select/Select.mjs +2 -5
- package/Select/SelectInput.js +164 -2
- package/Select/SelectInput.mjs +164 -2
- package/Slide/Slide.js +48 -26
- package/Slide/Slide.mjs +49 -27
- package/Slider/Slider.js +10 -1
- package/Slider/Slider.mjs +10 -1
- package/Slider/useSlider.js +3 -2
- package/Slider/useSlider.mjs +3 -2
- package/SwipeableDrawer/SwipeableDrawer.js +7 -3
- package/SwipeableDrawer/SwipeableDrawer.mjs +7 -3
- package/Switch/Switch.js +7 -6
- package/Switch/Switch.mjs +7 -6
- package/Tabs/ScrollbarSize.js +2 -1
- package/Tabs/ScrollbarSize.mjs +2 -1
- package/Tabs/Tabs.js +2 -1
- package/Tabs/Tabs.mjs +2 -1
- package/Tooltip/Tooltip.js +26 -108
- package/Tooltip/Tooltip.mjs +26 -108
- package/Unstable_TrapFocus/FocusTrap.js +18 -14
- package/Unstable_TrapFocus/FocusTrap.mjs +18 -14
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +49 -49
- package/styles/responsiveFontSizes.js +19 -8
- package/styles/responsiveFontSizes.mjs +19 -8
- package/styles/useThemeProps.d.mts +3 -3
- package/styles/useThemeProps.d.ts +3 -3
- package/transitions/utils.d.mts +17 -0
- package/transitions/utils.d.ts +17 -0
- package/transitions/utils.js +64 -0
- package/transitions/utils.mjs +63 -0
- package/useAutocomplete/useAutocomplete.d.mts +4 -5
- package/useAutocomplete/useAutocomplete.d.ts +4 -5
- package/useAutocomplete/useAutocomplete.js +166 -53
- package/useAutocomplete/useAutocomplete.mjs +166 -53
- 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/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,
|
|
163
|
+
}) => ownerState.touch,
|
|
217
164
|
style: {
|
|
218
165
|
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
219
|
-
|
|
166
|
+
marginInlineEnd: '24px'
|
|
220
167
|
},
|
|
221
168
|
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}, {
|
|
226
|
-
props: ({
|
|
227
|
-
ownerState
|
|
228
|
-
}) => !!ownerState.isRtl,
|
|
229
|
-
style: {
|
|
230
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
231
|
-
marginLeft: '14px'
|
|
169
|
+
marginInlineStart: '24px'
|
|
232
170
|
},
|
|
233
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
|
|
234
|
-
marginRight: '14px'
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}, {
|
|
238
|
-
props: ({
|
|
239
|
-
ownerState
|
|
240
|
-
}) => !!ownerState.isRtl && ownerState.touch,
|
|
241
|
-
style: {
|
|
242
|
-
[`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
|
|
243
|
-
marginLeft: '24px'
|
|
244
|
-
},
|
|
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);
|
|
@@ -442,7 +352,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
442
352
|
const handleBlur = event => {
|
|
443
353
|
// Needed for https://github.com/mui/material-ui/issues/45373
|
|
444
354
|
const target = event?.target ?? childNode;
|
|
445
|
-
if (!target || !isFocusVisible(target)) {
|
|
355
|
+
if (!target || target.disabled || !isFocusVisible(target)) {
|
|
446
356
|
setChildIsFocusVisible(false);
|
|
447
357
|
|
|
448
358
|
// InputBase can call onBlur() without an event when the input becomes disabled.
|
|
@@ -470,6 +380,15 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
470
380
|
setChildNode(event.currentTarget);
|
|
471
381
|
}
|
|
472
382
|
if (isFocusVisible(event.target)) {
|
|
383
|
+
// Workaround for https://github.com/facebook/react/issues/9142.
|
|
384
|
+
// React does not fire blur when a focused element becomes disabled.
|
|
385
|
+
const handleNativeBlur = blurEvent => {
|
|
386
|
+
if (blurEvent.target.disabled) {
|
|
387
|
+
handleBlur(blurEvent);
|
|
388
|
+
}
|
|
389
|
+
blurEvent.target.removeEventListener('blur', handleNativeBlur);
|
|
390
|
+
};
|
|
391
|
+
event.target.addEventListener('blur', handleNativeBlur);
|
|
473
392
|
setChildIsFocusVisible(true);
|
|
474
393
|
handleMouseOver(event);
|
|
475
394
|
}
|
|
@@ -601,7 +520,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
601
520
|
}
|
|
602
521
|
const ownerState = {
|
|
603
522
|
...props,
|
|
604
|
-
isRtl,
|
|
605
523
|
arrow,
|
|
606
524
|
disableInteractive,
|
|
607
525
|
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
|
};
|
|
@@ -188,7 +192,7 @@ function FocusTrap(props) {
|
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
// The focus is already inside
|
|
191
|
-
if (
|
|
195
|
+
if ((0, _contains.default)(rootElement, activeEl)) {
|
|
192
196
|
return;
|
|
193
197
|
}
|
|
194
198
|
|
|
@@ -8,7 +8,9 @@ import ownerDocument from '@mui/utils/ownerDocument';
|
|
|
8
8
|
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
9
9
|
import exactProp from '@mui/utils/exactProp';
|
|
10
10
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
11
|
+
import contains from "../utils/contains.mjs";
|
|
11
12
|
import getActiveElement from "../utils/getActiveElement.mjs";
|
|
13
|
+
import { getFocusTarget } from "../utils/focusable.mjs";
|
|
12
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
15
|
// Inspired by https://github.com/focus-trap/tabbable
|
|
14
16
|
const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
|
|
@@ -107,34 +109,36 @@ function FocusTrap(props) {
|
|
|
107
109
|
activated.current = !disableAutoFocus;
|
|
108
110
|
}, [disableAutoFocus, open]);
|
|
109
111
|
React.useEffect(() => {
|
|
112
|
+
// Reset on every mount — React 18 Strict Mode double-mounts leave this
|
|
113
|
+
// stuck at `true` after the cleanup of the previous mount set it.
|
|
114
|
+
ignoreNextEnforceFocus.current = false;
|
|
115
|
+
|
|
110
116
|
// We might render an empty child.
|
|
111
117
|
if (!open || !rootRef.current) {
|
|
112
118
|
return;
|
|
113
119
|
}
|
|
114
120
|
const doc = ownerDocument(rootRef.current);
|
|
115
121
|
const activeElement = getActiveElement(doc);
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
|
|
123
|
+
// Prefer the explicitly marked focusable element. Fall back to the root
|
|
124
|
+
// element for generic FocusTrap usage.
|
|
125
|
+
const focusTarget = getFocusTarget(rootRef.current) ?? rootRef.current;
|
|
126
|
+
if (!contains(rootRef.current, activeElement)) {
|
|
127
|
+
if (!focusTarget.hasAttribute('tabIndex')) {
|
|
118
128
|
if (process.env.NODE_ENV !== 'production') {
|
|
119
129
|
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'));
|
|
120
130
|
}
|
|
121
|
-
|
|
131
|
+
focusTarget.setAttribute('tabIndex', '-1');
|
|
122
132
|
}
|
|
123
133
|
if (activated.current) {
|
|
124
|
-
|
|
134
|
+
focusTarget.focus();
|
|
125
135
|
}
|
|
126
136
|
}
|
|
127
137
|
return () => {
|
|
128
138
|
// restoreLastFocus()
|
|
129
|
-
if (!disableRestoreFocus) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// Not all elements in IE11 have a focus method.
|
|
133
|
-
// Once IE11 support is dropped the focus() call can be unconditional.
|
|
134
|
-
if (nodeToRestore.current && nodeToRestore.current.focus) {
|
|
135
|
-
ignoreNextEnforceFocus.current = true;
|
|
136
|
-
nodeToRestore.current.focus();
|
|
137
|
-
}
|
|
139
|
+
if (!disableRestoreFocus && nodeToRestore.current) {
|
|
140
|
+
ignoreNextEnforceFocus.current = true;
|
|
141
|
+
nodeToRestore.current.focus();
|
|
138
142
|
nodeToRestore.current = null;
|
|
139
143
|
}
|
|
140
144
|
};
|
|
@@ -181,7 +185,7 @@ function FocusTrap(props) {
|
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
// The focus is already inside
|
|
184
|
-
if (
|
|
188
|
+
if (contains(rootElement, activeEl)) {
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
187
191
|
|
package/index.js
CHANGED
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
34
|
"react-is": "^19.2.4",
|
|
35
35
|
"react-transition-group": "^4.4.5",
|
|
36
|
-
"@mui/core-downloads-tracker": "^9.0.
|
|
36
|
+
"@mui/core-downloads-tracker": "^9.0.1",
|
|
37
|
+
"@mui/system": "^9.0.1",
|
|
37
38
|
"@mui/types": "^9.0.0",
|
|
38
|
-
"@mui/
|
|
39
|
-
"@mui/utils": "^9.0.0"
|
|
39
|
+
"@mui/utils": "^9.0.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@emotion/react": "^11.5.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
45
45
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
47
|
-
"@mui/material-pigment-css": "^9.0.
|
|
47
|
+
"@mui/material-pigment-css": "^9.0.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@types/react": {
|
|
@@ -573,154 +573,154 @@
|
|
|
573
573
|
}
|
|
574
574
|
},
|
|
575
575
|
"./Box": {
|
|
576
|
-
"require": {
|
|
577
|
-
"types": "./Box/index.d.ts",
|
|
578
|
-
"default": "./Box/index.js"
|
|
579
|
-
},
|
|
580
576
|
"import": {
|
|
581
577
|
"types": "./Box/index.d.mts",
|
|
582
578
|
"default": "./Box/index.mjs"
|
|
583
579
|
},
|
|
580
|
+
"require": {
|
|
581
|
+
"types": "./Box/index.d.ts",
|
|
582
|
+
"default": "./Box/index.js"
|
|
583
|
+
},
|
|
584
584
|
"default": {
|
|
585
585
|
"types": "./Box/index.d.mts",
|
|
586
586
|
"default": "./Box/index.mjs"
|
|
587
587
|
}
|
|
588
588
|
},
|
|
589
589
|
"./Breadcrumbs": {
|
|
590
|
-
"require": {
|
|
591
|
-
"types": "./Breadcrumbs/index.d.ts",
|
|
592
|
-
"default": "./Breadcrumbs/index.js"
|
|
593
|
-
},
|
|
594
590
|
"import": {
|
|
595
591
|
"types": "./Breadcrumbs/index.d.mts",
|
|
596
592
|
"default": "./Breadcrumbs/index.mjs"
|
|
597
593
|
},
|
|
594
|
+
"require": {
|
|
595
|
+
"types": "./Breadcrumbs/index.d.ts",
|
|
596
|
+
"default": "./Breadcrumbs/index.js"
|
|
597
|
+
},
|
|
598
598
|
"default": {
|
|
599
599
|
"types": "./Breadcrumbs/index.d.mts",
|
|
600
600
|
"default": "./Breadcrumbs/index.mjs"
|
|
601
601
|
}
|
|
602
602
|
},
|
|
603
603
|
"./Button": {
|
|
604
|
-
"require": {
|
|
605
|
-
"types": "./Button/index.d.ts",
|
|
606
|
-
"default": "./Button/index.js"
|
|
607
|
-
},
|
|
608
604
|
"import": {
|
|
609
605
|
"types": "./Button/index.d.mts",
|
|
610
606
|
"default": "./Button/index.mjs"
|
|
611
607
|
},
|
|
608
|
+
"require": {
|
|
609
|
+
"types": "./Button/index.d.ts",
|
|
610
|
+
"default": "./Button/index.js"
|
|
611
|
+
},
|
|
612
612
|
"default": {
|
|
613
613
|
"types": "./Button/index.d.mts",
|
|
614
614
|
"default": "./Button/index.mjs"
|
|
615
615
|
}
|
|
616
616
|
},
|
|
617
617
|
"./ButtonBase": {
|
|
618
|
-
"require": {
|
|
619
|
-
"types": "./ButtonBase/index.d.ts",
|
|
620
|
-
"default": "./ButtonBase/index.js"
|
|
621
|
-
},
|
|
622
618
|
"import": {
|
|
623
619
|
"types": "./ButtonBase/index.d.mts",
|
|
624
620
|
"default": "./ButtonBase/index.mjs"
|
|
625
621
|
},
|
|
622
|
+
"require": {
|
|
623
|
+
"types": "./ButtonBase/index.d.ts",
|
|
624
|
+
"default": "./ButtonBase/index.js"
|
|
625
|
+
},
|
|
626
626
|
"default": {
|
|
627
627
|
"types": "./ButtonBase/index.d.mts",
|
|
628
628
|
"default": "./ButtonBase/index.mjs"
|
|
629
629
|
}
|
|
630
630
|
},
|
|
631
631
|
"./ButtonGroup": {
|
|
632
|
-
"require": {
|
|
633
|
-
"types": "./ButtonGroup/index.d.ts",
|
|
634
|
-
"default": "./ButtonGroup/index.js"
|
|
635
|
-
},
|
|
636
632
|
"import": {
|
|
637
633
|
"types": "./ButtonGroup/index.d.mts",
|
|
638
634
|
"default": "./ButtonGroup/index.mjs"
|
|
639
635
|
},
|
|
636
|
+
"require": {
|
|
637
|
+
"types": "./ButtonGroup/index.d.ts",
|
|
638
|
+
"default": "./ButtonGroup/index.js"
|
|
639
|
+
},
|
|
640
640
|
"default": {
|
|
641
641
|
"types": "./ButtonGroup/index.d.mts",
|
|
642
642
|
"default": "./ButtonGroup/index.mjs"
|
|
643
643
|
}
|
|
644
644
|
},
|
|
645
645
|
"./Card": {
|
|
646
|
-
"require": {
|
|
647
|
-
"types": "./Card/index.d.ts",
|
|
648
|
-
"default": "./Card/index.js"
|
|
649
|
-
},
|
|
650
646
|
"import": {
|
|
651
647
|
"types": "./Card/index.d.mts",
|
|
652
648
|
"default": "./Card/index.mjs"
|
|
653
649
|
},
|
|
650
|
+
"require": {
|
|
651
|
+
"types": "./Card/index.d.ts",
|
|
652
|
+
"default": "./Card/index.js"
|
|
653
|
+
},
|
|
654
654
|
"default": {
|
|
655
655
|
"types": "./Card/index.d.mts",
|
|
656
656
|
"default": "./Card/index.mjs"
|
|
657
657
|
}
|
|
658
658
|
},
|
|
659
659
|
"./CardActionArea": {
|
|
660
|
-
"require": {
|
|
661
|
-
"types": "./CardActionArea/index.d.ts",
|
|
662
|
-
"default": "./CardActionArea/index.js"
|
|
663
|
-
},
|
|
664
660
|
"import": {
|
|
665
661
|
"types": "./CardActionArea/index.d.mts",
|
|
666
662
|
"default": "./CardActionArea/index.mjs"
|
|
667
663
|
},
|
|
664
|
+
"require": {
|
|
665
|
+
"types": "./CardActionArea/index.d.ts",
|
|
666
|
+
"default": "./CardActionArea/index.js"
|
|
667
|
+
},
|
|
668
668
|
"default": {
|
|
669
669
|
"types": "./CardActionArea/index.d.mts",
|
|
670
670
|
"default": "./CardActionArea/index.mjs"
|
|
671
671
|
}
|
|
672
672
|
},
|
|
673
673
|
"./CardActions": {
|
|
674
|
-
"require": {
|
|
675
|
-
"types": "./CardActions/index.d.ts",
|
|
676
|
-
"default": "./CardActions/index.js"
|
|
677
|
-
},
|
|
678
674
|
"import": {
|
|
679
675
|
"types": "./CardActions/index.d.mts",
|
|
680
676
|
"default": "./CardActions/index.mjs"
|
|
681
677
|
},
|
|
678
|
+
"require": {
|
|
679
|
+
"types": "./CardActions/index.d.ts",
|
|
680
|
+
"default": "./CardActions/index.js"
|
|
681
|
+
},
|
|
682
682
|
"default": {
|
|
683
683
|
"types": "./CardActions/index.d.mts",
|
|
684
684
|
"default": "./CardActions/index.mjs"
|
|
685
685
|
}
|
|
686
686
|
},
|
|
687
687
|
"./CardContent": {
|
|
688
|
-
"require": {
|
|
689
|
-
"types": "./CardContent/index.d.ts",
|
|
690
|
-
"default": "./CardContent/index.js"
|
|
691
|
-
},
|
|
692
688
|
"import": {
|
|
693
689
|
"types": "./CardContent/index.d.mts",
|
|
694
690
|
"default": "./CardContent/index.mjs"
|
|
695
691
|
},
|
|
692
|
+
"require": {
|
|
693
|
+
"types": "./CardContent/index.d.ts",
|
|
694
|
+
"default": "./CardContent/index.js"
|
|
695
|
+
},
|
|
696
696
|
"default": {
|
|
697
697
|
"types": "./CardContent/index.d.mts",
|
|
698
698
|
"default": "./CardContent/index.mjs"
|
|
699
699
|
}
|
|
700
700
|
},
|
|
701
701
|
"./CardHeader": {
|
|
702
|
-
"require": {
|
|
703
|
-
"types": "./CardHeader/index.d.ts",
|
|
704
|
-
"default": "./CardHeader/index.js"
|
|
705
|
-
},
|
|
706
702
|
"import": {
|
|
707
703
|
"types": "./CardHeader/index.d.mts",
|
|
708
704
|
"default": "./CardHeader/index.mjs"
|
|
709
705
|
},
|
|
706
|
+
"require": {
|
|
707
|
+
"types": "./CardHeader/index.d.ts",
|
|
708
|
+
"default": "./CardHeader/index.js"
|
|
709
|
+
},
|
|
710
710
|
"default": {
|
|
711
711
|
"types": "./CardHeader/index.d.mts",
|
|
712
712
|
"default": "./CardHeader/index.mjs"
|
|
713
713
|
}
|
|
714
714
|
},
|
|
715
715
|
"./CardMedia": {
|
|
716
|
-
"require": {
|
|
717
|
-
"types": "./CardMedia/index.d.ts",
|
|
718
|
-
"default": "./CardMedia/index.js"
|
|
719
|
-
},
|
|
720
716
|
"import": {
|
|
721
717
|
"types": "./CardMedia/index.d.mts",
|
|
722
718
|
"default": "./CardMedia/index.mjs"
|
|
723
719
|
},
|
|
720
|
+
"require": {
|
|
721
|
+
"types": "./CardMedia/index.d.ts",
|
|
722
|
+
"default": "./CardMedia/index.js"
|
|
723
|
+
},
|
|
724
724
|
"default": {
|
|
725
725
|
"types": "./CardMedia/index.d.mts",
|
|
726
726
|
"default": "./CardMedia/index.mjs"
|
|
@@ -58,16 +58,27 @@ function responsiveFontSizes(themeInput, options = {}) {
|
|
|
58
58
|
})
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
+
const responsive = (0, _cssUtils.responsiveProperty)({
|
|
62
|
+
cssProperty: 'fontSize',
|
|
63
|
+
min: minFontSize,
|
|
64
|
+
max: maxFontSize,
|
|
65
|
+
unit: 'rem',
|
|
66
|
+
breakpoints: breakpointValues,
|
|
67
|
+
transform
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// https://github.com/mui/material-ui/issues/40255
|
|
71
|
+
// Preserve the original font size at the largest breakpoint.
|
|
72
|
+
// Grid alignment can snap the max value away from the original designed size.
|
|
73
|
+
if (breakpointValues.length > 0) {
|
|
74
|
+
const lastBreakpoint = breakpointValues[breakpointValues.length - 1];
|
|
75
|
+
responsive[`@media (min-width:${lastBreakpoint}px)`] = {
|
|
76
|
+
fontSize: `${Math.round(maxFontSize * 10000) / 10000}rem`
|
|
77
|
+
};
|
|
78
|
+
}
|
|
61
79
|
typography[variant] = {
|
|
62
80
|
...style,
|
|
63
|
-
...
|
|
64
|
-
cssProperty: 'fontSize',
|
|
65
|
-
min: minFontSize,
|
|
66
|
-
max: maxFontSize,
|
|
67
|
-
unit: 'rem',
|
|
68
|
-
breakpoints: breakpointValues,
|
|
69
|
-
transform
|
|
70
|
-
})
|
|
81
|
+
...responsive
|
|
71
82
|
};
|
|
72
83
|
});
|
|
73
84
|
return theme;
|
|
@@ -51,16 +51,27 @@ export default function responsiveFontSizes(themeInput, options = {}) {
|
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
const responsive = responsiveProperty({
|
|
55
|
+
cssProperty: 'fontSize',
|
|
56
|
+
min: minFontSize,
|
|
57
|
+
max: maxFontSize,
|
|
58
|
+
unit: 'rem',
|
|
59
|
+
breakpoints: breakpointValues,
|
|
60
|
+
transform
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// https://github.com/mui/material-ui/issues/40255
|
|
64
|
+
// Preserve the original font size at the largest breakpoint.
|
|
65
|
+
// Grid alignment can snap the max value away from the original designed size.
|
|
66
|
+
if (breakpointValues.length > 0) {
|
|
67
|
+
const lastBreakpoint = breakpointValues[breakpointValues.length - 1];
|
|
68
|
+
responsive[`@media (min-width:${lastBreakpoint}px)`] = {
|
|
69
|
+
fontSize: `${Math.round(maxFontSize * 10000) / 10000}rem`
|
|
70
|
+
};
|
|
71
|
+
}
|
|
54
72
|
typography[variant] = {
|
|
55
73
|
...style,
|
|
56
|
-
...
|
|
57
|
-
cssProperty: 'fontSize',
|
|
58
|
-
min: minFontSize,
|
|
59
|
-
max: maxFontSize,
|
|
60
|
-
unit: 'rem',
|
|
61
|
-
breakpoints: breakpointValues,
|
|
62
|
-
transform
|
|
63
|
-
})
|
|
74
|
+
...responsive
|
|
64
75
|
};
|
|
65
76
|
});
|
|
66
77
|
return theme;
|