"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = exports.StyledLink = exports.StyledButton = void 0;
const react_1 = __importDefault(require("react"));
// eslint-disable-next-line import/named
const styled_components_1 = __importStar(require("styled-components"));
const Icon_1 = require("../Icon");
const cssStyle = ({ light }) => styled_components_1.css `
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 0.7em 1em;
  outline: none;
  border: none;
  border-radius: 3px;
  background: ${light ? 'transparent' : 'var(--primary-color)'};
  color: ${light ? 'var(--accent-color)' : '#fff'};
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8em;
  line-height: 1;
  transition: all 0.3s cubic - bezier(0.55, 0, 0.1, 1);
  min-height: var(--input-min-height);
  :hover {
    background-color: ${light ? 'rgba(0, 0, 0, 0.05)' : 'var(--accent-color)'};
  }
  & > span:not(:empty) {
    margin-left: 0.4em;
  }
`;
exports.StyledButton = styled_components_1.default.button `
  ${(p) => cssStyle(p)}
`;
exports.StyledLink = styled_components_1.default.a `
  ${(p) => cssStyle(p)}
  padding-top: 0;
  padding-bottom: 0;
`;
const Button = (_a) => {
    var { icon, children, css: style } = _a, props = __rest(_a, ["icon", "children", "css"]);
    const renderMutualContent = (react_1.default.createElement(react_1.default.Fragment, null,
        icon && react_1.default.createElement(Icon_1.Icon, { path: icon }),
        children && react_1.default.createElement("span", null, children)));
    return 'asLink' in props && props.asLink === true ? (react_1.default.createElement(exports.StyledLink, Object.assign({ css: style }, props), renderMutualContent)) : (react_1.default.createElement(exports.StyledButton, Object.assign({ type: "button", css: style }, props), renderMutualContent));
};
exports.Button = Button;
//# sourceMappingURL=index.js.map