import { h, Host } from "@stencil/core";
export class PnChoiceButton {
    constructor() {
        this.value = undefined;
        this.name = undefined;
        this.choiceid = undefined;
        this.type = 'checkbox';
        this.disabled = false;
        this.checked = false;
        this.indeterminate = false;
    }
    hostElement;
    handlechange() {
        this.indeterminate = false;
    }
    componentDidLoad() {
        this.checkAndSetIndeterminateState();
    }
    componentDidUpdate() {
        this.checkAndSetIndeterminateState();
    }
    checkAndSetIndeterminateState() {
        let checkbox = this.hostElement.querySelector(`#${this.choiceid}`);
        if (checkbox) {
            checkbox.indeterminate = this.indeterminate;
        }
    }
    render() {
        return (h(Host, { key: 'a1a97f024a1817a0833541650309056b8d4765ea' }, h("input", { key: '028965fc99719face3b99d28e64915a089f5f6f9', type: this.type, id: this.choiceid, value: this.value, name: this.name || this.choiceid, disabled: this.disabled, checked: this.checked }), h("label", { key: '372c83ee394b81b038300bdc19f8cccd15f14e48', htmlFor: this.choiceid, class: "pn-choice-button" }, h("slot", { key: '92fd81e2908be7d4eebc81c5c3676340bb596cee' }))));
    }
    static get is() { return "pn-choice-button"; }
    static get originalStyleUrls() {
        return {
            "$": ["pn-choice-button.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["pn-choice-button.css"]
        };
    }
    static get properties() {
        return {
            "value": {
                "type": "any",
                "mutable": false,
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "This will be emitted on change and input"
                },
                "attribute": "value",
                "reflect": true
            },
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The name of the checkbox group"
                },
                "attribute": "name",
                "reflect": false
            },
            "choiceid": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The string you put here will be what you'd make the ID of a native checkbox, you can't name props \"id\" because it's reserved\nso we went with the more descriptive name \"choice\", if you want to create labels for your checkbox, you will bind it to this ID"
                },
                "attribute": "choiceid",
                "reflect": false
            },
            "type": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "type",
                "reflect": false,
                "defaultValue": "'checkbox'"
            },
            "disabled": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "disabled",
                "reflect": false,
                "defaultValue": "false"
            },
            "checked": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "checked",
                "reflect": false,
                "defaultValue": "false"
            },
            "indeterminate": {
                "type": "boolean",
                "mutable": true,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "indeterminate",
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get elementRef() { return "hostElement"; }
    static get listeners() {
        return [{
                "name": "change",
                "method": "handlechange",
                "target": undefined,
                "capture": false,
                "passive": false
            }];
    }
}
//# sourceMappingURL=pn-choice-button.js.map
