1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 |
|
4 |
|
5 | import * as React from 'react';
|
6 | import PropTypes from 'prop-types';
|
7 | import clsx from 'clsx';
|
8 | import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
|
9 | import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
|
10 | import withStyles from '../styles/withStyles';
|
11 | import ButtonBase from '../ButtonBase';
|
12 | export const styles = {
|
13 |
|
14 | root: {
|
15 | width: 40,
|
16 | flexShrink: 0,
|
17 | opacity: 0.8,
|
18 | '&$disabled': {
|
19 | opacity: 0
|
20 | }
|
21 | },
|
22 |
|
23 |
|
24 | vertical: {
|
25 | width: '100%',
|
26 | height: 40,
|
27 | '& svg': {
|
28 | transform: 'rotate(90deg)'
|
29 | }
|
30 | },
|
31 |
|
32 |
|
33 | disabled: {}
|
34 | };
|
35 |
|
36 | var _ref = React.createElement(KeyboardArrowLeft, {
|
37 | fontSize: "small"
|
38 | });
|
39 |
|
40 | var _ref2 = React.createElement(KeyboardArrowRight, {
|
41 | fontSize: "small"
|
42 | });
|
43 |
|
44 | const TabScrollButton = React.forwardRef(function TabScrollButton(props, ref) {
|
45 | const {
|
46 | classes,
|
47 | className: classNameProp,
|
48 | direction,
|
49 | orientation,
|
50 | disabled
|
51 | } = props,
|
52 | other = _objectWithoutPropertiesLoose(props, ["classes", "className", "direction", "orientation", "disabled"]);
|
53 |
|
54 | return React.createElement(ButtonBase, _extends({
|
55 | component: "div",
|
56 | className: clsx(classes.root, classNameProp, disabled && classes.disabled, orientation === 'vertical' && classes.vertical),
|
57 | ref: ref,
|
58 | role: null,
|
59 | tabIndex: null
|
60 | }, other), direction === 'left' ? _ref : _ref2);
|
61 | });
|
62 | process.env.NODE_ENV !== "production" ? TabScrollButton.propTypes = {
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | |
69 |
|
70 |
|
71 | children: PropTypes.node,
|
72 |
|
73 | |
74 |
|
75 |
|
76 |
|
77 | classes: PropTypes.object,
|
78 |
|
79 | |
80 |
|
81 |
|
82 | className: PropTypes.string,
|
83 |
|
84 | |
85 |
|
86 |
|
87 | direction: PropTypes.oneOf(['left', 'right']).isRequired,
|
88 |
|
89 | |
90 |
|
91 |
|
92 | disabled: PropTypes.bool,
|
93 |
|
94 | |
95 |
|
96 |
|
97 | orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired
|
98 | } : void 0;
|
99 | export default withStyles(styles, {
|
100 | name: 'MuiTabScrollButton'
|
101 | })(TabScrollButton); |
\ | No newline at end of file |