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 properties() { return {
        "collapsed": {
            "type": Boolean,
            "attr": "collapsed",
            "watchCallbacks": ["collapsedChanged"]
        },
        "label": {
            "type": String,
            "attr": "label"
        },
        "toggle": {
            "state": true
        }
    }; }
    static get events() { return [{
            "name": "onToggle",
            "method": "onToggle",
            "bubbles": true,
            "cancelable": true,
            "composed": true
        }]; }
    static get style() { return "/**style-placeholder:ema-collapsible:**/"; }
}
