@verbb/formie-browser 1.0.13 → 1.0.15
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 +80 -0
- package/dist/chunks/{address-country-Rx6GQTND.js → address-country-BcEQKw0T.js} +11 -5
- package/dist/chunks/{address-finder-k7_BXaRe.js → address-finder-BWGINCSA.js} +3 -3
- package/dist/chunks/address-state-DI3ndhMU.js +365 -0
- package/dist/chunks/{api-BUb6P-xu.js → api-BK9b340y.js} +93 -63
- package/dist/chunks/{api-DqpfkZWL.js → api-Dxl_CKw-.js} +202 -193
- package/dist/chunks/{api-sPqGbOww.js → api-ghNr2uxX.js} +15 -9
- package/dist/chunks/{async-nPFRNQ06.js → async-2GdXNFCE.js} +18 -1
- package/dist/chunks/{bpoint-Dlq34XH1.js → bpoint-BwtuyN_O.js} +3 -3
- package/dist/chunks/calculations-YEoVCG2q.js +310 -0
- package/dist/chunks/{captcha-eu-CGm8Lbrj.js → captcha-eu-DWLoQFKB.js} +6 -5
- package/dist/chunks/{checkbox-radio-BY2aTCOG.js → checkbox-radio-gsm8QPJg.js} +74 -75
- package/dist/chunks/{combobox-C0EuExSI.js → combobox-Ba08_cHL.js} +340 -328
- package/dist/chunks/conditions-Ceeg6ReZ.js +467 -0
- package/dist/chunks/country-from-ip-DDj_mFki.js +29 -0
- package/dist/chunks/csrf-DxHg_ZYt.js +61 -0
- package/dist/chunks/{custom-google-maps-BsaSirEZ.js → custom-google-maps-C4l2S3GO.js} +9 -3
- package/dist/chunks/{custom-link-CJ1-FjEM.js → custom-link-CLazgKYH.js} +8 -2
- package/dist/chunks/{custom-maps-DYW_pBid.js → custom-maps-DqcAlD0v.js} +10 -4
- package/dist/chunks/{date-picker-F9BUBDSW.js → date-picker-DaPvMrop.js} +467 -443
- package/dist/chunks/{dist-D6i-VNgM.js → dist-ZLeW0zZ3.js} +1281 -453
- package/dist/chunks/{eway-D9_m8ooj.js → eway-uw0DzU-L.js} +5 -5
- package/dist/chunks/field-references.resolver-Ca8MguFv.js +104 -0
- package/dist/chunks/{file-upload-rqfZNqlH.js → file-upload-B8_mH012.js} +119 -99
- package/dist/chunks/friendly-captcha-v1-CVXaXgDO.js +34 -0
- package/dist/chunks/{friendly-captcha-v2-CLSAbkqx.js → friendly-captcha-v2-DkeIVTKI.js} +6 -5
- package/dist/chunks/{friendly-challenge-8uPatWqk.js → friendly-challenge-DPG9MJb1.js} +111 -102
- package/dist/chunks/{go-cardless-DAT3ZaQf.js → go-cardless-c4wLJdOt.js} +2 -2
- package/dist/chunks/google-address-JHYvjwgN.js +168 -0
- package/dist/chunks/{hcaptcha-CGLAmgjO.js → hcaptcha-Dt3ELLlP.js} +4 -4
- package/dist/chunks/{hidden-D7_Ch-QN.js → hidden-BZhXnNPe.js} +8 -2
- package/dist/chunks/http-C2QdHuWO.js +27 -0
- package/dist/chunks/{leaflet-src-j-lHNmhR.js → leaflet-src-DE6rv6M-.js} +42 -46
- package/dist/chunks/{loqate-CJPzBmSm.js → loqate-m51iPyO1.js} +3 -3
- package/dist/chunks/{mollie-Bibhl67p.js → mollie-Bn0PX173.js} +2 -2
- package/dist/chunks/{moneris-H2wSqk9h.js → moneris-BRbUvI4t.js} +3 -3
- package/dist/chunks/opayo-BwWdInEP.js +188 -0
- package/dist/chunks/{paddle-DkvIxQdG.js → paddle-CympHVvd.js} +4 -4
- package/dist/chunks/{password-validation-D06uH9va.js → password-validation-C8_uO_c_.js} +18 -12
- package/dist/chunks/{paypal-CQpAF7Ua.js → paypal-h75h6wae.js} +8 -6
- package/dist/chunks/{payway-CwDkC7YZ.js → payway-C9rHTCC_.js} +4 -4
- package/dist/chunks/{phone-country-D3ayr60L.js → phone-country-B8fv-L5_.js} +80 -63
- package/dist/chunks/{place-kit-BGHklIZ-.js → place-kit-BnZGQ-L1.js} +11 -11
- package/dist/chunks/{placekit-autocomplete.esm-DWVabQlq.js → placekit-autocomplete.esm-CZZERYur.js} +11 -15
- package/dist/chunks/{recaptcha-enterprise-XPId5-bS.js → recaptcha-enterprise-CUs8BO6V.js} +4 -4
- package/dist/chunks/{recaptcha-shared-CLYJvojk.js → recaptcha-shared-DTbTw-MF.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-Cy-0PEPc.js → recaptcha-v2-checkbox-P1McW4Pv.js} +4 -4
- package/dist/chunks/{recaptcha-v2-invisible-BwRH540O.js → recaptcha-v2-invisible-FGDqozSP.js} +4 -4
- package/dist/chunks/{recaptcha-v3-No4Ykrhk.js → recaptcha-v3-CflUHeZD.js} +4 -4
- package/dist/chunks/{repeater-BVnPUqTj.js → repeater-CyhDbozO.js} +60 -40
- package/dist/chunks/request-profile-DhwkeCpS.js +10 -0
- package/dist/chunks/rich-text-uV4o_pGk.js +361 -0
- package/dist/chunks/{chunk-3b4jIN3o.js → rolldown-runtime-DtPi1Y-2.js} +2 -2
- package/dist/chunks/{scripts-CbQ7agX3.js → scripts-DrccjrFv.js} +1 -1
- package/dist/chunks/{sdk-BhHAYgga.js → sdk-lkwSvlpM.js} +282 -234
- package/dist/chunks/{shared-Bx9s0i0P.js → shared-OKhSay59.js} +27 -21
- package/dist/chunks/{signature-IOhuicje.js → signature-7cldFbqj.js} +138 -112
- package/dist/chunks/skip-CEW89ExY.js +7 -0
- package/dist/chunks/{snaptcha-DKx98oon.js → snaptcha-C3QLYxFT.js} +2 -2
- package/dist/chunks/{square-DwdcOI1G.js → square-C1z5DPVw.js} +9 -7
- package/dist/chunks/{stripe-DaoG2FT1.js → stripe-Dmkdkq1y.js} +11 -12
- package/dist/chunks/{summary-Dks0gXS3.js → summary-Bn-g5SDx.js} +48 -46
- package/dist/chunks/{survey-likert-DkE6bR7B.js → survey-likert-fk1hUPff.js} +7 -1
- package/dist/chunks/{survey-rank-DN6x4IZM.js → survey-rank-BsLGl2LX.js} +37 -25
- package/dist/chunks/{survey-rating-BnsNL9U5.js → survey-rating-DVS6e6fM.js} +17 -5
- package/dist/chunks/{table-CAjCJHrL.js → table-j7MlLLCc.js} +22 -16
- package/dist/chunks/{text-limit-BGaY0jhI.js → text-limit-LGMPhFuC.js} +40 -34
- package/dist/chunks/{theme-classes-Tv7q7ToE.js → theme-classes-DAQuEqdP.js} +1 -1
- package/dist/chunks/{turnstile-DJakPzQD.js → turnstile-ptihQfLl.js} +4 -4
- package/dist/chunks/{upload-manager-W-QDgxKD.js → upload-manager-BW7l-BhF.js} +459 -387
- package/dist/chunks/{utils-Vqp8i_RM.js → utils-DpUBPadZ.js} +20 -14
- package/dist/css/formie-base.css +104 -1
- package/dist/css/theme/_messages.css +2 -0
- package/dist/css/theme/_tokens.css +31 -25
- package/dist/css/theme/forms/_form.css +5 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1779 -1415
- package/dist/js/contracts/client.d.ts +5 -3
- package/dist/js/contracts/client.d.ts.map +1 -1
- package/dist/js/contracts/common.d.ts +2 -2
- package/dist/js/contracts/common.d.ts.map +1 -1
- package/dist/js/contracts/modules.d.ts +37 -12
- package/dist/js/contracts/modules.d.ts.map +1 -1
- package/dist/js/contracts/schema.d.ts +20 -38
- package/dist/js/contracts/schema.d.ts.map +1 -1
- package/dist/js/contracts/theme.d.ts +4 -1
- package/dist/js/contracts/theme.d.ts.map +1 -1
- package/dist/js/core/client-rendered-modules.d.ts +17 -0
- package/dist/js/core/client-rendered-modules.d.ts.map +1 -0
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/field-error-aria.d.ts +23 -0
- package/dist/js/core/field-error-aria.d.ts.map +1 -0
- package/dist/js/core/hydrate-modules.d.ts +10 -8
- package/dist/js/core/hydrate-modules.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts +3 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts.map +1 -1
- package/dist/js/modules/address/address-finder.d.ts +1 -1
- package/dist/js/modules/address/address-finder.d.ts.map +1 -1
- package/dist/js/modules/address/factories.d.ts +3 -3
- package/dist/js/modules/address/factories.d.ts.map +1 -1
- package/dist/js/modules/address/google-address.d.ts +12 -1
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/address/index.d.ts +2 -2
- package/dist/js/modules/address/index.d.ts.map +1 -1
- package/dist/js/modules/address/loqate.d.ts +1 -1
- package/dist/js/modules/address/loqate.d.ts.map +1 -1
- package/dist/js/modules/address/place-kit.d.ts +1 -1
- package/dist/js/modules/address/place-kit.d.ts.map +1 -1
- package/dist/js/modules/captchas/captcha-eu.d.ts +1 -1
- package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -1
- package/dist/js/modules/captchas/factories.d.ts +11 -11
- package/dist/js/modules/captchas/factories.d.ts.map +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +1 -1
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -1
- package/dist/js/modules/captchas/hcaptcha.d.ts +1 -1
- package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -1
- package/dist/js/modules/captchas/index.d.ts +2 -2
- package/dist/js/modules/captchas/index.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -1
- package/dist/js/modules/captchas/recaptcha-v3.d.ts +1 -1
- package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -1
- package/dist/js/modules/captchas/snaptcha.d.ts +1 -1
- package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -1
- package/dist/js/modules/captchas/turnstile.d.ts +1 -1
- package/dist/js/modules/captchas/turnstile.d.ts.map +1 -1
- package/dist/js/modules/fields/address-country.d.ts +2 -2
- package/dist/js/modules/fields/address-country.d.ts.map +1 -1
- package/dist/js/modules/fields/address-state.d.ts +2 -2
- package/dist/js/modules/fields/address-state.d.ts.map +1 -1
- package/dist/js/modules/fields/calculations.d.ts +2 -2
- package/dist/js/modules/fields/calculations.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts +2 -2
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts +2 -2
- package/dist/js/modules/fields/combobox.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/config.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts +1 -0
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/evaluator.d.ts +4 -1
- package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/references.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/submission-context.d.ts +15 -0
- package/dist/js/modules/fields/conditions/submission-context.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/types.d.ts +3 -1
- package/dist/js/modules/fields/conditions/types.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/values.d.ts +1 -1
- package/dist/js/modules/fields/conditions/values.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.d.ts +2 -2
- package/dist/js/modules/fields/conditions.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-google-maps.d.ts +2 -2
- package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-link.d.ts +2 -2
- package/dist/js/modules/fields/custom-link.d.ts.map +1 -1
- package/dist/js/modules/fields/custom-maps.d.ts +2 -2
- package/dist/js/modules/fields/custom-maps.d.ts.map +1 -1
- package/dist/js/modules/fields/date-picker.d.ts +2 -2
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts +2 -2
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/hidden.d.ts +2 -2
- package/dist/js/modules/fields/hidden.d.ts.map +1 -1
- package/dist/js/modules/fields/index.d.ts +2 -2
- package/dist/js/modules/fields/index.d.ts.map +1 -1
- package/dist/js/modules/fields/password-validation.d.ts +2 -2
- package/dist/js/modules/fields/password-validation.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts +2 -2
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/repeater.d.ts +2 -2
- package/dist/js/modules/fields/repeater.d.ts.map +1 -1
- package/dist/js/modules/fields/rich-text.d.ts +2 -2
- package/dist/js/modules/fields/rich-text.d.ts.map +1 -1
- package/dist/js/modules/fields/shared.d.ts +1 -0
- package/dist/js/modules/fields/shared.d.ts.map +1 -1
- package/dist/js/modules/fields/signature.d.ts +2 -2
- package/dist/js/modules/fields/signature.d.ts.map +1 -1
- package/dist/js/modules/fields/summary.d.ts +2 -2
- package/dist/js/modules/fields/summary.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-likert.d.ts +2 -2
- package/dist/js/modules/fields/survey-likert.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-rank.d.ts +2 -2
- package/dist/js/modules/fields/survey-rank.d.ts.map +1 -1
- package/dist/js/modules/fields/survey-rating.d.ts +2 -2
- package/dist/js/modules/fields/survey-rating.d.ts.map +1 -1
- package/dist/js/modules/fields/table.d.ts +2 -2
- package/dist/js/modules/fields/table.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts +2 -2
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts +2 -2
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
- package/dist/js/modules/loader.d.ts +10 -4
- package/dist/js/modules/loader.d.ts.map +1 -1
- package/dist/js/modules/payments/bpoint.d.ts +1 -1
- package/dist/js/modules/payments/bpoint.d.ts.map +1 -1
- package/dist/js/modules/payments/eway.d.ts +1 -1
- package/dist/js/modules/payments/eway.d.ts.map +1 -1
- package/dist/js/modules/payments/factories.d.ts +7 -7
- package/dist/js/modules/payments/factories.d.ts.map +1 -1
- package/dist/js/modules/payments/go-cardless.d.ts +1 -1
- package/dist/js/modules/payments/go-cardless.d.ts.map +1 -1
- package/dist/js/modules/payments/index.d.ts +2 -2
- package/dist/js/modules/payments/index.d.ts.map +1 -1
- package/dist/js/modules/payments/mollie.d.ts +1 -1
- package/dist/js/modules/payments/mollie.d.ts.map +1 -1
- package/dist/js/modules/payments/moneris.d.ts +1 -1
- package/dist/js/modules/payments/moneris.d.ts.map +1 -1
- package/dist/js/modules/payments/opayo.d.ts +1 -1
- package/dist/js/modules/payments/opayo.d.ts.map +1 -1
- package/dist/js/modules/payments/paddle.d.ts +1 -1
- package/dist/js/modules/payments/paddle.d.ts.map +1 -1
- package/dist/js/modules/payments/paypal.d.ts +1 -1
- package/dist/js/modules/payments/paypal.d.ts.map +1 -1
- package/dist/js/modules/payments/payway.d.ts +1 -1
- package/dist/js/modules/payments/payway.d.ts.map +1 -1
- package/dist/js/modules/payments/square.d.ts +1 -1
- package/dist/js/modules/payments/square.d.ts.map +1 -1
- package/dist/js/modules/payments/stripe.d.ts +1 -1
- package/dist/js/modules/payments/stripe.d.ts.map +1 -1
- package/dist/js/modules/payments/utils.d.ts +6 -0
- package/dist/js/modules/payments/utils.d.ts.map +1 -1
- package/dist/js/modules/registry.d.ts +6 -4
- package/dist/js/modules/registry.d.ts.map +1 -1
- package/dist/js/submit/pipeline.d.ts.map +1 -1
- package/dist/js/theme/browser-theme-state.generated.d.ts +24 -0
- package/dist/js/theme/browser-theme-state.generated.d.ts.map +1 -0
- package/dist/js/theme/theme-classes.d.ts +3 -3
- package/dist/js/theme/theme-classes.d.ts.map +1 -1
- package/dist/js/transport/forms-api.d.ts +5 -3
- package/dist/js/transport/forms-api.d.ts.map +1 -1
- package/dist/js/utils/async.d.ts +1 -0
- package/dist/js/utils/async.d.ts.map +1 -1
- package/dist/js/utils/country-from-ip.d.ts +2 -2
- package/dist/js/utils/country-from-ip.d.ts.map +1 -1
- package/dist/js/utils/csrf.d.ts +17 -0
- package/dist/js/utils/csrf.d.ts.map +1 -0
- package/dist/js/utils/field-references.parser.d.ts +1 -0
- package/dist/js/utils/field-references.parser.d.ts.map +1 -1
- package/dist/js/utils/field-references.resolver.d.ts.map +1 -1
- package/dist/js/utils/field-references.types.d.ts +1 -0
- package/dist/js/utils/field-references.types.d.ts.map +1 -1
- package/dist/js/utils/http.d.ts +3 -1
- package/dist/js/utils/http.d.ts.map +1 -1
- package/dist/js/utils/request-profile.d.ts +4 -0
- package/dist/js/utils/request-profile.d.ts.map +1 -0
- package/dist/js/utils/unload-warning.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/match.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/rules/required.d.ts.map +1 -1
- package/dist/js/validation/rules/shared.d.ts.map +1 -1
- package/dist/js/validation/rules/url.d.ts.map +1 -1
- package/dist/js/validation/skip.d.ts +7 -0
- package/dist/js/validation/skip.d.ts.map +1 -0
- package/dist/js/validation/submit-readiness.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +43 -12
- package/src/css/formie-base.css +104 -1
- package/src/css/theme/_messages.css +2 -0
- package/src/css/theme/_tokens.css +31 -25
- package/src/css/theme/forms/_form.css +5 -1
- package/src/index.ts +13 -8
- package/src/js/contracts/client.ts +5 -3
- package/src/js/contracts/common.ts +5 -6
- package/src/js/contracts/modules.ts +41 -12
- package/src/js/contracts/schema.ts +21 -43
- package/src/js/contracts/theme.ts +6 -1
- package/src/js/core/client-rendered-modules.ts +69 -0
- package/src/js/core/create-formie-client.ts +132 -86
- package/src/js/core/field-error-aria.ts +93 -0
- package/src/js/core/hydrate-modules.ts +54 -29
- package/src/js/core/submit-result-state.ts +51 -45
- package/src/js/core/submit-result-ui.ts +25 -68
- package/src/js/core/validation-focus.ts +20 -20
- package/src/js/modules/address/address-finder.ts +1 -1
- package/src/js/modules/address/factories.ts +15 -13
- package/src/js/modules/address/google-address.ts +102 -40
- package/src/js/modules/address/index.ts +2 -2
- package/src/js/modules/address/loqate.ts +1 -1
- package/src/js/modules/address/place-kit.ts +14 -8
- package/src/js/modules/captchas/captcha-eu.ts +2 -2
- package/src/js/modules/captchas/factories.ts +66 -42
- package/src/js/modules/captchas/friendly-captcha-v1.ts +12 -2
- package/src/js/modules/captchas/friendly-captcha-v2.ts +4 -2
- package/src/js/modules/captchas/hcaptcha.ts +5 -5
- package/src/js/modules/captchas/index.ts +2 -2
- package/src/js/modules/captchas/recaptcha-enterprise.ts +2 -2
- package/src/js/modules/captchas/recaptcha-v2-checkbox.ts +3 -3
- package/src/js/modules/captchas/recaptcha-v2-invisible.ts +2 -2
- package/src/js/modules/captchas/recaptcha-v3.ts +2 -2
- package/src/js/modules/captchas/snaptcha.ts +1 -1
- package/src/js/modules/captchas/turnstile.ts +3 -3
- package/src/js/modules/fields/address-country.ts +11 -9
- package/src/js/modules/fields/address-state.ts +94 -35
- package/src/js/modules/fields/calculations.ts +5 -3
- package/src/js/modules/fields/checkbox-radio.ts +24 -42
- package/src/js/modules/fields/combobox.ts +28 -9
- package/src/js/modules/fields/conditions/config.ts +17 -20
- package/src/js/modules/fields/conditions/effects.ts +25 -29
- package/src/js/modules/fields/conditions/evaluator.ts +21 -29
- package/src/js/modules/fields/conditions/references.ts +16 -5
- package/src/js/modules/fields/conditions/submission-context.ts +80 -0
- package/src/js/modules/fields/conditions/types.ts +3 -1
- package/src/js/modules/fields/conditions/values.ts +31 -6
- package/src/js/modules/fields/conditions.ts +65 -18
- package/src/js/modules/fields/custom-google-maps.ts +5 -3
- package/src/js/modules/fields/custom-link.ts +5 -3
- package/src/js/modules/fields/custom-maps.ts +5 -3
- package/src/js/modules/fields/date-picker.ts +40 -7
- package/src/js/modules/fields/file-upload.ts +62 -23
- package/src/js/modules/fields/hidden.ts +5 -3
- package/src/js/modules/fields/index.ts +2 -2
- package/src/js/modules/fields/password-validation.ts +5 -3
- package/src/js/modules/fields/phone-country.ts +35 -8
- package/src/js/modules/fields/repeater.ts +60 -7
- package/src/js/modules/fields/rich-text.ts +20 -4
- package/src/js/modules/fields/shared.ts +13 -0
- package/src/js/modules/fields/signature.ts +24 -4
- package/src/js/modules/fields/summary.ts +8 -20
- package/src/js/modules/fields/survey-likert.ts +5 -3
- package/src/js/modules/fields/survey-rank.ts +21 -3
- package/src/js/modules/fields/survey-rating.ts +17 -3
- package/src/js/modules/fields/table.ts +5 -3
- package/src/js/modules/fields/text-limit.ts +5 -3
- package/src/js/modules/fields/upload-manager.ts +244 -67
- package/src/js/modules/loader.ts +345 -281
- package/src/js/modules/payments/bpoint.ts +2 -2
- package/src/js/modules/payments/eway.ts +2 -2
- package/src/js/modules/payments/factories.ts +53 -52
- package/src/js/modules/payments/go-cardless.ts +1 -1
- package/src/js/modules/payments/index.ts +2 -2
- package/src/js/modules/payments/mollie.ts +1 -1
- package/src/js/modules/payments/moneris.ts +2 -2
- package/src/js/modules/payments/opayo.ts +21 -8
- package/src/js/modules/payments/paddle.ts +10 -6
- package/src/js/modules/payments/payment.ts +22 -18
- package/src/js/modules/payments/paypal.ts +1 -1
- package/src/js/modules/payments/payway.ts +2 -2
- package/src/js/modules/payments/square.ts +2 -2
- package/src/js/modules/payments/stripe.ts +5 -5
- package/src/js/modules/payments/utils.ts +14 -0
- package/src/js/modules/registry.ts +19 -11
- package/src/js/submit/pipeline.ts +10 -11
- package/src/js/theme/browser-theme-state.generated.ts +25 -0
- package/src/js/theme/theme-classes.ts +3 -3
- package/src/js/transport/forms-api.ts +66 -67
- package/src/js/utils/async.ts +34 -0
- package/src/js/utils/country-from-ip.ts +14 -9
- package/src/js/utils/csrf.ts +136 -0
- package/src/js/utils/field-references.parser.ts +13 -113
- package/src/js/utils/field-references.resolver.ts +27 -64
- package/src/js/utils/field-references.row-scope.ts +1 -1
- package/src/js/utils/field-references.types.ts +1 -0
- package/src/js/utils/http.ts +5 -5
- package/src/js/utils/request-profile.ts +10 -0
- package/src/js/utils/unload-warning.ts +12 -4
- package/src/js/validation/rules/email.ts +3 -5
- package/src/js/validation/rules/match.ts +2 -1
- package/src/js/validation/rules/minmax.ts +4 -43
- package/src/js/validation/rules/number.ts +3 -47
- package/src/js/validation/rules/pattern.ts +3 -8
- package/src/js/validation/rules/required.ts +14 -1
- package/src/js/validation/rules/shared.ts +5 -1
- package/src/js/validation/rules/url.ts +3 -10
- package/src/js/validation/skip.ts +9 -0
- package/src/js/validation/submit-readiness.ts +9 -2
- package/src/js/validation/validator.ts +49 -61
- package/dist/chunks/address-state-BwE01m2_.js +0 -344
- package/dist/chunks/calculations-Dv3hYb8_.js +0 -299
- package/dist/chunks/conditions-CPH1snCx.js +0 -424
- package/dist/chunks/country-from-ip-BwxKaBuJ.js +0 -26
- package/dist/chunks/field-references.resolver-CHwn0G0L.js +0 -145
- package/dist/chunks/friendly-captcha-v1-C_2reOXr.js +0 -31
- package/dist/chunks/google-address-BH3Zhi06.js +0 -161
- package/dist/chunks/http-D-JExro7.js +0 -27
- package/dist/chunks/opayo-CR0DtsLa.js +0 -179
- package/dist/chunks/rich-text-Bg_--4TG.js +0 -349
- package/dist/js/modules/fields/conditions/transforms.d.ts +0 -3
- package/dist/js/modules/fields/conditions/transforms.d.ts.map +0 -1
- package/src/js/modules/fields/conditions/transforms.ts +0 -206
- package/src/js/modules/payments/stub-payment-module.ts +0 -87
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,86 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 1.0.15 - 2026-10-15
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Rename field module settings to `allowedCountryCodes`, `maxFiles`, `minFileSize` and `maxFileSize` to match the PHP field API.
|
|
9
|
+
- Remove the unused legacy frontend-theme attribute from mounted forms.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- Fixed adding or removing repeater rows with the mouse automatically focusing fields in the submission editor, and keyboard focus targeting field wrappers instead of controls.
|
|
13
|
+
- Fixed hiding an unused state field triggering an unsaved-changes warning when opening a submission.
|
|
14
|
+
- Fixed PlaceKit autocomplete clearing the selected state when using a dynamic State / Province dropdown.
|
|
15
|
+
- Fixed dynamic state dropdowns using control-panel markup, including country changes and preservation of historical saved values.
|
|
16
|
+
- Fixed browser event compatibility not inheriting the setting from forms loaded into a wrapper through REST or GraphQL.
|
|
17
|
+
- Fixed resetting forms leaving added repeater rows or failing to restore removed rows and dynamic address state values.
|
|
18
|
+
- Fixed dynamic address state fields failing to reappear after selecting a country that uses states.
|
|
19
|
+
- Fixed dynamic address state fields remaining visible before a country was selected.
|
|
20
|
+
- Fixed required searchable dropdowns rejecting selected values during browser validation.
|
|
21
|
+
- Fixed address state fields becoming unresponsive when changing countries after selecting a state.
|
|
22
|
+
- Fixed date pickers displaying prefilled dates and date ranges one day early in time zones west of UTC.
|
|
23
|
+
- Fixed live validation error descriptions referencing another form when multiple forms used the same field handles.
|
|
24
|
+
- Fixed keyboard focus skipping newly added repeater rows and being lost when removing the focused row.
|
|
25
|
+
- Fixed correcting a spam-rejected submission causing a stale-session error and clearing entered values.
|
|
26
|
+
- Fixed payment checkout redirects showing an unsaved-changes warning and leaving forms disabled when cancelled.
|
|
27
|
+
- Fixed completed forms with conditional fields showing an unsaved-changes warning when leaving the page.
|
|
28
|
+
- Fixed required simple upload fields rejecting retained files when returning to an earlier page.
|
|
29
|
+
- Fixed simple file uploads losing attachment capabilities after a failed submission.
|
|
30
|
+
- Fixed Upload Manager silently rejecting files that exceed file type, size, or count restrictions.
|
|
31
|
+
- Fixed failed uploads continuing to display an active processing status.
|
|
32
|
+
- Fixed saving progress hiding unfinished forms when Hide Form was enabled for completion.
|
|
33
|
+
- Fixed matching page conditions revealing inactive pages in multi-page forms.
|
|
34
|
+
|
|
35
|
+
## 1.0.14 - 2026-10-08
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
- Add a `formie:field:clear` event for custom controls to clear their values when conditions hide a field or page.
|
|
39
|
+
- Add one generated browser-theme state manifest and canonical state classes for browser-created controls.
|
|
40
|
+
- Add `data-formie-validation-skip` so helper controls (such as the Upload Manager browse input) can opt out of client-side validation.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
- Use Tailwind's Rose palette for the default danger theme colors.
|
|
44
|
+
- Use Tailwind's Emerald palette for the default success theme colors.
|
|
45
|
+
- Add themeable borders to success and error form messages.
|
|
46
|
+
- Consume canonical payment actions and domain status independently from completion redirects, retaining the Formie 3 response facade.
|
|
47
|
+
- Expose mounted instances and current failures as a structured hydration report, separately from runtime lifecycle controls.
|
|
48
|
+
- Consume canonical completion data attributes and response fields while retaining Formie 3 markup and response fallbacks.
|
|
49
|
+
- Resolve surface-specific browser-module manifests by exact occurrence key, pass the exact rendering surface to match and setup hooks, and expose stable `beforeSubmit` and `afterSubmit` lifecycle hooks instead of internal pipeline stages.
|
|
50
|
+
- Read the bounded `data-formie-theme-classes` contract, stop posting executable theme config during Summary refreshes, and keep client-rendered forms responsible for their own markup.
|
|
51
|
+
- Split required `formie-base.css` behaviour from optional `formie-theme.css` visuals while retaining combined `formie.css`.
|
|
52
|
+
- Share versioned tri-state conditions and plain-text validation rules across PHP and browser consumers; enforce recursive hidden-value clearing and server-authoritative navigation.
|
|
53
|
+
- Preserve exact nested submission error paths, return typed page-transition results, and distinguish skipped side effects from invalid condition configuration.
|
|
54
|
+
- Consume the shared completion outcome and preserve the server-owned configuration and query-prefill boundary.
|
|
55
|
+
- Resolve trusted versioned browser modules, reconcile occurrence lifecycles and failures, and restrict full form mounts to server-rendered HTML.
|
|
56
|
+
- Share reference parsing with the Variable Picker and diagnose unavailable browser references.
|
|
57
|
+
- Initialize Opayo through its CSRF-protected payment-session endpoint and display unknown payment outcomes as awaiting reconciliation.
|
|
58
|
+
- Use browser-bound creation plus separate view, delete and attach capabilities for Upload Manager assets, and submit staged files as structured upload references instead of authoritative asset IDs.
|
|
59
|
+
- Carry expected submission versions and signed request tokens through submit and page-state requests.
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
- Fixed successful front-end submission edits showing an unsaved-changes warning when leaving the page.
|
|
63
|
+
- Fixed saved uploads being cleared when opening a submission for editing or resuming.
|
|
64
|
+
- Fixed conditional Date/Time fields failing to initialize when shown again.
|
|
65
|
+
- Fixed conditionally hidden date and signature fields retaining their previous values.
|
|
66
|
+
- Fixed browser module errors repeatedly updating the page and making forms unresponsive.
|
|
67
|
+
- Fixed unchecked checkbox groups being treated as nonempty by browser conditions.
|
|
68
|
+
- Fixed empty searchable multi-select fields being treated as filled by conditions.
|
|
69
|
+
- Fixed date pickers retaining a submitted date after their visible input reset.
|
|
70
|
+
- Fixed signatures carrying over into a new submission after a form reset.
|
|
71
|
+
- Fixed searchable Dropdown fields showing a stale selection after a form reset.
|
|
72
|
+
- Fixed checkbox, radio, rich-text, rating, and rank fields retaining stale values or display state after a form reset.
|
|
73
|
+
- Fixed “Disable Submit Button Until Valid” being ignored on server-rendered forms and repeatedly updating disabled buttons.
|
|
74
|
+
- Fixed successful AJAX redirects triggering an unsaved-changes warning.
|
|
75
|
+
- Fixed refreshed upload tokens triggering an unsaved-changes warning after a successful form submission.
|
|
76
|
+
- Fix TypeScript declaration imports when the npm packages are installed outside the Formie workspace.
|
|
77
|
+
- Present required browser-module failures as accessible alerts with collapsed, copyable technical details, while keeping raw exception details restricted to Craft's authenticated submission editor.
|
|
78
|
+
- Let the persistent field error region own announcements without reserving empty layout space or overriding its configured priority with nested assertive alerts. ([#2954](https://github.com/verbb/formie/issues/2954))
|
|
79
|
+
- Keep Stripe checkout amounts aligned with server rounding and UGX currency conversion.
|
|
80
|
+
- Open Paddle checkout using the transaction created by the server.
|
|
81
|
+
- Refresh cached form tokens when Twig emits the static-cache attribute without a value.
|
|
82
|
+
- Fix required File Upload fields using Upload Manager never passing client-side validation after a successful upload. ([#2924](https://github.com/verbb/formie/issues/2924))
|
|
83
|
+
- Fix Advanced Upload Manager and form transport helpers hard-coding `CRAFT_CSRF_TOKEN`, so uploads and related XHR requests work when Craft’s `csrfTokenName` is customised.
|
|
84
|
+
|
|
5
85
|
## 1.0.13 - 2026-07-09
|
|
6
86
|
|
|
7
87
|
### Fixed
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./debug-BV0DvdHx.js";
|
|
2
2
|
import { i as t, n } from "./constants-DVcJAvc5.js";
|
|
3
|
-
import { r } from "./shared-
|
|
4
|
-
import { n as i } from "./country-from-ip-
|
|
3
|
+
import { i as r } from "./shared-OKhSay59.js";
|
|
4
|
+
import { n as i } from "./country-from-ip-DDj_mFki.js";
|
|
5
5
|
//#region src/js/modules/fields/address-country.ts
|
|
6
6
|
var a = "address-country", o = n.country, s = e("fields", "address-country");
|
|
7
7
|
function c(e, t, n) {
|
|
@@ -35,9 +35,9 @@ async function f(e, n) {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
if (r.value.trim()) return;
|
|
38
|
-
let a = await i(n.countryFromIpAction);
|
|
38
|
+
let a = await i(n.countryFromIpAction, e.closest("form"));
|
|
39
39
|
if (!a?.countryCode) return;
|
|
40
|
-
if (!l(a.countryCode, n.
|
|
40
|
+
if (!l(a.countryCode, n.allowedCountryCodes)) {
|
|
41
41
|
s.log("Detected country is not in the allowed list; skipping preselect.", { countryCode: a.countryCode });
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
@@ -49,7 +49,13 @@ async function f(e, n) {
|
|
|
49
49
|
await d(r, f), s.log("Preselected country from IP.", { selectValue: f });
|
|
50
50
|
}
|
|
51
51
|
var p = {
|
|
52
|
-
|
|
52
|
+
moduleId: `formie:${a}`,
|
|
53
|
+
version: 2,
|
|
54
|
+
surfaces: [
|
|
55
|
+
"server-rendered",
|
|
56
|
+
"client-rendered",
|
|
57
|
+
"cp-edit"
|
|
58
|
+
],
|
|
53
59
|
kind: "field",
|
|
54
60
|
match: (e) => !!e.target.querySelector(o),
|
|
55
61
|
setup: async (e) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as e } from "./event-names-BCI2FLD8.js";
|
|
2
|
-
import { t } from "./api-
|
|
3
|
-
import { r as n } from "./scripts-
|
|
2
|
+
import { t } from "./api-ghNr2uxX.js";
|
|
3
|
+
import { r as n } from "./scripts-DrccjrFv.js";
|
|
4
4
|
//#region src/js/modules/address/address-finder.ts
|
|
5
5
|
var r = "FORMIE_ADDRESS_FINDER_SCRIPT", i = t({
|
|
6
|
-
|
|
6
|
+
moduleId: "formie:address-finder",
|
|
7
7
|
load: async () => n("AddressFinder", {
|
|
8
8
|
id: r,
|
|
9
9
|
src: "https://api.addressfinder.io/assets/v3/widget.js",
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { t as e } from "./request-profile-DhwkeCpS.js";
|
|
2
|
+
import { t } from "./dist-ZLeW0zZ3.js";
|
|
3
|
+
import { t as n } from "./debug-BV0DvdHx.js";
|
|
4
|
+
import { a as r, n as i } from "./theme-classes-DAQuEqdP.js";
|
|
5
|
+
import { n as a } from "./constants-DVcJAvc5.js";
|
|
6
|
+
import { i as o, n as s } from "./shared-OKhSay59.js";
|
|
7
|
+
import { initFormieCombobox as c } from "./combobox-Ba08_cHL.js";
|
|
8
|
+
//#region src/js/modules/fields/address-state.ts
|
|
9
|
+
var l = "[data-formie-address-state-dynamic]", u = "[data-formie-address-state-input]", d = "[data-formie-address-state-autofill-anchor]", f = "formie-address-autofill-start", p = a.country, m = "address-state", h = "formie/address/subdivisions", g = ["formie-select", "formie-dropdown-input"], _ = [
|
|
10
|
+
0,
|
|
11
|
+
100,
|
|
12
|
+
300
|
|
13
|
+
], v = n("fields", "address-state"), y = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
|
|
14
|
+
function x(e) {
|
|
15
|
+
return e.closest("[data-formie-field-type=\"address\"]") || e.closest("[data-formie-address-field-layout]")?.closest("[data-formie-field]") || e.closest("[data-formie-field]");
|
|
16
|
+
}
|
|
17
|
+
function S(e) {
|
|
18
|
+
let t = e.querySelector(p);
|
|
19
|
+
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement ? t : null;
|
|
20
|
+
}
|
|
21
|
+
function C(e) {
|
|
22
|
+
let t = e.querySelector(l);
|
|
23
|
+
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement ? t : null;
|
|
24
|
+
}
|
|
25
|
+
function w(e) {
|
|
26
|
+
return e.querySelector("[data-formie-field-label]") || (e.querySelector("[data-formie-address-state-cp]") ? e.querySelector(":scope > .heading > label") : null);
|
|
27
|
+
}
|
|
28
|
+
function T(e) {
|
|
29
|
+
e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
30
|
+
}
|
|
31
|
+
function E(e, t) {
|
|
32
|
+
if (!(e instanceof HTMLSelectElement)) return;
|
|
33
|
+
let n = e._formieTomSelect;
|
|
34
|
+
n && n.getValue() !== t && n.setValue(t, !0);
|
|
35
|
+
}
|
|
36
|
+
function D(e, t) {
|
|
37
|
+
let n = e.value;
|
|
38
|
+
e.value = t, E(e, e.value), e.value !== n && T(e);
|
|
39
|
+
}
|
|
40
|
+
function O(e, t) {
|
|
41
|
+
e.autofillAnchor && (e.autofillAnchor.value = t);
|
|
42
|
+
}
|
|
43
|
+
function k(e) {
|
|
44
|
+
let t = e.autofillAnchor?.value?.trim() || "", n = e.stateControl.value?.trim() || "", r = t || n;
|
|
45
|
+
r && (e.pendingStateValue = r);
|
|
46
|
+
}
|
|
47
|
+
function A(e) {
|
|
48
|
+
return e.pendingStateValue?.trim() || e.autofillAnchor?.value?.trim() || e.stateControl.value?.trim() || "";
|
|
49
|
+
}
|
|
50
|
+
function ee(e) {
|
|
51
|
+
if (e.autofillAnchor) return e.autofillAnchor;
|
|
52
|
+
let t = e.addressRoot.querySelector(d);
|
|
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", t.hidden = e.isCpEdit, 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 j(e) {
|
|
61
|
+
k(e);
|
|
62
|
+
let t = A(e);
|
|
63
|
+
if (!t) return;
|
|
64
|
+
let n = e.lastSubdivisions, r = e.stateControl instanceof HTMLSelectElement ? I(t, n) || "" : t;
|
|
65
|
+
O(e, r), e.pendingStateValue = r, D(e.stateControl, r);
|
|
66
|
+
}
|
|
67
|
+
function M(e, t, n, r) {
|
|
68
|
+
let i = new URL(/^https?:\/\//.test(e) || 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 N(e, t, n, r) {
|
|
72
|
+
return [
|
|
73
|
+
e,
|
|
74
|
+
t,
|
|
75
|
+
n,
|
|
76
|
+
r
|
|
77
|
+
].join("|");
|
|
78
|
+
}
|
|
79
|
+
function P(e) {
|
|
80
|
+
return y.has(e);
|
|
81
|
+
}
|
|
82
|
+
async function F(e, n, r, i, a) {
|
|
83
|
+
let o = N(e, n, r, i);
|
|
84
|
+
return y.has(o) ? y.get(o) || null : (b.has(o) || b.set(o, (async () => {
|
|
85
|
+
try {
|
|
86
|
+
let s = await t(M(i, e, n, r), { headers: { Accept: "application/json" } }, a);
|
|
87
|
+
if (!s.ok) return y.set(o, null), null;
|
|
88
|
+
let c = await s.json();
|
|
89
|
+
return y.set(o, c), c;
|
|
90
|
+
} catch (t) {
|
|
91
|
+
return v.warn("Failed fetching subdivisions.", {
|
|
92
|
+
country: e,
|
|
93
|
+
error: t
|
|
94
|
+
}), y.set(o, null), null;
|
|
95
|
+
} finally {
|
|
96
|
+
b.delete(o);
|
|
97
|
+
}
|
|
98
|
+
})()), b.get(o) || null);
|
|
99
|
+
}
|
|
100
|
+
function I(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 L(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-cp",
|
|
119
|
+
"data-formie-address-state-hide-when-unused",
|
|
120
|
+
"data-formie-address-state-use-searchable",
|
|
121
|
+
"data-formie-address-state-use-datalist",
|
|
122
|
+
"data-formie-address-state-option-label",
|
|
123
|
+
"data-formie-address-state-option-value"
|
|
124
|
+
].forEach((n) => {
|
|
125
|
+
let r = e.getAttribute(n);
|
|
126
|
+
if (r === null) {
|
|
127
|
+
t.removeAttribute(n);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
t.setAttribute(n, r);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function R(e, t) {
|
|
134
|
+
t.className = e.hasAttribute("data-formie-address-state-cp") ? "text fullwidth" : e.className;
|
|
135
|
+
}
|
|
136
|
+
function z(e, t) {
|
|
137
|
+
let n = [...g];
|
|
138
|
+
i(e, "fieldControlError").forEach((t) => {
|
|
139
|
+
e.classList.contains(t) && n.push(t);
|
|
140
|
+
}), t.className = n.join(" ");
|
|
141
|
+
}
|
|
142
|
+
function B(e, t) {
|
|
143
|
+
return e.parentNode?.replaceChild(t, e), t;
|
|
144
|
+
}
|
|
145
|
+
function V(e, t) {
|
|
146
|
+
let n = document.createElement("input");
|
|
147
|
+
return n.type = "text", L(e, n), R(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;
|
|
148
|
+
}
|
|
149
|
+
function H(e, t, n, r = "") {
|
|
150
|
+
e.innerHTML = "";
|
|
151
|
+
let i = document.createElement("option");
|
|
152
|
+
i.value = "", i.textContent = n || "", e.appendChild(i), t.forEach((t) => {
|
|
153
|
+
let n = document.createElement("option");
|
|
154
|
+
n.value = t.value, n.textContent = t.label, e.appendChild(n);
|
|
155
|
+
}), e.value = I(r, t) || r;
|
|
156
|
+
}
|
|
157
|
+
function U(e, t, n, r) {
|
|
158
|
+
let i = document.createElement("select");
|
|
159
|
+
return L(e, i), z(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"), H(i, n, r, t), i;
|
|
160
|
+
}
|
|
161
|
+
function W(e, t, n, r) {
|
|
162
|
+
let i = e.list;
|
|
163
|
+
if (!r || n.length === 0) {
|
|
164
|
+
e.removeAttribute("list"), i && i.remove();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
let a = e.ownerDocument.getElementById(t);
|
|
168
|
+
a || (a = e.ownerDocument.createElement("datalist"), a.id = t, e.insertAdjacentElement("afterend", a)), a.innerHTML = "", n.forEach((t) => {
|
|
169
|
+
let n = e.ownerDocument.createElement("option");
|
|
170
|
+
n.value = t.label, a?.appendChild(n);
|
|
171
|
+
}), e.setAttribute("list", t);
|
|
172
|
+
}
|
|
173
|
+
function G(e, t) {
|
|
174
|
+
let { stateField: n, stateControl: i, required: a } = e;
|
|
175
|
+
if (r(n, n, "conditionalHidden", !t), n.toggleAttribute("data-formie-address-state-hidden", !t), !t) {
|
|
176
|
+
i.required = !1, i.disabled = !e.isCpEdit;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
i.disabled = !1, i.required = a;
|
|
180
|
+
}
|
|
181
|
+
function K(e) {
|
|
182
|
+
if (e.fetchingAnnouncementEl) return e.fetchingAnnouncementEl;
|
|
183
|
+
let t = document.createElement("div");
|
|
184
|
+
return t.className = e.isCpEdit ? "visually-hidden" : "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;
|
|
185
|
+
}
|
|
186
|
+
function q() {
|
|
187
|
+
let e = document.createElement("div");
|
|
188
|
+
e.className = "formie-address-state-skeleton", e.setAttribute("data-formie-address-state-skeleton", "true"), e.setAttribute("aria-hidden", "true");
|
|
189
|
+
let t = document.createElement("div");
|
|
190
|
+
return t.className = "formie-address-state-skeleton-input", e.appendChild(t), e;
|
|
191
|
+
}
|
|
192
|
+
function J(e) {
|
|
193
|
+
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"), r(e.stateField, e.stateField, "conditionalHidden", !1), e.stateField.removeAttribute("data-formie-address-state-hidden"), e.stateField.setAttribute("data-formie-address-state-skeleton-active", "true");
|
|
194
|
+
let t = e.stateField.querySelector("[data-formie-field-control]");
|
|
195
|
+
t instanceof HTMLElement && (e.skeletonEl || (e.skeletonEl = q(), t.appendChild(e.skeletonEl)), e.skeletonEl.removeAttribute("hidden")), K(e).textContent = "Loading state or province options for the selected country.";
|
|
196
|
+
}
|
|
197
|
+
function Y(e) {
|
|
198
|
+
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 = "");
|
|
199
|
+
}
|
|
200
|
+
function X(e, t) {
|
|
201
|
+
let n = w(e);
|
|
202
|
+
if (!n) return;
|
|
203
|
+
let r = n.querySelector("[data-formie-field-required], .required");
|
|
204
|
+
n.textContent = t, r && n.appendChild(r);
|
|
205
|
+
}
|
|
206
|
+
function Z(e, t) {
|
|
207
|
+
e.setAttribute("data-formie-combobox-input", "true"), s(e, "combobox", "before-init", {
|
|
208
|
+
select: e,
|
|
209
|
+
options: { placeholder: t }
|
|
210
|
+
});
|
|
211
|
+
let n = c(e, { placeholder: t });
|
|
212
|
+
return s(e, "combobox", "after-init", {
|
|
213
|
+
combobox: e._formieTomSelect,
|
|
214
|
+
options: { placeholder: t }
|
|
215
|
+
}), n;
|
|
216
|
+
}
|
|
217
|
+
async function Q(t, n) {
|
|
218
|
+
let { hideWhenUnused: r = !0, useSearchable: i = !0, useDatalist: a = !0, optionLabel: o = "name", optionValue: s = "name", placeholder: c = null, subdivisionsAction: l = h } = n, u = t.countryControl?.value?.trim() || "";
|
|
219
|
+
k(t);
|
|
220
|
+
let d = A(t), f = t.isCpEdit && !!d && u === t.initialCountry && d === t.initialValue, p = ++t.fetchGeneration;
|
|
221
|
+
if (t.comboboxCleanup?.(), t.comboboxCleanup = null, !u) {
|
|
222
|
+
if (X(t.stateField, t.stateField.dataset.formieAddressStateDefaultLabel || "State / Province"), Y(t), r && !f) {
|
|
223
|
+
G(t, !1), D(t.stateControl, ""), O(t, ""), t.pendingStateValue = "", t.lastSubdivisions = [];
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (G(t, !0), t.stateControl instanceof HTMLSelectElement) {
|
|
227
|
+
let e = V(t.stateControl, d);
|
|
228
|
+
t.stateControl = B(t.stateControl, e);
|
|
229
|
+
} else t.stateControl.disabled = !t.isCpEdit && !f, t.stateControl.placeholder = c || t.stateControl.placeholder;
|
|
230
|
+
t.lastSubdivisions = [];
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
P(N(u, o, s, l)) || J(t);
|
|
234
|
+
let m = await F(u, o, s, l, e(t.addressRoot.closest("form")));
|
|
235
|
+
if (p !== t.fetchGeneration) return;
|
|
236
|
+
let g = [...m?.subdivisions || []];
|
|
237
|
+
f && g.length && !I(d, g) && g.push({
|
|
238
|
+
label: d,
|
|
239
|
+
value: d
|
|
240
|
+
});
|
|
241
|
+
let _ = m?.administrativeAreaUsed ?? !0, v = m?.administrativeAreaLabel || "State / Province";
|
|
242
|
+
if (t.lastSubdivisions = g, Y(t), r && !_ && !f) {
|
|
243
|
+
G(t, !1), D(t.stateControl, ""), O(t, ""), t.pendingStateValue = "";
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (G(t, !0), X(t.stateField, v), g.length > 0) {
|
|
247
|
+
let e = t.stateControl instanceof HTMLSelectElement ? t.stateControl : U(t.stateControl, d, g, c);
|
|
248
|
+
t.stateControl === e ? (z(t.stateControl, e), H(e, g, c, e.value)) : t.stateControl = B(t.stateControl, e), i ? t.comboboxCleanup = Z(e, c) : e.removeAttribute("data-formie-combobox-input"), D(e, I(d, g) || d), j(t);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
let y = t.stateControl instanceof HTMLInputElement ? t.stateControl : V(t.stateControl, d);
|
|
252
|
+
t.stateControl !== y && (t.stateControl = B(t.stateControl, y)), y.disabled = !1, W(y, t.datalistId, g, a), D(y, d), j(t);
|
|
253
|
+
}
|
|
254
|
+
function te(e, t) {
|
|
255
|
+
let n = () => {
|
|
256
|
+
k(e), e.countryControl?.value?.trim() && (e.lastCountry = "", Q(e, t).then(() => {
|
|
257
|
+
j(e);
|
|
258
|
+
}));
|
|
259
|
+
};
|
|
260
|
+
_.forEach((t) => {
|
|
261
|
+
let r = window.setTimeout(n, t);
|
|
262
|
+
e.autofillSweepTimers.push(r);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function $(e) {
|
|
266
|
+
e.countryChangeTimer !== null && (window.clearTimeout(e.countryChangeTimer), e.countryChangeTimer = null), e.autofillSweepTimers.forEach((e) => {
|
|
267
|
+
window.clearTimeout(e);
|
|
268
|
+
}), e.autofillSweepTimers = [];
|
|
269
|
+
}
|
|
270
|
+
function ne(e, t) {
|
|
271
|
+
let n = x(e);
|
|
272
|
+
if (!n) return v.warn("Address root not found; skipping field."), () => {};
|
|
273
|
+
let r = C(e);
|
|
274
|
+
if (!r) return v.warn("Dynamic state control not found; skipping field."), () => {};
|
|
275
|
+
let i = w(e);
|
|
276
|
+
i && !e.dataset.formieAddressStateDefaultLabel && (e.dataset.formieAddressStateDefaultLabel = i.textContent?.trim() || "State / Province");
|
|
277
|
+
let a = {
|
|
278
|
+
addressRoot: n,
|
|
279
|
+
isCpEdit: r.hasAttribute("data-formie-address-state-cp"),
|
|
280
|
+
initialCountry: S(n)?.value?.trim() || "",
|
|
281
|
+
initialValue: r.value?.trim() || "",
|
|
282
|
+
stateField: e,
|
|
283
|
+
stateControl: r,
|
|
284
|
+
countryControl: S(n),
|
|
285
|
+
autofillAnchor: null,
|
|
286
|
+
pendingStateValue: r.value?.trim() || "",
|
|
287
|
+
datalistId: `formie-address-state-datalist-${r.getAttribute("data-formie-input-id") || Math.random().toString(36).slice(2)}`,
|
|
288
|
+
comboboxCleanup: null,
|
|
289
|
+
skeletonEl: null,
|
|
290
|
+
fetchingAnnouncementEl: null,
|
|
291
|
+
autofillSweepTimers: [],
|
|
292
|
+
countryChangeTimer: null,
|
|
293
|
+
lastCountry: "",
|
|
294
|
+
fetchGeneration: 0,
|
|
295
|
+
required: r.required,
|
|
296
|
+
lastSubdivisions: []
|
|
297
|
+
}, o = r.value, s = e.closest("form"), c = !1, d = null;
|
|
298
|
+
ee(a);
|
|
299
|
+
let p = (e = !1) => {
|
|
300
|
+
let n = a.countryControl?.value?.trim() || "";
|
|
301
|
+
if (!e && n === a.lastCountry) return;
|
|
302
|
+
let r = a.lastCountry, i = A(a);
|
|
303
|
+
a.lastCountry = n, Q(a, t).then(() => {
|
|
304
|
+
j(a), r && n && r !== n && !I(i, a.lastSubdivisions) && !A(a) && (D(a.stateControl, ""), O(a, ""));
|
|
305
|
+
});
|
|
306
|
+
}, m = () => {
|
|
307
|
+
a.countryChangeTimer !== null && window.clearTimeout(a.countryChangeTimer), a.countryChangeTimer = window.setTimeout(() => {
|
|
308
|
+
a.countryChangeTimer = null, k(a), p(!0);
|
|
309
|
+
}, 50);
|
|
310
|
+
}, h = (e) => {
|
|
311
|
+
let n = e.target;
|
|
312
|
+
if (!(n instanceof HTMLInputElement || n instanceof HTMLSelectElement)) return;
|
|
313
|
+
let r = n === a.autofillAnchor, i = n.matches(l) || n.matches(u);
|
|
314
|
+
if ((r || i) && (i && !r && (O(a, n.value), a.pendingStateValue = n.value), k(a), a.countryControl?.value?.trim())) {
|
|
315
|
+
if (a.lastSubdivisions.length > 0) {
|
|
316
|
+
j(a);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
a.lastCountry = "", Q(a, t).then(() => {
|
|
320
|
+
j(a);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}, g = (e) => {
|
|
324
|
+
if (e.animationName !== f) return;
|
|
325
|
+
let r = e.target;
|
|
326
|
+
(r instanceof HTMLInputElement || r instanceof HTMLSelectElement) && n.contains(r) && (k(a), a.countryControl?.value?.trim() && (a.lastCountry = "", Q(a, t).then(() => {
|
|
327
|
+
j(a);
|
|
328
|
+
})));
|
|
329
|
+
}, _ = (e) => {
|
|
330
|
+
let n = e.detail?.state?.trim();
|
|
331
|
+
if (!n) {
|
|
332
|
+
p();
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
a.pendingStateValue = n, O(a, n), Q(a, t).then(() => {
|
|
336
|
+
j(a), a.lastCountry = a.countryControl?.value?.trim() || "";
|
|
337
|
+
});
|
|
338
|
+
}, y = (e) => {
|
|
339
|
+
d !== null && window.clearTimeout(d), d = window.setTimeout(() => {
|
|
340
|
+
d = null, !(e.defaultPrevented || c) && ($(a), a.stateControl.value = "", a.pendingStateValue = o, O(a, o), p(!0));
|
|
341
|
+
}, 0);
|
|
342
|
+
};
|
|
343
|
+
return s?.addEventListener("reset", y), a.countryControl?.addEventListener("change", m), a.countryControl?.addEventListener("input", m), n.addEventListener("input", h), n.addEventListener("change", h), n.addEventListener("animationstart", g), n.addEventListener("formie:address:google:populate", _), n.addEventListener("formie:address:address-finder:populate", _), n.addEventListener("formie:address:loqate:populate", _), n.addEventListener("formie:address:place-kit:populate", _), p(!0), te(a, t), () => {
|
|
344
|
+
c = !0, d !== null && window.clearTimeout(d), a.fetchGeneration++, s?.removeEventListener("reset", y), $(a), Y(a), a.skeletonEl?.remove(), a.fetchingAnnouncementEl?.remove(), a.autofillAnchor?.remove(), a.comboboxCleanup?.(), a.countryControl?.removeEventListener("change", m), a.countryControl?.removeEventListener("input", m), n.removeEventListener("input", h), n.removeEventListener("change", h), n.removeEventListener("animationstart", g), n.removeEventListener("formie:address:google:populate", _), n.removeEventListener("formie:address:address-finder:populate", _), n.removeEventListener("formie:address:loqate:populate", _), n.removeEventListener("formie:address:place-kit:populate", _);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
var re = {
|
|
348
|
+
moduleId: `formie:${m}`,
|
|
349
|
+
version: 2,
|
|
350
|
+
surfaces: [
|
|
351
|
+
"server-rendered",
|
|
352
|
+
"client-rendered",
|
|
353
|
+
"cp-edit"
|
|
354
|
+
],
|
|
355
|
+
kind: "field",
|
|
356
|
+
match: (e) => !!e.target.querySelector(l),
|
|
357
|
+
setup: async (e) => {
|
|
358
|
+
let t = e.options || {}, n = o(e), r = n.map((e) => ne(e, t));
|
|
359
|
+
return v.log("Module setup.", { fieldCount: n.length }), { destroy: () => {
|
|
360
|
+
r.forEach((e) => e()), v.log("Module destroy.", { fieldCount: n.length });
|
|
361
|
+
} };
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
//#endregion
|
|
365
|
+
export { re as addressStateModule };
|