import { h } from "@stencil/core";
export class Collapsible {
    constructor() {
        this.toggle = false;
        this.collapsed = false;
    }
    collapsedChanged() {
        if (this.collapsed == true) {
            this.toggle = false;
        }
        if (this.collapsed == false) {
            this.toggle = true;
        }
    }
    componentDidLoad() {
        if (this.collapsed == false) {
            this.toggleComponent();
        }
    }
    toggleComponent() {
        this.toggle = !this.toggle;
        this.onToggle.emit({ visible: this.toggle });
    }
    render() {
        return (h("div", null,
            h("ema-card", null,
                h("ema-card-header", null,
                    h("span", { class: "ema-card-header-title", onClick: () => this.toggleComponent() },
                        h("div", null,
                            this.label,
                            " ",
                            this.toggle ? h("span", null, "\u25B2") : h("span", null, "\u25BC")))),
                h("ema-card-content", { class: this.toggle ? 'active' : 'inactive' },
                    h("slot", null)))));
    }
    static get is() { return "ema-collapsible"; }
    static get originalStyleUrls() { return {
        "$": ["collapsible.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["collapsible.css"]
    }; }
    static get properties() { return {
        "collapsed": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "collapsed",
            "reflect": false,
            "defaultValue": "false"
        },
        "label": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "label",
            "reflect": false
        }
    }; }
    static get states() { return {
        "toggle": {}
    }; }
    static get events() { return [{
            "method": "onToggle",
            "name": "onToggle",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }]; }
    static get watchers() { return [{
            "propName": "collapsed",
            "methodName": "collapsedChanged"
        }]; }
}
