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 capitalize from '../utils/capitalize';
|
8 | export const styles = theme => ({
|
9 | root: {
|
10 | position: 'absolute',
|
11 | height: 2,
|
12 | bottom: 0,
|
13 | width: '100%',
|
14 | transition: theme.transitions.create()
|
15 | },
|
16 | colorPrimary: {
|
17 | backgroundColor: theme.palette.primary.main
|
18 | },
|
19 | colorSecondary: {
|
20 | backgroundColor: theme.palette.secondary.main
|
21 | },
|
22 | vertical: {
|
23 | height: '100%',
|
24 | width: 2,
|
25 | right: 0
|
26 | }
|
27 | });
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | const TabIndicator = React.forwardRef(function TabIndicator(props, ref) {
|
33 | const {
|
34 | classes,
|
35 | className,
|
36 | color,
|
37 | orientation
|
38 | } = props,
|
39 | other = _objectWithoutPropertiesLoose(props, ["classes", "className", "color", "orientation"]);
|
40 |
|
41 | return React.createElement("span", _extends({
|
42 | className: clsx(classes.root, classes[`color${capitalize(color)}`], className, orientation === 'vertical' && classes.vertical),
|
43 | ref: ref
|
44 | }, other));
|
45 | });
|
46 | process.env.NODE_ENV !== "production" ? TabIndicator.propTypes = {
|
47 | |
48 |
|
49 |
|
50 |
|
51 | classes: PropTypes.object.isRequired,
|
52 |
|
53 | |
54 |
|
55 |
|
56 | className: PropTypes.string,
|
57 |
|
58 | |
59 |
|
60 |
|
61 |
|
62 | color: PropTypes.oneOf(['primary', 'secondary']).isRequired,
|
63 |
|
64 | |
65 |
|
66 |
|
67 | orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired
|
68 | } : void 0;
|
69 | export default withStyles(styles, {
|
70 | name: 'PrivateTabIndicator'
|
71 | })(TabIndicator); |
\ | No newline at end of file |