import { h } from '@stencil/core';
import { Util } from '@ema/core';
export class TabHeader {
    constructor() {
        this.id = Util.getUUID();
        this.isSelected = false;
    }
    async getChild() {
        return {
            select: this.select.bind(this),
            unselect: this.unselect.bind(this),
            name: this.name,
            id: this.id
        };
    }
    unselect() {
        this.isSelected = false;
    }
    select() {
        this.isSelected = true;
    }
    async onClick() {
        this.onSelect.emit(await this.getChild());
    }
    render() {
        const classes = {
            'ema-tab-header': true,
            'ema-tab-header-selected': this.isSelected
        };
        return [
            h("div", { class: classes, onClick: this.onClick.bind(this) },
                h("slot", null)),
        ];
    }
    static get is() { return "ema-tab-header"; }
    static get originalStyleUrls() { return {
        "$": ["tab-header.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["tab-header.css"]
    }; }
    static get properties() { return {
        "name": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "name",
            "reflect": false
        }
    }; }
    static get states() { return {
        "isSelected": {}
    }; }
    static get events() { return [{
            "method": "onSelect",
            "name": "onSelect",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }]; }
    static get methods() { return {
        "getChild": {
            "complexType": {
                "signature": "() => Promise<{ select: any; unselect: any; name: string; id: string; }>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<{ select: any; unselect: any; name: string; id: string; }>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        }
    }; }
}
