@verbb/formie-browser 1.0.2 → 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 +16 -0
- package/dist/chunks/{address-finder-CQW81kY0.js → address-finder-BU4roxT6.js} +2 -2
- package/dist/chunks/{bpoint-D8OjLmsn.js → bpoint-uNg5j6rt.js} +1 -1
- package/dist/chunks/{calculations-BqZsENCq.js → calculations-C9t6Zop9.js} +2 -2
- package/dist/chunks/{captcha-eu-DIa6aUWz.js → captcha-eu-BAPzHNts.js} +2 -2
- package/dist/chunks/{checkbox-radio-BI-UjgMF.js → checkbox-radio-CHeLNVIK.js} +39 -34
- package/dist/chunks/{conditions-BVl6jTYo.js → conditions-DKxVCsjD.js} +189 -163
- package/dist/chunks/{date-picker-69TgvErA.js → date-picker-B3iQ797Z.js} +2 -2
- package/dist/chunks/{eway-1GPxH6DU.js → eway-DCielIML.js} +2 -2
- package/dist/chunks/file-upload-DP2TOUYV.js +316 -0
- package/dist/chunks/{friendly-captcha-v1-DA2QPKA3.js → friendly-captcha-v1-DdlcGiFY.js} +1 -1
- package/dist/chunks/{friendly-captcha-v2-BorOWiz_.js → friendly-captcha-v2-76w-YnFm.js} +1 -1
- package/dist/chunks/{go-cardless-DwBgERcA.js → go-cardless-rwCkzbNK.js} +1 -1
- package/dist/chunks/{google-address-BcTBncyS.js → google-address-BD8IZ86V.js} +77 -58
- package/dist/chunks/{hcaptcha-BchdVCqq.js → hcaptcha-BNNTL6uf.js} +2 -2
- package/dist/chunks/{hidden-D8RqSPt7.js → hidden-CW6Rcf1N.js} +1 -1
- package/dist/chunks/{index-C1ZOKiAi.js → index-D6npYxvr.js} +1372 -1178
- package/dist/chunks/{loqate-nXuTX7In.js → loqate-B-ZNS65B.js} +2 -2
- package/dist/chunks/{mollie-qdCynQCd.js → mollie-BDAZ-1X4.js} +1 -1
- package/dist/chunks/{moneris-BNEA-laO.js → moneris-B1b0uEtY.js} +1 -1
- package/dist/chunks/{opayo-BJtXOkuK.js → opayo-CC5hraHo.js} +2 -2
- package/dist/chunks/{paddle-D72Pa8kr.js → paddle-B4GmrDsq.js} +2 -2
- package/dist/chunks/{paypal-Cqt2bned.js → paypal-BFS6XsIS.js} +2 -2
- package/dist/chunks/{payway-BjCqsc0H.js → payway-DekoJead.js} +2 -2
- package/dist/chunks/{phone-country-K9pYAlzM.js → phone-country-Cm5YUeXI.js} +2 -2
- package/dist/chunks/{place-kit-Dg6f_UoM.js → place-kit-DizZWV_e.js} +1 -1
- package/dist/chunks/{recaptcha-enterprise--VYAeeqz.js → recaptcha-enterprise-BbOvO7JZ.js} +2 -2
- package/dist/chunks/{recaptcha-shared-PSIEEEe1.js → recaptcha-shared-Dwg1eVFS.js} +2 -2
- package/dist/chunks/{recaptcha-v2-checkbox-atBNe5ml.js → recaptcha-v2-checkbox-SY3ti5iQ.js} +2 -2
- package/dist/chunks/{recaptcha-v2-invisible-DnBufNPT.js → recaptcha-v2-invisible-DSmQnn6c.js} +2 -2
- package/dist/chunks/{recaptcha-v3-CF6O8rDj.js → recaptcha-v3-DNh7YCnR.js} +2 -2
- package/dist/chunks/{repeater-CB7Yojvx.js → repeater-DM0vuFNQ.js} +2 -2
- package/dist/chunks/{rich-text-nAV_SQZo.js → rich-text-C8aGYp70.js} +1 -1
- package/dist/chunks/{scripts-BkAAux0i.js → scripts-CKTFtxPO.js} +1 -1
- package/dist/chunks/{shared-DGqeMvcJ.js → shared--BU5CFoL.js} +4 -4
- package/dist/chunks/{signature-BT6CsQ6n.js → signature-pFhZfH7d.js} +1 -1
- package/dist/chunks/{snaptcha-C7qQo02f.js → snaptcha-VuOUOaLj.js} +1 -1
- package/dist/chunks/{square-C5AH3trb.js → square-BR9pvToy.js} +4 -4
- package/dist/chunks/{stripe-EJK0RyUv.js → stripe-OHUwoV9g.js} +2 -2
- package/dist/chunks/{summary-DC_ipXCU.js → summary-Da7Ktg3N.js} +2 -2
- package/dist/chunks/{table-BEAI99qo.js → table-C0PmR9bI.js} +2 -2
- package/dist/chunks/text-limit-mLEwZDIa.js +144 -0
- package/dist/chunks/{turnstile-_uCRwnU-.js → turnstile-9tM7q_LK.js} +2 -2
- package/dist/css/theme/forms/_form.css +28 -0
- package/dist/index.js +9 -9
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- 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/address/google-address.d.ts +7 -0
- package/dist/js/modules/address/google-address.d.ts.map +1 -1
- package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions/effects.d.ts +3 -1
- package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
- package/dist/js/modules/fields/conditions.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/submit/pipeline.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/scope.d.ts +6 -0
- package/dist/js/validation/scope.d.ts.map +1 -0
- package/dist/js/validation/submit-readiness.d.ts +4 -0
- package/dist/js/validation/submit-readiness.d.ts.map +1 -0
- package/dist/js/validation/validator.d.ts +1 -0
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/css/theme/forms/_form.css +28 -0
- package/src/js/core/create-formie-client.ts +6 -0
- package/src/js/core/field-error-container.ts +39 -0
- package/src/js/core/submit-result-state.ts +29 -2
- package/src/js/core/submit-result-ui.ts +3 -9
- package/src/js/modules/address/google-address.ts +33 -1
- package/src/js/modules/fields/checkbox-radio.ts +21 -15
- package/src/js/modules/fields/conditions/effects.ts +79 -2
- package/src/js/modules/fields/conditions.ts +53 -11
- package/src/js/modules/fields/file-upload.ts +200 -105
- package/src/js/modules/fields/text-limit.ts +87 -22
- package/src/js/submit/pipeline.ts +3 -28
- 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/scope.ts +25 -0
- package/src/js/validation/submit-readiness.ts +157 -0
- package/src/js/validation/validator.ts +11 -7
- package/dist/chunks/file-upload-BDZZftgL.js +0 -281
- package/dist/chunks/text-limit-Blgq5G-G.js +0 -135
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- version bump
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @verbb/formie-core@1.0.4
|
|
10
|
+
|
|
11
|
+
## 1.0.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- version bump
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @verbb/formie-core@1.0.3
|
|
18
|
+
|
|
3
19
|
## 1.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -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
|
};
|