"use strict";

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

var _base = _interopRequireDefault(require("@emotion/styled/base"));

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

var _styles = require("./styles");

var _jsxRuntime = require("@emotion/react/jsx-runtime");

var _excluded = ["as", "variant", "color", "size", "disabled"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

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) { _defineProperty(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; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var Button = (0, _base["default"])("button", process.env.NODE_ENV === "production" ? {
  target: "e117fuc81"
} : {
  target: "e117fuc81",
  label: "Button"
})(function (_ref) {
  var _buttonColorVariantSt;

  var _ref$variant = _ref.variant,
      variant = _ref$variant === void 0 ? 'secondary' : _ref$variant,
      _ref$color = _ref.color,
      color = _ref$color === void 0 ? 'brand' : _ref$color,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? 'md' : _ref$size,
      disabled = _ref.disabled,
      block = _ref.block;
  return [// Base styles
  {
    "transitionProperty": "background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",
    "transitionTimingFunction": "cubic-bezier(0.4, 0, 0.2, 1)",
    "transitionDuration": "200ms",
    "borderRadius": "0.25rem",
    "fontWeight": "700",
    "fontFamily": "\"TT Commons\", system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"",
    "--tw-transform": "translate3d(var(--tw-translate-x), var(--tw-translate-y), 0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))",
    ":active": {
      "--tw-scale-x": ".95",
      "--tw-scale-y": ".95",
      "transform": "var(--tw-transform)"
    },
    "lineHeight": "1.25rem",
    ":focus": {
      "outline": "2px solid transparent",
      "outlineOffset": "2px"
    }
  }, _styles.buttonVariantStyle[variant], (_buttonColorVariantSt = _styles.buttonColorVariantStyle[color]) === null || _buttonColorVariantSt === void 0 ? void 0 : _buttonColorVariantSt[variant], _styles.buttonRingStyle[color], _styles.buttonSizeStyle[size], disabled && {
    "opacity": "0.3"
  }, block && {
    "width": "100%"
  }];
}, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbnB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9e2NvbG9yfVxuICAgICAgc2l6ZT17c2l6ZX1cbiAgICAgIGRpc2FibGVkPXtkaXNhYmxlZH1cbiAgICAgIHsuLi4ocHJvcHMgYXMgQnV0dG9uU3BlY2lmaWNQcm9wcyl9XG4gICAgLz5cbiAgKTtcblxuICBzd2l0Y2ggKGFzKSB7XG4gICAgY2FzZSAnYnV0dG9uJzpcbiAgICAgIHJldHVybiBkZWZhdWx0Q29tcG9uZW50O1xuICAgIGNhc2UgJ2EnOlxuICAgICAgcmV0dXJuIChcbiAgICAgICAgPEJ1dHRvbkxpbmtcbiAgICAgICAgICBjb2xvcj17Y29sb3J9XG4gICAgICAgICAgc2l6ZT17c2l6ZX1cbiAgICAgICAgICBkaXNhYmxlZD17ZGlzYWJsZWR9XG4gICAgICAgICAgey4uLihwcm9wcyBhcyBBbmNob3JTcGVjaWZpY1Byb3BzKX1cbiAgICAgICAgLz5cbiAgICAgICk7XG4gICAgZGVmYXVsdDpcbiAgICAgIHJldHVybiBkZWZhdWx0Q29tcG9uZW50O1xuICB9XG59O1xuXG5leHBvcnQgZGVmYXVsdCBCdXR0b247XG4iXX0= */");
var ButtonLink = (0, _base["default"])("a", process.env.NODE_ENV === "production" ? {
  target: "e117fuc80"
} : {
  target: "e117fuc80",
  label: "ButtonLink"
})(function (_ref2) {
  var _ref2$size = _ref2.size,
      size = _ref2$size === void 0 ? 'md' : _ref2$size,
      _ref2$color = _ref2.color,
      color = _ref2$color === void 0 ? 'brand' : _ref2$color,
      disabled = _ref2.disabled;
  return [{
    "fontWeight": "600",
    "textDecoration": "underline",
    "cursor": "pointer"
  }, _styles.buttonLinkSizeStyle[size], _styles.buttonLinkColorStyle[color], disabled && {
    "pointerEvents": "none",
    "--tw-text-opacity": "1",
    "color": "rgba(107, 114, 128, var(--tw-text-opacity))"
  }];
}, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy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cj17Y29sb3J9XG4gICAgICBzaXplPXtzaXplfVxuICAgICAgZGlzYWJsZWQ9e2Rpc2FibGVkfVxuICAgICAgey4uLihwcm9wcyBhcyBCdXR0b25TcGVjaWZpY1Byb3BzKX1cbiAgICAvPlxuICApO1xuXG4gIHN3aXRjaCAoYXMpIHtcbiAgICBjYXNlICdidXR0b24nOlxuICAgICAgcmV0dXJuIGRlZmF1bHRDb21wb25lbnQ7XG4gICAgY2FzZSAnYSc6XG4gICAgICByZXR1cm4gKFxuICAgICAgICA8QnV0dG9uTGlua1xuICAgICAgICAgIGNvbG9yPXtjb2xvcn1cbiAgICAgICAgICBzaXplPXtzaXplfVxuICAgICAgICAgIGRpc2FibGVkPXtkaXNhYmxlZH1cbiAgICAgICAgICB7Li4uKHByb3BzIGFzIEFuY2hvclNwZWNpZmljUHJvcHMpfVxuICAgICAgICAvPlxuICAgICAgKTtcbiAgICBkZWZhdWx0OlxuICAgICAgcmV0dXJuIGRlZmF1bHRDb21wb25lbnQ7XG4gIH1cbn07XG5cbmV4cG9ydCBkZWZhdWx0IEJ1dHRvbjtcbiJdfQ== */");

var ButtonComponent = function ButtonComponent(_ref3) {
  var _ref3$as = _ref3.as,
      as = _ref3$as === void 0 ? 'button' : _ref3$as,
      _ref3$variant = _ref3.variant,
      variant = _ref3$variant === void 0 ? 'secondary' : _ref3$variant,
      _ref3$color = _ref3.color,
      color = _ref3$color === void 0 ? 'brand' : _ref3$color,
      _ref3$size = _ref3.size,
      size = _ref3$size === void 0 ? 'md' : _ref3$size,
      disabled = _ref3.disabled,
      props = _objectWithoutProperties(_ref3, _excluded);

  var defaultComponent = (0, _jsxRuntime.jsx)(Button, _objectSpread({
    variant: variant,
    color: color,
    size: size,
    disabled: disabled
  }, props));

  switch (as) {
    case 'button':
      return defaultComponent;

    case 'a':
      return (0, _jsxRuntime.jsx)(ButtonLink, _objectSpread({
        color: color,
        size: size,
        disabled: disabled
      }, props));

    default:
      return defaultComponent;
  }
};

var _default = Button;
exports["default"] = _default;