import { h, Host } from "@stencil/core";
import { createID } from "../../utils/string.utils";
import { govHost, toBoolAttrIfDefined } from "../../helpers/Dom/template";
import { TabsClass, TabsItemClass } from "./constants";
export class GovTabsItem {
    constructor() {
        /**
         * Item disable state
         */
        this.disabled = false;
        /**
         * Default selected tab
         */
        this.default = false;
        this.isActive = false;
        this.h = govHost(this.host);
        this.contentId = createID('GovTabContent');
        this.triggerId = createID('GovTabTrigger');
    }
    rerenderParent() {
        const element = this.h.getParent(TabsClass.root);
        if (element) {
            element.rerender().catch();
        }
    }
    render() {
        return (h(Host, { key: '7de42fde0ca4e787967c76a14aa2498367f66a1c', class: this.h.classes(TabsItemClass.root), default: this.default }, h("div", { key: '89f6bf8f5505ed17e5a9c46f60dfbf34353a75e6', class: TabsItemClass.inner, role: "tabpanel", id: this.identifier || this.contentId, hidden: !this.isActive, "aria-labelledby": this.triggerIdentifier || this.triggerId, "aria-hidden": toBoolAttrIfDefined(!this.isActive) }, h("slot", { key: '690b06566e645ce22ec34c47c56852a75ac1069b' }))));
    }
    /**
     * Returns a unique tab content identifier
     */
    async getIdentifier() {
        return this.identifier || this.contentId;
    }
    /**
     * Returns a unique tab trigger identifier
     */
    async getTriggerIdentifier() {
        return this.triggerIdentifier || this.triggerId;
    }
    /**
     * Returns a unique tab trigger identifier
     */
    async getDisableState() {
        return this.disabled;
    }
    /**
     * Set status of tab-item
     */
    async setActiveStatus(status) {
        this.isActive = status;
    }
    static get is() { return "gov-tabs-item"; }
    static get properties() {
        return {
            "identifier": {
                "type": "string",
                "attribute": "identifier",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Custom tab item identifier. Otherwise, it will be generated"
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "triggerIdentifier": {
                "type": "string",
                "attribute": "trigger-identifier",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Custom tab trigger item identifier. Otherwise, it will be generated"
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "label": {
                "type": "string",
                "attribute": "label",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Item name of the tab"
                },
                "getter": false,
                "setter": false,
                "reflect": true
            },
            "disabled": {
                "type": "boolean",
                "attribute": "disabled",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Item disable state"
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "defaultValue": "false"
            },
            "iconStart": {
                "type": "string",
                "attribute": "icon-start",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon definition at the stat. Use the type/name notation"
                },
                "getter": false,
                "setter": false,
                "reflect": true
            },
            "iconEnd": {
                "type": "string",
                "attribute": "icon-end",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon definition at the end. Use the type/name notation"
                },
                "getter": false,
                "setter": false,
                "reflect": true
            },
            "default": {
                "type": "boolean",
                "attribute": "default",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Default selected tab"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get states() {
        return {
            "isActive": {}
        };
    }
    static get methods() {
        return {
            "getIdentifier": {
                "complexType": {
                    "signature": "() => Promise<string>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<string>"
                },
                "docs": {
                    "text": "Returns a unique tab content identifier",
                    "tags": []
                }
            },
            "getTriggerIdentifier": {
                "complexType": {
                    "signature": "() => Promise<string>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<string>"
                },
                "docs": {
                    "text": "Returns a unique tab trigger identifier",
                    "tags": []
                }
            },
            "getDisableState": {
                "complexType": {
                    "signature": "() => Promise<boolean>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<boolean>"
                },
                "docs": {
                    "text": "Returns a unique tab trigger identifier",
                    "tags": []
                }
            },
            "setActiveStatus": {
                "complexType": {
                    "signature": "(status: boolean) => Promise<void>",
                    "parameters": [{
                            "name": "status",
                            "type": "boolean",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Set status of tab-item",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "host"; }
    static get watchers() {
        return [{
                "propName": "label",
                "methodName": "rerenderParent"
            }, {
                "propName": "disabled",
                "methodName": "rerenderParent"
            }];
    }
}
//# sourceMappingURL=gov-tabs-item.js.map
