import * as tslib_1 from "tslib";
import * as React from 'react';
import classnames from 'classnames';
import Group from './button-group';
var defaultProps = {
    prefixCls: 'ty-btn',
    size: 'md',
    color: 'default',
    onClick: function () {
    },
};
var renderIcon = function (icon, loading) {
    if (loading === void 0) { loading = false; }
    if (loading) {
        return React.createElement("span", { className: "ty-btn__loader" });
    }
    else {
        return icon;
    }
};
var Button = function (props) {
    var _a;
    var color = props.color, size = props.size, block = props.block, icon = props.icon, link = props.link, loading = props.loading, dash = props.dash, disabled = props.disabled, outline = props.outline, round = props.round, ripple = props.ripple, children = props.children, className = props.className, prefixCls = props.prefixCls, style = props.style, restProps = tslib_1.__rest(props, ["color", "size", "block", "icon", "link", "loading", "dash", "disabled", "outline", "round", "ripple", "children", "className", "prefixCls", "style"]);
    var cls = classnames(prefixCls, className, link ? [prefixCls + "_" + color + "_link"] :
        (outline ? [prefixCls + "_" + color + "_outline"] : [prefixCls + "_" + color]), size && prefixCls + "_" + size, (_a = {},
        _a[prefixCls + "_block"] = block,
        _a[prefixCls + "_round"] = round,
        _a[prefixCls + "_ripple"] = ripple,
        _a[prefixCls + "_dash"] = outline && dash,
        _a["ty-btn_" + color + "_disabled"] = disabled || loading,
        _a));
    return (React.createElement("button", tslib_1.__assign({ className: cls, disabled: disabled || loading, style: style }, restProps),
        renderIcon(icon, loading),
        children));
};
Button.defaultProps = defaultProps;
Button.Group = Group;
export default Button;
//# sourceMappingURL=index.js.map