@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
|
@@ -13,6 +13,7 @@ var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _NoSsr = _interopRequireDefault(require("../NoSsr"));
|
|
15
15
|
var _Drawer = _interopRequireWildcard(require("../Drawer/Drawer"));
|
|
16
|
+
var _contains = _interopRequireDefault(require("../utils/contains"));
|
|
16
17
|
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
|
17
18
|
var _ownerWindow = _interopRequireDefault(require("../utils/ownerWindow"));
|
|
18
19
|
var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallback"));
|
|
@@ -175,6 +176,9 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
175
176
|
const anchorRtl = (0, _Drawer.getAnchor)(theme, anchor);
|
|
176
177
|
const rtlTranslateMultiplier = ['right', 'bottom'].includes(anchorRtl) ? 1 : -1;
|
|
177
178
|
const horizontalSwipe = (0, _Drawer.isHorizontal)(anchor);
|
|
179
|
+
|
|
180
|
+
// Slide preserves this active-swipe `translate(x, y)` transform on exit.
|
|
181
|
+
// Keep this in sync with isGestureTranslate in Slide.js.
|
|
178
182
|
const transform = horizontalSwipe ? `translate(${rtlTranslateMultiplier * translate}px, 0)` : `translate(0, ${rtlTranslateMultiplier * translate}px)`;
|
|
179
183
|
const drawerStyle = paperRef.current.style;
|
|
180
184
|
drawerStyle.transform = transform;
|
|
@@ -291,7 +295,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
291
295
|
const horizontalSwipe = (0, _Drawer.isHorizontal)(anchor);
|
|
292
296
|
const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, (0, _ownerDocument.default)(nativeEvent.currentTarget));
|
|
293
297
|
const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, (0, _ownerWindow.default)(nativeEvent.currentTarget));
|
|
294
|
-
if (open && paperRef.current
|
|
298
|
+
if (open && (0, _contains.default)(paperRef.current, nativeEvent.target) && claimedSwipeInstance === null) {
|
|
295
299
|
const domTreeShapes = getDomTreeShapes(nativeEvent.target, paperRef.current);
|
|
296
300
|
const hasNativeHandler = computeHasNativeHandler({
|
|
297
301
|
domTreeShapes,
|
|
@@ -389,7 +393,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
389
393
|
}
|
|
390
394
|
|
|
391
395
|
// At least one element clogs the drawer interaction zone.
|
|
392
|
-
if (open && (hideBackdrop || !backdropRef.current
|
|
396
|
+
if (open && (hideBackdrop || !(0, _contains.default)(backdropRef.current, nativeEvent.target)) && !(0, _contains.default)(paperRef.current, nativeEvent.target)) {
|
|
393
397
|
return;
|
|
394
398
|
}
|
|
395
399
|
const anchorRtl = (0, _Drawer.getAnchor)(theme, anchor);
|
|
@@ -401,7 +405,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
401
405
|
// if disableSwipeToOpen
|
|
402
406
|
// if target != swipeArea, and target is not a child of paper ref
|
|
403
407
|
// if is a child of paper ref, and `allowSwipeInChildren` does not allow it
|
|
404
|
-
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || paperRef.current
|
|
408
|
+
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || (0, _contains.default)(paperRef.current, nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
|
|
405
409
|
return;
|
|
406
410
|
}
|
|
407
411
|
if (horizontalSwipe) {
|
|
@@ -5,6 +5,7 @@ import * as ReactDOM from 'react-dom';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import NoSsr from "../NoSsr/index.mjs";
|
|
7
7
|
import Drawer, { getAnchor, isHorizontal } from "../Drawer/Drawer.mjs";
|
|
8
|
+
import contains from "../utils/contains.mjs";
|
|
8
9
|
import ownerDocument from "../utils/ownerDocument.mjs";
|
|
9
10
|
import ownerWindow from "../utils/ownerWindow.mjs";
|
|
10
11
|
import useEventCallback from "../utils/useEventCallback.mjs";
|
|
@@ -168,6 +169,9 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
168
169
|
const anchorRtl = getAnchor(theme, anchor);
|
|
169
170
|
const rtlTranslateMultiplier = ['right', 'bottom'].includes(anchorRtl) ? 1 : -1;
|
|
170
171
|
const horizontalSwipe = isHorizontal(anchor);
|
|
172
|
+
|
|
173
|
+
// Slide preserves this active-swipe `translate(x, y)` transform on exit.
|
|
174
|
+
// Keep this in sync with isGestureTranslate in Slide.js.
|
|
171
175
|
const transform = horizontalSwipe ? `translate(${rtlTranslateMultiplier * translate}px, 0)` : `translate(0, ${rtlTranslateMultiplier * translate}px)`;
|
|
172
176
|
const drawerStyle = paperRef.current.style;
|
|
173
177
|
drawerStyle.transform = transform;
|
|
@@ -284,7 +288,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
284
288
|
const horizontalSwipe = isHorizontal(anchor);
|
|
285
289
|
const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
|
|
286
290
|
const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, ownerWindow(nativeEvent.currentTarget));
|
|
287
|
-
if (open && paperRef.current
|
|
291
|
+
if (open && contains(paperRef.current, nativeEvent.target) && claimedSwipeInstance === null) {
|
|
288
292
|
const domTreeShapes = getDomTreeShapes(nativeEvent.target, paperRef.current);
|
|
289
293
|
const hasNativeHandler = computeHasNativeHandler({
|
|
290
294
|
domTreeShapes,
|
|
@@ -382,7 +386,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
382
386
|
}
|
|
383
387
|
|
|
384
388
|
// At least one element clogs the drawer interaction zone.
|
|
385
|
-
if (open && (hideBackdrop || !backdropRef.current
|
|
389
|
+
if (open && (hideBackdrop || !contains(backdropRef.current, nativeEvent.target)) && !contains(paperRef.current, nativeEvent.target)) {
|
|
386
390
|
return;
|
|
387
391
|
}
|
|
388
392
|
const anchorRtl = getAnchor(theme, anchor);
|
|
@@ -394,7 +398,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
394
398
|
// if disableSwipeToOpen
|
|
395
399
|
// if target != swipeArea, and target is not a child of paper ref
|
|
396
400
|
// if is a child of paper ref, and `allowSwipeInChildren` does not allow it
|
|
397
|
-
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || paperRef.current
|
|
401
|
+
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || contains(paperRef.current, nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
|
|
398
402
|
return;
|
|
399
403
|
}
|
|
400
404
|
if (horizontalSwipe) {
|
package/Switch/Switch.js
CHANGED
|
@@ -19,6 +19,7 @@ var _zeroStyled = require("../zero-styled");
|
|
|
19
19
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
20
20
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
21
21
|
var _switchClasses = _interopRequireWildcard(require("./switchClasses"));
|
|
22
|
+
var _utils = require("../utils");
|
|
22
23
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
23
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
25
|
const useUtilityClasses = ownerState => {
|
|
@@ -186,12 +187,14 @@ const SwitchTrack = (0, _zeroStyled.styled)('span', {
|
|
|
186
187
|
height: '100%',
|
|
187
188
|
width: '100%',
|
|
188
189
|
borderRadius: 14 / 2,
|
|
189
|
-
boxSizing: 'border-box',
|
|
190
|
-
border: '1px solid transparent',
|
|
191
190
|
zIndex: -1,
|
|
192
191
|
transition: theme.transitions.create(['opacity', 'background-color'], {
|
|
193
192
|
duration: theme.transitions.duration.shortest
|
|
194
193
|
}),
|
|
194
|
+
'@media (forced-colors: active)': {
|
|
195
|
+
boxSizing: 'border-box',
|
|
196
|
+
border: '1px solid ButtonBorder'
|
|
197
|
+
},
|
|
195
198
|
backgroundColor: theme.vars ? theme.vars.palette.common.onBackground : `${theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white}`,
|
|
196
199
|
opacity: theme.vars ? theme.vars.opacity.switchTrack : `${theme.palette.mode === 'light' ? 0.38 : 0.3}`
|
|
197
200
|
})));
|
|
@@ -231,6 +234,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
231
234
|
size
|
|
232
235
|
};
|
|
233
236
|
const classes = useUtilityClasses(ownerState);
|
|
237
|
+
const externalInputProps = slotProps.input;
|
|
234
238
|
const externalForwardedProps = {
|
|
235
239
|
slots,
|
|
236
240
|
slotProps
|
|
@@ -284,11 +288,8 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
284
288
|
...(slotProps.switchBase && {
|
|
285
289
|
root: typeof slotProps.switchBase === 'function' ? slotProps.switchBase(ownerState) : slotProps.switchBase
|
|
286
290
|
}),
|
|
287
|
-
input: {
|
|
291
|
+
input: (0, _utils.mergeSlotProps)(typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps, {
|
|
288
292
|
role: 'switch'
|
|
289
|
-
},
|
|
290
|
-
...(slotProps.input && {
|
|
291
|
-
input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
|
|
292
293
|
})
|
|
293
294
|
}
|
|
294
295
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(TrackSlot, {
|
package/Switch/Switch.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { styled } from "../zero-styled/index.mjs";
|
|
|
12
12
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
13
13
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
14
14
|
import switchClasses, { getSwitchUtilityClass } from "./switchClasses.mjs";
|
|
15
|
+
import { mergeSlotProps } from "../utils/index.mjs";
|
|
15
16
|
import useSlot from "../utils/useSlot.mjs";
|
|
16
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const useUtilityClasses = ownerState => {
|
|
@@ -179,12 +180,14 @@ const SwitchTrack = styled('span', {
|
|
|
179
180
|
height: '100%',
|
|
180
181
|
width: '100%',
|
|
181
182
|
borderRadius: 14 / 2,
|
|
182
|
-
boxSizing: 'border-box',
|
|
183
|
-
border: '1px solid transparent',
|
|
184
183
|
zIndex: -1,
|
|
185
184
|
transition: theme.transitions.create(['opacity', 'background-color'], {
|
|
186
185
|
duration: theme.transitions.duration.shortest
|
|
187
186
|
}),
|
|
187
|
+
'@media (forced-colors: active)': {
|
|
188
|
+
boxSizing: 'border-box',
|
|
189
|
+
border: '1px solid ButtonBorder'
|
|
190
|
+
},
|
|
188
191
|
backgroundColor: theme.vars ? theme.vars.palette.common.onBackground : `${theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white}`,
|
|
189
192
|
opacity: theme.vars ? theme.vars.opacity.switchTrack : `${theme.palette.mode === 'light' ? 0.38 : 0.3}`
|
|
190
193
|
})));
|
|
@@ -224,6 +227,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
224
227
|
size
|
|
225
228
|
};
|
|
226
229
|
const classes = useUtilityClasses(ownerState);
|
|
230
|
+
const externalInputProps = slotProps.input;
|
|
227
231
|
const externalForwardedProps = {
|
|
228
232
|
slots,
|
|
229
233
|
slotProps
|
|
@@ -277,11 +281,8 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
277
281
|
...(slotProps.switchBase && {
|
|
278
282
|
root: typeof slotProps.switchBase === 'function' ? slotProps.switchBase(ownerState) : slotProps.switchBase
|
|
279
283
|
}),
|
|
280
|
-
input: {
|
|
284
|
+
input: mergeSlotProps(typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps, {
|
|
281
285
|
role: 'switch'
|
|
282
|
-
},
|
|
283
|
-
...(slotProps.input && {
|
|
284
|
-
input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
|
|
285
286
|
})
|
|
286
287
|
}
|
|
287
288
|
}), /*#__PURE__*/_jsx(TrackSlot, {
|
package/Tabs/ScrollbarSize.js
CHANGED
package/Tabs/ScrollbarSize.mjs
CHANGED
package/Tabs/Tabs.js
CHANGED
|
@@ -27,6 +27,7 @@ var _tabsClasses = _interopRequireWildcard(require("./tabsClasses"));
|
|
|
27
27
|
var _ownerWindow = _interopRequireDefault(require("../utils/ownerWindow"));
|
|
28
28
|
var _isLayoutSupported = _interopRequireDefault(require("../utils/isLayoutSupported"));
|
|
29
29
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
30
|
+
var _contains = _interopRequireDefault(require("../utils/contains"));
|
|
30
31
|
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
31
32
|
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
|
32
33
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
@@ -710,7 +711,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
710
711
|
getSlotProps: handlers => ({
|
|
711
712
|
...handlers,
|
|
712
713
|
onBlur: event => {
|
|
713
|
-
if (!event.currentTarget
|
|
714
|
+
if (!(0, _contains.default)(event.currentTarget, event.relatedTarget)) {
|
|
714
715
|
setIsFocusWithinList(false);
|
|
715
716
|
}
|
|
716
717
|
handlers.onBlur?.(event);
|
package/Tabs/Tabs.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import tabsClasses, { getTabsUtilityClass } from "./tabsClasses.mjs";
|
|
|
20
20
|
import ownerWindow from "../utils/ownerWindow.mjs";
|
|
21
21
|
import isLayoutSupported from "../utils/isLayoutSupported.mjs";
|
|
22
22
|
import useSlot from "../utils/useSlot.mjs";
|
|
23
|
+
import contains from "../utils/contains.mjs";
|
|
23
24
|
import getActiveElement from "../utils/getActiveElement.mjs";
|
|
24
25
|
import ownerDocument from "../utils/ownerDocument.mjs";
|
|
25
26
|
import useForkRef from "../utils/useForkRef.mjs";
|
|
@@ -703,7 +704,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
703
704
|
getSlotProps: handlers => ({
|
|
704
705
|
...handlers,
|
|
705
706
|
onBlur: event => {
|
|
706
|
-
if (!event.currentTarget
|
|
707
|
+
if (!contains(event.currentTarget, event.relatedTarget)) {
|
|
707
708
|
setIsFocusWithinList(false);
|
|
708
709
|
}
|
|
709
710
|
handlers.onBlur?.(event);
|
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,
|
|
171
|
+
}) => ownerState.touch,
|
|
225
172
|
style: {
|
|
226
173
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="left"] &`]: {
|
|
227
|
-
|
|
174
|
+
marginInlineEnd: '24px'
|
|
228
175
|
},
|
|
229
176
|
[`.${_tooltipClasses.default.popper}[data-popper-placement*="right"] &`]: {
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
props: ({
|
|
235
|
-
ownerState
|
|
236
|
-
}) => !!ownerState.isRtl,
|
|
237
|
-
style: {
|
|
238
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="left"] &`]: {
|
|
239
|
-
marginLeft: '14px'
|
|
177
|
+
marginInlineStart: '24px'
|
|
240
178
|
},
|
|
241
|
-
[`.${_tooltipClasses.default.popper}[data-popper-placement*="right"] &`]: {
|
|
242
|
-
marginRight: '14px'
|
|
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'
|
|
252
|
-
},
|
|
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);
|
|
@@ -450,7 +360,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
450
360
|
const handleBlur = event => {
|
|
451
361
|
// Needed for https://github.com/mui/material-ui/issues/45373
|
|
452
362
|
const target = event?.target ?? childNode;
|
|
453
|
-
if (!target || !(0, _isFocusVisible.default)(target)) {
|
|
363
|
+
if (!target || target.disabled || !(0, _isFocusVisible.default)(target)) {
|
|
454
364
|
setChildIsFocusVisible(false);
|
|
455
365
|
|
|
456
366
|
// InputBase can call onBlur() without an event when the input becomes disabled.
|
|
@@ -478,6 +388,15 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
478
388
|
setChildNode(event.currentTarget);
|
|
479
389
|
}
|
|
480
390
|
if ((0, _isFocusVisible.default)(event.target)) {
|
|
391
|
+
// Workaround for https://github.com/facebook/react/issues/9142.
|
|
392
|
+
// React does not fire blur when a focused element becomes disabled.
|
|
393
|
+
const handleNativeBlur = blurEvent => {
|
|
394
|
+
if (blurEvent.target.disabled) {
|
|
395
|
+
handleBlur(blurEvent);
|
|
396
|
+
}
|
|
397
|
+
blurEvent.target.removeEventListener('blur', handleNativeBlur);
|
|
398
|
+
};
|
|
399
|
+
event.target.addEventListener('blur', handleNativeBlur);
|
|
481
400
|
setChildIsFocusVisible(true);
|
|
482
401
|
handleMouseOver(event);
|
|
483
402
|
}
|
|
@@ -609,7 +528,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
609
528
|
}
|
|
610
529
|
const ownerState = {
|
|
611
530
|
...props,
|
|
612
|
-
isRtl,
|
|
613
531
|
arrow,
|
|
614
532
|
disableInteractive,
|
|
615
533
|
placement,
|