"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.commonLinkStyles = exports.commonButtonStyles = 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 getHeight = function getHeight(_ref) {
  var _theme$buttonSizes$he, _theme$buttonSizes, _theme$buttonSizes$he2;

  var _ref$size = _ref.size,
      size = _ref$size === void 0 ? 'md' : _ref$size,
      theme = _ref.theme;
  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[size]) !== null && _theme$buttonSizes$he !== void 0 ? _theme$buttonSizes$he : '40px';
};

exports.getHeight = getHeight;

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

var getMinWidth = function getMinWidth(_ref3) {
  var _theme$buttonSizes$mi, _theme$buttonSizes2, _theme$buttonSizes2$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$buttonSizes2 = theme.buttonSizes) === null || _theme$buttonSizes2 === void 0 ? void 0 : (_theme$buttonSizes2$m = _theme$buttonSizes2.minWidth) === null || _theme$buttonSizes2$m === void 0 ? void 0 : _theme$buttonSizes2$m[size]) !== null && _theme$buttonSizes$mi !== void 0 ? _theme$buttonSizes$mi : '160px' : undefined;
};

var getBackgroundColor = function getBackgroundColor(_ref4) {
  var disabled = _ref4.disabled,
      isLoading = _ref4.isLoading;
  return (0, _branding.getPaletteColor)(disabled && !isLoading ? 'greyscale-light' : 'brand-primary-fg');
};

var getForegroundColor = function getForegroundColor(_ref5) {
  var disabled = _ref5.disabled,
      isLoading = _ref5.isLoading;
  return (0, _branding.getPaletteColor)(disabled && !isLoading ? 'greyscale-black' : 'white');
};

var commonStyles = (0, _styledComponents.css)(["display:inline-block;min-width:", ";padding:0 15px;background:", ";border-width:0;border-radius:", ";color:", ";height:", ";font-family:", ";font-weight:", ";font-size:", ";", " ", "{box-shadow:", ",", " ", ";}&&&{", "}", ";"], getMinWidth, getBackgroundColor, getBorderRadius, getForegroundColor, getHeight, _typography.getFontFamily, _typography.getFontWeight, _typography.getFontSize, (0, _focus.getBaseFocusState)({}), _focus.FOCUS_VISIBLE_SELECTOR, _focus.focusedBoxShadow, _focus.focusedBorderShadow, _focus.focusedBorderColor, _spacing.getSpacingRules, _stackee.getStackeeRules);
var commonButtonStyles = (0, _styledComponents.css)(["", " line-height:100%;&:enabled:hover{background-color:", ";}&:enabled:active{background-color:", ";}"], commonStyles, (0, _branding.getPaletteColor)('brand-primary-fg-hover'), (0, _branding.getPaletteColor)('brand-primary-fg'));
exports.commonButtonStyles = commonButtonStyles;
var commonLinkStyles = (0, _styledComponents.css)(["", " line-height:", ";text-align:center;text-decoration:none;&:hover{background-color:", ";}&:active{background-color:", ";}"], commonStyles, getHeight, (0, _branding.getPaletteColor)('brand-primary-fg-hover'), (0, _branding.getPaletteColor)('brand-primary-fg'));
exports.commonLinkStyles = commonLinkStyles;