@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateBrowserValue } from '@verbb/formie-core';
|
|
1
2
|
import type { ValidationRuleDefinition } from '#validation/types';
|
|
2
3
|
|
|
3
4
|
const required: ValidationRuleDefinition = {
|
|
@@ -6,6 +7,18 @@ const required: ValidationRuleDefinition = {
|
|
|
6
7
|
return true;
|
|
7
8
|
}
|
|
8
9
|
|
|
10
|
+
if (input instanceof HTMLInputElement && input.type === 'file') {
|
|
11
|
+
if (input.files?.length) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const field = input.closest('[data-formie-field-handle]');
|
|
16
|
+
const name = input.name.replace(/\[\]$/, '');
|
|
17
|
+
|
|
18
|
+
return Array.from(field?.querySelectorAll<HTMLInputElement>('input[type="hidden"][data-formie-file-upload-asset-id]') || [])
|
|
19
|
+
.some((asset) => !asset.disabled && asset.name.startsWith(`${name}[`) && Number(asset.getAttribute('data-formie-file-upload-asset-id')) > 0);
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
if (input.type === 'checkbox' || input.type === 'radio') {
|
|
10
23
|
const checkboxInputs = input.form?.querySelectorAll(`[name="${input.name}"]:not([type="hidden"]):not([disabled])`) || [];
|
|
11
24
|
|
|
@@ -18,7 +31,7 @@ const required: ValidationRuleDefinition = {
|
|
|
18
31
|
return input instanceof HTMLInputElement ? input.checked : true;
|
|
19
32
|
}
|
|
20
33
|
|
|
21
|
-
return input.value
|
|
34
|
+
return validateBrowserValue(input.value, { type: 'required' }) === null;
|
|
22
35
|
},
|
|
23
36
|
message: ({ input, label, t }) => {
|
|
24
37
|
return input.getAttribute('data-formie-required-message')
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ValidationContext, ValidationInput } from '#validation/types';
|
|
2
|
+
import { isValidationSkipped } from '#validation/skip';
|
|
2
3
|
|
|
3
4
|
export function stripTags(value: string): string {
|
|
4
5
|
const doc = new DOMParser().parseFromString(value, 'text/html');
|
|
@@ -43,5 +44,8 @@ export function getComparableInput(ctx: ValidationContext): ValidationInput | nu
|
|
|
43
44
|
return null;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
return sourceField.
|
|
47
|
+
return Array.from(sourceField.querySelectorAll(ctx.config.fieldsSelector)).find((node): node is ValidationInput => {
|
|
48
|
+
return (node instanceof HTMLInputElement || node instanceof HTMLSelectElement || node instanceof HTMLTextAreaElement)
|
|
49
|
+
&& !isValidationSkipped(node);
|
|
50
|
+
}) ?? null;
|
|
47
51
|
}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
+
import { validateBrowserValue } from '@verbb/formie-core';
|
|
1
2
|
import type { ValidationRuleDefinition } from '#validation/types';
|
|
2
3
|
|
|
3
4
|
const url: ValidationRuleDefinition = {
|
|
4
5
|
rule: ({ input, getRule }) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
new URL(input.value);
|
|
11
|
-
return true;
|
|
12
|
-
} catch {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
6
|
+
const rule = getRule('url');
|
|
7
|
+
return !rule || validateBrowserValue(input.value, { ...(typeof rule === 'object' ? rule : {}), type: 'url' }) === null;
|
|
15
8
|
},
|
|
16
9
|
message: ({ input, label, t }) => {
|
|
17
10
|
return input.getAttribute('data-formie-pattern-url-message')
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controls marked with this attribute are not value carriers.
|
|
3
|
+
* The validator, live handlers, and match lookups all skip them.
|
|
4
|
+
*/
|
|
5
|
+
export const VALIDATION_SKIP_ATTR = 'data-formie-validation-skip';
|
|
6
|
+
|
|
7
|
+
export function isValidationSkipped(element: Element | null): boolean {
|
|
8
|
+
return !!element && element.hasAttribute(VALIDATION_SKIP_ATTR);
|
|
9
|
+
}
|
|
@@ -6,7 +6,10 @@ const PRESERVED_DISABLED_ATTR = 'data-formie-preserve-disabled';
|
|
|
6
6
|
const SUBMIT_READY_ATTR = 'data-formie-submit-ready';
|
|
7
7
|
|
|
8
8
|
function isSubmitReadinessEnabled(form: HTMLFormElement): boolean {
|
|
9
|
-
|
|
9
|
+
const value = form.dataset.formieDisableSubmitUntilValid?.trim().toLowerCase();
|
|
10
|
+
|
|
11
|
+
// Twig renders enabled boolean data attributes without a value.
|
|
12
|
+
return value === '' || value === 'true' || value === '1';
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
function getPrimarySubmitButtons(form: HTMLFormElement): HTMLButtonElement[] {
|
|
@@ -65,7 +68,11 @@ export function syncSubmitReadiness(form: HTMLFormElement, validator: FormieVali
|
|
|
65
68
|
button.setAttribute(SUBMIT_VALIDATION_DISABLED_ATTR, 'true');
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
// Observing `disabled` also catches external changes. Avoid scheduling
|
|
72
|
+
// another observer pass when the button already has the required state.
|
|
73
|
+
if (!button.disabled) {
|
|
74
|
+
button.disabled = true;
|
|
75
|
+
}
|
|
69
76
|
});
|
|
70
77
|
}
|
|
71
78
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ensureFieldErrorContainer } from '#core/field-error-container';
|
|
2
|
+
import {
|
|
3
|
+
clearFieldErrorAria,
|
|
4
|
+
setErrorMessageReference,
|
|
5
|
+
} from '#core/field-error-aria';
|
|
2
6
|
import { syncPageTabErrors } from '#core/page-tab-errors';
|
|
3
7
|
import rules from '#validation/rules';
|
|
4
8
|
import { applyErrorAriaLive, resolveValidationErrorAriaLive } from '#core/error-aria-live';
|
|
@@ -12,6 +16,7 @@ import type {
|
|
|
12
16
|
import { t } from '#utils/i18n';
|
|
13
17
|
import { getValidatorEventName } from '#utils/event-names';
|
|
14
18
|
import { createDebug } from '#utils/debug';
|
|
19
|
+
import { isValidationSkipped } from '#validation/skip';
|
|
15
20
|
|
|
16
21
|
type ValidatorDefinition = {
|
|
17
22
|
validate: (ctx: ValidationContext) => boolean;
|
|
@@ -42,44 +47,8 @@ function isValidationInput(node: Element | null): node is ValidationInput {
|
|
|
42
47
|
);
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (!current) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const filtered = current.split(/\s+/).filter((item) => {
|
|
53
|
-
return item !== describedById;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
if (filtered.length) {
|
|
57
|
-
input.setAttribute('aria-describedby', filtered.join(' '));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
input.removeAttribute('aria-describedby');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function appendDescribedBy(input: HTMLElement, describedById: string): void {
|
|
65
|
-
const current = (input.getAttribute('aria-describedby') || '').trim();
|
|
66
|
-
const items = current ? current.split(/\s+/) : [];
|
|
67
|
-
|
|
68
|
-
if (!items.includes(describedById)) {
|
|
69
|
-
items.push(describedById);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
input.setAttribute('aria-describedby', items.join(' ').trim());
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function setErrorMessageReference(input: HTMLElement, errorMessageId: string): void {
|
|
76
|
-
input.setAttribute('aria-errormessage', errorMessageId);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function clearErrorMessageReference(input: HTMLElement, errorMessageId: string): void {
|
|
80
|
-
if (input.getAttribute('aria-errormessage') === errorMessageId) {
|
|
81
|
-
input.removeAttribute('aria-errormessage');
|
|
82
|
-
}
|
|
50
|
+
function isPainted(element: HTMLElement): boolean {
|
|
51
|
+
return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length);
|
|
83
52
|
}
|
|
84
53
|
|
|
85
54
|
export class FormieValidator {
|
|
@@ -142,13 +111,13 @@ export class FormieValidator {
|
|
|
142
111
|
|
|
143
112
|
inputs(inputOrSelector: Element | null = null): ValidationInput[] {
|
|
144
113
|
if (isValidationInput(inputOrSelector)) {
|
|
145
|
-
return [inputOrSelector];
|
|
114
|
+
return isValidationSkipped(inputOrSelector) ? [] : [inputOrSelector];
|
|
146
115
|
}
|
|
147
116
|
|
|
148
117
|
const root = inputOrSelector || this.form;
|
|
149
118
|
|
|
150
119
|
return Array.from(root.querySelectorAll(this.config.fieldsSelector)).filter((input): input is ValidationInput => {
|
|
151
|
-
return isValidationInput(input);
|
|
120
|
+
return isValidationInput(input) && !isValidationSkipped(input);
|
|
152
121
|
});
|
|
153
122
|
}
|
|
154
123
|
|
|
@@ -266,7 +235,11 @@ export class FormieValidator {
|
|
|
266
235
|
}
|
|
267
236
|
|
|
268
237
|
const errorMessages = fieldContainer.querySelector('[data-formie-field-errors]') as HTMLElement | null;
|
|
269
|
-
|
|
238
|
+
// Capture message ids before nodes are removed so aria-errormessage / describedby
|
|
239
|
+
// can be cleared (querying after remove finds nothing).
|
|
240
|
+
const errorMessageIds = Array.from(fieldContainer.querySelectorAll('[data-formie-field-error]')).map((node) => {
|
|
241
|
+
return (node as HTMLElement).id;
|
|
242
|
+
}).filter(Boolean);
|
|
270
243
|
|
|
271
244
|
fieldContainer.querySelectorAll('[data-formie-field-error]').forEach((node) => {
|
|
272
245
|
node.remove();
|
|
@@ -283,18 +256,7 @@ export class FormieValidator {
|
|
|
283
256
|
element.classList.remove(...this.config.inputErrorClass);
|
|
284
257
|
}
|
|
285
258
|
element.removeAttribute('data-formie-input-has-error');
|
|
286
|
-
|
|
287
|
-
if (errorContainerId) {
|
|
288
|
-
removeDescribedBy(element, errorContainerId);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
fieldContainer.querySelectorAll('[data-formie-field-error]').forEach((errorNode) => {
|
|
292
|
-
const errorMessageId = (errorNode as HTMLElement).id;
|
|
293
|
-
|
|
294
|
-
if (errorMessageId) {
|
|
295
|
-
clearErrorMessageReference(element, errorMessageId);
|
|
296
|
-
}
|
|
297
|
-
});
|
|
259
|
+
clearFieldErrorAria(element, errorMessageIds);
|
|
298
260
|
});
|
|
299
261
|
|
|
300
262
|
// Nested field wrappers inherit error state so repeaters/groups can reflect
|
|
@@ -336,8 +298,10 @@ export class FormieValidator {
|
|
|
336
298
|
errorMessages.innerHTML = '';
|
|
337
299
|
|
|
338
300
|
const handle = fieldContainer.getAttribute('data-formie-field-handle') || 'field';
|
|
339
|
-
|
|
340
|
-
|
|
301
|
+
errorMessages.id = errorMessages.id || `${input.id || `${this.form.id}-${handle}`}-errors`;
|
|
302
|
+
// Use the rendered field's scoped region so matching handles in other
|
|
303
|
+
// forms cannot capture this control's accessible error reference.
|
|
304
|
+
const errorId = `${errorMessages.id}-1`;
|
|
341
305
|
applyErrorAriaLive(
|
|
342
306
|
errorMessages,
|
|
343
307
|
resolveValidationErrorAriaLive(this.config.errorAriaLive, this.submitted),
|
|
@@ -347,7 +311,6 @@ export class FormieValidator {
|
|
|
347
311
|
errorElement.setAttribute('data-formie-field-error', 'true');
|
|
348
312
|
errorElement.setAttribute(`data-formie-field-error-${validatorName}`, 'true');
|
|
349
313
|
errorElement.setAttribute('id', errorId);
|
|
350
|
-
errorElement.setAttribute('role', 'alert');
|
|
351
314
|
if (this.config.messageClass.length) {
|
|
352
315
|
errorElement.classList.add(...this.config.messageClass);
|
|
353
316
|
}
|
|
@@ -358,12 +321,17 @@ export class FormieValidator {
|
|
|
358
321
|
|
|
359
322
|
fieldContainer.querySelectorAll('input, select, textarea').forEach((fieldInput) => {
|
|
360
323
|
const element = fieldInput as HTMLElement;
|
|
324
|
+
|
|
325
|
+
if (isValidationSkipped(element)) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
361
329
|
element.setAttribute('aria-invalid', 'true');
|
|
362
330
|
if (this.config.inputErrorClass.length) {
|
|
363
331
|
element.classList.add(...this.config.inputErrorClass);
|
|
364
332
|
}
|
|
365
333
|
element.setAttribute('data-formie-input-has-error', 'true');
|
|
366
|
-
|
|
334
|
+
// Pair aria-errormessage + aria-describedby on the message id (#2946).
|
|
367
335
|
setErrorMessageReference(element, errorId);
|
|
368
336
|
});
|
|
369
337
|
|
|
@@ -509,11 +477,31 @@ export class FormieValidator {
|
|
|
509
477
|
return !!options.includeHiddenPages;
|
|
510
478
|
}
|
|
511
479
|
|
|
512
|
-
|
|
480
|
+
// Rich Text keeps the real <textarea> in a display:none wrapper while the
|
|
481
|
+
// contenteditable UI is painted. Geometry on the textarea is always zero,
|
|
482
|
+
// so validate against the editor host when present (#2947).
|
|
483
|
+
const field = element.closest('[data-formie-field-handle]');
|
|
484
|
+
const richTextHost = field?.querySelector('[data-formie-rich-text]');
|
|
485
|
+
|
|
486
|
+
if (richTextHost instanceof HTMLElement) {
|
|
487
|
+
return isPainted(richTextHost);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Searchable selects keep their value in a hidden native control. Its
|
|
491
|
+
// adjacent combobox determines whether that value is active for validation.
|
|
492
|
+
if (element instanceof HTMLSelectElement && element.hasAttribute('data-formie-combobox-input')) {
|
|
493
|
+
const combobox = element.nextElementSibling;
|
|
494
|
+
|
|
495
|
+
if (combobox instanceof HTMLElement && combobox.classList.contains('formie-combobox')) {
|
|
496
|
+
return isPainted(combobox);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
return isPainted(element);
|
|
513
501
|
}
|
|
514
502
|
|
|
515
503
|
blurHandler(event: Event): void {
|
|
516
|
-
if (!(event.target instanceof HTMLElement) || !isValidationInput(event.target) || !event.target.form?.isSameNode(this.form)) {
|
|
504
|
+
if (!(event.target instanceof HTMLElement) || !isValidationInput(event.target) || isValidationSkipped(event.target) || !event.target.form?.isSameNode(this.form)) {
|
|
517
505
|
return;
|
|
518
506
|
}
|
|
519
507
|
|
|
@@ -539,7 +527,7 @@ export class FormieValidator {
|
|
|
539
527
|
}
|
|
540
528
|
|
|
541
529
|
changeHandler(event: Event): void {
|
|
542
|
-
if (!(event.target instanceof HTMLElement) || !isValidationInput(event.target) || !event.target.form?.isSameNode(this.form)) {
|
|
530
|
+
if (!(event.target instanceof HTMLElement) || !isValidationInput(event.target) || isValidationSkipped(event.target) || !event.target.form?.isSameNode(this.form)) {
|
|
543
531
|
return;
|
|
544
532
|
}
|
|
545
533
|
|
|
@@ -570,7 +558,7 @@ export class FormieValidator {
|
|
|
570
558
|
}
|
|
571
559
|
|
|
572
560
|
inputHandler(event: Event): void {
|
|
573
|
-
if (!(event.target instanceof HTMLElement) || !isValidationInput(event.target) || !event.target.form?.isSameNode(this.form)) {
|
|
561
|
+
if (!(event.target instanceof HTMLElement) || !isValidationInput(event.target) || isValidationSkipped(event.target) || !event.target.form?.isSameNode(this.form)) {
|
|
574
562
|
return;
|
|
575
563
|
}
|
|
576
564
|
|
|
@@ -1,344 +0,0 @@
|
|
|
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-C0EuExSI.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 };
|