treege 3.0.0-beta.20 → 3.0.0-beta.21

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.
@@ -1,10 +1,10 @@
1
- import { j as t, i as G, L as ye, b as Qe, e as It, F as O, f as A, I as X, C as Ee, h as Oe, k as ke, l as _e, m as Pe, n as k, o as _, P as pe, p as he, B as ce, q as ge, r as Xe, s as y, t as Le, v as Be, S as Ye, w as Ze, x as et, y as tt, z as st, A as rt, D as At, E as Rt, G as Ne, g as ne, N as fe, a as Dt, c as Et, T as Ot } from "./ThemeContext-BIT4DHqC.js";
1
+ import { j as t, i as G, L as ye, b as Qe, e as It, F as O, f as A, I as X, C as Ee, h as Oe, k as ke, l as _e, m as Pe, n as k, o as _, P as pe, p as he, B as ce, q as ge, r as Xe, s as y, t as Le, v as Be, S as Ye, w as Ze, x as et, y as tt, z as st, A as rt, D as At, E as Dt, G as Ne, g as ae, N as fe, a as Rt, c as Et, T as Ot } from "./ThemeContext-BIT4DHqC.js";
2
2
  import * as qe from "react";
3
3
  import { createContext as nt, useContext as at, useMemo as U, useRef as K, useState as L, useCallback as Q, useEffect as J, forwardRef as kt } from "react";
4
4
  import He from "dompurify";
5
- import { MapPin as Ue, ChevronsUpDown as ot, Check as it, ChevronLeftIcon as _t, ChevronRightIcon as Pt, ChevronDownIcon as $e, Loader2 as we, CircleIcon as $t } from "lucide-react";
6
- import { getDefaultClassNames as lt, DayPicker as Mt } from "react-day-picker";
7
- import * as ae from "@radix-ui/react-tooltip";
5
+ import { MapPin as Ue, ChevronsUpDown as ot, Check as it, ChevronLeftIcon as _t, ChevronRightIcon as Pt, ChevronDownIcon as Me, Loader2 as we, CircleIcon as Mt } from "lucide-react";
6
+ import { getDefaultClassNames as lt, DayPicker as $t } from "react-day-picker";
7
+ import * as oe from "@radix-ui/react-tooltip";
8
8
  import * as Ae from "@radix-ui/react-radio-group";
9
9
  import "cmdk";
10
10
  import "@radix-ui/react-dialog";
@@ -97,7 +97,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
97
97
  return !0;
98
98
  }
99
99
  return s;
100
- }, Lt = (e) => e.filter(G), Me = (e) => {
100
+ }, Lt = (e) => e.filter(G), $e = (e) => {
101
101
  if (e.data.name)
102
102
  return e.data.name;
103
103
  if (e.data.label) {
@@ -110,7 +110,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
110
110
  return e.id;
111
111
  }, Bt = (e, r) => {
112
112
  const n = r.find((s) => s.id === e);
113
- return n ? Me(n) : void 0;
113
+ return n ? $e(n) : void 0;
114
114
  }, Se = (e) => e == null || typeof e == "string" && e.trim() === "" ? !0 : Array.isArray(e) && e.length === 0, qt = (e, r) => {
115
115
  if (!e)
116
116
  return !1;
@@ -119,7 +119,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
119
119
  }, ze = (e, r) => {
120
120
  const n = {};
121
121
  return r.forEach((s) => {
122
- const a = s.id, i = Me(s);
122
+ const a = s.id, i = $e(s);
123
123
  e[a] !== void 0 && (n[i] = e[a]);
124
124
  }), n;
125
125
  }, Ge = (e, r, n) => {
@@ -240,12 +240,12 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
240
240
  if (!j)
241
241
  return;
242
242
  c.add(p), o.push(j);
243
- const I = i.get(p) || [], { edgesToFollow: $, waitingForInput: R } = Wt(I, n, a);
244
- if (R) {
243
+ const I = i.get(p) || [], { edgesToFollow: M, waitingForInput: D } = Wt(I, n, a);
244
+ if (D) {
245
245
  m = !0;
246
246
  return;
247
247
  }
248
- $.forEach((w) => {
248
+ M.forEach((w) => {
249
249
  u(w.target);
250
250
  });
251
251
  };
@@ -316,7 +316,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
316
316
  console.warn(`Flow with id "${p}" not found`);
317
317
  return;
318
318
  }
319
- const I = j.nodes.find(($) => !$.parentId);
319
+ const I = j.nodes.find((M) => !M.parentId);
320
320
  if (!I) {
321
321
  console.warn(`Flow "${p}" has no root node; preserving FlowNode "${h.id}"`), g.push(h);
322
322
  return;
@@ -343,14 +343,14 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
343
343
  const p = l.get(g), j = p ? s.get(p) : void 0;
344
344
  if (!j)
345
345
  return;
346
- const I = new Set(j.nodes.map((w) => w.id)), $ = mt(
346
+ const I = new Set(j.nodes.map((w) => w.id)), M = mt(
347
347
  I,
348
348
  s,
349
349
  c,
350
350
  l,
351
351
  new Set(p ? [p] : [])
352
352
  );
353
- Xt($, d).forEach((w) => {
353
+ Xt(M, d).forEach((w) => {
354
354
  h.forEach((x) => {
355
355
  const b = c.get(x.target) ?? x.target, v = x.id ?? `${g}__${x.target}`;
356
356
  d.push({
@@ -381,7 +381,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
381
381
  ...r,
382
382
  edges: n
383
383
  };
384
- }, Zt = ["b", "i", "em", "strong", "u", "br", "p", "span"], es = ["class"], oe = (e, r = {}) => {
384
+ }, Zt = ["b", "i", "em", "strong", "u", "br", "p", "span"], es = ["class"], te = (e, r = {}) => {
385
385
  if (e == null || e === "")
386
386
  return "";
387
387
  const n = String(e), { plainTextOnly: s = !0, allowedTags: a, allowedAttributes: i } = r;
@@ -410,22 +410,22 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
410
410
  RETURN_DOM_FRAGMENT: !1
411
411
  // Return string, not DOM fragment
412
412
  });
413
- }, Je = 100, Re = (e, r = {}, n = 0, s = /* @__PURE__ */ new WeakSet()) => {
413
+ }, Je = 100, De = (e, r = {}, n = 0, s = /* @__PURE__ */ new WeakSet()) => {
414
414
  if (n > Je)
415
- return console.warn(`sanitizeHttpResponse: Maximum depth (${Je}) exceeded. Returning data as-is to prevent stack overflow.`), e;
415
+ return console.warn(`sanitizeHttpResponse: Maximum depth (${Je}) exceeded.`), typeof e == "string" ? te(e, r) : "[Max Depth Exceeded]";
416
416
  if (e == null)
417
417
  return e;
418
418
  if (typeof e == "string")
419
- return oe(e, r);
419
+ return te(e, r);
420
420
  if (Array.isArray(e))
421
- return e.map((a) => Re(a, r, n + 1, s));
421
+ return e.map((a) => De(a, r, n + 1, s));
422
422
  if (typeof e == "object") {
423
423
  if (s.has(e))
424
424
  return console.warn("sanitizeHttpResponse: Circular reference detected. Breaking cycle to prevent infinite recursion."), "[Circular Reference]";
425
425
  s.add(e);
426
426
  const a = {};
427
427
  for (const [i, o] of Object.entries(e))
428
- a[i] = Re(o, r, n + 1, s);
428
+ a[i] = De(o, r, n + 1, s);
429
429
  return s.delete(e), a;
430
430
  }
431
431
  return e;
@@ -434,7 +434,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
434
434
  return U(
435
435
  () => (a) => {
436
436
  const i = s(a);
437
- return typeof a == "object" && a !== null ? oe(i) : i;
437
+ return typeof a == "object" && a !== null ? te(i) : i;
438
438
  },
439
439
  [s]
440
440
  );
@@ -476,7 +476,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
476
476
  delete v[F];
477
477
  }), v;
478
478
  }));
479
- }, []), $ = Q(
479
+ }, []), M = Q(
480
480
  (x) => {
481
481
  const b = {};
482
482
  h.forEach((P) => {
@@ -505,7 +505,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
505
505
  };
506
506
  },
507
507
  [h, d, c]
508
- ), R = U(() => {
508
+ ), D = U(() => {
509
509
  const x = [];
510
510
  return h.forEach((b) => {
511
511
  if (!G(b))
@@ -523,13 +523,13 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
523
523
  formValues: d,
524
524
  inputNodes: o,
525
525
  mergedFlow: s,
526
- missingRequiredFields: R,
526
+ missingRequiredFields: D,
527
527
  prevFormValuesRef: l,
528
528
  setFieldValue: j,
529
529
  setFormErrors: u,
530
530
  setMultipleFieldValues: I,
531
531
  t: c,
532
- validateForm: $,
532
+ validateForm: M,
533
533
  visibleNodes: h,
534
534
  visibleRootNodes: p
535
535
  };
@@ -578,7 +578,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
578
578
  );
579
579
  });
580
580
  }), os = ({ node: e, value: r, setValue: n, error: s, label: a, placeholder: i, helperText: o, id: c, name: l }) => {
581
- const [m, u] = L(""), [d, f] = L([]), [g, h] = L(!1), { googleApiKey: p, language: j } = xe(), I = B(), $ = Q(
581
+ const [m, u] = L(""), [d, f] = L([]), [g, h] = L(!1), { googleApiKey: p, language: j } = xe(), I = B(), M = Q(
582
582
  (w) => {
583
583
  n(w.value), u(w.value), h(!1);
584
584
  },
@@ -595,7 +595,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
595
595
  }, 300);
596
596
  return () => clearTimeout(w);
597
597
  }, [m, p, j]);
598
- const R = Q(
598
+ const D = Q(
599
599
  (w) => {
600
600
  n(w), u(w), w.length >= 3 && h(!0);
601
601
  },
@@ -616,7 +616,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
616
616
  id: c,
617
617
  name: l,
618
618
  value: r || "",
619
- onChange: (w) => R(w.target.value),
619
+ onChange: (w) => D(w.target.value),
620
620
  onFocus: () => {
621
621
  d.length > 0 && h(!0);
622
622
  },
@@ -632,7 +632,7 @@ const ct = nt(void 0), dt = () => at(ct), Zs = ({
632
632
  Pe,
633
633
  {
634
634
  value: w.value,
635
- onSelect: () => $(w),
635
+ onSelect: () => M(w),
636
636
  onMouseDown: (b) => b.preventDefault(),
637
637
  children: [
638
638
  /* @__PURE__ */ t.jsx(Ue, { className: "mr-2 h-4 w-4" }),
@@ -768,7 +768,7 @@ function ht({
768
768
  }) {
769
769
  const l = lt();
770
770
  return /* @__PURE__ */ t.jsx(
771
- Mt,
771
+ $t,
772
772
  {
773
773
  showOutsideDays: n,
774
774
  className: y(
@@ -829,7 +829,7 @@ function ht({
829
829
  ...r
830
830
  },
831
831
  components: {
832
- Chevron: ({ className: m, orientation: u, ...d }) => u === "left" ? /* @__PURE__ */ t.jsx(_t, { className: y("size-4", m), ...d }) : u === "right" ? /* @__PURE__ */ t.jsx(Pt, { className: y("size-4", m), ...d }) : /* @__PURE__ */ t.jsx($e, { className: y("size-4", m), ...d }),
832
+ Chevron: ({ className: m, orientation: u, ...d }) => u === "left" ? /* @__PURE__ */ t.jsx(_t, { className: y("size-4", m), ...d }) : u === "right" ? /* @__PURE__ */ t.jsx(Pt, { className: y("size-4", m), ...d }) : /* @__PURE__ */ t.jsx(Me, { className: y("size-4", m), ...d }),
833
833
  DayButton: cs,
834
834
  Root: ({ className: m, rootRef: u, ...d }) => /* @__PURE__ */ t.jsx("div", { "data-slot": "calendar", ref: u, className: y(m), ...d }),
835
835
  WeekNumber: ({ children: m, ...u }) => /* @__PURE__ */ t.jsx("td", { ...u, children: /* @__PURE__ */ t.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: m }) }),
@@ -879,7 +879,7 @@ const ds = ({ node: e, value: r, setValue: n, error: s, label: a, placeholder: i
879
879
  /* @__PURE__ */ t.jsxs(pe, { open: m, onOpenChange: u, children: [
880
880
  /* @__PURE__ */ t.jsx(he, { asChild: !0, children: /* @__PURE__ */ t.jsxs(ce, { variant: "outline", id: c, name: l, className: "w-full justify-between font-normal", children: [
881
881
  f ? f.toLocaleDateString() : i || d("renderer.defaultInputs.selectDate"),
882
- /* @__PURE__ */ t.jsx($e, { className: "size-4" })
882
+ /* @__PURE__ */ t.jsx(Me, { className: "size-4" })
883
883
  ] }) }),
884
884
  /* @__PURE__ */ t.jsx(ge, { className: "w-auto overflow-hidden p-0", align: "start", children: /* @__PURE__ */ t.jsx(
885
885
  ht,
@@ -915,7 +915,7 @@ const ds = ({ node: e, value: r, setValue: n, error: s, label: a, placeholder: i
915
915
  /* @__PURE__ */ t.jsxs(pe, { open: c, onOpenChange: l, children: [
916
916
  /* @__PURE__ */ t.jsx(he, { asChild: !0, children: /* @__PURE__ */ t.jsxs(ce, { id: o, variant: "outline", className: "w-full justify-between font-normal", children: [
917
917
  h(),
918
- /* @__PURE__ */ t.jsx($e, { className: "size-4" })
918
+ /* @__PURE__ */ t.jsx(Me, { className: "size-4" })
919
919
  ] }) }),
920
920
  /* @__PURE__ */ t.jsx(ge, { className: "w-auto overflow-hidden p-0", align: "start", children: /* @__PURE__ */ t.jsx(
921
921
  ht,
@@ -981,17 +981,17 @@ const ds = ({ node: e, value: r, setValue: n, error: s, label: a, placeholder: i
981
981
  ] });
982
982
  }, ps = ({ value: e, name: r, id: n }) => /* @__PURE__ */ t.jsx(X, { type: "hidden", id: n, name: r, value: e ?? "" });
983
983
  function Ve({ delayDuration: e = 0, ...r }) {
984
- return /* @__PURE__ */ t.jsx(ae.Provider, { "data-slot": "tooltip-provider", delayDuration: e, ...r });
984
+ return /* @__PURE__ */ t.jsx(oe.Provider, { "data-slot": "tooltip-provider", delayDuration: e, ...r });
985
985
  }
986
986
  function xt({ ...e }) {
987
- return /* @__PURE__ */ t.jsx(Ve, { children: /* @__PURE__ */ t.jsx(ae.Root, { "data-slot": "tooltip", ...e }) });
987
+ return /* @__PURE__ */ t.jsx(Ve, { children: /* @__PURE__ */ t.jsx(oe.Root, { "data-slot": "tooltip", ...e }) });
988
988
  }
989
989
  function bt({ ...e }) {
990
- return /* @__PURE__ */ t.jsx(ae.Trigger, { "data-slot": "tooltip-trigger", ...e });
990
+ return /* @__PURE__ */ t.jsx(oe.Trigger, { "data-slot": "tooltip-trigger", ...e });
991
991
  }
992
992
  function jt({ className: e, sideOffset: r = 0, children: n, ...s }) {
993
- return /* @__PURE__ */ t.jsx(ae.Portal, { children: /* @__PURE__ */ t.jsxs(
994
- ae.Content,
993
+ return /* @__PURE__ */ t.jsx(oe.Portal, { children: /* @__PURE__ */ t.jsxs(
994
+ oe.Content,
995
995
  {
996
996
  "data-slot": "tooltip-content",
997
997
  sideOffset: r,
@@ -1002,7 +1002,7 @@ function jt({ className: e, sideOffset: r = 0, children: n, ...s }) {
1002
1002
  ...s,
1003
1003
  children: [
1004
1004
  n,
1005
- /* @__PURE__ */ t.jsx(ae.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })
1005
+ /* @__PURE__ */ t.jsx(oe.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })
1006
1006
  ]
1007
1007
  }
1008
1008
  ) });
@@ -1016,17 +1016,17 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1016
1016
  return Array.isArray(l) ? l[Number.parseInt(c, 10)] : l;
1017
1017
  }
1018
1018
  return s[a];
1019
- }, e) : e, De = (e) => {
1019
+ }, e) : e, Re = (e) => {
1020
1020
  const r = e.matchAll(/{{([\w-]+)}}/g);
1021
1021
  return Array.from(r, (n) => n[1]);
1022
- }, Ce = (e, r) => De(e).every((s) => {
1022
+ }, Ce = (e, r) => Re(e).every((s) => {
1023
1023
  const a = r[s];
1024
1024
  return a != null && a !== "";
1025
1025
  }), Te = (e, r, n = !1) => e.replace(/{{([\w-]+)}}/g, (s, a) => {
1026
1026
  const i = String(r[a] || "");
1027
1027
  return n ? encodeURIComponent(i) : i;
1028
1028
  }), hs = ({ node: e, value: r, setValue: n, error: s, label: a, placeholder: i, helperText: o, id: c, name: l }) => {
1029
- const [m, u] = L(!1), [d, f] = L(null), [g, h] = L([]), [p, j] = L(""), [I, $] = L(!1), { formValues: R, inputNodes: w } = xe(), x = B(), { httpConfig: b } = e.data, v = K(!1), F = K(""), P = K(b), q = K(R), ee = K(w), Y = K(n), de = K(null), te = U(() => b?.url ? De(b.url) : [], [b?.url]), se = te.length > 0, ie = U(() => te.map((C) => `${C}:${String(R[C] ?? "")}`).join("|"), [te, R]), le = U(() => b?.url ? se ? Ce(b.url, R) : !0 : !1, [b?.url, se, R]), W = Q(
1029
+ const [m, u] = L(!1), [d, f] = L(null), [g, h] = L([]), [p, j] = L(""), [I, M] = L(!1), { formValues: D, inputNodes: w } = xe(), x = B(), { httpConfig: b } = e.data, v = K(!1), F = K(""), P = K(b), q = K(D), ee = K(w), Y = K(n), de = K(null), se = U(() => b?.url ? Re(b.url) : [], [b?.url]), re = se.length > 0, ie = U(() => se.map((C) => `${C}:${String(D[C] ?? "")}`).join("|"), [se, D]), le = U(() => b?.url ? re ? Ce(b.url, D) : !0 : !1, [b?.url, re, D]), W = Q(
1030
1030
  async (C) => {
1031
1031
  const T = P.current, V = q.current, N = Y.current;
1032
1032
  if (!T?.url) {
@@ -1036,11 +1036,11 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1036
1036
  if (!(T.url && !Ce(T.url, V))) {
1037
1037
  u(!0), f(null);
1038
1038
  try {
1039
- const M = Te(T.url, V, !0), D = T.searchParam && C ? `${M}${M.includes("?") ? "&" : "?"}${T.searchParam}=${encodeURIComponent(C)}` : M, E = {};
1040
- T.headers?.forEach((re) => {
1041
- E[re.key] = Te(re.value, V);
1039
+ const $ = Te(T.url, V, !0), R = T.searchParam && C ? `${$}${$.includes("?") ? "&" : "?"}${T.searchParam}=${encodeURIComponent(C)}` : $, E = {};
1040
+ T.headers?.forEach((ne) => {
1041
+ E[ne.key] = Te(ne.value, V);
1042
1042
  });
1043
- const S = ["POST", "PUT", "PATCH"].includes(T.method || "") ? T.sendFormData ? JSON.stringify(ze(V, ee.current)) : T.body ? Te(T.body, V) : void 0 : void 0, z = await fetch(D, {
1043
+ const S = ["POST", "PUT", "PATCH"].includes(T.method || "") ? T.sendFormData ? JSON.stringify(ze(V, ee.current)) : T.body ? Te(T.body, V) : void 0 : void 0, z = await fetch(R, {
1044
1044
  body: S || void 0,
1045
1045
  headers: {
1046
1046
  "Content-Type": "application/json",
@@ -1052,18 +1052,18 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1052
1052
  f(`HTTP Error ${z.status}: ${z.statusText}`), u(!1);
1053
1053
  return;
1054
1054
  }
1055
- const H = await z.json(), ue = Re(H), Z = T.responsePath ? Fe(ue, T.responsePath) : ue;
1055
+ const H = await z.json(), ue = De(H), Z = T.responsePath ? Fe(ue, T.responsePath) : ue;
1056
1056
  if (T.responseMapping && Array.isArray(Z)) {
1057
- const { valueField: re = "value", labelField: be = "label" } = T.responseMapping, je = Z.map((me) => ({
1057
+ const { valueField: ne = "value", labelField: be = "label" } = T.responseMapping, je = Z.map((me) => ({
1058
1058
  label: String(Fe(me, be) || ""),
1059
- value: String(Fe(me, re) || "")
1059
+ value: String(Fe(me, ne) || "")
1060
1060
  }));
1061
1061
  h(je);
1062
1062
  } else
1063
1063
  N(typeof Z == "string" ? Z : JSON.stringify(Z));
1064
- } catch (M) {
1065
- const D = M instanceof Error ? M.message : x("renderer.defaultHttpInput.fetchFailed");
1066
- f(D), console.error("HTTP Input fetch error:", M);
1064
+ } catch ($) {
1065
+ const R = $ instanceof Error ? $.message : x("renderer.defaultHttpInput.fetchFailed");
1066
+ f(R), console.error("HTTP Input fetch error:", $);
1067
1067
  } finally {
1068
1068
  u(!1);
1069
1069
  }
@@ -1072,24 +1072,24 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1072
1072
  [x]
1073
1073
  );
1074
1074
  if (J(() => {
1075
- P.current = b, q.current = R, ee.current = w, Y.current = n, de.current = W;
1076
- }, [b, R, w, n, W]), J(() => {
1075
+ P.current = b, q.current = D, ee.current = w, Y.current = n, de.current = W;
1076
+ }, [b, D, w, n, W]), J(() => {
1077
1077
  if (v.current)
1078
1078
  return;
1079
1079
  v.current = !0;
1080
1080
  const C = P.current, T = q.current, V = de.current, N = C?.url && Ce(C.url, T);
1081
1081
  if (C?.fetchOnMount && N && V && (V(), C.url)) {
1082
- const M = De(C.url);
1083
- F.current = M.map((D) => `${D}:${String(T[D] ?? "")}`).join("|");
1082
+ const $ = Re(C.url);
1083
+ F.current = $.map((R) => `${R}:${String(T[R] ?? "")}`).join("|");
1084
1084
  }
1085
1085
  }, []), J(() => {
1086
- if (!v.current || !se || F.current === ie || !le)
1086
+ if (!v.current || !re || F.current === ie || !le)
1087
1087
  return;
1088
1088
  const C = setTimeout(() => {
1089
1089
  W(), F.current = ie;
1090
1090
  }, 500);
1091
1091
  return () => clearTimeout(C);
1092
- }, [ie, se, le, W]), J(() => {
1092
+ }, [ie, re, le, W]), J(() => {
1093
1093
  if (!(b?.searchParam && p))
1094
1094
  return;
1095
1095
  const C = setTimeout(() => {
@@ -1108,7 +1108,7 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1108
1108
  a || e.data.name,
1109
1109
  e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
1110
1110
  ] }),
1111
- /* @__PURE__ */ t.jsxs(pe, { open: I, onOpenChange: $, children: [
1111
+ /* @__PURE__ */ t.jsxs(pe, { open: I, onOpenChange: M, children: [
1112
1112
  /* @__PURE__ */ t.jsx(he, { asChild: !0, children: /* @__PURE__ */ t.jsxs(ce, { variant: "outline", role: "combobox", "aria-expanded": I, className: "w-full justify-between", children: [
1113
1113
  z,
1114
1114
  /* @__PURE__ */ t.jsx(ot, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
@@ -1137,7 +1137,7 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1137
1137
  {
1138
1138
  value: H.value,
1139
1139
  onSelect: () => {
1140
- n(H.value), $(!1);
1140
+ n(H.value), M(!1);
1141
1141
  },
1142
1142
  children: [
1143
1143
  /* @__PURE__ */ t.jsx(it, { className: y("mr-2 h-4 w-4", r === H.value ? "opacity-100" : "opacity-0") }),
@@ -1154,10 +1154,10 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1154
1154
  o && !s && /* @__PURE__ */ t.jsx(_, { children: o })
1155
1155
  ] });
1156
1156
  }
1157
- const V = m && b?.showLoading, N = te.filter((S) => {
1158
- const z = R[S];
1157
+ const V = m && b?.showLoading, N = se.filter((S) => {
1158
+ const z = D[S];
1159
1159
  return z == null || z === "";
1160
- }), M = N.map((S) => Bt(S, w) || S), D = g.length === 0 && !V ? d || (N.length > 0 ? `${x("renderer.defaultHttpInput.waitingForRequiredFields")}: ${M.join(", ")}` : x("renderer.defaultHttpInput.noDataAvailable")) : void 0, E = /* @__PURE__ */ t.jsxs(
1160
+ }), $ = N.map((S) => Bt(S, w) || S), R = g.length === 0 && !V ? d || (N.length > 0 ? `${x("renderer.defaultHttpInput.waitingForRequiredFields")}: ${$.join(", ")}` : x("renderer.defaultHttpInput.noDataAvailable")) : void 0, E = /* @__PURE__ */ t.jsxs(
1161
1161
  Ye,
1162
1162
  {
1163
1163
  value: Array.isArray(r) ? r[0] ?? "" : r ?? "",
@@ -1178,9 +1178,9 @@ const Fe = (e, r) => r ? r.split(".").reduce((s, a) => {
1178
1178
  a || e.data.name,
1179
1179
  e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
1180
1180
  ] }),
1181
- D ? /* @__PURE__ */ t.jsx(Ve, { children: /* @__PURE__ */ t.jsxs(xt, { children: [
1181
+ R ? /* @__PURE__ */ t.jsx(Ve, { children: /* @__PURE__ */ t.jsxs(xt, { children: [
1182
1182
  /* @__PURE__ */ t.jsx(bt, { asChild: !0, children: /* @__PURE__ */ t.jsx("div", { className: "w-full", children: E }) }),
1183
- /* @__PURE__ */ t.jsx(jt, { children: /* @__PURE__ */ t.jsx("p", { children: D }) })
1183
+ /* @__PURE__ */ t.jsx(jt, { children: /* @__PURE__ */ t.jsx("p", { children: R }) })
1184
1184
  ] }) }) : E,
1185
1185
  s && /* @__PURE__ */ t.jsx(k, { children: s }),
1186
1186
  o && !s && /* @__PURE__ */ t.jsx(_, { children: o })
@@ -1246,7 +1246,7 @@ function js({ className: e, ...r }) {
1246
1246
  e
1247
1247
  ),
1248
1248
  ...r,
1249
- children: /* @__PURE__ */ t.jsx(Ae.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: /* @__PURE__ */ t.jsx($t, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" }) })
1249
+ children: /* @__PURE__ */ t.jsx(Ae.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: /* @__PURE__ */ t.jsx(Mt, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" }) })
1250
1250
  }
1251
1251
  );
1252
1252
  }
@@ -1329,7 +1329,7 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1329
1329
  e.data.required && /* @__PURE__ */ t.jsx("span", { className: "text-red-500", children: "*" })
1330
1330
  ] }),
1331
1331
  /* @__PURE__ */ t.jsx(
1332
- Rt,
1332
+ Dt,
1333
1333
  {
1334
1334
  id: l,
1335
1335
  name: c,
@@ -1441,12 +1441,12 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1441
1441
  /* @__PURE__ */ t.jsx("h4", { className: "font-semibold text-sm", children: n }),
1442
1442
  /* @__PURE__ */ t.jsx(Ne, { className: "my-8 flex-1" })
1443
1443
  ] }) : /* @__PURE__ */ t.jsx(Ne, { className: "my-8" });
1444
- }, Rs = ({ node: e }) => {
1444
+ }, Ds = ({ node: e }) => {
1445
1445
  const { edges: r } = xe(), n = B(), s = ut(e.id, r);
1446
1446
  return /* @__PURE__ */ t.jsx("h2", { className: y("mb-5 font-bold text-2xl", !s && "mt-10"), children: n(e.data?.label) });
1447
- }, Ds = {
1447
+ }, Rs = {
1448
1448
  divider: As,
1449
- title: Rs
1449
+ title: Ds
1450
1450
  }, Es = async (e) => {
1451
1451
  try {
1452
1452
  const { url: r, method: n = "GET", headers: s = [], body: a } = e;
@@ -1494,7 +1494,7 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1494
1494
  const c = r[o.trim()];
1495
1495
  if (c == null)
1496
1496
  return a ? "null" : "";
1497
- const l = typeof c == "string" ? oe(c) : c;
1497
+ const l = typeof c == "string" ? te(c) : c;
1498
1498
  if (s)
1499
1499
  return encodeURIComponent(String(l));
1500
1500
  if (a) {
@@ -1556,7 +1556,7 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1556
1556
  if (!e)
1557
1557
  return;
1558
1558
  e.startsWith("http://") || e.startsWith("https://") ? window.location.href = e : window.history?.pushState ? (window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate"))) : window.location.href = e;
1559
- }, $s = (e, r, n, s) => {
1559
+ }, Ms = (e, r, n, s) => {
1560
1560
  const [a, i] = L(!1), [o, c] = L(null), l = U(() => {
1561
1561
  const d = e.find((f) => G(f) && f.data?.type === "submit");
1562
1562
  return d && G(d) ? d : null;
@@ -1571,18 +1571,18 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1571
1571
  try {
1572
1572
  const g = await _s(f, r, s);
1573
1573
  if (g.success) {
1574
- const h = ne(f.successMessage, n);
1574
+ const h = ae(f.successMessage, n);
1575
1575
  if (h && c({ message: h, type: "success" }), d && d(g.data), g.redirectUrl) {
1576
1576
  const p = g.redirectUrl;
1577
1577
  setTimeout(() => Ps(p), 1e3);
1578
1578
  }
1579
1579
  } else {
1580
- const h = ne(f.errorMessage, n) || g.error || "An error occurred during submission";
1580
+ const h = ae(f.errorMessage, n) || g.error || "An error occurred during submission";
1581
1581
  c({ message: h, type: "error" });
1582
1582
  }
1583
1583
  return g;
1584
1584
  } catch (g) {
1585
- const h = ne(f.errorMessage, n) || (g instanceof Error ? g.message : "An unexpected error occurred");
1585
+ const h = ae(f.errorMessage, n) || (g instanceof Error ? g.message : "An unexpected error occurred");
1586
1586
  return c({ message: h, type: "error" }), {
1587
1587
  error: h,
1588
1588
  success: !1
@@ -1635,24 +1635,24 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1635
1635
  formValues: p,
1636
1636
  inputNodes: j,
1637
1637
  missingRequiredFields: I,
1638
- prevFormValuesRef: $,
1639
- visibleNodes: R,
1638
+ prevFormValuesRef: M,
1639
+ visibleNodes: D,
1640
1640
  visibleRootNodes: w,
1641
1641
  setFieldValue: x,
1642
1642
  setMultipleFieldValues: b,
1643
1643
  validateForm: v,
1644
1644
  t: F
1645
- } = ts(r, m, d.language), { handleSubmitWithConfig: P, hasSubmitConfig: q, isSubmitting: ee, submitMessage: Y, clearSubmitMessage: de } = $s(
1646
- R,
1645
+ } = ts(r, m, d.language), { handleSubmitWithConfig: P, hasSubmitConfig: q, isSubmitting: ee, submitMessage: Y, clearSubmitMessage: de } = Ms(
1646
+ D,
1647
1647
  p,
1648
1648
  d.language,
1649
1649
  j
1650
- ), te = d.components.form || ss, se = d.components.submitButton || yt, ie = d.components.submitButtonWrapper || Nt, le = K(a), W = K(c), C = U(() => ze(p, j), [p, j]), T = Q(
1650
+ ), se = d.components.form || ss, re = d.components.submitButton || yt, ie = d.components.submitButtonWrapper || Nt, le = K(a), W = K(c), C = U(() => ze(p, j), [p, j]), T = Q(
1651
1651
  async (N) => {
1652
1652
  N.preventDefault();
1653
- const { isValid: M, errors: D } = v(W.current);
1654
- if (!M) {
1655
- const E = Object.keys(D)[0];
1653
+ const { isValid: $, errors: R } = v(W.current);
1654
+ if (!$) {
1655
+ const E = Object.keys(R)[0];
1656
1656
  E && document.getElementById(E)?.focus();
1657
1657
  return;
1658
1658
  }
@@ -1671,18 +1671,18 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1671
1671
  [v, q, P, i, C]
1672
1672
  ), V = Q(
1673
1673
  (N) => {
1674
- const { type: M } = N;
1675
- switch (M) {
1674
+ const { type: $ } = N;
1675
+ switch ($) {
1676
1676
  case fe.input: {
1677
1677
  if (!G(N))
1678
1678
  return null;
1679
- const D = N.data, E = D.type || "text", S = d.components.inputs?.[E], z = Is[E], H = S || z, ue = (Tt) => x(Z, Tt), Z = N.id, re = p[Z], be = h[Z], je = ne(D.label, d.language), me = ne(D.placeholder, d.language), wt = ne(D.helperText, d.language), vt = Me(N), St = oe(je), Ft = oe(me), Ct = oe(wt);
1679
+ const R = N.data, E = R.type || "text", S = d.components.inputs?.[E], z = Is[E], H = S || z, ue = (Tt) => x(Z, Tt), Z = N.id, ne = p[Z], be = h[Z], je = ae(R.label, d.language), me = ae(R.placeholder, d.language), wt = ae(R.helperText, d.language), vt = $e(N), St = te(je), Ft = te(me), Ct = te(wt);
1680
1680
  return /* @__PURE__ */ t.jsx(
1681
1681
  H,
1682
1682
  {
1683
1683
  id: N.id,
1684
1684
  node: N,
1685
- value: re,
1685
+ value: ne,
1686
1686
  error: be,
1687
1687
  label: St,
1688
1688
  placeholder: Ft,
@@ -1697,22 +1697,22 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1697
1697
  case fe.group: {
1698
1698
  if (!Et(N))
1699
1699
  return null;
1700
- const D = d.components.group || rs, E = R.filter((S) => S.parentId === N.id);
1701
- return /* @__PURE__ */ t.jsx(D, { node: N, children: E.map((S) => V(S)) }, N.id);
1700
+ const R = d.components.group || rs, E = D.filter((S) => S.parentId === N.id);
1701
+ return /* @__PURE__ */ t.jsx(R, { node: N, children: E.map((S) => V(S)) }, N.id);
1702
1702
  }
1703
1703
  case fe.ui: {
1704
- if (!Dt(N))
1704
+ if (!Rt(N))
1705
1705
  return null;
1706
- const E = N.data.type || "title", S = d.components.ui?.[E], z = Ds[E], H = S || z;
1706
+ const E = N.data.type || "title", S = d.components.ui?.[E], z = Rs[E], H = S || z;
1707
1707
  return /* @__PURE__ */ t.jsx(H, { node: N }, N.id);
1708
1708
  }
1709
1709
  case fe.flow:
1710
1710
  return null;
1711
1711
  default:
1712
- return console.warn("Unknown node type:", M), null;
1712
+ return console.warn("Unknown node type:", $), null;
1713
1713
  }
1714
1714
  },
1715
- [d.components, d.language, R, p, h, x, I]
1715
+ [d.components, d.language, D, p, h, x, I]
1716
1716
  );
1717
1717
  return J(() => {
1718
1718
  le.current = a;
@@ -1723,9 +1723,9 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1723
1723
  }, [C]), J(() => {
1724
1724
  d.validationMode === "onChange" && v(W.current);
1725
1725
  }, [d.validationMode, v]), J(() => {
1726
- const N = Ht(j, p, $.current);
1727
- Object.keys(N).length > 0 && b(N), $.current = p;
1728
- }, [p, j, b, $]), /* @__PURE__ */ t.jsx(Ot, { theme: d.theme, storageKey: "treege-renderer-theme", children: /* @__PURE__ */ t.jsxs(
1726
+ const N = Ht(j, p, M.current);
1727
+ Object.keys(N).length > 0 && b(N), M.current = p;
1728
+ }, [p, j, b, M]), /* @__PURE__ */ t.jsx(Ot, { theme: d.theme, storageKey: "treege-renderer-theme", children: /* @__PURE__ */ t.jsxs(
1729
1729
  Yt,
1730
1730
  {
1731
1731
  value: {
@@ -1738,9 +1738,9 @@ const ys = ({ node: e, value: r, setValue: n, error: s, label: a, helperText: i,
1738
1738
  setFieldValue: x
1739
1739
  },
1740
1740
  children: [
1741
- /* @__PURE__ */ t.jsxs(te, { onSubmit: T, children: [
1741
+ /* @__PURE__ */ t.jsxs(se, { onSubmit: T, children: [
1742
1742
  w.map((N) => V(N)),
1743
- f && /* @__PURE__ */ t.jsx(ie, { missingFields: I, children: /* @__PURE__ */ t.jsx(se, { label: F("renderer.defaultSubmitButton.submit"), disabled: ee }) })
1743
+ f && /* @__PURE__ */ t.jsx(ie, { missingFields: I, children: /* @__PURE__ */ t.jsx(re, { label: F("renderer.defaultSubmitButton.submit"), disabled: ee }) })
1744
1744
  ] }),
1745
1745
  /* @__PURE__ */ t.jsx("p", { className: "py-2 text-muted-foreground text-xs", children: "Powered by Treege" }),
1746
1746
  Y && /* @__PURE__ */ t.jsx(
@@ -1780,8 +1780,8 @@ export {
1780
1780
  ze as K,
1781
1781
  Ge as L,
1782
1782
  Ht as M,
1783
- oe as N,
1784
- Re as O,
1783
+ te as N,
1784
+ De as O,
1785
1785
  Zs as T,
1786
1786
  ts as a,
1787
1787
  tr as b,
@@ -1805,8 +1805,8 @@ export {
1805
1805
  Is as t,
1806
1806
  dt as u,
1807
1807
  As as v,
1808
- Rs as w,
1809
- Ds as x,
1808
+ Ds as w,
1809
+ Rs as x,
1810
1810
  ve as y,
1811
1811
  Vt as z
1812
1812
  };
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { T as t } from "./TreegeEditor-LKN_xeXZ.js";
2
2
  import { T as u, d as l, g as r, b as i, c as n, i as o, a as d, u as p } from "./ThemeContext-BIT4DHqC.js";
3
- import { c as T, d as D, e as I, f as m, g, h as c, D as F, i as R, j as N, k as x, l as S, m as b, n as v, o as h, p as w, q as z, r as C, s as H, v as A, w as k, T as y, b as E, L as G, M as P, J as U, K as V, t as j, x as q, y as B, z as J, A as K, C as L, F as M, G as O, I as Q, E as W, H as X, N as Y, O as Z, B as _, u as $, a as ee } from "./TreegeRenderer--ZEq_w_0.js";
3
+ import { c as T, d as D, e as I, f as m, g, h as c, D as F, i as R, j as N, k as x, l as S, m as b, n as v, o as h, p as w, q as z, r as C, s as H, v as A, w as k, T as y, b as E, L as G, M as P, J as U, K as V, t as j, x as q, y as B, z as J, A as K, C as L, F as M, G as O, I as Q, E as W, H as X, N as Y, O as Z, B as _, u as $, a as ee } from "./TreegeRenderer-Ci_Ym86Y.js";
4
4
  export {
5
5
  T as DefaultAddressInput,
6
6
  D as DefaultAutocompleteInput,
package/dist/renderer.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as t, d as s, e as u, f as l, g as n, h as r, D as i, i as o, j as f, k as p, l as d, m as D, n as I, o as T, p as m, q as g, r as c, s as F, v as R, w as v, T as x, b as S, L as b, M as h, J as z, K as C, t as w, x as H, y as N, z as A, A as k, C as y, F as P, G as E, I as G, E as U, H as V, N as j, O as q, B, u as J, a as K } from "./TreegeRenderer--ZEq_w_0.js";
1
+ import { c as t, d as s, e as u, f as l, g as n, h as r, D as i, i as o, j as f, k as p, l as d, m as D, n as I, o as T, p as m, q as g, r as c, s as F, v as R, w as v, T as x, b as S, L as b, M as h, J as z, K as C, t as w, x as H, y as N, z as A, A as k, C as y, F as P, G as E, I as G, E as U, H as V, N as j, O as q, B, u as J, a as K } from "./TreegeRenderer-Ci_Ym86Y.js";
2
2
  import { T as M, g as O, u as Q } from "./ThemeContext-BIT4DHqC.js";
3
3
  export {
4
4
  t as DefaultAddressInput,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "treege",
3
3
  "description": "Powerful form generator",
4
4
  "license": "ISC",
5
- "version": "3.0.0-beta.20",
5
+ "version": "3.0.0-beta.21",
6
6
  "type": "module",
7
7
  "types": "./dist/main.d.ts",
8
8
  "module": "./dist/main.js",