"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var React = _interopRequireWildcard(require("react"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _injectE2E = _interopRequireDefault(require("../../Tools/injectE2E"));

var _interpolation = require("../../Tools/interpolation");

var Wrapper =
/*#__PURE__*/
_styledComponents.default.div.attrs(_injectE2E.default).withConfig({
  componentId: "sc-5kcyjn-0"
})(["\n  position: relative;\n  flex: 1 auto;\n  flex-direction: row;\n  justify-content: flex-start;\n  align-items: center;\n  padding: 1rem;\n  box-sizing: border-box;\n  cursor: pointer;\n\n  @media (max-width: ", ") {\n    order: 1;\n\n    &.hidden {\n      order: 2;\n    }\n  }\n\n  @media (min-width: ", ") {\n    display: flex;\n    justify-content: center;\n    order: 1;\n\n    &:hover {\n      & :last-child {\n        opacity: 1;\n      }\n    }\n  }\n"], (0, _interpolation.screenSize)('sm'), (0, _interpolation.screenSize)('sm'));

var Bar =
/*#__PURE__*/
_styledComponents.default.div.withConfig({
  componentId: "sc-5kcyjn-1"
})(["\n  position: absolute;\n  bottom: -2px;\n  left: 0;\n  width: 100%;\n  height: 0.2rem;\n  transition-duration: 0.3s;\n  transition-timing-function: ease-in-out;\n  background-color: ", ";\n  opacity: ", ";\n"], (0, _interpolation.theme)('tabMenuBarColor'), function (props) {
  return props.selected === true ? '1' : '0';
});

var TabMenuItem = function TabMenuItem(_ref) {
  var children = _ref.children,
      className = _ref.className,
      selected = _ref.selected,
      rest = (0, _objectWithoutProperties2.default)(_ref, ["children", "className", "selected"]);
  return React.createElement(Wrapper, (0, _extends2.default)({
    className: selected === true ? className : "".concat(className || '', " disabled")
  }, rest), children, React.createElement(Bar, {
    selected: selected
  }));
};

TabMenuItem.propTypes = process.env.NODE_ENV !== "production" ? {
  children: _propTypes.default.node,
  className: _propTypes.default.string,
  e2e: _propTypes.default.string,
  selected: _propTypes.default.bool
} : {};
TabMenuItem.defaultProps = {
  e2e: 'defaultTabMenuItem',
  selected: false
};
var _default = TabMenuItem;
exports.default = _default;