UNPKG

4.97 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
5var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
7Object.defineProperty(exports, "__esModule", {
8 value: true
9});
10exports.default = exports.styles = void 0;
11
12var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
16var React = _interopRequireWildcard(require("react"));
17
18var _propTypes = _interopRequireDefault(require("prop-types"));
19
20var _clsx = _interopRequireDefault(require("clsx"));
21
22var _Collapse = _interopRequireDefault(require("../Collapse"));
23
24var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
25
26var styles = function styles(theme) {
27 return {
28 /* Styles applied to the root element. */
29 root: {
30 marginTop: 8,
31 marginLeft: 12,
32 // half icon
33 paddingLeft: 8 + 12,
34 // margin + half icon
35 paddingRight: 8,
36 borderLeft: "1px solid ".concat(theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[600])
37 },
38
39 /* Styles applied to the root element if `last={true}` (controlled by `Step`). */
40 last: {
41 borderLeft: 'none'
42 },
43
44 /* Styles applied to the Transition component. */
45 transition: {}
46 };
47};
48
49exports.styles = styles;
50var StepContent = /*#__PURE__*/React.forwardRef(function StepContent(props, ref) {
51 var active = props.active,
52 alternativeLabel = props.alternativeLabel,
53 children = props.children,
54 classes = props.classes,
55 className = props.className,
56 completed = props.completed,
57 expanded = props.expanded,
58 last = props.last,
59 optional = props.optional,
60 orientation = props.orientation,
61 _props$TransitionComp = props.TransitionComponent,
62 TransitionComponent = _props$TransitionComp === void 0 ? _Collapse.default : _props$TransitionComp,
63 _props$transitionDura = props.transitionDuration,
64 transitionDurationProp = _props$transitionDura === void 0 ? 'auto' : _props$transitionDura,
65 TransitionProps = props.TransitionProps,
66 other = (0, _objectWithoutProperties2.default)(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "expanded", "last", "optional", "orientation", "TransitionComponent", "transitionDuration", "TransitionProps"]);
67
68 if (process.env.NODE_ENV !== 'production') {
69 if (orientation !== 'vertical') {
70 console.error('Material-UI: <StepContent /> is only designed for use with the vertical stepper.');
71 }
72 }
73
74 var transitionDuration = transitionDurationProp;
75
76 if (transitionDurationProp === 'auto' && !TransitionComponent.muiSupportAuto) {
77 transitionDuration = undefined;
78 }
79
80 return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
81 className: (0, _clsx.default)(classes.root, className, last && classes.last),
82 ref: ref
83 }, other), /*#__PURE__*/React.createElement(TransitionComponent, (0, _extends2.default)({
84 in: active || expanded,
85 className: classes.transition,
86 timeout: transitionDuration,
87 unmountOnExit: true
88 }, TransitionProps), children));
89});
90process.env.NODE_ENV !== "production" ? StepContent.propTypes = {
91 // ----------------------------- Warning --------------------------------
92 // | These PropTypes are generated from the TypeScript type definitions |
93 // | To update them edit the d.ts file and run "yarn proptypes" |
94 // ----------------------------------------------------------------------
95
96 /**
97 * Step content.
98 */
99 children: _propTypes.default.node,
100
101 /**
102 * Override or extend the styles applied to the component.
103 * See [CSS API](#css) below for more details.
104 */
105 classes: _propTypes.default.object,
106
107 /**
108 * @ignore
109 */
110 className: _propTypes.default.string,
111
112 /**
113 * The component used for the transition.
114 * [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
115 */
116 TransitionComponent: _propTypes.default.elementType,
117
118 /**
119 * Adjust the duration of the content expand transition.
120 * Passed as a prop to the transition component.
121 *
122 * Set to 'auto' to automatically calculate transition time based on height.
123 */
124 transitionDuration: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.shape({
125 appear: _propTypes.default.number,
126 enter: _propTypes.default.number,
127 exit: _propTypes.default.number
128 })]),
129
130 /**
131 * Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element.
132 */
133 TransitionProps: _propTypes.default.object
134} : void 0;
135
136var _default = (0, _withStyles.default)(styles, {
137 name: 'MuiStepContent'
138})(StepContent);
139
140exports.default = _default;
\No newline at end of file