import { h, Host } from "@stencil/core";
import { CountryCode } from "../../../../utils/country-codes";
import { numberOnlyHandler } from "../../../../ui-components/form/utils";
import { countryLabels, countryOptions } from "../../utils/country-config";
export class FormAddressFields {
    constructor() {
        this.country = CountryCode.USA;
    }
    render() {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
        const labels = countryLabels[this.country];
        const options = countryOptions[this.country];
        return (h(Host, { key: '9b18ac26cce34bd3008146f106a260d9cb99de12' }, h("div", { key: 'c234c03bc4a3dbe74a0946af78aaed5992c3406c', class: "row gy-3" }, h("div", { key: '0ce04acdf48726866bd6beecc25d0008b754984f', class: "col-12" }, h("form-control-text", { key: '4d4b5098ebc39e52d0f17c677c4e92980793f46b', name: "line1", label: "Street Address", inputHandler: this.inputHandler, defaultValue: (_a = this.defaultValues) === null || _a === void 0 ? void 0 : _a.line1, errorText: (_b = this.errors) === null || _b === void 0 ? void 0 : _b.line1, helpText: "No PO Boxes." })), h("div", { key: '4133b38343c52135f2457bd7a9ad91b094422fb5', class: "col-12" }, h("form-control-text", { key: '7e60be69dad198d488030ece4296326bb6368f2c', name: "line2", label: "Address Line 2 (optional)", inputHandler: this.inputHandler, defaultValue: (_c = this.defaultValues) === null || _c === void 0 ? void 0 : _c.line2, errorText: (_d = this.errors) === null || _d === void 0 ? void 0 : _d.line2 })), h("div", { key: 'a34a4e57cbd168bbbe065329bcfb393473b0def1', class: "col-12" }, h("form-control-text", { key: '46e3005ef99ec988726ffcc37ec73756f002880d', name: "city", label: "City", inputHandler: this.inputHandler, defaultValue: (_e = this.defaultValues) === null || _e === void 0 ? void 0 : _e.city, errorText: (_f = this.errors) === null || _f === void 0 ? void 0 : _f.city })), h("div", { key: '2bf3389786351f2338cde13cbf87d28260444174', class: "col-12 col-md-6" }, h("form-control-select", { key: '18a2a403d20af45965877601fa8d44a5aea48894', name: "state", label: labels.stateLabel, options: options.stateOptions, inputHandler: this.inputHandler, defaultValue: (_g = this.defaultValues) === null || _g === void 0 ? void 0 : _g.state, errorText: (_h = this.errors) === null || _h === void 0 ? void 0 : _h.state })), h("div", { key: '1548ad58c0bd3b96067055601a006fc137ca31a3', class: "col-12 col-md-6" }, h("form-control-text", { key: '8e8193efa81f1f5d8c626f76d75d15aba60ac921', name: "postal_code", label: labels.postalLabel, inputHandler: this.inputHandler, defaultValue: (_j = this.defaultValues) === null || _j === void 0 ? void 0 : _j.postal_code, errorText: (_k = this.errors) === null || _k === void 0 ? void 0 : _k.postal_code, maxLength: this.country === CountryCode.USA ? 5 : 7, keyDownHandler: this.country === CountryCode.USA ? numberOnlyHandler : undefined })))));
    }
    static get is() { return "form-address-fields"; }
    static get properties() {
        return {
            "country": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "CountryCode",
                    "resolved": "CountryCode.CAN | CountryCode.USA",
                    "references": {
                        "CountryCode": {
                            "location": "import",
                            "path": "../../../../utils/country-codes",
                            "id": "src/utils/country-codes.ts::CountryCode"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "country",
                "defaultValue": "CountryCode.USA"
            },
            "errors": {
                "type": "any",
                "mutable": false,
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "errors"
            },
            "defaultValues": {
                "type": "any",
                "mutable": false,
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "default-values"
            },
            "inputHandler": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(name: string, value: string) => void",
                    "resolved": "(name: string, value: string) => void",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            }
        };
    }
}
