"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 };
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const classnames_1 = __importDefault(require("classnames"));
const React = __importStar(require("react"));
const react_jss_1 = __importDefault(require("react-jss"));
const __1 = require("../..");
const styles = {
    button: {
        paddingLeft: 0,
        paddingRight: ({ text }) => text ? '10px' : '0px',
    },
    buttonText: {
        verticalAlign: 'top',
    },
};
class ButtonIconImp extends React.Component {
    constructor() {
        super(...arguments);
        this.getIconSize = () => {
            switch (this.props.btnSize) {
                case __1.Size.XXXSMALL:
                    return 16;
                case __1.Size.XXSMALL:
                    return 20;
                case __1.Size.XSMALL:
                    return 25;
                case __1.Size.SMALL:
                    return 30;
                case __1.Size.BIG:
                    return 42;
                default:
                    return 34;
            }
        };
    }
    renderIcon() {
        const { classes, iconClassName, symbolId, text, iconColor } = this.props;
        const size = this.getIconSize();
        const icon = (React.createElement(__1.Icon, { key: "icon", className: iconClassName, symbolId: symbolId, color: iconColor, size: size }));
        if (!text)
            return icon;
        const textSpan = (React.createElement("span", { key: "text", className: classes.buttonText }, text));
        return [
            icon,
            textSpan,
        ];
    }
    render() {
        const _a = this.props, { className: upperClassName, classes, sheet, iconColor, symbolId, text, iconClassName } = _a, buttonProps = __rest(_a, ["className", "classes", "sheet", "iconColor", "symbolId", "text", "iconClassName"]);
        return (React.createElement(__1.Button, Object.assign({ className: classnames_1.default(classes.button, upperClassName) }, buttonProps), this.renderIcon()));
    }
}
ButtonIconImp.defaultProps = {
    iconColor: 'rgba(255, 255, 255, 0.6)',
};
exports.ButtonIcon = react_jss_1.default(styles)(ButtonIconImp);
//# sourceMappingURL=index.js.map