1 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
2 | import _extends from "@babel/runtime/helpers/esm/extends";
|
3 | const _excluded = ["children", "className", "TransitionComponent", "transitionDuration", "TransitionProps"];
|
4 | import * as React from 'react';
|
5 | import PropTypes from 'prop-types';
|
6 | import clsx from 'clsx';
|
7 | import { unstable_composeClasses as composeClasses } from '@mui/base';
|
8 | import styled from '../styles/styled';
|
9 | import useThemeProps from '../styles/useThemeProps';
|
10 | import Collapse from '../Collapse';
|
11 | import StepperContext from '../Stepper/StepperContext';
|
12 | import StepContext from '../Step/StepContext';
|
13 | import { getStepContentUtilityClass } from './stepContentClasses';
|
14 | import { jsx as _jsx } from "react/jsx-runtime";
|
15 |
|
16 | const useUtilityClasses = ownerState => {
|
17 | const {
|
18 | classes,
|
19 | last
|
20 | } = ownerState;
|
21 | const slots = {
|
22 | root: ['root', last && 'last'],
|
23 | transition: ['transition']
|
24 | };
|
25 | return composeClasses(slots, getStepContentUtilityClass, classes);
|
26 | };
|
27 |
|
28 | const StepContentRoot = styled('div', {
|
29 | name: 'MuiStepContent',
|
30 | slot: 'Root',
|
31 | overridesResolver: (props, styles) => {
|
32 | const {
|
33 | ownerState
|
34 | } = props;
|
35 | return [styles.root, ownerState.last && styles.last];
|
36 | }
|
37 | })(({
|
38 | ownerState,
|
39 | theme
|
40 | }) => _extends({
|
41 | marginLeft: 12,
|
42 |
|
43 | paddingLeft: 8 + 12,
|
44 |
|
45 | paddingRight: 8,
|
46 | borderLeft: theme.vars ? `1px solid ${theme.vars.palette.StepContent.border}` : `1px solid ${theme.palette.mode === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]}`
|
47 | }, ownerState.last && {
|
48 | borderLeft: 'none'
|
49 | }));
|
50 | const StepContentTransition = styled(Collapse, {
|
51 | name: 'MuiStepContent',
|
52 | slot: 'Transition',
|
53 | overridesResolver: (props, styles) => styles.transition
|
54 | })({});
|
55 | const StepContent = React.forwardRef(function StepContent(inProps, ref) {
|
56 | const props = useThemeProps({
|
57 | props: inProps,
|
58 | name: 'MuiStepContent'
|
59 | });
|
60 |
|
61 | const {
|
62 | children,
|
63 | className,
|
64 | TransitionComponent = Collapse,
|
65 | transitionDuration: transitionDurationProp = 'auto',
|
66 | TransitionProps
|
67 | } = props,
|
68 | other = _objectWithoutPropertiesLoose(props, _excluded);
|
69 |
|
70 | const {
|
71 | orientation
|
72 | } = React.useContext(StepperContext);
|
73 | const {
|
74 | active,
|
75 | last,
|
76 | expanded
|
77 | } = React.useContext(StepContext);
|
78 |
|
79 | const ownerState = _extends({}, props, {
|
80 | last
|
81 | });
|
82 |
|
83 | const classes = useUtilityClasses(ownerState);
|
84 |
|
85 | if (process.env.NODE_ENV !== 'production') {
|
86 | if (orientation !== 'vertical') {
|
87 | console.error('MUI: <StepContent /> is only designed for use with the vertical stepper.');
|
88 | }
|
89 | }
|
90 |
|
91 | let transitionDuration = transitionDurationProp;
|
92 |
|
93 | if (transitionDurationProp === 'auto' && !TransitionComponent.muiSupportAuto) {
|
94 | transitionDuration = undefined;
|
95 | }
|
96 |
|
97 | return _jsx(StepContentRoot, _extends({
|
98 | className: clsx(classes.root, className),
|
99 | ref: ref,
|
100 | ownerState: ownerState
|
101 | }, other, {
|
102 | children: _jsx(StepContentTransition, _extends({
|
103 | as: TransitionComponent,
|
104 | in: active || expanded,
|
105 | className: classes.transition,
|
106 | ownerState: ownerState,
|
107 | timeout: transitionDuration,
|
108 | unmountOnExit: true
|
109 | }, TransitionProps, {
|
110 | children: children
|
111 | }))
|
112 | }));
|
113 | });
|
114 | process.env.NODE_ENV !== "production" ? StepContent.propTypes
|
115 |
|
116 | = {
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | |
123 |
|
124 |
|
125 | children: PropTypes.node,
|
126 |
|
127 | |
128 |
|
129 |
|
130 | classes: PropTypes.object,
|
131 |
|
132 | |
133 |
|
134 |
|
135 | className: PropTypes.string,
|
136 |
|
137 | |
138 |
|
139 |
|
140 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
141 |
|
142 | |
143 |
|
144 |
|
145 |
|
146 |
|
147 | TransitionComponent: PropTypes.elementType,
|
148 |
|
149 | |
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | transitionDuration: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.shape({
|
157 | appear: PropTypes.number,
|
158 | enter: PropTypes.number,
|
159 | exit: PropTypes.number
|
160 | })]),
|
161 |
|
162 | |
163 |
|
164 |
|
165 |
|
166 | TransitionProps: PropTypes.object
|
167 | } : void 0;
|
168 | export default StepContent; |
\ | No newline at end of file |