"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

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

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

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

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

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

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

var _secondaryButton = require("./secondary-button.css-rules");

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

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var getCommonStyles = (0, _styledComponents.css)(["&&{display:inline-block;height:48px;border-width:0;padding:0 20px;background:transparent;color:", ";text-decoration:none;font-size:", ";font-family:", ";font-weight:", ";border-radius:", ";", "}", "{transition:", ";box-shadow:", ",", " ", ";}&:hover{background-color:", ";}&:active{background-color:", ";}&[disabled]{&:hover{cursor:default;background-color:transparent;}color:", ";}"], (0, _branding.getPaletteColor)('greyscale-darker'), _typography.getFontSize, _typography.getFontFamily, _typography.getFontWeight, _secondaryButton.getBorderRadius, (0, _focus.getBaseFocusState)({
  activeTransition: false
}), _focus.FOCUS_VISIBLE_SELECTOR, _focus.transitionInstant, _focus.focusedBoxShadow, _focus.focusedBorderShadow, _focus.focusedBorderColor, _focus.hoverBackgroundColor, _focus.activeBackgroundColor, (0, _branding.getPaletteColor)('greyscale-medium'));

var ActualButton = _styledComponents["default"].button.attrs(function (props) {
  return {
    type: props.type || 'button',
    bold: 'true'
  };
}).withConfig({
  displayName: "ActualButton",
  componentId: "ur52dw-0"
})(["", " line-height:100%;", ";"], getCommonStyles, _spacing.getSpacingRules);

var LinkButton = _styledComponents["default"].a.attrs(function () {
  return {
    bold: 'true'
  };
}).withConfig({
  displayName: "LinkButton",
  componentId: "ur52dw-1"
})(["", " line-height:48px;text-align:center;text-decoration:none;", ";"], getCommonStyles, _spacing.getSpacingRules);

var SecondaryButton = (0, _react.forwardRef)(function (props, ref) {
  return props.href === undefined ? /*#__PURE__*/_react["default"].createElement(ActualButton, _extends({}, props, {
    ref: ref
  })) : /*#__PURE__*/_react["default"].createElement(LinkButton, _extends({}, props, {
    ref: ref
  }));
});
exports.SecondaryButton = SecondaryButton;
SecondaryButton.displayName = 'SecondaryButton';