'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _styledComponents = require('styled-components');

var _styledComponents2 = _interopRequireDefault(_styledComponents);

var _themeGet = require('../../../extensions/themeGet');

var _themeGet2 = _interopRequireDefault(_themeGet);

var _TabList = require('./TabList');

var _TabList2 = _interopRequireDefault(_TabList);

var _TabContainer = require('./TabContainer');

var _TabContainer2 = _interopRequireDefault(_TabContainer);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var verticalStyles = (0, _styledComponents.css)(['border-bottom-color:', ';border-right-color:', ';&:last-child{border-radius:0 0 0 3px;margin-bottom:0;}', ';'], (0, _themeGet2.default)('colors.border.medium'), function (props) {
  return props.active ? (0, _themeGet2.default)('colors.background.default')(props) : (0, _themeGet2.default)('colors.border.medium')(props);
}, function (_ref) {
  var disabled = _ref.disabled,
      active = _ref.active;

  if (!disabled && !active) {
    return (0, _styledComponents.css)(['&:hover{border-bottom-color:', ';}'], function (props) {
      return props.active ? (0, _themeGet2.default)('colors.border.medium')(props) : (0, _themeGet2.default)('colors.primary.default')(props);
    });
  }
});

var Tab = _styledComponents2.default.li.withConfig({
  displayName: 'Tab'
})(['position:relative;display:flex;flex-direction:column;align-content:flex-start;opacity:', ';padding:1em 1.4em;margin-right:-1px;margin-bottom:-1px;cursor:', ';color:inherit;background:', ';font-weight:bold;text-transform:uppercase;white-space:nowrap;transition:opacity 0.2s ease,border-color 0.2s ease;border-width:', ';border-style:solid;border-color:', ';border-bottom-color:', ';&:first-child{border-radius:3px 0 0 0;}&:last-child{border-radius:0 3px 0 0;margin-right:0;}', ' ', ':not(', ') > &{flex:1 0 0;}', ' > &,', ' > ', ' > &{', ';}'], function (_ref2) {
  var active = _ref2.active;
  return active ? 1 : 0.5;
}, function (_ref3) {
  var disabled = _ref3.disabled,
      active = _ref3.active;
  return disabled || active ? 'default' : 'pointer';
}, function (props) {
  return props.disabled ? (0, _themeGet2.default)('colors.background.disabled')(props) : (0, _themeGet2.default)('colors.background.default')(props);
}, (0, _themeGet2.default)('thicknesses.normal'), (0, _themeGet2.default)('colors.border.medium'), function (props) {
  return props.active ? (0, _themeGet2.default)('colors.background.default')(props) : (0, _themeGet2.default)('colors.border.medium')(props);
}, function (_ref4) {
  var disabled = _ref4.disabled,
      active = _ref4.active;

  if (!disabled && !active) {
    return (0, _styledComponents.css)(['&:hover{border-color:', ';opacity:1;z-index:1;}'], function (props) {
      return props.active ? (0, _themeGet2.default)('colors.border.medium')(props) : (0, _themeGet2.default)('colors.primary.default')(props);
    });
  }
}, _TabList2.default, _TabList2.default.Vertical, _TabList2.default.Vertical, _TabContainer2.default.Vertical, _TabList2.default, verticalStyles);

Tab.Vertical = (0, _styledComponents2.default)(Tab).withConfig({
  displayName: 'Tab__Vertical'
})(['', ';'], verticalStyles);

/**
 * @component
 */
exports.default = Tab;