@mui/material 9.0.1 → 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 +8 -6
- package/Autocomplete/Autocomplete.mjs +8 -6
- package/Backdrop/Backdrop.d.mts +2 -2
- package/Backdrop/Backdrop.d.ts +2 -2
- package/Badge/Badge.js +28 -24
- package/Badge/Badge.mjs +28 -24
- package/BottomNavigationAction/BottomNavigationAction.js +6 -2
- package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
- package/Button/Button.js +11 -15
- package/Button/Button.mjs +11 -15
- 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 +84 -0
- package/CardActionArea/CardActionArea.js +2 -1
- package/CardActionArea/CardActionArea.mjs +2 -1
- package/Chip/Chip.js +2 -1
- package/Chip/Chip.mjs +2 -1
- package/CircularProgress/CircularProgress.js +85 -55
- package/CircularProgress/CircularProgress.mjs +84 -55
- 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 +2 -0
- package/Dialog/Dialog.mjs +2 -0
- package/Drawer/Drawer.d.mts +2 -2
- package/Drawer/Drawer.d.ts +2 -2
- package/Fab/Fab.js +2 -1
- package/Fab/Fab.mjs +2 -1
- 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.js +4 -3
- package/FilledInput/FilledInput.mjs +4 -3
- 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 +2 -1
- package/IconButton/IconButton.mjs +2 -1
- package/Input/Input.js +3 -2
- package/Input/Input.mjs +3 -2
- package/InputBase/InputBase.js +2 -1
- package/InputBase/InputBase.mjs +2 -1
- package/InputLabel/InputLabel.js +2 -1
- package/InputLabel/InputLabel.mjs +2 -1
- package/LICENSE +1 -1
- package/LinearProgress/LinearProgress.js +187 -120
- package/LinearProgress/LinearProgress.mjs +186 -120
- package/ListItem/ListItem.js +2 -1
- package/ListItem/ListItem.mjs +2 -1
- package/ListItemButton/ListItemButton.js +2 -1
- package/ListItemButton/ListItemButton.mjs +2 -1
- package/Menu/Menu.d.mts +1 -1
- package/Menu/Menu.d.ts +1 -1
- package/MobileStepper/MobileStepper.js +2 -1
- package/MobileStepper/MobileStepper.mjs +2 -1
- package/OutlinedInput/NotchedOutline.js +4 -3
- package/OutlinedInput/NotchedOutline.mjs +4 -3
- 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/Popover/Popover.d.mts +1 -1
- package/Popover/Popover.d.ts +1 -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/SelectInput.js +115 -25
- package/Select/SelectInput.mjs +115 -25
- 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 +53 -25
- package/Slide/Slide.mjs +52 -24
- package/Slider/Slider.js +4 -3
- package/Slider/Slider.mjs +4 -3
- package/Slider/useSlider.js +1 -1
- package/Slider/useSlider.mjs +1 -1
- 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 +14 -3
- package/SwipeableDrawer/SwipeableDrawer.mjs +14 -3
- package/Switch/Switch.js +3 -2
- package/Switch/Switch.mjs +3 -2
- package/TableSortLabel/TableSortLabel.js +2 -1
- package/TableSortLabel/TableSortLabel.mjs +2 -1
- package/Tabs/Tabs.js +14 -3
- package/Tabs/Tabs.mjs +14 -3
- package/Tooltip/Tooltip.d.mts +2 -2
- package/Tooltip/Tooltip.d.ts +2 -2
- package/Tooltip/Tooltip.js +3 -0
- package/Tooltip/Tooltip.mjs +3 -0
- package/Unstable_TrapFocus/FocusTrap.js +42 -8
- package/Unstable_TrapFocus/FocusTrap.mjs +42 -8
- 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 +6 -6
- 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/shouldSkipGeneratingVar.js +1 -1
- package/styles/shouldSkipGeneratingVar.mjs +1 -1
- package/styles/stringifyTheme.js +1 -0
- package/styles/stringifyTheme.mjs +1 -0
- 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 +34 -2
- package/transitions/utils.d.ts +34 -2
- package/transitions/utils.js +33 -4
- package/transitions/utils.mjs +31 -4
- package/useAutocomplete/useAutocomplete.d.mts +8 -1
- package/useAutocomplete/useAutocomplete.d.ts +8 -1
- package/useAutocomplete/useAutocomplete.js +66 -4
- package/useAutocomplete/useAutocomplete.mjs +66 -4
- package/version/index.js +3 -3
- package/version/index.mjs +3 -3
- /package/transitions/{transition.js → types.js} +0 -0
- /package/transitions/{transition.mjs → types.mjs} +0 -0
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
|
+
exports.resetWarningFlags = resetWarningFlags;
|
|
10
11
|
var React = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
@@ -17,9 +18,16 @@ var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
|
17
18
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
18
19
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
19
20
|
var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/createSimplePaletteValueFilter"));
|
|
21
|
+
var _utils = require("../transitions/utils");
|
|
20
22
|
var _circularProgressClasses = require("./circularProgressClasses");
|
|
21
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
24
|
const SIZE = 44;
|
|
25
|
+
let warnedMinMaxWithoutVariant = false;
|
|
26
|
+
let warnedInvalidMinMaxValue = false;
|
|
27
|
+
function resetWarningFlags() {
|
|
28
|
+
warnedMinMaxWithoutVariant = false;
|
|
29
|
+
warnedInvalidMinMaxValue = false;
|
|
30
|
+
}
|
|
23
31
|
const circularRotateKeyframe = (0, _zeroStyled.keyframes)`
|
|
24
32
|
0% {
|
|
25
33
|
transform: rotate(0deg);
|
|
@@ -81,31 +89,41 @@ const CircularProgressRoot = (0, _zeroStyled.styled)('span', {
|
|
|
81
89
|
}
|
|
82
90
|
})((0, _memoTheme.default)(({
|
|
83
91
|
theme
|
|
84
|
-
}) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
}) => {
|
|
93
|
+
const reducedMotionAnimationStyles = (0, _utils.getReducedMotionStyles)(theme, {
|
|
94
|
+
animation: 'none'
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
display: 'inline-block',
|
|
98
|
+
variants: [{
|
|
99
|
+
props: {
|
|
100
|
+
variant: 'determinate'
|
|
101
|
+
},
|
|
102
|
+
style: {
|
|
103
|
+
...(0, _utils.getTransitionStyles)(theme, 'transform')
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
props: {
|
|
107
|
+
variant: 'indeterminate'
|
|
108
|
+
},
|
|
109
|
+
style: rotateAnimation || {
|
|
110
|
+
animation: `${circularRotateKeyframe} 1.4s linear infinite`
|
|
111
|
+
}
|
|
112
|
+
}, ...(reducedMotionAnimationStyles ? [{
|
|
113
|
+
props: {
|
|
114
|
+
variant: 'indeterminate'
|
|
115
|
+
},
|
|
116
|
+
style: reducedMotionAnimationStyles
|
|
117
|
+
}] : []), ...Object.entries(theme.palette).filter((0, _createSimplePaletteValueFilter.default)()).map(([color]) => ({
|
|
118
|
+
props: {
|
|
119
|
+
color
|
|
120
|
+
},
|
|
121
|
+
style: {
|
|
122
|
+
color: (theme.vars || theme).palette[color].main
|
|
123
|
+
}
|
|
124
|
+
}))]
|
|
125
|
+
};
|
|
126
|
+
}));
|
|
109
127
|
const CircularProgressSVG = (0, _zeroStyled.styled)('svg', {
|
|
110
128
|
name: 'MuiCircularProgress',
|
|
111
129
|
slot: 'Svg'
|
|
@@ -123,34 +141,44 @@ const CircularProgressCircle = (0, _zeroStyled.styled)('circle', {
|
|
|
123
141
|
}
|
|
124
142
|
})((0, _memoTheme.default)(({
|
|
125
143
|
theme
|
|
126
|
-
}) =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
}) => {
|
|
145
|
+
const reducedMotionAnimationStyles = (0, _utils.getReducedMotionStyles)(theme, {
|
|
146
|
+
animation: 'none'
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
stroke: 'currentColor',
|
|
150
|
+
variants: [{
|
|
151
|
+
props: {
|
|
152
|
+
variant: 'determinate'
|
|
153
|
+
},
|
|
154
|
+
style: {
|
|
155
|
+
...(0, _utils.getTransitionStyles)(theme, 'stroke-dashoffset')
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
props: {
|
|
159
|
+
variant: 'indeterminate'
|
|
160
|
+
},
|
|
161
|
+
style: {
|
|
162
|
+
// Some default value that looks fine while waiting for the animation to kick in.
|
|
163
|
+
strokeDasharray: '80px, 200px',
|
|
164
|
+
strokeDashoffset: 0 // Add the unit to fix a Edge 16 and below bug.
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
props: ({
|
|
168
|
+
ownerState
|
|
169
|
+
}) => ownerState.variant === 'indeterminate' && !ownerState.disableShrink,
|
|
170
|
+
style: dashAnimation || {
|
|
171
|
+
// At runtime for Pigment CSS, `dashAnimation` will be null and the generated keyframe will be used.
|
|
172
|
+
animation: `${circularDashKeyframe} 1.4s ease-in-out infinite`
|
|
173
|
+
}
|
|
174
|
+
}, ...(reducedMotionAnimationStyles ? [{
|
|
175
|
+
props: ({
|
|
176
|
+
ownerState
|
|
177
|
+
}) => ownerState.variant === 'indeterminate' && !ownerState.disableShrink,
|
|
178
|
+
style: reducedMotionAnimationStyles
|
|
179
|
+
}] : [])]
|
|
180
|
+
};
|
|
181
|
+
}));
|
|
154
182
|
const CircularProgressTrack = (0, _zeroStyled.styled)('circle', {
|
|
155
183
|
name: 'MuiCircularProgress',
|
|
156
184
|
slot: 'Track'
|
|
@@ -188,8 +216,9 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
188
216
|
...other
|
|
189
217
|
} = props;
|
|
190
218
|
if (process.env.NODE_ENV !== 'production') {
|
|
191
|
-
if (variant === 'indeterminate' && (minProp !== undefined || maxProp !== undefined)) {
|
|
219
|
+
if (!warnedMinMaxWithoutVariant && variant === 'indeterminate' && (minProp !== undefined || maxProp !== undefined)) {
|
|
192
220
|
console.warn(`MUI: You have provided the \`min\` or \`max\` props with an 'indeterminate' variant. These props will have no effect.`);
|
|
221
|
+
warnedMinMaxWithoutVariant = true;
|
|
193
222
|
}
|
|
194
223
|
}
|
|
195
224
|
const min = minProp ?? 0;
|
|
@@ -211,8 +240,9 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
211
240
|
if (variant === 'determinate') {
|
|
212
241
|
const circumference = 2 * Math.PI * ((SIZE - thickness) / 2);
|
|
213
242
|
if (process.env.NODE_ENV !== 'production') {
|
|
214
|
-
if (value < min || value > max || min >= max) {
|
|
243
|
+
if (!warnedInvalidMinMaxValue && (value < min || value > max || min >= max)) {
|
|
215
244
|
console.error(`MUI: The min, max, and value props in CircularProgress should be numbers where min < max and min <= value <= max. Received min=${min}, max=${max}, value=${value}.`);
|
|
245
|
+
warnedInvalidMinMaxValue = true;
|
|
216
246
|
}
|
|
217
247
|
}
|
|
218
248
|
const range = max - min;
|
|
@@ -10,9 +10,16 @@ import memoTheme from "../utils/memoTheme.mjs";
|
|
|
10
10
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
11
11
|
import capitalize from "../utils/capitalize.mjs";
|
|
12
12
|
import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFilter.mjs";
|
|
13
|
+
import { getReducedMotionStyles, getTransitionStyles } from "../transitions/utils.mjs";
|
|
13
14
|
import { getCircularProgressUtilityClass } from "./circularProgressClasses.mjs";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
const SIZE = 44;
|
|
17
|
+
let warnedMinMaxWithoutVariant = false;
|
|
18
|
+
let warnedInvalidMinMaxValue = false;
|
|
19
|
+
export function resetWarningFlags() {
|
|
20
|
+
warnedMinMaxWithoutVariant = false;
|
|
21
|
+
warnedInvalidMinMaxValue = false;
|
|
22
|
+
}
|
|
16
23
|
const circularRotateKeyframe = keyframes`
|
|
17
24
|
0% {
|
|
18
25
|
transform: rotate(0deg);
|
|
@@ -74,31 +81,41 @@ const CircularProgressRoot = styled('span', {
|
|
|
74
81
|
}
|
|
75
82
|
})(memoTheme(({
|
|
76
83
|
theme
|
|
77
|
-
}) =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
84
|
+
}) => {
|
|
85
|
+
const reducedMotionAnimationStyles = getReducedMotionStyles(theme, {
|
|
86
|
+
animation: 'none'
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
display: 'inline-block',
|
|
90
|
+
variants: [{
|
|
91
|
+
props: {
|
|
92
|
+
variant: 'determinate'
|
|
93
|
+
},
|
|
94
|
+
style: {
|
|
95
|
+
...getTransitionStyles(theme, 'transform')
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
props: {
|
|
99
|
+
variant: 'indeterminate'
|
|
100
|
+
},
|
|
101
|
+
style: rotateAnimation || {
|
|
102
|
+
animation: `${circularRotateKeyframe} 1.4s linear infinite`
|
|
103
|
+
}
|
|
104
|
+
}, ...(reducedMotionAnimationStyles ? [{
|
|
105
|
+
props: {
|
|
106
|
+
variant: 'indeterminate'
|
|
107
|
+
},
|
|
108
|
+
style: reducedMotionAnimationStyles
|
|
109
|
+
}] : []), ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color]) => ({
|
|
110
|
+
props: {
|
|
111
|
+
color
|
|
112
|
+
},
|
|
113
|
+
style: {
|
|
114
|
+
color: (theme.vars || theme).palette[color].main
|
|
115
|
+
}
|
|
116
|
+
}))]
|
|
117
|
+
};
|
|
118
|
+
}));
|
|
102
119
|
const CircularProgressSVG = styled('svg', {
|
|
103
120
|
name: 'MuiCircularProgress',
|
|
104
121
|
slot: 'Svg'
|
|
@@ -116,34 +133,44 @@ const CircularProgressCircle = styled('circle', {
|
|
|
116
133
|
}
|
|
117
134
|
})(memoTheme(({
|
|
118
135
|
theme
|
|
119
|
-
}) =>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
}) => {
|
|
137
|
+
const reducedMotionAnimationStyles = getReducedMotionStyles(theme, {
|
|
138
|
+
animation: 'none'
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
stroke: 'currentColor',
|
|
142
|
+
variants: [{
|
|
143
|
+
props: {
|
|
144
|
+
variant: 'determinate'
|
|
145
|
+
},
|
|
146
|
+
style: {
|
|
147
|
+
...getTransitionStyles(theme, 'stroke-dashoffset')
|
|
148
|
+
}
|
|
149
|
+
}, {
|
|
150
|
+
props: {
|
|
151
|
+
variant: 'indeterminate'
|
|
152
|
+
},
|
|
153
|
+
style: {
|
|
154
|
+
// Some default value that looks fine while waiting for the animation to kick in.
|
|
155
|
+
strokeDasharray: '80px, 200px',
|
|
156
|
+
strokeDashoffset: 0 // Add the unit to fix a Edge 16 and below bug.
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
props: ({
|
|
160
|
+
ownerState
|
|
161
|
+
}) => ownerState.variant === 'indeterminate' && !ownerState.disableShrink,
|
|
162
|
+
style: dashAnimation || {
|
|
163
|
+
// At runtime for Pigment CSS, `dashAnimation` will be null and the generated keyframe will be used.
|
|
164
|
+
animation: `${circularDashKeyframe} 1.4s ease-in-out infinite`
|
|
165
|
+
}
|
|
166
|
+
}, ...(reducedMotionAnimationStyles ? [{
|
|
167
|
+
props: ({
|
|
168
|
+
ownerState
|
|
169
|
+
}) => ownerState.variant === 'indeterminate' && !ownerState.disableShrink,
|
|
170
|
+
style: reducedMotionAnimationStyles
|
|
171
|
+
}] : [])]
|
|
172
|
+
};
|
|
173
|
+
}));
|
|
147
174
|
const CircularProgressTrack = styled('circle', {
|
|
148
175
|
name: 'MuiCircularProgress',
|
|
149
176
|
slot: 'Track'
|
|
@@ -181,8 +208,9 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
181
208
|
...other
|
|
182
209
|
} = props;
|
|
183
210
|
if (process.env.NODE_ENV !== 'production') {
|
|
184
|
-
if (variant === 'indeterminate' && (minProp !== undefined || maxProp !== undefined)) {
|
|
211
|
+
if (!warnedMinMaxWithoutVariant && variant === 'indeterminate' && (minProp !== undefined || maxProp !== undefined)) {
|
|
185
212
|
console.warn(`MUI: You have provided the \`min\` or \`max\` props with an 'indeterminate' variant. These props will have no effect.`);
|
|
213
|
+
warnedMinMaxWithoutVariant = true;
|
|
186
214
|
}
|
|
187
215
|
}
|
|
188
216
|
const min = minProp ?? 0;
|
|
@@ -204,8 +232,9 @@ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress
|
|
|
204
232
|
if (variant === 'determinate') {
|
|
205
233
|
const circumference = 2 * Math.PI * ((SIZE - thickness) / 2);
|
|
206
234
|
if (process.env.NODE_ENV !== 'production') {
|
|
207
|
-
if (value < min || value > max || min >= max) {
|
|
235
|
+
if (!warnedInvalidMinMaxValue && (value < min || value > max || min >= max)) {
|
|
208
236
|
console.error(`MUI: The min, max, and value props in CircularProgress should be numbers where min < max and min <= value <= max. Received min=${min}, max=${max}, value=${value}.`);
|
|
237
|
+
warnedInvalidMinMaxValue = true;
|
|
209
238
|
}
|
|
210
239
|
}
|
|
211
240
|
const range = max - min;
|
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.
|