"use strict";
/**
 * @file Button
 * @author fex
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var TooltipWrapper_1 = require("./TooltipWrapper");
var helper_1 = require("../utils/helper");
var theme_1 = require("../theme");
var Button = /** @class */ (function (_super) {
    tslib_1.__extends(Button, _super);
    function Button() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Button.prototype.renderButton = function () {
        var _a = this.props, level = _a.level, size = _a.size, disabled = _a.disabled, className = _a.className, Comp = _a.componentClass, cx = _a.classnames, children = _a.children, disabledTip = _a.disabledTip, block = _a.block, type = _a.type, active = _a.active, iconOnly = _a.iconOnly, href = _a.href, rest = tslib_1.__rest(_a, ["level", "size", "disabled", "className", "componentClass", "classnames", "children", "disabledTip", "block", "type", "active", "iconOnly", "href"]);
        if (href) {
            Comp = 'a';
        }
        return (React.createElement(Comp, tslib_1.__assign({ type: Comp === 'a' ? undefined : type }, helper_1.pickEventsProps(rest), { href: href, className: cx("Button", (_b = {},
                _b["Button--" + level] = level,
                _b["Button--" + size] = size,
                _b["Button--block"] = block,
                _b["Button--iconOnly"] = iconOnly,
                _b['is-disabled'] = disabled,
                _b['is-active'] = active,
                _b), className), disabled: disabled }), children));
        var _b;
    };
    Button.prototype.render = function () {
        var _a = this.props, tooltip = _a.tooltip, placement = _a.placement, tooltipContainer = _a.tooltipContainer, tooltipTrigger = _a.tooltipTrigger, tooltipRootClose = _a.tooltipRootClose, disabled = _a.disabled, disabledTip = _a.disabledTip, classPrefix = _a.classPrefix, cx = _a.classnames;
        return (React.createElement(TooltipWrapper_1.default, { placement: placement, tooltip: disabled ? disabledTip : tooltip, container: tooltipContainer, trigger: tooltipTrigger, rootClose: tooltipRootClose }, disabled && disabledTip ? (React.createElement("div", { className: cx('Button--disabled-wrap') }, this.renderButton())) : (this.renderButton())));
    };
    Button.defaultProps = {
        componentClass: 'button',
        level: 'default',
        type: 'button',
        placement: 'top',
        tooltipTrigger: ['hover', 'focus'],
        tooltipRootClose: false,
    };
    return Button;
}(React.Component));
exports.Button = Button;
exports.default = theme_1.themeable(Button);
//# sourceMappingURL=./components/Button.js.map
