@verbb/formie-browser 1.0.3 → 1.0.4
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 +8 -0
- package/dist/chunks/{address-finder-BjMuEiwF.js → address-finder-BU4roxT6.js} +2 -2
- package/dist/chunks/{bpoint-KudsBCo2.js → bpoint-uNg5j6rt.js} +1 -1
- package/dist/chunks/{calculations-DlGSkQ3W.js → calculations-C9t6Zop9.js} +2 -2
- package/dist/chunks/{captcha-eu-CterYFok.js → captcha-eu-BAPzHNts.js} +2 -2
- package/dist/chunks/{checkbox-radio-CBvgk3hR.js → checkbox-radio-CHeLNVIK.js} +39 -34
- package/dist/chunks/{conditions-DYy1-Hwt.js → conditions-DKxVCsjD.js} +2 -2
- package/dist/chunks/{date-picker-BlD--zfe.js → date-picker-B3iQ797Z.js} +2 -2
- package/dist/chunks/{eway-qwc-B5Us.js → eway-DCielIML.js} +2 -2
- package/dist/chunks/{file-upload-CIgHrXfp.js → file-upload-DP2TOUYV.js} +34 -34
- package/dist/chunks/{friendly-captcha-v1-EDFac33c.js → friendly-captcha-v1-DdlcGiFY.js} +1 -1
- package/dist/chunks/{friendly-captcha-v2-BDpSvFGR.js → friendly-captcha-v2-76w-YnFm.js} +1 -1
- package/dist/chunks/{go-cardless-DuDMVsnz.js → go-cardless-rwCkzbNK.js} +1 -1
- package/dist/chunks/{google-address-Bmjp01pH.js → google-address-BD8IZ86V.js} +2 -2
- package/dist/chunks/{hcaptcha-BTQ6An6g.js → hcaptcha-BNNTL6uf.js} +2 -2
- package/dist/chunks/{hidden-DbPdOxKb.js → hidden-CW6Rcf1N.js} +1 -1
- package/dist/chunks/{index-BcqwpPNE.js → index-D6npYxvr.js} +790 -681
- package/dist/chunks/{loqate-BdNGv93o.js → loqate-B-ZNS65B.js} +2 -2
- package/dist/chunks/{mollie-DFOjTuGX.js → mollie-BDAZ-1X4.js} +1 -1
- package/dist/chunks/{moneris-BbFfl-EL.js → moneris-B1b0uEtY.js} +1 -1
- package/dist/chunks/{opayo-CmgYa9ya.js → opayo-CC5hraHo.js} +2 -2
- package/dist/chunks/{paddle-BUi7w1_o.js → paddle-B4GmrDsq.js} +2 -2
- package/dist/chunks/{paypal-A-ePfh6k.js → paypal-BFS6XsIS.js} +2 -2
- package/dist/chunks/{payway-BqFCbhyo.js → payway-DekoJead.js} +2 -2
- package/dist/chunks/{phone-country-DPMiqk4L.js → phone-country-Cm5YUeXI.js} +2 -2
- package/dist/chunks/{place-kit-CX7tamAg.js → place-kit-DizZWV_e.js} +1 -1
- package/dist/chunks/{recaptcha-enterprise-DxF6cW95.js → recaptcha-enterprise-BbOvO7JZ.js} +2 -2
- package/dist/chunks/{recaptcha-shared-DhGcbiaq.js → recaptcha-shared-Dwg1eVFS.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-R9EfbZ4k.js → recaptcha-v2-checkbox-SY3ti5iQ.js} +2 -2
- package/dist/chunks/{recaptcha-v2-invisible-DV9hswAp.js → recaptcha-v2-invisible-DSmQnn6c.js} +2 -2
- package/dist/chunks/{recaptcha-v3-V0xc-Edh.js → recaptcha-v3-DNh7YCnR.js} +2 -2
- package/dist/chunks/{repeater-DKUT6TGI.js → repeater-DM0vuFNQ.js} +2 -2
- package/dist/chunks/{rich-text-SH7KiaKH.js → rich-text-C8aGYp70.js} +1 -1
- package/dist/chunks/{scripts-D9N2d5rN.js → scripts-CKTFtxPO.js} +1 -1
- package/dist/chunks/{shared-BmntPmnW.js → shared--BU5CFoL.js} +1 -1
- package/dist/chunks/{signature-BA3tQsGT.js → signature-pFhZfH7d.js} +1 -1
- package/dist/chunks/{snaptcha-DV7p6J9k.js → snaptcha-VuOUOaLj.js} +1 -1
- package/dist/chunks/{square-Bs-ndqYK.js → square-BR9pvToy.js} +4 -4
- package/dist/chunks/{stripe-DkZAHxtn.js → stripe-OHUwoV9g.js} +2 -2
- package/dist/chunks/{summary-Dq2i9TQk.js → summary-Da7Ktg3N.js} +2 -2
- package/dist/chunks/{table-Cu4WfVcw.js → table-C0PmR9bI.js} +2 -2
- package/dist/chunks/text-limit-mLEwZDIa.js +144 -0
- package/dist/chunks/{turnstile-CId90tRr.js → turnstile-9tM7q_LK.js} +2 -2
- package/dist/index.js +9 -9
- package/dist/js/core/field-error-container.d.ts +4 -0
- package/dist/js/core/field-error-container.d.ts.map +1 -0
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
- package/dist/js/utils/i18n.d.ts.map +1 -1
- package/dist/js/validation/rules/email.d.ts.map +1 -1
- package/dist/js/validation/rules/number.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/js/core/field-error-container.ts +39 -0
- package/src/js/core/submit-result-state.ts +12 -2
- package/src/js/core/submit-result-ui.ts +3 -9
- package/src/js/modules/fields/checkbox-radio.ts +21 -15
- package/src/js/modules/fields/file-upload.ts +12 -9
- package/src/js/modules/fields/text-limit.ts +87 -22
- package/src/js/utils/i18n.ts +184 -5
- package/src/js/validation/rules/email.ts +3 -2
- package/src/js/validation/rules/match.ts +2 -2
- package/src/js/validation/rules/minmax.ts +4 -4
- package/src/js/validation/rules/number.ts +9 -5
- package/src/js/validation/rules/pattern.ts +4 -4
- package/src/js/validation/rules/required.ts +1 -1
- package/src/js/validation/rules/url.ts +1 -1
- package/src/js/validation/validator.ts +7 -7
- package/dist/chunks/text-limit-2ycmB-Ae.js +0 -135
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as p, g as a } from "./index-
|
|
2
|
-
import { l as _ } from "./scripts-
|
|
1
|
+
import { d as p, g as a } from "./index-D6npYxvr.js";
|
|
2
|
+
import { l as _ } from "./scripts-CKTFtxPO.js";
|
|
3
3
|
const f = "FORMIE_ADDRESS_FINDER_SCRIPT", g = p({
|
|
4
4
|
id: "address-finder",
|
|
5
5
|
load: async () => _("AddressFinder", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as H, _ as A, $ as D, U as N, F as T } from "./index-BEsfee-D.js";
|
|
2
|
-
import { g as K, d as L } from "./shared
|
|
3
|
-
import { h as R, i as k, n as U, j as V, r as _ } from "./index-
|
|
2
|
+
import { g as K, d as L } from "./shared--BU5CFoL.js";
|
|
3
|
+
import { h as R, i as k, n as U, j as V, r as _ } from "./index-D6npYxvr.js";
|
|
4
4
|
const S = "input[data-formie-calculation-input]", y = "calculations", g = R("fields", "calculations");
|
|
5
5
|
function j(e, r, t) {
|
|
6
6
|
const a = k(e), o = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as l, C as n } from "./index-
|
|
2
|
-
import { l as s } from "./scripts-
|
|
1
|
+
import { a as l, C as n } from "./index-D6npYxvr.js";
|
|
2
|
+
import { l as s } from "./scripts-CKTFtxPO.js";
|
|
3
3
|
async function c(e) {
|
|
4
4
|
const t = String(e.endPoint || "https://www.captcha.eu").trim().replace(/\/+$/, "");
|
|
5
5
|
return s("KROT", {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import { h as L } from "./index-
|
|
3
|
-
const l = "[data-formie-checkboxes-field-layout], [data-formie-radio-field-layout]",
|
|
1
|
+
import { r as p, d as E, a as M, e as v } from "./shared--BU5CFoL.js";
|
|
2
|
+
import { h as L } from "./index-D6npYxvr.js";
|
|
3
|
+
const l = "[data-formie-checkboxes-field-layout], [data-formie-radio-field-layout]", u = "minmaxOptions", h = "data-formie-checkbox-radio-max-disabled", A = "checkbox-radio", x = "checkbox-radio", d = L("fields", "checkbox-radio");
|
|
4
4
|
function m(t) {
|
|
5
5
|
return t.hasAttribute("data-checkbox-toggle") || t.hasAttribute("data-formie-checkbox-toggle");
|
|
6
6
|
}
|
|
7
7
|
function b(t) {
|
|
8
|
-
const r = t(
|
|
8
|
+
const r = t(u);
|
|
9
9
|
if (!r || r === !0 || typeof r != "object")
|
|
10
10
|
return {
|
|
11
11
|
min: null,
|
|
@@ -17,30 +17,35 @@ function b(t) {
|
|
|
17
17
|
max: typeof o.max == "number" ? o.max : null
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
function k(t) {
|
|
21
|
+
return Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((r) => r instanceof HTMLInputElement && !m(r)).filter((r) => r.checked).length;
|
|
22
|
+
}
|
|
20
23
|
function T(t) {
|
|
21
|
-
|
|
24
|
+
p(t, x, (r) => {
|
|
22
25
|
r.addValidator(
|
|
23
|
-
|
|
26
|
+
u,
|
|
24
27
|
({ field: o, getRule: e }) => {
|
|
25
|
-
if (!o || !e(
|
|
28
|
+
if (!o || !e(u))
|
|
26
29
|
return !0;
|
|
27
|
-
const
|
|
28
|
-
return !(
|
|
30
|
+
const a = k(o), { min: n, max: c } = b(e);
|
|
31
|
+
return !(n !== null && a < n || c !== null && a > c);
|
|
29
32
|
},
|
|
30
|
-
({ field: o, label: e, t:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
({ field: o, label: e, t: a, getRule: n }) => {
|
|
34
|
+
if (!o)
|
|
35
|
+
return a("{label} has an invalid value.", { label: e });
|
|
36
|
+
const c = k(o), { min: i, max: f } = b(n);
|
|
37
|
+
return i !== null && c < i ? o.getAttribute("data-formie-validation-min-options-message") ?? a("{label} should contain at least {min, number} {min, plural, one{option} other{options}}.", { label: e, min: i }) : f !== null && c > f ? o.getAttribute("data-formie-validation-max-options-message") ?? a("{label} should contain at most {max, number} {max, plural, one{option} other{options}}.", { label: e, max: f }) : a("{label} has an invalid value.", { label: e });
|
|
33
38
|
}
|
|
34
39
|
);
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
42
|
function q(t) {
|
|
38
|
-
|
|
43
|
+
M(t, x, [u]);
|
|
39
44
|
}
|
|
40
45
|
function s(t) {
|
|
41
46
|
t.checked ? t.setAttribute("checked", "") : t.removeAttribute("checked");
|
|
42
47
|
}
|
|
43
|
-
function
|
|
48
|
+
function y(t) {
|
|
44
49
|
const r = Array.from(t.querySelectorAll('input[type="checkbox"][required][data-formie-checkbox-input]')).filter((e) => e instanceof HTMLInputElement);
|
|
45
50
|
if (!r.length)
|
|
46
51
|
return;
|
|
@@ -53,52 +58,52 @@ function k(t) {
|
|
|
53
58
|
e.setAttribute("required", "true"), e.setAttribute("aria-required", "true");
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
|
-
function
|
|
61
|
+
function g(t) {
|
|
57
62
|
const r = parseInt(t.closest("[data-formie-field-handle]")?.getAttribute("data-formie-max-options") || "", 10);
|
|
58
63
|
if (!(r > 0))
|
|
59
64
|
return;
|
|
60
|
-
const o = Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((n) => n instanceof HTMLInputElement && !m(n)),
|
|
65
|
+
const o = Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((n) => n instanceof HTMLInputElement && !m(n)), a = o.filter((n) => n.checked).length >= r;
|
|
61
66
|
o.forEach((n) => {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
67
|
+
const c = a && !n.checked, i = n.hasAttribute(h);
|
|
68
|
+
if (c) {
|
|
64
69
|
n.disabled || (n.disabled = !0, n.setAttribute(h, "true"));
|
|
65
70
|
return;
|
|
66
71
|
}
|
|
67
72
|
i && (n.disabled = !1, n.removeAttribute(h));
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
|
-
function
|
|
75
|
+
function I(t, r) {
|
|
71
76
|
Array.from(t.querySelectorAll('input[type="checkbox"]')).filter((e) => e instanceof HTMLInputElement && e !== r && !m(e)).forEach((e) => {
|
|
72
77
|
e.disabled && !e.checked || (e.checked = r.checked, s(e), e.dispatchEvent(new Event("change", { bubbles: !0 })), e.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
|
-
function
|
|
80
|
+
function C(t, r) {
|
|
76
81
|
if (!t.checked || !t.name) {
|
|
77
82
|
s(t);
|
|
78
83
|
return;
|
|
79
84
|
}
|
|
80
|
-
Array.from(r.querySelectorAll(`input[type="radio"][name="${
|
|
85
|
+
Array.from(r.querySelectorAll(`input[type="radio"][name="${v(t.name)}"]`)).filter((e) => e instanceof HTMLInputElement).forEach((e) => {
|
|
81
86
|
s(e);
|
|
82
87
|
});
|
|
83
88
|
}
|
|
84
|
-
function
|
|
89
|
+
function S(t) {
|
|
85
90
|
const r = Array.from(t.querySelectorAll('input[type="checkbox"], input[type="radio"]')).filter((e) => e instanceof HTMLInputElement);
|
|
86
91
|
if (!r.length)
|
|
87
|
-
return
|
|
92
|
+
return d.log("No checkbox/radio inputs found for field."), () => {
|
|
88
93
|
};
|
|
89
94
|
const o = r.map((e) => {
|
|
90
|
-
const
|
|
91
|
-
s(e), e.type === "checkbox" && m(e) &&
|
|
95
|
+
const a = e.type === "radio" ? "change" : "click", n = () => {
|
|
96
|
+
s(e), e.type === "checkbox" && m(e) && I(t, e), e.type === "radio" && C(e, t), y(t), g(t), d.log("Input interaction processed.", {
|
|
92
97
|
inputName: e.name,
|
|
93
98
|
inputType: e.type,
|
|
94
99
|
checked: e.checked
|
|
95
100
|
});
|
|
96
101
|
};
|
|
97
|
-
return e.addEventListener(
|
|
98
|
-
e.removeEventListener(
|
|
102
|
+
return e.addEventListener(a, n), s(e), () => {
|
|
103
|
+
e.removeEventListener(a, n);
|
|
99
104
|
};
|
|
100
105
|
});
|
|
101
|
-
return
|
|
106
|
+
return y(t), g(t), E(t, A, "init", {
|
|
102
107
|
checkboxRadio: t
|
|
103
108
|
}), () => {
|
|
104
109
|
o.forEach((e) => {
|
|
@@ -106,25 +111,25 @@ function C(t) {
|
|
|
106
111
|
});
|
|
107
112
|
};
|
|
108
113
|
}
|
|
109
|
-
const
|
|
110
|
-
id:
|
|
114
|
+
const O = {
|
|
115
|
+
id: A,
|
|
111
116
|
kind: "field",
|
|
112
117
|
match: (t) => t.target instanceof HTMLElement && (t.target.matches(l) || !!t.target.querySelector(l)),
|
|
113
118
|
setup: async (t) => {
|
|
114
119
|
if (!(t.target instanceof HTMLElement))
|
|
115
120
|
return;
|
|
116
121
|
const r = t.target.matches(l) ? [t.target] : Array.from(t.target.querySelectorAll(l)).filter((e) => e instanceof HTMLElement);
|
|
117
|
-
T(t.form),
|
|
122
|
+
T(t.form), d.log("Module setup.", {
|
|
118
123
|
fieldCount: r.length
|
|
119
124
|
});
|
|
120
|
-
const o = r.map((e) =>
|
|
125
|
+
const o = r.map((e) => S(e));
|
|
121
126
|
return await t.emit("formie:module:checkbox-radio:init", {
|
|
122
127
|
count: r.length
|
|
123
128
|
}), {
|
|
124
129
|
destroy: () => {
|
|
125
130
|
o.forEach((e) => {
|
|
126
131
|
e();
|
|
127
|
-
}), q(t.form),
|
|
132
|
+
}), q(t.form), d.log("Module destroy.", {
|
|
128
133
|
fieldCount: r.length
|
|
129
134
|
}), t.emit("formie:module:checkbox-radio:destroy", {});
|
|
130
135
|
}
|
|
@@ -132,5 +137,5 @@ const H = {
|
|
|
132
137
|
}
|
|
133
138
|
};
|
|
134
139
|
export {
|
|
135
|
-
|
|
140
|
+
O as checkboxRadioModule
|
|
136
141
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as te, A as re } from "./index-BEsfee-D.js";
|
|
2
|
-
import { e as V } from "./shared
|
|
3
|
-
import { j as F, h as ne } from "./index-
|
|
2
|
+
import { e as V } from "./shared--BU5CFoL.js";
|
|
3
|
+
import { j as F, h as ne } from "./index-D6npYxvr.js";
|
|
4
4
|
const D = "[data-formie-conditions]";
|
|
5
5
|
function ie(e) {
|
|
6
6
|
if (!e || typeof e != "object")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as st, d as Qn } from "./shared
|
|
1
|
+
import { g as st, d as Qn } from "./shared--BU5CFoL.js";
|
|
2
2
|
import { e as ft } from "./styles-C3aqgtek.js";
|
|
3
|
-
import { h as ut } from "./index-
|
|
3
|
+
import { h as ut } from "./index-D6npYxvr.js";
|
|
4
4
|
function ct(a, i) {
|
|
5
5
|
for (var e = 0; e < i.length; e++) {
|
|
6
6
|
const u = i[e];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { r as
|
|
1
|
+
import { r as V, a as K, d as O } from "./shared--BU5CFoL.js";
|
|
2
2
|
import { e as q } from "./styles-C3aqgtek.js";
|
|
3
|
-
import { k as B, l as j, m as W, o as Y } from "./index-
|
|
4
|
-
const $ = "@layer formie-theme{.formie-file-input{padding:var(--formie-space-1);line-height:var(--formie-line-height-base);cursor:pointer}.formie-file-input::file-selector-button,.formie-file-input::-webkit-file-upload-button{appearance:none;-webkit-appearance:none;margin-inline-end:var(--formie-space-2);padding:calc(var(--formie-control-padding-y) - 1px) var(--formie-space-2);min-height:calc(var(--formie-control-height) - (var(--formie-space-1) * 2));border:var(--formie-border-width) solid var(--formie-color-border);border-radius:calc(var(--formie-radius-sm) - 1px);background:var(--formie-color-surface-subtle);color:var(--formie-color-heading);font-weight:var(--formie-font-weight-normal);font-size:var(--formie-font-size-xs);line-height:1.1;white-space:nowrap;cursor:pointer;transition:border-color .15s ease,background-color .15s ease,color .15s ease,box-shadow .15s ease}.formie-file-input:hover::file-selector-button,.formie-file-input:hover::-webkit-file-upload-button{border-color:color-mix(in srgb,var(--formie-color-border) 70%,var(--formie-color-heading) 30%);background:var(--formie-color-surface-muted)}.formie-file-input:focus{outline:0}.formie-file-input:focus-visible::file-selector-button,.formie-file-input:focus-visible::-webkit-file-upload-button{border-color:var(--formie-color-focus-ring)}.formie-field-has-error .formie-file-input::file-selector-button,.formie-field-has-error .formie-file-input::-webkit-file-upload-button{border-color:var(--formie-color-danger)}.formie-file-summary{padding:var(--formie-file-summary-padding);gap:var(--formie-gap-file-summary);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm)}.formie-file-summary-container{margin:0;padding-left:var(--formie-list-indent)}}", _ = 'input[type="file"][data-formie-file-input]', F = j("uploaded"), L = W("reset"), J = "data-formie-file-upload-key", G = "data-formie-file-upload-hydrate-endpoint",
|
|
3
|
+
import { k as B, l as j, m as W, o as Y } from "./index-D6npYxvr.js";
|
|
4
|
+
const $ = "@layer formie-theme{.formie-file-input{padding:var(--formie-space-1);line-height:var(--formie-line-height-base);cursor:pointer}.formie-file-input::file-selector-button,.formie-file-input::-webkit-file-upload-button{appearance:none;-webkit-appearance:none;margin-inline-end:var(--formie-space-2);padding:calc(var(--formie-control-padding-y) - 1px) var(--formie-space-2);min-height:calc(var(--formie-control-height) - (var(--formie-space-1) * 2));border:var(--formie-border-width) solid var(--formie-color-border);border-radius:calc(var(--formie-radius-sm) - 1px);background:var(--formie-color-surface-subtle);color:var(--formie-color-heading);font-weight:var(--formie-font-weight-normal);font-size:var(--formie-font-size-xs);line-height:1.1;white-space:nowrap;cursor:pointer;transition:border-color .15s ease,background-color .15s ease,color .15s ease,box-shadow .15s ease}.formie-file-input:hover::file-selector-button,.formie-file-input:hover::-webkit-file-upload-button{border-color:color-mix(in srgb,var(--formie-color-border) 70%,var(--formie-color-heading) 30%);background:var(--formie-color-surface-muted)}.formie-file-input:focus{outline:0}.formie-file-input:focus-visible::file-selector-button,.formie-file-input:focus-visible::-webkit-file-upload-button{border-color:var(--formie-color-focus-ring)}.formie-field-has-error .formie-file-input::file-selector-button,.formie-field-has-error .formie-file-input::-webkit-file-upload-button{border-color:var(--formie-color-danger)}.formie-file-summary{padding:var(--formie-file-summary-padding);gap:var(--formie-gap-file-summary);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm)}.formie-file-summary-container{margin:0;padding-left:var(--formie-list-indent)}}", _ = 'input[type="file"][data-formie-file-input]', F = j("uploaded"), L = W("reset"), J = "data-formie-file-upload-key", G = "data-formie-file-upload-hydrate-endpoint", b = "data-formie-file-upload-anchor", Q = "data-formie-file-upload-asset-id", X = [
|
|
5
5
|
"fileLimit",
|
|
6
6
|
"fileSizeMinLimit",
|
|
7
7
|
"fileSizeMaxLimit"
|
|
8
8
|
], w = "file-upload", E = "file-upload", T = B("repeater", "init-row"), Z = "[data-formie-field-handle]";
|
|
9
9
|
q(E, [$]);
|
|
10
|
-
function
|
|
10
|
+
function g(e) {
|
|
11
11
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function I(e) {
|
|
14
14
|
const t = Number(e);
|
|
15
15
|
return Number.isInteger(t) && t > 0 ? t : null;
|
|
16
16
|
}
|
|
@@ -29,32 +29,32 @@ function D(e) {
|
|
|
29
29
|
function ee(e) {
|
|
30
30
|
return e.getAttribute(J)?.trim() || e.getAttribute("data-formie-input-id")?.trim() || "";
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function x(e) {
|
|
33
33
|
return Array.from(e.querySelectorAll('input[type="hidden"]')).filter((t) => t instanceof HTMLInputElement);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function C(e, t) {
|
|
36
36
|
const r = D(t);
|
|
37
|
-
return
|
|
37
|
+
return x(e).filter((n) => n.name === r && n.value.trim() !== "");
|
|
38
38
|
}
|
|
39
39
|
function te(e, t) {
|
|
40
|
-
const r = k(t), n =
|
|
40
|
+
const r = k(t), n = x(e).find((s) => s.hasAttribute(b) || s.name === r && s.value === "");
|
|
41
41
|
if (n)
|
|
42
|
-
return n.setAttribute(
|
|
42
|
+
return n.setAttribute(b, "true"), n.name = r, n.value = "", n;
|
|
43
43
|
const i = document.createElement("input");
|
|
44
|
-
return i.type = "hidden", i.name = r, i.value = "", i.setAttribute(
|
|
44
|
+
return i.type = "hidden", i.name = r, i.value = "", i.setAttribute(b, "true"), t.insertAdjacentElement("afterend", i), i;
|
|
45
45
|
}
|
|
46
46
|
function N(e) {
|
|
47
47
|
if (Array.isArray(e))
|
|
48
48
|
return null;
|
|
49
|
-
const t =
|
|
49
|
+
const t = I(e);
|
|
50
50
|
if (t)
|
|
51
51
|
return {
|
|
52
52
|
assetId: t,
|
|
53
53
|
filename: ""
|
|
54
54
|
};
|
|
55
|
-
if (!
|
|
55
|
+
if (!g(e))
|
|
56
56
|
return null;
|
|
57
|
-
const r =
|
|
57
|
+
const r = I(e.assetId ?? e.id ?? e.value), n = c(e.filename ?? e.title ?? e.label ?? e.name), i = c(e.url) || null;
|
|
58
58
|
return !r && !n ? null : {
|
|
59
59
|
assetId: r,
|
|
60
60
|
filename: n,
|
|
@@ -80,8 +80,8 @@ function S(e) {
|
|
|
80
80
|
})).filter((t) => t.filename !== "") : [];
|
|
81
81
|
}
|
|
82
82
|
function H(e, t) {
|
|
83
|
-
return
|
|
84
|
-
assetId:
|
|
83
|
+
return C(e, t).map((r) => ({
|
|
84
|
+
assetId: I(r.value),
|
|
85
85
|
filename: ""
|
|
86
86
|
})).filter((r) => r.assetId !== null);
|
|
87
87
|
}
|
|
@@ -99,29 +99,29 @@ function re(e, t) {
|
|
|
99
99
|
return !r.length || !n.length ? !1 : r.every((i) => n.includes(i));
|
|
100
100
|
}
|
|
101
101
|
function ne(e) {
|
|
102
|
-
|
|
102
|
+
V(e, w, (t) => {
|
|
103
103
|
t.addValidator("fileLimit", ({ input: r }) => {
|
|
104
104
|
const n = parseInt(r.getAttribute("data-formie-file-limit") || "", 10);
|
|
105
105
|
return r.type !== "file" || !n || !("files" in r) || !r.files?.length ? !0 : r.files.length <= n;
|
|
106
|
-
}, ({ input: r, t: n }) => n("Choose up to {files} files.", {
|
|
106
|
+
}, ({ input: r, t: n }) => r.getAttribute("data-formie-validation-max-files-message") ?? n("Choose up to {files} files.", {
|
|
107
107
|
files: r.getAttribute("data-formie-file-limit") || ""
|
|
108
108
|
})), t.addValidator("fileSizeMinLimit", ({ input: r }) => {
|
|
109
109
|
const i = parseFloat(r.getAttribute("data-formie-size-min-limit") || "") * 1e3 * 1e3;
|
|
110
110
|
return r.type !== "file" || !i || !("files" in r) || !r.files?.length ? !0 : Array.from(r.files).every((s) => s.size >= i);
|
|
111
|
-
}, ({ input: r, t: n }) => n("File must be larger than {filesize} MB.", {
|
|
111
|
+
}, ({ input: r, t: n }) => r.getAttribute("data-formie-validation-min-file-size-message") ?? n("File must be larger than {filesize} MB.", {
|
|
112
112
|
filesize: r.getAttribute("data-formie-size-min-limit") || ""
|
|
113
113
|
})), t.addValidator("fileSizeMaxLimit", ({ input: r }) => {
|
|
114
114
|
const i = parseFloat(r.getAttribute("data-formie-size-max-limit") || "") * 1e3 * 1e3;
|
|
115
115
|
return r.type !== "file" || !i || !("files" in r) || !r.files?.length ? !0 : Array.from(r.files).every((s) => s.size <= i);
|
|
116
|
-
}, ({ input: r, t: n }) => n("File must be smaller than {filesize} MB.", {
|
|
116
|
+
}, ({ input: r, t: n }) => r.getAttribute("data-formie-validation-max-file-size-message") ?? n("File must be smaller than {filesize} MB.", {
|
|
117
117
|
filesize: r.getAttribute("data-formie-size-max-limit") || ""
|
|
118
118
|
}));
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
function ie(e) {
|
|
122
|
-
|
|
122
|
+
K(e, w, X);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function P(e, t) {
|
|
125
125
|
const r = e.querySelector("[data-formie-file-summary]");
|
|
126
126
|
if (r)
|
|
127
127
|
return r;
|
|
@@ -134,7 +134,7 @@ function y(e) {
|
|
|
134
134
|
r && (r.replaceChildren(), r.hidden = !0), e.summaryRoot = r;
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
const n = r ||
|
|
137
|
+
const n = r || P(e.field, e.input);
|
|
138
138
|
if (!n)
|
|
139
139
|
return;
|
|
140
140
|
n.hidden = !1, e.summaryRoot = n;
|
|
@@ -147,7 +147,7 @@ function y(e) {
|
|
|
147
147
|
function R(e, t, r) {
|
|
148
148
|
let i = te(e, t);
|
|
149
149
|
const s = D(t);
|
|
150
|
-
|
|
150
|
+
C(e, t).forEach((o) => {
|
|
151
151
|
o.remove();
|
|
152
152
|
}), r.forEach((o) => {
|
|
153
153
|
if (!o.assetId)
|
|
@@ -194,25 +194,25 @@ async function ae(e, t, r) {
|
|
|
194
194
|
}
|
|
195
195
|
function le(e, t) {
|
|
196
196
|
const r = e.detail;
|
|
197
|
-
if (!
|
|
197
|
+
if (!g(r))
|
|
198
198
|
return [];
|
|
199
|
-
const n = c(r.fieldHandle), i = c(r.inputKey), s = c(r.inputName ?? r.name), o =
|
|
200
|
-
let m = !1, u = !1,
|
|
201
|
-
if (i !== "" && i === t.inputKey && (m = !0, d.push(r.assets, r.assetIds, r.data)), s !== "" && s === t.inputName && (u = !0, d.push(r.assets, r.assetIds, r.data)), n === t.fieldHandle && (
|
|
199
|
+
const n = c(r.fieldHandle), i = c(r.inputKey), s = c(r.inputName ?? r.name), o = g(r.data) ? r.data : null, l = c(o?.fieldHandle), a = c(o?.inputKey), p = c(o?.inputName ?? o?.name), d = [];
|
|
200
|
+
let m = !1, u = !1, h = !1;
|
|
201
|
+
if (i !== "" && i === t.inputKey && (m = !0, d.push(r.assets, r.assetIds, r.data)), s !== "" && s === t.inputName && (u = !0, d.push(r.assets, r.assetIds, r.data)), n === t.fieldHandle && (h = !0, d.push(r.assets, r.assetIds, r.data)), o) {
|
|
202
202
|
const f = [
|
|
203
203
|
o.assets,
|
|
204
204
|
o.assetIds,
|
|
205
205
|
o.uploadedAssets,
|
|
206
206
|
o.data
|
|
207
207
|
];
|
|
208
|
-
a !== "" && a === t.inputKey && (m = !0, d.push(...f)), p !== "" && p === t.inputName && (u = !0, d.push(...f)), l === t.fieldHandle && (
|
|
208
|
+
a !== "" && a === t.inputKey && (m = !0, d.push(...f)), p !== "" && p === t.inputName && (u = !0, d.push(...f)), l === t.fieldHandle && (h = !0, d.push(...f));
|
|
209
209
|
}
|
|
210
210
|
[r.assets, r.assetIds, r.data].forEach((f) => {
|
|
211
|
-
|
|
211
|
+
g(f) && (t.inputKey && t.inputKey in f && (m = !0, d.push(f[t.inputKey])), t.inputName in f && (u = !0, d.push(f[t.inputName])), t.fieldHandle in f && d.push(f[t.fieldHandle]));
|
|
212
212
|
});
|
|
213
213
|
for (const f of d) {
|
|
214
214
|
const A = v(f);
|
|
215
|
-
if (A.length && (m || u ||
|
|
215
|
+
if (A.length && (m || u || h || re(A, t.pendingFiles)))
|
|
216
216
|
return A;
|
|
217
217
|
}
|
|
218
218
|
return [];
|
|
@@ -228,7 +228,7 @@ function fe(e, t, r) {
|
|
|
228
228
|
const n = {
|
|
229
229
|
field: e,
|
|
230
230
|
input: t,
|
|
231
|
-
summaryRoot:
|
|
231
|
+
summaryRoot: P(e, t),
|
|
232
232
|
uploadedAssets: U(
|
|
233
233
|
H(e, t),
|
|
234
234
|
S(e.querySelector("[data-formie-file-summary]"))
|
|
@@ -245,7 +245,7 @@ function fe(e, t, r) {
|
|
|
245
245
|
const u = await ae(e, t, d);
|
|
246
246
|
if (m !== n.hydrationToken)
|
|
247
247
|
return;
|
|
248
|
-
n.uploadedAssets = u, y(n),
|
|
248
|
+
n.uploadedAssets = u, y(n), O(e, E, "uploaded-assets-sync", {
|
|
249
249
|
fileUpload: e,
|
|
250
250
|
assets: u
|
|
251
251
|
});
|
|
@@ -295,7 +295,7 @@ const ye = {
|
|
|
295
295
|
ne(t), i(e.target);
|
|
296
296
|
const s = (o) => {
|
|
297
297
|
const l = o.detail;
|
|
298
|
-
if (!
|
|
298
|
+
if (!g(l))
|
|
299
299
|
return;
|
|
300
300
|
const a = l.row;
|
|
301
301
|
a instanceof HTMLElement && i(a);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as x, g as E } from "./index-
|
|
2
|
-
import { e as v, a as L } from "./scripts-
|
|
1
|
+
import { d as x, g as E } from "./index-D6npYxvr.js";
|
|
2
|
+
import { e as v, a as L } from "./scripts-CKTFtxPO.js";
|
|
3
3
|
const w = "FORMIE_GOOGLE_ADDRESS_SCRIPT", m = "formieGoogleMapsReady";
|
|
4
4
|
let f = null;
|
|
5
5
|
async function R(t) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as h, b as i, C as d } from "./index-
|
|
2
|
-
import { a as p, e as m } from "./scripts-
|
|
1
|
+
import { a as h, b as i, C as d } from "./index-D6npYxvr.js";
|
|
2
|
+
import { a as p, e as m } from "./scripts-CKTFtxPO.js";
|
|
3
3
|
async function u(a) {
|
|
4
4
|
const o = typeof a.language == "string" && a.language.trim() !== "" ? a.language.trim() : "en", { async: t, defer: e } = i(a.loadingMethod), r = "FORMIE_HCAPTCHA_ONLOAD", c = window, l = c.hcaptcha;
|
|
5
5
|
if (l)
|