@verbb/formie-browser 1.0.4 → 1.0.5

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 (182) hide show
  1. package/CHANGELOG.md +62 -22
  2. package/dist/chunks/address-country-Rx6GQTND.js +68 -0
  3. package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
  4. package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
  5. package/dist/chunks/api-CmwLRq_n.js +780 -0
  6. package/dist/chunks/api-DMK8NSUI.js +407 -0
  7. package/dist/chunks/api-sPqGbOww.js +125 -0
  8. package/dist/chunks/async-nPFRNQ06.js +25 -0
  9. package/dist/chunks/bpoint-DSjqRv63.js +24 -0
  10. package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
  11. package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
  12. package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
  13. package/dist/chunks/chunk-3b4jIN3o.js +13 -0
  14. package/dist/chunks/combobox-D-2b42wn.js +1954 -0
  15. package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
  16. package/dist/chunks/constants-DVcJAvc5.js +38 -0
  17. package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
  18. package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
  19. package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
  20. package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
  21. package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
  22. package/dist/chunks/debug-BV0DvdHx.js +41 -0
  23. package/dist/chunks/dist-BF5GU3_9.js +2674 -0
  24. package/dist/chunks/event-names-BCI2FLD8.js +51 -0
  25. package/dist/chunks/eway-D3ctTbEk.js +70 -0
  26. package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
  27. package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
  28. package/dist/chunks/file-upload-D49m8-DR.js +287 -0
  29. package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
  30. package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
  31. package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
  32. package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
  33. package/dist/chunks/google-address-OhKilPWE.js +161 -0
  34. package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
  35. package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
  36. package/dist/chunks/http-D-JExro7.js +27 -0
  37. package/dist/chunks/i18n-BY1ds1BL.js +121 -0
  38. package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
  39. package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
  40. package/dist/chunks/mollie-COG-ko2D.js +23 -0
  41. package/dist/chunks/moneris-CMH8PlRc.js +117 -0
  42. package/dist/chunks/opayo-D2jsR5vh.js +113 -0
  43. package/dist/chunks/paddle-DxF88RfC.js +55 -0
  44. package/dist/chunks/paypal-b5pnwrA2.js +95 -0
  45. package/dist/chunks/payway-BJYu9DIR.js +55 -0
  46. package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
  47. package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
  48. package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
  49. package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
  50. package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
  51. package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
  52. package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
  53. package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
  54. package/dist/chunks/repeater-B5leVxZU.js +102 -0
  55. package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
  56. package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
  57. package/dist/chunks/sdk-BhHAYgga.js +1397 -0
  58. package/dist/chunks/shared-Bx9s0i0P.js +100 -0
  59. package/dist/chunks/signature-CpgqHCEx.js +463 -0
  60. package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
  61. package/dist/chunks/square-BP8RWAKB.js +40 -0
  62. package/dist/chunks/stripe-MihN63uC.js +184 -0
  63. package/dist/chunks/styles-BfoIZwJp.js +19 -0
  64. package/dist/chunks/summary-D3AjxpYN.js +114 -0
  65. package/dist/chunks/table-C-lkQN6I.js +78 -0
  66. package/dist/chunks/text-limit-B09elPDB.js +125 -0
  67. package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
  68. package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
  69. package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
  70. package/dist/css/formie-theme.css +2 -0
  71. package/dist/css/theme/fields/_address-state.css +94 -0
  72. package/dist/css/theme/fields/_combobox.css +246 -0
  73. package/dist/css/theme/fields/_select.css +13 -0
  74. package/dist/index.js +2447 -39
  75. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  76. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  77. package/dist/js/core/validation-focus.d.ts +4 -0
  78. package/dist/js/core/validation-focus.d.ts.map +1 -0
  79. package/dist/js/modules/address/api.d.ts +1 -0
  80. package/dist/js/modules/address/api.d.ts.map +1 -1
  81. package/dist/js/modules/address/constants.d.ts +22 -1
  82. package/dist/js/modules/address/constants.d.ts.map +1 -1
  83. package/dist/js/modules/address/host.d.ts +2 -2
  84. package/dist/js/modules/address/host.d.ts.map +1 -1
  85. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  86. package/dist/js/modules/fields/address-country.d.ts +3 -0
  87. package/dist/js/modules/fields/address-country.d.ts.map +1 -0
  88. package/dist/js/modules/fields/address-state.d.ts +3 -0
  89. package/dist/js/modules/fields/address-state.d.ts.map +1 -0
  90. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  91. package/dist/js/modules/fields/combobox.d.ts +17 -0
  92. package/dist/js/modules/fields/combobox.d.ts.map +1 -0
  93. package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
  94. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
  95. package/dist/js/modules/fields/custom-link.d.ts +3 -0
  96. package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
  97. package/dist/js/modules/fields/custom-maps.d.ts +3 -0
  98. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
  99. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  100. package/dist/js/modules/fields/index.d.ts.map +1 -1
  101. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  102. package/dist/js/submit/pipeline.d.ts.map +1 -1
  103. package/dist/js/utils/country-from-ip.d.ts +7 -0
  104. package/dist/js/utils/country-from-ip.d.ts.map +1 -0
  105. package/dist/js/utils/field-references.d.ts +1 -0
  106. package/dist/js/utils/field-references.d.ts.map +1 -1
  107. package/dist/js/utils/field-references.row-scope.d.ts +11 -0
  108. package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
  109. package/package.json +6 -3
  110. package/src/css/formie-theme.css +2 -0
  111. package/src/css/theme/fields/_address-state.css +94 -0
  112. package/src/css/theme/fields/_combobox.css +246 -0
  113. package/src/css/theme/fields/_select.css +13 -0
  114. package/src/js/core/create-formie-client.ts +27 -0
  115. package/src/js/core/submit-result-ui.ts +4 -4
  116. package/src/js/core/validation-focus.ts +117 -0
  117. package/src/js/modules/address/api.ts +7 -0
  118. package/src/js/modules/address/constants.ts +82 -2
  119. package/src/js/modules/address/host.ts +16 -6
  120. package/src/js/modules/address/loqate.ts +3 -17
  121. package/src/js/modules/fields/address-country.ts +156 -0
  122. package/src/js/modules/fields/address-state.ts +946 -0
  123. package/src/js/modules/fields/calculations.ts +32 -0
  124. package/src/js/modules/fields/combobox.ts +188 -0
  125. package/src/js/modules/fields/custom-google-maps.ts +416 -0
  126. package/src/js/modules/fields/custom-link.ts +95 -0
  127. package/src/js/modules/fields/custom-maps.ts +339 -0
  128. package/src/js/modules/fields/date-picker.ts +96 -3
  129. package/src/js/modules/fields/index.ts +6 -0
  130. package/src/js/modules/fields/phone-country.ts +6 -0
  131. package/src/js/submit/pipeline.ts +11 -1
  132. package/src/js/utils/country-from-ip.ts +54 -0
  133. package/src/js/utils/field-references.row-scope.ts +303 -0
  134. package/src/js/utils/field-references.ts +1 -0
  135. package/dist/chunks/address-finder-BU4roxT6.js +0 -37
  136. package/dist/chunks/bpoint-uNg5j6rt.js +0 -26
  137. package/dist/chunks/calculations-C9t6Zop9.js +0 -147
  138. package/dist/chunks/captcha-eu-BAPzHNts.js +0 -34
  139. package/dist/chunks/checkbox-radio-CHeLNVIK.js +0 -141
  140. package/dist/chunks/conditions-DKxVCsjD.js +0 -459
  141. package/dist/chunks/date-picker-B3iQ797Z.js +0 -4994
  142. package/dist/chunks/eway-DCielIML.js +0 -74
  143. package/dist/chunks/file-upload-DP2TOUYV.js +0 -316
  144. package/dist/chunks/friendly-captcha-v1-DdlcGiFY.js +0 -33
  145. package/dist/chunks/friendly-captcha-v2-76w-YnFm.js +0 -38
  146. package/dist/chunks/go-cardless-rwCkzbNK.js +0 -24
  147. package/dist/chunks/google-address-BD8IZ86V.js +0 -181
  148. package/dist/chunks/hcaptcha-BNNTL6uf.js +0 -56
  149. package/dist/chunks/hidden-CW6Rcf1N.js +0 -31
  150. package/dist/chunks/index-BEsfee-D.js +0 -1839
  151. package/dist/chunks/index-BP7Unm5Y.js +0 -863
  152. package/dist/chunks/index-D6npYxvr.js +0 -4423
  153. package/dist/chunks/loqate-B-ZNS65B.js +0 -55
  154. package/dist/chunks/mollie-BDAZ-1X4.js +0 -24
  155. package/dist/chunks/moneris-B1b0uEtY.js +0 -101
  156. package/dist/chunks/opayo-CC5hraHo.js +0 -122
  157. package/dist/chunks/paddle-B4GmrDsq.js +0 -60
  158. package/dist/chunks/paypal-BFS6XsIS.js +0 -100
  159. package/dist/chunks/payway-DekoJead.js +0 -56
  160. package/dist/chunks/phone-country-Cm5YUeXI.js +0 -3765
  161. package/dist/chunks/place-kit-DizZWV_e.js +0 -42
  162. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
  163. package/dist/chunks/recaptcha-enterprise-BbOvO7JZ.js +0 -71
  164. package/dist/chunks/recaptcha-shared-Dwg1eVFS.js +0 -15
  165. package/dist/chunks/recaptcha-v2-checkbox-SY3ti5iQ.js +0 -41
  166. package/dist/chunks/recaptcha-v2-invisible-DSmQnn6c.js +0 -59
  167. package/dist/chunks/recaptcha-v3-DNh7YCnR.js +0 -28
  168. package/dist/chunks/repeater-DM0vuFNQ.js +0 -124
  169. package/dist/chunks/rich-text-C8aGYp70.js +0 -304
  170. package/dist/chunks/scripts-CKTFtxPO.js +0 -36
  171. package/dist/chunks/sdk-3SicTWby.js +0 -1559
  172. package/dist/chunks/shared--BU5CFoL.js +0 -80
  173. package/dist/chunks/signature-pFhZfH7d.js +0 -550
  174. package/dist/chunks/snaptcha-VuOUOaLj.js +0 -8
  175. package/dist/chunks/square-BR9pvToy.js +0 -46
  176. package/dist/chunks/stripe-OHUwoV9g.js +0 -202
  177. package/dist/chunks/styles-C3aqgtek.js +0 -21
  178. package/dist/chunks/summary-Da7Ktg3N.js +0 -126
  179. package/dist/chunks/table-C0PmR9bI.js +0 -95
  180. package/dist/chunks/text-limit-mLEwZDIa.js +0 -144
  181. package/dist/chunks/turnstile-9tM7q_LK.js +0 -59
  182. package/dist/chunks/utils-BntI3W4S.js +0 -6149
@@ -1,202 +0,0 @@
1
- import { v as I, x as C, y as E, z as g } from "./index-D6npYxvr.js";
2
- import { e as P } from "./styles-C3aqgtek.js";
3
- import { l as A } from "./scripts-CKTFtxPO.js";
4
- const R = "@layer formie-theme{.formie-stripe-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--formie-space-2);min-height:12rem;width:100%;padding:var(--formie-space-4);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface);color:var(--formie-color-text-muted);text-align:center;box-sizing:border-box}.formie-stripe-placeholder[hidden]{display:none}}";
5
- P("stripe", [R]);
6
- const L = "FORMIE_STRIPE_SCRIPT", U = C("stripe", "confirm"), F = "[data-formie-stripe-elements-placeholder]", w = /* @__PURE__ */ new Set([
7
- "BIF",
8
- "CLP",
9
- "DJF",
10
- "GNF",
11
- "JPY",
12
- "KMF",
13
- "KRW",
14
- "MGA",
15
- "PYG",
16
- "RWF",
17
- "UGX",
18
- "VND",
19
- "VUV",
20
- "XAF",
21
- "XOF",
22
- "XPF"
23
- ]);
24
- function M(r, e) {
25
- return w.has(e.toUpperCase()) ? Math.ceil(r) : Math.ceil(r * 100);
26
- }
27
- function b(r, e) {
28
- r && (g(r, e, "fieldErrors", "fieldError"), r.querySelectorAll("[data-payment-placeholder-error]").forEach((s) => {
29
- g(s, e, "fieldError");
30
- }));
31
- }
32
- function T(r, e, s = "Loading payment options...") {
33
- if (!r)
34
- return;
35
- b(r, e), r.removeAttribute("hidden"), r.innerHTML = "";
36
- const i = document.createElement("div");
37
- i.className = "formie-loading";
38
- const t = document.createElement("div");
39
- t.textContent = s, r.append(i, t);
40
- }
41
- function v(r, e, s) {
42
- if (!r)
43
- return;
44
- b(r, e), r.removeAttribute("hidden"), E(r, e, "fieldErrors"), r.innerHTML = "";
45
- const i = document.createElement("div");
46
- i.setAttribute("data-payment-placeholder-error", ""), i.textContent = s, E(i, e, "fieldError"), r.appendChild(i);
47
- }
48
- const k = I({
49
- id: "stripe",
50
- defaultRequiredInputSuffixes: ["stripePaymentIntentId"],
51
- load: async (r) => {
52
- const { provider: e } = r.options, s = e.publishableKey;
53
- return s?.trim() ? (await A("Stripe", {
54
- id: L,
55
- src: "https://js.stripe.com/v3"
56
- }))(s) : (console.error("[formie] Missing publishableKey for Stripe."), null);
57
- },
58
- mount: async (r) => {
59
- const { api: e, field: s, services: i, provider: t } = r, u = s.querySelector("[data-formie-stripe-elements]"), a = s.querySelector(F), d = s, c = i.form || i.root;
60
- if (!u || !e)
61
- return null;
62
- const l = t.initialPaymentInformation || {}, _ = [l.amount, l.currency].map((o) => String(o ?? "").trim()).filter((o, n) => (n === 0 ? t.amountType : t.currencyType) === "dynamic" && o !== ""), y = () => {
63
- const o = i.resolveAmount({ value: l.amount });
64
- if (!o.ok)
65
- return {
66
- ok: !1,
67
- error: "error" in o ? o.error : "Provide a payment amount to proceed."
68
- };
69
- const n = i.resolveCurrency({ value: l.currency });
70
- if (!n.ok)
71
- return {
72
- ok: !1,
73
- error: "error" in n ? n.error : "Provide a payment currency to proceed."
74
- };
75
- const m = n.value.toLowerCase(), p = t.amountType === "dynamic" ? M(o.value, m) : o.value;
76
- return {
77
- ok: !0,
78
- value: {
79
- ...l,
80
- capture_method: "automatic",
81
- mode: t.paymentType === "subscription" ? "subscription" : "payment",
82
- appearance: {},
83
- amount: p,
84
- currency: m
85
- }
86
- };
87
- }, S = () => {
88
- try {
89
- d.__formieStripeWidget?.paymentElement?.destroy?.();
90
- } catch {
91
- }
92
- d.__formieStripeWidget = null, d.__formieStripeElements = void 0, u.innerHTML = "";
93
- }, f = () => {
94
- const o = y();
95
- if (!o.ok) {
96
- S(), v(
97
- a,
98
- c,
99
- "error" in o ? o.error : "Unable to resolve payment details."
100
- );
101
- return;
102
- }
103
- try {
104
- if (d.__formieStripeWidget && d.__formieStripeElements) {
105
- d.__formieStripeElements.update(o.value), b(a, c), a?.setAttribute("hidden", "hidden");
106
- return;
107
- }
108
- T(a, c);
109
- const n = e.elements(o.value), m = n.create("payment", {});
110
- m.mount(u), m.on?.("loaderror", (p) => {
111
- const h = p?.error?.message || "Unable to load payment options.";
112
- S(), v(a, c, h);
113
- }), m.on?.("ready", () => {
114
- b(a, c), a?.setAttribute("hidden", "hidden");
115
- }), d.__formieStripeElements = n, d.__formieStripeInstance = e, d.__formieStripeWidget = { elements: n, paymentElement: m }, m.on || (b(a, c), a?.setAttribute("hidden", "hidden"));
116
- } catch (n) {
117
- S(), v(
118
- a,
119
- c,
120
- n instanceof Error ? n.message : "Unable to initialize Stripe payment element."
121
- );
122
- }
123
- };
124
- return d.__formieStripeEvaluateAndRender = f, d.__formieStripeDynamicUnbind?.(), _.length > 0 && (d.__formieStripeDynamicUnbind = i.watchFieldValueChanges(_, () => {
125
- f();
126
- }, 600)), f(), d.__formieStripeWidget || null;
127
- },
128
- unmount: async (r) => {
129
- r.widget?.paymentElement?.destroy();
130
- const e = r.field;
131
- e.__formieStripeWidget = null, e.__formieStripeElements = void 0, e.__formieStripeInstance = null, e.__formieStripeLastClientSecret = void 0, e.__formieStripeEvaluateAndRender = null, e.__formieStripeDynamicUnbind?.(), e.__formieStripeDynamicUnbind = null;
132
- },
133
- onBeforeAuthorize: async (r) => {
134
- const { widget: e, services: s, field: i } = r, t = i;
135
- let u = e;
136
- if (u?.elements || (t.__formieStripeEvaluateAndRender?.(), u = t.__formieStripeWidget || null), !u?.elements)
137
- return !1;
138
- const a = await u.elements.submit();
139
- return a?.error ? (s.addError(a.error.message), !1) : !0;
140
- },
141
- setup: async (r) => {
142
- const { services: e, options: s } = r, i = s.provider, t = r.target, u = async (d) => {
143
- try {
144
- const l = d.detail?.data;
145
- if (!l?.clientSecret || t.__formieStripeConfirming || t.__formieStripeLastClientSecret === l.clientSecret)
146
- return;
147
- const _ = t.__formieStripeElements;
148
- if (!_) {
149
- e.addError("Stripe elements not ready for 3DS.");
150
- return;
151
- }
152
- const y = t.__formieStripeInstance, S = i.publishableKey;
153
- if (!y || !S) {
154
- e.addError("Stripe is not initialized.");
155
- return;
156
- }
157
- t.__formieStripeConfirming = !0;
158
- const f = new URL(l.returnUrl || window.location.href);
159
- f.searchParams.set("origin", window.location.href);
160
- const n = await (l.type === "setup" ? y.confirmSetup : y.confirmPayment)({
161
- elements: _,
162
- clientSecret: l.clientSecret,
163
- redirect: "if_required",
164
- confirmParams: { return_url: f.toString() }
165
- });
166
- if (n?.error) {
167
- e.releaseSubmitLoading(), e.addError(n.error.message);
168
- return;
169
- }
170
- l.subscriptionId && e.updateInputs("stripeSubscriptionId", l.subscriptionId);
171
- const m = n && "paymentIntent" in n ? n.paymentIntent : null, p = n && "setupIntent" in n ? n.setupIntent : null;
172
- if (m?.id)
173
- e.updateInputs("stripePaymentIntentId", m.id);
174
- else if (p?.id)
175
- e.updateInputs("stripePaymentIntentId", p.id);
176
- else {
177
- e.releaseSubmitLoading(), e.addError("Stripe confirmation did not return an intent ID.");
178
- return;
179
- }
180
- t.__formieStripeLastClientSecret = l.clientSecret, e.triggerSubmit();
181
- } catch (c) {
182
- e.releaseSubmitLoading(), e.addError(c instanceof Error ? c.message : "Unable to confirm Stripe payment.");
183
- } finally {
184
- t.__formieStripeConfirming = !1;
185
- }
186
- };
187
- t.__formieStripeConfirmUnbind?.();
188
- const a = e.events.onForm(U, u);
189
- return t.__formieStripeConfirmUnbind = a, {
190
- destroy: () => {
191
- t.__formieStripeConfirmUnbind?.(), t.__formieStripeConfirmUnbind = null;
192
- }
193
- };
194
- },
195
- onAfterSubmit: async (r) => {
196
- const e = r.field;
197
- r.result?.ok && !r.result?.nextPage && (e.__formieStripeWidget?.paymentElement?.destroy?.(), e.__formieStripeWidget = null, e.__formieStripeElements = void 0, r.services.updateInputs(["stripePaymentIntentId", "stripeSubscriptionId"], ""), e.__formieStripeLastClientSecret = void 0);
198
- }
199
- });
200
- export {
201
- k as stripeModule
202
- };
@@ -1,21 +0,0 @@
1
- const t = /* @__PURE__ */ new Set();
2
- function l(n, r) {
3
- if (typeof document > "u")
4
- return;
5
- const e = `formie-module-style:${n}`;
6
- if (t.has(e) || document.querySelector(`style[data-formie-module-style="${n}"]`)) {
7
- t.add(e);
8
- return;
9
- }
10
- const d = r.filter((s) => typeof s == "string" && s.trim().length > 0).join(`
11
- `);
12
- if (!d) {
13
- t.add(e);
14
- return;
15
- }
16
- const o = document.createElement("style");
17
- o.setAttribute("data-formie-module-style", n), o.textContent = d, document.head.appendChild(o), t.add(e);
18
- }
19
- export {
20
- l as e
21
- };
@@ -1,126 +0,0 @@
1
- import { g as H, d as M } from "./shared--BU5CFoL.js";
2
- import { e as I } from "./styles-C3aqgtek.js";
3
- import { h as x, t as L, p as V, q as z } from "./index-D6npYxvr.js";
4
- const N = '@layer formie-theme{.formie-summary-container{padding:var(--formie-summary-padding);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm)}.formie-summary-heading{color:var(--formie-color-heading)}.formie-summary-blocks{display:grid;gap:var(--formie-gap-summary)}.formie-summary-blocks[data-formie-loading=true]{position:relative;min-height:calc(var(--formie-loading-size) + var(--formie-space-4))}.formie-summary-blocks[data-formie-loading=true]>*{opacity:0;pointer-events:none}.formie-summary-blocks[data-formie-loading=true]:before{position:absolute;inset:0;content:"";display:block;background:var(--formie-color-bg);border-radius:inherit;z-index:1}.formie-summary-blocks[data-formie-loading=true]:after{position:absolute;top:50%;left:50%;width:var(--formie-loading-size);height:var(--formie-loading-size);content:"";display:block;border:var(--formie-loading-border-width) solid var(--formie-loading-color);border-top-color:transparent;border-right-color:transparent;border-radius:var(--formie-radius-full);transform:translate(-50%,-50%);z-index:2;animation:formie-loading-spin var(--formie-loading-speed) linear infinite}}', C = "[data-formie-summary-blocks]", q = "[data-formie-summary-container]", U = "formie/fields/get-summary-html", b = "summary", i = x("fields", "summary");
5
- I(b, [N]);
6
- function _() {
7
- const e = new URL(window.location.href);
8
- return e.hash = "", e.toString();
9
- }
10
- function w(e) {
11
- return {
12
- accessToken: e.querySelector("[data-formie-summary-token]")?.value?.trim() || null
13
- };
14
- }
15
- async function P(e, n, t) {
16
- if (!n.accessToken)
17
- throw new Error("Summary field requires an access token.");
18
- const m = new FormData(e);
19
- return m.set("action", U), m.set("accessToken", n.accessToken), z(_(), {
20
- method: "POST",
21
- body: m,
22
- signal: t,
23
- headers: {
24
- Accept: "text/html"
25
- }
26
- });
27
- }
28
- function B(e, n) {
29
- const t = e.closest("form");
30
- if (!(t instanceof HTMLFormElement))
31
- return i.warn("Missing form ancestor; skipping field."), () => {
32
- };
33
- let m = !1, a = !0, h = !1, l = 0, d = 0, u = null;
34
- const v = () => {
35
- const r = e.querySelector(C);
36
- return r instanceof HTMLElement ? r : null;
37
- }, F = () => {
38
- const r = e.querySelector(q);
39
- return r instanceof HTMLElement ? r : null;
40
- }, f = (r) => {
41
- const o = v();
42
- if (o) {
43
- if (r) {
44
- o.setAttribute("data-formie-loading", "true"), o.setAttribute("aria-busy", "true"), L(o, t, "loading", !0);
45
- return;
46
- }
47
- o.removeAttribute("data-formie-loading"), o.removeAttribute("aria-busy"), L(o, t, "loading", !1);
48
- }
49
- }, A = w(e);
50
- f(!!A.accessToken);
51
- const c = () => {
52
- !h || m && !a || (i.log("Queueing fetch."), R());
53
- }, R = V(async () => {
54
- const r = w(e);
55
- if (!v() || !r.accessToken) {
56
- i.warn("Missing state for fetch.", r), f(!1);
57
- return;
58
- }
59
- d += 1;
60
- const o = d, O = l;
61
- u?.abort(), u = new AbortController(), f(!0);
62
- try {
63
- const s = await P(t, r, u.signal);
64
- if (o !== d)
65
- return;
66
- const y = F(), S = document.createElement("template");
67
- S.innerHTML = s.trim();
68
- const T = S.content.querySelector(q);
69
- y && T instanceof HTMLElement ? y.replaceWith(T) : y && (y.innerHTML = s), m = !0, a = l !== O, i.log("Fetch complete.", {
70
- isDirty: a,
71
- dirtyVersion: l,
72
- requestVersion: o
73
- }), M(e, b, "fetch-summary", {
74
- summary: e,
75
- html: s
76
- });
77
- } catch (s) {
78
- if (s instanceof DOMException && s.name === "AbortError") {
79
- i.log("Fetch aborted.");
80
- return;
81
- }
82
- console.error("[formie] Failed to load summary field HTML.", s);
83
- } finally {
84
- o === d && (f(!1), u = null, a && c());
85
- }
86
- }, 300), D = (r) => {
87
- const o = r?.target;
88
- o instanceof Node && e.contains(o) || (a = !0, l += 1, i.log("Marked dirty.", { dirtyVersion: l }));
89
- }, g = (r) => {
90
- D(r), c();
91
- }, p = () => {
92
- a = !0, i.log("Submit result received; refreshing."), c();
93
- }, k = () => {
94
- a = !0, i.log("Page navigation received; refreshing."), c();
95
- }, E = new IntersectionObserver((r) => {
96
- h = !!r[0]?.isIntersecting, h && (i.log("Field became visible."), M(e, b, "field-visible", {
97
- summary: e
98
- }), c());
99
- }, {
100
- root: t,
101
- rootMargin: "50px"
102
- });
103
- return E.observe(e), t.addEventListener("input", g), t.addEventListener("change", g), n.addEventListener("formie:page:navigate:after", k), n.addEventListener("formie:submit:result", p), () => {
104
- u?.abort(), E.disconnect(), t.removeEventListener("input", g), t.removeEventListener("change", g), n.removeEventListener("formie:page:navigate:after", k), n.removeEventListener("formie:submit:result", p), i.log("Field destroyed.");
105
- };
106
- }
107
- const Y = {
108
- id: b,
109
- kind: "field",
110
- match: (e) => !!e.target.querySelector(C),
111
- setup: async (e) => {
112
- const n = H(e).map((t) => B(t, e.root));
113
- return i.log("Module setup.", { fieldCount: n.length }), await e.emit("formie:module:summary:init", {
114
- count: n.length
115
- }), {
116
- destroy: () => {
117
- n.forEach((t) => {
118
- t();
119
- }), i.log("Module destroy.", { fieldCount: n.length }), e.emit("formie:module:summary:destroy", {});
120
- }
121
- };
122
- }
123
- };
124
- export {
125
- Y as summaryModule
126
- };
@@ -1,95 +0,0 @@
1
- import { d as h, b as L, c as A } from "./shared--BU5CFoL.js";
2
- import { e as M } from "./styles-C3aqgtek.js";
3
- import { s as R } from "./index-D6npYxvr.js";
4
- const S = '@layer formie-theme{.formie-table-wrapper{max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.formie-table{width:var(--formie-table-width);margin-bottom:var(--formie-table-margin-bottom);border-collapse:var(--formie-table-border-collapse)}.formie-table th{text-align:var(--formie-table-th-text-align);font-size:var(--formie-table-th-font-size);font-weight:var(--formie-table-th-font-weight);color:var(--formie-table-th-color, var(--formie-gray-500))}.formie-table th,.formie-table td{padding:var(--formie-table-row-padding);vertical-align:top}.formie-table th:first-child,.formie-table td:first-child{padding-left:0}.formie-table th:last-child,.formie-table td:last-child{padding-right:0}.formie-table [data-col-remove]{width:calc(var(--formie-button-icon-button-size) + (var(--formie-table-row-padding) * 2));min-width:calc(var(--formie-button-icon-button-size) + (var(--formie-table-row-padding) * 2));white-space:nowrap;text-align:center;vertical-align:middle}.formie-table [data-formie-table-column-type=checkbox]{text-align:center;vertical-align:middle}.formie-table [data-formie-table-column-type=checkbox] .formie-checkbox-option{display:flex;align-items:center;justify-content:center;width:100%;min-height:var(--formie-check-size);margin:0}.formie-table [data-formie-table-column-type=checkbox] .formie-checkbox-option-label{display:block;width:var(--formie-check-size);min-width:var(--formie-check-size);height:var(--formie-check-size);margin:0 auto;padding-left:0;font-size:0;line-height:0}.formie-table [data-formie-table-column-type=checkbox] .formie-checkbox-option-label:before{position:static}.formie-table-color-input{min-width:4rem;padding:var(--formie-space-1)}.formie-table-multiline-input{min-height:calc(var(--formie-control-height) + var(--formie-space-2))}.formie-table-remove-button{display:inline-flex;vertical-align:middle}.formie-button.formie-table-add-button{position:relative;display:inline-flex;align-items:center;justify-content:center;width:auto;max-width:100%;justify-self:start;padding-left:var(--formie-table-add-button-padding-left)}.formie-button.formie-table-add-button:before{position:absolute;content:"";display:block;width:var(--formie-table-add-button-width);height:var(--formie-table-add-button-height);left:var(--formie-table-add-button-left);top:50%;transform:translateY(-50%);background-color:currentColor;-webkit-mask-image:var(--formie-table-add-button-icon-mask);mask-image:var(--formie-table-add-button-icon-mask);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}}', b = "[data-formie-table-field-layout]", H = "[data-formie-table]", _ = "[data-formie-table-body]", g = "[data-formie-table-row]", x = "[data-formie-table-add]", O = "[data-formie-table-remove]", y = "data-formie-template-id", k = "data-formie-table-row-id", s = "table";
5
- M(s, [S]);
6
- function z(e, o) {
7
- return A(e, o);
8
- }
9
- function c(e) {
10
- return e.querySelectorAll(g).length;
11
- }
12
- function B(e) {
13
- return Array.from(e.querySelectorAll(g)).reduce((o, r) => {
14
- const i = parseInt(r.getAttribute(k) || "", 10);
15
- return Number.isNaN(i) ? o : Math.max(o, i + 1);
16
- }, 0);
17
- }
18
- function p(e, o) {
19
- if (!e)
20
- return;
21
- const r = parseInt(e.getAttribute("data-formie-max-rows") || "", 10);
22
- e.disabled = r > 0 && o >= r;
23
- }
24
- function C(e, o) {
25
- const r = e.querySelector(H), i = e.querySelector(_), t = e.querySelector(x);
26
- if (!(r instanceof HTMLElement) || !(i instanceof HTMLElement))
27
- return () => {
28
- };
29
- const u = /* @__PURE__ */ new Map();
30
- let v = B(e);
31
- const w = () => {
32
- e.querySelectorAll(O).forEach((a) => {
33
- if (!(a instanceof HTMLElement) || u.has(a))
34
- return;
35
- const n = (d) => {
36
- d.preventDefault();
37
- const l = a.closest(g);
38
- if (!(l instanceof HTMLElement))
39
- return;
40
- const f = parseInt((t instanceof HTMLButtonElement ? t.getAttribute("data-formie-min-rows") : "") || "", 10);
41
- f > 0 && c(e) <= f || (l.remove(), p(t instanceof HTMLButtonElement ? t : null, c(e)), h(e, s, "remove", {
42
- table: e,
43
- row: l
44
- }));
45
- };
46
- a.addEventListener("click", n), u.set(a, n);
47
- });
48
- }, T = async () => {
49
- if (o.static || !(t instanceof HTMLButtonElement) || !t.getAttribute("data-formie-table-add"))
50
- return;
51
- const n = t.getAttribute(y) || e.getAttribute(y), d = parseInt(t.getAttribute("data-formie-max-rows") || "", 10);
52
- if (d > 0 && c(e) >= d)
53
- return;
54
- const l = z(e, n);
55
- if (!l)
56
- return;
57
- const f = L(l).replaceAll("__ROW__", String(v++)), m = document.createElement("tr");
58
- m.setAttribute("data-formie-table-row", "true"), m.setAttribute(k, String(v - 1)), m.innerHTML = f, i.appendChild(m), await R(50), w(), p(t, c(e)), h(e, s, "append", {
59
- table: e,
60
- row: m
61
- });
62
- }, E = (a) => {
63
- a.preventDefault(), T();
64
- };
65
- return t instanceof HTMLButtonElement && !o.static && t.addEventListener("click", E), w(), p(t instanceof HTMLButtonElement ? t : null, c(e)), h(e, s, "init", {
66
- table: e
67
- }), () => {
68
- t instanceof HTMLButtonElement && t.removeEventListener("click", E), u.forEach((a, n) => {
69
- n.removeEventListener("click", a);
70
- });
71
- };
72
- }
73
- const N = {
74
- id: s,
75
- kind: "field",
76
- match: (e) => e.target instanceof HTMLElement && (e.target.matches(b) || !!e.target.querySelector(b)),
77
- setup: async (e) => {
78
- const o = e.options || {};
79
- if (!(e.target instanceof HTMLElement))
80
- return;
81
- const r = e.target.matches(b) ? [e.target] : Array.from(e.target.querySelectorAll(b)).filter((t) => t instanceof HTMLElement), i = r.map((t) => C(t, o));
82
- return await e.emit("formie:module:table:init", {
83
- count: r.length
84
- }), {
85
- destroy: () => {
86
- i.forEach((t) => {
87
- t();
88
- }), e.emit("formie:module:table:destroy", {});
89
- }
90
- };
91
- }
92
- };
93
- export {
94
- N as tableModule
95
- };
@@ -1,144 +0,0 @@
1
- import { z as u } from "./index-BEsfee-D.js";
2
- import { f as b, r as w, a as E } from "./shared--BU5CFoL.js";
3
- import { e as v } from "./styles-C3aqgtek.js";
4
- import { u as C } from "./index-D6npYxvr.js";
5
- const M = "@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)}}", f = "input[data-formie-single-line-text-input], textarea[data-formie-multi-line-text-input]", _ = [
6
- "textMinCharacterLimit",
7
- "textMaxCharacterLimit",
8
- "textMinWordLimit",
9
- "textMaxWordLimit"
10
- ], L = "text-limit", d = "data-formie-text-limit-allow-overtype", I = "{count, plural, one{character allowed} other{characters allowed}}", y = "{count, plural, one{character left} other{characters left}}", R = "{count, plural, one{character over limit} other{characters over limit}}", O = "{count, plural, one{word allowed} other{words allowed}}", S = "{count, plural, one{word left} other{words left}}", V = "{count, plural, one{word over limit} other{words over limit}}", s = /* @__PURE__ */ new WeakMap();
11
- v("text-limit", [M]);
12
- function c(t) {
13
- return t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement;
14
- }
15
- function l(t, a) {
16
- return parseInt(t.getAttribute(a) || "", 10) || 0;
17
- }
18
- function W(t) {
19
- return t.hasAttribute("data-formie-min-chars") || t.hasAttribute("data-formie-max-chars") || t.hasAttribute("data-formie-min-words") || t.hasAttribute("data-formie-max-words");
20
- }
21
- function D(t) {
22
- return t.hasAttribute("data-formie-max-chars") || t.hasAttribute("data-formie-max-words");
23
- }
24
- function h(t) {
25
- return t.hasAttribute(d);
26
- }
27
- function x(t) {
28
- return t.value === "";
29
- }
30
- function H(t) {
31
- w(t, L, (a) => {
32
- a.addValidator("textMinCharacterLimit", ({ input: e }) => {
33
- if (!c(e))
34
- return !0;
35
- const r = l(e, "data-formie-min-chars");
36
- return !r || x(e) ? !0 : u(e.value).graphemeCount >= r;
37
- }, ({ label: e, input: r, t: o }) => r.getAttribute("data-formie-validation-min-characters-message") || o("{label} must be no less than {min} characters.", {
38
- label: e,
39
- min: r.getAttribute("data-formie-min-chars") || ""
40
- })), a.addValidator("textMaxCharacterLimit", ({ input: e }) => {
41
- if (!c(e) || h(e))
42
- return !0;
43
- const r = l(e, "data-formie-max-chars");
44
- return !r || x(e) ? !0 : u(e.value).graphemeCount <= r;
45
- }, ({ label: e, input: r, t: o }) => r.getAttribute("data-formie-validation-max-characters-message") || o("{label} must be no greater than {max} characters.", {
46
- label: e,
47
- max: r.getAttribute("data-formie-max-chars") || ""
48
- })), a.addValidator("textMinWordLimit", ({ input: e }) => {
49
- if (!c(e))
50
- return !0;
51
- const r = l(e, "data-formie-min-words");
52
- return !r || e.value.trim() === "" ? !0 : u(e.value).wordCount >= r;
53
- }, ({ label: e, input: r, t: o }) => r.getAttribute("data-formie-validation-min-words-message") || o("{label} must be no less than {min} words.", {
54
- label: e,
55
- min: r.getAttribute("data-formie-min-words") || ""
56
- })), a.addValidator("textMaxWordLimit", ({ input: e }) => {
57
- if (!c(e) || h(e))
58
- return !0;
59
- const r = l(e, "data-formie-max-words");
60
- return !r || e.value.trim() === "" ? !0 : u(e.value).wordCount <= r;
61
- }, ({ label: e, input: r, t: o }) => r.getAttribute("data-formie-validation-max-words-message") || o("{label} must be no greater than {max} words.", {
62
- label: e,
63
- max: r.getAttribute("data-formie-max-words") || ""
64
- }));
65
- });
66
- }
67
- function X(t) {
68
- E(t, L, _);
69
- }
70
- function F(t) {
71
- if (s.has(t))
72
- return s.get(t) || null;
73
- const a = t.closest("[data-formie-field-handle]");
74
- if (!a)
75
- return s.set(t, null), null;
76
- const e = a.querySelector("[data-formie-limit-text]");
77
- if (e)
78
- return s.set(t, e), e;
79
- const r = a.querySelector("[data-formie-field-control]"), o = document.createElement("div");
80
- return o.className = "formie-field-limit formie-limit-text", o.setAttribute("data-formie-field-limit", "true"), o.setAttribute("data-formie-limit-text", "true"), r?.parentElement ? (r.insertAdjacentElement("afterend", o), s.set(t, o), o) : (a.appendChild(o), s.set(t, o), o);
81
- }
82
- function N(t, a, e) {
83
- return (e === "character" ? t.value === "" : t.value.trim() === "") ? "allowed" : a < 0 ? "over" : "left";
84
- }
85
- function q(t, a) {
86
- return t === "character" ? a === "allowed" ? I : a === "over" ? R : y : a === "allowed" ? O : a === "over" ? V : S;
87
- }
88
- function T(t, a, e, r, o) {
89
- const n = N(a, e, o), i = n === "allowed" ? r : Math.abs(e), m = document.createElement("span");
90
- m.className = n === "over" ? "formie-limit-number formie-limit-number-error" : "formie-limit-number", m.textContent = String(i);
91
- const A = q(o, n);
92
- t.replaceChildren(
93
- m,
94
- document.createTextNode(` ${C(A, { count: i })}`)
95
- );
96
- }
97
- function g(t) {
98
- const a = l(t, "data-formie-max-chars"), e = l(t, "data-formie-max-words"), r = F(t);
99
- if (!r)
100
- return;
101
- const o = u(t.value);
102
- if (a > 0) {
103
- const n = a - o.graphemeCount;
104
- T(r, t, n, a, "character");
105
- return;
106
- }
107
- if (e > 0) {
108
- const n = e - o.wordCount;
109
- T(r, t, n, e, "word");
110
- }
111
- }
112
- const j = {
113
- id: "text-limit",
114
- kind: "field",
115
- match: (t) => !!t.target.querySelector(f),
116
- setup: async (t) => {
117
- const a = t.options || {}, e = b(t), r = Array.from((e || t.target).querySelectorAll(f)).filter((i) => (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement) && W(i)), o = r.filter((i) => D(i));
118
- a.allowOvertype && r.forEach((i) => {
119
- i.setAttribute(d, "true");
120
- }), H(t.form);
121
- const n = o.map((i) => {
122
- const m = () => {
123
- g(i);
124
- };
125
- return i.addEventListener("input", m), i.addEventListener("change", m), g(i), () => {
126
- i.removeEventListener("input", m), i.removeEventListener("change", m);
127
- };
128
- });
129
- return await t.emit("formie:module:text-limit:init", {
130
- count: r.length
131
- }), {
132
- destroy: () => {
133
- n.forEach((i) => {
134
- i();
135
- }), a.allowOvertype && r.forEach((i) => {
136
- i.removeAttribute(d);
137
- }), X(t.form), t.emit("formie:module:text-limit:destroy", {});
138
- }
139
- };
140
- }
141
- };
142
- export {
143
- j as textLimitModule
144
- };
@@ -1,59 +0,0 @@
1
- import { a as s, c as u, f as i, b as d, C as p } from "./index-D6npYxvr.js";
2
- import { l as f } from "./scripts-CKTFtxPO.js";
3
- function m(e) {
4
- const r = e.appearance || "always";
5
- return (e.execution || (r === "execute" ? "execute" : "render")) === "execute" ? u : i;
6
- }
7
- async function _(e) {
8
- const { async: r, defer: t } = d(e.loadingMethod);
9
- return f("turnstile", {
10
- id: "FORMIE_TURNSTILE_SCRIPT",
11
- src: "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",
12
- async: r,
13
- defer: t,
14
- timeoutMs: p
15
- });
16
- }
17
- const A = s({
18
- id: "turnstile",
19
- defaultPlaceholderSelector: "[data-turnstile-placeholder]",
20
- defaultTokenFieldNames: ["cf-turnstile-response"],
21
- load: ({ options: e }) => _(e.provider),
22
- mount: ({ api: e, container: r, provider: t, services: a }) => {
23
- const l = t.appearance || "always", o = t.execution || (l === "execute" ? "execute" : "render");
24
- return e.render(r, {
25
- sitekey: t.siteKey || "",
26
- theme: t.theme || "auto",
27
- size: t.size || "normal",
28
- appearance: l,
29
- execution: o,
30
- callback: (n) => {
31
- typeof n == "string" && n.trim() !== "" && a.tokens.write(n.trim()), a.errors.clear();
32
- },
33
- "expired-callback": () => {
34
- a.tokens.clear(), a.errors.clear();
35
- },
36
- "timeout-callback": () => {
37
- a.tokens.clear(), a.errors.clear();
38
- },
39
- "error-callback": () => {
40
- a.tokens.clear();
41
- }
42
- });
43
- },
44
- screen: ({ api: e, widget: r, placeholder: t, services: a, provider: l, stageCtx: o }) => {
45
- if (!a.tokens.has())
46
- return e.execute(r), a.tokens.wait(m(l)).then((n) => {
47
- if (!n) {
48
- const c = a.errors.getDefaultMessage();
49
- a.errors.show(c, t), o.abort(c);
50
- }
51
- });
52
- },
53
- unmount: ({ api: e, widget: r, services: t }) => {
54
- e.reset(r), t.tokens.clear();
55
- }
56
- });
57
- export {
58
- A as turnstileModule
59
- };