UNPKG

3.43 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import withStyles from '../styles/withStyles';
7export const styles = theme => ({
8 /* Styles applied to the root element. */
9 root: {
10 flex: '1 1 auto'
11 },
12
13 /* Styles applied to the root element if `orientation="horizontal"`. */
14 horizontal: {},
15
16 /* Styles applied to the root element if `orientation="vertical"`. */
17 vertical: {
18 marginLeft: 12,
19 // half icon
20 padding: '0 0 8px'
21 },
22
23 /* Styles applied to the root element if `alternativeLabel={true}`. */
24 alternativeLabel: {
25 position: 'absolute',
26 top: 8 + 4,
27 left: 'calc(-50% + 20px)',
28 right: 'calc(50% + 20px)'
29 },
30
31 /* Pseudo-class applied to the root element if `active={true}`. */
32 active: {},
33
34 /* Pseudo-class applied to the root element if `completed={true}`. */
35 completed: {},
36
37 /* Pseudo-class applied to the root element if `disabled={true}`. */
38 disabled: {},
39
40 /* Styles applied to the line element. */
41 line: {
42 display: 'block',
43 borderColor: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]
44 },
45
46 /* Styles applied to the root element if `orientation="horizontal"`. */
47 lineHorizontal: {
48 borderTopStyle: 'solid',
49 borderTopWidth: 1
50 },
51
52 /* Styles applied to the root element if `orientation="vertical"`. */
53 lineVertical: {
54 borderLeftStyle: 'solid',
55 borderLeftWidth: 1,
56 minHeight: 24
57 }
58});
59const StepConnector = /*#__PURE__*/React.forwardRef(function StepConnector(props, ref) {
60 const {
61 // eslint-disable-next-line react/prop-types
62 active,
63 // eslint-disable-next-line react/prop-types
64 alternativeLabel = false,
65 classes,
66 className,
67 // eslint-disable-next-line react/prop-types
68 completed,
69 // eslint-disable-next-line react/prop-types
70 disabled,
71 // eslint-disable-next-line react/prop-types
72 orientation = 'horizontal'
73 } = props,
74 other = _objectWithoutPropertiesLoose(props, ["active", "alternativeLabel", "classes", "className", "completed", "disabled", "index", "orientation"]);
75
76 return /*#__PURE__*/React.createElement("div", _extends({
77 className: clsx(classes.root, classes[orientation], className, alternativeLabel && classes.alternativeLabel, active && classes.active, completed && classes.completed, disabled && classes.disabled),
78 ref: ref
79 }, other), /*#__PURE__*/React.createElement("span", {
80 className: clsx(classes.line, {
81 'horizontal': classes.lineHorizontal,
82 'vertical': classes.lineVertical
83 }[orientation])
84 }));
85});
86process.env.NODE_ENV !== "production" ? StepConnector.propTypes = {
87 // ----------------------------- Warning --------------------------------
88 // | These PropTypes are generated from the TypeScript type definitions |
89 // | To update them edit the d.ts file and run "yarn proptypes" |
90 // ----------------------------------------------------------------------
91
92 /**
93 * Override or extend the styles applied to the component.
94 * See [CSS API](#css) below for more details.
95 */
96 classes: PropTypes.object,
97
98 /**
99 * @ignore
100 */
101 className: PropTypes.string
102} : void 0;
103export default withStyles(styles, {
104 name: 'MuiStepConnector'
105})(StepConnector);
\No newline at end of file