@nivaro/react 0.3.104 → 0.3.106

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,29 +1,30 @@
1
- import { jsx as e, jsxs as y, Fragment as $t } from "react/jsx-runtime";
2
- import { useQuery as de, useQueryClient as Dt } from "@tanstack/react-query";
3
- import * as Ft from "lucide-react";
4
- import { ChevronDown as jt, Loader2 as Ot, User as qt, Mail as Bt } from "lucide-react";
5
- import st, { useContext as Ut, useState as Y, useRef as $e, useEffect as ne, memo as Tt } from "react";
6
- import { RelationPathDataContext as It, useDrilldown as lt, fieldDrilldownConfig as Mt, useOptionalNivaroClient as ue, useNavigation as Pt } from "../../context.js";
1
+ import { jsx as e, jsxs as y, Fragment as Dt } from "react/jsx-runtime";
2
+ import { useQuery as de, useQueryClient as Ft } from "@tanstack/react-query";
3
+ import * as jt from "lucide-react";
4
+ import { ChevronDown as Ot, Loader2 as qt, User as Bt, Mail as Ut } from "lucide-react";
5
+ import st, { useContext as Tt, useState as te, useRef as $e, useEffect as ne, memo as It } from "react";
6
+ import { RelationPathDataContext as Mt, useDrilldown as lt, fieldDrilldownConfig as Pt, useOptionalNivaroClient as ue, useNavigation as Gt } from "../../context.js";
7
7
  import { get as at, post as Ct } from "../../lib/commands.js";
8
- import { planFieldGrid as Gt, isEmptyValue as Lt, isFolded as Vt, readGroupStructure as Jt } from "../../lib/form-structure.js";
8
+ import { planFieldGrid as Lt, isEmptyValue as Vt, isFolded as Jt, readGroupStructure as Rt } from "../../lib/form-structure.js";
9
9
  import { reportSectionUse as ot } from "../../lib/form-usage-beacon.js";
10
10
  import { useRecordReader as ct } from "../../lib/record-loader.js";
11
- import { formatDate as ce, formatDateTime as dt, choiceLabel as Rt, titleCase as ut, cn as E, toLocalDateString as De } from "../../lib/utils.js";
12
- import { DesignDropZone as zt, designWrap as Ht } from "../layout-editor/DesignNode.js";
13
- import { useLayoutDesign as Kt, revealGroupKey as Et } from "../layout-editor/design-context.js";
11
+ import { useStartsOpen as zt } from "../../lib/use-starts-open.js";
12
+ import { formatDate as ce, formatDateTime as dt, choiceLabel as Ht, titleCase as ut, cn as E, toLocalDateString as De } from "../../lib/utils.js";
13
+ import { DesignDropZone as Kt, designWrap as Et } from "../layout-editor/DesignNode.js";
14
+ import { useLayoutDesign as Wt, revealGroupKey as At } from "../layout-editor/design-context.js";
14
15
  import { GridGuides as ke } from "../layout-editor/grid-guides.js";
15
- import { UserAvatar as Wt } from "../UserAvatar.js";
16
- import { DropdownMenu as At, DropdownMenuTrigger as Yt, DropdownMenuContent as Qt, DropdownMenuItem as Ye } from "../ui/dropdown-menu.js";
16
+ import { UserAvatar as Yt } from "../UserAvatar.js";
17
+ import { DropdownMenu as Qt, DropdownMenuTrigger as Zt, DropdownMenuContent as Xt, DropdownMenuItem as Ye } from "../ui/dropdown-menu.js";
17
18
  import { WidgetSlot as Qe } from "../WidgetSlot.js";
18
19
  import { FieldRow as Se } from "./FieldRow.js";
19
- import { useFormHelpVideos as Zt, FormHelpVideoButton as Xt } from "./FormHelpVideoButton.js";
20
- import { FoldArea as en, RowGroupCell as tn, rowMemberField as nn } from "./form-structure-ui.js";
21
- import { applyDisplayTemplate as rn, useContainerWidth as sn, resolveColSpan as Ze } from "./helpers.js";
22
- import { SectionIntro as ln } from "./LayoutContentBlock.js";
23
- import { invalidateM2MFor as an } from "./m2m-invalidate.js";
24
- import { groupSectionPropsEqual as on } from "./render-stability.js";
25
- import { UserChip as pt, OwnersInline as Xe, OwnersInlineCompact as cn } from "./UserChip.js";
26
- import { UserRosterCluster as zn } from "./UserChip.js";
20
+ import { useFormHelpVideos as en, FormHelpVideoButton as tn } from "./FormHelpVideoButton.js";
21
+ import { FoldArea as nn, RowGroupCell as rn, rowMemberField as sn } from "./form-structure-ui.js";
22
+ import { applyDisplayTemplate as ln, useContainerWidth as an, resolveColSpan as Ze } from "./helpers.js";
23
+ import { SectionIntro as on } from "./LayoutContentBlock.js";
24
+ import { invalidateM2MFor as cn } from "./m2m-invalidate.js";
25
+ import { groupSectionPropsEqual as dn } from "./render-stability.js";
26
+ import { UserChip as pt, OwnersInline as Xe, OwnersInlineCompact as un } from "./UserChip.js";
27
+ import { UserRosterCluster as En } from "./UserChip.js";
27
28
  function et(n) {
28
29
  if (typeof n != "string") return n ?? [];
29
30
  try {
@@ -32,7 +33,7 @@ function et(n) {
32
33
  return [];
33
34
  }
34
35
  }
35
- function dn({
36
+ function pn({
36
37
  relCollection: n,
37
38
  relId: t,
38
39
  entries: i,
@@ -114,9 +115,9 @@ function dn({
114
115
  ] }, h)
115
116
  )) });
116
117
  }
117
- function un(n) {
118
+ function mn(n) {
118
119
  if (!n) return null;
119
- const t = n.replace(/(^|-)([a-z])/g, (a, s, o) => o.toUpperCase()), i = Ft[t];
120
+ const t = n.replace(/(^|-)([a-z])/g, (a, s, o) => o.toUpperCase()), i = jt[t];
120
121
  return i || null;
121
122
  }
122
123
  function tt(n) {
@@ -200,7 +201,7 @@ function Fe(n, t) {
200
201
  const l = tt(t).choices;
201
202
  if (Array.isArray(l)) {
202
203
  const m = l.find((d) => String(d.value) === s);
203
- if (m) return Rt(m.text);
204
+ if (m) return Ht(m.text);
204
205
  }
205
206
  }
206
207
  const o = Number(s);
@@ -239,7 +240,7 @@ function Fe(n, t) {
239
240
  return !s.includes(" ") && !s.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(s) && !/^\d+$/.test(s) && (s.includes("_") || s.includes("-") || /^[a-z]/.test(s)) ? ut(s) : s;
240
241
  }
241
242
  function nt({ userId: n }) {
242
- const t = ue(), { navigate: i, userUrl: a } = Pt(), s = a ? a(n) : `/users/${n}`, { data: o } = de({
243
+ const t = ue(), { navigate: i, userUrl: a } = Gt(), s = a ? a(n) : `/users/${n}`, { data: o } = de({
243
244
  queryKey: ["user-chip", n],
244
245
  queryFn: () => t.request(
245
246
  at(`/users/${n}`)
@@ -247,10 +248,10 @@ function nt({ userId: n }) {
247
248
  enabled: !!t && !!n,
248
249
  staleTime: 12e4
249
250
  }), r = o ? [o.first_name, o.last_name].filter(Boolean).join(" ") || o.email : n, l = r.split(" ").map((m) => m[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
250
- return /* @__PURE__ */ y(At, { children: [
251
- /* @__PURE__ */ e(Yt, { asChild: !0, children: /* @__PURE__ */ y("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 py-px pl-0.5 pr-2 hover:bg-slate-200 transition-colors", children: [
251
+ return /* @__PURE__ */ y(Qt, { children: [
252
+ /* @__PURE__ */ e(Zt, { asChild: !0, children: /* @__PURE__ */ y("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 py-px pl-0.5 pr-2 hover:bg-slate-200 transition-colors", children: [
252
253
  /* @__PURE__ */ e(
253
- Wt,
254
+ Yt,
254
255
  {
255
256
  userId: n,
256
257
  className: "h-4 w-4",
@@ -259,14 +260,14 @@ function nt({ userId: n }) {
259
260
  ),
260
261
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-600", children: r })
261
262
  ] }) }),
262
- /* @__PURE__ */ y(Qt, { align: "start", className: "text-[12px]", children: [
263
+ /* @__PURE__ */ y(Xt, { align: "start", className: "text-[12px]", children: [
263
264
  s && /* @__PURE__ */ y(
264
265
  Ye,
265
266
  {
266
267
  className: "gap-2 text-[12px] cursor-pointer",
267
268
  onSelect: () => i(s),
268
269
  children: [
269
- /* @__PURE__ */ e(qt, { className: "h-3.5 w-3.5" }),
270
+ /* @__PURE__ */ e(Bt, { className: "h-3.5 w-3.5" }),
270
271
  " View profile"
271
272
  ]
272
273
  }
@@ -279,7 +280,7 @@ function nt({ userId: n }) {
279
280
  window.location.href = `mailto:${o.email}`;
280
281
  },
281
282
  children: [
282
- /* @__PURE__ */ e(Bt, { className: "h-3.5 w-3.5" }),
283
+ /* @__PURE__ */ e(Ut, { className: "h-3.5 w-3.5" }),
283
284
  " Send email"
284
285
  ]
285
286
  }
@@ -287,7 +288,7 @@ function nt({ userId: n }) {
287
288
  ] })
288
289
  ] });
289
290
  }
290
- function pn({
291
+ function fn({
291
292
  collection: n,
292
293
  itemId: t,
293
294
  layoutId: i,
@@ -295,7 +296,7 @@ function pn({
295
296
  filenameTemplate: s,
296
297
  label: o
297
298
  }) {
298
- const r = ue(), l = Dt(), [m, d] = Y(!1), F = async () => {
299
+ const r = ue(), l = Ft(), [m, d] = te(!1), F = async () => {
299
300
  if (!(!r || m || !a)) {
300
301
  d(!0);
301
302
  try {
@@ -306,7 +307,7 @@ function pn({
306
307
  attach_field: a,
307
308
  filename_template: s ?? void 0
308
309
  })
309
- ), an(l, [t]), l.invalidateQueries({ queryKey: ["items", n, t] });
310
+ ), cn(l, [t]), l.invalidateQueries({ queryKey: ["items", n, t] });
310
311
  } catch {
311
312
  } finally {
312
313
  d(!1);
@@ -368,7 +369,7 @@ function re({
368
369
  return /* @__PURE__ */ e("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" });
369
370
  const $ = i ?? "text-[13px] text-slate-700";
370
371
  if (!d) return /* @__PURE__ */ e("span", { className: $, children: o });
371
- const g = r != null && r.display_template ? rn(r.display_template, d) : String(d.name ?? d.title ?? d.label ?? d.display_name ?? o);
372
+ const g = r != null && r.display_template ? ln(r.display_template, d) : String(d.name ?? d.title ?? d.label ?? d.display_name ?? o);
372
373
  return /* @__PURE__ */ e("span", { className: $, children: g });
373
374
  }
374
375
  function rt({ userId: n }) {
@@ -406,8 +407,8 @@ function it({
406
407
  }
407
408
  );
408
409
  }
409
- function mn(n) {
410
- const [t, i] = Y(!1), a = $e(!0), s = $e(JSON.stringify(n ?? null));
410
+ function hn(n) {
411
+ const [t, i] = te(!1), a = $e(!0), s = $e(JSON.stringify(n ?? null));
411
412
  return ne(() => {
412
413
  const o = JSON.stringify(n ?? null);
413
414
  if (a.current) {
@@ -422,7 +423,7 @@ function mn(n) {
422
423
  };
423
424
  }, [n]), t ? "nvr-value-pulse" : "";
424
425
  }
425
- function Ln({
426
+ function Rn({
426
427
  field: n,
427
428
  val: t,
428
429
  relations: i,
@@ -431,7 +432,7 @@ function Ln({
431
432
  textClassName: o
432
433
  }) {
433
434
  var O;
434
- const r = mn(t), l = (O = Ut(It)) == null ? void 0 : O[n.field], m = lt(), d = E(o ?? "text-[13px] text-slate-900 dark:text-slate-100", r), F = Mt(n) ?? { enabled: !0, layout_id: null, width: null }, $ = i.find(
435
+ const r = hn(t), l = (O = Tt(Mt)) == null ? void 0 : O[n.field], m = lt(), d = E(o ?? "text-[13px] text-slate-900 dark:text-slate-100", r), F = Pt(n) ?? { enabled: !0, layout_id: null, width: null }, $ = i.find(
435
436
  (c) => c.one_collection === a && c.one_field === n.field && c.junction_field
436
437
  );
437
438
  if ($) {
@@ -510,7 +511,7 @@ function Ln({
510
511
  }
511
512
  return h;
512
513
  }
513
- function fn({
514
+ function bn({
514
515
  summaryFields: n,
515
516
  fields: t,
516
517
  draft: i,
@@ -541,7 +542,7 @@ function fn({
541
542
  return /* @__PURE__ */ y("div", { className: "flex items-center gap-1.5", children: [
542
543
  /* @__PURE__ */ e("span", { className: x, children: u }),
543
544
  /* @__PURE__ */ e(
544
- cn,
545
+ un,
545
546
  {
546
547
  collection: r ?? s,
547
548
  itemId: l ?? o
@@ -549,14 +550,14 @@ function fn({
549
550
  )
550
551
  ] });
551
552
  }
552
- const M = n.find((u) => (typeof u == "string" ? u : u.field) === _), me = M && typeof M != "string" ? M.label : void 0, H = t.find((u) => u.field === _), G = me || (H == null ? void 0 : H.label) || _.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
553
+ const M = n.find((u) => (typeof u == "string" ? u : u.field) === _), me = M && typeof M != "string" ? M.label : void 0, H = t.find((u) => u.field === _), C = me || (H == null ? void 0 : H.label) || _.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
553
554
  if (h != null && h.has(_))
554
555
  return /* @__PURE__ */ y("div", { className: "flex items-center gap-1.5", children: [
555
- /* @__PURE__ */ e("span", { className: x, children: G }),
556
- /* @__PURE__ */ e(Ot, { className: "h-3 w-3 animate-spin text-slate-300" })
556
+ /* @__PURE__ */ e("span", { className: x, children: C }),
557
+ /* @__PURE__ */ e(qt, { className: "h-3 w-3 animate-spin text-slate-300" })
557
558
  ] });
558
559
  if ($ && _ in $) {
559
- const u = g == null ? void 0 : g[_], T = (u == null ? void 0 : u.label) || G, B = $[_];
560
+ const u = g == null ? void 0 : g[_], T = (u == null ? void 0 : u.label) || C, B = $[_];
560
561
  let I;
561
562
  if ((u == null ? void 0 : u.agg) === "count")
562
563
  I = String(B);
@@ -580,10 +581,10 @@ function fn({
580
581
  else if (A === "int")
581
582
  I = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(B);
582
583
  else if (A === "decimal") {
583
- const Q = typeof W.precision == "number" ? W.precision : 2;
584
+ const Y = typeof W.precision == "number" ? W.precision : 2;
584
585
  I = new Intl.NumberFormat(void 0, {
585
- minimumFractionDigits: Q,
586
- maximumFractionDigits: Q
586
+ minimumFractionDigits: Y,
587
+ maximumFractionDigits: Y
587
588
  }).format(B);
588
589
  } else
589
590
  I = B.toLocaleString(void 0, { maximumFractionDigits: 2 });
@@ -596,7 +597,7 @@ function fn({
596
597
  if (d && _ in d) {
597
598
  const u = d[_];
598
599
  return /* @__PURE__ */ y("div", { className: R, children: [
599
- /* @__PURE__ */ e("span", { className: x, children: G }),
600
+ /* @__PURE__ */ e("span", { className: x, children: C }),
600
601
  /* @__PURE__ */ y("span", { className: S, children: [
601
602
  u,
602
603
  " item",
@@ -607,7 +608,7 @@ function fn({
607
608
  if (F && _ in F) {
608
609
  const u = F[_];
609
610
  return /* @__PURE__ */ y("div", { className: R, children: [
610
- /* @__PURE__ */ e("span", { className: x, children: G }),
611
+ /* @__PURE__ */ e("span", { className: x, children: C }),
611
612
  /* @__PURE__ */ y("span", { className: S, children: [
612
613
  u,
613
614
  " row",
@@ -621,14 +622,14 @@ function fn({
621
622
  if (P != null && P.one_collection) {
622
623
  const u = Array.isArray(q) ? q : q != null && q !== "" ? [q] : [];
623
624
  return /* @__PURE__ */ y("div", { className: R, children: [
624
- /* @__PURE__ */ e("span", { className: x, children: G }),
625
+ /* @__PURE__ */ e("span", { className: x, children: C }),
625
626
  u.length === 0 ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : P.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: u.map((T) => /* @__PURE__ */ e(nt, { userId: String(T) }, String(T))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: u.map((T) => /* @__PURE__ */ e(re, { relCollection: P.one_collection, id: T }, String(T))) })
626
627
  ] });
627
628
  }
628
629
  if (Array.isArray(q)) {
629
630
  const u = a.find((B) => B.many_field === _ && B.junction_field), T = u == null ? void 0 : u.one_collection;
630
631
  return /* @__PURE__ */ y("div", { className: R, children: [
631
- /* @__PURE__ */ e("span", { className: x, children: G }),
632
+ /* @__PURE__ */ e("span", { className: x, children: C }),
632
633
  q.length === 0 ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : T ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: q.map(
633
634
  (B) => T === "nivaro_users" ? /* @__PURE__ */ e(nt, { userId: String(B) }, String(B)) : /* @__PURE__ */ e(re, { relCollection: T, id: B }, String(B))
634
635
  ) }) : /* @__PURE__ */ y("span", { className: S, children: [
@@ -639,7 +640,7 @@ function fn({
639
640
  ] });
640
641
  }
641
642
  return /* @__PURE__ */ y("div", { className: R, children: [
642
- /* @__PURE__ */ e("span", { className: x, children: G }),
643
+ /* @__PURE__ */ e("span", { className: x, children: C }),
643
644
  q == null || q === "" ? /* @__PURE__ */ e("span", { className: D, children: "—" }) : /* @__PURE__ */ e("span", { className: S, children: Fe(q, H) })
644
645
  ] });
645
646
  };
@@ -652,7 +653,7 @@ function fn({
652
653
  }
653
654
  );
654
655
  }
655
- const Vn = Tt(function({
656
+ const zn = It(function({
656
657
  group: t,
657
658
  fields: i,
658
659
  draft: a,
@@ -678,7 +679,7 @@ const Vn = Tt(function({
678
679
  summaryAggConfigs: M,
679
680
  o2mLoading: me,
680
681
  footerSlot: H,
681
- ownersCollection: G,
682
+ ownersCollection: C,
682
683
  ownersItemId: q,
683
684
  ownersAssignment: P,
684
685
  pdfAssignment: u,
@@ -687,42 +688,45 @@ const Vn = Tt(function({
687
688
  layoutId: I,
688
689
  hideEmptySummary: W,
689
690
  widgetAssignments: A,
690
- widgetApiBase: Q,
691
+ widgetApiBase: Y,
691
692
  fieldInlineDisplay: fe,
692
693
  swapConfig: L,
693
694
  swapped: je,
694
695
  onSwapToggle: Oe,
695
- alternateFields: Z,
696
+ alternateFields: Q,
696
697
  alternateWidths: he,
697
698
  deferred: ie,
698
699
  onFirstOpen: se
699
700
  }) {
700
701
  var Le;
701
- const [mt, ft] = Y(t.is_collapsed ?? !1), [ht, bt] = Y(!1), j = Kt(), K = (f, N) => Ht(j, f, N, { asChild: !0 }), le = (f) => ({ kind: "slot", field: f, group_key: t.key }), qe = !!(j != null && j.showHidden), [Be, Ue] = Y({}), { data: be } = Zt(r), X = (j == null ? void 0 : j.fold) ?? null, ee = (j == null ? void 0 : j.reveal) ?? null, [Te, xe] = Y(null);
702
+ const [mt, ft] = zt(
703
+ t.is_collapsed == null ? void 0 : !t.is_collapsed,
704
+ !0
705
+ ), ht = !mt, [bt, xt] = te(!1), j = Wt(), K = (f, N) => Et(j, f, N, { asChild: !0 }), le = (f) => ({ kind: "slot", field: f, group_key: t.key }), qe = !!(j != null && j.showHidden), [Be, Ue] = te({}), { data: be } = en(r), Z = (j == null ? void 0 : j.fold) ?? null, X = (j == null ? void 0 : j.reveal) ?? null, [Te, xe] = te(null);
702
706
  ne(() => {
703
- X && xe(!X.open);
704
- }, [X == null ? void 0 : X.seq]), ne(() => {
705
- ee && Et(ee.target) === t.key && xe(!1);
706
- }, [ee == null ? void 0 : ee.seq]);
707
- const Ie = S !== void 0, z = Te ?? (Ie ? !x : mt);
707
+ Z && xe(!Z.open);
708
+ }, [Z == null ? void 0 : Z.seq]), ne(() => {
709
+ X && At(X.target) === t.key && xe(!1);
710
+ }, [X == null ? void 0 : X.seq]);
711
+ const Ie = S !== void 0, z = Te ?? (Ie ? !x : ht);
708
712
  ne(() => {
709
713
  ie && !z && (se == null || se(t.key));
710
714
  }, [ie, z, se, t.key]);
711
715
  const ge = Te !== null ? () => xe((f) => !f) : Ie ? S : () => ft((f) => !f), Me = !j && I != null, ye = () => {
712
716
  Me && ot({ layoutId: Number(I), collection: r, kind: "opened", key: t.key });
713
- }, xt = () => {
717
+ }, gt = () => {
714
718
  z && ye(), ge == null || ge();
715
- }, gt = !g && i.some((f) => m[f.field]), Pe = j ? "always" : t.visibility_mode ?? "always";
719
+ }, yt = !g && i.some((f) => m[f.field]), Pe = j ? "always" : t.visibility_mode ?? "always";
716
720
  if (Pe === "new_only" && !O || Pe === "existing_only" && O) return null;
717
- const te = A ?? [], yt = !O && te.some((f) => f.widget_id != null && Be[f.field] === void 0);
721
+ const ee = A ?? [], _t = !O && ee.some((f) => f.widget_id != null && Be[f.field] === void 0);
718
722
  let ae = !1;
719
723
  if (t.hide_when_empty && c && !j && (ae = c.every(
720
724
  (N) => N == null || N === "" || Array.isArray(N) && N.length === 0
721
- ) && !yt && te.every((N) => !Be[N.field])), ae && te.length === 0) return null;
722
- const _e = $e(null), Ne = sn(_e), Ce = un(t.icon), _t = qe ? i : i.filter((f) => !f.hidden), Ge = (Le = be == null ? void 0 : be.sections) == null ? void 0 : Le[t.key], Nt = Array.isArray(Ge) && Ge.length > 0, wt = (f) => Nt ? /* @__PURE__ */ y("div", { className: "relative", children: [
725
+ ) && !_t && ee.every((N) => !Be[N.field])), ae && ee.length === 0) return null;
726
+ const _e = $e(null), Ne = an(_e), Ge = mn(t.icon), Nt = qe ? i : i.filter((f) => !f.hidden), Ce = (Le = be == null ? void 0 : be.sections) == null ? void 0 : Le[t.key], wt = Array.isArray(Ce) && Ce.length > 0, vt = (f) => wt ? /* @__PURE__ */ y("div", { className: "relative", children: [
723
727
  f,
724
728
  /* @__PURE__ */ e("span", { className: "absolute right-[52px] top-1/2 flex -translate-y-1/2", children: /* @__PURE__ */ e(
725
- Xt,
729
+ tn,
726
730
  {
727
731
  collection: r,
728
732
  kind: "section",
@@ -750,14 +754,14 @@ const Vn = Tt(function({
750
754
  (p = (N = f.target) == null ? void 0 : N.closest) != null && p.call(N, "[data-usage-header]") || ye();
751
755
  },
752
756
  children: [
753
- Me && !ae && /* @__PURE__ */ e(hn, { layoutId: Number(I), collection: r, sectionKey: t.key }),
754
- wt(
757
+ Me && !ae && /* @__PURE__ */ e(xn, { layoutId: Number(I), collection: r, sectionKey: t.key }),
758
+ vt(
755
759
  /* @__PURE__ */ y(
756
760
  "button",
757
761
  {
758
762
  type: "button",
759
763
  "data-usage-header": "",
760
- onClick: xt,
764
+ onClick: gt,
761
765
  "data-design-group-header": j ? "" : void 0,
762
766
  className: E(
763
767
  "flex w-full items-center gap-2 px-5 py-3 text-left hover:bg-slate-50/50 dark:hover:bg-white/[0.02] rounded-t-xl",
@@ -767,12 +771,12 @@ const Vn = Tt(function({
767
771
  z && !(D && D.length > 0) && "rounded-b-xl"
768
772
  ),
769
773
  children: [
770
- Ce && /* @__PURE__ */ e(Ce, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
774
+ Ge && /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
771
775
  /* @__PURE__ */ e("span", { className: "font-medium text-[13px] shrink-0 text-slate-800 dark:text-slate-200", children: t.label }),
772
776
  /* @__PURE__ */ e("span", { className: "flex-1" }),
773
- gt && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
777
+ yt && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
774
778
  /* @__PURE__ */ e(
775
- jt,
779
+ Ot,
776
780
  {
777
781
  "data-design-pass": j ? "" : void 0,
778
782
  className: E(
@@ -786,7 +790,7 @@ const Vn = Tt(function({
786
790
  )
787
791
  ),
788
792
  z && D && D.length > 0 && /* @__PURE__ */ e(
789
- fn,
793
+ bn,
790
794
  {
791
795
  summaryFields: D,
792
796
  fields: i,
@@ -794,7 +798,7 @@ const Vn = Tt(function({
794
798
  relations: o,
795
799
  collection: r,
796
800
  itemId: l,
797
- ownersCollection: G,
801
+ ownersCollection: C,
798
802
  ownersItemId: q,
799
803
  ownersAssignment: P,
800
804
  m2mCounts: R,
@@ -805,14 +809,14 @@ const Vn = Tt(function({
805
809
  hideEmpty: !!t.summary_hide_empty || !!W
806
810
  }
807
811
  ),
808
- z && !ie && t.hide_when_empty && te.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: te.filter((f) => f.widget_id != null).map((f) => /* @__PURE__ */ e(
812
+ z && !ie && t.hide_when_empty && ee.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: ee.filter((f) => f.widget_id != null).map((f) => /* @__PURE__ */ e(
809
813
  Qe,
810
814
  {
811
815
  widgetId: f.widget_id,
812
816
  inputBindings: et(f.input_bindings),
813
817
  itemDraft: a,
814
818
  frameless: !0,
815
- apiBase: Q,
819
+ apiBase: Y,
816
820
  onContentChange: (N) => Ue(
817
821
  (p) => p[f.field] === N ? p : { ...p, [f.field]: N }
818
822
  )
@@ -825,13 +829,13 @@ const Vn = Tt(function({
825
829
  "data-section-body": "",
826
830
  className: "nvr-expand-in border-t border-slate-100 px-5 py-4 dark:border-border/60",
827
831
  children: [
828
- !g && /* @__PURE__ */ e(ln, { group: t, className: "mb-3" }),
832
+ !g && /* @__PURE__ */ e(on, { group: t, className: "mb-3" }),
829
833
  (() => {
830
- const f = Gt(_t, {
831
- rows: g ? [] : Jt(t.swap_config).rows,
832
- folded: (p) => !g && Vt(p._overrides),
834
+ const f = Lt(Nt, {
835
+ rows: g ? [] : Rt(t.swap_config).rows,
836
+ folded: (p) => !g && Jt(p._overrides),
833
837
  keep: (p) => !!p.required,
834
- filled: (p) => !Lt(a[p.field]) || !!m[p.field]
838
+ filled: (p) => !Vt(a[p.field]) || !!m[p.field]
835
839
  }), N = f.units.map(
836
840
  (p) => p.kind === "row" ? {
837
841
  _k: `row:${p.row.key}`,
@@ -854,7 +858,7 @@ const Vn = Tt(function({
854
858
  });
855
859
  for (const p of A ?? [])
856
860
  N.push({ _k: p.field, sort: p.sort, _t: "widget", slot: p });
857
- return N.sort((p, U) => p.sort - U.sort), j && N.length === 0 && f.folded.length === 0 ? /* @__PURE__ */ e(zt, {}) : g ? /* @__PURE__ */ y(
861
+ return N.sort((p, U) => p.sort - U.sort), j && N.length === 0 && f.folded.length === 0 ? /* @__PURE__ */ e(Kt, {}) : g ? /* @__PURE__ */ y(
858
862
  "div",
859
863
  {
860
864
  ref: _e,
@@ -900,7 +904,7 @@ const Vn = Tt(function({
900
904
  /* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: U.label || ut(U.field) }),
901
905
  /* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (b == null ? void 0 : b.one_collection) === "nivaro_users" ? (() => {
902
906
  const k = a[U.field], V = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
903
- return V.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: V.map((C) => /* @__PURE__ */ e(pt, { userId: String(C) }, String(C))) });
907
+ return V.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: V.map((G) => /* @__PURE__ */ e(pt, { userId: String(G) }, String(G))) });
904
908
  })() : b != null && b.one_collection ? /* @__PURE__ */ e(re, { relCollection: b.one_collection, id: a[U.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: Fe(a[U.field], U) }) })
905
909
  ]
906
910
  },
@@ -915,7 +919,7 @@ const Vn = Tt(function({
915
919
  var Ee, We;
916
920
  if (b._t === "row")
917
921
  return /* @__PURE__ */ e(
918
- tn,
922
+ rn,
919
923
  {
920
924
  row: b.row,
921
925
  members: b.members,
@@ -926,7 +930,7 @@ const Vn = Tt(function({
926
930
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
927
931
  Se,
928
932
  {
929
- field: nn(w),
933
+ field: sn(w),
930
934
  draft: a,
931
935
  onChange: s,
932
936
  relations: o,
@@ -965,7 +969,7 @@ const Vn = Tt(function({
965
969
  return K(
966
970
  le("__pdf__"),
967
971
  /* @__PURE__ */ e("div", { style: { gridColumn: `span ${w}` }, children: /* @__PURE__ */ e(
968
- pn,
972
+ fn,
969
973
  {
970
974
  collection: r,
971
975
  itemId: l,
@@ -991,7 +995,7 @@ const Vn = Tt(function({
991
995
  label: b.slot.label_override ?? void 0,
992
996
  defaultExpanded: b.slot.default_expanded ?? !0,
993
997
  frameless: !0,
994
- apiBase: Q,
998
+ apiBase: Y,
995
999
  onContentChange: (Ae) => Ue(
996
1000
  (ve) => ve[b.slot.field] === Ae ? ve : { ...ve, [b.slot.field]: Ae }
997
1001
  )
@@ -999,15 +1003,15 @@ const Vn = Tt(function({
999
1003
  ) }, b.slot.field)
1000
1004
  );
1001
1005
  }
1002
- const k = b.f, V = fe == null ? void 0 : fe[k.field], C = V == null ? void 0 : V.entries, vt = (V == null ? void 0 : V.separator) ?? null, oe = a[k.field], Ve = oe != null && oe !== "", Je = C != null && C.length && Ve ? ((We = o.find(
1006
+ const k = b.f, V = fe == null ? void 0 : fe[k.field], G = V == null ? void 0 : V.entries, kt = (V == null ? void 0 : V.separator) ?? null, oe = a[k.field], Ve = oe != null && oe !== "", Je = G != null && G.length && Ve ? ((We = o.find(
1003
1007
  (w) => w.many_collection === r && w.many_field === k.field && !w.junction_field
1004
1008
  )) == null ? void 0 : We.one_collection) ?? null : null, Re = (L == null ? void 0 : L.enabled) && k.field === L.primary_field, ze = (() => {
1005
1009
  const w = a[(L == null ? void 0 : L.primary_field) ?? ""];
1006
1010
  return w != null && w !== "";
1007
- })(), He = (Z ?? []).some((w) => {
1011
+ })(), He = (Q ?? []).some((w) => {
1008
1012
  const J = a[w.field];
1009
1013
  return J != null && J !== "";
1010
- }), kt = Re && Oe ? /* @__PURE__ */ y("span", { className: "inline-flex items-center gap-1.5", children: [
1014
+ }), St = Re && Oe ? /* @__PURE__ */ y("span", { className: "inline-flex items-center gap-1.5", children: [
1011
1015
  /* @__PURE__ */ e(
1012
1016
  "button",
1013
1017
  {
@@ -1061,7 +1065,7 @@ const Vn = Tt(function({
1061
1065
  ]
1062
1066
  }
1063
1067
  )
1064
- ] }) : void 0, St = Re && je && (Z != null && Z.length) ? /* @__PURE__ */ e("div", { className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 dark:border-border dark:bg-slate-900/40 p-3", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: Z.map((w) => {
1068
+ ] }) : void 0, $t = Re && je && (Q != null && Q.length) ? /* @__PURE__ */ e("div", { className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 dark:border-border dark:bg-slate-900/40 p-3", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: Q.map((w) => {
1065
1069
  const J = (he == null ? void 0 : he[w.field]) ?? 2;
1066
1070
  return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${J}` }, children: /* @__PURE__ */ e(
1067
1071
  Se,
@@ -1097,8 +1101,8 @@ const Vn = Tt(function({
1097
1101
  layoutAiEnabled: $,
1098
1102
  renderField: h,
1099
1103
  onCountChange: v,
1100
- swapButton: kt,
1101
- swapContent: St
1104
+ swapButton: St,
1105
+ swapContent: $t
1102
1106
  }
1103
1107
  );
1104
1108
  return K(
@@ -1109,13 +1113,13 @@ const Vn = Tt(function({
1109
1113
  style: { gridColumn: `span ${Ze(k.options, Ne)}` },
1110
1114
  children: [
1111
1115
  we(k) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: Ke }) : Ke,
1112
- (C == null ? void 0 : C.length) && Ve && Je && /* @__PURE__ */ e(
1113
- dn,
1116
+ (G == null ? void 0 : G.length) && Ve && Je && /* @__PURE__ */ e(
1117
+ pn,
1114
1118
  {
1115
1119
  relCollection: Je,
1116
1120
  relId: oe,
1117
- entries: C,
1118
- separator: vt
1121
+ entries: G,
1122
+ separator: kt
1119
1123
  }
1120
1124
  )
1121
1125
  ]
@@ -1129,7 +1133,7 @@ const Vn = Tt(function({
1129
1133
  _t: "field",
1130
1134
  f: b
1131
1135
  }));
1132
- return /* @__PURE__ */ y($t, { children: [
1136
+ return /* @__PURE__ */ y(Dt, { children: [
1133
1137
  /* @__PURE__ */ y(
1134
1138
  "div",
1135
1139
  {
@@ -1143,13 +1147,13 @@ const Vn = Tt(function({
1143
1147
  }
1144
1148
  ),
1145
1149
  /* @__PURE__ */ e(
1146
- en,
1150
+ nn,
1147
1151
  {
1148
1152
  count: U.length,
1149
- open: ht,
1153
+ open: bt,
1150
1154
  forcedOpen: f.forcedOpen,
1151
1155
  design: !!j,
1152
- onToggle: () => bt((b) => !b),
1156
+ onToggle: () => xt((b) => !b),
1153
1157
  children: /* @__PURE__ */ y(
1154
1158
  "div",
1155
1159
  {
@@ -1173,8 +1177,8 @@ const Vn = Tt(function({
1173
1177
  ]
1174
1178
  }
1175
1179
  );
1176
- }, on);
1177
- function hn({
1180
+ }, dn);
1181
+ function xn({
1178
1182
  layoutId: n,
1179
1183
  collection: t,
1180
1184
  sectionKey: i
@@ -1184,14 +1188,14 @@ function hn({
1184
1188
  }, [n, t, i]), null;
1185
1189
  }
1186
1190
  export {
1187
- Vn as GroupSection,
1188
- dn as InlineDisplay,
1191
+ zn as GroupSection,
1192
+ pn as InlineDisplay,
1189
1193
  Xe as OwnersInline,
1190
- cn as OwnersInlineCompact,
1194
+ un as OwnersInlineCompact,
1191
1195
  re as RelationCell,
1192
- Ln as StripFieldValue,
1196
+ Rn as StripFieldValue,
1193
1197
  pt as UserChip,
1194
- zn as UserRosterCluster,
1198
+ En as UserRosterCluster,
1195
1199
  Fe as formatDisplayValue,
1196
- mn as useChangePulse
1200
+ hn as useChangePulse
1197
1201
  };