"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.linkStyles = exports.buttonStyles = exports.commonStyles = exports.getHeight = void 0;

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

var _branding = require("../../../mixins/branding");

var _spacing = require("../../../mixins/spacing");

var _stackee = require("../../../mixins/stackee");

var _typography = require("../../../mixins/typography");

var _focus = require("../../../mixins/focus");

var getBorderRadius = function getBorderRadius(_ref) {
  var theme = _ref.theme;
  return theme.buttonBorderRadius;
};

var getHeight = function getHeight(_ref2) {
  var _theme$buttonSizes$he, _theme$buttonSizes, _theme$buttonSizes$he2, _theme$buttonSizes$he3, _theme$buttonSizes2, _theme$buttonSizes2$h;

  var _ref2$size = _ref2.size,
      size = _ref2$size === void 0 ? 'md' : _ref2$size,
      theme = _ref2.theme;

  switch (size) {
    case 'sm':
      return (_theme$buttonSizes$he = (_theme$buttonSizes = theme.buttonSizes) === null || _theme$buttonSizes === void 0 ? void 0 : (_theme$buttonSizes$he2 = _theme$buttonSizes.height) === null || _theme$buttonSizes$he2 === void 0 ? void 0 : _theme$buttonSizes$he2.sm) !== null && _theme$buttonSizes$he !== void 0 ? _theme$buttonSizes$he : '40px';

    case 'md': // intentional fall-through.

    default:
      return (_theme$buttonSizes$he3 = (_theme$buttonSizes2 = theme.buttonSizes) === null || _theme$buttonSizes2 === void 0 ? void 0 : (_theme$buttonSizes2$h = _theme$buttonSizes2.height) === null || _theme$buttonSizes2$h === void 0 ? void 0 : _theme$buttonSizes2$h.md) !== null && _theme$buttonSizes$he3 !== void 0 ? _theme$buttonSizes$he3 : '48px';
  }
};

exports.getHeight = getHeight;

var getMinWidth = function getMinWidth(_ref3) {
  var _theme$buttonSizes$mi, _theme$buttonSizes3, _theme$buttonSizes3$m;

  var shrink = _ref3.shrink,
      _ref3$size = _ref3.size,
      size = _ref3$size === void 0 ? 'md' : _ref3$size,
      theme = _ref3.theme;
  return shrink == null ? (_theme$buttonSizes$mi = (_theme$buttonSizes3 = theme.buttonSizes) === null || _theme$buttonSizes3 === void 0 ? void 0 : (_theme$buttonSizes3$m = _theme$buttonSizes3.minWidth) === null || _theme$buttonSizes3$m === void 0 ? void 0 : _theme$buttonSizes3$m[size]) !== null && _theme$buttonSizes$mi !== void 0 ? _theme$buttonSizes$mi : '160px' : undefined;
};

var commonStyles = (0, _styledComponents.css)(["&&{display:inline-block;height:", ";border-width:0;padding:0 20px;background:transparent;color:", ";min-width:", ";text-decoration:none;font-size:", ";font-family:", ";font-weight:", ";border-radius:", ";", "}", "{transition:", ";box-shadow:", ",", " ", ";}&[disabled]{&:hover{cursor:default;background-color:transparent;}color:", ";}"], getHeight, (0, _branding.getPaletteColor)('greyscale-dark'), getMinWidth, _typography.getFontSize, _typography.getFontFamily, _typography.getFontWeight, getBorderRadius, (0, _focus.getBaseFocusState)({
  activeTransition: false
}), _focus.FOCUS_VISIBLE_SELECTOR, _focus.transitionInstant, _focus.focusedBoxShadow, _focus.focusedBorderShadow, _focus.focusedBorderColor, (0, _branding.getPaletteColor)('greyscale-medium'));
exports.commonStyles = commonStyles;
var buttonStyles = (0, _styledComponents.css)(["line-height:100%;&&&{", "}", ";&:enabled:hover{background-color:", ";}&:enabled:active{background-color:", ";}"], _spacing.getSpacingRules, _stackee.getStackeeRules, _focus.hoverBackgroundColor, _focus.activeBackgroundColor);
exports.buttonStyles = buttonStyles;
var linkStyles = (0, _styledComponents.css)(["line-height:", ";text-align:center;text-decoration:none;&&&{", "}", ";&:hover{background-color:", ";}&:active{background-color:", ";}"], getHeight, _spacing.getSpacingRules, _stackee.getStackeeRules, _focus.hoverBackgroundColor, _focus.activeBackgroundColor);
exports.linkStyles = linkStyles;