@verbb/formie-browser 1.0.0 → 1.0.2

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/address-finder-CQW81kY0.js +37 -0
  3. package/dist/chunks/bpoint-D8OjLmsn.js +26 -0
  4. package/dist/chunks/calculations-BqZsENCq.js +147 -0
  5. package/dist/chunks/captcha-eu-DIa6aUWz.js +34 -0
  6. package/dist/chunks/checkbox-radio-BI-UjgMF.js +136 -0
  7. package/dist/chunks/conditions-BVl6jTYo.js +433 -0
  8. package/dist/chunks/date-picker-69TgvErA.js +4994 -0
  9. package/dist/chunks/eway-1GPxH6DU.js +74 -0
  10. package/dist/chunks/file-upload-BDZZftgL.js +281 -0
  11. package/dist/chunks/friendly-captcha-v1-DA2QPKA3.js +33 -0
  12. package/dist/chunks/friendly-captcha-v2-BorOWiz_.js +38 -0
  13. package/dist/chunks/go-cardless-DwBgERcA.js +24 -0
  14. package/dist/chunks/google-address-BcTBncyS.js +162 -0
  15. package/dist/chunks/hcaptcha-BchdVCqq.js +56 -0
  16. package/dist/chunks/hidden-D8RqSPt7.js +31 -0
  17. package/dist/chunks/index-BEsfee-D.js +1839 -0
  18. package/dist/chunks/index-BP7Unm5Y.js +863 -0
  19. package/dist/chunks/index-C1ZOKiAi.js +4229 -0
  20. package/dist/chunks/loqate-nXuTX7In.js +55 -0
  21. package/dist/chunks/mollie-qdCynQCd.js +24 -0
  22. package/dist/chunks/moneris-BNEA-laO.js +101 -0
  23. package/dist/chunks/opayo-BJtXOkuK.js +122 -0
  24. package/dist/chunks/paddle-D72Pa8kr.js +60 -0
  25. package/dist/chunks/paypal-Cqt2bned.js +100 -0
  26. package/dist/chunks/payway-BjCqsc0H.js +56 -0
  27. package/dist/chunks/phone-country-K9pYAlzM.js +3765 -0
  28. package/dist/chunks/place-kit-Dg6f_UoM.js +42 -0
  29. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
  30. package/dist/chunks/recaptcha-enterprise--VYAeeqz.js +71 -0
  31. package/dist/chunks/recaptcha-shared-PSIEEEe1.js +15 -0
  32. package/dist/chunks/recaptcha-v2-checkbox-atBNe5ml.js +41 -0
  33. package/dist/chunks/recaptcha-v2-invisible-DnBufNPT.js +59 -0
  34. package/dist/chunks/recaptcha-v3-CF6O8rDj.js +28 -0
  35. package/dist/chunks/repeater-CB7Yojvx.js +124 -0
  36. package/dist/chunks/rich-text-nAV_SQZo.js +304 -0
  37. package/dist/chunks/scripts-BkAAux0i.js +36 -0
  38. package/dist/chunks/sdk-3SicTWby.js +1559 -0
  39. package/dist/chunks/shared-DGqeMvcJ.js +80 -0
  40. package/dist/chunks/signature-BT6CsQ6n.js +550 -0
  41. package/dist/chunks/snaptcha-C7qQo02f.js +8 -0
  42. package/dist/chunks/square-C5AH3trb.js +46 -0
  43. package/dist/chunks/stripe-EJK0RyUv.js +202 -0
  44. package/dist/chunks/styles-C3aqgtek.js +21 -0
  45. package/dist/chunks/summary-DC_ipXCU.js +126 -0
  46. package/dist/chunks/table-BEAI99qo.js +95 -0
  47. package/dist/chunks/text-limit-Blgq5G-G.js +135 -0
  48. package/dist/chunks/turnstile-_uCRwnU-.js +59 -0
  49. package/dist/chunks/utils-BntI3W4S.js +6149 -0
  50. package/dist/index.js +39 -3205
  51. package/package.json +5 -5
  52. package/src/js/modules/fields/file-upload.ts +1 -1
  53. package/src/js/modules/fields/repeater.ts +1 -1
  54. package/src/js/modules/fields/rich-text.ts +2 -2
  55. package/src/js/modules/fields/signature.ts +1 -1
  56. package/src/js/modules/fields/summary.ts +1 -1
  57. package/src/js/modules/fields/table.ts +1 -1
  58. package/src/js/modules/fields/text-limit.ts +1 -1
  59. package/src/js/modules/payments/paypal.ts +1 -1
  60. package/src/js/modules/payments/payway.ts +1 -1
  61. package/src/js/modules/payments/stripe.ts +1 -1
  62. package/dist/chunks/address-finder-DfMCiW89.js +0 -47
  63. package/dist/chunks/api-CbqEMQT5.js +0 -181
  64. package/dist/chunks/api-DE7LfK-R.js +0 -960
  65. package/dist/chunks/api-DOfDzYC_.js +0 -538
  66. package/dist/chunks/async-B3DUf1GZ.js +0 -26
  67. package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
  68. package/dist/chunks/calculations-CkYAqO_-.js +0 -197
  69. package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
  70. package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
  71. package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
  72. package/dist/chunks/conditions-4fXKhEJS.js +0 -609
  73. package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
  74. package/dist/chunks/debug-KnZeKYBI.js +0 -39
  75. package/dist/chunks/dist-D09GnXMW.js +0 -2663
  76. package/dist/chunks/event-names-DamGPtXR.js +0 -51
  77. package/dist/chunks/eway-DEAYcwT0.js +0 -86
  78. package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
  79. package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
  80. package/dist/chunks/file-upload-Bh63PQSE.js +0 -430
  81. package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
  82. package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
  83. package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
  84. package/dist/chunks/go-cardless-CuND59rR.js +0 -26
  85. package/dist/chunks/google-address--uR8WDSm.js +0 -208
  86. package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
  87. package/dist/chunks/hidden-CYnZYple.js +0 -36
  88. package/dist/chunks/http-18nn97DZ.js +0 -29
  89. package/dist/chunks/i18n-vUh-KGiH.js +0 -55
  90. package/dist/chunks/loqate-BICNJlVK.js +0 -97
  91. package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
  92. package/dist/chunks/moneris-B_IFZFTx.js +0 -159
  93. package/dist/chunks/opayo-U2x_TOII.js +0 -192
  94. package/dist/chunks/paddle-BqXFrc79.js +0 -75
  95. package/dist/chunks/paypal-Cn_DYGDb.js +0 -121
  96. package/dist/chunks/payway-Rnq796eC.js +0 -75
  97. package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
  98. package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
  99. package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
  100. package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
  101. package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
  102. package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
  103. package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
  104. package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
  105. package/dist/chunks/repeater-CXD1eLSn.js +0 -151
  106. package/dist/chunks/rich-text-DkmZRhGj.js +0 -442
  107. package/dist/chunks/scripts-BGD_iU_6.js +0 -41
  108. package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
  109. package/dist/chunks/shared-DC6_1u8X.js +0 -85
  110. package/dist/chunks/signature-E9KyYXS1.js +0 -765
  111. package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
  112. package/dist/chunks/square-BLqK51rS.js +0 -61
  113. package/dist/chunks/stripe-B8gHpZNC.js +0 -273
  114. package/dist/chunks/styles-BIh6g7V_.js +0 -22
  115. package/dist/chunks/summary-EcNE0cvg.js +0 -191
  116. package/dist/chunks/table-yxEDL6kA.js +0 -124
  117. package/dist/chunks/text-limit-D0H_Ca2c.js +0 -179
  118. package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
  119. package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
  120. package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
@@ -1,179 +0,0 @@
1
- import { t as ensureModuleStyles } from "./styles-BIh6g7V_.js";
2
- import { r as Le } from "./dist-D09GnXMW.js";
3
- import { c as retainFormValidators, i as getModuleFieldTarget, s as releaseFormValidators } from "./shared-DC6_1u8X.js";
4
- //#region src/css/theme/fields/_text-limit.css?inline
5
- var _text_limit_default = "@layer formie-theme{.formie-limit-number{font-weight:var(--formie-font-weight-semibold);color:var(--formie-color-text)}.formie-limit-number-error{color:var(--formie-color-danger)}}";
6
- //#endregion
7
- //#region src/js/modules/fields/text-limit.ts
8
- var INPUT_SELECTOR = "input[data-formie-single-line-text-input], textarea[data-formie-multi-line-text-input]";
9
- var TEXT_LIMIT_VALIDATORS = [
10
- "textMinCharacterLimit",
11
- "textMaxCharacterLimit",
12
- "textMinWordLimit",
13
- "textMaxWordLimit"
14
- ];
15
- var VALIDATOR_SCOPE = "text-limit";
16
- var ALLOW_OVERTYPE_ATTR = "data-formie-text-limit-allow-overtype";
17
- var limitTargetCache = /* @__PURE__ */ new WeakMap();
18
- ensureModuleStyles("text-limit", [_text_limit_default]);
19
- function isTextLimitInput(input) {
20
- return input instanceof HTMLInputElement || input instanceof HTMLTextAreaElement;
21
- }
22
- function getLimitValue(input, attribute) {
23
- return parseInt(input.getAttribute(attribute) || "", 10) || 0;
24
- }
25
- function hasAnyLimitAttributes(input) {
26
- return input.hasAttribute("data-formie-min-chars") || input.hasAttribute("data-formie-max-chars") || input.hasAttribute("data-formie-min-words") || input.hasAttribute("data-formie-max-words");
27
- }
28
- function hasCounterLimitAttributes(input) {
29
- return input.hasAttribute("data-formie-max-chars") || input.hasAttribute("data-formie-max-words");
30
- }
31
- function allowsOvertype(input) {
32
- return input.hasAttribute(ALLOW_OVERTYPE_ATTR);
33
- }
34
- function hasNoRawValue(input) {
35
- return input.value === "";
36
- }
37
- function registerValidators(form) {
38
- retainFormValidators(form, VALIDATOR_SCOPE, (validator) => {
39
- validator.addValidator("textMinCharacterLimit", ({ input }) => {
40
- if (!isTextLimitInput(input)) return true;
41
- const limit = getLimitValue(input, "data-formie-min-chars");
42
- if (!limit || hasNoRawValue(input)) return true;
43
- return Le(input.value).graphemeCount >= limit;
44
- }, ({ label, input, t }) => {
45
- return t("{attribute} must be no less than {min} characters.", {
46
- attribute: label,
47
- min: input.getAttribute("data-formie-min-chars") || ""
48
- });
49
- });
50
- validator.addValidator("textMaxCharacterLimit", ({ input }) => {
51
- if (!isTextLimitInput(input)) return true;
52
- if (allowsOvertype(input)) return true;
53
- const limit = getLimitValue(input, "data-formie-max-chars");
54
- if (!limit || hasNoRawValue(input)) return true;
55
- return Le(input.value).graphemeCount <= limit;
56
- }, ({ label, input, t }) => {
57
- return t("{attribute} must be no greater than {max} characters.", {
58
- attribute: label,
59
- max: input.getAttribute("data-formie-max-chars") || ""
60
- });
61
- });
62
- validator.addValidator("textMinWordLimit", ({ input }) => {
63
- if (!isTextLimitInput(input)) return true;
64
- const limit = getLimitValue(input, "data-formie-min-words");
65
- if (!limit || input.value.trim() === "") return true;
66
- return Le(input.value).wordCount >= limit;
67
- }, ({ label, input, t }) => {
68
- return t("{attribute} must be no less than {min} words.", {
69
- attribute: label,
70
- min: input.getAttribute("data-formie-min-words") || ""
71
- });
72
- });
73
- validator.addValidator("textMaxWordLimit", ({ input }) => {
74
- if (!isTextLimitInput(input)) return true;
75
- if (allowsOvertype(input)) return true;
76
- const limit = getLimitValue(input, "data-formie-max-words");
77
- if (!limit || input.value.trim() === "") return true;
78
- return Le(input.value).wordCount <= limit;
79
- }, ({ label, input, t }) => {
80
- return t("{attribute} must be no greater than {max} words.", {
81
- attribute: label,
82
- max: input.getAttribute("data-formie-max-words") || ""
83
- });
84
- });
85
- });
86
- }
87
- function unregisterValidators(form) {
88
- releaseFormValidators(form, VALIDATOR_SCOPE, TEXT_LIMIT_VALIDATORS);
89
- }
90
- function getLimitTarget(input) {
91
- if (limitTargetCache.has(input)) return limitTargetCache.get(input) || null;
92
- const field = input.closest("[data-formie-field-handle]");
93
- if (!field) {
94
- limitTargetCache.set(input, null);
95
- return null;
96
- }
97
- const existingTarget = field.querySelector("[data-formie-limit-text]");
98
- if (existingTarget) {
99
- limitTargetCache.set(input, existingTarget);
100
- return existingTarget;
101
- }
102
- const control = field.querySelector("[data-formie-field-control]");
103
- const target = document.createElement("div");
104
- target.className = "formie-field-limit formie-limit-text";
105
- target.setAttribute("data-formie-field-limit", "true");
106
- target.setAttribute("data-formie-limit-text", "true");
107
- if (control?.parentElement) {
108
- control.insertAdjacentElement("afterend", target);
109
- limitTargetCache.set(input, target);
110
- return target;
111
- }
112
- field.appendChild(target);
113
- limitTargetCache.set(input, target);
114
- return target;
115
- }
116
- function renderCounter(target, remaining, unit) {
117
- const number = document.createElement("span");
118
- number.className = remaining < 0 ? "formie-limit-number formie-limit-number-error" : "formie-limit-number";
119
- number.textContent = String(remaining);
120
- target.replaceChildren(number, document.createTextNode(` ${Math.abs(remaining) === 1 ? unit : `${unit}s`} left`));
121
- }
122
- function updateCounter(input) {
123
- const maxChars = getLimitValue(input, "data-formie-max-chars");
124
- const maxWords = getLimitValue(input, "data-formie-max-words");
125
- const target = getLimitTarget(input);
126
- if (!target) return;
127
- const metrics = Le(input.value);
128
- if (maxChars > 0) {
129
- renderCounter(target, maxChars - metrics.graphemeCount, "character");
130
- return;
131
- }
132
- if (maxWords > 0) renderCounter(target, maxWords - metrics.wordCount, "word");
133
- }
134
- var textLimitModule = {
135
- id: "text-limit",
136
- kind: "field",
137
- match: (ctx) => {
138
- return !!ctx.target.querySelector(INPUT_SELECTOR);
139
- },
140
- setup: async (ctx) => {
141
- const options = ctx.options || {};
142
- const field = getModuleFieldTarget(ctx);
143
- const inputs = Array.from((field || ctx.target).querySelectorAll(INPUT_SELECTOR)).filter((input) => {
144
- return (input instanceof HTMLInputElement || input instanceof HTMLTextAreaElement) && hasAnyLimitAttributes(input);
145
- });
146
- const counterInputs = inputs.filter((input) => {
147
- return hasCounterLimitAttributes(input);
148
- });
149
- if (options.allowOvertype) inputs.forEach((input) => {
150
- input.setAttribute(ALLOW_OVERTYPE_ATTR, "true");
151
- });
152
- registerValidators(ctx.form);
153
- const unbinds = counterInputs.map((input) => {
154
- const handler = () => {
155
- updateCounter(input);
156
- };
157
- input.addEventListener("input", handler);
158
- input.addEventListener("change", handler);
159
- updateCounter(input);
160
- return () => {
161
- input.removeEventListener("input", handler);
162
- input.removeEventListener("change", handler);
163
- };
164
- });
165
- await ctx.emit("formie:module:text-limit:init", { count: inputs.length });
166
- return { destroy: () => {
167
- unbinds.forEach((unbind) => {
168
- unbind();
169
- });
170
- if (options.allowOvertype) inputs.forEach((input) => {
171
- input.removeAttribute(ALLOW_OVERTYPE_ATTR);
172
- });
173
- unregisterValidators(ctx.form);
174
- ctx.emit("formie:module:text-limit:destroy", {});
175
- } };
176
- }
177
- };
178
- //#endregion
179
- export { textLimitModule };
@@ -1,59 +0,0 @@
1
- //#region src/js/theme/theme-classes.ts
2
- var themeRegistry = /* @__PURE__ */ new WeakMap();
3
- var THEME_ROOT_SELECTORS = "[data-formie-form], [data-formie], form";
4
- function splitClasses(value) {
5
- if (!value) return [];
6
- return (Array.isArray(value) ? value : [value]).flatMap((item) => {
7
- return String(item).split(/\s+/);
8
- }).map((item) => {
9
- return item.trim();
10
- }).filter(Boolean);
11
- }
12
- function uniqueClasses(classes) {
13
- return Array.from(new Set(classes));
14
- }
15
- function resolveThemeClassMap(source) {
16
- if (!source) return {};
17
- const directMatch = themeRegistry.get(source);
18
- if (directMatch) return directMatch;
19
- const root = source.closest(THEME_ROOT_SELECTORS);
20
- if (!root) return {};
21
- return themeRegistry.get(root) || {};
22
- }
23
- function normalizeThemeClassMap(theme) {
24
- const normalized = {};
25
- Object.entries(theme || {}).forEach(([key, value]) => {
26
- const classes = uniqueClasses(splitClasses(value));
27
- if (classes.length) normalized[key] = classes;
28
- });
29
- return normalized;
30
- }
31
- function registerThemeClassMap(target, theme, form) {
32
- const normalized = normalizeThemeClassMap(theme);
33
- const resolvedForm = form || (target instanceof HTMLFormElement ? target : target.querySelector("form"));
34
- themeRegistry.set(target, normalized);
35
- if (resolvedForm) themeRegistry.set(resolvedForm, normalized);
36
- return normalized;
37
- }
38
- function getThemeClasses(source, key) {
39
- return resolveThemeClassMap(source)[key] || [];
40
- }
41
- function addThemeClasses(target, source, ...keys) {
42
- const classes = uniqueClasses(keys.flatMap((key) => {
43
- return getThemeClasses(source, key);
44
- }));
45
- if (classes.length) target.classList.add(...classes);
46
- }
47
- function removeThemeClasses(target, source, ...keys) {
48
- const classes = uniqueClasses(keys.flatMap((key) => {
49
- return getThemeClasses(source, key);
50
- }));
51
- if (classes.length) target.classList.remove(...classes);
52
- }
53
- function toggleThemeClasses(target, source, key, enabled) {
54
- getThemeClasses(source, key).forEach((className) => {
55
- target.classList.toggle(className, enabled);
56
- });
57
- }
58
- //#endregion
59
- export { toggleThemeClasses as i, registerThemeClassMap as n, removeThemeClasses as r, addThemeClasses as t };
@@ -1,68 +0,0 @@
1
- import { a as CAPTCHA_PROVIDER_LOAD_TIMEOUT_MS, i as CAPTCHA_EXECUTE_WAIT_FOR_VALUE_MS, o as CAPTCHA_SUBMIT_WAIT_FOR_VALUE_MS, r as getScriptAttributes, t as defineCaptchaModule } from "./api-DOfDzYC_.js";
2
- import { r as loadScriptAndEnsureGlobal } from "./scripts-BGD_iU_6.js";
3
- //#region src/js/modules/captchas/turnstile.ts
4
- function getTurnstileWaitForValueMs(provider) {
5
- const appearance = provider.appearance || "always";
6
- return (provider.execution || (appearance === "execute" ? "execute" : "render")) === "execute" ? CAPTCHA_EXECUTE_WAIT_FOR_VALUE_MS : CAPTCHA_SUBMIT_WAIT_FOR_VALUE_MS;
7
- }
8
- async function loadTurnstileGlobal(options) {
9
- const { async, defer } = getScriptAttributes(options.loadingMethod);
10
- return loadScriptAndEnsureGlobal("turnstile", {
11
- id: "FORMIE_TURNSTILE_SCRIPT",
12
- src: "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",
13
- async,
14
- defer,
15
- timeoutMs: CAPTCHA_PROVIDER_LOAD_TIMEOUT_MS
16
- });
17
- }
18
- var turnstileModule = defineCaptchaModule({
19
- id: "turnstile",
20
- defaultPlaceholderSelector: "[data-turnstile-placeholder]",
21
- defaultTokenFieldNames: ["cf-turnstile-response"],
22
- load: ({ options }) => {
23
- return loadTurnstileGlobal(options.provider);
24
- },
25
- mount: ({ api, container, provider, services }) => {
26
- const appearance = provider.appearance || "always";
27
- const execution = provider.execution || (appearance === "execute" ? "execute" : "render");
28
- return api.render(container, {
29
- sitekey: provider.siteKey || "",
30
- theme: provider.theme || "auto",
31
- size: provider.size || "normal",
32
- appearance,
33
- execution,
34
- callback: (token) => {
35
- if (typeof token === "string" && token.trim() !== "") services.tokens.write(token.trim());
36
- services.errors.clear();
37
- },
38
- "expired-callback": () => {
39
- services.tokens.clear();
40
- services.errors.clear();
41
- },
42
- "timeout-callback": () => {
43
- services.tokens.clear();
44
- services.errors.clear();
45
- },
46
- "error-callback": () => {
47
- services.tokens.clear();
48
- }
49
- });
50
- },
51
- screen: ({ api, widget, placeholder, services, provider, stageCtx }) => {
52
- if (services.tokens.has()) return;
53
- api.execute(widget);
54
- return services.tokens.wait(getTurnstileWaitForValueMs(provider)).then((hasToken) => {
55
- if (!hasToken) {
56
- const message = services.errors.getDefaultMessage();
57
- services.errors.show(message, placeholder);
58
- stageCtx.abort(message);
59
- }
60
- });
61
- },
62
- unmount: ({ api, widget, services }) => {
63
- api.reset(widget);
64
- services.tokens.clear();
65
- }
66
- });
67
- //#endregion
68
- export { turnstileModule };