1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = exports.styles = void 0;
|
11 |
|
12 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13 |
|
14 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15 |
|
16 | var React = _interopRequireWildcard(require("react"));
|
17 |
|
18 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
19 |
|
20 | var _clsx = _interopRequireDefault(require("clsx"));
|
21 |
|
22 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
23 |
|
24 | var _Typography = _interopRequireDefault(require("../Typography"));
|
25 |
|
26 | var _StepIcon = _interopRequireDefault(require("../StepIcon"));
|
27 |
|
28 | var styles = function styles(theme) {
|
29 | return {
|
30 |
|
31 | root: {
|
32 | display: 'flex',
|
33 | alignItems: 'center',
|
34 | '&$alternativeLabel': {
|
35 | flexDirection: 'column'
|
36 | },
|
37 | '&$disabled': {
|
38 | cursor: 'default'
|
39 | }
|
40 | },
|
41 |
|
42 |
|
43 | horizontal: {},
|
44 |
|
45 |
|
46 | vertical: {},
|
47 |
|
48 |
|
49 | label: {
|
50 | color: theme.palette.text.secondary,
|
51 | '&$active': {
|
52 | color: theme.palette.text.primary,
|
53 | fontWeight: 500
|
54 | },
|
55 | '&$completed': {
|
56 | color: theme.palette.text.primary,
|
57 | fontWeight: 500
|
58 | },
|
59 | '&$alternativeLabel': {
|
60 | textAlign: 'center',
|
61 | marginTop: 16
|
62 | },
|
63 | '&$error': {
|
64 | color: theme.palette.error.main
|
65 | }
|
66 | },
|
67 |
|
68 |
|
69 | active: {},
|
70 |
|
71 |
|
72 | completed: {},
|
73 |
|
74 |
|
75 | error: {},
|
76 |
|
77 |
|
78 | disabled: {},
|
79 |
|
80 |
|
81 | iconContainer: {
|
82 | flexShrink: 0,
|
83 |
|
84 | display: 'flex',
|
85 | paddingRight: 8,
|
86 | '&$alternativeLabel': {
|
87 | paddingRight: 0
|
88 | }
|
89 | },
|
90 |
|
91 |
|
92 | alternativeLabel: {},
|
93 |
|
94 |
|
95 | labelContainer: {
|
96 | width: '100%'
|
97 | }
|
98 | };
|
99 | };
|
100 |
|
101 | exports.styles = styles;
|
102 | var StepLabel = React.forwardRef(function StepLabel(props, ref) {
|
103 | var _props$active = props.active,
|
104 | active = _props$active === void 0 ? false : _props$active,
|
105 | _props$alternativeLab = props.alternativeLabel,
|
106 | alternativeLabel = _props$alternativeLab === void 0 ? false : _props$alternativeLab,
|
107 | children = props.children,
|
108 | classes = props.classes,
|
109 | className = props.className,
|
110 | _props$completed = props.completed,
|
111 | completed = _props$completed === void 0 ? false : _props$completed,
|
112 | _props$disabled = props.disabled,
|
113 | disabled = _props$disabled === void 0 ? false : _props$disabled,
|
114 | _props$error = props.error,
|
115 | error = _props$error === void 0 ? false : _props$error,
|
116 | expanded = props.expanded,
|
117 | icon = props.icon,
|
118 | last = props.last,
|
119 | optional = props.optional,
|
120 | _props$orientation = props.orientation,
|
121 | orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
122 | StepIconComponentProp = props.StepIconComponent,
|
123 | StepIconProps = props.StepIconProps,
|
124 | other = (0, _objectWithoutProperties2.default)(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "disabled", "error", "expanded", "icon", "last", "optional", "orientation", "StepIconComponent", "StepIconProps"]);
|
125 | var StepIconComponent = StepIconComponentProp;
|
126 |
|
127 | if (icon && !StepIconComponent) {
|
128 | StepIconComponent = _StepIcon.default;
|
129 | }
|
130 |
|
131 | return React.createElement("span", (0, _extends2.default)({
|
132 | className: (0, _clsx.default)(classes.root, classes[orientation], className, disabled && classes.disabled, alternativeLabel && classes.alternativeLabel, error && classes.error),
|
133 | ref: ref
|
134 | }, other), icon || StepIconComponent ? React.createElement("span", {
|
135 | className: (0, _clsx.default)(classes.iconContainer, alternativeLabel && classes.alternativeLabel)
|
136 | }, React.createElement(StepIconComponent, (0, _extends2.default)({
|
137 | completed: completed,
|
138 | active: active,
|
139 | error: error,
|
140 | icon: icon
|
141 | }, StepIconProps))) : null, React.createElement("span", {
|
142 | className: classes.labelContainer
|
143 | }, children ? React.createElement(_Typography.default, {
|
144 | variant: "body2",
|
145 | component: "span",
|
146 | display: "block",
|
147 | className: (0, _clsx.default)(classes.label, alternativeLabel && classes.alternativeLabel, completed && classes.completed, active && classes.active, error && classes.error)
|
148 | }, children) : null, optional));
|
149 | });
|
150 | process.env.NODE_ENV !== "production" ? StepLabel.propTypes = {
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | |
157 |
|
158 |
|
159 | children: _propTypes.default.node,
|
160 |
|
161 | |
162 |
|
163 |
|
164 |
|
165 | classes: _propTypes.default.object,
|
166 |
|
167 | |
168 |
|
169 |
|
170 | className: _propTypes.default.string,
|
171 |
|
172 | |
173 |
|
174 |
|
175 |
|
176 | disabled: _propTypes.default.bool,
|
177 |
|
178 | |
179 |
|
180 |
|
181 | error: _propTypes.default.bool,
|
182 |
|
183 | |
184 |
|
185 |
|
186 | icon: _propTypes.default.node,
|
187 |
|
188 | |
189 |
|
190 |
|
191 | optional: _propTypes.default.node,
|
192 |
|
193 | |
194 |
|
195 |
|
196 | StepIconComponent: _propTypes.default.elementType,
|
197 |
|
198 | |
199 |
|
200 |
|
201 | StepIconProps: _propTypes.default.object
|
202 | } : void 0;
|
203 | StepLabel.muiName = 'StepLabel';
|
204 |
|
205 | var _default = (0, _withStyles.default)(styles, {
|
206 | name: 'MuiStepLabel'
|
207 | })(StepLabel);
|
208 |
|
209 | exports.default = _default; |
\ | No newline at end of file |