import { h } from "@stencil/core";
/**
 * FloatButton 悬浮按钮组件
 * 固定在视口边缘的圆形/方形操作按钮，常用于返回顶部、新建等快捷操作
 */
export class FloatButton {
    /** 按钮类型 */
    type = 'default';
    /** 按钮形状 */
    shape = 'circle';
    /** 图标（文本/字符图标） */
    icon = '';
    /** 描述文字（与图标二选一或共存） */
    description = '';
    /** 距离右侧偏移（px） */
    right = 40;
    /** 距离底部偏移（px） */
    bottom = 40;
    /** 角标（数字或文字） */
    badge;
    /** 点击事件 */
    hbClick;
    handleClick = (e) => {
        this.hbClick.emit({ source: 'float-button', originalEvent: e });
    };
    renderBadge() {
        if (this.badge === undefined || this.badge === null || this.badge === '') {
            return null;
        }
        const text = typeof this.badge === 'number' && this.badge > 99 ? '99+' : String(this.badge);
        return h("span", { class: "hb-float-button__badge" }, text);
    }
    render() {
        const style = {
            right: `${this.right}px`,
            bottom: `${this.bottom}px`,
        };
        return (h("button", { key: '6457ed8d2174a9ad9e23be02a95d4cbb3952e4e0', type: "button", class: {
                'hb-float-button': true,
                [`hb-float-button--${this.type}`]: true,
                [`hb-float-button--${this.shape}`]: true,
            }, style: style, onClick: this.handleClick }, this.icon && h("span", { key: '21d687c58c84fdcdb74a4130cce591de92489ffc', class: "hb-float-button__icon" }, this.icon), this.description && h("span", { key: 'f8580e6a836a0004244c2d158917420a0c2e1a55', class: "hb-float-button__description" }, this.description), this.renderBadge()));
    }
    static get is() { return "hb-float-button"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["float-button.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["float-button.css"]
        };
    }
    static get properties() {
        return {
            "type": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'default' | 'primary'",
                    "resolved": "\"default\" | \"primary\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u6309\u94AE\u7C7B\u578B"
                },
                "getter": false,
                "setter": false,
                "attribute": "type",
                "reflect": false,
                "defaultValue": "'default'"
            },
            "shape": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'circle' | 'square'",
                    "resolved": "\"circle\" | \"square\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u6309\u94AE\u5F62\u72B6"
                },
                "getter": false,
                "setter": false,
                "attribute": "shape",
                "reflect": false,
                "defaultValue": "'circle'"
            },
            "icon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u56FE\u6807\uFF08\u6587\u672C/\u5B57\u7B26\u56FE\u6807\uFF09"
                },
                "getter": false,
                "setter": false,
                "attribute": "icon",
                "reflect": false,
                "defaultValue": "''"
            },
            "description": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u63CF\u8FF0\u6587\u5B57\uFF08\u4E0E\u56FE\u6807\u4E8C\u9009\u4E00\u6216\u5171\u5B58\uFF09"
                },
                "getter": false,
                "setter": false,
                "attribute": "description",
                "reflect": false,
                "defaultValue": "''"
            },
            "right": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u8DDD\u79BB\u53F3\u4FA7\u504F\u79FB\uFF08px\uFF09"
                },
                "getter": false,
                "setter": false,
                "attribute": "right",
                "reflect": false,
                "defaultValue": "40"
            },
            "bottom": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u8DDD\u79BB\u5E95\u90E8\u504F\u79FB\uFF08px\uFF09"
                },
                "getter": false,
                "setter": false,
                "attribute": "bottom",
                "reflect": false,
                "defaultValue": "40"
            },
            "badge": {
                "type": "any",
                "mutable": false,
                "complexType": {
                    "original": "number | string | undefined",
                    "resolved": "number | string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u89D2\u6807\uFF08\u6570\u5B57\u6216\u6587\u5B57\uFF09"
                },
                "getter": false,
                "setter": false,
                "attribute": "badge",
                "reflect": false
            }
        };
    }
    static get events() {
        return [{
                "method": "hbClick",
                "name": "hbClick",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "\u70B9\u51FB\u4E8B\u4EF6"
                },
                "complexType": {
                    "original": "{ source: 'float-button'; originalEvent: MouseEvent }",
                    "resolved": "{ source: \"float-button\"; originalEvent: MouseEvent; }",
                    "references": {
                        "MouseEvent": {
                            "location": "global",
                            "id": "global::MouseEvent"
                        }
                    }
                }
            }];
    }
}
//# sourceMappingURL=FloatButton.js.map
