/*!
 * Built with Stencil
 * By PostNord.
 */
import { h, Host } from "@stencil/core";
import { white } from "pn-design-assets/pn-assets/colors.js";
/**
 * @deprecated This component will be removed in v8. Please use the `pn-progress-stepper` instead.
 * @see {@link https://portal.postnord.com/web-components/?path=/docs/components-feedback-progress-stepper--docs Use `pn-progress-stepper` instead.}
 */
export class PnProgressIndicatorStep {
    activated;
    done;
    /** Set by the parent component. Do not use manually. @hide true */
    activeStep;
    /** Set by the parent component. Do not use manually. @hide true */
    index;
    /** The step name. */
    name;
    /** Set the step as checked, meaning a white check mark will appear. */
    checked = false;
    /** Set by the parent component. Do not use manually. @hide true */
    active;
    setactivestep;
    setActiveStepHandler() {
        if (this.done || this.activated) {
            this.setactivestep.emit(this.index);
        }
    }
    componentWillLoad() {
        this.checkStatus();
    }
    componentDidUpdate() {
        this.checkStatus();
    }
    checkStatus() {
        if (!this.done) {
            this.done = this.checked || this.activeStep > this.index;
        }
        if (this.active === 'yes') {
            this.activated = true;
        }
        else if (this.active === 'no') {
            this.activated = false;
            this.done = false;
        }
        else if (!this.activated) {
            this.activated = this.activeStep >= this.index;
        }
    }
    getClassNames() {
        let className = 'pn-progress-indicator-step';
        if (this.done || this.checked)
            className += ' done';
        if (this.activated)
            className += ' activated';
        if (this.activeStep === this.index)
            className += ' active';
        return className;
    }
    render() {
        return (h(Host, { key: 'e5518f2d8c21c889738beb3a42e6865e7c64ac76', class: this.getClassNames(), onClick: () => this.setActiveStepHandler() }, h("div", { key: 'b0f5f684ca12fda2b22b51945d3b0b41ab490fa3', class: "progress-line" }), h("div", { key: '8d05494d4cc77145e44270666b678cf48eb05a96', class: "info-container" }, h("slot", { key: '864bea1ce3dd348be1abadcc3f8fb3757ac009b9' }), this.name), h("div", { key: '7d8394e5a4919404a137fd30ce125dfda5ed3034', class: "circle" }, this.done || this.checked ? (h("svg", { xmlns: "http://www.w3.org/2000/svg", "enable-background": "new 0 0 24 24", id: "checkmark", version: "1.0", viewBox: "0 0 24 24" }, h("polyline", { class: "checkmark-path", fill: "none", points: "20,6 9,17 4,12", stroke: white, "stroke-miterlimit": "10", "stroke-width": "3" }))) : (''))));
    }
    static get is() { return "pn-progress-indicator-step"; }
    static get originalStyleUrls() {
        return {
            "$": ["pn-progress-indicator-step.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["pn-progress-indicator-step.css"]
        };
    }
    static get properties() {
        return {
            "activeStep": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "hide",
                            "text": "true"
                        }],
                    "text": "Set by the parent component. Do not use manually."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "active-step"
            },
            "index": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "hide",
                            "text": "true"
                        }],
                    "text": "Set by the parent component. Do not use manually."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "index"
            },
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The step name."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "name"
            },
            "checked": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Set the step as checked, meaning a white check mark will appear."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "checked",
                "defaultValue": "false"
            },
            "active": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'yes' | 'no'",
                    "resolved": "\"no\" | \"yes\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [{
                            "name": "hide",
                            "text": "true"
                        }],
                    "text": "Set by the parent component. Do not use manually."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "active"
            }
        };
    }
    static get states() {
        return {
            "activated": {},
            "done": {}
        };
    }
    static get events() {
        return [{
                "method": "setactivestep",
                "name": "setactivestep",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                }
            }];
    }
}
