@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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import contains from '@mui/utils/contains';
|
|
5
6
|
import ownerDocument from '@mui/utils/ownerDocument';
|
|
6
7
|
import useForkRef from '@mui/utils/useForkRef';
|
|
7
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
@@ -66,7 +67,7 @@ function ClickAwayListener(props) {
|
|
|
66
67
|
syntheticEventRef.current = false;
|
|
67
68
|
const doc = ownerDocument(nodeRef.current);
|
|
68
69
|
|
|
69
|
-
// 1.
|
|
70
|
+
// 1. IE 11 support, which trigger the handleClickAway even after the unbind
|
|
70
71
|
// 2. The child might render null.
|
|
71
72
|
// 3. Behave like a blur listener.
|
|
72
73
|
if (!activatedRef.current || !nodeRef.current || 'clientX' in event && clickedRootScrollbar(event, doc)) {
|
|
@@ -84,11 +85,7 @@ function ClickAwayListener(props) {
|
|
|
84
85
|
if (event.composedPath) {
|
|
85
86
|
insideDOM = event.composedPath().includes(nodeRef.current);
|
|
86
87
|
} else {
|
|
87
|
-
insideDOM = !doc.documentElement.contains(
|
|
88
|
-
// @ts-expect-error returns `false` as intended when not dispatched from a Node
|
|
89
|
-
event.target) || nodeRef.current.contains(
|
|
90
|
-
// @ts-expect-error returns `false` as intended when not dispatched from a Node
|
|
91
|
-
event.target);
|
|
88
|
+
insideDOM = !contains(doc.documentElement, event.target) || contains(nodeRef.current, event.target);
|
|
92
89
|
}
|
|
93
90
|
if (!insideDOM && (disableReactTree || !insideReactTree)) {
|
|
94
91
|
onClickAway(event);
|
package/Collapse/Collapse.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
|
-
import { TransitionStatus } from 'react-transition-group';
|
|
4
3
|
import { Theme } from "../styles/index.mjs";
|
|
5
4
|
import { InternalStandardProps as StandardProps } from "../internal/index.mjs";
|
|
6
|
-
import { TransitionProps } from "../transitions/
|
|
5
|
+
import { TransitionProps, TransitionStatus } from "../transitions/types.mjs";
|
|
7
6
|
import { CollapseClasses } from "./collapseClasses.mjs";
|
|
8
7
|
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.mjs";
|
|
9
8
|
export interface CollapseSlots {
|
|
@@ -32,6 +31,15 @@ export type CollapseSlotsAndSlotProps = CreateSlotsAndSlotProps<CollapseSlots, {
|
|
|
32
31
|
wrapperInner: SlotProps<'div', CollapseWrapperInnerSlotPropsOverrides, CollapseOwnerState>;
|
|
33
32
|
}>;
|
|
34
33
|
export interface CollapseProps extends StandardProps<TransitionProps, 'timeout'>, CollapseSlotsAndSlotProps {
|
|
34
|
+
/**
|
|
35
|
+
* Add a custom transition end trigger.
|
|
36
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
37
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
38
|
+
*
|
|
39
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
40
|
+
* @param {Function} done Call this when the transition has finished.
|
|
41
|
+
*/
|
|
42
|
+
addEndListener?: TransitionProps['addEndListener'] | undefined;
|
|
35
43
|
/**
|
|
36
44
|
* The content node to be collapsed.
|
|
37
45
|
*/
|
|
@@ -51,6 +59,11 @@ export interface CollapseProps extends StandardProps<TransitionProps, 'timeout'>
|
|
|
51
59
|
* Either a string to use a HTML element or a component.
|
|
52
60
|
*/
|
|
53
61
|
component?: React.ElementType<TransitionProps> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
disablePrefersReducedMotion?: boolean | undefined;
|
|
54
67
|
/**
|
|
55
68
|
* The transition timing function.
|
|
56
69
|
* You may specify a single easing or a object containing enter and exit values.
|
|
@@ -85,7 +98,6 @@ export interface CollapseOwnerState extends CollapseProps {
|
|
|
85
98
|
/**
|
|
86
99
|
* The Collapse transition is used by the
|
|
87
100
|
* [Vertical Stepper](https://mui.com/material-ui/react-stepper/#vertical-stepper) StepContent component.
|
|
88
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
89
101
|
*
|
|
90
102
|
* Demos:
|
|
91
103
|
*
|
package/Collapse/Collapse.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
|
-
import { TransitionStatus } from 'react-transition-group';
|
|
4
3
|
import { Theme } from "../styles/index.js";
|
|
5
4
|
import { InternalStandardProps as StandardProps } from "../internal/index.js";
|
|
6
|
-
import { TransitionProps } from "../transitions/
|
|
5
|
+
import { TransitionProps, TransitionStatus } from "../transitions/types.js";
|
|
7
6
|
import { CollapseClasses } from "./collapseClasses.js";
|
|
8
7
|
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
9
8
|
export interface CollapseSlots {
|
|
@@ -32,6 +31,15 @@ export type CollapseSlotsAndSlotProps = CreateSlotsAndSlotProps<CollapseSlots, {
|
|
|
32
31
|
wrapperInner: SlotProps<'div', CollapseWrapperInnerSlotPropsOverrides, CollapseOwnerState>;
|
|
33
32
|
}>;
|
|
34
33
|
export interface CollapseProps extends StandardProps<TransitionProps, 'timeout'>, CollapseSlotsAndSlotProps {
|
|
34
|
+
/**
|
|
35
|
+
* Add a custom transition end trigger.
|
|
36
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
37
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
38
|
+
*
|
|
39
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
40
|
+
* @param {Function} done Call this when the transition has finished.
|
|
41
|
+
*/
|
|
42
|
+
addEndListener?: TransitionProps['addEndListener'] | undefined;
|
|
35
43
|
/**
|
|
36
44
|
* The content node to be collapsed.
|
|
37
45
|
*/
|
|
@@ -51,6 +59,11 @@ export interface CollapseProps extends StandardProps<TransitionProps, 'timeout'>
|
|
|
51
59
|
* Either a string to use a HTML element or a component.
|
|
52
60
|
*/
|
|
53
61
|
component?: React.ElementType<TransitionProps> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
disablePrefersReducedMotion?: boolean | undefined;
|
|
54
67
|
/**
|
|
55
68
|
* The transition timing function.
|
|
56
69
|
* You may specify a single easing or a object containing enter and exit values.
|
|
@@ -85,7 +98,6 @@ export interface CollapseOwnerState extends CollapseProps {
|
|
|
85
98
|
/**
|
|
86
99
|
* The Collapse transition is used by the
|
|
87
100
|
* [Vertical Stepper](https://mui.com/material-ui/react-stepper/#vertical-stepper) StepContent component.
|
|
88
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
89
101
|
*
|
|
90
102
|
* Demos:
|
|
91
103
|
*
|
package/Collapse/Collapse.js
CHANGED
|
@@ -10,10 +10,10 @@ exports.default = void 0;
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var _reactTransitionGroup = require("react-transition-group");
|
|
14
|
-
var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
|
|
15
13
|
var _elementTypeAcceptingRef = _interopRequireDefault(require("@mui/utils/elementTypeAcceptingRef"));
|
|
16
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _Transition = _interopRequireDefault(require("../internal/Transition"));
|
|
16
|
+
var _useReducedMotion = _interopRequireDefault(require("../transitions/useReducedMotion"));
|
|
17
17
|
var _zeroStyled = require("../zero-styled");
|
|
18
18
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
19
19
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
@@ -23,6 +23,7 @@ var _utils2 = require("../utils");
|
|
|
23
23
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
24
24
|
var _collapseClasses = require("./collapseClasses");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
+
const EMPTY_OBJECT = {};
|
|
26
27
|
const useUtilityClasses = ownerState => {
|
|
27
28
|
const {
|
|
28
29
|
orientation,
|
|
@@ -90,7 +91,7 @@ const CollapseWrapper = (0, _zeroStyled.styled)('div', {
|
|
|
90
91
|
name: 'MuiCollapse',
|
|
91
92
|
slot: 'Wrapper'
|
|
92
93
|
})({
|
|
93
|
-
//
|
|
94
|
+
// Prevent children with negative margins from making the measured size too small.
|
|
94
95
|
display: 'flex',
|
|
95
96
|
width: '100%',
|
|
96
97
|
variants: [{
|
|
@@ -122,7 +123,6 @@ const CollapseWrapperInner = (0, _zeroStyled.styled)('div', {
|
|
|
122
123
|
/**
|
|
123
124
|
* The Collapse transition is used by the
|
|
124
125
|
* [Vertical Stepper](/material-ui/react-stepper/#vertical-stepper) StepContent component.
|
|
125
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
126
126
|
*/
|
|
127
127
|
const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
128
128
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
@@ -135,6 +135,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
135
135
|
className,
|
|
136
136
|
collapsedSize: collapsedSizeProp = '0px',
|
|
137
137
|
component,
|
|
138
|
+
disablePrefersReducedMotion = false,
|
|
138
139
|
easing,
|
|
139
140
|
in: inProp,
|
|
140
141
|
onEnter,
|
|
@@ -144,12 +145,12 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
144
145
|
onExited,
|
|
145
146
|
onExiting,
|
|
146
147
|
orientation = 'vertical',
|
|
147
|
-
slots =
|
|
148
|
-
slotProps =
|
|
148
|
+
slots = EMPTY_OBJECT,
|
|
149
|
+
slotProps = EMPTY_OBJECT,
|
|
149
150
|
style,
|
|
150
151
|
timeout = _createTransitions.duration.standard,
|
|
151
152
|
// eslint-disable-next-line react/prop-types
|
|
152
|
-
TransitionComponent =
|
|
153
|
+
TransitionComponent = _Transition.default,
|
|
153
154
|
...other
|
|
154
155
|
} = props;
|
|
155
156
|
const ownerState = {
|
|
@@ -159,18 +160,19 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
159
160
|
};
|
|
160
161
|
const classes = useUtilityClasses(ownerState);
|
|
161
162
|
const theme = (0, _zeroStyled.useTheme)();
|
|
162
|
-
const timer = (0, _useTimeout.default)();
|
|
163
163
|
const wrapperRef = React.useRef(null);
|
|
164
|
-
const autoTransitionDuration = React.useRef();
|
|
164
|
+
const autoTransitionDuration = React.useRef(null);
|
|
165
165
|
const collapsedSize = typeof collapsedSizeProp === 'number' ? `${collapsedSizeProp}px` : collapsedSizeProp;
|
|
166
166
|
const isHorizontal = orientation === 'horizontal';
|
|
167
167
|
const size = isHorizontal ? 'width' : 'height';
|
|
168
|
+
const reducedMotion = (0, _useReducedMotion.default)(theme.motion.reducedMotion, disablePrefersReducedMotion);
|
|
168
169
|
const nodeRef = React.useRef(null);
|
|
169
170
|
const handleRef = (0, _utils2.useForkRef)(ref, nodeRef);
|
|
170
171
|
const getWrapperSize = () => wrapperRef.current ? wrapperRef.current[isHorizontal ? 'clientWidth' : 'clientHeight'] : 0;
|
|
171
172
|
const handleEnter = (0, _utils.normalizedTransitionCallback)(nodeRef, (node, isAppearing) => {
|
|
172
173
|
if (wrapperRef.current && isHorizontal) {
|
|
173
|
-
//
|
|
174
|
+
// Temporarily remove horizontal content from normal layout so we can
|
|
175
|
+
// measure its natural width.
|
|
174
176
|
wrapperRef.current.style.position = 'absolute';
|
|
175
177
|
}
|
|
176
178
|
node.style[size] = collapsedSize;
|
|
@@ -181,7 +183,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
181
183
|
const handleEntering = (0, _utils.normalizedTransitionCallback)(nodeRef, (node, isAppearing) => {
|
|
182
184
|
const wrapperSize = getWrapperSize();
|
|
183
185
|
if (wrapperRef.current && isHorizontal) {
|
|
184
|
-
//
|
|
186
|
+
// Restore normal layout after measuring the horizontal content.
|
|
185
187
|
wrapperRef.current.style.position = '';
|
|
186
188
|
}
|
|
187
189
|
const {
|
|
@@ -194,13 +196,17 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
194
196
|
}, {
|
|
195
197
|
mode: 'enter'
|
|
196
198
|
});
|
|
197
|
-
if (timeout === 'auto') {
|
|
199
|
+
if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
|
|
198
200
|
const duration2 = theme.transitions.getAutoHeightDuration(wrapperSize);
|
|
199
|
-
node.style.transitionDuration = `${duration2}ms`;
|
|
200
201
|
autoTransitionDuration.current = duration2;
|
|
201
202
|
} else {
|
|
202
|
-
|
|
203
|
+
autoTransitionDuration.current = null;
|
|
203
204
|
}
|
|
205
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
206
|
+
duration: autoTransitionDuration.current ?? transitionDuration,
|
|
207
|
+
delay: undefined
|
|
208
|
+
});
|
|
209
|
+
node.style.transitionDuration = typeof transitionTiming.duration === 'string' ? transitionTiming.duration : `${transitionTiming.duration}ms`;
|
|
204
210
|
node.style[size] = `${wrapperSize}px`;
|
|
205
211
|
node.style.transitionTimingFunction = transitionTimingFunction;
|
|
206
212
|
if (onEntering) {
|
|
@@ -232,30 +238,27 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
232
238
|
}, {
|
|
233
239
|
mode: 'exit'
|
|
234
240
|
});
|
|
235
|
-
if (timeout === 'auto') {
|
|
236
|
-
//
|
|
237
|
-
// Actually it just calculates animation duration based on size
|
|
241
|
+
if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
|
|
242
|
+
// getAutoHeightDuration also works for width; it calculates duration from size.
|
|
238
243
|
const duration2 = theme.transitions.getAutoHeightDuration(wrapperSize);
|
|
239
|
-
node.style.transitionDuration = `${duration2}ms`;
|
|
240
244
|
autoTransitionDuration.current = duration2;
|
|
241
245
|
} else {
|
|
242
|
-
|
|
246
|
+
autoTransitionDuration.current = null;
|
|
243
247
|
}
|
|
248
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
249
|
+
duration: autoTransitionDuration.current ?? transitionDuration,
|
|
250
|
+
delay: undefined
|
|
251
|
+
});
|
|
252
|
+
node.style.transitionDuration = typeof transitionTiming.duration === 'string' ? transitionTiming.duration : `${transitionTiming.duration}ms`;
|
|
244
253
|
node.style[size] = collapsedSize;
|
|
245
254
|
node.style.transitionTimingFunction = transitionTimingFunction;
|
|
246
255
|
if (onExiting) {
|
|
247
256
|
onExiting(node);
|
|
248
257
|
}
|
|
249
258
|
});
|
|
250
|
-
const handleAddEndListener = next => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
if (addEndListener) {
|
|
255
|
-
// Old call signature before `react-transition-group` implemented `nodeRef`
|
|
256
|
-
addEndListener(nodeRef.current, next);
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
+
const handleAddEndListener = addEndListener ? next => {
|
|
260
|
+
addEndListener(nodeRef.current, next);
|
|
261
|
+
} : undefined;
|
|
259
262
|
const externalForwardedProps = {
|
|
260
263
|
slots,
|
|
261
264
|
slotProps,
|
|
@@ -296,6 +299,8 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
296
299
|
onExited: handleExited,
|
|
297
300
|
onExiting: handleExiting,
|
|
298
301
|
addEndListener: handleAddEndListener,
|
|
302
|
+
getAutoTimeout: timeout === 'auto' ? () => autoTransitionDuration.current : undefined,
|
|
303
|
+
reduceMotion: reducedMotion.shouldReduceMotion,
|
|
299
304
|
nodeRef: nodeRef,
|
|
300
305
|
timeout: timeout === 'auto' ? null : timeout,
|
|
301
306
|
...other,
|
|
@@ -334,9 +339,12 @@ process.env.NODE_ENV !== "production" ? Collapse.propTypes /* remove-proptypes *
|
|
|
334
339
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
335
340
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
336
341
|
/**
|
|
337
|
-
* Add a custom transition end trigger.
|
|
338
|
-
*
|
|
339
|
-
*
|
|
342
|
+
* Add a custom transition end trigger.
|
|
343
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
344
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
345
|
+
*
|
|
346
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
347
|
+
* @param {Function} done Call this when the transition has finished.
|
|
340
348
|
*/
|
|
341
349
|
addEndListener: _propTypes.default.func,
|
|
342
350
|
/**
|
|
@@ -361,6 +369,11 @@ process.env.NODE_ENV !== "production" ? Collapse.propTypes /* remove-proptypes *
|
|
|
361
369
|
* Either a string to use a HTML element or a component.
|
|
362
370
|
*/
|
|
363
371
|
component: _elementTypeAcceptingRef.default,
|
|
372
|
+
/**
|
|
373
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
374
|
+
* @default false
|
|
375
|
+
*/
|
|
376
|
+
disablePrefersReducedMotion: _propTypes.default.bool,
|
|
364
377
|
/**
|
|
365
378
|
* The transition timing function.
|
|
366
379
|
* You may specify a single easing or a object containing enter and exit values.
|
package/Collapse/Collapse.mjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { Transition } from 'react-transition-group';
|
|
7
|
-
import useTimeout from '@mui/utils/useTimeout';
|
|
8
6
|
import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
|
|
9
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import Transition from "../internal/Transition.mjs";
|
|
9
|
+
import useReducedMotion from "../transitions/useReducedMotion.mjs";
|
|
10
10
|
import { styled, useTheme } from "../zero-styled/index.mjs";
|
|
11
11
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
12
12
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
@@ -16,6 +16,7 @@ import { useForkRef } from "../utils/index.mjs";
|
|
|
16
16
|
import useSlot from "../utils/useSlot.mjs";
|
|
17
17
|
import { getCollapseUtilityClass } from "./collapseClasses.mjs";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
const EMPTY_OBJECT = {};
|
|
19
20
|
const useUtilityClasses = ownerState => {
|
|
20
21
|
const {
|
|
21
22
|
orientation,
|
|
@@ -83,7 +84,7 @@ const CollapseWrapper = styled('div', {
|
|
|
83
84
|
name: 'MuiCollapse',
|
|
84
85
|
slot: 'Wrapper'
|
|
85
86
|
})({
|
|
86
|
-
//
|
|
87
|
+
// Prevent children with negative margins from making the measured size too small.
|
|
87
88
|
display: 'flex',
|
|
88
89
|
width: '100%',
|
|
89
90
|
variants: [{
|
|
@@ -115,7 +116,6 @@ const CollapseWrapperInner = styled('div', {
|
|
|
115
116
|
/**
|
|
116
117
|
* The Collapse transition is used by the
|
|
117
118
|
* [Vertical Stepper](/material-ui/react-stepper/#vertical-stepper) StepContent component.
|
|
118
|
-
* It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
|
|
119
119
|
*/
|
|
120
120
|
const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
121
121
|
const props = useDefaultProps({
|
|
@@ -128,6 +128,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
128
128
|
className,
|
|
129
129
|
collapsedSize: collapsedSizeProp = '0px',
|
|
130
130
|
component,
|
|
131
|
+
disablePrefersReducedMotion = false,
|
|
131
132
|
easing,
|
|
132
133
|
in: inProp,
|
|
133
134
|
onEnter,
|
|
@@ -137,8 +138,8 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
137
138
|
onExited,
|
|
138
139
|
onExiting,
|
|
139
140
|
orientation = 'vertical',
|
|
140
|
-
slots =
|
|
141
|
-
slotProps =
|
|
141
|
+
slots = EMPTY_OBJECT,
|
|
142
|
+
slotProps = EMPTY_OBJECT,
|
|
142
143
|
style,
|
|
143
144
|
timeout = duration.standard,
|
|
144
145
|
// eslint-disable-next-line react/prop-types
|
|
@@ -152,18 +153,19 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
152
153
|
};
|
|
153
154
|
const classes = useUtilityClasses(ownerState);
|
|
154
155
|
const theme = useTheme();
|
|
155
|
-
const timer = useTimeout();
|
|
156
156
|
const wrapperRef = React.useRef(null);
|
|
157
|
-
const autoTransitionDuration = React.useRef();
|
|
157
|
+
const autoTransitionDuration = React.useRef(null);
|
|
158
158
|
const collapsedSize = typeof collapsedSizeProp === 'number' ? `${collapsedSizeProp}px` : collapsedSizeProp;
|
|
159
159
|
const isHorizontal = orientation === 'horizontal';
|
|
160
160
|
const size = isHorizontal ? 'width' : 'height';
|
|
161
|
+
const reducedMotion = useReducedMotion(theme.motion.reducedMotion, disablePrefersReducedMotion);
|
|
161
162
|
const nodeRef = React.useRef(null);
|
|
162
163
|
const handleRef = useForkRef(ref, nodeRef);
|
|
163
164
|
const getWrapperSize = () => wrapperRef.current ? wrapperRef.current[isHorizontal ? 'clientWidth' : 'clientHeight'] : 0;
|
|
164
165
|
const handleEnter = normalizedTransitionCallback(nodeRef, (node, isAppearing) => {
|
|
165
166
|
if (wrapperRef.current && isHorizontal) {
|
|
166
|
-
//
|
|
167
|
+
// Temporarily remove horizontal content from normal layout so we can
|
|
168
|
+
// measure its natural width.
|
|
167
169
|
wrapperRef.current.style.position = 'absolute';
|
|
168
170
|
}
|
|
169
171
|
node.style[size] = collapsedSize;
|
|
@@ -174,7 +176,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
174
176
|
const handleEntering = normalizedTransitionCallback(nodeRef, (node, isAppearing) => {
|
|
175
177
|
const wrapperSize = getWrapperSize();
|
|
176
178
|
if (wrapperRef.current && isHorizontal) {
|
|
177
|
-
//
|
|
179
|
+
// Restore normal layout after measuring the horizontal content.
|
|
178
180
|
wrapperRef.current.style.position = '';
|
|
179
181
|
}
|
|
180
182
|
const {
|
|
@@ -187,13 +189,17 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
187
189
|
}, {
|
|
188
190
|
mode: 'enter'
|
|
189
191
|
});
|
|
190
|
-
if (timeout === 'auto') {
|
|
192
|
+
if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
|
|
191
193
|
const duration2 = theme.transitions.getAutoHeightDuration(wrapperSize);
|
|
192
|
-
node.style.transitionDuration = `${duration2}ms`;
|
|
193
194
|
autoTransitionDuration.current = duration2;
|
|
194
195
|
} else {
|
|
195
|
-
|
|
196
|
+
autoTransitionDuration.current = null;
|
|
196
197
|
}
|
|
198
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
199
|
+
duration: autoTransitionDuration.current ?? transitionDuration,
|
|
200
|
+
delay: undefined
|
|
201
|
+
});
|
|
202
|
+
node.style.transitionDuration = typeof transitionTiming.duration === 'string' ? transitionTiming.duration : `${transitionTiming.duration}ms`;
|
|
197
203
|
node.style[size] = `${wrapperSize}px`;
|
|
198
204
|
node.style.transitionTimingFunction = transitionTimingFunction;
|
|
199
205
|
if (onEntering) {
|
|
@@ -225,30 +231,27 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
225
231
|
}, {
|
|
226
232
|
mode: 'exit'
|
|
227
233
|
});
|
|
228
|
-
if (timeout === 'auto') {
|
|
229
|
-
//
|
|
230
|
-
// Actually it just calculates animation duration based on size
|
|
234
|
+
if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
|
|
235
|
+
// getAutoHeightDuration also works for width; it calculates duration from size.
|
|
231
236
|
const duration2 = theme.transitions.getAutoHeightDuration(wrapperSize);
|
|
232
|
-
node.style.transitionDuration = `${duration2}ms`;
|
|
233
237
|
autoTransitionDuration.current = duration2;
|
|
234
238
|
} else {
|
|
235
|
-
|
|
239
|
+
autoTransitionDuration.current = null;
|
|
236
240
|
}
|
|
241
|
+
const transitionTiming = reducedMotion.getTransitionTiming({
|
|
242
|
+
duration: autoTransitionDuration.current ?? transitionDuration,
|
|
243
|
+
delay: undefined
|
|
244
|
+
});
|
|
245
|
+
node.style.transitionDuration = typeof transitionTiming.duration === 'string' ? transitionTiming.duration : `${transitionTiming.duration}ms`;
|
|
237
246
|
node.style[size] = collapsedSize;
|
|
238
247
|
node.style.transitionTimingFunction = transitionTimingFunction;
|
|
239
248
|
if (onExiting) {
|
|
240
249
|
onExiting(node);
|
|
241
250
|
}
|
|
242
251
|
});
|
|
243
|
-
const handleAddEndListener = next => {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
if (addEndListener) {
|
|
248
|
-
// Old call signature before `react-transition-group` implemented `nodeRef`
|
|
249
|
-
addEndListener(nodeRef.current, next);
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
+
const handleAddEndListener = addEndListener ? next => {
|
|
253
|
+
addEndListener(nodeRef.current, next);
|
|
254
|
+
} : undefined;
|
|
252
255
|
const externalForwardedProps = {
|
|
253
256
|
slots,
|
|
254
257
|
slotProps,
|
|
@@ -289,6 +292,8 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
289
292
|
onExited: handleExited,
|
|
290
293
|
onExiting: handleExiting,
|
|
291
294
|
addEndListener: handleAddEndListener,
|
|
295
|
+
getAutoTimeout: timeout === 'auto' ? () => autoTransitionDuration.current : undefined,
|
|
296
|
+
reduceMotion: reducedMotion.shouldReduceMotion,
|
|
292
297
|
nodeRef: nodeRef,
|
|
293
298
|
timeout: timeout === 'auto' ? null : timeout,
|
|
294
299
|
...other,
|
|
@@ -327,9 +332,12 @@ process.env.NODE_ENV !== "production" ? Collapse.propTypes /* remove-proptypes *
|
|
|
327
332
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
328
333
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
329
334
|
/**
|
|
330
|
-
* Add a custom transition end trigger.
|
|
331
|
-
*
|
|
332
|
-
*
|
|
335
|
+
* Add a custom transition end trigger.
|
|
336
|
+
* Use it when you need custom logic to decide when the transition has ended.
|
|
337
|
+
* Note: Timeouts are still used as a fallback if provided.
|
|
338
|
+
*
|
|
339
|
+
* @param {HTMLElement} node The transitioning DOM node.
|
|
340
|
+
* @param {Function} done Call this when the transition has finished.
|
|
333
341
|
*/
|
|
334
342
|
addEndListener: PropTypes.func,
|
|
335
343
|
/**
|
|
@@ -354,6 +362,11 @@ process.env.NODE_ENV !== "production" ? Collapse.propTypes /* remove-proptypes *
|
|
|
354
362
|
* Either a string to use a HTML element or a component.
|
|
355
363
|
*/
|
|
356
364
|
component: elementTypeAcceptingRef,
|
|
365
|
+
/**
|
|
366
|
+
* If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
|
|
367
|
+
* @default false
|
|
368
|
+
*/
|
|
369
|
+
disablePrefersReducedMotion: PropTypes.bool,
|
|
357
370
|
/**
|
|
358
371
|
* The transition timing function.
|
|
359
372
|
* You may specify a single easing or a object containing enter and exit values.
|
package/Dialog/Dialog.d.mts
CHANGED
|
@@ -5,13 +5,13 @@ import { InternalStandardProps as StandardProps } from "../internal/index.mjs";
|
|
|
5
5
|
import { BackdropProps } from "../Backdrop/index.mjs";
|
|
6
6
|
import { PaperProps } from "../Paper/index.mjs";
|
|
7
7
|
import { ModalProps } from "../Modal/index.mjs";
|
|
8
|
-
import { TransitionProps } from "../transitions/
|
|
8
|
+
import { TransitionProps } from "../transitions/types.mjs";
|
|
9
9
|
import { DialogClasses } from "./dialogClasses.mjs";
|
|
10
10
|
import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from "../utils/types.mjs";
|
|
11
11
|
export interface DialogSlots {
|
|
12
12
|
/**
|
|
13
13
|
* The component that renders the transition.
|
|
14
|
-
* [Follow this guide](/material-ui/transitions/#
|
|
14
|
+
* [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
|
|
15
15
|
* @default Collapse
|
|
16
16
|
*/
|
|
17
17
|
transition?: React.ElementType | undefined;
|
package/Dialog/Dialog.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ import { InternalStandardProps as StandardProps } from "../internal/index.js";
|
|
|
5
5
|
import { BackdropProps } from "../Backdrop/index.js";
|
|
6
6
|
import { PaperProps } from "../Paper/index.js";
|
|
7
7
|
import { ModalProps } from "../Modal/index.js";
|
|
8
|
-
import { TransitionProps } from "../transitions/
|
|
8
|
+
import { TransitionProps } from "../transitions/types.js";
|
|
9
9
|
import { DialogClasses } from "./dialogClasses.js";
|
|
10
10
|
import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from "../utils/types.js";
|
|
11
11
|
export interface DialogSlots {
|
|
12
12
|
/**
|
|
13
13
|
* The component that renders the transition.
|
|
14
|
-
* [Follow this guide](/material-ui/transitions/#
|
|
14
|
+
* [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
|
|
15
15
|
* @default Collapse
|
|
16
16
|
*/
|
|
17
17
|
transition?: React.ElementType | undefined;
|
package/Dialog/Dialog.js
CHANGED
|
@@ -23,6 +23,7 @@ var _zeroStyled = require("../zero-styled");
|
|
|
23
23
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
24
24
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
25
25
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
26
|
+
var _focusable = require("../utils/focusable");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
28
|
const DialogBackdrop = (0, _zeroStyled.styled)(_Backdrop.default, {
|
|
28
29
|
name: 'MuiDialog',
|
|
@@ -114,6 +115,8 @@ const DialogPaper = (0, _zeroStyled.styled)(_Paper.default, {
|
|
|
114
115
|
margin: 32,
|
|
115
116
|
position: 'relative',
|
|
116
117
|
overflowY: 'auto',
|
|
118
|
+
// We disable the focus ring for mouse, touch and keyboard users.
|
|
119
|
+
outline: 0,
|
|
117
120
|
'@media print': {
|
|
118
121
|
overflowY: 'visible',
|
|
119
122
|
boxShadow: 'none'
|
|
@@ -298,7 +301,16 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
|
|
|
298
301
|
shouldForwardComponentProp: true,
|
|
299
302
|
externalForwardedProps,
|
|
300
303
|
ownerState,
|
|
301
|
-
className: classes.paper
|
|
304
|
+
className: classes.paper,
|
|
305
|
+
additionalProps: {
|
|
306
|
+
elevation: 24,
|
|
307
|
+
role,
|
|
308
|
+
'aria-describedby': ariaDescribedby,
|
|
309
|
+
'aria-labelledby': ariaLabelledby,
|
|
310
|
+
'aria-modal': ariaModal,
|
|
311
|
+
tabIndex: -1,
|
|
312
|
+
[_focusable.FOCUSABLE_ATTRIBUTE]: ''
|
|
313
|
+
}
|
|
302
314
|
});
|
|
303
315
|
const [ContainerSlot, containerSlotProps] = (0, _useSlot.default)('container', {
|
|
304
316
|
elementType: DialogContainer,
|
|
@@ -340,11 +352,6 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
|
|
|
340
352
|
...containerSlotProps,
|
|
341
353
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PaperSlot, {
|
|
342
354
|
as: PaperComponent,
|
|
343
|
-
elevation: 24,
|
|
344
|
-
role: role,
|
|
345
|
-
"aria-describedby": ariaDescribedby,
|
|
346
|
-
"aria-labelledby": ariaLabelledby,
|
|
347
|
-
"aria-modal": ariaModal,
|
|
348
355
|
...paperSlotProps,
|
|
349
356
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogContext.default.Provider, {
|
|
350
357
|
value: dialogContextValue,
|
package/Dialog/Dialog.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import { styled, useTheme } from "../zero-styled/index.mjs";
|
|
|
16
16
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
17
17
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
18
18
|
import useSlot from "../utils/useSlot.mjs";
|
|
19
|
+
import { FOCUSABLE_ATTRIBUTE } from "../utils/focusable.mjs";
|
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
const DialogBackdrop = styled(Backdrop, {
|
|
21
22
|
name: 'MuiDialog',
|
|
@@ -107,6 +108,8 @@ const DialogPaper = styled(Paper, {
|
|
|
107
108
|
margin: 32,
|
|
108
109
|
position: 'relative',
|
|
109
110
|
overflowY: 'auto',
|
|
111
|
+
// We disable the focus ring for mouse, touch and keyboard users.
|
|
112
|
+
outline: 0,
|
|
110
113
|
'@media print': {
|
|
111
114
|
overflowY: 'visible',
|
|
112
115
|
boxShadow: 'none'
|
|
@@ -291,7 +294,16 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
|
|
|
291
294
|
shouldForwardComponentProp: true,
|
|
292
295
|
externalForwardedProps,
|
|
293
296
|
ownerState,
|
|
294
|
-
className: classes.paper
|
|
297
|
+
className: classes.paper,
|
|
298
|
+
additionalProps: {
|
|
299
|
+
elevation: 24,
|
|
300
|
+
role,
|
|
301
|
+
'aria-describedby': ariaDescribedby,
|
|
302
|
+
'aria-labelledby': ariaLabelledby,
|
|
303
|
+
'aria-modal': ariaModal,
|
|
304
|
+
tabIndex: -1,
|
|
305
|
+
[FOCUSABLE_ATTRIBUTE]: ''
|
|
306
|
+
}
|
|
295
307
|
});
|
|
296
308
|
const [ContainerSlot, containerSlotProps] = useSlot('container', {
|
|
297
309
|
elementType: DialogContainer,
|
|
@@ -333,11 +345,6 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
|
|
|
333
345
|
...containerSlotProps,
|
|
334
346
|
children: /*#__PURE__*/_jsx(PaperSlot, {
|
|
335
347
|
as: PaperComponent,
|
|
336
|
-
elevation: 24,
|
|
337
|
-
role: role,
|
|
338
|
-
"aria-describedby": ariaDescribedby,
|
|
339
|
-
"aria-labelledby": ariaLabelledby,
|
|
340
|
-
"aria-modal": ariaModal,
|
|
341
348
|
...paperSlotProps,
|
|
342
349
|
children: /*#__PURE__*/_jsx(DialogContext.Provider, {
|
|
343
350
|
value: dialogContextValue,
|
package/Drawer/Drawer.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.mjs";
|
|
|
6
6
|
import { ModalProps } from "../Modal/index.mjs";
|
|
7
7
|
import { BackdropProps } from "../Backdrop/index.mjs";
|
|
8
8
|
import { PaperProps } from "../Paper/index.mjs";
|
|
9
|
-
import { TransitionProps } from "../transitions/
|
|
9
|
+
import { TransitionProps } from "../transitions/types.mjs";
|
|
10
10
|
import { DrawerClasses } from "./drawerClasses.mjs";
|
|
11
11
|
export interface DrawerRootSlotPropsOverrides {}
|
|
12
12
|
export interface DrawerDockedSlotPropsOverrides {}
|
|
@@ -36,7 +36,7 @@ export interface DrawerSlots {
|
|
|
36
36
|
paper: React.ElementType;
|
|
37
37
|
/**
|
|
38
38
|
* The component used for the transition.
|
|
39
|
-
* [Follow this guide](
|
|
39
|
+
* [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
|
|
40
40
|
* @default Slide
|
|
41
41
|
*/
|
|
42
42
|
transition: React.ElementType;
|