@verbb/formie-browser 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -22
- package/dist/chunks/address-country-Rx6GQTND.js +68 -0
- package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
- package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
- package/dist/chunks/api-CmwLRq_n.js +780 -0
- package/dist/chunks/api-DMK8NSUI.js +407 -0
- package/dist/chunks/api-sPqGbOww.js +125 -0
- package/dist/chunks/async-nPFRNQ06.js +25 -0
- package/dist/chunks/bpoint-DSjqRv63.js +24 -0
- package/dist/chunks/calculations-CeDgB9jt.js +299 -0
- package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
- package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
- package/dist/chunks/chunk-3b4jIN3o.js +13 -0
- package/dist/chunks/combobox-D-2b42wn.js +1954 -0
- package/dist/chunks/conditions-DjZOtHfS.js +412 -0
- package/dist/chunks/constants-DVcJAvc5.js +38 -0
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
- package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
- package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
- package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
- package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
- package/dist/chunks/debug-BV0DvdHx.js +41 -0
- package/dist/chunks/dist-BQ4a9hmy.js +2659 -0
- package/dist/chunks/event-names-BCI2FLD8.js +51 -0
- package/dist/chunks/eway-D3ctTbEk.js +70 -0
- package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
- package/dist/chunks/file-upload-D49m8-DR.js +287 -0
- package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
- package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
- package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
- package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
- package/dist/chunks/google-address-OhKilPWE.js +161 -0
- package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
- package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
- package/dist/chunks/http-D-JExro7.js +27 -0
- package/dist/chunks/i18n-BY1ds1BL.js +121 -0
- package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
- package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
- package/dist/chunks/mollie-COG-ko2D.js +23 -0
- package/dist/chunks/moneris-CMH8PlRc.js +117 -0
- package/dist/chunks/opayo-D2jsR5vh.js +113 -0
- package/dist/chunks/paddle-DxF88RfC.js +55 -0
- package/dist/chunks/paypal-b5pnwrA2.js +95 -0
- package/dist/chunks/payway-BJYu9DIR.js +55 -0
- package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
- package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
- package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
- package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
- package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
- package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
- package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
- package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
- package/dist/chunks/repeater-B5leVxZU.js +102 -0
- package/dist/chunks/rich-text-D0sb8bmX.js +349 -0
- package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
- package/dist/chunks/sdk-BhHAYgga.js +1397 -0
- package/dist/chunks/shared-Bx9s0i0P.js +100 -0
- package/dist/chunks/signature-xz4QO7CR.js +536 -0
- package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
- package/dist/chunks/square-BP8RWAKB.js +40 -0
- package/dist/chunks/stripe-MihN63uC.js +184 -0
- package/dist/chunks/styles-BfoIZwJp.js +19 -0
- package/dist/chunks/summary-D3AjxpYN.js +114 -0
- package/dist/chunks/table-C-lkQN6I.js +78 -0
- package/dist/chunks/text-limit-DbgEFHLO.js +125 -0
- package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
- package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
- package/dist/chunks/upload-manager-BpqWSHmU.js +2558 -0
- package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
- package/dist/css/formie-theme.css +2 -0
- package/dist/css/theme/_buttons.css +16 -0
- package/dist/css/theme/_tokens.css +2 -0
- package/dist/css/theme/fields/_address-state.css +94 -0
- package/dist/css/theme/fields/_combobox.css +246 -0
- package/dist/css/theme/fields/_select.css +13 -0
- package/dist/css/theme/fields/_signature.css +19 -0
- package/dist/css/theme/fields/_upload-manager.css +279 -0
- package/dist/index.js +2448 -39
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts +4 -0
- package/dist/js/core/validation-focus.d.ts.map +1 -0
- package/dist/js/modules/address/api.d.ts +1 -0
- package/dist/js/modules/address/api.d.ts.map +1 -1
- package/dist/js/modules/address/constants.d.ts +22 -1
- package/dist/js/modules/address/constants.d.ts.map +1 -1
- package/dist/js/modules/address/host.d.ts +2 -2
- package/dist/js/modules/address/host.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +3 -0
- package/dist/js/modules/fields/address-country.d.ts.map +1 -0
- package/dist/js/modules/fields/address-state.d.ts +3 -0
- package/dist/js/modules/fields/address-state.d.ts.map +1 -0
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +17 -0
- package/dist/js/modules/fields/combobox.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-link.d.ts +3 -0
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
- package/dist/js/modules/fields/custom-maps.d.ts +3 -0
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/signature.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts +3 -0
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -0
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +7 -0
- package/dist/js/utils/country-from-ip.d.ts.map +1 -0
- package/dist/js/utils/field-references.d.ts +1 -0
- package/dist/js/utils/field-references.d.ts.map +1 -1
- package/dist/js/utils/field-references.row-scope.d.ts +11 -0
- package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
- package/package.json +8 -3
- package/src/css/formie-theme.css +2 -0
- package/src/css/theme/_buttons.css +16 -0
- package/src/css/theme/_tokens.css +2 -0
- package/src/css/theme/fields/_address-state.css +94 -0
- package/src/css/theme/fields/_combobox.css +246 -0
- package/src/css/theme/fields/_select.css +13 -0
- package/src/css/theme/fields/_signature.css +19 -0
- package/src/css/theme/fields/_upload-manager.css +279 -0
- package/src/js/core/create-formie-client.ts +27 -0
- package/src/js/core/submit-result-ui.ts +4 -4
- package/src/js/core/validation-focus.ts +117 -0
- package/src/js/modules/address/api.ts +7 -0
- package/src/js/modules/address/constants.ts +82 -2
- package/src/js/modules/address/host.ts +16 -6
- package/src/js/modules/address/loqate.ts +3 -17
- package/src/js/modules/fields/address-country.ts +156 -0
- package/src/js/modules/fields/address-state.ts +946 -0
- package/src/js/modules/fields/calculations.ts +32 -0
- package/src/js/modules/fields/combobox.ts +188 -0
- package/src/js/modules/fields/custom-google-maps.ts +416 -0
- package/src/js/modules/fields/custom-link.ts +95 -0
- package/src/js/modules/fields/custom-maps.ts +339 -0
- package/src/js/modules/fields/date-picker.ts +96 -3
- package/src/js/modules/fields/index.ts +7 -0
- package/src/js/modules/fields/phone-country.ts +6 -0
- package/src/js/modules/fields/signature.ts +199 -15
- package/src/js/modules/fields/upload-manager.ts +1277 -0
- package/src/js/submit/pipeline.ts +11 -1
- package/src/js/utils/country-from-ip.ts +54 -0
- package/src/js/utils/field-references.row-scope.ts +303 -0
- package/src/js/utils/field-references.ts +1 -0
- package/src/vendor.d.ts +1 -1
- package/dist/chunks/address-finder-BU4roxT6.js +0 -37
- package/dist/chunks/bpoint-uNg5j6rt.js +0 -26
- package/dist/chunks/calculations-C9t6Zop9.js +0 -147
- package/dist/chunks/captcha-eu-BAPzHNts.js +0 -34
- package/dist/chunks/checkbox-radio-CHeLNVIK.js +0 -141
- package/dist/chunks/conditions-DKxVCsjD.js +0 -459
- package/dist/chunks/date-picker-B3iQ797Z.js +0 -4994
- package/dist/chunks/eway-DCielIML.js +0 -74
- package/dist/chunks/file-upload-DP2TOUYV.js +0 -316
- package/dist/chunks/friendly-captcha-v1-DdlcGiFY.js +0 -33
- package/dist/chunks/friendly-captcha-v2-76w-YnFm.js +0 -38
- package/dist/chunks/go-cardless-rwCkzbNK.js +0 -24
- package/dist/chunks/google-address-BD8IZ86V.js +0 -181
- package/dist/chunks/hcaptcha-BNNTL6uf.js +0 -56
- package/dist/chunks/hidden-CW6Rcf1N.js +0 -31
- package/dist/chunks/index-BEsfee-D.js +0 -1839
- package/dist/chunks/index-BP7Unm5Y.js +0 -863
- package/dist/chunks/index-D6npYxvr.js +0 -4423
- package/dist/chunks/loqate-B-ZNS65B.js +0 -55
- package/dist/chunks/mollie-BDAZ-1X4.js +0 -24
- package/dist/chunks/moneris-B1b0uEtY.js +0 -101
- package/dist/chunks/opayo-CC5hraHo.js +0 -122
- package/dist/chunks/paddle-B4GmrDsq.js +0 -60
- package/dist/chunks/paypal-BFS6XsIS.js +0 -100
- package/dist/chunks/payway-DekoJead.js +0 -56
- package/dist/chunks/phone-country-Cm5YUeXI.js +0 -3765
- package/dist/chunks/place-kit-DizZWV_e.js +0 -42
- package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
- package/dist/chunks/recaptcha-enterprise-BbOvO7JZ.js +0 -71
- package/dist/chunks/recaptcha-shared-Dwg1eVFS.js +0 -15
- package/dist/chunks/recaptcha-v2-checkbox-SY3ti5iQ.js +0 -41
- package/dist/chunks/recaptcha-v2-invisible-DSmQnn6c.js +0 -59
- package/dist/chunks/recaptcha-v3-DNh7YCnR.js +0 -28
- package/dist/chunks/repeater-DM0vuFNQ.js +0 -124
- package/dist/chunks/rich-text-C8aGYp70.js +0 -304
- package/dist/chunks/scripts-CKTFtxPO.js +0 -36
- package/dist/chunks/sdk-3SicTWby.js +0 -1559
- package/dist/chunks/shared--BU5CFoL.js +0 -80
- package/dist/chunks/signature-pFhZfH7d.js +0 -550
- package/dist/chunks/snaptcha-VuOUOaLj.js +0 -8
- package/dist/chunks/square-BR9pvToy.js +0 -46
- package/dist/chunks/stripe-OHUwoV9g.js +0 -202
- package/dist/chunks/styles-C3aqgtek.js +0 -21
- package/dist/chunks/summary-Da7Ktg3N.js +0 -126
- package/dist/chunks/table-C0PmR9bI.js +0 -95
- package/dist/chunks/text-limit-mLEwZDIa.js +0 -144
- package/dist/chunks/turnstile-9tM7q_LK.js +0 -59
- package/dist/chunks/utils-BntI3W4S.js +0 -6149
package/CHANGELOG.md
CHANGED
|
@@ -1,37 +1,91 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Unreleased
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 1.0.6 - 2026-06-14
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Updated dependencies
|
|
9
|
-
- @verbb/formie-core@1.0.4
|
|
7
|
+
### Added
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
- Add the `upload-manager` field module for File Upload **Upload Manager (Advanced)** fields, powered by Uppy (`@uppy/core` + `@uppy/xhr-upload`). Supports drag-and-drop, async staged uploads to Formie upload endpoints, transfer progress with server-processing feedback, remove, hidden asset ID sync, hydration for saved submissions and drafts, up/down reorder controls, and repeater row binding.
|
|
12
10
|
|
|
13
|
-
###
|
|
11
|
+
### Changed
|
|
14
12
|
|
|
15
|
-
-
|
|
16
|
-
- Updated dependencies
|
|
17
|
-
- @verbb/formie-core@1.0.3
|
|
13
|
+
- Run stale pending File Upload cleanup during Craft garbage collection.
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
### Fixed
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
- Fix Signature field initialization on multi-page forms, conditional fields, and late layout by retrying canvas sizing, watching visibility changes, and surfacing accurate status messages when canvas support or init fails. ([#2708](https://github.com/verbb/formie/issues/2708))
|
|
22
18
|
|
|
23
|
-
-
|
|
24
|
-
- Updated dependencies
|
|
25
|
-
- @verbb/formie-core@1.0.2
|
|
19
|
+
## 1.0.5 - 2026-06-12
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
### Added
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
- Add the `combobox` field module for searchable dropdown fields, powered by Tom Select. Supports single and multi-select filtering, placeholder handling, and Formie theme styling.
|
|
24
|
+
- Add the `address-state` field module for country-dependent Address state/province inputs, including subdivision fetching, loading UX, searchable dropdown enhancement, and password-manager autofill reconciliation.
|
|
25
|
+
- Add the `address-country` field module for IP-based country preselect on Address fields, plus shared `fetchCountryFromIp()` / `createGeoIpLookup()` utilities used by Phone country preselect.
|
|
26
|
+
- Add Date Range collection to the `date-picker` module for Calendar (Advanced) fields, using Flatpickr range mode for start and end date/time values.
|
|
27
|
+
- Export `initFormieCombobox()` from the combobox module for reuse by other field modules.
|
|
28
|
+
- Add table column reference resolution to the `calculations` module for Calculations field expressions.
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
- Updated dependencies [d25d240]
|
|
33
|
-
- @verbb/formie-core@1.0.1
|
|
30
|
+
### Changed
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
- Normalise Address sub-field selectors to `data-formie-address-*`, with `ADDRESS_LEGACY_SELECTORS` fallbacks for older markup.
|
|
33
|
+
- Honour the `includeFlatpickrCss` plugin setting so projects providing their own Flatpickr stylesheet can skip Formie's bundled CSS.
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Fix page-reload single-line and multi-line text limit validation rerenders so field error styling, form-level error messages, and scroll/focus behaviour match Ajax submissions.
|
|
38
|
+
|
|
39
|
+
## 1.0.4 - 2026-06-07
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- Add client-side validation message overrides via `data-formie-validation-*-message` attributes, wired through the validator for required, email, number, pattern, match, and min/max rules.
|
|
44
|
+
- Add validation message parity for file upload and checkbox/radio options-limit rules.
|
|
45
|
+
- Add per-field validation error position support (`Above Input` / `Below Input`) via `field-error-container`.
|
|
46
|
+
- Extend `t()` to resolve Craft-style `{param, plural, …}` and `{param, number}` message syntax for translated validation copy.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- Replace text-limit counter translation strings with Craft plural syntax and show context-aware counter copy for empty, under-limit, and over-limit states.
|
|
51
|
+
- Update checkbox-radio, file-upload, text-limit, and submit-result modules for validation message and error-position handling.
|
|
52
|
+
|
|
53
|
+
## 1.0.3 - 2026-06-06
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- Add `submit-readiness` validation module to disable the submit button until the current page passes validation when the form setting is enabled.
|
|
58
|
+
- Add default country preselect support to the Google Places address auto-complete module.
|
|
59
|
+
- Add form CSS for placing the submit button at the end of the last field row.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- Rework file-upload module persistence for Ajax and multi-page forms, including nested Repeater and Group fields.
|
|
64
|
+
- Update conditions module effects for control panel submission field condition behaviour.
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
|
|
68
|
+
- Fix File Upload fields inside Repeater or Group fields not initializing upload persistence for nested inputs.
|
|
69
|
+
- Fix Ajax and multi-page File Upload fields losing their uploaded-file summary after step navigation or when editing existing submissions.
|
|
70
|
+
|
|
71
|
+
## 1.0.2 - 2026-06-03
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
|
|
75
|
+
- Fix front-end JS/CSS build output, restoring TypeScript declaration files and correcting bundled module chunk references.
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
|
|
79
|
+
- Rebuild browser distribution after build pipeline fixes.
|
|
80
|
+
|
|
81
|
+
## 1.0.1 - 2026-06-02
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- Update package homepage and documentation URLs.
|
|
86
|
+
|
|
87
|
+
## 1.0.0 - 2026-06-02
|
|
88
|
+
|
|
89
|
+
### Added
|
|
90
|
+
|
|
91
|
+
- Initial public release of the Formie browser runtime, including field modules, validation, conditions, payments, captcha integrations, and the `createFormieClient()` API.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as e } from "./debug-BV0DvdHx.js";
|
|
2
|
+
import { i as t, n } from "./constants-DVcJAvc5.js";
|
|
3
|
+
import { r } from "./shared-Bx9s0i0P.js";
|
|
4
|
+
import { n as i } from "./country-from-ip-BwxKaBuJ.js";
|
|
5
|
+
//#region src/js/modules/fields/address-country.ts
|
|
6
|
+
var a = "address-country", o = n.country, s = e("fields", "address-country");
|
|
7
|
+
function c(e, t, n) {
|
|
8
|
+
return n === "full" && t ? t : e.toUpperCase();
|
|
9
|
+
}
|
|
10
|
+
function l(e, t = []) {
|
|
11
|
+
if (!t.length) return !0;
|
|
12
|
+
let n = e.toUpperCase();
|
|
13
|
+
return t.some((e) => e.toUpperCase() === n);
|
|
14
|
+
}
|
|
15
|
+
function u(e, t) {
|
|
16
|
+
return Array.from(e.options).some((e) => e.value === t);
|
|
17
|
+
}
|
|
18
|
+
async function d(e, t) {
|
|
19
|
+
for (let n = 0; n < 20; n += 1) {
|
|
20
|
+
let n = e._formieTomSelect;
|
|
21
|
+
if (n || !e.hasAttribute("data-formie-combobox-input")) {
|
|
22
|
+
n ? n.setValue(t, !0) : e.value = t, e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
await new Promise((e) => {
|
|
26
|
+
window.setTimeout(e, 50);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
s.warn("Timed out waiting for country combobox initialisation.");
|
|
30
|
+
}
|
|
31
|
+
async function f(e, n) {
|
|
32
|
+
let r = t(e, "country");
|
|
33
|
+
if (!(r instanceof HTMLSelectElement)) {
|
|
34
|
+
s.warn("Country control not found or not a select; skipping preselect.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (r.value.trim()) return;
|
|
38
|
+
let a = await i(n.countryFromIpAction);
|
|
39
|
+
if (!a?.countryCode) return;
|
|
40
|
+
if (!l(a.countryCode, n.countryAllowed)) {
|
|
41
|
+
s.log("Detected country is not in the allowed list; skipping preselect.", { countryCode: a.countryCode });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let o = n.countryOptionValue === "full" ? "full" : "short", f = c(a.countryCode, a.countryName, o);
|
|
45
|
+
if (!u(r, f)) {
|
|
46
|
+
s.warn("Detected country is not available in the country dropdown; skipping preselect.", { selectValue: f });
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await d(r, f), s.log("Preselected country from IP.", { selectValue: f });
|
|
50
|
+
}
|
|
51
|
+
var p = {
|
|
52
|
+
id: a,
|
|
53
|
+
kind: "field",
|
|
54
|
+
match: (e) => !!e.target.querySelector(o),
|
|
55
|
+
setup: async (e) => {
|
|
56
|
+
let t = e.options || {};
|
|
57
|
+
if (!t.countryPreselectFromIp) return { destroy: () => {} };
|
|
58
|
+
let n = r(e), i = n.map(async (e) => {
|
|
59
|
+
let n = e.closest("[data-formie-field-type=\"address\"]") || e.closest("[data-formie-address-field-layout]")?.closest("[data-formie-field]") || e;
|
|
60
|
+
n instanceof HTMLElement && await f(n, t);
|
|
61
|
+
});
|
|
62
|
+
return await Promise.all(i), s.log("Module setup.", { fieldCount: n.length }), { destroy: () => {
|
|
63
|
+
s.log("Module destroy.", { fieldCount: n.length });
|
|
64
|
+
} };
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { p as addressCountryModule };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { n as e } from "./event-names-BCI2FLD8.js";
|
|
2
|
+
import { t } from "./api-sPqGbOww.js";
|
|
3
|
+
import { r as n } from "./scripts-6CYSUGKQ.js";
|
|
4
|
+
//#region src/js/modules/address/address-finder.ts
|
|
5
|
+
var r = "FORMIE_ADDRESS_FINDER_SCRIPT", i = t({
|
|
6
|
+
id: "address-finder",
|
|
7
|
+
load: async () => n("AddressFinder", {
|
|
8
|
+
id: r,
|
|
9
|
+
src: "https://api.addressfinder.io/assets/v3/widget.js",
|
|
10
|
+
async: !0,
|
|
11
|
+
defer: !0
|
|
12
|
+
}),
|
|
13
|
+
mount: ({ api: t, field: n, services: r, provider: i }) => {
|
|
14
|
+
let a = r.input.getAutocomplete();
|
|
15
|
+
if (!a || t === void 0 || !t.Widget) throw Error("AddressFinder API not ready");
|
|
16
|
+
let o = i.apiKey || "", s = i.countryCode || "au", c = new t.Widget(a, o, s, i.widgetOptions);
|
|
17
|
+
return c.on("result:select", (t, i) => {
|
|
18
|
+
i.address_line_2 ? (r.input.setValue("address1", i.address_line_2), r.input.setValue("address2", i.address_line_1)) : (r.input.setValue("address1", i.address_line_1 || ""), r.input.setValue("address2", "")), r.input.setValue("city", i.locality_name || ""), r.input.setValue("zip", i.postcode || ""), r.input.setValue("state", i.state_territory || ""), r.input.setValue("country", s), n.dispatchEvent(new CustomEvent(e("address-finder", "populate"), {
|
|
19
|
+
bubbles: !0,
|
|
20
|
+
detail: {
|
|
21
|
+
addressProvider: "address-finder",
|
|
22
|
+
fullAddress: t,
|
|
23
|
+
metaData: i
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
}), c;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { i as addressFinderModule };
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { t as e } from "./debug-BV0DvdHx.js";
|
|
2
|
+
import { n as t } from "./constants-DVcJAvc5.js";
|
|
3
|
+
import { r as n, t as r } from "./shared-Bx9s0i0P.js";
|
|
4
|
+
import { initFormieCombobox as i } from "./combobox-D-2b42wn.js";
|
|
5
|
+
//#region src/js/modules/fields/address-state.ts
|
|
6
|
+
var a = "[data-formie-address-state-dynamic]", o = "[data-formie-address-state-input]", s = "[data-formie-address-state-autofill-anchor]", c = "formie-address-autofill-start", l = t.country, u = "address-state", d = "formie/address/subdivisions", f = ["formie-select", "formie-dropdown-input"], p = [
|
|
7
|
+
0,
|
|
8
|
+
100,
|
|
9
|
+
300
|
|
10
|
+
], m = e("fields", "address-state"), h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
11
|
+
function _(e) {
|
|
12
|
+
return e.closest("[data-formie-field-type=\"address\"]") || e.closest("[data-formie-address-field-layout]")?.closest("[data-formie-field]") || e.closest("[data-formie-field]");
|
|
13
|
+
}
|
|
14
|
+
function v(e) {
|
|
15
|
+
let t = e.querySelector(l);
|
|
16
|
+
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement ? t : null;
|
|
17
|
+
}
|
|
18
|
+
function y(e) {
|
|
19
|
+
let t = e.querySelector(a);
|
|
20
|
+
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement ? t : null;
|
|
21
|
+
}
|
|
22
|
+
function b(e) {
|
|
23
|
+
return e.querySelector("[data-formie-field-label]");
|
|
24
|
+
}
|
|
25
|
+
function x(e) {
|
|
26
|
+
e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
27
|
+
}
|
|
28
|
+
function S(e, t) {
|
|
29
|
+
if (!(e instanceof HTMLSelectElement)) return;
|
|
30
|
+
let n = e._formieTomSelect;
|
|
31
|
+
n && n.getValue() !== t && n.setValue(t, !0);
|
|
32
|
+
}
|
|
33
|
+
function C(e, t) {
|
|
34
|
+
if (e.value !== t) {
|
|
35
|
+
e.value = t, x(e);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
S(e, t);
|
|
39
|
+
}
|
|
40
|
+
function w(e, t) {
|
|
41
|
+
e.autofillAnchor && (e.autofillAnchor.value = t);
|
|
42
|
+
}
|
|
43
|
+
function T(e) {
|
|
44
|
+
let t = e.autofillAnchor?.value?.trim() || "", n = e.stateControl.value?.trim() || "", r = t || n;
|
|
45
|
+
r && (e.pendingStateValue = r);
|
|
46
|
+
}
|
|
47
|
+
function E(e) {
|
|
48
|
+
return e.pendingStateValue?.trim() || e.autofillAnchor?.value?.trim() || e.stateControl.value?.trim() || "";
|
|
49
|
+
}
|
|
50
|
+
function D(e) {
|
|
51
|
+
if (e.autofillAnchor) return e.autofillAnchor;
|
|
52
|
+
let t = e.addressRoot.querySelector(s);
|
|
53
|
+
if (t instanceof HTMLInputElement) e.autofillAnchor = t;
|
|
54
|
+
else {
|
|
55
|
+
let t = document.createElement("input");
|
|
56
|
+
t.type = "text", t.setAttribute("data-formie-address-state-autofill-anchor", "true"), t.setAttribute("autocomplete", "address-level1"), t.setAttribute("tabindex", "-1"), t.setAttribute("aria-hidden", "true"), t.className = "formie-sr-only", e.addressRoot.appendChild(t), e.autofillAnchor = t;
|
|
57
|
+
}
|
|
58
|
+
return e.stateControl.setAttribute("autocomplete", "off"), e.stateControl.value && !e.autofillAnchor.value && (e.autofillAnchor.value = e.stateControl.value), e.autofillAnchor;
|
|
59
|
+
}
|
|
60
|
+
function O(e) {
|
|
61
|
+
T(e);
|
|
62
|
+
let t = E(e);
|
|
63
|
+
if (!t) return;
|
|
64
|
+
let n = e.lastSubdivisions, r = n.length > 0 && N(t, n) || t;
|
|
65
|
+
C(e.stateControl, r), S(e.stateControl, r), w(e, r), e.pendingStateValue = r;
|
|
66
|
+
}
|
|
67
|
+
function k(e, t, n, r) {
|
|
68
|
+
let i = new URL(e.startsWith("/") ? e : `/actions/${e}`, window.location.origin);
|
|
69
|
+
return i.searchParams.set("country", t), i.searchParams.set("optionLabel", n), i.searchParams.set("optionValue", r), i.toString();
|
|
70
|
+
}
|
|
71
|
+
function A(e, t, n, r) {
|
|
72
|
+
return [
|
|
73
|
+
e,
|
|
74
|
+
t,
|
|
75
|
+
n,
|
|
76
|
+
r
|
|
77
|
+
].join("|");
|
|
78
|
+
}
|
|
79
|
+
function j(e) {
|
|
80
|
+
return h.has(e);
|
|
81
|
+
}
|
|
82
|
+
async function M(e, t, n, r) {
|
|
83
|
+
let i = A(e, t, n, r);
|
|
84
|
+
return h.has(i) ? h.get(i) || null : (g.has(i) || g.set(i, (async () => {
|
|
85
|
+
try {
|
|
86
|
+
let a = await fetch(k(r, e, t, n), { headers: { Accept: "application/json" } });
|
|
87
|
+
if (!a.ok) return h.set(i, null), null;
|
|
88
|
+
let o = await a.json();
|
|
89
|
+
return h.set(i, o), o;
|
|
90
|
+
} catch (t) {
|
|
91
|
+
return m.warn("Failed fetching subdivisions.", {
|
|
92
|
+
country: e,
|
|
93
|
+
error: t
|
|
94
|
+
}), h.set(i, null), null;
|
|
95
|
+
} finally {
|
|
96
|
+
g.delete(i);
|
|
97
|
+
}
|
|
98
|
+
})()), g.get(i) || null);
|
|
99
|
+
}
|
|
100
|
+
function N(e, t) {
|
|
101
|
+
let n = e.trim().toLowerCase();
|
|
102
|
+
if (!n) return null;
|
|
103
|
+
for (let e of t) if (e.value.toLowerCase() === n || (e.name || "").toLowerCase() === n || (e.short || "").toLowerCase() === n || e.label.toLowerCase() === n) return e.value;
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
function P(e, t) {
|
|
107
|
+
[
|
|
108
|
+
"id",
|
|
109
|
+
"name",
|
|
110
|
+
"required",
|
|
111
|
+
"disabled",
|
|
112
|
+
"placeholder",
|
|
113
|
+
"aria-describedby",
|
|
114
|
+
"data-formie-input-id",
|
|
115
|
+
"data-formie-input-type",
|
|
116
|
+
"data-formie-input-error-state",
|
|
117
|
+
"data-formie-address-state-dynamic",
|
|
118
|
+
"data-formie-address-state-hide-when-unused",
|
|
119
|
+
"data-formie-address-state-use-searchable",
|
|
120
|
+
"data-formie-address-state-use-datalist",
|
|
121
|
+
"data-formie-address-state-option-label",
|
|
122
|
+
"data-formie-address-state-option-value"
|
|
123
|
+
].forEach((n) => {
|
|
124
|
+
let r = e.getAttribute(n);
|
|
125
|
+
if (r === null) {
|
|
126
|
+
t.removeAttribute(n);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
t.setAttribute(n, r);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function F(e, t) {
|
|
133
|
+
t.className = e.className;
|
|
134
|
+
}
|
|
135
|
+
function I(e, t) {
|
|
136
|
+
let n = [...f];
|
|
137
|
+
e.classList.contains("formie-input-error") && n.push("formie-input-error"), t.className = n.join(" ");
|
|
138
|
+
}
|
|
139
|
+
function L(e, t) {
|
|
140
|
+
return e.parentNode?.replaceChild(t, e), t;
|
|
141
|
+
}
|
|
142
|
+
function R(e, t) {
|
|
143
|
+
let n = document.createElement("input");
|
|
144
|
+
return n.type = "text", P(e, n), F(e, n), n.setAttribute("data-formie-input-type", "text"), n.setAttribute("data-formie-address-state-input", "true"), n.setAttribute("data-formie-single-line-text-input", "true"), n.setAttribute("autocomplete", "off"), n.removeAttribute("data-formie-combobox-input"), n.value = t, n;
|
|
145
|
+
}
|
|
146
|
+
function z(e, t, n, r = "") {
|
|
147
|
+
e.innerHTML = "";
|
|
148
|
+
let i = document.createElement("option");
|
|
149
|
+
i.value = "", i.textContent = n || "", e.appendChild(i), t.forEach((t) => {
|
|
150
|
+
let n = document.createElement("option");
|
|
151
|
+
n.value = t.value, n.textContent = t.label, e.appendChild(n);
|
|
152
|
+
}), e.value = N(r, t) || r;
|
|
153
|
+
}
|
|
154
|
+
function B(e, t, n, r) {
|
|
155
|
+
let i = document.createElement("select");
|
|
156
|
+
return P(e, i), I(e, i), i.setAttribute("data-formie-input-type", "select"), i.setAttribute("data-formie-address-state-input", "true"), i.setAttribute("data-formie-select", "true"), i.setAttribute("data-formie-dropdown-input", "true"), i.removeAttribute("data-formie-single-line-text-input"), i.setAttribute("autocomplete", "off"), z(i, n, r, t), i;
|
|
157
|
+
}
|
|
158
|
+
function V(e, t, n, r) {
|
|
159
|
+
let i = e.list;
|
|
160
|
+
if (!r || n.length === 0) {
|
|
161
|
+
e.removeAttribute("list"), i && i.remove();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
let a = e.ownerDocument.getElementById(t);
|
|
165
|
+
a || (a = e.ownerDocument.createElement("datalist"), a.id = t, e.insertAdjacentElement("afterend", a)), a.innerHTML = "", n.forEach((t) => {
|
|
166
|
+
let n = e.ownerDocument.createElement("option");
|
|
167
|
+
n.value = t.label, a?.appendChild(n);
|
|
168
|
+
}), e.setAttribute("list", t);
|
|
169
|
+
}
|
|
170
|
+
function H(e, t) {
|
|
171
|
+
let { stateField: n, stateControl: r, required: i } = e;
|
|
172
|
+
if (n.classList.toggle("formie-conditionally-hidden", !t), n.toggleAttribute("data-formie-conditionally-hidden", !t), !t) {
|
|
173
|
+
r.required = !1, r.disabled = !0;
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
r.disabled = !1, r.required = i;
|
|
177
|
+
}
|
|
178
|
+
function U(e) {
|
|
179
|
+
if (e.fetchingAnnouncementEl) return e.fetchingAnnouncementEl;
|
|
180
|
+
let t = document.createElement("div");
|
|
181
|
+
return t.className = "formie-sr-only", t.setAttribute("data-formie-address-state-fetching-announce", "true"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "true"), e.addressRoot.appendChild(t), e.fetchingAnnouncementEl = t, t;
|
|
182
|
+
}
|
|
183
|
+
function W() {
|
|
184
|
+
let e = document.createElement("div");
|
|
185
|
+
e.className = "formie-address-state-skeleton", e.setAttribute("data-formie-address-state-skeleton", "true"), e.setAttribute("aria-hidden", "true");
|
|
186
|
+
let t = document.createElement("div");
|
|
187
|
+
return t.className = "formie-address-state-skeleton-input", e.appendChild(t), e;
|
|
188
|
+
}
|
|
189
|
+
function G(e) {
|
|
190
|
+
e.addressRoot.setAttribute("data-formie-address-state-fetching", "true"), e.countryControl?.setAttribute("aria-busy", "true"), e.stateControl.setAttribute("aria-hidden", "true"), e.stateControl.setAttribute("tabindex", "-1"), e.stateField.classList.remove("formie-conditionally-hidden"), e.stateField.removeAttribute("data-formie-conditionally-hidden"), e.stateField.setAttribute("data-formie-address-state-skeleton-active", "true");
|
|
191
|
+
let t = e.stateField.querySelector("[data-formie-field-control]");
|
|
192
|
+
t instanceof HTMLElement && (e.skeletonEl || (e.skeletonEl = W(), t.appendChild(e.skeletonEl)), e.skeletonEl.removeAttribute("hidden")), U(e).textContent = "Loading state or province options for the selected country.";
|
|
193
|
+
}
|
|
194
|
+
function K(e) {
|
|
195
|
+
e.addressRoot.removeAttribute("data-formie-address-state-fetching"), e.countryControl?.removeAttribute("aria-busy"), e.stateControl.removeAttribute("aria-hidden"), e.stateControl.removeAttribute("tabindex"), e.stateField.removeAttribute("data-formie-address-state-skeleton-active"), e.skeletonEl?.setAttribute("hidden", "hidden"), e.fetchingAnnouncementEl && (e.fetchingAnnouncementEl.textContent = "");
|
|
196
|
+
}
|
|
197
|
+
function q(e, t) {
|
|
198
|
+
let n = b(e);
|
|
199
|
+
if (!n) return;
|
|
200
|
+
let r = n.querySelector("[data-formie-field-required]");
|
|
201
|
+
n.textContent = t, r && n.appendChild(r);
|
|
202
|
+
}
|
|
203
|
+
function J(e, t) {
|
|
204
|
+
e.setAttribute("data-formie-combobox-input", "true"), r(e, "combobox", "before-init", {
|
|
205
|
+
select: e,
|
|
206
|
+
options: { placeholder: t }
|
|
207
|
+
});
|
|
208
|
+
let n = i(e, { placeholder: t });
|
|
209
|
+
return r(e, "combobox", "after-init", {
|
|
210
|
+
combobox: e._formieTomSelect,
|
|
211
|
+
options: { placeholder: t }
|
|
212
|
+
}), n;
|
|
213
|
+
}
|
|
214
|
+
async function Y(e, t) {
|
|
215
|
+
let { hideWhenUnused: n = !0, useSearchable: r = !0, useDatalist: i = !0, optionLabel: a = "name", optionValue: o = "name", placeholder: s = null, subdivisionsAction: c = d } = t, l = e.countryControl?.value?.trim() || "";
|
|
216
|
+
T(e);
|
|
217
|
+
let u = E(e), f = ++e.fetchGeneration;
|
|
218
|
+
if (e.comboboxCleanup?.(), e.comboboxCleanup = null, !l) {
|
|
219
|
+
if (q(e.stateField, e.stateField.dataset.formieAddressStateDefaultLabel || "State / Province"), K(e), n) {
|
|
220
|
+
H(e, !1), C(e.stateControl, ""), w(e, ""), e.pendingStateValue = "", e.lastSubdivisions = [];
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (H(e, !0), e.stateControl instanceof HTMLSelectElement) {
|
|
224
|
+
let t = R(e.stateControl, u);
|
|
225
|
+
e.stateControl = L(e.stateControl, t);
|
|
226
|
+
} else e.stateControl.disabled = !0, e.stateControl.placeholder = s || e.stateControl.placeholder;
|
|
227
|
+
e.lastSubdivisions = [];
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
j(A(l, a, o, c)) || G(e);
|
|
231
|
+
let p = await M(l, a, o, c);
|
|
232
|
+
if (f !== e.fetchGeneration) return;
|
|
233
|
+
let m = p?.subdivisions || [], h = p?.administrativeAreaUsed ?? !0, g = p?.administrativeAreaLabel || "State / Province";
|
|
234
|
+
if (e.lastSubdivisions = m, K(e), n && !h) {
|
|
235
|
+
H(e, !1), C(e.stateControl, ""), w(e, ""), e.pendingStateValue = "";
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (H(e, !0), q(e.stateField, g), m.length > 0) {
|
|
239
|
+
let t = e.stateControl instanceof HTMLSelectElement ? e.stateControl : B(e.stateControl, u, m, s);
|
|
240
|
+
e.stateControl === t ? (I(e.stateControl, t), z(t, m, s, t.value)) : e.stateControl = L(e.stateControl, t), r ? e.comboboxCleanup = J(t, s) : t.removeAttribute("data-formie-combobox-input"), C(t, N(u, m) || u), O(e);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
let _ = e.stateControl instanceof HTMLInputElement ? e.stateControl : R(e.stateControl, u);
|
|
244
|
+
e.stateControl !== _ && (e.stateControl = L(e.stateControl, _)), _.disabled = !1, V(_, e.datalistId, m, i), C(_, u), O(e);
|
|
245
|
+
}
|
|
246
|
+
function X(e, t) {
|
|
247
|
+
let n = () => {
|
|
248
|
+
T(e), e.countryControl?.value?.trim() && (e.lastCountry = "", Y(e, t).then(() => {
|
|
249
|
+
O(e);
|
|
250
|
+
}));
|
|
251
|
+
};
|
|
252
|
+
p.forEach((t) => {
|
|
253
|
+
let r = window.setTimeout(n, t);
|
|
254
|
+
e.autofillSweepTimers.push(r);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function Z(e) {
|
|
258
|
+
e.countryChangeTimer !== null && (window.clearTimeout(e.countryChangeTimer), e.countryChangeTimer = null), e.autofillSweepTimers.forEach((e) => {
|
|
259
|
+
window.clearTimeout(e);
|
|
260
|
+
}), e.autofillSweepTimers = [];
|
|
261
|
+
}
|
|
262
|
+
function Q(e, t) {
|
|
263
|
+
let n = _(e);
|
|
264
|
+
if (!n) return m.warn("Address root not found; skipping field."), () => {};
|
|
265
|
+
let r = y(e);
|
|
266
|
+
if (!r) return m.warn("Dynamic state control not found; skipping field."), () => {};
|
|
267
|
+
let i = b(e);
|
|
268
|
+
i && !e.dataset.formieAddressStateDefaultLabel && (e.dataset.formieAddressStateDefaultLabel = i.textContent?.trim() || "State / Province");
|
|
269
|
+
let s = {
|
|
270
|
+
addressRoot: n,
|
|
271
|
+
stateField: e,
|
|
272
|
+
stateControl: r,
|
|
273
|
+
countryControl: v(n),
|
|
274
|
+
autofillAnchor: null,
|
|
275
|
+
pendingStateValue: r.value?.trim() || "",
|
|
276
|
+
datalistId: `formie-address-state-datalist-${r.getAttribute("data-formie-input-id") || Math.random().toString(36).slice(2)}`,
|
|
277
|
+
comboboxCleanup: null,
|
|
278
|
+
skeletonEl: null,
|
|
279
|
+
fetchingAnnouncementEl: null,
|
|
280
|
+
autofillSweepTimers: [],
|
|
281
|
+
countryChangeTimer: null,
|
|
282
|
+
lastCountry: "",
|
|
283
|
+
fetchGeneration: 0,
|
|
284
|
+
required: r.required,
|
|
285
|
+
lastSubdivisions: []
|
|
286
|
+
};
|
|
287
|
+
D(s);
|
|
288
|
+
let l = (e = !1) => {
|
|
289
|
+
let n = s.countryControl?.value?.trim() || "";
|
|
290
|
+
if (!e && n === s.lastCountry) return;
|
|
291
|
+
let r = s.lastCountry, i = E(s);
|
|
292
|
+
s.lastCountry = n, Y(s, t).then(() => {
|
|
293
|
+
O(s), !(!r || !n || r === n) && !N(i, s.lastSubdivisions) && !E(s) && (C(s.stateControl, ""), w(s, ""));
|
|
294
|
+
});
|
|
295
|
+
}, u = () => {
|
|
296
|
+
s.countryChangeTimer !== null && window.clearTimeout(s.countryChangeTimer), s.countryChangeTimer = window.setTimeout(() => {
|
|
297
|
+
s.countryChangeTimer = null, T(s), l(!0);
|
|
298
|
+
}, 50);
|
|
299
|
+
}, d = (e) => {
|
|
300
|
+
let n = e.target;
|
|
301
|
+
if (!(n instanceof HTMLInputElement || n instanceof HTMLSelectElement)) return;
|
|
302
|
+
let r = n === s.autofillAnchor, i = n.matches(a) || n.matches(o);
|
|
303
|
+
if (!(!r && !i) && (i && !r && w(s, n.value), T(s), s.countryControl?.value?.trim())) {
|
|
304
|
+
if (s.lastSubdivisions.length > 0) {
|
|
305
|
+
O(s);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
s.lastCountry = "", Y(s, t).then(() => {
|
|
309
|
+
O(s);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}, f = (e) => {
|
|
313
|
+
if (e.animationName !== c) return;
|
|
314
|
+
let r = e.target;
|
|
315
|
+
(r instanceof HTMLInputElement || r instanceof HTMLSelectElement) && n.contains(r) && (T(s), s.countryControl?.value?.trim() && (s.lastCountry = "", Y(s, t).then(() => {
|
|
316
|
+
O(s);
|
|
317
|
+
})));
|
|
318
|
+
}, p = (e) => {
|
|
319
|
+
let n = e.detail?.state?.trim();
|
|
320
|
+
if (!n) {
|
|
321
|
+
l();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
s.pendingStateValue = n, w(s, n), Y(s, t).then(() => {
|
|
325
|
+
C(s.stateControl, n), S(s.stateControl, n), s.lastCountry = s.countryControl?.value?.trim() || "";
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
return s.countryControl?.addEventListener("change", u), s.countryControl?.addEventListener("input", u), n.addEventListener("input", d), n.addEventListener("change", d), n.addEventListener("animationstart", f), n.addEventListener("formie:address:google:populate", p), n.addEventListener("formie:address:address-finder:populate", p), n.addEventListener("formie:address:loqate:populate", p), n.addEventListener("formie:address:place-kit:populate", p), l(), X(s, t), () => {
|
|
329
|
+
Z(s), K(s), s.skeletonEl?.remove(), s.fetchingAnnouncementEl?.remove(), s.autofillAnchor?.remove(), s.comboboxCleanup?.(), s.countryControl?.removeEventListener("change", u), s.countryControl?.removeEventListener("input", u), n.removeEventListener("input", d), n.removeEventListener("change", d), n.removeEventListener("animationstart", f), n.removeEventListener("formie:address:google:populate", p), n.removeEventListener("formie:address:address-finder:populate", p), n.removeEventListener("formie:address:loqate:populate", p), n.removeEventListener("formie:address:place-kit:populate", p);
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
var $ = {
|
|
333
|
+
id: u,
|
|
334
|
+
kind: "field",
|
|
335
|
+
match: (e) => !!e.target.querySelector(a),
|
|
336
|
+
setup: async (e) => {
|
|
337
|
+
let t = e.options || {}, r = n(e), i = r.map((e) => Q(e, t));
|
|
338
|
+
return m.log("Module setup.", { fieldCount: r.length }), { destroy: () => {
|
|
339
|
+
i.forEach((e) => e()), m.log("Module destroy.", { fieldCount: r.length });
|
|
340
|
+
} };
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
//#endregion
|
|
344
|
+
export { $ as addressStateModule };
|