UNPKG

@material-ui/core

Version:

React components that implement Google's Material Design.

71 lines (66 loc) 2.01 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import withStyles from '../styles/withStyles'; import capitalize from '../utils/capitalize'; export var styles = function styles(theme) { return { root: { position: 'absolute', height: 2, bottom: 0, width: '100%', transition: theme.transitions.create() }, colorPrimary: { backgroundColor: theme.palette.primary.main }, colorSecondary: { backgroundColor: theme.palette.secondary.main }, vertical: { height: '100%', width: 2, right: 0 } }; }; /** * @ignore - internal component. */ var TabIndicator = /*#__PURE__*/React.forwardRef(function TabIndicator(props, ref) { var classes = props.classes, className = props.className, color = props.color, orientation = props.orientation, other = _objectWithoutProperties(props, ["classes", "className", "color", "orientation"]); return /*#__PURE__*/React.createElement("span", _extends({ className: clsx(classes.root, classes["color".concat(capitalize(color))], className, orientation === 'vertical' && classes.vertical), ref: ref }, other)); }); process.env.NODE_ENV !== "production" ? TabIndicator.propTypes = { /** * Override or extend the styles applied to the component. * See [CSS API](#css) below for more details. */ classes: PropTypes.object.isRequired, /** * @ignore */ className: PropTypes.string, /** * @ignore * The color of the tab indicator. */ color: PropTypes.oneOf(['primary', 'secondary']).isRequired, /** * The tabs orientation (layout flow direction). */ orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired } : void 0; export default withStyles(styles, { name: 'PrivateTabIndicator' })(TabIndicator);