import { h } from "@stencil/core";
export class DgaNavHeaderSubMenu {
    constructor() {
        this.active = false;
        this.subMenuFullWidth = false;
    }
    onActiveChange() {
        if (this.active && this.submenu) {
            this.submenu.style.display = 'block';
            this.submenu.style.maxHeight = `${this.submenu.scrollHeight}px`;
        }
        else if (this.submenu) {
            this.submenu.style.maxHeight = '';
        }
    }
    componentDidLoad() {
        this.submenu = this.el.shadowRoot.querySelector('.header__sub-menu');
        this.onActiveChange(); // Ensure styles are set on initial load
    }
    render() {
        const backgroundClass = this.background === 'Brand' ? 'header__sub-menu--bg-brand' : '';
        const fullWidthClass = this.subMenuFullWidth ? 'header__sub-menu--full' : '';
        return (h("div", { key: '60795e354d8aca73dbadda2e1abb81731662d046', class: `header__sub-menu ${backgroundClass} ${fullWidthClass}`, ref: el => (this.submenu = el) }, h("div", { key: 'e26408241071d544add36fb1769893e9964ebbd5', class: "sub-menu__container" }, h("slot", { key: '59998beb0e160440d9c7c788b826dba6ee98712b' }))));
    }
    static get is() { return "dga-nav-header-sub-menu"; }
    static get properties() {
        return {
            "active": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "active",
                "reflect": false,
                "defaultValue": "false"
            },
            "subMenuFullWidth": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "sub-menu-full-width",
                "reflect": false,
                "defaultValue": "false"
            },
            "background": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "background",
                "reflect": false
            }
        };
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "active",
                "methodName": "onActiveChange"
            }];
    }
}
//# sourceMappingURL=dga-nav-header-sub-menu.js.map
