"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.Card = void 0;

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

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

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

var _stacking = require("../../../mixins/stacking");

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

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

var _card = require("./card.css-rules");

var _unstyledButton = require("../../behaviors/unstyled-button");

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 sharedStyles = (0, _styledComponents.css)(["background-color:", ";border-radius:", ";display:block;font-size:", ";", ";", ";", ";&&&{transition-delay:0s;transition-property:all;transition-duration:300ms;transition-timing-function:ease-in;}box-shadow:0 5px 15px 0 ", ";&:hover{box-shadow:0 5px 15px 0 ", ";}&:active{box-shadow:0 5px 15px 0 ", ";}"], (0, _branding.getPaletteColor)('white'), _card.getCardBorderRadius, _card.getCardFontSize, _card.getCardSpacingRules, _stacking.getStackedRules, _stackee.getStackeeRules, _card.getBoxShadowColor, _card.getHoverBoxShadowColor, _card.getBoxShadowColor);

var CardDiv = _styledComponents["default"].div.withConfig({
  displayName: "CardDiv",
  componentId: "xc590y-0"
})(["", ""], sharedStyles);

var CardLink = _styledComponents["default"].a.withConfig({
  displayName: "CardLink",
  componentId: "xc590y-1"
})(["color:inherit;outline:none;text-decoration:inherit;", " ", "{box-shadow:", " ", ",", ";}", ";"], _focus.getBaseFocusState, _focus.FOCUS_VISIBLE_SELECTOR, (0, _focus.focusedBorderShadow)({
  inset: false
}), _focus.focusedBorderColor, _focus.focusedBoxShadow, sharedStyles);

var CardButton = (0, _styledComponents["default"])(_unstyledButton.UnstyledButton).withConfig({
  displayName: "CardButton",
  componentId: "xc590y-2"
})(["width:100%;line-height:inherit;", ""], sharedStyles);
var Card = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
  if (props.href != null) {
    return /*#__PURE__*/_react["default"].createElement(CardLink, _extends({
      ref: ref
    }, props));
  }

  if (props.onClick) {
    return /*#__PURE__*/_react["default"].createElement(CardButton, _extends({
      ref: ref
    }, props));
  }

  return /*#__PURE__*/_react["default"].createElement(CardDiv, _extends({
    ref: ref
  }, props));
});
exports.Card = Card;
Card.displayName = 'Card';