'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-5aa5c817.js');

const ICON_MAP = {
    success: '✓',
    warning: '⚠',
    info: 'ℹ',
    error: '✕',
    loading: '⏳',
};
const Message = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
    }
    get el() { return index.getElement(this); }
    /** 消息文字 */
    message = '';
    /** 消息类型 */
    type = 'info';
    /** 是否显示关闭按钮 */
    closable = false;
    /** 显示时间（毫秒），0 为不自动关闭 */
    duration = 3000;
    visible = true;
    componentDidLoad() {
        if (this.duration > 0) {
            setTimeout(() => this.close(), this.duration);
        }
    }
    close = () => {
        this.visible = false;
        setTimeout(() => this.el.remove(), 300);
    };
    render() {
        return (index.h("div", { key: '51069b8f2a5079fcfd64bb24168907bbcfbfd869', class: {
                'hb-message': true,
                [`hb-message--${this.type}`]: true,
                'hb-message--visible': this.visible,
            }, role: "alert" }, index.h("span", { key: 'ad3123ae0c4eb9b8010c446bf0016d54af7b8a3a', class: "hb-message__icon" }, ICON_MAP[this.type]), index.h("span", { key: '557ea0f92544ab58079a498b8f90dc774746c0a2', class: "hb-message__text" }, this.message), this.closable && (index.h("span", { key: 'e90e3380ba2b9a473d5f839983b959584948fd2a', class: "hb-message__close", onClick: this.close }, "\u00D7"))));
    }
};

exports.hb_message = Message;

//# sourceMappingURL=hb-message.cjs.entry.js.map