@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/Slide/Slide.d.mts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TransitionProps } from "../transitions/
|
|
2
|
+
import { TransitionProps } from "../transitions/types.mjs";
|
|
3
3
|
export interface SlideProps extends TransitionProps {
|
|
4
|
+
/**
|
|
5
|
+
* Add a custom transition end trigger.
|
|
6
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
7
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
8
|
+
*
|
|
9
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
10
|
+
* @param {Function} done Call this when the transition has finished.
|
|
11
|
+
*/
|
|
12
|
+
addEndListener?: TransitionProps['addEndListener'] | undefined;
|
|
4
13
|
/**
|
|
5
14
|
* Perform the enter transition when it first mounts if `in` is also `true`.
|
|
6
15
|
* Set this to `false` to disable this behavior.
|
|
@@ -16,6 +25,11 @@ export interface SlideProps extends TransitionProps {
|
|
|
16
25
|
* It's used to set the container the Slide is transitioning from.
|
|
17
26
|
*/
|
|
18
27
|
container?: null | Element | ((element: Element) => Element) | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
disablePrefersReducedMotion?: boolean | undefined;
|
|
19
33
|
/**
|
|
20
34
|
* Direction the child node will enter from.
|
|
21
35
|
* @default 'down'
|
|
@@ -48,7 +62,6 @@ export interface SlideProps extends TransitionProps {
|
|
|
48
62
|
|
|
49
63
|
/**
|
|
50
64
|
* The Slide transition is used by the [Drawer](https://mui.com/material-ui/react-drawer/) component.
|
|
51
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
52
65
|
*
|
|
53
66
|
* Demos:
|
|
54
67
|
*
|
package/Slide/Slide.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TransitionProps } from "../transitions/
|
|
2
|
+
import { TransitionProps } from "../transitions/types.js";
|
|
3
3
|
export interface SlideProps extends TransitionProps {
|
|
4
|
+
/**
|
|
5
|
+
* Add a custom transition end trigger.
|
|
6
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
7
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
8
|
+
*
|
|
9
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
10
|
+
* @param {Function} done Call this when the transition has finished.
|
|
11
|
+
*/
|
|
12
|
+
addEndListener?: TransitionProps['addEndListener'] | undefined;
|
|
4
13
|
/**
|
|
5
14
|
* Perform the enter transition when it first mounts if `in` is also `true`.
|
|
6
15
|
* Set this to `false` to disable this behavior.
|
|
@@ -16,6 +25,11 @@ export interface SlideProps extends TransitionProps {
|
|
|
16
25
|
* It's used to set the container the Slide is transitioning from.
|
|
17
26
|
*/
|
|
18
27
|
container?: null | Element | ((element: Element) => Element) | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
disablePrefersReducedMotion?: boolean | undefined;
|
|
19
33
|
/**
|
|
20
34
|
* Direction the child node will enter from.
|
|
21
35
|
* @default 'down'
|
|
@@ -48,7 +62,6 @@ export interface SlideProps extends TransitionProps {
|
|
|
48
62
|
|
|
49
63
|
/**
|
|
50
64
|
* The Slide transition is used by the [Drawer](https://mui.com/material-ui/react-drawer/) component.
|
|
51
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
52
65
|
*
|
|
53
66
|
* Demos:
|
|
54
67
|
*
|
package/Slide/Slide.js
CHANGED
|
@@ -10,49 +10,63 @@ exports.default = void 0;
|
|
|
10
10
|
exports.setTranslateValue = setTranslateValue;
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var _reactTransitionGroup = require("react-transition-group");
|
|
14
13
|
var _chainPropTypes = _interopRequireDefault(require("@mui/utils/chainPropTypes"));
|
|
15
14
|
var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
|
|
16
15
|
var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
|
|
17
16
|
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
17
|
+
var _Transition = _interopRequireDefault(require("../internal/Transition"));
|
|
18
18
|
var _isLayoutSupported = _interopRequireDefault(require("../utils/isLayoutSupported"));
|
|
19
19
|
var _debounce = _interopRequireDefault(require("../utils/debounce"));
|
|
20
20
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
21
21
|
var _zeroStyled = require("../zero-styled");
|
|
22
|
+
var _useReducedMotion = _interopRequireDefault(require("../transitions/useReducedMotion"));
|
|
22
23
|
var _utils = require("../transitions/utils");
|
|
23
24
|
var _utils2 = require("../utils");
|
|
24
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
26
|
const hiddenStyles = {
|
|
26
27
|
visibility: 'hidden'
|
|
27
28
|
};
|
|
29
|
+
const DEFAULT_TRANSLATE_OPTIONS = {};
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Detects SwipeableDrawer's active-swipe `translate(x, y)` transform.
|
|
33
|
+
* Keep this in sync with SwipeableDrawer.setPosition.
|
|
34
|
+
*/
|
|
35
|
+
function isGestureTranslate(transform) {
|
|
36
|
+
return typeof transform === 'string' && /^translate\(.+,\s*.+\)$/.test(transform);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Move the node off-screen. Later we reset transform to `none` to slide it in.
|
|
40
|
+
function getTranslateValue(direction, node, resolvedContainer, options = DEFAULT_TRANSLATE_OPTIONS) {
|
|
41
|
+
const {
|
|
42
|
+
resetInlineTransform = true
|
|
43
|
+
} = options;
|
|
32
44
|
const containerRect = resolvedContainer && resolvedContainer.getBoundingClientRect();
|
|
33
45
|
const containerWindow = (0, _utils2.ownerWindow)(node);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
offsetX = parseInt(transformValues[4], 10);
|
|
54
|
-
offsetY = parseInt(transformValues[5], 10);
|
|
46
|
+
let rect;
|
|
47
|
+
let transform;
|
|
48
|
+
if (resetInlineTransform) {
|
|
49
|
+
// Read layout from the element's natural position, not from a previous
|
|
50
|
+
// off-screen transform. Clear transition too, or the browser may report an
|
|
51
|
+
// in-between animated value during exit.
|
|
52
|
+
const previousTransform = node.style.transform;
|
|
53
|
+
const previousTransition = node.style.transition;
|
|
54
|
+
node.style.transition = '';
|
|
55
|
+
node.style.transform = '';
|
|
56
|
+
rect = node.getBoundingClientRect();
|
|
57
|
+
const computedStyle = containerWindow.getComputedStyle(node);
|
|
58
|
+
transform = computedStyle.getPropertyValue('transform');
|
|
59
|
+
node.style.transform = previousTransform;
|
|
60
|
+
node.style.transition = previousTransition;
|
|
61
|
+
} else {
|
|
62
|
+
rect = node.getBoundingClientRect();
|
|
63
|
+
const computedStyle = containerWindow.getComputedStyle(node);
|
|
64
|
+
transform = computedStyle.getPropertyValue('transform');
|
|
55
65
|
}
|
|
66
|
+
const {
|
|
67
|
+
offsetX,
|
|
68
|
+
offsetY
|
|
69
|
+
} = (0, _utils.getTranslateOffsets)(transform);
|
|
56
70
|
if (direction === 'left') {
|
|
57
71
|
if (containerRect) {
|
|
58
72
|
return `translateX(${containerRect.right + offsetX - rect.left}px)`;
|
|
@@ -81,9 +95,9 @@ function getTranslateValue(direction, node, resolvedContainer) {
|
|
|
81
95
|
function resolveContainer(containerPropProp) {
|
|
82
96
|
return typeof containerPropProp === 'function' ? containerPropProp() : containerPropProp;
|
|
83
97
|
}
|
|
84
|
-
function setTranslateValue(direction, node, containerProp) {
|
|
98
|
+
function setTranslateValue(direction, node, containerProp, options) {
|
|
85
99
|
const resolvedContainer = resolveContainer(containerProp);
|
|
86
|
-
const transform = getTranslateValue(direction, node, resolvedContainer);
|
|
100
|
+
const transform = getTranslateValue(direction, node, resolvedContainer, options);
|
|
87
101
|
if (transform) {
|
|
88
102
|
node.style.transform = transform;
|
|
89
103
|
}
|
|
@@ -91,7 +105,6 @@ function setTranslateValue(direction, node, containerProp) {
|
|
|
91
105
|
|
|
92
106
|
/**
|
|
93
107
|
* The Slide transition is used by the [Drawer](/material-ui/react-drawer/) component.
|
|
94
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
95
108
|
*/
|
|
96
109
|
const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
97
110
|
const theme = (0, _zeroStyled.useTheme)();
|
|
@@ -108,6 +121,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
108
121
|
appear = true,
|
|
109
122
|
children,
|
|
110
123
|
container: containerProp,
|
|
124
|
+
disablePrefersReducedMotion = false,
|
|
111
125
|
direction = 'down',
|
|
112
126
|
easing: easingProp = defaultEasing,
|
|
113
127
|
in: inProp,
|
|
@@ -121,11 +135,15 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
121
135
|
timeout = defaultTimeout,
|
|
122
136
|
...other
|
|
123
137
|
} = props;
|
|
138
|
+
const reducedMotion = (0, _useReducedMotion.default)(theme.motion.reducedMotion, disablePrefersReducedMotion);
|
|
124
139
|
const childrenRef = React.useRef(null);
|
|
140
|
+
const preserveInlineTransformRef = React.useRef(false);
|
|
125
141
|
const handleRef = (0, _useForkRef.default)((0, _getReactElementRef.default)(children), childrenRef, ref);
|
|
126
142
|
const handleEnter = (0, _utils.normalizedTransitionCallback)(childrenRef, (node, isAppearing) => {
|
|
127
143
|
setTranslateValue(direction, node, containerProp);
|
|
128
|
-
(
|
|
144
|
+
if (!reducedMotion.shouldReduceMotion) {
|
|
145
|
+
(0, _utils.reflow)(node);
|
|
146
|
+
}
|
|
129
147
|
if (onEnter) {
|
|
130
148
|
onEnter(node, isAppearing);
|
|
131
149
|
}
|
|
@@ -138,7 +156,15 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
138
156
|
}, {
|
|
139
157
|
mode: 'enter'
|
|
140
158
|
});
|
|
141
|
-
|
|
159
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
160
|
+
duration: transitionProps.duration,
|
|
161
|
+
delay: transitionProps.delay
|
|
162
|
+
});
|
|
163
|
+
node.style.transition = theme.transitions.create('transform', {
|
|
164
|
+
duration: transitionTiming.duration,
|
|
165
|
+
easing: transitionProps.easing,
|
|
166
|
+
delay: transitionTiming.delay
|
|
167
|
+
});
|
|
142
168
|
node.style.transform = 'none';
|
|
143
169
|
if (onEntering) {
|
|
144
170
|
onEntering(node, isAppearing);
|
|
@@ -154,32 +180,45 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
154
180
|
}, {
|
|
155
181
|
mode: 'exit'
|
|
156
182
|
});
|
|
157
|
-
|
|
158
|
-
|
|
183
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
184
|
+
duration: transitionProps.duration,
|
|
185
|
+
delay: transitionProps.delay
|
|
186
|
+
});
|
|
187
|
+
node.style.transition = theme.transitions.create('transform', {
|
|
188
|
+
duration: transitionTiming.duration,
|
|
189
|
+
easing: transitionProps.easing,
|
|
190
|
+
delay: transitionTiming.delay
|
|
191
|
+
});
|
|
192
|
+
const preserveInlineTransform = isGestureTranslate(node.style.transform);
|
|
193
|
+
preserveInlineTransformRef.current = preserveInlineTransform;
|
|
194
|
+
|
|
195
|
+
// Preserve SwipeableDrawer's inline gesture transform during exit. Slide's
|
|
196
|
+
// own off-screen translateX/Y transforms still use the reset path.
|
|
197
|
+
setTranslateValue(direction, node, containerProp, {
|
|
198
|
+
resetInlineTransform: !preserveInlineTransform
|
|
199
|
+
});
|
|
159
200
|
if (onExit) {
|
|
160
201
|
onExit(node);
|
|
161
202
|
}
|
|
162
203
|
});
|
|
163
204
|
const handleExited = (0, _utils.normalizedTransitionCallback)(childrenRef, node => {
|
|
164
|
-
|
|
205
|
+
preserveInlineTransformRef.current = false;
|
|
206
|
+
// Hidden nodes stay off-screen without animating.
|
|
165
207
|
node.style.transition = '';
|
|
166
208
|
if (onExited) {
|
|
167
209
|
onExited(node);
|
|
168
210
|
}
|
|
169
211
|
});
|
|
170
|
-
const handleAddEndListener = next => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
addEndListener(childrenRef.current, next);
|
|
174
|
-
}
|
|
175
|
-
};
|
|
212
|
+
const handleAddEndListener = addEndListener ? next => {
|
|
213
|
+
addEndListener(childrenRef.current, next);
|
|
214
|
+
} : undefined;
|
|
176
215
|
const updatePosition = React.useCallback(() => {
|
|
177
216
|
if (childrenRef.current) {
|
|
178
217
|
setTranslateValue(direction, childrenRef.current, containerProp);
|
|
179
218
|
}
|
|
180
219
|
}, [direction, containerProp]);
|
|
181
220
|
React.useEffect(() => {
|
|
182
|
-
// Skip
|
|
221
|
+
// Skip resize listeners when the off-screen position does not depend on screen size.
|
|
183
222
|
if (inProp || direction === 'down' || direction === 'right') {
|
|
184
223
|
return undefined;
|
|
185
224
|
}
|
|
@@ -196,13 +235,13 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
196
235
|
};
|
|
197
236
|
}, [direction, inProp, containerProp]);
|
|
198
237
|
React.useEffect(() => {
|
|
199
|
-
if (!inProp) {
|
|
200
|
-
//
|
|
201
|
-
//
|
|
238
|
+
if (!inProp && !preserveInlineTransformRef.current) {
|
|
239
|
+
// While hidden, keep the child at the correct off-screen position if
|
|
240
|
+
// direction or container changes.
|
|
202
241
|
updatePosition();
|
|
203
242
|
}
|
|
204
243
|
}, [inProp, updatePosition]);
|
|
205
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
244
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Transition.default, {
|
|
206
245
|
nodeRef: childrenRef,
|
|
207
246
|
onEnter: handleEnter,
|
|
208
247
|
onEntered: handleEntered,
|
|
@@ -213,12 +252,15 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
213
252
|
addEndListener: handleAddEndListener,
|
|
214
253
|
appear: appear,
|
|
215
254
|
in: inProp,
|
|
255
|
+
reduceMotion: reducedMotion.shouldReduceMotion,
|
|
216
256
|
timeout: timeout,
|
|
217
257
|
...other,
|
|
218
258
|
children: (state, {
|
|
219
259
|
ownerState,
|
|
220
260
|
...restChildProps
|
|
221
261
|
}) => {
|
|
262
|
+
// Do not pass ownerState to a DOM child. ownerState is only for
|
|
263
|
+
// Material UI styling, and React would treat it as an invalid DOM attribute.
|
|
222
264
|
let childStyle;
|
|
223
265
|
if (state === 'exited' && !inProp) {
|
|
224
266
|
childStyle = style || children.props.style ? {
|
|
@@ -248,9 +290,12 @@ process.env.NODE_ENV !== "production" ? Slide.propTypes /* remove-proptypes */ =
|
|
|
248
290
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
249
291
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
250
292
|
/**
|
|
251
|
-
* Add a custom transition end trigger.
|
|
252
|
-
*
|
|
253
|
-
*
|
|
293
|
+
* Add a custom transition end trigger.
|
|
294
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
295
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
296
|
+
*
|
|
297
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
298
|
+
* @param {Function} done Call this when the transition has finished.
|
|
254
299
|
*/
|
|
255
300
|
addEndListener: _propTypes.default.func,
|
|
256
301
|
/**
|
|
@@ -288,6 +333,11 @@ process.env.NODE_ENV !== "production" ? Slide.propTypes /* remove-proptypes */ =
|
|
|
288
333
|
* @default 'down'
|
|
289
334
|
*/
|
|
290
335
|
direction: _propTypes.default.oneOf(['down', 'left', 'right', 'up']),
|
|
336
|
+
/**
|
|
337
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
338
|
+
* @default false
|
|
339
|
+
*/
|
|
340
|
+
disablePrefersReducedMotion: _propTypes.default.bool,
|
|
291
341
|
/**
|
|
292
342
|
* The transition timing function.
|
|
293
343
|
* You may specify a single easing or a object containing enter and exit values.
|
package/Slide/Slide.mjs
CHANGED
|
@@ -2,49 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { Transition } from 'react-transition-group';
|
|
6
5
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
7
6
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
8
7
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
9
8
|
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
9
|
+
import Transition from "../internal/Transition.mjs";
|
|
10
10
|
import isLayoutSupported from "../utils/isLayoutSupported.mjs";
|
|
11
11
|
import debounce from "../utils/debounce.mjs";
|
|
12
12
|
import useForkRef from "../utils/useForkRef.mjs";
|
|
13
13
|
import { useTheme } from "../zero-styled/index.mjs";
|
|
14
|
-
import
|
|
14
|
+
import useReducedMotion from "../transitions/useReducedMotion.mjs";
|
|
15
|
+
import { normalizedTransitionCallback, reflow, getTransitionProps, getTranslateOffsets } from "../transitions/utils.mjs";
|
|
15
16
|
import { ownerWindow } from "../utils/index.mjs";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
const hiddenStyles = {
|
|
18
19
|
visibility: 'hidden'
|
|
19
20
|
};
|
|
21
|
+
const DEFAULT_TRANSLATE_OPTIONS = {};
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Detects SwipeableDrawer's active-swipe `translate(x, y)` transform.
|
|
25
|
+
* Keep this in sync with SwipeableDrawer.setPosition.
|
|
26
|
+
*/
|
|
27
|
+
function isGestureTranslate(transform) {
|
|
28
|
+
return typeof transform === 'string' && /^translate\(.+,\s*.+\)$/.test(transform);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Move the node off-screen. Later we reset transform to `none` to slide it in.
|
|
32
|
+
function getTranslateValue(direction, node, resolvedContainer, options = DEFAULT_TRANSLATE_OPTIONS) {
|
|
33
|
+
const {
|
|
34
|
+
resetInlineTransform = true
|
|
35
|
+
} = options;
|
|
24
36
|
const containerRect = resolvedContainer && resolvedContainer.getBoundingClientRect();
|
|
25
37
|
const containerWindow = ownerWindow(node);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
offsetX = parseInt(transformValues[4], 10);
|
|
46
|
-
offsetY = parseInt(transformValues[5], 10);
|
|
38
|
+
let rect;
|
|
39
|
+
let transform;
|
|
40
|
+
if (resetInlineTransform) {
|
|
41
|
+
// Read layout from the element's natural position, not from a previous
|
|
42
|
+
// off-screen transform. Clear transition too, or the browser may report an
|
|
43
|
+
// in-between animated value during exit.
|
|
44
|
+
const previousTransform = node.style.transform;
|
|
45
|
+
const previousTransition = node.style.transition;
|
|
46
|
+
node.style.transition = '';
|
|
47
|
+
node.style.transform = '';
|
|
48
|
+
rect = node.getBoundingClientRect();
|
|
49
|
+
const computedStyle = containerWindow.getComputedStyle(node);
|
|
50
|
+
transform = computedStyle.getPropertyValue('transform');
|
|
51
|
+
node.style.transform = previousTransform;
|
|
52
|
+
node.style.transition = previousTransition;
|
|
53
|
+
} else {
|
|
54
|
+
rect = node.getBoundingClientRect();
|
|
55
|
+
const computedStyle = containerWindow.getComputedStyle(node);
|
|
56
|
+
transform = computedStyle.getPropertyValue('transform');
|
|
47
57
|
}
|
|
58
|
+
const {
|
|
59
|
+
offsetX,
|
|
60
|
+
offsetY
|
|
61
|
+
} = getTranslateOffsets(transform);
|
|
48
62
|
if (direction === 'left') {
|
|
49
63
|
if (containerRect) {
|
|
50
64
|
return `translateX(${containerRect.right + offsetX - rect.left}px)`;
|
|
@@ -73,9 +87,9 @@ function getTranslateValue(direction, node, resolvedContainer) {
|
|
|
73
87
|
function resolveContainer(containerPropProp) {
|
|
74
88
|
return typeof containerPropProp === 'function' ? containerPropProp() : containerPropProp;
|
|
75
89
|
}
|
|
76
|
-
export function setTranslateValue(direction, node, containerProp) {
|
|
90
|
+
export function setTranslateValue(direction, node, containerProp, options) {
|
|
77
91
|
const resolvedContainer = resolveContainer(containerProp);
|
|
78
|
-
const transform = getTranslateValue(direction, node, resolvedContainer);
|
|
92
|
+
const transform = getTranslateValue(direction, node, resolvedContainer, options);
|
|
79
93
|
if (transform) {
|
|
80
94
|
node.style.transform = transform;
|
|
81
95
|
}
|
|
@@ -83,7 +97,6 @@ export function setTranslateValue(direction, node, containerProp) {
|
|
|
83
97
|
|
|
84
98
|
/**
|
|
85
99
|
* The Slide transition is used by the [Drawer](/material-ui/react-drawer/) component.
|
|
86
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
87
100
|
*/
|
|
88
101
|
const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
89
102
|
const theme = useTheme();
|
|
@@ -100,6 +113,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
100
113
|
appear = true,
|
|
101
114
|
children,
|
|
102
115
|
container: containerProp,
|
|
116
|
+
disablePrefersReducedMotion = false,
|
|
103
117
|
direction = 'down',
|
|
104
118
|
easing: easingProp = defaultEasing,
|
|
105
119
|
in: inProp,
|
|
@@ -113,11 +127,15 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
113
127
|
timeout = defaultTimeout,
|
|
114
128
|
...other
|
|
115
129
|
} = props;
|
|
130
|
+
const reducedMotion = useReducedMotion(theme.motion.reducedMotion, disablePrefersReducedMotion);
|
|
116
131
|
const childrenRef = React.useRef(null);
|
|
132
|
+
const preserveInlineTransformRef = React.useRef(false);
|
|
117
133
|
const handleRef = useForkRef(getReactElementRef(children), childrenRef, ref);
|
|
118
134
|
const handleEnter = normalizedTransitionCallback(childrenRef, (node, isAppearing) => {
|
|
119
135
|
setTranslateValue(direction, node, containerProp);
|
|
120
|
-
|
|
136
|
+
if (!reducedMotion.shouldReduceMotion) {
|
|
137
|
+
reflow(node);
|
|
138
|
+
}
|
|
121
139
|
if (onEnter) {
|
|
122
140
|
onEnter(node, isAppearing);
|
|
123
141
|
}
|
|
@@ -130,7 +148,15 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
130
148
|
}, {
|
|
131
149
|
mode: 'enter'
|
|
132
150
|
});
|
|
133
|
-
|
|
151
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
152
|
+
duration: transitionProps.duration,
|
|
153
|
+
delay: transitionProps.delay
|
|
154
|
+
});
|
|
155
|
+
node.style.transition = theme.transitions.create('transform', {
|
|
156
|
+
duration: transitionTiming.duration,
|
|
157
|
+
easing: transitionProps.easing,
|
|
158
|
+
delay: transitionTiming.delay
|
|
159
|
+
});
|
|
134
160
|
node.style.transform = 'none';
|
|
135
161
|
if (onEntering) {
|
|
136
162
|
onEntering(node, isAppearing);
|
|
@@ -146,32 +172,45 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
146
172
|
}, {
|
|
147
173
|
mode: 'exit'
|
|
148
174
|
});
|
|
149
|
-
|
|
150
|
-
|
|
175
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
176
|
+
duration: transitionProps.duration,
|
|
177
|
+
delay: transitionProps.delay
|
|
178
|
+
});
|
|
179
|
+
node.style.transition = theme.transitions.create('transform', {
|
|
180
|
+
duration: transitionTiming.duration,
|
|
181
|
+
easing: transitionProps.easing,
|
|
182
|
+
delay: transitionTiming.delay
|
|
183
|
+
});
|
|
184
|
+
const preserveInlineTransform = isGestureTranslate(node.style.transform);
|
|
185
|
+
preserveInlineTransformRef.current = preserveInlineTransform;
|
|
186
|
+
|
|
187
|
+
// Preserve SwipeableDrawer's inline gesture transform during exit. Slide's
|
|
188
|
+
// own off-screen translateX/Y transforms still use the reset path.
|
|
189
|
+
setTranslateValue(direction, node, containerProp, {
|
|
190
|
+
resetInlineTransform: !preserveInlineTransform
|
|
191
|
+
});
|
|
151
192
|
if (onExit) {
|
|
152
193
|
onExit(node);
|
|
153
194
|
}
|
|
154
195
|
});
|
|
155
196
|
const handleExited = normalizedTransitionCallback(childrenRef, node => {
|
|
156
|
-
|
|
197
|
+
preserveInlineTransformRef.current = false;
|
|
198
|
+
// Hidden nodes stay off-screen without animating.
|
|
157
199
|
node.style.transition = '';
|
|
158
200
|
if (onExited) {
|
|
159
201
|
onExited(node);
|
|
160
202
|
}
|
|
161
203
|
});
|
|
162
|
-
const handleAddEndListener = next => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
addEndListener(childrenRef.current, next);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
204
|
+
const handleAddEndListener = addEndListener ? next => {
|
|
205
|
+
addEndListener(childrenRef.current, next);
|
|
206
|
+
} : undefined;
|
|
168
207
|
const updatePosition = React.useCallback(() => {
|
|
169
208
|
if (childrenRef.current) {
|
|
170
209
|
setTranslateValue(direction, childrenRef.current, containerProp);
|
|
171
210
|
}
|
|
172
211
|
}, [direction, containerProp]);
|
|
173
212
|
React.useEffect(() => {
|
|
174
|
-
// Skip
|
|
213
|
+
// Skip resize listeners when the off-screen position does not depend on screen size.
|
|
175
214
|
if (inProp || direction === 'down' || direction === 'right') {
|
|
176
215
|
return undefined;
|
|
177
216
|
}
|
|
@@ -188,9 +227,9 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
188
227
|
};
|
|
189
228
|
}, [direction, inProp, containerProp]);
|
|
190
229
|
React.useEffect(() => {
|
|
191
|
-
if (!inProp) {
|
|
192
|
-
//
|
|
193
|
-
//
|
|
230
|
+
if (!inProp && !preserveInlineTransformRef.current) {
|
|
231
|
+
// While hidden, keep the child at the correct off-screen position if
|
|
232
|
+
// direction or container changes.
|
|
194
233
|
updatePosition();
|
|
195
234
|
}
|
|
196
235
|
}, [inProp, updatePosition]);
|
|
@@ -205,12 +244,15 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
205
244
|
addEndListener: handleAddEndListener,
|
|
206
245
|
appear: appear,
|
|
207
246
|
in: inProp,
|
|
247
|
+
reduceMotion: reducedMotion.shouldReduceMotion,
|
|
208
248
|
timeout: timeout,
|
|
209
249
|
...other,
|
|
210
250
|
children: (state, {
|
|
211
251
|
ownerState,
|
|
212
252
|
...restChildProps
|
|
213
253
|
}) => {
|
|
254
|
+
// Do not pass ownerState to a DOM child. ownerState is only for
|
|
255
|
+
// Material UI styling, and React would treat it as an invalid DOM attribute.
|
|
214
256
|
let childStyle;
|
|
215
257
|
if (state === 'exited' && !inProp) {
|
|
216
258
|
childStyle = style || children.props.style ? {
|
|
@@ -240,9 +282,12 @@ process.env.NODE_ENV !== "production" ? Slide.propTypes /* remove-proptypes */ =
|
|
|
240
282
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
241
283
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
242
284
|
/**
|
|
243
|
-
* Add a custom transition end trigger.
|
|
244
|
-
*
|
|
245
|
-
*
|
|
285
|
+
* Add a custom transition end trigger.
|
|
286
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
287
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
288
|
+
*
|
|
289
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
290
|
+
* @param {Function} done Call this when the transition has finished.
|
|
246
291
|
*/
|
|
247
292
|
addEndListener: PropTypes.func,
|
|
248
293
|
/**
|
|
@@ -280,6 +325,11 @@ process.env.NODE_ENV !== "production" ? Slide.propTypes /* remove-proptypes */ =
|
|
|
280
325
|
* @default 'down'
|
|
281
326
|
*/
|
|
282
327
|
direction: PropTypes.oneOf(['down', 'left', 'right', 'up']),
|
|
328
|
+
/**
|
|
329
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
330
|
+
* @default false
|
|
331
|
+
*/
|
|
332
|
+
disablePrefersReducedMotion: PropTypes.bool,
|
|
283
333
|
/**
|
|
284
334
|
* The transition timing function.
|
|
285
335
|
* You may specify a single easing or a object containing enter and exit values.
|