@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/Stepper/Stepper.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface StepperOwnProps extends Pick<PaperProps, 'elevation' | 'square'
|
|
|
15
15
|
/**
|
|
16
16
|
* If set to 'true' and orientation is horizontal,
|
|
17
17
|
* then the step label will be positioned under the icon.
|
|
18
|
+
* If set to 'true' and orientation is vertical,
|
|
19
|
+
* it reverses the position of the label and content.
|
|
18
20
|
* @default false
|
|
19
21
|
*/
|
|
20
22
|
alternativeLabel?: boolean | undefined;
|
package/Stepper/Stepper.js
CHANGED
|
@@ -55,6 +55,14 @@ const StepperRoot = (0, _zeroStyled.styled)('ol', {
|
|
|
55
55
|
flexDirection: 'row',
|
|
56
56
|
alignItems: 'center'
|
|
57
57
|
}
|
|
58
|
+
}, {
|
|
59
|
+
props: {
|
|
60
|
+
orientation: 'horizontal',
|
|
61
|
+
alternativeLabel: false
|
|
62
|
+
},
|
|
63
|
+
style: {
|
|
64
|
+
gap: 8
|
|
65
|
+
}
|
|
58
66
|
}, {
|
|
59
67
|
props: {
|
|
60
68
|
orientation: 'vertical'
|
|
@@ -69,6 +77,14 @@ const StepperRoot = (0, _zeroStyled.styled)('ol', {
|
|
|
69
77
|
style: {
|
|
70
78
|
alignItems: 'flex-start'
|
|
71
79
|
}
|
|
80
|
+
}, {
|
|
81
|
+
props: {
|
|
82
|
+
orientation: 'vertical',
|
|
83
|
+
alternativeLabel: true
|
|
84
|
+
},
|
|
85
|
+
style: {
|
|
86
|
+
alignItems: 'flex-end'
|
|
87
|
+
}
|
|
72
88
|
}]
|
|
73
89
|
});
|
|
74
90
|
const defaultConnector = /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepConnector.default, {});
|
|
@@ -200,6 +216,8 @@ process.env.NODE_ENV !== "production" ? Stepper.propTypes /* remove-proptypes */
|
|
|
200
216
|
/**
|
|
201
217
|
* If set to 'true' and orientation is horizontal,
|
|
202
218
|
* then the step label will be positioned under the icon.
|
|
219
|
+
* If set to 'true' and orientation is vertical,
|
|
220
|
+
* it reverses the position of the label and content.
|
|
203
221
|
* @default false
|
|
204
222
|
*/
|
|
205
223
|
alternativeLabel: _propTypes.default.bool,
|
package/Stepper/Stepper.mjs
CHANGED
|
@@ -48,6 +48,14 @@ const StepperRoot = styled('ol', {
|
|
|
48
48
|
flexDirection: 'row',
|
|
49
49
|
alignItems: 'center'
|
|
50
50
|
}
|
|
51
|
+
}, {
|
|
52
|
+
props: {
|
|
53
|
+
orientation: 'horizontal',
|
|
54
|
+
alternativeLabel: false
|
|
55
|
+
},
|
|
56
|
+
style: {
|
|
57
|
+
gap: 8
|
|
58
|
+
}
|
|
51
59
|
}, {
|
|
52
60
|
props: {
|
|
53
61
|
orientation: 'vertical'
|
|
@@ -62,6 +70,14 @@ const StepperRoot = styled('ol', {
|
|
|
62
70
|
style: {
|
|
63
71
|
alignItems: 'flex-start'
|
|
64
72
|
}
|
|
73
|
+
}, {
|
|
74
|
+
props: {
|
|
75
|
+
orientation: 'vertical',
|
|
76
|
+
alternativeLabel: true
|
|
77
|
+
},
|
|
78
|
+
style: {
|
|
79
|
+
alignItems: 'flex-end'
|
|
80
|
+
}
|
|
65
81
|
}]
|
|
66
82
|
});
|
|
67
83
|
const defaultConnector = /*#__PURE__*/_jsx(StepConnector, {});
|
|
@@ -193,6 +209,8 @@ process.env.NODE_ENV !== "production" ? Stepper.propTypes /* remove-proptypes */
|
|
|
193
209
|
/**
|
|
194
210
|
* If set to 'true' and orientation is horizontal,
|
|
195
211
|
* then the step label will be positioned under the icon.
|
|
212
|
+
* If set to 'true' and orientation is vertical,
|
|
213
|
+
* it reverses the position of the label and content.
|
|
196
214
|
* @default false
|
|
197
215
|
*/
|
|
198
216
|
alternativeLabel: PropTypes.bool,
|
package/SvgIcon/SvgIcon.js
CHANGED
|
@@ -16,6 +16,7 @@ var _zeroStyled = require("../zero-styled");
|
|
|
16
16
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
17
17
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
18
18
|
var _svgIconClasses = require("./svgIconClasses");
|
|
19
|
+
var _utils = require("../transitions/utils");
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
21
|
const useUtilityClasses = ownerState => {
|
|
21
22
|
const {
|
|
@@ -45,7 +46,7 @@ const SvgIconRoot = (0, _zeroStyled.styled)('svg', {
|
|
|
45
46
|
height: '1em',
|
|
46
47
|
display: 'inline-block',
|
|
47
48
|
flexShrink: 0,
|
|
48
|
-
|
|
49
|
+
...(0, _utils.getTransitionStyles)(theme, 'fill', {
|
|
49
50
|
duration: (theme.vars ?? theme).transitions?.duration?.shorter
|
|
50
51
|
}),
|
|
51
52
|
variants: [{
|
package/SvgIcon/SvgIcon.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { styled } from "../zero-styled/index.mjs";
|
|
|
9
9
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
10
10
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
11
11
|
import { getSvgIconUtilityClass } from "./svgIconClasses.mjs";
|
|
12
|
+
import { getTransitionStyles } from "../transitions/utils.mjs";
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
14
15
|
const {
|
|
@@ -38,7 +39,7 @@ const SvgIconRoot = styled('svg', {
|
|
|
38
39
|
height: '1em',
|
|
39
40
|
display: 'inline-block',
|
|
40
41
|
flexShrink: 0,
|
|
41
|
-
|
|
42
|
+
...getTransitionStyles(theme, 'fill', {
|
|
42
43
|
duration: (theme.vars ?? theme).transitions?.duration?.shorter
|
|
43
44
|
}),
|
|
44
45
|
variants: [{
|
|
@@ -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"));
|
|
@@ -20,6 +21,7 @@ var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEff
|
|
|
20
21
|
var _zeroStyled = require("../zero-styled");
|
|
21
22
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
22
23
|
var _utils = require("../transitions/utils");
|
|
24
|
+
var _useReducedMotion = _interopRequireDefault(require("../transitions/useReducedMotion"));
|
|
23
25
|
var _utils2 = require("../utils");
|
|
24
26
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
25
27
|
var _SwipeArea = _interopRequireDefault(require("./SwipeArea"));
|
|
@@ -151,6 +153,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
151
153
|
slotProps = {},
|
|
152
154
|
...other
|
|
153
155
|
} = props;
|
|
156
|
+
const reducedMotion = (0, _useReducedMotion.default)(theme.motion.reducedMotion, false);
|
|
154
157
|
const [maybeSwiping, setMaybeSwiping] = React.useState(false);
|
|
155
158
|
const swipeInstance = React.useRef({
|
|
156
159
|
isSwiping: null
|
|
@@ -175,18 +178,30 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
175
178
|
const anchorRtl = (0, _Drawer.getAnchor)(theme, anchor);
|
|
176
179
|
const rtlTranslateMultiplier = ['right', 'bottom'].includes(anchorRtl) ? 1 : -1;
|
|
177
180
|
const horizontalSwipe = (0, _Drawer.isHorizontal)(anchor);
|
|
181
|
+
|
|
182
|
+
// Slide preserves this active-swipe `translate(x, y)` transform on exit.
|
|
183
|
+
// Keep this in sync with isGestureTranslate in Slide.js.
|
|
178
184
|
const transform = horizontalSwipe ? `translate(${rtlTranslateMultiplier * translate}px, 0)` : `translate(0, ${rtlTranslateMultiplier * translate}px)`;
|
|
179
185
|
const drawerStyle = paperRef.current.style;
|
|
180
186
|
drawerStyle.transform = transform;
|
|
181
187
|
let transition = '';
|
|
182
188
|
if (mode) {
|
|
183
|
-
|
|
189
|
+
const transitionProps = (0, _utils.getTransitionProps)({
|
|
184
190
|
easing: undefined,
|
|
185
191
|
style: undefined,
|
|
186
192
|
timeout: transitionDuration
|
|
187
193
|
}, {
|
|
188
194
|
mode
|
|
189
|
-
})
|
|
195
|
+
});
|
|
196
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
197
|
+
duration: transitionProps.duration,
|
|
198
|
+
delay: transitionProps.delay
|
|
199
|
+
});
|
|
200
|
+
transition = theme.transitions.create('all', {
|
|
201
|
+
...transitionProps,
|
|
202
|
+
duration: transitionTiming.duration,
|
|
203
|
+
delay: transitionTiming.delay
|
|
204
|
+
});
|
|
190
205
|
}
|
|
191
206
|
if (changeTransition) {
|
|
192
207
|
drawerStyle.transition = transition;
|
|
@@ -198,7 +213,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
198
213
|
backdropStyle.transition = transition;
|
|
199
214
|
}
|
|
200
215
|
}
|
|
201
|
-
}, [anchor, disableBackdropTransition, hideBackdrop, theme, transitionDuration]);
|
|
216
|
+
}, [anchor, disableBackdropTransition, hideBackdrop, reducedMotion, theme, transitionDuration]);
|
|
202
217
|
const handleBodyTouchEnd = (0, _useEventCallback.default)(nativeEvent => {
|
|
203
218
|
if (!touchDetected.current) {
|
|
204
219
|
return;
|
|
@@ -291,7 +306,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
291
306
|
const horizontalSwipe = (0, _Drawer.isHorizontal)(anchor);
|
|
292
307
|
const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, (0, _ownerDocument.default)(nativeEvent.currentTarget));
|
|
293
308
|
const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, (0, _ownerWindow.default)(nativeEvent.currentTarget));
|
|
294
|
-
if (open && paperRef.current
|
|
309
|
+
if (open && (0, _contains.default)(paperRef.current, nativeEvent.target) && claimedSwipeInstance === null) {
|
|
295
310
|
const domTreeShapes = getDomTreeShapes(nativeEvent.target, paperRef.current);
|
|
296
311
|
const hasNativeHandler = computeHasNativeHandler({
|
|
297
312
|
domTreeShapes,
|
|
@@ -389,7 +404,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
389
404
|
}
|
|
390
405
|
|
|
391
406
|
// At least one element clogs the drawer interaction zone.
|
|
392
|
-
if (open && (hideBackdrop || !backdropRef.current
|
|
407
|
+
if (open && (hideBackdrop || !(0, _contains.default)(backdropRef.current, nativeEvent.target)) && !(0, _contains.default)(paperRef.current, nativeEvent.target)) {
|
|
393
408
|
return;
|
|
394
409
|
}
|
|
395
410
|
const anchorRtl = (0, _Drawer.getAnchor)(theme, anchor);
|
|
@@ -401,7 +416,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
401
416
|
// if disableSwipeToOpen
|
|
402
417
|
// if target != swipeArea, and target is not a child of paper ref
|
|
403
418
|
// if is a child of paper ref, and `allowSwipeInChildren` does not allow it
|
|
404
|
-
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || paperRef.current
|
|
419
|
+
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || (0, _contains.default)(paperRef.current, nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
|
|
405
420
|
return;
|
|
406
421
|
}
|
|
407
422
|
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";
|
|
@@ -12,6 +13,7 @@ import useEnhancedEffect from "../utils/useEnhancedEffect.mjs";
|
|
|
12
13
|
import { useTheme } from "../zero-styled/index.mjs";
|
|
13
14
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
14
15
|
import { getTransitionProps } from "../transitions/utils.mjs";
|
|
16
|
+
import useReducedMotion from "../transitions/useReducedMotion.mjs";
|
|
15
17
|
import { mergeSlotProps } from "../utils/index.mjs";
|
|
16
18
|
import useSlot from "../utils/useSlot.mjs";
|
|
17
19
|
import SwipeArea from "./SwipeArea.mjs";
|
|
@@ -144,6 +146,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
144
146
|
slotProps = {},
|
|
145
147
|
...other
|
|
146
148
|
} = props;
|
|
149
|
+
const reducedMotion = useReducedMotion(theme.motion.reducedMotion, false);
|
|
147
150
|
const [maybeSwiping, setMaybeSwiping] = React.useState(false);
|
|
148
151
|
const swipeInstance = React.useRef({
|
|
149
152
|
isSwiping: null
|
|
@@ -168,18 +171,30 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
168
171
|
const anchorRtl = getAnchor(theme, anchor);
|
|
169
172
|
const rtlTranslateMultiplier = ['right', 'bottom'].includes(anchorRtl) ? 1 : -1;
|
|
170
173
|
const horizontalSwipe = isHorizontal(anchor);
|
|
174
|
+
|
|
175
|
+
// Slide preserves this active-swipe `translate(x, y)` transform on exit.
|
|
176
|
+
// Keep this in sync with isGestureTranslate in Slide.js.
|
|
171
177
|
const transform = horizontalSwipe ? `translate(${rtlTranslateMultiplier * translate}px, 0)` : `translate(0, ${rtlTranslateMultiplier * translate}px)`;
|
|
172
178
|
const drawerStyle = paperRef.current.style;
|
|
173
179
|
drawerStyle.transform = transform;
|
|
174
180
|
let transition = '';
|
|
175
181
|
if (mode) {
|
|
176
|
-
|
|
182
|
+
const transitionProps = getTransitionProps({
|
|
177
183
|
easing: undefined,
|
|
178
184
|
style: undefined,
|
|
179
185
|
timeout: transitionDuration
|
|
180
186
|
}, {
|
|
181
187
|
mode
|
|
182
|
-
})
|
|
188
|
+
});
|
|
189
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
190
|
+
duration: transitionProps.duration,
|
|
191
|
+
delay: transitionProps.delay
|
|
192
|
+
});
|
|
193
|
+
transition = theme.transitions.create('all', {
|
|
194
|
+
...transitionProps,
|
|
195
|
+
duration: transitionTiming.duration,
|
|
196
|
+
delay: transitionTiming.delay
|
|
197
|
+
});
|
|
183
198
|
}
|
|
184
199
|
if (changeTransition) {
|
|
185
200
|
drawerStyle.transition = transition;
|
|
@@ -191,7 +206,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
191
206
|
backdropStyle.transition = transition;
|
|
192
207
|
}
|
|
193
208
|
}
|
|
194
|
-
}, [anchor, disableBackdropTransition, hideBackdrop, theme, transitionDuration]);
|
|
209
|
+
}, [anchor, disableBackdropTransition, hideBackdrop, reducedMotion, theme, transitionDuration]);
|
|
195
210
|
const handleBodyTouchEnd = useEventCallback(nativeEvent => {
|
|
196
211
|
if (!touchDetected.current) {
|
|
197
212
|
return;
|
|
@@ -284,7 +299,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
284
299
|
const horizontalSwipe = isHorizontal(anchor);
|
|
285
300
|
const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
|
|
286
301
|
const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, ownerWindow(nativeEvent.currentTarget));
|
|
287
|
-
if (open && paperRef.current
|
|
302
|
+
if (open && contains(paperRef.current, nativeEvent.target) && claimedSwipeInstance === null) {
|
|
288
303
|
const domTreeShapes = getDomTreeShapes(nativeEvent.target, paperRef.current);
|
|
289
304
|
const hasNativeHandler = computeHasNativeHandler({
|
|
290
305
|
domTreeShapes,
|
|
@@ -382,7 +397,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
382
397
|
}
|
|
383
398
|
|
|
384
399
|
// At least one element clogs the drawer interaction zone.
|
|
385
|
-
if (open && (hideBackdrop || !backdropRef.current
|
|
400
|
+
if (open && (hideBackdrop || !contains(backdropRef.current, nativeEvent.target)) && !contains(paperRef.current, nativeEvent.target)) {
|
|
386
401
|
return;
|
|
387
402
|
}
|
|
388
403
|
const anchorRtl = getAnchor(theme, anchor);
|
|
@@ -394,7 +409,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
|
|
|
394
409
|
// if disableSwipeToOpen
|
|
395
410
|
// if target != swipeArea, and target is not a child of paper ref
|
|
396
411
|
// if is a child of paper ref, and `allowSwipeInChildren` does not allow it
|
|
397
|
-
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || paperRef.current
|
|
412
|
+
if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || contains(paperRef.current, nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
|
|
398
413
|
return;
|
|
399
414
|
}
|
|
400
415
|
if (horizontalSwipe) {
|
package/Switch/Switch.js
CHANGED
|
@@ -19,7 +19,9 @@ 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"));
|
|
24
|
+
var _utils2 = require("../transitions/utils");
|
|
23
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
26
|
const useUtilityClasses = ownerState => {
|
|
25
27
|
const {
|
|
@@ -124,7 +126,7 @@ const SwitchSwitchBase = (0, _zeroStyled.styled)(_SwitchBase.default, {
|
|
|
124
126
|
zIndex: 1,
|
|
125
127
|
// Render above the focus ripple.
|
|
126
128
|
color: theme.vars ? theme.vars.palette.Switch.defaultColor : `${theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.grey[300]}`,
|
|
127
|
-
|
|
129
|
+
...(0, _utils2.getTransitionStyles)(theme, ['left', 'transform'], {
|
|
128
130
|
duration: theme.transitions.duration.shortest
|
|
129
131
|
}),
|
|
130
132
|
[`&.${_switchClasses.default.checked}`]: {
|
|
@@ -186,12 +188,14 @@ const SwitchTrack = (0, _zeroStyled.styled)('span', {
|
|
|
186
188
|
height: '100%',
|
|
187
189
|
width: '100%',
|
|
188
190
|
borderRadius: 14 / 2,
|
|
189
|
-
boxSizing: 'border-box',
|
|
190
|
-
border: '1px solid transparent',
|
|
191
191
|
zIndex: -1,
|
|
192
|
-
|
|
192
|
+
...(0, _utils2.getTransitionStyles)(theme, ['opacity', 'background-color'], {
|
|
193
193
|
duration: theme.transitions.duration.shortest
|
|
194
194
|
}),
|
|
195
|
+
'@media (forced-colors: active)': {
|
|
196
|
+
boxSizing: 'border-box',
|
|
197
|
+
border: '1px solid ButtonBorder'
|
|
198
|
+
},
|
|
195
199
|
backgroundColor: theme.vars ? theme.vars.palette.common.onBackground : `${theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white}`,
|
|
196
200
|
opacity: theme.vars ? theme.vars.opacity.switchTrack : `${theme.palette.mode === 'light' ? 0.38 : 0.3}`
|
|
197
201
|
})));
|
|
@@ -231,6 +235,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
231
235
|
size
|
|
232
236
|
};
|
|
233
237
|
const classes = useUtilityClasses(ownerState);
|
|
238
|
+
const externalInputProps = slotProps.input;
|
|
234
239
|
const externalForwardedProps = {
|
|
235
240
|
slots,
|
|
236
241
|
slotProps
|
|
@@ -284,11 +289,8 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
284
289
|
...(slotProps.switchBase && {
|
|
285
290
|
root: typeof slotProps.switchBase === 'function' ? slotProps.switchBase(ownerState) : slotProps.switchBase
|
|
286
291
|
}),
|
|
287
|
-
input: {
|
|
292
|
+
input: (0, _utils.mergeSlotProps)(typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps, {
|
|
288
293
|
role: 'switch'
|
|
289
|
-
},
|
|
290
|
-
...(slotProps.input && {
|
|
291
|
-
input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
|
|
292
294
|
})
|
|
293
295
|
}
|
|
294
296
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(TrackSlot, {
|
package/Switch/Switch.mjs
CHANGED
|
@@ -12,7 +12,9 @@ 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";
|
|
17
|
+
import { getTransitionStyles } from "../transitions/utils.mjs";
|
|
16
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
19
|
const useUtilityClasses = ownerState => {
|
|
18
20
|
const {
|
|
@@ -117,7 +119,7 @@ const SwitchSwitchBase = styled(SwitchBase, {
|
|
|
117
119
|
zIndex: 1,
|
|
118
120
|
// Render above the focus ripple.
|
|
119
121
|
color: theme.vars ? theme.vars.palette.Switch.defaultColor : `${theme.palette.mode === 'light' ? theme.palette.common.white : theme.palette.grey[300]}`,
|
|
120
|
-
|
|
122
|
+
...getTransitionStyles(theme, ['left', 'transform'], {
|
|
121
123
|
duration: theme.transitions.duration.shortest
|
|
122
124
|
}),
|
|
123
125
|
[`&.${switchClasses.checked}`]: {
|
|
@@ -179,12 +181,14 @@ const SwitchTrack = styled('span', {
|
|
|
179
181
|
height: '100%',
|
|
180
182
|
width: '100%',
|
|
181
183
|
borderRadius: 14 / 2,
|
|
182
|
-
boxSizing: 'border-box',
|
|
183
|
-
border: '1px solid transparent',
|
|
184
184
|
zIndex: -1,
|
|
185
|
-
|
|
185
|
+
...getTransitionStyles(theme, ['opacity', 'background-color'], {
|
|
186
186
|
duration: theme.transitions.duration.shortest
|
|
187
187
|
}),
|
|
188
|
+
'@media (forced-colors: active)': {
|
|
189
|
+
boxSizing: 'border-box',
|
|
190
|
+
border: '1px solid ButtonBorder'
|
|
191
|
+
},
|
|
188
192
|
backgroundColor: theme.vars ? theme.vars.palette.common.onBackground : `${theme.palette.mode === 'light' ? theme.palette.common.black : theme.palette.common.white}`,
|
|
189
193
|
opacity: theme.vars ? theme.vars.opacity.switchTrack : `${theme.palette.mode === 'light' ? 0.38 : 0.3}`
|
|
190
194
|
})));
|
|
@@ -224,6 +228,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
224
228
|
size
|
|
225
229
|
};
|
|
226
230
|
const classes = useUtilityClasses(ownerState);
|
|
231
|
+
const externalInputProps = slotProps.input;
|
|
227
232
|
const externalForwardedProps = {
|
|
228
233
|
slots,
|
|
229
234
|
slotProps
|
|
@@ -277,11 +282,8 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
277
282
|
...(slotProps.switchBase && {
|
|
278
283
|
root: typeof slotProps.switchBase === 'function' ? slotProps.switchBase(ownerState) : slotProps.switchBase
|
|
279
284
|
}),
|
|
280
|
-
input: {
|
|
285
|
+
input: mergeSlotProps(typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps, {
|
|
281
286
|
role: 'switch'
|
|
282
|
-
},
|
|
283
|
-
...(slotProps.input && {
|
|
284
|
-
input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
|
|
285
287
|
})
|
|
286
288
|
}
|
|
287
289
|
}), /*#__PURE__*/_jsx(TrackSlot, {
|
|
@@ -19,6 +19,7 @@ var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
|
19
19
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
20
20
|
var _tableSortLabelClasses = _interopRequireWildcard(require("./tableSortLabelClasses"));
|
|
21
21
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
22
|
+
var _utils = require("../transitions/utils");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
const useUtilityClasses = ownerState => {
|
|
24
25
|
const {
|
|
@@ -76,7 +77,7 @@ const TableSortLabelIcon = (0, _zeroStyled.styled)('span', {
|
|
|
76
77
|
marginRight: 4,
|
|
77
78
|
marginLeft: 4,
|
|
78
79
|
opacity: 0,
|
|
79
|
-
|
|
80
|
+
...(0, _utils.getTransitionStyles)(theme, ['opacity', 'transform'], {
|
|
80
81
|
duration: theme.transitions.duration.shorter
|
|
81
82
|
}),
|
|
82
83
|
userSelect: 'none',
|
|
@@ -12,6 +12,7 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
|
12
12
|
import capitalize from "../utils/capitalize.mjs";
|
|
13
13
|
import tableSortLabelClasses, { getTableSortLabelUtilityClass } from "./tableSortLabelClasses.mjs";
|
|
14
14
|
import useSlot from "../utils/useSlot.mjs";
|
|
15
|
+
import { getTransitionStyles } from "../transitions/utils.mjs";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const useUtilityClasses = ownerState => {
|
|
17
18
|
const {
|
|
@@ -69,7 +70,7 @@ const TableSortLabelIcon = styled('span', {
|
|
|
69
70
|
marginRight: 4,
|
|
70
71
|
marginLeft: 4,
|
|
71
72
|
opacity: 0,
|
|
72
|
-
|
|
73
|
+
...getTransitionStyles(theme, ['opacity', 'transform'], {
|
|
73
74
|
duration: theme.transitions.duration.shorter
|
|
74
75
|
}),
|
|
75
76
|
userSelect: 'none',
|
package/Tabs/ScrollbarSize.js
CHANGED
package/Tabs/ScrollbarSize.mjs
CHANGED
package/Tabs/Tabs.js
CHANGED
|
@@ -20,6 +20,7 @@ var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
|
20
20
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
21
21
|
var _debounce = _interopRequireDefault(require("../utils/debounce"));
|
|
22
22
|
var _animate = _interopRequireDefault(require("../internal/animate"));
|
|
23
|
+
var _useReducedMotion = _interopRequireDefault(require("../transitions/useReducedMotion"));
|
|
23
24
|
var _ScrollbarSize = _interopRequireDefault(require("./ScrollbarSize"));
|
|
24
25
|
var _TabScrollButton = _interopRequireDefault(require("../TabScrollButton"));
|
|
25
26
|
var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallback"));
|
|
@@ -27,10 +28,12 @@ var _tabsClasses = _interopRequireWildcard(require("./tabsClasses"));
|
|
|
27
28
|
var _ownerWindow = _interopRequireDefault(require("../utils/ownerWindow"));
|
|
28
29
|
var _isLayoutSupported = _interopRequireDefault(require("../utils/isLayoutSupported"));
|
|
29
30
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
31
|
+
var _contains = _interopRequireDefault(require("../utils/contains"));
|
|
30
32
|
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
31
33
|
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
|
32
34
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
33
35
|
var _useRovingTabIndex = require("../utils/useRovingTabIndex");
|
|
36
|
+
var _utils = require("../transitions/utils");
|
|
34
37
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
38
|
const useUtilityClasses = ownerState => {
|
|
36
39
|
const {
|
|
@@ -184,7 +187,7 @@ const TabsIndicator = (0, _zeroStyled.styled)('span', {
|
|
|
184
187
|
height: 2,
|
|
185
188
|
bottom: 0,
|
|
186
189
|
width: '100%',
|
|
187
|
-
|
|
190
|
+
...(0, _utils.getTransitionStyles)(theme),
|
|
188
191
|
variants: [{
|
|
189
192
|
props: {
|
|
190
193
|
indicatorColor: 'primary'
|
|
@@ -221,6 +224,12 @@ const TabsScrollbarSize = (0, _zeroStyled.styled)(_ScrollbarSize.default)({
|
|
|
221
224
|
}
|
|
222
225
|
});
|
|
223
226
|
const defaultIndicatorStyle = {};
|
|
227
|
+
|
|
228
|
+
// Dev-only: tracks per-`Tabs` instance (keyed by its ref) whether the invalid-value warning was
|
|
229
|
+
// already logged, so it isn't repeated across the several effects that call `getTabsMeta`.
|
|
230
|
+
// Only referenced from `process.env.NODE_ENV !== 'production'` blocks; the `@__PURE__` annotation
|
|
231
|
+
// lets minifiers drop it (and the `WeakMap` allocation) entirely from production builds.
|
|
232
|
+
const warnedTabValueInvalid = /* @__PURE__ */new WeakMap();
|
|
224
233
|
let warnedOnceTabPresent = false;
|
|
225
234
|
const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
226
235
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
@@ -229,6 +238,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
229
238
|
});
|
|
230
239
|
const theme = (0, _zeroStyled.useTheme)();
|
|
231
240
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
241
|
+
const reducedMotion = (0, _useReducedMotion.default)(theme.motion.reducedMotion, false);
|
|
232
242
|
const {
|
|
233
243
|
'aria-label': ariaLabel,
|
|
234
244
|
'aria-labelledby': ariaLabelledBy,
|
|
@@ -335,7 +345,9 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
335
345
|
if (children.length > 0) {
|
|
336
346
|
const tab = children[valueToIndex.get(value)];
|
|
337
347
|
if (process.env.NODE_ENV !== 'production') {
|
|
338
|
-
|
|
348
|
+
// `getTabsMeta` runs from several effects, so guard against logging the warning repeatedly.
|
|
349
|
+
if (!tab && !warnedTabValueInvalid.has(tabsRef)) {
|
|
350
|
+
warnedTabValueInvalid.set(tabsRef, true);
|
|
339
351
|
console.error([`MUI: The \`value\` provided to the Tabs component is invalid.`, `None of the Tabs' children match with "${value}".`, valueToIndex.keys ? `You can provide one of the following values: ${Array.from(valueToIndex.keys()).join(', ')}.` : null].join('\n'));
|
|
340
352
|
}
|
|
341
353
|
}
|
|
@@ -392,7 +404,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
392
404
|
const scroll = (scrollValue, {
|
|
393
405
|
animation = true
|
|
394
406
|
} = {}) => {
|
|
395
|
-
if (animation) {
|
|
407
|
+
if (animation && !reducedMotion.shouldReduceMotion) {
|
|
396
408
|
(0, _animate.default)(scrollStart, tabsRef.current, scrollValue, {
|
|
397
409
|
duration: theme.transitions.duration.standard
|
|
398
410
|
});
|
|
@@ -710,7 +722,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
710
722
|
getSlotProps: handlers => ({
|
|
711
723
|
...handlers,
|
|
712
724
|
onBlur: event => {
|
|
713
|
-
if (!event.currentTarget
|
|
725
|
+
if (!(0, _contains.default)(event.currentTarget, event.relatedTarget)) {
|
|
714
726
|
setIsFocusWithinList(false);
|
|
715
727
|
}
|
|
716
728
|
handlers.onBlur?.(event);
|
package/Tabs/Tabs.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import memoTheme from "../utils/memoTheme.mjs";
|
|
|
13
13
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
14
14
|
import debounce from "../utils/debounce.mjs";
|
|
15
15
|
import animate from "../internal/animate.mjs";
|
|
16
|
+
import useReducedMotion from "../transitions/useReducedMotion.mjs";
|
|
16
17
|
import ScrollbarSize from "./ScrollbarSize.mjs";
|
|
17
18
|
import TabScrollButton from "../TabScrollButton/index.mjs";
|
|
18
19
|
import useEventCallback from "../utils/useEventCallback.mjs";
|
|
@@ -20,10 +21,12 @@ import tabsClasses, { getTabsUtilityClass } from "./tabsClasses.mjs";
|
|
|
20
21
|
import ownerWindow from "../utils/ownerWindow.mjs";
|
|
21
22
|
import isLayoutSupported from "../utils/isLayoutSupported.mjs";
|
|
22
23
|
import useSlot from "../utils/useSlot.mjs";
|
|
24
|
+
import contains from "../utils/contains.mjs";
|
|
23
25
|
import getActiveElement from "../utils/getActiveElement.mjs";
|
|
24
26
|
import ownerDocument from "../utils/ownerDocument.mjs";
|
|
25
27
|
import useForkRef from "../utils/useForkRef.mjs";
|
|
26
28
|
import { RovingTabIndexContext, useRovingTabIndexRoot } from "../utils/useRovingTabIndex.mjs";
|
|
29
|
+
import { getTransitionStyles } from "../transitions/utils.mjs";
|
|
27
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
31
|
const useUtilityClasses = ownerState => {
|
|
29
32
|
const {
|
|
@@ -177,7 +180,7 @@ const TabsIndicator = styled('span', {
|
|
|
177
180
|
height: 2,
|
|
178
181
|
bottom: 0,
|
|
179
182
|
width: '100%',
|
|
180
|
-
|
|
183
|
+
...getTransitionStyles(theme),
|
|
181
184
|
variants: [{
|
|
182
185
|
props: {
|
|
183
186
|
indicatorColor: 'primary'
|
|
@@ -214,6 +217,12 @@ const TabsScrollbarSize = styled(ScrollbarSize)({
|
|
|
214
217
|
}
|
|
215
218
|
});
|
|
216
219
|
const defaultIndicatorStyle = {};
|
|
220
|
+
|
|
221
|
+
// Dev-only: tracks per-`Tabs` instance (keyed by its ref) whether the invalid-value warning was
|
|
222
|
+
// already logged, so it isn't repeated across the several effects that call `getTabsMeta`.
|
|
223
|
+
// Only referenced from `process.env.NODE_ENV !== 'production'` blocks; the `@__PURE__` annotation
|
|
224
|
+
// lets minifiers drop it (and the `WeakMap` allocation) entirely from production builds.
|
|
225
|
+
const warnedTabValueInvalid = /* @__PURE__ */new WeakMap();
|
|
217
226
|
let warnedOnceTabPresent = false;
|
|
218
227
|
const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
219
228
|
const props = useDefaultProps({
|
|
@@ -222,6 +231,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
222
231
|
});
|
|
223
232
|
const theme = useTheme();
|
|
224
233
|
const isRtl = useRtl();
|
|
234
|
+
const reducedMotion = useReducedMotion(theme.motion.reducedMotion, false);
|
|
225
235
|
const {
|
|
226
236
|
'aria-label': ariaLabel,
|
|
227
237
|
'aria-labelledby': ariaLabelledBy,
|
|
@@ -328,7 +338,9 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
328
338
|
if (children.length > 0) {
|
|
329
339
|
const tab = children[valueToIndex.get(value)];
|
|
330
340
|
if (process.env.NODE_ENV !== 'production') {
|
|
331
|
-
|
|
341
|
+
// `getTabsMeta` runs from several effects, so guard against logging the warning repeatedly.
|
|
342
|
+
if (!tab && !warnedTabValueInvalid.has(tabsRef)) {
|
|
343
|
+
warnedTabValueInvalid.set(tabsRef, true);
|
|
332
344
|
console.error([`MUI: The \`value\` provided to the Tabs component is invalid.`, `None of the Tabs' children match with "${value}".`, valueToIndex.keys ? `You can provide one of the following values: ${Array.from(valueToIndex.keys()).join(', ')}.` : null].join('\n'));
|
|
333
345
|
}
|
|
334
346
|
}
|
|
@@ -385,7 +397,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
385
397
|
const scroll = (scrollValue, {
|
|
386
398
|
animation = true
|
|
387
399
|
} = {}) => {
|
|
388
|
-
if (animation) {
|
|
400
|
+
if (animation && !reducedMotion.shouldReduceMotion) {
|
|
389
401
|
animate(scrollStart, tabsRef.current, scrollValue, {
|
|
390
402
|
duration: theme.transitions.duration.standard
|
|
391
403
|
});
|
|
@@ -703,7 +715,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
703
715
|
getSlotProps: handlers => ({
|
|
704
716
|
...handlers,
|
|
705
717
|
onBlur: event => {
|
|
706
|
-
if (!event.currentTarget
|
|
718
|
+
if (!contains(event.currentTarget, event.relatedTarget)) {
|
|
707
719
|
setIsFocusWithinList(false);
|
|
708
720
|
}
|
|
709
721
|
handlers.onBlur?.(event);
|
package/Tooltip/Tooltip.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { PopperProps } from "../Popper/index.mjs";
|
|
|
4
4
|
import { Theme } from "../styles/index.mjs";
|
|
5
5
|
import { InternalStandardProps as StandardProps } from "../internal/index.mjs";
|
|
6
6
|
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.mjs";
|
|
7
|
-
import { TransitionProps } from "../transitions/
|
|
7
|
+
import { TransitionProps } from "../transitions/types.mjs";
|
|
8
8
|
import { TooltipClasses } from "./tooltipClasses.mjs";
|
|
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;
|