"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 styled_components_1 = __importDefault(require("styled-components"));
const lodash_1 = require("lodash");
const Box_1 = require("../Box");
const utils_1 = require("../../styles/utils");
const styles_1 = require("./styles");
const Icon_1 = require("../Icon");
exports.defaultProps = {
    variant: 'raw',
};
const Button = styled_components_1.default(Box_1.Box)(utils_1.buttonReset, styles_1.getVariant);
const StyledIcon = styled_components_1.default(Icon_1.Icon)(({ theme, color }) => ({
    cursor: 'pointer',
    '&:hover': {
        color: color && utils_1.getHoverColor(lodash_1.get(theme, `colors.${color}`)),
    },
}));
exports.IconButton = (_a) => {
    var { children, className, style, onClick, buttonProps, IconComponent, variant } = _a, IconProps = __rest(_a, ["children", "className", "style", "onClick", "buttonProps", "IconComponent", "variant"]);
    return (react_1.default.createElement(Button, Object.assign({ as: "button", type: "button", className: className, style: style, onClick: onClick, variant: variant }, buttonProps),
        react_1.default.createElement(StyledIcon, Object.assign({ as: IconComponent }, IconProps)),
        children));
};
exports.IconButton.defaultProps = exports.defaultProps;
//# sourceMappingURL=IconButton.js.map