import * as tslib_1 from "tslib";
import React from 'react';
import classNames from 'classnames';
import warning from '../_utils/warning';
var defaultProps = {
    count: 0,
    prefixCls: 'ty-badge',
    color: '#f2453d',
    max: 99,
    dot: false,
    processing: false,
    showZero: false,
    text: undefined,
};
var Badge = function (props) {
    var _a, _b;
    var count = props.count, color = props.color, max = props.max, dot = props.dot, processing = props.processing, showZero = props.showZero, text = props.text, title = props.title, className = props.className, prefixCls = props.prefixCls, style = props.style, badgeStyle = props.badgeStyle, children = props.children;
    var cls = classNames(prefixCls, className, (_a = {}, _a[prefixCls + "_no-wrap"] = !children, _a));
    var dotCls = classNames(prefixCls + "__dot", (_b = {}, _b[prefixCls + "__dot_wave"] = processing, _b));
    warning(!dot && processing, 'only dot badge has the processing effect');
    var _renderCount = function () {
        var isZero = (typeof count === 'number') && count === 0;
        if (isZero && !showZero) {
            return null;
        }
        if (typeof count === 'number') {
            return (React.createElement("sup", { title: title, className: prefixCls + "__count", style: tslib_1.__assign({ backgroundColor: color }, badgeStyle) }, text || (count > max ? max + "+" : count)));
        }
        else {
            return React.createElement("span", { className: prefixCls + "__custom" }, count);
        }
    };
    return (React.createElement("span", { className: cls, style: style },
        children,
        dot ?
            (React.createElement("sup", { title: title, className: dotCls, style: tslib_1.__assign({ backgroundColor: color }, badgeStyle) })) :
            _renderCount()));
};
Badge.defaultProps = defaultProps;
export default Badge;
//# sourceMappingURL=index.js.map