"use strict";
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)
            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 });
const react_1 = __importDefault(require("react"));
const styles_1 = require("../../styles");
const Icon_1 = require("../../components/Icon");
const utils_1 = require("../../styles/utils");
const styles_2 = require("./styles");
exports.defaultProps = {
    onClick: () => { },
    variant: 'primary',
    fluid: false,
    tabIndex: 0,
    type: 'button'
};
const ButtonComponent = (_a, ref) => {
    var { onClick, variant, fluid, RouterLink, iconPosition, href } = _a, otherProps = __rest(_a, ["onClick", "variant", "fluid", "RouterLink", "iconPosition", "href"]);
    if (RouterLink) {
        return react_1.default.createElement(RouterLink, Object.assign({}, otherProps));
    }
    else {
        return (react_1.default.createElement("button", Object.assign({ ref: ref, onClick: onClick, role: href && 'button' }, (href && { type: undefined }), otherProps)));
    }
};
const ButtonWithRef = react_1.default.forwardRef(ButtonComponent);
exports.Button = styles_1.styled(ButtonWithRef)(utils_1.buttonReset, ({ theme, fluid, iconPosition }) => (Object.assign({ whiteSpace: 'nowrap', position: 'relative', display: 'inline-flex', justifyContent: 'center', alignItems: 'center', flexShrink: 0, textAlign: 'center', textDecoration: 'none', letterSpacing: '1px', border: 'none', padding: '0.75rem 1.75rem', minHeight: '2.5rem', lineHeight: theme.lineHeights.tight, fontFamily: theme.fontFamilies.baseText, fontSize: theme.fontSizes[1], fontWeight: theme.fontWeights.semiBold, borderRadius: '8px' }, (fluid && { width: '100%' }), { '&:disabled, &:disabled:hover': {
        backgroundColor: theme.colors.disabled,
        color: theme.colors.inactive,
        boxShadow: 'none',
        cursor: 'not-allowed'
    }, [Icon_1.Icon]: Object.assign({}, (iconPosition && {
        [`margin${styles_2.getIconStyle(iconPosition)}`]: theme.space.s
    })) })), styles_2.getVariant);
exports.Button.defaultProps = exports.defaultProps;
//# sourceMappingURL=Button.js.map