@verbb/formie-browser 1.0.0
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 +5 -0
- package/LICENSE.md +40 -0
- package/README.md +34 -0
- package/dist/chunks/address-finder-DfMCiW89.js +47 -0
- package/dist/chunks/api-CbqEMQT5.js +181 -0
- package/dist/chunks/api-DE7LfK-R.js +960 -0
- package/dist/chunks/api-DOfDzYC_.js +538 -0
- package/dist/chunks/async-B3DUf1GZ.js +26 -0
- package/dist/chunks/bpoint-Ciy3yY9Q.js +34 -0
- package/dist/chunks/calculations-CkYAqO_-.js +197 -0
- package/dist/chunks/captcha-eu-DnOWhMwr.js +43 -0
- package/dist/chunks/checkbox-radio-0x7Tc0br.js +197 -0
- package/dist/chunks/chunk-K6L4z4UQ.js +24 -0
- package/dist/chunks/conditions-4fXKhEJS.js +609 -0
- package/dist/chunks/date-picker-B6iZkjHS.js +6204 -0
- package/dist/chunks/debug-KnZeKYBI.js +39 -0
- package/dist/chunks/dist-D09GnXMW.js +2663 -0
- package/dist/chunks/event-names-DamGPtXR.js +51 -0
- package/dist/chunks/eway-DEAYcwT0.js +86 -0
- package/dist/chunks/field-references.keys-BpBZ_quS.js +24 -0
- package/dist/chunks/field-references.resolver-Ba6xhiJC.js +183 -0
- package/dist/chunks/file-upload-Bh63PQSE.js +430 -0
- package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +40 -0
- package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +47 -0
- package/dist/chunks/friendly-challenge-Dg8XkStd.js +1101 -0
- package/dist/chunks/go-cardless-CuND59rR.js +26 -0
- package/dist/chunks/google-address--uR8WDSm.js +208 -0
- package/dist/chunks/hcaptcha-CmaFUesv.js +72 -0
- package/dist/chunks/hidden-CYnZYple.js +36 -0
- package/dist/chunks/http-18nn97DZ.js +29 -0
- package/dist/chunks/i18n-vUh-KGiH.js +55 -0
- package/dist/chunks/loqate-BICNJlVK.js +97 -0
- package/dist/chunks/mollie-DwlsgHZ1.js +26 -0
- package/dist/chunks/moneris-B_IFZFTx.js +159 -0
- package/dist/chunks/opayo-U2x_TOII.js +192 -0
- package/dist/chunks/paddle-BqXFrc79.js +75 -0
- package/dist/chunks/paypal-Cn_DYGDb.js +121 -0
- package/dist/chunks/payway-Rnq796eC.js +75 -0
- package/dist/chunks/phone-country-B6Me4lK0.js +3317 -0
- package/dist/chunks/place-kit-ldUl-u9w.js +56 -0
- package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +1771 -0
- package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +72 -0
- package/dist/chunks/recaptcha-shared-DTI4qWVR.js +22 -0
- package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +49 -0
- package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +62 -0
- package/dist/chunks/recaptcha-v3-EAlWhnkX.js +33 -0
- package/dist/chunks/repeater-CXD1eLSn.js +151 -0
- package/dist/chunks/rich-text-DkmZRhGj.js +442 -0
- package/dist/chunks/scripts-BGD_iU_6.js +41 -0
- package/dist/chunks/sdk-B7u9fTlP.js +2103 -0
- package/dist/chunks/shared-DC6_1u8X.js +85 -0
- package/dist/chunks/signature-E9KyYXS1.js +765 -0
- package/dist/chunks/snaptcha-CCDunGeb.js +8 -0
- package/dist/chunks/square-BLqK51rS.js +61 -0
- package/dist/chunks/stripe-B8gHpZNC.js +273 -0
- package/dist/chunks/styles-BIh6g7V_.js +22 -0
- package/dist/chunks/summary-EcNE0cvg.js +191 -0
- package/dist/chunks/table-yxEDL6kA.js +124 -0
- package/dist/chunks/text-limit-D0H_Ca2c.js +179 -0
- package/dist/chunks/theme-classes-vSHpdCUO.js +59 -0
- package/dist/chunks/turnstile-DP0bdR7T.js +68 -0
- package/dist/chunks/utils-ByrEVYrJ.js +49584 -0
- package/dist/css/formie-base.css +78 -0
- package/dist/css/formie-theme.css +19 -0
- package/dist/css/formie.css +2 -0
- package/dist/css/theme/_buttons.css +249 -0
- package/dist/css/theme/_loading.css +37 -0
- package/dist/css/theme/_messages.css +39 -0
- package/dist/css/theme/_progress.css +62 -0
- package/dist/css/theme/_tokens.css +361 -0
- package/dist/css/theme/_typography.css +70 -0
- package/dist/css/theme/fields/_address.css +17 -0
- package/dist/css/theme/fields/_check-radio.css +108 -0
- package/dist/css/theme/fields/_file.css +58 -0
- package/dist/css/theme/fields/_group.css +13 -0
- package/dist/css/theme/fields/_input.css +48 -0
- package/dist/css/theme/fields/_nested.css +19 -0
- package/dist/css/theme/fields/_repeater.css +69 -0
- package/dist/css/theme/fields/_rich-text.css +201 -0
- package/dist/css/theme/fields/_select.css +37 -0
- package/dist/css/theme/fields/_signature.css +39 -0
- package/dist/css/theme/fields/_summary.css +53 -0
- package/dist/css/theme/fields/_table.css +121 -0
- package/dist/css/theme/fields/_text-limit.css +10 -0
- package/dist/css/theme/forms/_field.css +62 -0
- package/dist/css/theme/forms/_form.css +166 -0
- package/dist/css/theme/integrations/_payment-modal.css +32 -0
- package/dist/css/theme/integrations/_paypal.css +10 -0
- package/dist/css/theme/integrations/_payway.css +10 -0
- package/dist/css/theme/integrations/_stripe.css +24 -0
- package/dist/css/theme/utilities/_accessibility.css +13 -0
- package/dist/css/theme-base/_controls.css +41 -0
- package/dist/css/theme-base/_primitives.css +34 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3206 -0
- package/dist/js/compatibility/dom-adapter.d.ts +12 -0
- package/dist/js/compatibility/dom-adapter.d.ts.map +1 -0
- package/dist/js/compatibility/event-map.d.ts +25 -0
- package/dist/js/compatibility/event-map.d.ts.map +1 -0
- package/dist/js/compatibility/validator-adapter.d.ts +17 -0
- package/dist/js/compatibility/validator-adapter.d.ts.map +1 -0
- package/dist/js/contracts/client.d.ts +40 -0
- package/dist/js/contracts/client.d.ts.map +1 -0
- package/dist/js/contracts/common.d.ts +5 -0
- package/dist/js/contracts/common.d.ts.map +1 -0
- package/dist/js/contracts/modules.d.ts +47 -0
- package/dist/js/contracts/modules.d.ts.map +1 -0
- package/dist/js/contracts/schema.d.ts +79 -0
- package/dist/js/contracts/schema.d.ts.map +1 -0
- package/dist/js/contracts/theme.d.ts +2 -0
- package/dist/js/contracts/theme.d.ts.map +1 -0
- package/dist/js/core/create-formie-client.d.ts +3 -0
- package/dist/js/core/create-formie-client.d.ts.map +1 -0
- package/dist/js/core/dom-events.d.ts +2 -0
- package/dist/js/core/dom-events.d.ts.map +1 -0
- package/dist/js/core/formie.d.ts +27 -0
- package/dist/js/core/formie.d.ts.map +1 -0
- package/dist/js/core/hydrate-modules.d.ts +22 -0
- package/dist/js/core/hydrate-modules.d.ts.map +1 -0
- package/dist/js/core/page-client-event.d.ts +9 -0
- package/dist/js/core/page-client-event.d.ts.map +1 -0
- package/dist/js/core/page-tab-errors.d.ts +2 -0
- package/dist/js/core/page-tab-errors.d.ts.map +1 -0
- package/dist/js/core/submit-flow.d.ts +21 -0
- package/dist/js/core/submit-flow.d.ts.map +1 -0
- package/dist/js/core/submit-result-state.d.ts +8 -0
- package/dist/js/core/submit-result-state.d.ts.map +1 -0
- package/dist/js/core/submit-result-ui.d.ts +10 -0
- package/dist/js/core/submit-result-ui.d.ts.map +1 -0
- package/dist/js/events/event-bus.d.ts +21 -0
- package/dist/js/events/event-bus.d.ts.map +1 -0
- package/dist/js/modules/address/address-finder.d.ts +2 -0
- package/dist/js/modules/address/address-finder.d.ts.map +1 -0
- package/dist/js/modules/address/api.d.ts +8 -0
- package/dist/js/modules/address/api.d.ts.map +1 -0
- package/dist/js/modules/address/constants.d.ts +15 -0
- package/dist/js/modules/address/constants.d.ts.map +1 -0
- package/dist/js/modules/address/factories.d.ts +35 -0
- package/dist/js/modules/address/factories.d.ts.map +1 -0
- package/dist/js/modules/address/google-address.d.ts +2 -0
- package/dist/js/modules/address/google-address.d.ts.map +1 -0
- package/dist/js/modules/address/host.d.ts +30 -0
- package/dist/js/modules/address/host.d.ts.map +1 -0
- package/dist/js/modules/address/index.d.ts +3 -0
- package/dist/js/modules/address/index.d.ts.map +1 -0
- package/dist/js/modules/address/loqate.d.ts +2 -0
- package/dist/js/modules/address/loqate.d.ts.map +1 -0
- package/dist/js/modules/address/place-kit.d.ts +2 -0
- package/dist/js/modules/address/place-kit.d.ts.map +1 -0
- package/dist/js/modules/captchas/api.d.ts +9 -0
- package/dist/js/modules/captchas/api.d.ts.map +1 -0
- package/dist/js/modules/captchas/captcha-eu.d.ts +2 -0
- package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -0
- package/dist/js/modules/captchas/constants.d.ts +5 -0
- package/dist/js/modules/captchas/constants.d.ts.map +1 -0
- package/dist/js/modules/captchas/factories.d.ts +63 -0
- package/dist/js/modules/captchas/factories.d.ts.map +1 -0
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +2 -0
- package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -0
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +2 -0
- package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -0
- package/dist/js/modules/captchas/hcaptcha.d.ts +2 -0
- package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -0
- package/dist/js/modules/captchas/host.d.ts +78 -0
- package/dist/js/modules/captchas/host.d.ts.map +1 -0
- package/dist/js/modules/captchas/index.d.ts +3 -0
- package/dist/js/modules/captchas/index.d.ts.map +1 -0
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +2 -0
- package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -0
- package/dist/js/modules/captchas/recaptcha-shared.d.ts +26 -0
- package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -0
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +2 -0
- package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -0
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +2 -0
- package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -0
- package/dist/js/modules/captchas/recaptcha-v3.d.ts +2 -0
- package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -0
- package/dist/js/modules/captchas/snaptcha.d.ts +2 -0
- package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -0
- package/dist/js/modules/captchas/turnstile.d.ts +2 -0
- package/dist/js/modules/captchas/turnstile.d.ts.map +1 -0
- package/dist/js/modules/captchas/utils.d.ts +13 -0
- package/dist/js/modules/captchas/utils.d.ts.map +1 -0
- package/dist/js/modules/fields/calculations.d.ts +3 -0
- package/dist/js/modules/fields/calculations.d.ts.map +1 -0
- package/dist/js/modules/fields/checkbox-radio.d.ts +3 -0
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/config.d.ts +5 -0
- package/dist/js/modules/fields/conditions/config.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/effects.d.ts +2 -0
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/evaluator.d.ts +6 -0
- package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/references.d.ts +5 -0
- package/dist/js/modules/fields/conditions/references.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/transforms.d.ts +3 -0
- package/dist/js/modules/fields/conditions/transforms.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/types.d.ts +30 -0
- package/dist/js/modules/fields/conditions/types.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions/values.d.ts +5 -0
- package/dist/js/modules/fields/conditions/values.d.ts.map +1 -0
- package/dist/js/modules/fields/conditions.d.ts +3 -0
- package/dist/js/modules/fields/conditions.d.ts.map +1 -0
- package/dist/js/modules/fields/date-picker.d.ts +3 -0
- package/dist/js/modules/fields/date-picker.d.ts.map +1 -0
- package/dist/js/modules/fields/file-upload.d.ts +3 -0
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -0
- package/dist/js/modules/fields/hidden.d.ts +3 -0
- package/dist/js/modules/fields/hidden.d.ts.map +1 -0
- package/dist/js/modules/fields/index.d.ts +3 -0
- package/dist/js/modules/fields/index.d.ts.map +1 -0
- package/dist/js/modules/fields/phone-country.d.ts +3 -0
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -0
- package/dist/js/modules/fields/repeater.d.ts +3 -0
- package/dist/js/modules/fields/repeater.d.ts.map +1 -0
- package/dist/js/modules/fields/rich-text.d.ts +3 -0
- package/dist/js/modules/fields/rich-text.d.ts.map +1 -0
- package/dist/js/modules/fields/shared.d.ts +20 -0
- package/dist/js/modules/fields/shared.d.ts.map +1 -0
- package/dist/js/modules/fields/signature.d.ts +3 -0
- package/dist/js/modules/fields/signature.d.ts.map +1 -0
- package/dist/js/modules/fields/summary.d.ts +3 -0
- package/dist/js/modules/fields/summary.d.ts.map +1 -0
- package/dist/js/modules/fields/table.d.ts +3 -0
- package/dist/js/modules/fields/table.d.ts.map +1 -0
- package/dist/js/modules/fields/text-limit.d.ts +3 -0
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -0
- package/dist/js/modules/loader.d.ts +11 -0
- package/dist/js/modules/loader.d.ts.map +1 -0
- package/dist/js/modules/payments/api.d.ts +8 -0
- package/dist/js/modules/payments/api.d.ts.map +1 -0
- package/dist/js/modules/payments/bpoint.d.ts +2 -0
- package/dist/js/modules/payments/bpoint.d.ts.map +1 -0
- package/dist/js/modules/payments/constants.d.ts +5 -0
- package/dist/js/modules/payments/constants.d.ts.map +1 -0
- package/dist/js/modules/payments/eway.d.ts +9 -0
- package/dist/js/modules/payments/eway.d.ts.map +1 -0
- package/dist/js/modules/payments/factories.d.ts +54 -0
- package/dist/js/modules/payments/factories.d.ts.map +1 -0
- package/dist/js/modules/payments/go-cardless.d.ts +2 -0
- package/dist/js/modules/payments/go-cardless.d.ts.map +1 -0
- package/dist/js/modules/payments/host.d.ts +70 -0
- package/dist/js/modules/payments/host.d.ts.map +1 -0
- package/dist/js/modules/payments/index.d.ts +3 -0
- package/dist/js/modules/payments/index.d.ts.map +1 -0
- package/dist/js/modules/payments/mollie.d.ts +2 -0
- package/dist/js/modules/payments/mollie.d.ts.map +1 -0
- package/dist/js/modules/payments/moneris.d.ts +2 -0
- package/dist/js/modules/payments/moneris.d.ts.map +1 -0
- package/dist/js/modules/payments/opayo.d.ts +25 -0
- package/dist/js/modules/payments/opayo.d.ts.map +1 -0
- package/dist/js/modules/payments/paddle.d.ts +2 -0
- package/dist/js/modules/payments/paddle.d.ts.map +1 -0
- package/dist/js/modules/payments/paypal.d.ts +2 -0
- package/dist/js/modules/payments/paypal.d.ts.map +1 -0
- package/dist/js/modules/payments/payway.d.ts +2 -0
- package/dist/js/modules/payments/payway.d.ts.map +1 -0
- package/dist/js/modules/payments/square.d.ts +2 -0
- package/dist/js/modules/payments/square.d.ts.map +1 -0
- package/dist/js/modules/payments/stripe.d.ts +2 -0
- package/dist/js/modules/payments/stripe.d.ts.map +1 -0
- package/dist/js/modules/payments/utils.d.ts +17 -0
- package/dist/js/modules/payments/utils.d.ts.map +1 -0
- package/dist/js/modules/registry.d.ts +9 -0
- package/dist/js/modules/registry.d.ts.map +1 -0
- package/dist/js/modules/styles.d.ts +2 -0
- package/dist/js/modules/styles.d.ts.map +1 -0
- package/dist/js/submit/pipeline.d.ts +18 -0
- package/dist/js/submit/pipeline.d.ts.map +1 -0
- package/dist/js/theme/theme-classes.d.ts +10 -0
- package/dist/js/theme/theme-classes.d.ts.map +1 -0
- package/dist/js/transport/forms-api.d.ts +11 -0
- package/dist/js/transport/forms-api.d.ts.map +1 -0
- package/dist/js/utils/async.d.ts +8 -0
- package/dist/js/utils/async.d.ts.map +1 -0
- package/dist/js/utils/debug.d.ts +10 -0
- package/dist/js/utils/debug.d.ts.map +1 -0
- package/dist/js/utils/event-names.d.ts +13 -0
- package/dist/js/utils/event-names.d.ts.map +1 -0
- package/dist/js/utils/field-references.d.ts +6 -0
- package/dist/js/utils/field-references.d.ts.map +1 -0
- package/dist/js/utils/field-references.keys.d.ts +4 -0
- package/dist/js/utils/field-references.keys.d.ts.map +1 -0
- package/dist/js/utils/field-references.parser.d.ts +3 -0
- package/dist/js/utils/field-references.parser.d.ts.map +1 -0
- package/dist/js/utils/field-references.registry.d.ts +3 -0
- package/dist/js/utils/field-references.registry.d.ts.map +1 -0
- package/dist/js/utils/field-references.resolver.d.ts +4 -0
- package/dist/js/utils/field-references.resolver.d.ts.map +1 -0
- package/dist/js/utils/field-references.types.d.ts +27 -0
- package/dist/js/utils/field-references.types.d.ts.map +1 -0
- package/dist/js/utils/fields.d.ts +5 -0
- package/dist/js/utils/fields.d.ts.map +1 -0
- package/dist/js/utils/http.d.ts +9 -0
- package/dist/js/utils/http.d.ts.map +1 -0
- package/dist/js/utils/i18n.d.ts +7 -0
- package/dist/js/utils/i18n.d.ts.map +1 -0
- package/dist/js/utils/scripts.d.ts +13 -0
- package/dist/js/utils/scripts.d.ts.map +1 -0
- package/dist/js/utils/unload-warning.d.ts +10 -0
- package/dist/js/utils/unload-warning.d.ts.map +1 -0
- package/dist/js/validation/rules/email.d.ts +4 -0
- package/dist/js/validation/rules/email.d.ts.map +1 -0
- package/dist/js/validation/rules/match.d.ts +4 -0
- package/dist/js/validation/rules/match.d.ts.map +1 -0
- package/dist/js/validation/rules/number.d.ts +4 -0
- package/dist/js/validation/rules/number.d.ts.map +1 -0
- package/dist/js/validation/rules/required.d.ts +4 -0
- package/dist/js/validation/rules/required.d.ts.map +1 -0
- package/dist/js/validation/rules/shared.d.ts +7 -0
- package/dist/js/validation/rules/shared.d.ts.map +1 -0
- package/dist/js/validation/rules/url.d.ts +4 -0
- package/dist/js/validation/rules/url.d.ts.map +1 -0
- package/dist/js/validation/rules.d.ts +10 -0
- package/dist/js/validation/rules.d.ts.map +1 -0
- package/dist/js/validation/types.d.ts +44 -0
- package/dist/js/validation/types.d.ts.map +1 -0
- package/dist/js/validation/validator.d.ts +53 -0
- package/dist/js/validation/validator.d.ts.map +1 -0
- package/package.json +78 -0
- package/src/css/formie-base.css +78 -0
- package/src/css/formie-theme.css +19 -0
- package/src/css/formie.css +2 -0
- package/src/css/theme/_buttons.css +249 -0
- package/src/css/theme/_loading.css +37 -0
- package/src/css/theme/_messages.css +39 -0
- package/src/css/theme/_progress.css +62 -0
- package/src/css/theme/_tokens.css +361 -0
- package/src/css/theme/_typography.css +70 -0
- package/src/css/theme/fields/_address.css +17 -0
- package/src/css/theme/fields/_check-radio.css +108 -0
- package/src/css/theme/fields/_file.css +58 -0
- package/src/css/theme/fields/_group.css +13 -0
- package/src/css/theme/fields/_input.css +48 -0
- package/src/css/theme/fields/_nested.css +19 -0
- package/src/css/theme/fields/_repeater.css +69 -0
- package/src/css/theme/fields/_rich-text.css +201 -0
- package/src/css/theme/fields/_select.css +37 -0
- package/src/css/theme/fields/_signature.css +39 -0
- package/src/css/theme/fields/_summary.css +53 -0
- package/src/css/theme/fields/_table.css +121 -0
- package/src/css/theme/fields/_text-limit.css +10 -0
- package/src/css/theme/forms/_field.css +62 -0
- package/src/css/theme/forms/_form.css +166 -0
- package/src/css/theme/integrations/_payment-modal.css +32 -0
- package/src/css/theme/integrations/_paypal.css +10 -0
- package/src/css/theme/integrations/_payway.css +10 -0
- package/src/css/theme/integrations/_stripe.css +24 -0
- package/src/css/theme/utilities/_accessibility.css +13 -0
- package/src/css/theme-base/_controls.css +41 -0
- package/src/css/theme-base/_primitives.css +34 -0
- package/src/icons/rich-text/aligncenter.svg +6 -0
- package/src/icons/rich-text/alignleft.svg +6 -0
- package/src/icons/rich-text/alignright.svg +6 -0
- package/src/icons/rich-text/bold.svg +4 -0
- package/src/icons/rich-text/clear.svg +6 -0
- package/src/icons/rich-text/code.svg +4 -0
- package/src/icons/rich-text/heading1.svg +3 -0
- package/src/icons/rich-text/heading2.svg +3 -0
- package/src/icons/rich-text/image.svg +6 -0
- package/src/icons/rich-text/italic.svg +5 -0
- package/src/icons/rich-text/line.svg +3 -0
- package/src/icons/rich-text/link.svg +4 -0
- package/src/icons/rich-text/olist.svg +8 -0
- package/src/icons/rich-text/paragraph.svg +3 -0
- package/src/icons/rich-text/quote.svg +4 -0
- package/src/icons/rich-text/strikethrough.svg +4 -0
- package/src/icons/rich-text/ulist.svg +8 -0
- package/src/icons/rich-text/underline.svg +4 -0
- package/src/index.ts +125 -0
- package/src/js/compatibility/dom-adapter.ts +129 -0
- package/src/js/compatibility/event-map.ts +72 -0
- package/src/js/compatibility/validator-adapter.ts +105 -0
- package/src/js/contracts/client.ts +43 -0
- package/src/js/contracts/common.ts +14 -0
- package/src/js/contracts/modules.ts +53 -0
- package/src/js/contracts/schema.ts +83 -0
- package/src/js/contracts/theme.ts +1 -0
- package/src/js/core/create-formie-client.ts +1519 -0
- package/src/js/core/dom-events.ts +8 -0
- package/src/js/core/formie.ts +242 -0
- package/src/js/core/hydrate-modules.ts +102 -0
- package/src/js/core/page-client-event.ts +129 -0
- package/src/js/core/page-tab-errors.ts +37 -0
- package/src/js/core/submit-flow.ts +120 -0
- package/src/js/core/submit-result-state.ts +597 -0
- package/src/js/core/submit-result-ui.ts +448 -0
- package/src/js/events/event-bus.ts +109 -0
- package/src/js/modules/address/address-finder.ts +85 -0
- package/src/js/modules/address/api.ts +22 -0
- package/src/js/modules/address/constants.ts +15 -0
- package/src/js/modules/address/factories.ts +203 -0
- package/src/js/modules/address/google-address.ts +345 -0
- package/src/js/modules/address/host.ts +137 -0
- package/src/js/modules/address/index.ts +10 -0
- package/src/js/modules/address/loqate.ts +128 -0
- package/src/js/modules/address/place-kit.ts +94 -0
- package/src/js/modules/captchas/api.ts +25 -0
- package/src/js/modules/captchas/captcha-eu.ts +86 -0
- package/src/js/modules/captchas/constants.ts +4 -0
- package/src/js/modules/captchas/factories.ts +485 -0
- package/src/js/modules/captchas/friendly-captcha-v1.ts +65 -0
- package/src/js/modules/captchas/friendly-captcha-v2.ts +84 -0
- package/src/js/modules/captchas/hcaptcha.ts +153 -0
- package/src/js/modules/captchas/host.ts +448 -0
- package/src/js/modules/captchas/index.ts +16 -0
- package/src/js/modules/captchas/recaptcha-enterprise.ts +138 -0
- package/src/js/modules/captchas/recaptcha-shared.ts +69 -0
- package/src/js/modules/captchas/recaptcha-v2-checkbox.ts +72 -0
- package/src/js/modules/captchas/recaptcha-v2-invisible.ts +108 -0
- package/src/js/modules/captchas/recaptcha-v3.ts +62 -0
- package/src/js/modules/captchas/snaptcha.ts +10 -0
- package/src/js/modules/captchas/turnstile.ts +131 -0
- package/src/js/modules/captchas/utils.ts +85 -0
- package/src/js/modules/fields/calculations.ts +273 -0
- package/src/js/modules/fields/checkbox-radio.ts +295 -0
- package/src/js/modules/fields/conditions/config.ts +79 -0
- package/src/js/modules/fields/conditions/effects.ts +166 -0
- package/src/js/modules/fields/conditions/evaluator.ts +44 -0
- package/src/js/modules/fields/conditions/references.ts +165 -0
- package/src/js/modules/fields/conditions/transforms.ts +206 -0
- package/src/js/modules/fields/conditions/types.ts +33 -0
- package/src/js/modules/fields/conditions/values.ts +115 -0
- package/src/js/modules/fields/conditions.ts +229 -0
- package/src/js/modules/fields/date-picker.ts +272 -0
- package/src/js/modules/fields/file-upload.ts +628 -0
- package/src/js/modules/fields/hidden.ts +58 -0
- package/src/js/modules/fields/index.ts +19 -0
- package/src/js/modules/fields/phone-country.ts +226 -0
- package/src/js/modules/fields/repeater.ts +231 -0
- package/src/js/modules/fields/rich-text.ts +217 -0
- package/src/js/modules/fields/shared.ts +238 -0
- package/src/js/modules/fields/signature.ts +202 -0
- package/src/js/modules/fields/summary.ts +272 -0
- package/src/js/modules/fields/table.ts +197 -0
- package/src/js/modules/fields/text-limit.ts +280 -0
- package/src/js/modules/loader.ts +331 -0
- package/src/js/modules/payments/api.ts +20 -0
- package/src/js/modules/payments/bpoint.ts +48 -0
- package/src/js/modules/payments/constants.ts +17 -0
- package/src/js/modules/payments/eway.ts +132 -0
- package/src/js/modules/payments/factories.ts +332 -0
- package/src/js/modules/payments/go-cardless.ts +37 -0
- package/src/js/modules/payments/host.ts +459 -0
- package/src/js/modules/payments/index.ts +17 -0
- package/src/js/modules/payments/mollie.ts +38 -0
- package/src/js/modules/payments/moneris.ts +216 -0
- package/src/js/modules/payments/opayo.ts +272 -0
- package/src/js/modules/payments/paddle.ts +111 -0
- package/src/js/modules/payments/payment.ts +183 -0
- package/src/js/modules/payments/paypal.ts +214 -0
- package/src/js/modules/payments/payway.ts +114 -0
- package/src/js/modules/payments/square.ts +106 -0
- package/src/js/modules/payments/stripe.ts +426 -0
- package/src/js/modules/payments/stub-payment-module.ts +87 -0
- package/src/js/modules/payments/utils.ts +60 -0
- package/src/js/modules/registry.ts +38 -0
- package/src/js/modules/styles.ts +29 -0
- package/src/js/submit/pipeline.ts +514 -0
- package/src/js/theme/theme-classes.ts +106 -0
- package/src/js/transport/forms-api.ts +345 -0
- package/src/js/utils/async.ts +81 -0
- package/src/js/utils/debug.ts +59 -0
- package/src/js/utils/event-names.ts +60 -0
- package/src/js/utils/field-references.keys.ts +47 -0
- package/src/js/utils/field-references.parser.ts +121 -0
- package/src/js/utils/field-references.registry.ts +50 -0
- package/src/js/utils/field-references.resolver.ts +115 -0
- package/src/js/utils/field-references.ts +11 -0
- package/src/js/utils/field-references.types.ts +31 -0
- package/src/js/utils/fields.ts +58 -0
- package/src/js/utils/http.ts +51 -0
- package/src/js/utils/i18n.ts +98 -0
- package/src/js/utils/scripts.ts +84 -0
- package/src/js/utils/unload-warning.ts +190 -0
- package/src/js/validation/rules/email.ts +18 -0
- package/src/js/validation/rules/match.ts +26 -0
- package/src/js/validation/rules/minmax.ts +47 -0
- package/src/js/validation/rules/number.ts +55 -0
- package/src/js/validation/rules/pattern.ts +29 -0
- package/src/js/validation/rules/required.ts +30 -0
- package/src/js/validation/rules/shared.ts +47 -0
- package/src/js/validation/rules/url.ts +23 -0
- package/src/js/validation/rules.ts +16 -0
- package/src/js/validation/types.ts +50 -0
- package/src/js/validation/validator.ts +643 -0
- package/src/vendor.d.ts +100 -0
- package/src/vite-env.d.ts +22 -0
- package/vite-dev.mjs +22 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export { createFormieClient } from '#core/create-formie-client';
|
|
2
|
+
export { hydrateFormieModules } from '#core/hydrate-modules';
|
|
3
|
+
export { formie } from '#core/formie';
|
|
4
|
+
export { ModuleRegistry } from '#modules/registry';
|
|
5
|
+
export { FormieValidator } from '#validation/validator';
|
|
6
|
+
export { bindLegacyDomEventCompatibility } from '#compatibility/dom-adapter';
|
|
7
|
+
export { bindLegacyValidatorCompatibility } from '#compatibility/validator-adapter';
|
|
8
|
+
export {
|
|
9
|
+
defineCaptchaModule,
|
|
10
|
+
definePassiveCaptchaModule,
|
|
11
|
+
} from '#modules/captchas/api';
|
|
12
|
+
export { definePaymentModule } from '#modules/payments/api';
|
|
13
|
+
export { defineAddressModule } from '#modules/address/api';
|
|
14
|
+
// Re-export the package surface from one root entry so external consumers can
|
|
15
|
+
// mount forms, register modules, and share contracts without reaching into internals.
|
|
16
|
+
export {
|
|
17
|
+
getFormieTranslations,
|
|
18
|
+
mergeFormieTranslations,
|
|
19
|
+
setFormieTranslations,
|
|
20
|
+
t,
|
|
21
|
+
translate,
|
|
22
|
+
} from '#utils/i18n';
|
|
23
|
+
export {
|
|
24
|
+
createDebug,
|
|
25
|
+
debugLog,
|
|
26
|
+
debugWarn,
|
|
27
|
+
isFormieDebugEnabled,
|
|
28
|
+
setFormieDebugEnabled,
|
|
29
|
+
} from '#utils/debug';
|
|
30
|
+
export {
|
|
31
|
+
LEGACY_FORMIE_DOM_EVENT_BRIDGES,
|
|
32
|
+
LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES,
|
|
33
|
+
resolveLegacyCompatibilityOptions,
|
|
34
|
+
} from '#compatibility/event-map';
|
|
35
|
+
export {
|
|
36
|
+
FORMIE_HTML_EVENT_NAMES,
|
|
37
|
+
getFieldModuleEventName,
|
|
38
|
+
getGlobalModuleLifecycleEventName,
|
|
39
|
+
getScopedModuleLifecycleEventName,
|
|
40
|
+
normalizeFormieEventName,
|
|
41
|
+
toDomEventName,
|
|
42
|
+
type ModuleLifecycleEventPhase,
|
|
43
|
+
} from '#utils/event-names';
|
|
44
|
+
export {
|
|
45
|
+
buildFieldValueRegistry,
|
|
46
|
+
fieldKeyToInputName,
|
|
47
|
+
inputNameToFieldKey,
|
|
48
|
+
normalizeFieldKey,
|
|
49
|
+
parseFieldReference,
|
|
50
|
+
resolveFieldReferenceFromFormData,
|
|
51
|
+
resolveFieldReferenceLive,
|
|
52
|
+
} from '#utils/field-references';
|
|
53
|
+
export type {
|
|
54
|
+
AddressModuleContext,
|
|
55
|
+
AddressModuleOptions,
|
|
56
|
+
AddressProviderModule,
|
|
57
|
+
AddressServices,
|
|
58
|
+
} from '#modules/address/api';
|
|
59
|
+
export type {
|
|
60
|
+
CaptchaModuleContext,
|
|
61
|
+
CaptchaModuleOptions,
|
|
62
|
+
CaptchaProviderModule,
|
|
63
|
+
CaptchaServices,
|
|
64
|
+
} from '#modules/captchas/api';
|
|
65
|
+
export type {
|
|
66
|
+
PaymentModuleContext,
|
|
67
|
+
PaymentModuleOptions,
|
|
68
|
+
PaymentProviderModule,
|
|
69
|
+
PaymentServices,
|
|
70
|
+
} from '#modules/payments/api';
|
|
71
|
+
export type {
|
|
72
|
+
FormieClient,
|
|
73
|
+
FormEventUnsubscribe,
|
|
74
|
+
FormieFormInstance,
|
|
75
|
+
FormMountOptions,
|
|
76
|
+
} from '#contracts/client';
|
|
77
|
+
export type { FormieModuleHydrator, FormieModuleHydratorOptions } from '#core/hydrate-modules';
|
|
78
|
+
export type { FormieApp, FormieElementTarget, FormieEvent, FormieOptions } from '#core/formie';
|
|
79
|
+
export type {
|
|
80
|
+
LegacyBridgeDisposition,
|
|
81
|
+
LegacyCompatibilityOptions,
|
|
82
|
+
LegacyDomEventBridge,
|
|
83
|
+
LegacyValidatorEventBridge,
|
|
84
|
+
ResolvedLegacyCompatibilityOptions,
|
|
85
|
+
} from '#compatibility/event-map';
|
|
86
|
+
export type { FormAction, FormMode, FormTransport, SubmitStage } from '#contracts/common';
|
|
87
|
+
export type {
|
|
88
|
+
FormieModuleDefinition,
|
|
89
|
+
FormieModuleInstance,
|
|
90
|
+
ModuleHookContext,
|
|
91
|
+
ModuleMatchContext,
|
|
92
|
+
ModuleRegistrationOptions,
|
|
93
|
+
ModuleSetupContext,
|
|
94
|
+
SubmitHookContext,
|
|
95
|
+
} from '#contracts/modules';
|
|
96
|
+
export type {
|
|
97
|
+
FormRefreshTokensPayload,
|
|
98
|
+
FormDefinitionField,
|
|
99
|
+
FormDefinitionPage,
|
|
100
|
+
FormDefinitionPayload,
|
|
101
|
+
FormEndpointPayload,
|
|
102
|
+
FormModuleManifest,
|
|
103
|
+
FormModuleTarget,
|
|
104
|
+
FormModuleTargetType,
|
|
105
|
+
FormRedirect,
|
|
106
|
+
FormSubmitResult,
|
|
107
|
+
} from '#contracts/schema';
|
|
108
|
+
export type { ThemeClassMap } from '#contracts/theme';
|
|
109
|
+
export type {
|
|
110
|
+
ValidationConfig,
|
|
111
|
+
ValidationContext,
|
|
112
|
+
ValidationError,
|
|
113
|
+
ValidationInput,
|
|
114
|
+
ValidationRuleDefinition,
|
|
115
|
+
ValidationRules,
|
|
116
|
+
ValidationRuleValue,
|
|
117
|
+
} from '#validation/types';
|
|
118
|
+
export type { TranslationReplacements } from '#utils/i18n';
|
|
119
|
+
export type {
|
|
120
|
+
FieldReferenceTransform,
|
|
121
|
+
FieldValueRegistry,
|
|
122
|
+
FieldValueRegistryEntry,
|
|
123
|
+
ParsedFieldReference,
|
|
124
|
+
ResolveFieldValueResult,
|
|
125
|
+
} from '#utils/field-references';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { FormieFormInstance } from '#contracts/client';
|
|
2
|
+
import {
|
|
3
|
+
LEGACY_FORMIE_DOM_EVENT_BRIDGES,
|
|
4
|
+
type LegacyDomEventBridge,
|
|
5
|
+
type ResolvedLegacyCompatibilityOptions,
|
|
6
|
+
} from '#compatibility/event-map';
|
|
7
|
+
import { toDomEventName } from '#utils/event-names';
|
|
8
|
+
|
|
9
|
+
type BindLegacyDomEventCompatibilityOptions = {
|
|
10
|
+
target: Element;
|
|
11
|
+
form: HTMLFormElement;
|
|
12
|
+
instance: FormieFormInstance;
|
|
13
|
+
options: ResolvedLegacyCompatibilityOptions;
|
|
14
|
+
unbinds: Array<() => void>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type SubmitResultLike = {
|
|
18
|
+
ok?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function dispatchLegacyDomEvent(target: Document | HTMLFormElement, legacyEvent: string, detail: unknown): void {
|
|
22
|
+
target.dispatchEvent(new CustomEvent(legacyEvent, {
|
|
23
|
+
bubbles: true,
|
|
24
|
+
detail,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function shouldDispatchBridge(bridge: LegacyDomEventBridge, detail: unknown): boolean {
|
|
29
|
+
if (bridge.canonicalEvent !== 'formie:submit:result') {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const result = detail as SubmitResultLike | null;
|
|
34
|
+
|
|
35
|
+
if (bridge.legacyEvent === 'onAfterFormieSubmit') {
|
|
36
|
+
return !!result?.ok;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (bridge.legacyEvent === 'onFormieSubmitError') {
|
|
40
|
+
return result?.ok === false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function createLegacyPageToggleDetail(form: HTMLFormElement, detail: unknown): unknown {
|
|
47
|
+
const eventDetail = detail && typeof detail === 'object' ? detail as Record<string, unknown> : {};
|
|
48
|
+
const nextPageId = typeof eventDetail.pageId === 'string' ? eventDetail.pageId : '';
|
|
49
|
+
const pages = Array.from(form.querySelectorAll<HTMLElement>('[data-formie-page-id]'));
|
|
50
|
+
const nextPageIndex = pages.findIndex((page) => {
|
|
51
|
+
return page.getAttribute('data-formie-page-id') === nextPageId;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
data: {
|
|
56
|
+
nextPageId,
|
|
57
|
+
nextPageIndex,
|
|
58
|
+
totalPages: pages.length,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function createLegacyDetail(
|
|
64
|
+
bridge: LegacyDomEventBridge,
|
|
65
|
+
detail: unknown,
|
|
66
|
+
target: Element,
|
|
67
|
+
form: HTMLFormElement,
|
|
68
|
+
instance: FormieFormInstance,
|
|
69
|
+
): unknown {
|
|
70
|
+
const legacyFormieApi = (globalThis as { Formie?: unknown }).Formie || instance;
|
|
71
|
+
|
|
72
|
+
if (bridge.legacyEvent === 'onFormieLoaded') {
|
|
73
|
+
return {
|
|
74
|
+
formie: legacyFormieApi,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (bridge.legacyEvent === 'onFormieInit') {
|
|
79
|
+
return {
|
|
80
|
+
formie: legacyFormieApi,
|
|
81
|
+
form: instance,
|
|
82
|
+
$form: form,
|
|
83
|
+
formId: instance.id,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (bridge.legacyEvent === 'onFormieReady') {
|
|
88
|
+
return {
|
|
89
|
+
...(detail && typeof detail === 'object' ? detail as Record<string, unknown> : {}),
|
|
90
|
+
form,
|
|
91
|
+
target,
|
|
92
|
+
instance,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (bridge.legacyEvent === 'onFormiePageToggle') {
|
|
97
|
+
return createLegacyPageToggleDetail(form, detail);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return detail;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function bindLegacyDomEventCompatibility({
|
|
104
|
+
target,
|
|
105
|
+
form,
|
|
106
|
+
instance,
|
|
107
|
+
options,
|
|
108
|
+
unbinds,
|
|
109
|
+
}: BindLegacyDomEventCompatibilityOptions): void {
|
|
110
|
+
if (!options.legacyDomEvents) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
LEGACY_FORMIE_DOM_EVENT_BRIDGES.forEach((bridge) => {
|
|
115
|
+
const handler = (event: Event) => {
|
|
116
|
+
if (!(event instanceof CustomEvent) || !shouldDispatchBridge(bridge, event.detail)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const legacyTarget = bridge.target === 'document' ? document : form;
|
|
121
|
+
dispatchLegacyDomEvent(legacyTarget, bridge.legacyEvent, createLegacyDetail(bridge, event.detail, target, form, instance));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
target.addEventListener(toDomEventName(bridge.canonicalEvent), handler as EventListener);
|
|
125
|
+
unbinds.push(() => {
|
|
126
|
+
target.removeEventListener(toDomEventName(bridge.canonicalEvent), handler as EventListener);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type LegacyBridgeDisposition = 'safe' | 'approximate';
|
|
2
|
+
|
|
3
|
+
export type LegacyCompatibilityOptions = boolean | {
|
|
4
|
+
legacyDomEvents?: boolean;
|
|
5
|
+
legacyValidatorEvents?: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ResolvedLegacyCompatibilityOptions = {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
legacyDomEvents: boolean;
|
|
11
|
+
legacyValidatorEvents: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type LegacyDomEventBridge = {
|
|
15
|
+
legacyEvent: string;
|
|
16
|
+
canonicalEvent: string;
|
|
17
|
+
disposition: LegacyBridgeDisposition;
|
|
18
|
+
target?: 'form' | 'document';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type LegacyValidatorEventBridge = {
|
|
22
|
+
legacyEvent: string;
|
|
23
|
+
canonicalEvent: string;
|
|
24
|
+
disposition: 'safe';
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const LEGACY_FORMIE_DOM_EVENT_BRIDGES: LegacyDomEventBridge[] = [
|
|
28
|
+
{ legacyEvent: 'onFormieLoaded', canonicalEvent: 'formie:mount:after', disposition: 'approximate', target: 'document' },
|
|
29
|
+
{ legacyEvent: 'onFormieInit', canonicalEvent: 'formie:mount:after', disposition: 'approximate', target: 'document' },
|
|
30
|
+
{ legacyEvent: 'onFormieReady', canonicalEvent: 'formie:mount:after', disposition: 'safe' },
|
|
31
|
+
{ legacyEvent: 'onAfterFormieSubmit', canonicalEvent: 'formie:submit:result', disposition: 'safe' },
|
|
32
|
+
{ legacyEvent: 'onFormieSubmitError', canonicalEvent: 'formie:submit:result', disposition: 'safe' },
|
|
33
|
+
{ legacyEvent: 'onFormiePageToggle', canonicalEvent: 'formie:page:navigate:after', disposition: 'safe' },
|
|
34
|
+
{ legacyEvent: 'onBeforeFormieSubmit', canonicalEvent: 'formie:submit:before', disposition: 'approximate' },
|
|
35
|
+
{ legacyEvent: 'onFormieValidate', canonicalEvent: 'formie:stage:validate:before', disposition: 'approximate' },
|
|
36
|
+
{ legacyEvent: 'onAfterFormieValidate', canonicalEvent: 'formie:stage:validate:after', disposition: 'approximate' },
|
|
37
|
+
{ legacyEvent: 'onFormieSubmit', canonicalEvent: 'formie:submit:after', disposition: 'approximate' },
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export const LEGACY_FORMIE_VALIDATOR_EVENT_BRIDGES: LegacyValidatorEventBridge[] = [
|
|
41
|
+
{ legacyEvent: 'formieValidatorInitialized', canonicalEvent: 'formie:validator:ready', disposition: 'safe' },
|
|
42
|
+
{ legacyEvent: 'formieValidatorDestroyed', canonicalEvent: 'formie:validator:destroy', disposition: 'safe' },
|
|
43
|
+
{ legacyEvent: 'formieValidatorShowError', canonicalEvent: 'formie:validator:show-error', disposition: 'safe' },
|
|
44
|
+
{ legacyEvent: 'formieValidatorClearError', canonicalEvent: 'formie:validator:clear-error', disposition: 'safe' },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export function resolveLegacyCompatibilityOptions(options: LegacyCompatibilityOptions | undefined): ResolvedLegacyCompatibilityOptions {
|
|
48
|
+
if (!options) {
|
|
49
|
+
return {
|
|
50
|
+
enabled: false,
|
|
51
|
+
legacyDomEvents: false,
|
|
52
|
+
legacyValidatorEvents: false,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (options === true) {
|
|
57
|
+
return {
|
|
58
|
+
enabled: true,
|
|
59
|
+
legacyDomEvents: true,
|
|
60
|
+
legacyValidatorEvents: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const legacyDomEvents = options.legacyDomEvents ?? true;
|
|
65
|
+
const legacyValidatorEvents = options.legacyValidatorEvents ?? true;
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
enabled: legacyDomEvents || legacyValidatorEvents,
|
|
69
|
+
legacyDomEvents,
|
|
70
|
+
legacyValidatorEvents,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { ResolvedLegacyCompatibilityOptions } from '#compatibility/event-map';
|
|
2
|
+
import type { FormieValidator } from '#validation/validator';
|
|
3
|
+
|
|
4
|
+
type ValidatorReadyDetail = {
|
|
5
|
+
validator: FormieValidator;
|
|
6
|
+
addValidator: FormieValidator['addValidator'];
|
|
7
|
+
removeValidator: FormieValidator['removeValidator'];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type BindLegacyValidatorCompatibilityOptions = {
|
|
11
|
+
target: Element;
|
|
12
|
+
form: HTMLFormElement;
|
|
13
|
+
validatorDetail: ValidatorReadyDetail | null;
|
|
14
|
+
options: ResolvedLegacyCompatibilityOptions;
|
|
15
|
+
unbinds: Array<() => void>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function dispatchLegacyValidatorEvent(target: Document | Element, legacyEvent: string, detail: unknown): void {
|
|
19
|
+
target.dispatchEvent(new CustomEvent(legacyEvent, {
|
|
20
|
+
bubbles: true,
|
|
21
|
+
detail,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function matchesValidator(detail: unknown, validator: FormieValidator): detail is { validator: FormieValidator } {
|
|
26
|
+
return !!detail && typeof detail === 'object' && (detail as { validator?: FormieValidator }).validator === validator;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function bindLegacyValidatorCompatibility({
|
|
30
|
+
target,
|
|
31
|
+
form,
|
|
32
|
+
validatorDetail,
|
|
33
|
+
options,
|
|
34
|
+
unbinds,
|
|
35
|
+
}: BindLegacyValidatorCompatibilityOptions): void {
|
|
36
|
+
if (!options.legacyValidatorEvents || !validatorDetail) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { validator, addValidator, removeValidator } = validatorDetail;
|
|
41
|
+
const baseDetail = {
|
|
42
|
+
...validatorDetail,
|
|
43
|
+
form,
|
|
44
|
+
target,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
dispatchLegacyValidatorEvent(document, 'formieValidatorInitialized', baseDetail);
|
|
48
|
+
|
|
49
|
+
const destroyHandler = (event: Event) => {
|
|
50
|
+
if (!(event instanceof CustomEvent) || !matchesValidator(event.detail, validator)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
dispatchLegacyValidatorEvent(document, 'formieValidatorDestroyed', {
|
|
55
|
+
...baseDetail,
|
|
56
|
+
...event.detail,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const showErrorHandler = (event: Event) => {
|
|
61
|
+
if (!(event instanceof CustomEvent) || !matchesValidator(event.detail, validator) || !(event.target instanceof Element)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!form.contains(event.target)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
dispatchLegacyValidatorEvent(event.target, 'formieValidatorShowError', {
|
|
70
|
+
...event.detail,
|
|
71
|
+
addValidator,
|
|
72
|
+
removeValidator,
|
|
73
|
+
form,
|
|
74
|
+
target,
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const clearErrorHandler = (event: Event) => {
|
|
79
|
+
if (!(event instanceof CustomEvent) || !matchesValidator(event.detail, validator) || !(event.target instanceof Element)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!form.contains(event.target)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
dispatchLegacyValidatorEvent(event.target, 'formieValidatorClearError', {
|
|
88
|
+
...event.detail,
|
|
89
|
+
addValidator,
|
|
90
|
+
removeValidator,
|
|
91
|
+
form,
|
|
92
|
+
target,
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
document.addEventListener('formie:validator:destroy', destroyHandler as EventListener);
|
|
97
|
+
document.addEventListener('formie:validator:show-error', showErrorHandler as EventListener);
|
|
98
|
+
document.addEventListener('formie:validator:clear-error', clearErrorHandler as EventListener);
|
|
99
|
+
|
|
100
|
+
unbinds.push(() => {
|
|
101
|
+
document.removeEventListener('formie:validator:destroy', destroyHandler as EventListener);
|
|
102
|
+
document.removeEventListener('formie:validator:show-error', showErrorHandler as EventListener);
|
|
103
|
+
document.removeEventListener('formie:validator:clear-error', clearErrorHandler as EventListener);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { LegacyCompatibilityOptions } from '#compatibility/event-map';
|
|
2
|
+
import type { FormAction, FormMode, FormTransport } from '#contracts/common';
|
|
3
|
+
import type { FormieModuleDefinition, ModuleRegistrationOptions } from '#contracts/modules';
|
|
4
|
+
import type { FormEndpointPayload, FormSubmitResult } from '#contracts/schema';
|
|
5
|
+
|
|
6
|
+
export type FormMountOptions = {
|
|
7
|
+
mode: FormMode;
|
|
8
|
+
transport?: FormTransport;
|
|
9
|
+
formHandle?: string;
|
|
10
|
+
endpoint?: string;
|
|
11
|
+
payload?: FormEndpointPayload;
|
|
12
|
+
staticCache?: boolean;
|
|
13
|
+
refreshTokens?: boolean;
|
|
14
|
+
locale?: string;
|
|
15
|
+
siteId?: number;
|
|
16
|
+
autoVisible?: boolean;
|
|
17
|
+
compatibility?: LegacyCompatibilityOptions;
|
|
18
|
+
theme?: 'formie' | 'none';
|
|
19
|
+
themeConfig?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type FormEventUnsubscribe = () => void;
|
|
23
|
+
|
|
24
|
+
export type FormieFormInstance = {
|
|
25
|
+
id: string;
|
|
26
|
+
root: Element;
|
|
27
|
+
submit: (action?: FormAction) => Promise<FormSubmitResult>;
|
|
28
|
+
destroy: () => Promise<void>;
|
|
29
|
+
on: (eventName: string, callback: (payload: unknown) => void) => FormEventUnsubscribe;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type FormieClient = {
|
|
33
|
+
mount: (target: Element, options: FormMountOptions) => Promise<FormieFormInstance>;
|
|
34
|
+
unmount: (target: Element) => Promise<void>;
|
|
35
|
+
update: (target: Element, options: Partial<FormMountOptions>) => Promise<FormieFormInstance>;
|
|
36
|
+
getInstance: (target: Element) => FormieFormInstance | null;
|
|
37
|
+
refreshForCache: (targetOrId: Element | string) => Promise<void>;
|
|
38
|
+
registerModule: (moduleDefinition: FormieModuleDefinition, options?: ModuleRegistrationOptions) => boolean;
|
|
39
|
+
unregisterModule: (moduleId: string) => void;
|
|
40
|
+
getRegisteredModules: () => FormieModuleDefinition[];
|
|
41
|
+
scan: (root?: ParentNode) => Promise<FormieFormInstance[]>;
|
|
42
|
+
observe: (root?: ParentNode) => () => void;
|
|
43
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type FormAction = 'submit' | 'back' | 'save';
|
|
2
|
+
|
|
3
|
+
export type FormMode = 'server-rendered' | 'client-rendered';
|
|
4
|
+
|
|
5
|
+
export type FormTransport = 'rest' | 'graphql';
|
|
6
|
+
|
|
7
|
+
export type SubmitStage =
|
|
8
|
+
| 'prepare'
|
|
9
|
+
| 'normalize'
|
|
10
|
+
| 'validate'
|
|
11
|
+
| 'screen'
|
|
12
|
+
| 'authorize'
|
|
13
|
+
| 'dispatch'
|
|
14
|
+
| 'finalize';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FormAction, FormMode, SubmitStage } from '#contracts/common';
|
|
2
|
+
import type { FormModuleManifest, FormModuleTargetType, FormSubmitResult } from '#contracts/schema';
|
|
3
|
+
|
|
4
|
+
export type ModuleMatchContext = {
|
|
5
|
+
root: Element;
|
|
6
|
+
form: HTMLFormElement | null;
|
|
7
|
+
target: Element;
|
|
8
|
+
scope: FormModuleTargetType;
|
|
9
|
+
mode: FormMode;
|
|
10
|
+
manifestItem: FormModuleManifest;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ModuleHookContext = {
|
|
14
|
+
formId: string;
|
|
15
|
+
root: Element;
|
|
16
|
+
form: HTMLFormElement | null;
|
|
17
|
+
target: Element;
|
|
18
|
+
scope: FormModuleTargetType;
|
|
19
|
+
state: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type ModuleSetupContext = ModuleHookContext & {
|
|
23
|
+
options?: Record<string, unknown>;
|
|
24
|
+
on: (eventName: string, callback: (payload: unknown) => void) => () => void;
|
|
25
|
+
emit: (eventName: string, payload?: unknown) => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ModuleRegistrationOptions = {
|
|
29
|
+
replace?: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type SubmitHookContext = {
|
|
33
|
+
form: HTMLFormElement;
|
|
34
|
+
stage: SubmitStage;
|
|
35
|
+
action: FormAction;
|
|
36
|
+
formData: FormData;
|
|
37
|
+
abort: (reason?: string) => void;
|
|
38
|
+
isAborted: () => boolean;
|
|
39
|
+
abortReason: () => string | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type FormieModuleInstance = {
|
|
43
|
+
destroy: () => void | Promise<void>;
|
|
44
|
+
onBeforeStage?: (ctx: SubmitHookContext) => void | Promise<void>;
|
|
45
|
+
onAfterStage?: (ctx: SubmitHookContext, result?: FormSubmitResult) => void | Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type FormieModuleDefinition = {
|
|
49
|
+
id: string;
|
|
50
|
+
kind: 'field' | 'captcha' | 'payment' | 'address' | 'core';
|
|
51
|
+
match: (ctx: ModuleMatchContext) => boolean;
|
|
52
|
+
setup: (ctx: ModuleSetupContext) => Promise<FormieModuleInstance | void>;
|
|
53
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { FormAction, SubmitStage } from '#contracts/common';
|
|
2
|
+
import type { ThemeClassMap } from '#contracts/theme';
|
|
3
|
+
|
|
4
|
+
export type FormDefinitionField = {
|
|
5
|
+
id: string;
|
|
6
|
+
uid?: string;
|
|
7
|
+
handle: string;
|
|
8
|
+
type: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
settings?: Record<string, unknown>;
|
|
12
|
+
children?: FormDefinitionField[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type FormDefinitionPage = {
|
|
16
|
+
id: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
fields: FormDefinitionField[];
|
|
19
|
+
settings?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type FormDefinitionPayload = {
|
|
23
|
+
formId?: string;
|
|
24
|
+
handle?: string;
|
|
25
|
+
pages?: FormDefinitionPage[];
|
|
26
|
+
settings?: Record<string, unknown>;
|
|
27
|
+
theme?: ThemeClassMap;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type FormRefreshTokensPayload = {
|
|
31
|
+
csrf?: {
|
|
32
|
+
param: string;
|
|
33
|
+
token: string;
|
|
34
|
+
};
|
|
35
|
+
requestToken?: string;
|
|
36
|
+
renderId?: string;
|
|
37
|
+
captchas?: Record<string, { sessionKey: string; value?: string }>;
|
|
38
|
+
meta?: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type FormRedirect = {
|
|
42
|
+
url: string;
|
|
43
|
+
target?: 'same-tab' | 'new-tab';
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type FormSubmitResult = {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
action?: FormAction;
|
|
49
|
+
stage?: SubmitStage;
|
|
50
|
+
code?: string;
|
|
51
|
+
message?: string;
|
|
52
|
+
keepSubmitLoading?: boolean;
|
|
53
|
+
fieldErrors?: Record<string, string[]>;
|
|
54
|
+
pageFieldErrors?: Record<string, Record<string, string[]>>;
|
|
55
|
+
formErrors?: string[];
|
|
56
|
+
nextPage?: { id: string } | null;
|
|
57
|
+
redirect?: FormRedirect | null;
|
|
58
|
+
submitData?: unknown[];
|
|
59
|
+
meta?: Record<string, unknown>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type FormEndpointPayload = {
|
|
63
|
+
html?: string;
|
|
64
|
+
theme?: ThemeClassMap;
|
|
65
|
+
modules?: FormModuleManifest[];
|
|
66
|
+
refreshTokens?: FormRefreshTokensPayload;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type FormModuleTargetType = 'form' | 'field' | 'page' | 'button' | 'selector';
|
|
70
|
+
|
|
71
|
+
export type FormModuleTarget = {
|
|
72
|
+
targetType: FormModuleTargetType;
|
|
73
|
+
targetId: string;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type FormModuleManifest = {
|
|
77
|
+
id: string;
|
|
78
|
+
src?: string;
|
|
79
|
+
type: string;
|
|
80
|
+
targets?: FormModuleTarget[];
|
|
81
|
+
renderTargets?: string[];
|
|
82
|
+
config?: Record<string, unknown>;
|
|
83
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ThemeClassMap = Record<string, string[] | string>;
|