@nivaro/react 0.3.8 → 0.3.10

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 (60) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/replayUploadQueue.js +107 -93
  4. package/dist/hooks/useNivaroForm.js +129 -126
  5. package/dist/hooks/useSessionRecorder.js +103 -101
  6. package/dist/index.d.ts +115 -2
  7. package/dist/index.js +466 -447
  8. package/dist/shared/components/CollectionBrowserView.js +1058 -1059
  9. package/dist/shared/components/ConformanceView.js +36 -35
  10. package/dist/shared/components/DataTable.js +230 -223
  11. package/dist/shared/components/ForceReloadBanner.js +58 -34
  12. package/dist/shared/components/ItemEditForm.js +3687 -3580
  13. package/dist/shared/components/JsonMapEditor.js +18 -17
  14. package/dist/shared/components/MatrixEditor.js +8 -7
  15. package/dist/shared/components/MyWorkView.js +32 -31
  16. package/dist/shared/components/PageRenderer.js +146 -145
  17. package/dist/shared/components/QueryTable.js +49 -49
  18. package/dist/shared/components/RecordGridEditor.js +76 -75
  19. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  20. package/dist/shared/components/ai/AskPanel.js +55 -54
  21. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  22. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  23. package/dist/shared/components/chat/ChatPanel.js +288 -287
  24. package/dist/shared/components/chat/SlashCommands.js +30 -29
  25. package/dist/shared/components/chat/chat-outbox.js +76 -75
  26. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  27. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  28. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  29. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  30. package/dist/shared/components/item-edit/InlineTableField.js +301 -300
  31. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  32. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  33. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  34. package/dist/shared/components/item-edit/staged-links.js +86 -0
  35. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  36. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  37. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  38. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  39. package/dist/shared/components/panels/CommentPanel.js +237 -236
  40. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  41. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  42. package/dist/shared/components/profile/usePersonPresence.js +42 -37
  43. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  44. package/dist/shared/components/queue/QueueWorklist.js +597 -598
  45. package/dist/shared/lib/client-version.js +63 -0
  46. package/dist/shared/lib/force-reload.js +36 -0
  47. package/dist/shared/lib/load-error.js +11 -10
  48. package/dist/shared/lib/presence-live.js +73 -0
  49. package/dist/shared/lib/presence-state.js +39 -31
  50. package/dist/shared/lib/record-outbox.js +76 -75
  51. package/dist/shared/lib/request-gate.js +120 -102
  52. package/dist/shared/lib/rum.js +45 -36
  53. package/dist/shared/lib/safe-error.js +39 -0
  54. package/dist/shared/lib/server-clock.js +11 -7
  55. package/dist/shared/lib/signed-out.js +114 -0
  56. package/dist/shared/lib/socket-realtime.js +19 -17
  57. package/dist/shared/lib/unsaved-work.js +62 -0
  58. package/dist/shared/lib/use-online-users.js +11 -10
  59. package/dist/shared/lib/worker-socket.js +89 -79
  60. package/package.json +1 -1
@@ -1,9 +1,10 @@
1
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
2
  import { X as J } from "lucide-react";
3
3
  import { useState as l } from "react";
4
+ import { userErrorMessage as T } from "../../../lib/safe-error.js";
4
5
  import { Command as _, CommandInput as y, CommandList as k, CommandGroup as N, CommandItem as C } from "../../ui/command.js";
5
6
  import { Popover as i, PopoverTrigger as c, PopoverContent as p } from "../../ui/popover.js";
6
- function X({
7
+ function q({
7
8
  rule: t,
8
9
  parentFields: h,
9
10
  childFields: u,
@@ -12,8 +13,8 @@ function X({
12
13
  }) {
13
14
  var v, g;
14
15
  const [S, f] = l(!1), [j, m] = l(!1), [E, R] = l(!1), [P, b] = l(""), [s, d] = l(null), x = !!t.on_unavailable && typeof t.on_unavailable == "object";
15
- return /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
16
- /* @__PURE__ */ n(i, { open: S, onOpenChange: f, children: [
16
+ return /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
17
+ /* @__PURE__ */ r(i, { open: S, onOpenChange: f, children: [
17
18
  /* @__PURE__ */ e(c, { asChild: !0, children: /* @__PURE__ */ e(
18
19
  "button",
19
20
  {
@@ -23,7 +24,7 @@ function X({
23
24
  children: t.parent_field ? ((v = h.find((a) => a.value === t.parent_field)) == null ? void 0 : v.label) ?? t.parent_field : /* @__PURE__ */ e("span", { className: "text-slate-400", children: "parent field…" })
24
25
  }
25
26
  ) }),
26
- /* @__PURE__ */ e(p, { className: "w-52 p-0", align: "start", children: /* @__PURE__ */ n(_, { children: [
27
+ /* @__PURE__ */ e(p, { className: "w-52 p-0", align: "start", children: /* @__PURE__ */ r(_, { children: [
27
28
  /* @__PURE__ */ e(y, { placeholder: "Search…", className: "h-8 text-[12px]" }),
28
29
  /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(N, { children: h.map((a) => /* @__PURE__ */ e(
29
30
  C,
@@ -40,7 +41,7 @@ function X({
40
41
  ] }) })
41
42
  ] }),
42
43
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400 shrink-0", children: "→" }),
43
- /* @__PURE__ */ n(i, { open: j, onOpenChange: m, children: [
44
+ /* @__PURE__ */ r(i, { open: j, onOpenChange: m, children: [
44
45
  /* @__PURE__ */ e(c, { asChild: !0, children: /* @__PURE__ */ e(
45
46
  "button",
46
47
  {
@@ -50,7 +51,7 @@ function X({
50
51
  children: t.child_field ? ((g = u.find((a) => a.value === t.child_field)) == null ? void 0 : g.label) ?? t.child_field : /* @__PURE__ */ e("span", { className: "text-slate-400", children: "child field…" })
51
52
  }
52
53
  ) }),
53
- /* @__PURE__ */ e(p, { className: "w-52 p-0", align: "start", children: /* @__PURE__ */ n(_, { children: [
54
+ /* @__PURE__ */ e(p, { className: "w-52 p-0", align: "start", children: /* @__PURE__ */ r(_, { children: [
54
55
  /* @__PURE__ */ e(y, { placeholder: "Search…", className: "h-8 text-[12px]" }),
55
56
  /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(N, { children: u.map((a) => /* @__PURE__ */ e(
56
57
  C,
@@ -66,7 +67,7 @@ function X({
66
67
  )) }) })
67
68
  ] }) })
68
69
  ] }),
69
- /* @__PURE__ */ n(
70
+ /* @__PURE__ */ r(
70
71
  i,
71
72
  {
72
73
  open: E,
@@ -85,9 +86,9 @@ function X({
85
86
  children: "⇄"
86
87
  }
87
88
  ) }),
88
- /* @__PURE__ */ n(p, { className: "w-[420px] p-3 space-y-2", align: "end", children: [
89
+ /* @__PURE__ */ r(p, { className: "w-[420px] p-3 space-y-2", align: "end", children: [
89
90
  /* @__PURE__ */ e("p", { className: "text-[11px] font-medium text-slate-700 dark:text-foreground", children: "On unavailable — swap to a default" }),
90
- /* @__PURE__ */ n("p", { className: "text-[11px] text-slate-500", children: [
91
+ /* @__PURE__ */ r("p", { className: "text-[11px] text-slate-500", children: [
91
92
  "When the parent field is changed and a row’s value is no longer offered, re-point the row to the option that keeps ",
92
93
  /* @__PURE__ */ e("code", { children: "keep" }),
93
94
  " from the old value and takes",
@@ -104,17 +105,17 @@ function X({
104
105
  const w = a.target.value.trim();
105
106
  if (!w) {
106
107
  d(null);
107
- const { on_unavailable: r, ...I } = t;
108
+ const { on_unavailable: n, ...I } = t;
108
109
  o(I);
109
110
  return;
110
111
  }
111
112
  try {
112
- const r = JSON.parse(w);
113
- if (!r || typeof r != "object" || !r.replace)
113
+ const n = JSON.parse(w);
114
+ if (!n || typeof n != "object" || !n.replace)
114
115
  throw new Error('needs a "replace" map');
115
- d(null), o({ ...t, on_unavailable: r });
116
- } catch (r) {
117
- d(r instanceof Error ? r.message : "Invalid JSON");
116
+ d(null), o({ ...t, on_unavailable: n });
117
+ } catch (n) {
118
+ d(T(n, "Invalid JSON"));
118
119
  }
119
120
  },
120
121
  rows: 9,
@@ -146,5 +147,5 @@ function X({
146
147
  ] });
147
148
  }
148
149
  export {
149
- X as CascadeRuleRow
150
+ q as CascadeRuleRow
150
151
  };
@@ -4,15 +4,16 @@ import { PlayCircle as L, X as Q, Plus as R, StickyNote as V } from "lucide-reac
4
4
  import { useState as y, useEffect as j } from "react";
5
5
  import { useNivaroClient as T } from "../../../context.js";
6
6
  import { get as $ } from "../../../lib/commands.js";
7
- import { cn as K } from "../../../lib/utils.js";
8
- import { useHelpVideosForForm as X, fetchHelpVideo as M, helpVideoApi as D } from "../../help-videos/api.js";
9
- import { Command as z, CommandInput as G, CommandList as J, CommandEmpty as U, CommandItem as W } from "../../ui/command.js";
10
- import { Popover as Y, PopoverTrigger as Z, PopoverContent as ee } from "../../ui/popover.js";
11
- import { noteOf as te, NOTE_TEXT_MAX as oe, noteByline as ae, noteOps as re } from "../editor-notes.js";
12
- import { inputBase as ne } from "../panel-style.js";
7
+ import { userErrorMessage as K } from "../../../lib/safe-error.js";
8
+ import { cn as M } from "../../../lib/utils.js";
9
+ import { useHelpVideosForForm as X, fetchHelpVideo as D, helpVideoApi as z } from "../../help-videos/api.js";
10
+ import { Command as G, CommandInput as J, CommandList as U, CommandEmpty as W, CommandItem as Y } from "../../ui/command.js";
11
+ import { Popover as Z, PopoverTrigger as ee, PopoverContent as te } from "../../ui/popover.js";
12
+ import { noteOf as oe, NOTE_TEXT_MAX as ae, noteByline as re, noteOps as ne } from "../editor-notes.js";
13
+ import { inputBase as ie } from "../panel-style.js";
13
14
  import { useInspectorEnv as q, Setting as A } from "./kit.js";
14
- const E = "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-white px-2.5 text-[12px] font-medium text-slate-700 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:bg-background dark:text-foreground dark:hover:bg-muted", ie = "inline-flex h-7 items-center rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white transition-colors hover:bg-[#00b8e0] disabled:opacity-40";
15
- function se() {
15
+ const E = "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-white px-2.5 text-[12px] font-medium text-slate-700 transition-colors hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:bg-background dark:text-foreground dark:hover:bg-muted", se = "inline-flex h-7 items-center rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white transition-colors hover:bg-[#00b8e0] disabled:opacity-40";
16
+ function le() {
16
17
  const n = T();
17
18
  return _({
18
19
  queryKey: ["layout-editor", "me"],
@@ -20,11 +21,11 @@ function se() {
20
21
  queryFn: () => n.request($("/users/me")).then((r) => r.data)
21
22
  });
22
23
  }
23
- function ke({ target: n, name: r }) {
24
- const c = q(), { data: a } = se(), t = te(c.bundle, n), [p, i] = y((t == null ? void 0 : t.text) ?? "");
24
+ function we({ target: n, name: r }) {
25
+ const c = q(), { data: a } = le(), t = oe(c.bundle, n), [p, i] = y((t == null ? void 0 : t.text) ?? "");
25
26
  j(() => i((t == null ? void 0 : t.text) ?? ""), [t == null ? void 0 : t.text]);
26
27
  const m = p.trim() !== ((t == null ? void 0 : t.text) ?? ""), d = (l, f) => {
27
- const h = re(c.bundle, n, l);
28
+ const h = ne(c.bundle, n, l);
28
29
  h.length && c.apply(h, { label: f });
29
30
  }, u = () => {
30
31
  if (!p.trim()) return d(null, `Remove the note on ${r}`);
@@ -49,21 +50,21 @@ function ke({ target: n, name: r }) {
49
50
  {
50
51
  "aria-label": "Note for editors",
51
52
  rows: 3,
52
- maxLength: oe,
53
+ maxLength: ae,
53
54
  value: p,
54
55
  placeholder: "Finance asked for this in Q3",
55
56
  onChange: (l) => i(l.target.value),
56
- className: K(ne, "h-auto py-1.5 leading-snug")
57
+ className: M(ie, "h-auto py-1.5 leading-snug")
57
58
  }
58
59
  ),
59
- t && /* @__PURE__ */ o("p", { "data-note-byline": "", className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: ae(t) }),
60
+ t && /* @__PURE__ */ o("p", { "data-note-byline": "", className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: re(t) }),
60
61
  /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-2", children: [
61
62
  /* @__PURE__ */ o(
62
63
  "button",
63
64
  {
64
65
  type: "button",
65
66
  "data-note-save": "",
66
- className: ie,
67
+ className: se,
67
68
  disabled: !m,
68
69
  onClick: u,
69
70
  children: t ? "Save note" : "Pin note"
@@ -84,24 +85,24 @@ function ke({ target: n, name: r }) {
84
85
  }
85
86
  );
86
87
  }
87
- function Ne({
88
+ function Ce({
88
89
  kind: n,
89
90
  name: r,
90
91
  label: c
91
92
  }) {
92
- var w, C;
93
- const a = q(), t = T(), p = I(), { data: i } = X(a.collection), m = n === "field" ? (w = i == null ? void 0 : i.fields) == null ? void 0 : w[r] : (C = i == null ? void 0 : i.sections) == null ? void 0 : C[r], d = Array.isArray(m) ? m : [], [u, l] = y(!1), [f, h] = y(!1), [v, k] = y(null), x = _({
93
+ var N, w;
94
+ const a = q(), t = T(), p = I(), { data: i } = X(a.collection), m = n === "field" ? (N = i == null ? void 0 : i.fields) == null ? void 0 : N[r] : (w = i == null ? void 0 : i.sections) == null ? void 0 : w[r], d = Array.isArray(m) ? m : [], [u, l] = y(!1), [f, h] = y(!1), [g, v] = y(null), x = _({
94
95
  queryKey: ["help-videos", "library", { status: "published", picker: !0 }],
95
96
  enabled: u,
96
97
  staleTime: 6e4,
97
98
  queryFn: () => t.request($("/help-videos", { status: "published", limit: 100 })).then((e) => e.data)
98
- }), b = { kind: n, key: a.collection, state_key: r }, O = (e) => e.kind === b.kind && e.key === b.key && e.state_key === b.state_key, N = async (e, F) => {
99
- h(!0), k(null);
99
+ }), b = { kind: n, key: a.collection, state_key: r }, O = (e) => e.kind === b.kind && e.key === b.key && e.state_key === b.state_key, k = async (e, F) => {
100
+ h(!0), v(null);
100
101
  try {
101
- const S = ((await M(t, e)).contexts ?? []).filter((H) => !O(H));
102
- await D(t).setContexts(e, F ? [...S, b] : S), await p.invalidateQueries({ queryKey: ["help-videos"] });
103
- } catch (g) {
104
- k(g instanceof Error ? g.message : "Could not change the video");
102
+ const S = ((await D(t, e)).contexts ?? []).filter((H) => !O(H));
103
+ await z(t).setContexts(e, F ? [...S, b] : S), await p.invalidateQueries({ queryKey: ["help-videos"] });
104
+ } catch (C) {
105
+ v(K(C, "Could not change the video"));
105
106
  } finally {
106
107
  h(!1);
107
108
  }
@@ -131,7 +132,7 @@ function Ne({
131
132
  "aria-label": `Take ${e.title} off ${c}`,
132
133
  "data-tip": "Take it off",
133
134
  disabled: f,
134
- onClick: () => void N(e.id, !1),
135
+ onClick: () => void k(e.id, !1),
135
136
  className: "rounded p-0.5 text-slate-400 hover:bg-muted hover:text-slate-700 disabled:opacity-40 dark:hover:text-foreground",
136
137
  children: /* @__PURE__ */ o(Q, { className: "h-3.5 w-3.5" })
137
138
  }
@@ -140,21 +141,21 @@ function Ne({
140
141
  },
141
142
  e.id
142
143
  )) }),
143
- /* @__PURE__ */ s(Y, { open: u, onOpenChange: l, children: [
144
- /* @__PURE__ */ o(Z, { asChild: !0, children: /* @__PURE__ */ s("button", { type: "button", className: E, disabled: f, "data-help-video-pick": "", children: [
144
+ /* @__PURE__ */ s(Z, { open: u, onOpenChange: l, children: [
145
+ /* @__PURE__ */ o(ee, { asChild: !0, children: /* @__PURE__ */ s("button", { type: "button", className: E, disabled: f, "data-help-video-pick": "", children: [
145
146
  /* @__PURE__ */ o(R, { className: "h-3.5 w-3.5" }),
146
147
  "Attach a video"
147
148
  ] }) }),
148
- /* @__PURE__ */ o(ee, { align: "start", className: "w-[300px] p-0", children: /* @__PURE__ */ s(z, { children: [
149
- /* @__PURE__ */ o(G, { placeholder: "Find a published video…" }),
150
- /* @__PURE__ */ s(J, { className: "max-h-[260px] overscroll-contain", children: [
151
- /* @__PURE__ */ o(U, { children: x.isLoading ? "Loading videos…" : "No published videos to attach." }),
149
+ /* @__PURE__ */ o(te, { align: "start", className: "w-[300px] p-0", children: /* @__PURE__ */ s(G, { children: [
150
+ /* @__PURE__ */ o(J, { placeholder: "Find a published video…" }),
151
+ /* @__PURE__ */ s(U, { className: "max-h-[260px] overscroll-contain", children: [
152
+ /* @__PURE__ */ o(W, { children: x.isLoading ? "Loading videos…" : "No published videos to attach." }),
152
153
  B.map((e) => /* @__PURE__ */ o(
153
- W,
154
+ Y,
154
155
  {
155
156
  value: `${e.title} ${e.id}`,
156
157
  onSelect: () => {
157
- l(!1), N(e.id, !0);
158
+ l(!1), k(e.id, !0);
158
159
  },
159
160
  children: /* @__PURE__ */ o("span", { className: "truncate", children: e.title })
160
161
  },
@@ -163,12 +164,12 @@ function Ne({
163
164
  ] })
164
165
  ] }) })
165
166
  ] }),
166
- v && /* @__PURE__ */ o("p", { role: "alert", className: "text-[12px] text-red-700 dark:text-red-300", children: v })
167
+ g && /* @__PURE__ */ o("p", { role: "alert", className: "text-[12px] text-red-700 dark:text-red-300", children: g })
167
168
  ]
168
169
  }
169
170
  );
170
171
  }
171
172
  export {
172
- Ne as HelpVideoSetting,
173
- ke as NoteSetting
173
+ Ce as HelpVideoSetting,
174
+ we as NoteSetting
174
175
  };
@@ -2,17 +2,18 @@ import { jsxs as h, jsx as r, Fragment as J } from "react/jsx-runtime";
2
2
  import { useState as Q, useMemo as P } from "react";
3
3
  import { toast as O } from "sonner";
4
4
  import { HEADER_GROUP_KEY as _ } from "../../../lib/layout-ops.js";
5
+ import { userErrorMessage as X } from "../../../lib/safe-error.js";
5
6
  import { cn as F } from "../../../lib/utils.js";
6
- import { Skeleton as X } from "../../ui/skeleton.js";
7
- import { targetOfKey as ee, keyOf as te, isFieldRow as T, fieldZones as re, zoneItems as oe } from "../field-zones.js";
8
- import { resetPlacementOps as ne } from "../inheritance.js";
9
- import { useCollectionMeta as le } from "../inspector/field-context.js";
10
- import { overridePlacementOps as ae, describeField as se } from "../inspector/model.js";
11
- import { LoadError as ie } from "../load-error.js";
12
- import { useCollectionPipelines as de } from "../preview/preview-api.js";
13
- import { useCellMenu as ce, MatrixMenu as me, matrixCorner as ue, matrixTh as H, matrixRowHead as he, InheritChip as fe, matrixCellTd as Z, MatrixCellButton as j, matrixZoneTd as we } from "./MatrixGrid.js";
14
- import { useSaveRequirements as pe } from "./matrix-api.js";
15
- import { CELL_KINDS as z, stateCell as K, movesFrom as be, everyStateValue as L, everyStateOps as ge, cellChange as xe } from "./state-matrix.js";
7
+ import { Skeleton as ee } from "../../ui/skeleton.js";
8
+ import { targetOfKey as te, keyOf as re, isFieldRow as T, fieldZones as oe, zoneItems as ne } from "../field-zones.js";
9
+ import { resetPlacementOps as le } from "../inheritance.js";
10
+ import { useCollectionMeta as ae } from "../inspector/field-context.js";
11
+ import { overridePlacementOps as se, describeField as ie } from "../inspector/model.js";
12
+ import { LoadError as de } from "../load-error.js";
13
+ import { useCollectionPipelines as ce } from "../preview/preview-api.js";
14
+ import { useCellMenu as me, MatrixMenu as ue, matrixCorner as he, matrixTh as H, matrixRowHead as fe, InheritChip as pe, matrixCellTd as Z, MatrixCellButton as j, matrixZoneTd as we } from "./MatrixGrid.js";
15
+ import { useSaveRequirements as be } from "./matrix-api.js";
16
+ import { CELL_KINDS as z, stateCell as K, movesFrom as ge, everyStateValue as L, everyStateOps as xe, cellChange as ye } from "./state-matrix.js";
16
17
  const x = {
17
18
  normal: "Editable",
18
19
  readonly: "Read-only",
@@ -24,18 +25,18 @@ const x = {
24
25
  required: "required",
25
26
  hidden: "hidden"
26
27
  }, D = "*", A = (o) => `${o.field}${o.group_key ?? ""}`;
27
- function ye(o, a) {
28
- const f = new Set((a == null ? void 0 : a.placements.map((n) => n.field)) ?? []), w = (n) => ({
28
+ function ve(o, a) {
29
+ const f = new Set((a == null ? void 0 : a.placements.map((n) => n.field)) ?? []), p = (n) => ({
29
30
  row: n,
30
31
  source: f.has(n.field) ? "override" : "own"
31
- }), v = [], g = o.placements.filter((n) => n.group_key === _ && T(n)).sort((n, p) => n.sort - p.sort);
32
- g.length && v.push({ key: _, label: "Header strip", rows: g.map(w) });
33
- for (const n of re(o)) {
34
- const p = oe(o, n.key).filter(T);
35
- p.length && v.push({ key: n.key ?? "", label: n.label, rows: p.map(w) });
32
+ }), v = [], g = o.placements.filter((n) => n.group_key === _ && T(n)).sort((n, w) => n.sort - w.sort);
33
+ g.length && v.push({ key: _, label: "Header strip", rows: g.map(p) });
34
+ for (const n of oe(o)) {
35
+ const w = ne(o, n.key).filter(T);
36
+ w.length && v.push({ key: n.key ?? "", label: n.label, rows: w.map(p) });
36
37
  }
37
38
  if (a) {
38
- const n = new Set(o.placements.map((b) => b.field)), p = /* @__PURE__ */ new Set(), C = a.placements.filter((b) => !T(b) || n.has(b.field) || p.has(b.field) ? !1 : (p.add(b.field), !0));
39
+ const n = new Set(o.placements.map((b) => b.field)), w = /* @__PURE__ */ new Set(), C = a.placements.filter((b) => !T(b) || n.has(b.field) || w.has(b.field) ? !1 : (w.add(b.field), !0));
39
40
  C.length && v.push({
40
41
  key: "parent",
41
42
  label: `From ${String(a.layout.name ?? "the parent layout")}`,
@@ -44,19 +45,19 @@ function ye(o, a) {
44
45
  }
45
46
  return v;
46
47
  }
47
- function Pe({
48
+ function He({
48
49
  bundle: o,
49
50
  parent: a,
50
51
  collection: f,
51
- apply: w,
52
+ apply: p,
52
53
  onSelect: v
53
54
  }) {
54
- const { data: g } = le(f), {
55
+ const { data: g } = ae(f), {
55
56
  data: n = [],
56
- isLoading: p,
57
+ isLoading: w,
57
58
  isError: C,
58
59
  refetch: b
59
- } = de(f, !0), [V, W] = Q(null), s = n.find((e) => e.id === V) ?? n[0] ?? null, k = (s == null ? void 0 : s.states) ?? [], N = (s == null ? void 0 : s.transitions) ?? [], I = pe(f), y = ce(), R = P(() => ye(o, a), [o, a]), q = String((a == null ? void 0 : a.layout.name) ?? "the parent layout"), E = (e) => se(e.field, (g == null ? void 0 : g.fields) ?? [], (g == null ? void 0 : g.relations) ?? [], e).label, l = P(() => {
60
+ } = ce(f, !0), [V, W] = Q(null), s = n.find((e) => e.id === V) ?? n[0] ?? null, k = (s == null ? void 0 : s.states) ?? [], N = (s == null ? void 0 : s.transitions) ?? [], M = be(f), y = me(), R = P(() => ve(o, a), [o, a]), q = String((a == null ? void 0 : a.layout.name) ?? "the parent layout"), E = (e) => ie(e.field, (g == null ? void 0 : g.fields) ?? [], (g == null ? void 0 : g.relations) ?? [], e).label, l = P(() => {
60
61
  if (!y.open) return null;
61
62
  const e = y.open.lastIndexOf("|"), t = y.open.slice(0, e), d = y.open.slice(e + 1);
62
63
  for (const c of R)
@@ -72,7 +73,7 @@ function Pe({
72
73
  blocked: null
73
74
  })) : (() => {
74
75
  var m;
75
- const e = l.state, t = K(l.row, e, N), d = be(N, e), c = d.length === 1 ? `"${(m = d[0]) == null ? void 0 : m.label}"` : `the ${d.length} moves out`;
76
+ const e = l.state, t = K(l.row, e, N), d = ge(N, e), c = d.length === 1 ? `"${(m = d[0]) == null ? void 0 : m.label}"` : `the ${d.length} moves out`;
76
77
  return z.map((i) => {
77
78
  const u = t.options[i];
78
79
  return {
@@ -87,15 +88,15 @@ function Pe({
87
88
  if (!l) return;
88
89
  const t = E(l.row);
89
90
  if (l.state == null) {
90
- const m = ge(l.row, e);
91
- m.length && w(m, { label: `${t}: ${x[e].toLowerCase()} on every state` });
91
+ const m = xe(l.row, e);
92
+ m.length && p(m, { label: `${t}: ${x[e].toLowerCase()} on every state` });
92
93
  return;
93
94
  }
94
95
  if (!s) return;
95
- const d = l.state, c = xe(l.row, d, s.id, N, e);
96
- if (c && (c.ops.length && w(c.ops, { label: `${t}: ${x[e].toLowerCase()} in ${d.label}` }), c.requirements.length !== 0))
96
+ const d = l.state, c = ye(l.row, d, s.id, N, e);
97
+ if (c && (c.ops.length && p(c.ops, { label: `${t}: ${x[e].toLowerCase()} in ${d.label}` }), c.requirements.length !== 0))
97
98
  try {
98
- await I(c.requirements);
99
+ await M(c.requirements);
99
100
  const m = c.requirements.map((i) => `"${i.label}"`).join(", ");
100
101
  O.success(
101
102
  e === "required" ? `${m} now ${c.requirements.length === 1 ? "asks" : "ask"} for ${t}` : `${m} no longer ${c.requirements.length === 1 ? "asks" : "ask"} for ${t}`,
@@ -103,7 +104,7 @@ function Pe({
103
104
  description: `Saved to the ${s.name} pipeline`,
104
105
  action: {
105
106
  label: "Undo",
106
- onClick: () => void I(c.requirements, "before").catch(
107
+ onClick: () => void M(c.requirements, "before").catch(
107
108
  (i) => O.error(U(i))
108
109
  )
109
110
  }
@@ -112,13 +113,13 @@ function Pe({
112
113
  } catch (m) {
113
114
  O.error(`The pipeline was not changed: ${U(m)}`);
114
115
  }
115
- }, M = R.reduce((e, t) => e + t.rows.length, 0);
116
+ }, I = R.reduce((e, t) => e + t.rows.length, 0);
116
117
  return /* @__PURE__ */ h("div", { "data-field-state-matrix": "", className: "flex min-h-full flex-col gap-2 p-4", children: [
117
118
  /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-2", children: [
118
119
  /* @__PURE__ */ h("p", { className: "m-0 min-w-0 flex-1 text-[12px] text-slate-500 dark:text-muted-foreground", children: [
119
- M,
120
+ I,
120
121
  " ",
121
- M === 1 ? "field" : "fields",
122
+ I === 1 ? "field" : "fields",
122
123
  " by workflow state. Read-only uses the field's Read-only when; Required asks for the value before the record leaves the state."
123
124
  ] }),
124
125
  n.length > 1 && /* @__PURE__ */ r(
@@ -143,7 +144,7 @@ function Pe({
143
144
  }
144
145
  )
145
146
  ] }),
146
- C ? /* @__PURE__ */ r(ie, { what: "the workflow states", onRetry: () => void b() }) : !p && !s && /* @__PURE__ */ r(
147
+ C ? /* @__PURE__ */ r(de, { what: "the workflow states", onRetry: () => void b() }) : !w && !s && /* @__PURE__ */ r(
147
148
  "p",
148
149
  {
149
150
  role: "note",
@@ -151,8 +152,8 @@ function Pe({
151
152
  children: "No pipeline runs on this collection, so only Every state applies."
152
153
  }
153
154
  ),
154
- p ? /* @__PURE__ */ r(X, { className: "h-48 w-full rounded-lg" }) : /* @__PURE__ */ r(
155
- me,
155
+ w ? /* @__PURE__ */ r(ee, { className: "h-48 w-full rounded-lg" }) : /* @__PURE__ */ r(
156
+ ue,
156
157
  {
157
158
  menu: y,
158
159
  title: l ? `${E(l.row)} · ${l.state ? l.state.label : "Every state"}` : "",
@@ -161,7 +162,7 @@ function Pe({
161
162
  onPick: (e) => void G(e),
162
163
  children: /* @__PURE__ */ r("div", { className: "min-h-0 flex-1 overflow-auto rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ h("table", { className: "border-separate border-spacing-0 text-[12.5px]", children: [
163
164
  /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ h("tr", { children: [
164
- /* @__PURE__ */ r("th", { className: ue, children: "Field" }),
165
+ /* @__PURE__ */ r("th", { className: he, children: "Field" }),
165
166
  /* @__PURE__ */ r(
166
167
  "th",
167
168
  {
@@ -192,19 +193,19 @@ function Pe({
192
193
  ] }) }),
193
194
  /* @__PURE__ */ h("tbody", { children: [
194
195
  R.map((e) => /* @__PURE__ */ r(
195
- ve,
196
+ ke,
196
197
  {
197
198
  zone: e,
198
199
  colSpan: k.length + 1,
199
200
  render: (t) => {
200
201
  const d = E(t.row), c = A(t.row), m = t.source === "inherited" ? `From ${q} — override it to change it here` : null, i = L(t.row);
201
202
  return /* @__PURE__ */ h("tr", { "data-matrix-row": t.row.field, children: [
202
- /* @__PURE__ */ h("th", { scope: "row", className: he, children: [
203
+ /* @__PURE__ */ h("th", { scope: "row", className: fe, children: [
203
204
  /* @__PURE__ */ r(
204
205
  "button",
205
206
  {
206
207
  type: "button",
207
- onClick: (u) => v(ee(te(t.row)), {
208
+ onClick: (u) => v(te(re(t.row)), {
208
209
  additive: u.shiftKey || u.metaKey || u.ctrlKey
209
210
  }),
210
211
  "data-tip": "Select it on the form",
@@ -213,16 +214,16 @@ function Pe({
213
214
  }
214
215
  ),
215
216
  t.source !== "own" && a && /* @__PURE__ */ r(
216
- fe,
217
+ pe,
217
218
  {
218
219
  kind: t.source === "inherited" ? "inherited" : "override",
219
220
  parentName: q,
220
221
  action: t.source === "inherited" ? "override" : "reset",
221
222
  actionLabel: t.source === "inherited" ? `Override ${d} on this form` : `Reset ${d} to ${q}`,
222
223
  actionTip: t.source === "inherited" ? "Copy it onto this form to change it here" : `Take ${q}'s placement of it again`,
223
- onAction: () => t.source === "inherited" ? w(ae(o, a, t.row), {
224
+ onAction: () => t.source === "inherited" ? p(se(o, a, t.row), {
224
225
  label: `Override ${d} on this form`
225
- }) : w(ne(o, t.row.field), {
226
+ }) : p(le(o, t.row.field), {
226
227
  label: `Reset ${d} to ${q}`
227
228
  })
228
229
  }
@@ -275,7 +276,7 @@ function Pe({
275
276
  )
276
277
  ] });
277
278
  }
278
- function ve({
279
+ function ke({
279
280
  zone: o,
280
281
  colSpan: a,
281
282
  render: f
@@ -295,11 +296,11 @@ function ve({
295
296
  ] });
296
297
  }
297
298
  function U(o) {
298
- var f, w;
299
- const a = (w = (f = o == null ? void 0 : o.response) == null ? void 0 : f.data) == null ? void 0 : w.error;
300
- return typeof a == "string" ? a : o instanceof Error ? o.message : "Something went wrong";
299
+ var f, p;
300
+ const a = (p = (f = o == null ? void 0 : o.response) == null ? void 0 : f.data) == null ? void 0 : p.error;
301
+ return typeof a == "string" ? a : X(o, "Something went wrong");
301
302
  }
302
303
  export {
303
- Pe as FieldStateMatrix,
304
- ye as matrixZones
304
+ He as FieldStateMatrix,
305
+ ve as matrixZones
305
306
  };