@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
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { t as createDebug } from "./debug-KnZeKYBI.js";
|
|
2
|
+
import { r as normalizeFieldKey, t as fieldKeyToInputName } from "./field-references.keys-BpBZ_quS.js";
|
|
3
|
+
import { n as resolveFieldReferenceLive, r as buildFieldValueRegistry } from "./field-references.resolver-Ba6xhiJC.js";
|
|
4
|
+
import { c as we, i as Te, n as K, s as q, t as Ce } from "./dist-D09GnXMW.js";
|
|
5
|
+
import { r as getModuleFieldContainers, t as dispatchFieldEvent } from "./shared-DC6_1u8X.js";
|
|
6
|
+
//#region src/js/modules/fields/calculations.ts
|
|
7
|
+
var INPUT_SELECTOR = "input[data-formie-calculation-input]";
|
|
8
|
+
var MODULE_ID = "calculations";
|
|
9
|
+
var debug = createDebug("fields", "calculations");
|
|
10
|
+
function resolveVariables(root, variableEntries, options) {
|
|
11
|
+
const registry = buildFieldValueRegistry(root);
|
|
12
|
+
const variables = {};
|
|
13
|
+
variableEntries.forEach(([variableKey, variable]) => {
|
|
14
|
+
variables[variableKey] = K(variable, resolveFieldReferenceLive(variable.sourceKey || "", registry).value);
|
|
15
|
+
});
|
|
16
|
+
return Te(variables, options.formatting);
|
|
17
|
+
}
|
|
18
|
+
function getWatchNames(root, variableEntries) {
|
|
19
|
+
const registry = buildFieldValueRegistry(root);
|
|
20
|
+
const watchNames = /* @__PURE__ */ new Set();
|
|
21
|
+
variableEntries.forEach(([, variable]) => {
|
|
22
|
+
const key = normalizeFieldKey(variable.sourceKey || "");
|
|
23
|
+
const entry = registry.get(key);
|
|
24
|
+
if (entry?.names?.length) {
|
|
25
|
+
entry.names.forEach((name) => {
|
|
26
|
+
watchNames.add(name);
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const fallback = fieldKeyToInputName(key);
|
|
31
|
+
if (fallback) {
|
|
32
|
+
watchNames.add(fallback);
|
|
33
|
+
watchNames.add(`${fallback}[]`);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return watchNames;
|
|
37
|
+
}
|
|
38
|
+
function bindCalculationsField(root, field, input, options) {
|
|
39
|
+
const formula = Ce(options);
|
|
40
|
+
const variableEntries = we(options);
|
|
41
|
+
const sourceBindings = /* @__PURE__ */ new Map();
|
|
42
|
+
let observer = null;
|
|
43
|
+
let destroyed = false;
|
|
44
|
+
let evaluateQueued = false;
|
|
45
|
+
let rebindQueued = false;
|
|
46
|
+
const cleanupBindings = () => {
|
|
47
|
+
sourceBindings.forEach((listeners, target) => {
|
|
48
|
+
listeners.forEach((listener, eventName) => {
|
|
49
|
+
target.removeEventListener(eventName, listener);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
sourceBindings.clear();
|
|
53
|
+
};
|
|
54
|
+
const dispatchCalculatedValueChanged = (valueChanged) => {
|
|
55
|
+
if (!valueChanged || destroyed) return;
|
|
56
|
+
queueMicrotask(() => {
|
|
57
|
+
if (destroyed) return;
|
|
58
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
59
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const evaluate = (isInit = false) => {
|
|
63
|
+
const variables = resolveVariables(root, variableEntries, options);
|
|
64
|
+
debug.log("Evaluate requested.", {
|
|
65
|
+
fieldHandle: field.getAttribute("data-formie-field-handle") || null,
|
|
66
|
+
isInit
|
|
67
|
+
});
|
|
68
|
+
const beforeDetail = {
|
|
69
|
+
calculations: input,
|
|
70
|
+
init: isInit,
|
|
71
|
+
formula,
|
|
72
|
+
variables
|
|
73
|
+
};
|
|
74
|
+
dispatchFieldEvent(field, MODULE_ID, "before-evaluate", beforeDetail);
|
|
75
|
+
if (!beforeDetail.formula) {
|
|
76
|
+
const valueChanged = input.value !== "";
|
|
77
|
+
input.value = "";
|
|
78
|
+
dispatchCalculatedValueChanged(valueChanged);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const result = q(beforeDetail.formula, beforeDetail.variables, options);
|
|
83
|
+
const afterDetail = {
|
|
84
|
+
calculations: input,
|
|
85
|
+
init: isInit,
|
|
86
|
+
formula: beforeDetail.formula,
|
|
87
|
+
variables: beforeDetail.variables,
|
|
88
|
+
result
|
|
89
|
+
};
|
|
90
|
+
dispatchFieldEvent(field, MODULE_ID, "after-evaluate", afterDetail);
|
|
91
|
+
const nextValue = typeof afterDetail.result === "string" || typeof afterDetail.result === "number" ? String(afterDetail.result) : "";
|
|
92
|
+
const valueChanged = input.value !== nextValue;
|
|
93
|
+
input.value = nextValue;
|
|
94
|
+
debug.log("Evaluate complete.", {
|
|
95
|
+
fieldHandle: field.getAttribute("data-formie-field-handle") || null,
|
|
96
|
+
valueChanged,
|
|
97
|
+
nextValue
|
|
98
|
+
});
|
|
99
|
+
dispatchCalculatedValueChanged(valueChanged);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
const valueChanged = input.value !== "";
|
|
102
|
+
console.error("[formie] Failed to evaluate calculation.", error);
|
|
103
|
+
debug.warn("Evaluate failed.", {
|
|
104
|
+
fieldHandle: field.getAttribute("data-formie-field-handle") || null,
|
|
105
|
+
error: error instanceof Error ? error.message : error
|
|
106
|
+
});
|
|
107
|
+
input.value = "";
|
|
108
|
+
dispatchCalculatedValueChanged(valueChanged);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const scheduleEvaluate = (isInit = false) => {
|
|
112
|
+
if (evaluateQueued || destroyed) return;
|
|
113
|
+
evaluateQueued = true;
|
|
114
|
+
queueMicrotask(() => {
|
|
115
|
+
evaluateQueued = false;
|
|
116
|
+
evaluate(isInit);
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const bindSources = () => {
|
|
120
|
+
cleanupBindings();
|
|
121
|
+
const watchNames = getWatchNames(root, variableEntries);
|
|
122
|
+
debug.log("Binding variable watchers.", {
|
|
123
|
+
fieldHandle: field.getAttribute("data-formie-field-handle") || null,
|
|
124
|
+
watchCount: watchNames.size
|
|
125
|
+
});
|
|
126
|
+
if (!watchNames.size) return;
|
|
127
|
+
const listener = (event) => {
|
|
128
|
+
const name = event.target?.name || "";
|
|
129
|
+
if (!name || !watchNames.has(name)) return;
|
|
130
|
+
debug.log("Source change detected.", {
|
|
131
|
+
fieldHandle: field.getAttribute("data-formie-field-handle") || null,
|
|
132
|
+
sourceName: name,
|
|
133
|
+
eventType: event.type
|
|
134
|
+
});
|
|
135
|
+
scheduleEvaluate(false);
|
|
136
|
+
};
|
|
137
|
+
["input", "change"].forEach((eventName) => {
|
|
138
|
+
root.addEventListener(eventName, listener);
|
|
139
|
+
const listeners = sourceBindings.get(root) || /* @__PURE__ */ new Map();
|
|
140
|
+
listeners.set(eventName, listener);
|
|
141
|
+
sourceBindings.set(root, listeners);
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
const scheduleRebind = () => {
|
|
145
|
+
if (rebindQueued || destroyed) return;
|
|
146
|
+
rebindQueued = true;
|
|
147
|
+
queueMicrotask(() => {
|
|
148
|
+
rebindQueued = false;
|
|
149
|
+
bindSources();
|
|
150
|
+
scheduleEvaluate(false);
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
bindSources();
|
|
154
|
+
observer = new MutationObserver(() => {
|
|
155
|
+
scheduleRebind();
|
|
156
|
+
});
|
|
157
|
+
observer.observe(root, {
|
|
158
|
+
childList: true,
|
|
159
|
+
subtree: true
|
|
160
|
+
});
|
|
161
|
+
evaluate(true);
|
|
162
|
+
return () => {
|
|
163
|
+
destroyed = true;
|
|
164
|
+
observer?.disconnect();
|
|
165
|
+
cleanupBindings();
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
var calculationsModule = {
|
|
169
|
+
id: MODULE_ID,
|
|
170
|
+
kind: "field",
|
|
171
|
+
match: (ctx) => {
|
|
172
|
+
return !!ctx.target.querySelector(INPUT_SELECTOR);
|
|
173
|
+
},
|
|
174
|
+
setup: async (ctx) => {
|
|
175
|
+
const options = ctx.options || {};
|
|
176
|
+
const fields = getModuleFieldContainers(ctx);
|
|
177
|
+
debug.log("Module setup.", {
|
|
178
|
+
fieldCount: fields.length,
|
|
179
|
+
formatting: options.formatting || null
|
|
180
|
+
});
|
|
181
|
+
const cleanups = fields.map((field) => {
|
|
182
|
+
const input = field.querySelector(INPUT_SELECTOR);
|
|
183
|
+
if (!(input instanceof HTMLInputElement)) return () => {};
|
|
184
|
+
return bindCalculationsField(ctx.root, field, input, options);
|
|
185
|
+
});
|
|
186
|
+
await ctx.emit("formie:module:calculations:init", { count: cleanups.length });
|
|
187
|
+
return { destroy: () => {
|
|
188
|
+
debug.log("Module destroy.", { fieldCount: cleanups.length });
|
|
189
|
+
cleanups.forEach((cleanup) => {
|
|
190
|
+
cleanup();
|
|
191
|
+
});
|
|
192
|
+
ctx.emit("formie:module:calculations:destroy", {});
|
|
193
|
+
} };
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
export { calculationsModule };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { a as CAPTCHA_PROVIDER_LOAD_TIMEOUT_MS, t as defineCaptchaModule } from "./api-DOfDzYC_.js";
|
|
2
|
+
import { r as loadScriptAndEnsureGlobal } from "./scripts-BGD_iU_6.js";
|
|
3
|
+
//#region src/js/modules/captchas/captcha-eu.ts
|
|
4
|
+
async function loadCaptchaEuGlobal(options) {
|
|
5
|
+
return loadScriptAndEnsureGlobal("KROT", {
|
|
6
|
+
id: "FORMIE_CAPTCHA_EU_SCRIPT",
|
|
7
|
+
src: `${String(options.endPoint || "https://www.captcha.eu").trim().replace(/\/+$/, "")}/sdk.js`,
|
|
8
|
+
async: true,
|
|
9
|
+
defer: true,
|
|
10
|
+
timeoutMs: CAPTCHA_PROVIDER_LOAD_TIMEOUT_MS
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
var captchaEuModule = defineCaptchaModule({
|
|
14
|
+
id: "captcha-eu",
|
|
15
|
+
defaultPlaceholderSelector: "[data-captcha-eu-placeholder]",
|
|
16
|
+
defaultTokenFieldNames: ["captcha-eu-token"],
|
|
17
|
+
load: ({ options }) => {
|
|
18
|
+
return loadCaptchaEuGlobal(options.provider);
|
|
19
|
+
},
|
|
20
|
+
mount: ({ api, container, provider, services }) => {
|
|
21
|
+
api.init();
|
|
22
|
+
api.setup(String(provider.publicKey || ""));
|
|
23
|
+
api.WidgetV2.render(container);
|
|
24
|
+
api.on("CPT_OK", (event) => {
|
|
25
|
+
services.tokens.write(JSON.stringify(event.detail || {}), { container });
|
|
26
|
+
services.errors.clear();
|
|
27
|
+
}, container);
|
|
28
|
+
api.on("CPT_EXPIRED", () => {
|
|
29
|
+
services.tokens.clear();
|
|
30
|
+
services.errors.clear();
|
|
31
|
+
}, container);
|
|
32
|
+
return container;
|
|
33
|
+
},
|
|
34
|
+
screen: async ({ placeholder, services, stageCtx }) => {
|
|
35
|
+
if (!await services.tokens.wait()) {
|
|
36
|
+
const message = services.errors.getDefaultMessage();
|
|
37
|
+
services.errors.show(message, placeholder);
|
|
38
|
+
stageCtx.abort(message);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
export { captchaEuModule };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { t as createDebug } from "./debug-KnZeKYBI.js";
|
|
2
|
+
import { c as retainFormValidators, n as escapeSelectorValue, s as releaseFormValidators, t as dispatchFieldEvent } from "./shared-DC6_1u8X.js";
|
|
3
|
+
//#region src/js/modules/fields/checkbox-radio.ts
|
|
4
|
+
var FIELD_SELECTOR = "[data-formie-checkboxes-field-layout], [data-formie-radio-field-layout]";
|
|
5
|
+
var CHECKBOX_MINMAX_VALIDATOR = "minmaxOptions";
|
|
6
|
+
var MAX_DISABLED_ATTR = "data-formie-checkbox-radio-max-disabled";
|
|
7
|
+
var MODULE_ID = "checkbox-radio";
|
|
8
|
+
var VALIDATOR_SCOPE = "checkbox-radio";
|
|
9
|
+
var debug = createDebug("fields", "checkbox-radio");
|
|
10
|
+
function isToggleCheckbox(input) {
|
|
11
|
+
return input.hasAttribute("data-checkbox-toggle") || input.hasAttribute("data-formie-checkbox-toggle");
|
|
12
|
+
}
|
|
13
|
+
function getMinMaxRule(getRule) {
|
|
14
|
+
const rule = getRule(CHECKBOX_MINMAX_VALIDATOR);
|
|
15
|
+
if (!rule || rule === true || typeof rule !== "object") return {
|
|
16
|
+
min: null,
|
|
17
|
+
max: null
|
|
18
|
+
};
|
|
19
|
+
const candidate = rule;
|
|
20
|
+
return {
|
|
21
|
+
min: typeof candidate.min === "number" ? candidate.min : null,
|
|
22
|
+
max: typeof candidate.max === "number" ? candidate.max : null
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function registerValidators(form) {
|
|
26
|
+
retainFormValidators(form, VALIDATOR_SCOPE, (validator) => {
|
|
27
|
+
validator.addValidator(CHECKBOX_MINMAX_VALIDATOR, ({ field, getRule }) => {
|
|
28
|
+
if (!field || !getRule(CHECKBOX_MINMAX_VALIDATOR)) return true;
|
|
29
|
+
const selected = Array.from(field.querySelectorAll("input[type=\"checkbox\"]")).filter((input) => {
|
|
30
|
+
return input instanceof HTMLInputElement && !isToggleCheckbox(input);
|
|
31
|
+
}).filter((input) => {
|
|
32
|
+
return input.checked;
|
|
33
|
+
}).length;
|
|
34
|
+
const { min, max } = getMinMaxRule(getRule);
|
|
35
|
+
if (min !== null && selected < min) return false;
|
|
36
|
+
if (max !== null && selected > max) return false;
|
|
37
|
+
return true;
|
|
38
|
+
}, ({ field, label, t, getRule }) => {
|
|
39
|
+
const { min, max } = field ? getMinMaxRule(getRule) : {
|
|
40
|
+
min: null,
|
|
41
|
+
max: null
|
|
42
|
+
};
|
|
43
|
+
if (min !== null && max !== null) return t("{attribute} must select between {min} and {max}.", {
|
|
44
|
+
attribute: label,
|
|
45
|
+
min,
|
|
46
|
+
max
|
|
47
|
+
});
|
|
48
|
+
if (min !== null) return t("{attribute} must select no less than {min}.", {
|
|
49
|
+
attribute: label,
|
|
50
|
+
min
|
|
51
|
+
});
|
|
52
|
+
if (max !== null) return t("{attribute} must select no greater than {max}.", {
|
|
53
|
+
attribute: label,
|
|
54
|
+
max
|
|
55
|
+
});
|
|
56
|
+
return t("{attribute} has an invalid value.", { attribute: label });
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function unregisterValidators(form) {
|
|
61
|
+
releaseFormValidators(form, VALIDATOR_SCOPE, [CHECKBOX_MINMAX_VALIDATOR]);
|
|
62
|
+
}
|
|
63
|
+
function syncCheckedAttribute(input) {
|
|
64
|
+
if (input.checked) input.setAttribute("checked", "");
|
|
65
|
+
else input.removeAttribute("checked");
|
|
66
|
+
}
|
|
67
|
+
function syncRequiredCheckboxes(field) {
|
|
68
|
+
const requiredCheckboxes = Array.from(field.querySelectorAll("input[type=\"checkbox\"][required][data-formie-checkbox-input]")).filter((input) => {
|
|
69
|
+
return input instanceof HTMLInputElement;
|
|
70
|
+
});
|
|
71
|
+
if (!requiredCheckboxes.length) return;
|
|
72
|
+
const hasCheckedValue = requiredCheckboxes.some((input) => {
|
|
73
|
+
return input.checked;
|
|
74
|
+
});
|
|
75
|
+
requiredCheckboxes.forEach((input) => {
|
|
76
|
+
if (hasCheckedValue) {
|
|
77
|
+
input.removeAttribute("required");
|
|
78
|
+
input.setAttribute("aria-required", "false");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
input.setAttribute("required", "true");
|
|
82
|
+
input.setAttribute("aria-required", "true");
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function enforceMaxOptions(field) {
|
|
86
|
+
const maxOptions = parseInt(field.closest("[data-formie-field-handle]")?.getAttribute("data-formie-max-options") || "", 10);
|
|
87
|
+
if (!(maxOptions > 0)) return;
|
|
88
|
+
const checkboxes = Array.from(field.querySelectorAll("input[type=\"checkbox\"]")).filter((input) => {
|
|
89
|
+
return input instanceof HTMLInputElement && !isToggleCheckbox(input);
|
|
90
|
+
});
|
|
91
|
+
const disableUnchecked = checkboxes.filter((input) => {
|
|
92
|
+
return input.checked;
|
|
93
|
+
}).length >= maxOptions;
|
|
94
|
+
checkboxes.forEach((input) => {
|
|
95
|
+
const shouldDisableForMax = disableUnchecked && !input.checked;
|
|
96
|
+
const wasDisabledForMax = input.hasAttribute(MAX_DISABLED_ATTR);
|
|
97
|
+
if (shouldDisableForMax) {
|
|
98
|
+
if (!input.disabled) {
|
|
99
|
+
input.disabled = true;
|
|
100
|
+
input.setAttribute(MAX_DISABLED_ATTR, "true");
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (wasDisabledForMax) {
|
|
105
|
+
input.disabled = false;
|
|
106
|
+
input.removeAttribute(MAX_DISABLED_ATTR);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function toggleCheckboxGroup(field, toggle) {
|
|
111
|
+
Array.from(field.querySelectorAll("input[type=\"checkbox\"]")).filter((input) => {
|
|
112
|
+
return input instanceof HTMLInputElement && input !== toggle && !isToggleCheckbox(input);
|
|
113
|
+
}).forEach((input) => {
|
|
114
|
+
if (input.disabled && !input.checked) return;
|
|
115
|
+
input.checked = toggle.checked;
|
|
116
|
+
syncCheckedAttribute(input);
|
|
117
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
118
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function syncRadioGroup(input, field) {
|
|
122
|
+
if (!input.checked || !input.name) {
|
|
123
|
+
syncCheckedAttribute(input);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
Array.from(field.querySelectorAll(`input[type="radio"][name="${escapeSelectorValue(input.name)}"]`)).filter((radio) => {
|
|
127
|
+
return radio instanceof HTMLInputElement;
|
|
128
|
+
}).forEach((radio) => {
|
|
129
|
+
syncCheckedAttribute(radio);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function bindField(field) {
|
|
133
|
+
const inputs = Array.from(field.querySelectorAll("input[type=\"checkbox\"], input[type=\"radio\"]")).filter((input) => {
|
|
134
|
+
return input instanceof HTMLInputElement;
|
|
135
|
+
});
|
|
136
|
+
if (!inputs.length) {
|
|
137
|
+
debug.log("No checkbox/radio inputs found for field.");
|
|
138
|
+
return () => {};
|
|
139
|
+
}
|
|
140
|
+
const listeners = inputs.map((input) => {
|
|
141
|
+
const eventName = input.type === "radio" ? "change" : "click";
|
|
142
|
+
const handler = () => {
|
|
143
|
+
syncCheckedAttribute(input);
|
|
144
|
+
if (input.type === "checkbox" && isToggleCheckbox(input)) toggleCheckboxGroup(field, input);
|
|
145
|
+
if (input.type === "radio") syncRadioGroup(input, field);
|
|
146
|
+
syncRequiredCheckboxes(field);
|
|
147
|
+
enforceMaxOptions(field);
|
|
148
|
+
debug.log("Input interaction processed.", {
|
|
149
|
+
inputName: input.name,
|
|
150
|
+
inputType: input.type,
|
|
151
|
+
checked: input.checked
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
input.addEventListener(eventName, handler);
|
|
155
|
+
syncCheckedAttribute(input);
|
|
156
|
+
return () => {
|
|
157
|
+
input.removeEventListener(eventName, handler);
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
syncRequiredCheckboxes(field);
|
|
161
|
+
enforceMaxOptions(field);
|
|
162
|
+
dispatchFieldEvent(field, MODULE_ID, "init", { checkboxRadio: field });
|
|
163
|
+
return () => {
|
|
164
|
+
listeners.forEach((unbind) => {
|
|
165
|
+
unbind();
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
var checkboxRadioModule = {
|
|
170
|
+
id: MODULE_ID,
|
|
171
|
+
kind: "field",
|
|
172
|
+
match: (ctx) => {
|
|
173
|
+
return ctx.target instanceof HTMLElement && (ctx.target.matches(FIELD_SELECTOR) || !!ctx.target.querySelector(FIELD_SELECTOR));
|
|
174
|
+
},
|
|
175
|
+
setup: async (ctx) => {
|
|
176
|
+
if (!(ctx.target instanceof HTMLElement)) return;
|
|
177
|
+
const fields = ctx.target.matches(FIELD_SELECTOR) ? [ctx.target] : Array.from(ctx.target.querySelectorAll(FIELD_SELECTOR)).filter((field) => {
|
|
178
|
+
return field instanceof HTMLElement;
|
|
179
|
+
});
|
|
180
|
+
registerValidators(ctx.form);
|
|
181
|
+
debug.log("Module setup.", { fieldCount: fields.length });
|
|
182
|
+
const destroyBindings = fields.map((field) => {
|
|
183
|
+
return bindField(field);
|
|
184
|
+
});
|
|
185
|
+
await ctx.emit("formie:module:checkbox-radio:init", { count: fields.length });
|
|
186
|
+
return { destroy: () => {
|
|
187
|
+
destroyBindings.forEach((destroyBinding) => {
|
|
188
|
+
destroyBinding();
|
|
189
|
+
});
|
|
190
|
+
unregisterValidators(ctx.form);
|
|
191
|
+
debug.log("Module destroy.", { fieldCount: fields.length });
|
|
192
|
+
ctx.emit("formie:module:checkbox-radio:destroy", {});
|
|
193
|
+
} };
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
export { checkboxRadioModule };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
export { __toESM as n, __commonJSMin as t };
|