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 { alpha } from '../styles/colorManipulator';
|
8 | export const styles = theme => ({
|
9 |
|
10 | root: {
|
11 | height: 1,
|
12 | margin: 0,
|
13 |
|
14 | border: 'none',
|
15 | flexShrink: 0,
|
16 | backgroundColor: theme.palette.divider
|
17 | },
|
18 |
|
19 |
|
20 | absolute: {
|
21 | position: 'absolute',
|
22 | bottom: 0,
|
23 | left: 0,
|
24 | width: '100%'
|
25 | },
|
26 |
|
27 |
|
28 | inset: {
|
29 | marginLeft: 72
|
30 | },
|
31 |
|
32 |
|
33 | light: {
|
34 | backgroundColor: alpha(theme.palette.divider, 0.08)
|
35 | },
|
36 |
|
37 |
|
38 | middle: {
|
39 | marginLeft: theme.spacing(2),
|
40 | marginRight: theme.spacing(2)
|
41 | },
|
42 |
|
43 |
|
44 | vertical: {
|
45 | height: '100%',
|
46 | width: 1
|
47 | },
|
48 |
|
49 |
|
50 | flexItem: {
|
51 | alignSelf: 'stretch',
|
52 | height: 'auto'
|
53 | }
|
54 | });
|
55 | const Divider = React.forwardRef(function Divider(props, ref) {
|
56 | const {
|
57 | absolute = false,
|
58 | classes,
|
59 | className,
|
60 | component: Component = 'hr',
|
61 | flexItem = false,
|
62 | light = false,
|
63 | orientation = 'horizontal',
|
64 | role = Component !== 'hr' ? 'separator' : undefined,
|
65 | variant = 'fullWidth'
|
66 | } = props,
|
67 | other = _objectWithoutPropertiesLoose(props, ["absolute", "classes", "className", "component", "flexItem", "light", "orientation", "role", "variant"]);
|
68 |
|
69 | return React.createElement(Component, _extends({
|
70 | className: clsx(classes.root, className, variant !== 'fullWidth' && classes[variant], absolute && classes.absolute, flexItem && classes.flexItem, light && classes.light, orientation === 'vertical' && classes.vertical),
|
71 | role: role,
|
72 | ref: ref
|
73 | }, other));
|
74 | });
|
75 | process.env.NODE_ENV !== "production" ? Divider.propTypes = {
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | |
82 |
|
83 |
|
84 | absolute: PropTypes.bool,
|
85 |
|
86 | |
87 |
|
88 |
|
89 | children: PropTypes.node,
|
90 |
|
91 | |
92 |
|
93 |
|
94 |
|
95 | classes: PropTypes.object,
|
96 |
|
97 | |
98 |
|
99 |
|
100 | className: PropTypes.string,
|
101 |
|
102 | |
103 |
|
104 |
|
105 |
|
106 | component: PropTypes
|
107 |
|
108 | .elementType,
|
109 |
|
110 | |
111 |
|
112 |
|
113 |
|
114 | flexItem: PropTypes.bool,
|
115 |
|
116 | |
117 |
|
118 |
|
119 | light: PropTypes.bool,
|
120 |
|
121 | |
122 |
|
123 |
|
124 | orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
125 |
|
126 | |
127 |
|
128 |
|
129 | role: PropTypes.string,
|
130 |
|
131 | |
132 |
|
133 |
|
134 | variant: PropTypes.oneOf(['fullWidth', 'inset', 'middle'])
|
135 | } : void 0;
|
136 | export default withStyles(styles, {
|
137 | name: 'MuiDivider'
|
138 | })(Divider); |
\ | No newline at end of file |