UNPKG

4.19 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 _withStyles = _interopRequireDefault(require("../styles/withStyles"));
23
24var styles = function styles(theme) {
25 return {
26 /* Styles applied to the root element. */
27 root: {
28 flex: '1 1 auto'
29 },
30
31 /* Styles applied to the root element if `orientation="horizontal"`. */
32 horizontal: {},
33
34 /* Styles applied to the root element if `orientation="vertical"`. */
35 vertical: {
36 marginLeft: 12,
37 // half icon
38 padding: '0 0 8px'
39 },
40
41 /* Styles applied to the root element if `alternativeLabel={true}`. */
42 alternativeLabel: {
43 position: 'absolute',
44 top: 8 + 4,
45 left: 'calc(-50% + 20px)',
46 right: 'calc(50% + 20px)'
47 },
48
49 /* Pseudo-class applied to the root element if `active={true}`. */
50 active: {},
51
52 /* Pseudo-class applied to the root element if `completed={true}`. */
53 completed: {},
54
55 /* Pseudo-class applied to the root element if `disabled={true}`. */
56 disabled: {},
57
58 /* Styles applied to the line element. */
59 line: {
60 display: 'block',
61 borderColor: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]
62 },
63
64 /* Styles applied to the root element if `orientation="horizontal"`. */
65 lineHorizontal: {
66 borderTopStyle: 'solid',
67 borderTopWidth: 1
68 },
69
70 /* Styles applied to the root element if `orientation="vertical"`. */
71 lineVertical: {
72 borderLeftStyle: 'solid',
73 borderLeftWidth: 1,
74 minHeight: 24
75 }
76 };
77};
78
79exports.styles = styles;
80var StepConnector = /*#__PURE__*/React.forwardRef(function StepConnector(props, ref) {
81 var active = props.active,
82 _props$alternativeLab = props.alternativeLabel,
83 alternativeLabel = _props$alternativeLab === void 0 ? false : _props$alternativeLab,
84 classes = props.classes,
85 className = props.className,
86 completed = props.completed,
87 disabled = props.disabled,
88 index = props.index,
89 _props$orientation = props.orientation,
90 orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
91 other = (0, _objectWithoutProperties2.default)(props, ["active", "alternativeLabel", "classes", "className", "completed", "disabled", "index", "orientation"]);
92 return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
93 className: (0, _clsx.default)(classes.root, classes[orientation], className, alternativeLabel && classes.alternativeLabel, active && classes.active, completed && classes.completed, disabled && classes.disabled),
94 ref: ref
95 }, other), /*#__PURE__*/React.createElement("span", {
96 className: (0, _clsx.default)(classes.line, {
97 'horizontal': classes.lineHorizontal,
98 'vertical': classes.lineVertical
99 }[orientation])
100 }));
101});
102process.env.NODE_ENV !== "production" ? StepConnector.propTypes = {
103 // ----------------------------- Warning --------------------------------
104 // | These PropTypes are generated from the TypeScript type definitions |
105 // | To update them edit the d.ts file and run "yarn proptypes" |
106 // ----------------------------------------------------------------------
107
108 /**
109 * Override or extend the styles applied to the component.
110 * See [CSS API](#css) below for more details.
111 */
112 classes: _propTypes.default.object,
113
114 /**
115 * @ignore
116 */
117 className: _propTypes.default.string
118} : void 0;
119
120var _default = (0, _withStyles.default)(styles, {
121 name: 'MuiStepConnector'
122})(StepConnector);
123
124exports.default = _default;
\No newline at end of file