import { h, Host } from "@stencil/core";
import { validateProp } from "../../../helpers/Validate/props";
import { StepperClass, StepperItemClass, StepperSizes } from "./constants";
import { govHost } from "../../../helpers/Dom/template";
export class GovStepper {
    constructor() {
        this.hydrated = false;
        /**
         * Size of stepper
         */
        this.size = 'm';
        this.h = govHost(this.host);
    }
    validateSize(newValue) {
        validateProp(StepperSizes, newValue, StepperClass.root);
    }
    componentWillLoad() {
        this.validateSize(this.size);
    }
    componentDidLoad() {
        this.host.querySelectorAll(StepperItemClass.root).forEach((child) => {
            child.setAttribute('size', this.size);
            child.addEventListener('gov-change', (e) => {
                e.stopPropagation();
                this.govChange.emit(e.detail);
            });
        });
    }
    connectedCallback() {
        this.hydrated = true;
    }
    render() {
        return (h(Host, { key: '92d3349a28b4330a3bea5293853612d0a0b96069', class: this.h.classes(StepperClass.root), role: "list", size: this.size, hydrated: this.hydrated }, h("slot", { key: 'a5b65c3a06c63f826d6c968c69f1452abe0408af' })));
    }
    static get is() { return "gov-stepper"; }
    static get properties() {
        return {
            "size": {
                "type": "string",
                "attribute": "size",
                "mutable": false,
                "complexType": {
                    "original": "StepperSizesType",
                    "resolved": "\"l\" | \"m\" | \"s\"",
                    "references": {
                        "StepperSizesType": {
                            "location": "import",
                            "path": "./constants",
                            "id": "../../../packages/core/src/components/gov-stepper/stepper/constants.ts::StepperSizesType"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Size of stepper"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'m'"
            }
        };
    }
    static get events() {
        return [{
                "method": "govChange",
                "name": "gov-change",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Called when the Stepper state changes"
                },
                "complexType": {
                    "original": "GovStepperItemChangeEvent",
                    "resolved": "GovStepperItemChangeEvent",
                    "references": {
                        "GovStepperItemChangeEvent": {
                            "location": "import",
                            "path": "./gov-stepper-item.d",
                            "id": "../../../packages/core/src/components/gov-stepper/stepper/gov-stepper-item.d.tsx::GovStepperItemChangeEvent"
                        }
                    }
                }
            }];
    }
    static get elementRef() { return "host"; }
    static get watchers() {
        return [{
                "propName": "size",
                "methodName": "validateSize"
            }];
    }
}
//# sourceMappingURL=gov-stepper.js.map
