import { h, Host } from "@stencil/core";
import { validateProp } from "../../helpers/Validate/props";
import { AccordionClass, AccordionItemClass, AccordionSizes } from "./constants";
import { govHost } from "../../helpers/Dom/template";
export class GovAccordion {
    constructor() {
        this.hydrated = false;
        /**
         * Accordion’s size.
         */
        this.size = 'm';
        /**
         * Accordion item underline
         */
        this.noBorder = false;
        this.h = govHost(this.host);
    }
    validateSize(newValue) {
        validateProp(AccordionSizes, newValue, AccordionClass.root);
    }
    componentWillLoad() {
        this.validateSize(this.size);
    }
    componentDidLoad() {
        this.host.querySelectorAll(AccordionItemClass.root).forEach((child) => {
            child.addEventListener('gov-change', (e) => {
                e.stopPropagation();
                this.govChange.emit({
                    component: AccordionClass.root,
                    open: e.detail.open,
                    ref: e.detail.ref
                });
            });
        });
    }
    connectedCallback() {
        this.hydrated = true;
    }
    render() {
        return (h(Host, { key: '62ad311346ed2f7caa86f8085b4ee9a7a81c5f92', hydrated: this.hydrated, class: this.h.classes(AccordionClass.root), size: this.size, role: 'list' }, h("slot", { key: 'c4fade9da340c36695c6781e411abac9202ffdf8' })));
    }
    static get is() { return "gov-accordion"; }
    static get properties() {
        return {
            "size": {
                "type": "string",
                "attribute": "size",
                "mutable": false,
                "complexType": {
                    "original": "AccordionSizeType",
                    "resolved": "\"l\" | \"m\" | \"s\" | \"xl\" | \"xs\"",
                    "references": {
                        "AccordionSizeType": {
                            "location": "import",
                            "path": "./constants",
                            "id": "../../../packages/core/src/components/gov-accordion/constants.ts::AccordionSizeType"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Accordion\u2019s size."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'m'"
            },
            "noBorder": {
                "type": "boolean",
                "attribute": "no-border",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Accordion item underline"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get events() {
        return [{
                "method": "govChange",
                "name": "gov-change",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Called when the accordion state changes"
                },
                "complexType": {
                    "original": "AccordionEvent",
                    "resolved": "AccordionEvent",
                    "references": {
                        "AccordionEvent": {
                            "location": "import",
                            "path": "./gov-accordion.types",
                            "id": "../../../packages/core/src/components/gov-accordion/gov-accordion.types.ts::AccordionEvent"
                        }
                    }
                }
            }];
    }
    static get elementRef() { return "host"; }
    static get watchers() {
        return [{
                "propName": "size",
                "methodName": "validateSize"
            }];
    }
}
//# sourceMappingURL=gov-accordion.js.map
