import { h } from "@stencil/core";
export class Collapse {
    el;
    /** 是否开启手风琴模式（同时仅展开一项） */
    accordion = false;
    componentDidLoad() {
        this.el.addEventListener('hbCollapseItemToggle', ((e) => {
            if (!this.accordion)
                return;
            const { active } = e.detail;
            // 手风琴模式：某项展开时，关闭其余项
            if (!active)
                return;
            const current = e.target;
            this.el.querySelectorAll('hb-collapse-item').forEach((item) => {
                if (item !== current) {
                    item.active = false;
                }
            });
        }));
    }
    render() {
        return (h("div", { key: '24dd4feed226f43872d718544b72ca82415645fa', class: { 'hb-collapse': true, 'hb-collapse--accordion': this.accordion } }, h("slot", { key: 'f0f66d8ffb59b9bdebe72a093eea33551a1cd5c9' })));
    }
    static get is() { return "hb-collapse"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["collapse.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["collapse.css"]
        };
    }
    static get properties() {
        return {
            "accordion": {
                "type": "boolean",
                "mutable": true,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "\u662F\u5426\u5F00\u542F\u624B\u98CE\u7434\u6A21\u5F0F\uFF08\u540C\u65F6\u4EC5\u5C55\u5F00\u4E00\u9879\uFF09"
                },
                "getter": false,
                "setter": false,
                "attribute": "accordion",
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get elementRef() { return "el"; }
}
//# sourceMappingURL=Collapse.js.map
