"use strict";

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.useTabListStyle = exports.tabListStyle = exports.tabStyle = void 0;

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

var _ThemeProvider = require("../ThemeProvider");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

var tabStyle = function tabStyle(_ref, theme) {
  var _ref$color = _ref.color,
      color = _ref$color === void 0 ? 'button' : _ref$color;
  return {
    style: {
      display: 'flex',
      cursor: 'pointer',
      alignItems: 'center',
      justifyContent: 'center',
      transition: 'all 0.2s',
      color: 'faintText',
      whiteSpace: 'nowrap',
      _focus: {
        zIndex: '1',
        boxShadow: 'outline'
      },
      _disabled: {
        opacity: 0.4,
        cursor: 'not-allowed'
      },
      borderRadius: 'radius'
    },
    orientation: {
      horizontal: {
        height: '100%'
      },
      vertical: {
        width: '100%'
      }
    },
    sizes: {
      sm: {
        padding: [1, '0.25rem 1rem']
      },
      md: {
        padding: [2, '0.5rem 1rem']
      },
      lg: {
        padding: [3, '0.75rem 1.25rem']
      }
    },
    variants: {
      line: {
        borderBottom: '2px',
        borderColor: 'transparent',
        borderRadius: 0,
        _selected: {
          color: 'titleText',
          opacity: 1,
          borderColor: "".concat(color, ".500"),
          boxShadow: 'none',
          svg: {
            color: "".concat(color, ".500")
          }
        },
        _disabled: {
          opacity: 0.4,
          cursor: 'not-allowed'
        }
      },
      enclosed: {
        rounded: 'radius',
        border: '2px',
        borderColor: 'transparent',
        _selected: {
          color: "".concat(color, ".500"),
          borderColor: "".concat(color, ".500"),
          opacity: 1
        }
      },
      'enclosed-colored': {
        border: '1px',
        borderColor: 'inherit',
        bg: 'gray.50',
        mb: '-1px',
        _notLast: {
          mr: '-1px'
        },
        _selected: {
          bg: 'white',
          color: "".concat(color, ".500"),
          borderColor: 'inherit',
          borderTopColor: 'currentColor',
          borderBottomColor: 'transparent'
        }
      },
      'soft-rounded': {
        rounded: 'full',
        fontWeight: 'semibold',
        color: 'gray.500',
        _selected: {
          color: "".concat(color, ".700"),
          bg: "".concat(color, ".100")
        }
      },
      'solid-rounded': {
        rounded: 'full',
        fontWeight: 'semibold',
        color: 'gray.500',
        _selected: {
          color: 'white',
          bg: "".concat(color, ".500")
        }
      },
      unstyled: {// unstyled
      }
    }
  };
};

exports.tabStyle = tabStyle;

var useTabStyle = function useTabStyle(props) {
  var theme = (0, _ThemeProvider.useTheme)();
  var styles = theme['styles'].tab ? theme['styles'].tab(props, theme) : tabStyle(props, theme);
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styles.style), styles.orientation[props.orientation]), styles.sizes[props.size]), styles.variants[props.variant]), props.isFitted && {
    flex: 1
  });
};

var alignments = {
  end: 'flex-end',
  center: 'center',
  start: 'flex-start'
};

var tabListStyle = function tabListStyle(_ref2, _ref3) {
  var _ref2$align = _ref2.align,
      align = _ref2$align === void 0 ? 'start' : _ref2$align,
      showScrollbar = _ref2.showScrollbar;
  var colors = _ref3.colors;
  return {
    style: {
      borderColor: 'transparent'
    },
    orientation: {
      horizontal: {
        alignItems: 'center',
        justifyContent: alignments[align],
        minWidth: 'fit-content'
      },
      vertical: {
        flexDirection: 'column'
      }
    },
    variants: {
      line: {//
      },
      enclosed: {
        mb: '-1px',
        borderBottom: '1px'
      },
      'enclosed-colored': {
        mb: '-1px',
        borderBottom: '1px'
      },
      'soft-rounded': {// unstyled
      },
      'solid-rounded': {// unstyled
      },
      unstyled: {// unstyled
      }
    },
    container: {
      overflowX: 'auto',
      _scrollbar: {
        width: '0.4em',
        height: '0.4em',
        display: !showScrollbar && 'none'
      },
      _thumb: {
        backgroundColor: colors.thumb,
        marginTop: 8
      },
      _track: {
        backgroundColor: colors.track
      }
    }
  };
};

exports.tabListStyle = tabListStyle;

var useTabListStyle = function useTabListStyle(props) {
  var theme = (0, _ThemeProvider.useTheme)();
  var styles = theme['styles'].tabList ? theme['styles'].tabList(props, theme) : tabListStyle(props, theme);
  return {
    root: _objectSpread(_objectSpread(_objectSpread({}, styles.orientation[props.orientation]), styles.variants[props.variant]), styles.style),
    container: styles.container
  };
};

exports.useTabListStyle = useTabListStyle;
var _default = useTabStyle;
exports["default"] = _default;
//# sourceMappingURL=styles.js.map