@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.
Files changed (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/{address-finder-CQW81kY0.js → address-finder-BU4roxT6.js} +2 -2
  3. package/dist/chunks/{bpoint-D8OjLmsn.js → bpoint-uNg5j6rt.js} +1 -1
  4. package/dist/chunks/{calculations-BqZsENCq.js → calculations-C9t6Zop9.js} +2 -2
  5. package/dist/chunks/{captcha-eu-DIa6aUWz.js → captcha-eu-BAPzHNts.js} +2 -2
  6. package/dist/chunks/{checkbox-radio-BI-UjgMF.js → checkbox-radio-CHeLNVIK.js} +39 -34
  7. package/dist/chunks/{conditions-BVl6jTYo.js → conditions-DKxVCsjD.js} +189 -163
  8. package/dist/chunks/{date-picker-69TgvErA.js → date-picker-B3iQ797Z.js} +2 -2
  9. package/dist/chunks/{eway-1GPxH6DU.js → eway-DCielIML.js} +2 -2
  10. package/dist/chunks/file-upload-DP2TOUYV.js +316 -0
  11. package/dist/chunks/{friendly-captcha-v1-DA2QPKA3.js → friendly-captcha-v1-DdlcGiFY.js} +1 -1
  12. package/dist/chunks/{friendly-captcha-v2-BorOWiz_.js → friendly-captcha-v2-76w-YnFm.js} +1 -1
  13. package/dist/chunks/{go-cardless-DwBgERcA.js → go-cardless-rwCkzbNK.js} +1 -1
  14. package/dist/chunks/{google-address-BcTBncyS.js → google-address-BD8IZ86V.js} +77 -58
  15. package/dist/chunks/{hcaptcha-BchdVCqq.js → hcaptcha-BNNTL6uf.js} +2 -2
  16. package/dist/chunks/{hidden-D8RqSPt7.js → hidden-CW6Rcf1N.js} +1 -1
  17. package/dist/chunks/{index-C1ZOKiAi.js → index-D6npYxvr.js} +1372 -1178
  18. package/dist/chunks/{loqate-nXuTX7In.js → loqate-B-ZNS65B.js} +2 -2
  19. package/dist/chunks/{mollie-qdCynQCd.js → mollie-BDAZ-1X4.js} +1 -1
  20. package/dist/chunks/{moneris-BNEA-laO.js → moneris-B1b0uEtY.js} +1 -1
  21. package/dist/chunks/{opayo-BJtXOkuK.js → opayo-CC5hraHo.js} +2 -2
  22. package/dist/chunks/{paddle-D72Pa8kr.js → paddle-B4GmrDsq.js} +2 -2
  23. package/dist/chunks/{paypal-Cqt2bned.js → paypal-BFS6XsIS.js} +2 -2
  24. package/dist/chunks/{payway-BjCqsc0H.js → payway-DekoJead.js} +2 -2
  25. package/dist/chunks/{phone-country-K9pYAlzM.js → phone-country-Cm5YUeXI.js} +2 -2
  26. package/dist/chunks/{place-kit-Dg6f_UoM.js → place-kit-DizZWV_e.js} +1 -1
  27. package/dist/chunks/{recaptcha-enterprise--VYAeeqz.js → recaptcha-enterprise-BbOvO7JZ.js} +2 -2
  28. package/dist/chunks/{recaptcha-shared-PSIEEEe1.js → recaptcha-shared-Dwg1eVFS.js} +2 -2
  29. package/dist/chunks/{recaptcha-v2-checkbox-atBNe5ml.js → recaptcha-v2-checkbox-SY3ti5iQ.js} +2 -2
  30. package/dist/chunks/{recaptcha-v2-invisible-DnBufNPT.js → recaptcha-v2-invisible-DSmQnn6c.js} +2 -2
  31. package/dist/chunks/{recaptcha-v3-CF6O8rDj.js → recaptcha-v3-DNh7YCnR.js} +2 -2
  32. package/dist/chunks/{repeater-CB7Yojvx.js → repeater-DM0vuFNQ.js} +2 -2
  33. package/dist/chunks/{rich-text-nAV_SQZo.js → rich-text-C8aGYp70.js} +1 -1
  34. package/dist/chunks/{scripts-BkAAux0i.js → scripts-CKTFtxPO.js} +1 -1
  35. package/dist/chunks/{shared-DGqeMvcJ.js → shared--BU5CFoL.js} +4 -4
  36. package/dist/chunks/{signature-BT6CsQ6n.js → signature-pFhZfH7d.js} +1 -1
  37. package/dist/chunks/{snaptcha-C7qQo02f.js → snaptcha-VuOUOaLj.js} +1 -1
  38. package/dist/chunks/{square-C5AH3trb.js → square-BR9pvToy.js} +4 -4
  39. package/dist/chunks/{stripe-EJK0RyUv.js → stripe-OHUwoV9g.js} +2 -2
  40. package/dist/chunks/{summary-DC_ipXCU.js → summary-Da7Ktg3N.js} +2 -2
  41. package/dist/chunks/{table-BEAI99qo.js → table-C0PmR9bI.js} +2 -2
  42. package/dist/chunks/text-limit-mLEwZDIa.js +144 -0
  43. package/dist/chunks/{turnstile-_uCRwnU-.js → turnstile-9tM7q_LK.js} +2 -2
  44. package/dist/css/theme/forms/_form.css +28 -0
  45. package/dist/index.js +9 -9
  46. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  47. package/dist/js/core/field-error-container.d.ts +4 -0
  48. package/dist/js/core/field-error-container.d.ts.map +1 -0
  49. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  50. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  51. package/dist/js/modules/address/google-address.d.ts +7 -0
  52. package/dist/js/modules/address/google-address.d.ts.map +1 -1
  53. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
  54. package/dist/js/modules/fields/conditions/effects.d.ts +3 -1
  55. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -1
  56. package/dist/js/modules/fields/conditions.d.ts.map +1 -1
  57. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  58. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  59. package/dist/js/submit/pipeline.d.ts.map +1 -1
  60. package/dist/js/utils/i18n.d.ts.map +1 -1
  61. package/dist/js/validation/rules/email.d.ts.map +1 -1
  62. package/dist/js/validation/rules/number.d.ts.map +1 -1
  63. package/dist/js/validation/scope.d.ts +6 -0
  64. package/dist/js/validation/scope.d.ts.map +1 -0
  65. package/dist/js/validation/submit-readiness.d.ts +4 -0
  66. package/dist/js/validation/submit-readiness.d.ts.map +1 -0
  67. package/dist/js/validation/validator.d.ts +1 -0
  68. package/dist/js/validation/validator.d.ts.map +1 -1
  69. package/package.json +2 -2
  70. package/src/css/theme/forms/_form.css +28 -0
  71. package/src/js/core/create-formie-client.ts +6 -0
  72. package/src/js/core/field-error-container.ts +39 -0
  73. package/src/js/core/submit-result-state.ts +29 -2
  74. package/src/js/core/submit-result-ui.ts +3 -9
  75. package/src/js/modules/address/google-address.ts +33 -1
  76. package/src/js/modules/fields/checkbox-radio.ts +21 -15
  77. package/src/js/modules/fields/conditions/effects.ts +79 -2
  78. package/src/js/modules/fields/conditions.ts +53 -11
  79. package/src/js/modules/fields/file-upload.ts +200 -105
  80. package/src/js/modules/fields/text-limit.ts +87 -22
  81. package/src/js/submit/pipeline.ts +3 -28
  82. package/src/js/utils/i18n.ts +184 -5
  83. package/src/js/validation/rules/email.ts +3 -2
  84. package/src/js/validation/rules/match.ts +2 -2
  85. package/src/js/validation/rules/minmax.ts +4 -4
  86. package/src/js/validation/rules/number.ts +9 -5
  87. package/src/js/validation/rules/pattern.ts +4 -4
  88. package/src/js/validation/rules/required.ts +1 -1
  89. package/src/js/validation/rules/url.ts +1 -1
  90. package/src/js/validation/scope.ts +25 -0
  91. package/src/js/validation/submit-readiness.ts +157 -0
  92. package/src/js/validation/validator.ts +11 -7
  93. package/dist/chunks/file-upload-BDZZftgL.js +0 -281
  94. 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-C1ZOKiAi.js";
2
- import { l as _ } from "./scripts-BkAAux0i.js";
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,4 +1,4 @@
1
- import { u as c } from "./index-C1ZOKiAi.js";
1
+ import { v as c } from "./index-D6npYxvr.js";
2
2
  const p = c({
3
3
  id: "bpoint",
4
4
  defaultRequiredInputSuffixes: ["bpointToken"],
@@ -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-DGqeMvcJ.js";
3
- import { h as R, i as k, n as U, j as V, r as _ } from "./index-C1ZOKiAi.js";
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-C1ZOKiAi.js";
2
- import { l as s } from "./scripts-BkAAux0i.js";
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 A, d as E, a as p, e as M } from "./shared-DGqeMvcJ.js";
2
- import { h as L } from "./index-C1ZOKiAi.js";
3
- const l = "[data-formie-checkboxes-field-layout], [data-formie-radio-field-layout]", d = "minmaxOptions", h = "data-formie-checkbox-radio-max-disabled", g = "checkbox-radio", x = "checkbox-radio", f = L("fields", "checkbox-radio");
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(d);
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
- A(t, x, (r) => {
24
+ p(t, x, (r) => {
22
25
  r.addValidator(
23
- d,
26
+ u,
24
27
  ({ field: o, getRule: e }) => {
25
- if (!o || !e(d))
28
+ if (!o || !e(u))
26
29
  return !0;
27
- const n = Array.from(o.querySelectorAll('input[type="checkbox"]')).filter((u) => u instanceof HTMLInputElement && !m(u)).filter((u) => u.checked).length, { min: a, max: i } = b(e);
28
- return !(a !== null && n < a || i !== null && n > i);
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: c, getRule: n }) => {
31
- const { min: a, max: i } = o ? b(n) : { min: null, max: null };
32
- return a !== null && i !== null ? c("{attribute} must select between {min} and {max}.", { attribute: e, min: a, max: i }) : a !== null ? c("{attribute} must select no less than {min}.", { attribute: e, min: a }) : i !== null ? c("{attribute} must select no greater than {max}.", { attribute: e, max: i }) : c("{attribute} has an invalid value.", { attribute: e });
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
- p(t, x, [d]);
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 k(t) {
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 y(t) {
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)), c = o.filter((n) => n.checked).length >= r;
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 a = c && !n.checked, i = n.hasAttribute(h);
63
- if (a) {
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 v(t, r) {
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 I(t, r) {
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="${M(t.name)}"]`)).filter((e) => e instanceof HTMLInputElement).forEach((e) => {
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 C(t) {
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 f.log("No checkbox/radio inputs found for field."), () => {
92
+ return d.log("No checkbox/radio inputs found for field."), () => {
88
93
  };
89
94
  const o = r.map((e) => {
90
- const c = e.type === "radio" ? "change" : "click", n = () => {
91
- s(e), e.type === "checkbox" && m(e) && v(t, e), e.type === "radio" && I(e, t), k(t), y(t), f.log("Input interaction processed.", {
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(c, n), s(e), () => {
98
- e.removeEventListener(c, n);
102
+ return e.addEventListener(a, n), s(e), () => {
103
+ e.removeEventListener(a, n);
99
104
  };
100
105
  });
101
- return k(t), y(t), E(t, g, "init", {
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 H = {
110
- id: g,
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), f.log("Module setup.", {
122
+ T(t.form), d.log("Module setup.", {
118
123
  fieldCount: r.length
119
124
  });
120
- const o = r.map((e) => C(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), f.log("Module destroy.", {
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
- H as checkboxRadioModule
140
+ O as checkboxRadioModule
136
141
  };