1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import withStyles from '../styles/withStyles';
|
7 | import ButtonBase from '../ButtonBase';
|
8 | import StepLabel from '../StepLabel';
|
9 | import isMuiElement from '../utils/isMuiElement';
|
10 | export const styles = {
|
11 |
|
12 | root: {
|
13 | width: '100%',
|
14 | padding: '24px 16px',
|
15 | margin: '-24px -16px',
|
16 | boxSizing: 'content-box'
|
17 | },
|
18 |
|
19 |
|
20 | horizontal: {},
|
21 |
|
22 |
|
23 | vertical: {
|
24 | justifyContent: 'flex-start',
|
25 | padding: '8px',
|
26 | margin: '-8px'
|
27 | },
|
28 |
|
29 |
|
30 | touchRipple: {
|
31 | color: 'rgba(0, 0, 0, 0.3)'
|
32 | }
|
33 | };
|
34 | const StepButton = React.forwardRef(function StepButton(props, ref) {
|
35 | const {
|
36 | active,
|
37 | alternativeLabel,
|
38 | children,
|
39 | classes,
|
40 | className,
|
41 | completed,
|
42 | disabled,
|
43 | icon,
|
44 | optional,
|
45 | orientation
|
46 | } = props,
|
47 | other = _objectWithoutPropertiesLoose(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "disabled", "expanded", "icon", "last", "optional", "orientation"]);
|
48 |
|
49 | const childProps = {
|
50 | active,
|
51 | alternativeLabel,
|
52 | completed,
|
53 | disabled,
|
54 | icon,
|
55 | optional,
|
56 | orientation
|
57 | };
|
58 | const child = isMuiElement(children, ['StepLabel']) ? React.cloneElement(children, childProps) : React.createElement(StepLabel, childProps, children);
|
59 | return React.createElement(ButtonBase, _extends({
|
60 | focusRipple: true,
|
61 | disabled: disabled,
|
62 | TouchRippleProps: {
|
63 | className: classes.touchRipple
|
64 | },
|
65 | className: clsx(classes.root, classes[orientation], className),
|
66 | ref: ref
|
67 | }, other), child);
|
68 | });
|
69 | process.env.NODE_ENV !== "production" ? StepButton.propTypes = {
|
70 | |
71 |
|
72 |
|
73 |
|
74 | active: PropTypes.bool,
|
75 |
|
76 | |
77 |
|
78 |
|
79 |
|
80 | alternativeLabel: PropTypes.bool,
|
81 |
|
82 | |
83 |
|
84 |
|
85 | children: PropTypes.node,
|
86 |
|
87 | |
88 |
|
89 |
|
90 |
|
91 | classes: PropTypes.object.isRequired,
|
92 |
|
93 | |
94 |
|
95 |
|
96 | className: PropTypes.string,
|
97 |
|
98 | |
99 |
|
100 |
|
101 |
|
102 | completed: PropTypes.bool,
|
103 |
|
104 | |
105 |
|
106 |
|
107 |
|
108 | disabled: PropTypes.bool,
|
109 |
|
110 | |
111 |
|
112 |
|
113 |
|
114 | expanded: PropTypes.bool,
|
115 |
|
116 | |
117 |
|
118 |
|
119 | icon: PropTypes.node,
|
120 |
|
121 | |
122 |
|
123 |
|
124 | last: PropTypes.bool,
|
125 |
|
126 | |
127 |
|
128 |
|
129 | optional: PropTypes.node,
|
130 |
|
131 | |
132 |
|
133 |
|
134 | orientation: PropTypes.oneOf(['horizontal', 'vertical'])
|
135 | } : void 0;
|
136 | export default withStyles(styles, {
|
137 | name: 'MuiStepButton'
|
138 | })(StepButton); |
\ | No newline at end of file |