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 _colorManipulator = require("../styles/colorManipulator");
|
25 |
|
26 | var styles = function styles(theme) {
|
27 | return {
|
28 |
|
29 | root: {
|
30 | height: 1,
|
31 | margin: 0,
|
32 |
|
33 | border: 'none',
|
34 | flexShrink: 0,
|
35 | backgroundColor: theme.palette.divider
|
36 | },
|
37 |
|
38 |
|
39 | absolute: {
|
40 | position: 'absolute',
|
41 | bottom: 0,
|
42 | left: 0,
|
43 | width: '100%'
|
44 | },
|
45 |
|
46 |
|
47 | inset: {
|
48 | marginLeft: 72
|
49 | },
|
50 |
|
51 |
|
52 | light: {
|
53 | backgroundColor: (0, _colorManipulator.fade)(theme.palette.divider, 0.08)
|
54 | },
|
55 |
|
56 |
|
57 | middle: {
|
58 | marginLeft: theme.spacing(2),
|
59 | marginRight: theme.spacing(2)
|
60 | },
|
61 |
|
62 |
|
63 | vertical: {
|
64 | height: '100%',
|
65 | width: 1
|
66 | },
|
67 |
|
68 |
|
69 | flexItem: {
|
70 | alignSelf: 'stretch',
|
71 | height: 'auto'
|
72 | }
|
73 | };
|
74 | };
|
75 |
|
76 | exports.styles = styles;
|
77 | var Divider = React.forwardRef(function Divider(props, ref) {
|
78 | var _props$absolute = props.absolute,
|
79 | absolute = _props$absolute === void 0 ? false : _props$absolute,
|
80 | classes = props.classes,
|
81 | className = props.className,
|
82 | _props$component = props.component,
|
83 | Component = _props$component === void 0 ? 'hr' : _props$component,
|
84 | _props$flexItem = props.flexItem,
|
85 | flexItem = _props$flexItem === void 0 ? false : _props$flexItem,
|
86 | _props$light = props.light,
|
87 | light = _props$light === void 0 ? false : _props$light,
|
88 | _props$orientation = props.orientation,
|
89 | orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
90 | _props$role = props.role,
|
91 | role = _props$role === void 0 ? Component !== 'hr' ? 'separator' : undefined : _props$role,
|
92 | _props$variant = props.variant,
|
93 | variant = _props$variant === void 0 ? 'fullWidth' : _props$variant,
|
94 | other = (0, _objectWithoutProperties2.default)(props, ["absolute", "classes", "className", "component", "flexItem", "light", "orientation", "role", "variant"]);
|
95 | return React.createElement(Component, (0, _extends2.default)({
|
96 | className: (0, _clsx.default)(classes.root, className, variant !== 'fullWidth' && classes[variant], absolute && classes.absolute, flexItem && classes.flexItem, light && classes.light, orientation === 'vertical' && classes.vertical),
|
97 | role: role,
|
98 | ref: ref
|
99 | }, other));
|
100 | });
|
101 | process.env.NODE_ENV !== "production" ? Divider.propTypes = {
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 | |
108 |
|
109 |
|
110 | absolute: _propTypes.default.bool,
|
111 |
|
112 | |
113 |
|
114 |
|
115 | children: _propTypes.default.node,
|
116 |
|
117 | |
118 |
|
119 |
|
120 |
|
121 | classes: _propTypes.default.object,
|
122 |
|
123 | |
124 |
|
125 |
|
126 | className: _propTypes.default.string,
|
127 |
|
128 | |
129 |
|
130 |
|
131 |
|
132 | component: _propTypes.default
|
133 |
|
134 | .elementType,
|
135 |
|
136 | |
137 |
|
138 |
|
139 |
|
140 | flexItem: _propTypes.default.bool,
|
141 |
|
142 | |
143 |
|
144 |
|
145 | light: _propTypes.default.bool,
|
146 |
|
147 | |
148 |
|
149 |
|
150 | orientation: _propTypes.default.oneOf(['horizontal', 'vertical']),
|
151 |
|
152 | |
153 |
|
154 |
|
155 | role: _propTypes.default.string,
|
156 |
|
157 | |
158 |
|
159 |
|
160 | variant: _propTypes.default.oneOf(['fullWidth', 'inset', 'middle'])
|
161 | } : void 0;
|
162 |
|
163 | var _default = (0, _withStyles.default)(styles, {
|
164 | name: 'MuiDivider'
|
165 | })(Divider);
|
166 |
|
167 | exports.default = _default; |
\ | No newline at end of file |