UNPKG

@material-ui/core

Version:

React components that implement Google's Material Design.

99 lines (86 loc) 2.95 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; /* eslint-disable jsx-a11y/aria-role */ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft'; import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight'; import withStyles from '../styles/withStyles'; import ButtonBase from '../ButtonBase'; export var styles = { /* Styles applied to the root element. */ root: { width: 40, flexShrink: 0, opacity: 0.8, '&$disabled': { opacity: 0 } }, /* Styles applied to the root element if `orientation="vertical"`. */ vertical: { width: '100%', height: 40, '& svg': { transform: 'rotate(90deg)' } }, /* Pseudo-class applied to the root element if `disabled={true}`. */ disabled: {} }; var _ref = /*#__PURE__*/React.createElement(KeyboardArrowLeft, { fontSize: "small" }); var _ref2 = /*#__PURE__*/React.createElement(KeyboardArrowRight, { fontSize: "small" }); var TabScrollButton = /*#__PURE__*/React.forwardRef(function TabScrollButton(props, ref) { var classes = props.classes, classNameProp = props.className, direction = props.direction, orientation = props.orientation, disabled = props.disabled, other = _objectWithoutProperties(props, ["classes", "className", "direction", "orientation", "disabled"]); return /*#__PURE__*/React.createElement(ButtonBase, _extends({ component: "div", className: clsx(classes.root, classNameProp, disabled && classes.disabled, orientation === 'vertical' && classes.vertical), ref: ref, role: null, tabIndex: null }, other), direction === 'left' ? _ref : _ref2); }); process.env.NODE_ENV !== "production" ? TabScrollButton.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the d.ts file and run "yarn proptypes" | // ---------------------------------------------------------------------- /** * The content of the component. */ children: PropTypes.node, /** * Override or extend the styles applied to the component. * See [CSS API](#css) below for more details. */ classes: PropTypes.object, /** * @ignore */ className: PropTypes.string, /** * Which direction should the button indicate? */ direction: PropTypes.oneOf(['left', 'right']).isRequired, /** * If `true`, the element will be disabled. */ disabled: PropTypes.bool, /** * The tabs orientation (layout flow direction). */ orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired } : void 0; export default withStyles(styles, { name: 'MuiTabScrollButton' })(TabScrollButton);