1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = exports.styles = void 0;
|
11 |
|
12 | var React = _interopRequireWildcard(require("react"));
|
13 |
|
14 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
15 |
|
16 | var _clsx = _interopRequireDefault(require("clsx"));
|
17 |
|
18 | var _CheckCircle = _interopRequireDefault(require("../internal/svg-icons/CheckCircle"));
|
19 |
|
20 | var _Warning = _interopRequireDefault(require("../internal/svg-icons/Warning"));
|
21 |
|
22 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
23 |
|
24 | var _SvgIcon = _interopRequireDefault(require("../SvgIcon"));
|
25 |
|
26 | var styles = function styles(theme) {
|
27 | return {
|
28 |
|
29 | root: {
|
30 | display: 'block',
|
31 | color: theme.palette.text.disabled,
|
32 | '&$completed': {
|
33 | color: theme.palette.primary.main
|
34 | },
|
35 | '&$active': {
|
36 | color: theme.palette.primary.main
|
37 | },
|
38 | '&$error': {
|
39 | color: theme.palette.error.main
|
40 | }
|
41 | },
|
42 |
|
43 |
|
44 | text: {
|
45 | fill: theme.palette.primary.contrastText,
|
46 | fontSize: theme.typography.caption.fontSize,
|
47 | fontFamily: theme.typography.fontFamily
|
48 | },
|
49 |
|
50 |
|
51 | active: {},
|
52 |
|
53 |
|
54 | completed: {},
|
55 |
|
56 |
|
57 | error: {}
|
58 | };
|
59 | };
|
60 |
|
61 | exports.styles = styles;
|
62 |
|
63 | var _ref = React.createElement("circle", {
|
64 | cx: "12",
|
65 | cy: "12",
|
66 | r: "12"
|
67 | });
|
68 |
|
69 | var StepIcon = React.forwardRef(function StepIcon(props, ref) {
|
70 | var _props$completed = props.completed,
|
71 | completed = _props$completed === void 0 ? false : _props$completed,
|
72 | icon = props.icon,
|
73 | _props$active = props.active,
|
74 | active = _props$active === void 0 ? false : _props$active,
|
75 | _props$error = props.error,
|
76 | error = _props$error === void 0 ? false : _props$error,
|
77 | classes = props.classes;
|
78 |
|
79 | if (typeof icon === 'number' || typeof icon === 'string') {
|
80 | var className = (0, _clsx.default)(classes.root, active && classes.active, error && classes.error, completed && classes.completed);
|
81 |
|
82 | if (error) {
|
83 | return React.createElement(_Warning.default, {
|
84 | className: className,
|
85 | ref: ref
|
86 | });
|
87 | }
|
88 |
|
89 | if (completed) {
|
90 | return React.createElement(_CheckCircle.default, {
|
91 | className: className,
|
92 | ref: ref
|
93 | });
|
94 | }
|
95 |
|
96 | return React.createElement(_SvgIcon.default, {
|
97 | className: className,
|
98 | ref: ref
|
99 | }, _ref, React.createElement("text", {
|
100 | className: classes.text,
|
101 | x: "12",
|
102 | y: "16",
|
103 | textAnchor: "middle"
|
104 | }, icon));
|
105 | }
|
106 |
|
107 | return icon;
|
108 | });
|
109 | process.env.NODE_ENV !== "production" ? StepIcon.propTypes = {
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | |
116 |
|
117 |
|
118 | active: _propTypes.default.bool,
|
119 |
|
120 | |
121 |
|
122 |
|
123 |
|
124 | classes: _propTypes.default.object,
|
125 |
|
126 | |
127 |
|
128 |
|
129 | completed: _propTypes.default.bool,
|
130 |
|
131 | |
132 |
|
133 |
|
134 | error: _propTypes.default.bool,
|
135 |
|
136 | |
137 |
|
138 |
|
139 | icon: _propTypes.default.node
|
140 | } : void 0;
|
141 |
|
142 | var _default = (0, _withStyles.default)(styles, {
|
143 | name: 'MuiStepIcon'
|
144 | })(StepIcon);
|
145 |
|
146 | exports.default = _default; |
\ | No newline at end of file |