@nivaro/react 0.3.117 → 0.3.118

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 (137) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +136 -14
  4. package/dist/index.js +488 -485
  5. package/dist/shared/components/ActivityEntry.js +130 -125
  6. package/dist/shared/components/AgentPresenceChip.js +36 -26
  7. package/dist/shared/components/CellCopyLayer.js +50 -45
  8. package/dist/shared/components/CollectionBrowserView.js +3757 -3695
  9. package/dist/shared/components/FilePreviewLightbox.js +96 -58
  10. package/dist/shared/components/InStep.js +18 -17
  11. package/dist/shared/components/ItemEditForm.js +4220 -4175
  12. package/dist/shared/components/JobsTray.js +8 -8
  13. package/dist/shared/components/LiveNewMatchesPill.js +21 -14
  14. package/dist/shared/components/LiveOffNote.js +3 -2
  15. package/dist/shared/components/LiveRowMark.js +53 -23
  16. package/dist/shared/components/LiveTraceView.js +162 -123
  17. package/dist/shared/components/MyWorkView.js +320 -299
  18. package/dist/shared/components/NotificationBell.js +14 -14
  19. package/dist/shared/components/OverflowRail.js +1 -1
  20. package/dist/shared/components/PageRenderer.js +120 -116
  21. package/dist/shared/components/ProfileView.js +203 -202
  22. package/dist/shared/components/RealtimeStatusBanner.js +31 -29
  23. package/dist/shared/components/RecordDrilldownSheet.js +7 -7
  24. package/dist/shared/components/RecordHoverCard.js +102 -84
  25. package/dist/shared/components/RecordReadView.js +146 -146
  26. package/dist/shared/components/ScreenRefreshButton.js +34 -32
  27. package/dist/shared/components/TipLayer.js +65 -58
  28. package/dist/shared/components/WidgetImageMenu.js +83 -43
  29. package/dist/shared/components/activity/RecordActivityStream.js +175 -173
  30. package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
  31. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
  32. package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
  33. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
  34. package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
  35. package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
  36. package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
  37. package/dist/shared/components/collections-directory/page-model.js +72 -67
  38. package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
  39. package/dist/shared/components/integrations/SendStatus.js +65 -59
  40. package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
  41. package/dist/shared/components/integrations/console/SignalCard.js +237 -230
  42. package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
  43. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
  44. package/dist/shared/components/item-edit/CloneDialog.js +191 -161
  45. package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
  46. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
  47. package/dist/shared/components/item-edit/FieldComments.js +54 -53
  48. package/dist/shared/components/item-edit/FieldPointer.js +82 -67
  49. package/dist/shared/components/item-edit/FieldRow.js +106 -100
  50. package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
  51. package/dist/shared/components/item-edit/FilePickerField.js +452 -387
  52. package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
  53. package/dist/shared/components/item-edit/HeaderTools.js +94 -85
  54. package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
  55. package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
  56. package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
  57. package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
  58. package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
  59. package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
  60. package/dist/shared/components/item-edit/RecalcValue.js +57 -32
  61. package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
  62. package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
  63. package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
  64. package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
  65. package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
  66. package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
  67. package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
  68. package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
  69. package/dist/shared/components/item-edit/SectionPresence.js +18 -10
  70. package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
  71. package/dist/shared/components/item-edit/UserChip.js +1 -1
  72. package/dist/shared/components/item-edit/file-live.js +69 -54
  73. package/dist/shared/components/item-edit/layout-switch.js +98 -89
  74. package/dist/shared/components/item-edit/partner-needs.js +12 -12
  75. package/dist/shared/components/item-edit/removed-line.js +31 -25
  76. package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
  77. package/dist/shared/components/list/ListViewers.js +46 -35
  78. package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
  79. package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
  80. package/dist/shared/components/panels/AlertBanners.js +82 -72
  81. package/dist/shared/components/panels/BranchLanes.js +22 -22
  82. package/dist/shared/components/panels/CommentImages.js +123 -102
  83. package/dist/shared/components/panels/CommentPanel.js +186 -185
  84. package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
  85. package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
  86. package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
  87. package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
  88. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
  89. package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
  90. package/dist/shared/components/profile/AgentNameField.js +107 -81
  91. package/dist/shared/components/profile/AgentsPanel.js +184 -184
  92. package/dist/shared/components/profile/PersonAccess.js +599 -495
  93. package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
  94. package/dist/shared/components/profile/SignedInDevices.js +17 -17
  95. package/dist/shared/components/profile/primitives.js +1 -1
  96. package/dist/shared/components/queue/OwnerAvatars.js +91 -54
  97. package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
  98. package/dist/shared/components/queue/QueueWorklist.js +1002 -983
  99. package/dist/shared/components/support/AssignRules.js +1733 -0
  100. package/dist/shared/components/support/PersonPick.js +88 -0
  101. package/dist/shared/components/support/RequestList.js +790 -0
  102. package/dist/shared/components/support/ScreenShare.js +158 -152
  103. package/dist/shared/components/support/SupportRequestDialog.js +50 -48
  104. package/dist/shared/components/support/SupportView.js +140 -246
  105. package/dist/shared/components/support/TicketDetailSheet.js +82 -75
  106. package/dist/shared/components/support/TicketSlowScreens.js +9 -9
  107. package/dist/shared/components/support/assign-rules-text.js +171 -0
  108. package/dist/shared/components/support/support-list.js +125 -0
  109. package/dist/shared/components/ui/SimpleSelect.js +28 -20
  110. package/dist/shared/components/ui/checkbox.js +6 -6
  111. package/dist/shared/components/ui/select.js +43 -39
  112. package/dist/shared/components/ui/sheet.js +9 -9
  113. package/dist/shared/components/ui/switch.js +12 -11
  114. package/dist/shared/components/watch-list/WatchDock.js +532 -459
  115. package/dist/shared/components/watch-list/WatchExtras.js +332 -286
  116. package/dist/shared/components/watch-list/WatchRows.js +164 -140
  117. package/dist/shared/lib/activity-sentence.js +103 -91
  118. package/dist/shared/lib/agent-presence.js +27 -21
  119. package/dist/shared/lib/approval-progress.js +2 -2
  120. package/dist/shared/lib/copy-rules.js +31 -24
  121. package/dist/shared/lib/derived-causes.js +113 -78
  122. package/dist/shared/lib/grid-cursors.js +26 -26
  123. package/dist/shared/lib/label-flash.js +27 -0
  124. package/dist/shared/lib/list-return.js +137 -125
  125. package/dist/shared/lib/live-deltas.js +40 -34
  126. package/dist/shared/lib/live-groups.js +56 -52
  127. package/dist/shared/lib/live-preference.js +64 -59
  128. package/dist/shared/lib/live-screen.js +223 -192
  129. package/dist/shared/lib/partner-failure.js +11 -11
  130. package/dist/shared/lib/rollup-recalc.js +68 -64
  131. package/dist/shared/lib/screen-refresh.js +74 -68
  132. package/dist/shared/lib/screen-share.js +108 -104
  133. package/dist/shared/lib/send-status.js +77 -61
  134. package/dist/shared/lib/text-diff-window.js +29 -0
  135. package/dist/shared/lib/watch-list.js +210 -209
  136. package/dist/shared/lib/widget-image-render.js +72 -49
  137. package/package.json +1 -1
@@ -1,115 +1,182 @@
1
- import { jsxs as l, jsx as i, Fragment as W } from "react/jsx-runtime";
2
- import { useQuery as X } from "@tanstack/react-query";
3
- import { Copy as L, ChevronDown as Z, RotateCcw as ee } from "lucide-react";
1
+ import { jsxs as l, jsx as t, Fragment as re } from "react/jsx-runtime";
2
+ import { useQuery as ae } from "@tanstack/react-query";
3
+ import { CopyPlus as L, ChevronDown as Y, RotateCcw as oe } from "lucide-react";
4
4
  import { useState as f } from "react";
5
- import { toast as y } from "sonner";
6
- import { useNivaroClient as te, useItemNavigation as ie } from "../../context.js";
7
- import { post as ne } from "../../lib/commands.js";
8
- import { copyRulesQuery as le, headerCopySkip as re, groupNeverCopied as ae, fieldTitle as E } from "../../lib/copy-rules.js";
9
- import { cn as D } from "../../lib/utils.js";
10
- import { Button as F } from "../ui/button.js";
11
- import { Dialog as se, DialogTrigger as oe, DialogContent as de, DialogHeader as ce, DialogTitle as ue, DialogDescription as me, DialogFooter as fe } from "../ui/dialog.js";
12
- import { Label as Q } from "../ui/label.js";
13
- import { Switch as q } from "../ui/switch.js";
14
- import { FieldRenderer as pe } from "./FieldRenderer.js";
15
- const he = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
16
- function ge(n, c, o) {
17
- if (he.has(n.field) || n.field.includes(".") || n.computed_formula) return !1;
18
- const h = n.interface ?? "";
19
- return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(h) || ["sub_rows", "repeater", "rich_text"].includes(n.type) || c.some((x) => x.one_collection === o && x.one_field === n.field));
5
+ import { toast as C } from "sonner";
6
+ import { useNivaroClient as se, useItemNavigation as de } from "../../context.js";
7
+ import { post as ce } from "../../lib/commands.js";
8
+ import { copyRulesQuery as ue, headerCopySkip as me, groupNeverCopied as fe, fieldTitle as Z } from "../../lib/copy-rules.js";
9
+ import { cn as _ } from "../../lib/utils.js";
10
+ import { Button as O } from "../ui/button.js";
11
+ import { Checkbox as U } from "../ui/checkbox.js";
12
+ import { Dialog as pe, DialogTrigger as he, DialogContent as ge, DialogHeader as xe, DialogTitle as ye, DialogDescription as be, DialogFooter as ve } from "../ui/dialog.js";
13
+ import { Label as W } from "../ui/label.js";
14
+ import { FieldRenderer as we } from "./FieldRenderer.js";
15
+ const Ne = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
16
+ function ke(n, c, o) {
17
+ if (Ne.has(n.field) || n.field.includes(".") || n.computed_formula) return !1;
18
+ const y = n.interface ?? "";
19
+ return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(y) || ["sub_rows", "repeater", "rich_text"].includes(n.type) || c.some((p) => p.one_collection === o && p.one_field === n.field));
20
20
  }
21
- function xe(n) {
21
+ function Ce(n) {
22
22
  return n.interface === "sub_rows" || n.type === "sub_rows";
23
23
  }
24
- function p(n) {
24
+ function x(n) {
25
25
  var c;
26
- return ((c = n.label) == null ? void 0 : c.trim()) || E(n.field);
26
+ return ((c = n.label) == null ? void 0 : c.trim()) || Z(n.field);
27
27
  }
28
- function $e({
28
+ function X(n) {
29
+ return n == null ? !1 : typeof n == "string" ? n.trim() !== "" : Array.isArray(n) ? n.length > 0 : !0;
30
+ }
31
+ function Ae({
29
32
  collection: n,
30
33
  itemId: c,
31
34
  fields: o,
32
- relations: h,
33
- currentValues: g,
34
- onSuccess: x
35
+ relations: y,
36
+ currentValues: u,
37
+ recordLabel: p,
38
+ onSuccess: V
35
39
  }) {
36
- const O = te(), G = ie(), [N, b] = f(!1), [R, $] = f(!1), [v, j] = f(!1), [T, C] = f({}), [z, M] = f({}), k = X({ ...le(O, n), enabled: N }), K = re(k.data), P = ae(k.data, o), _ = P.reduce((e, t) => e + t.fields.length, 0), m = N && k.isPending, S = o.filter(
37
- (e) => ge(e, h, n) && !K.has(e.field)
38
- ), w = o.filter(xe);
39
- function Y() {
40
+ const P = se(), ee = de(), [S, b] = f(!1), [j, E] = f(!1), [v, T] = f(!1), [F, z] = f(!1), [M, I] = f({}), [A, B] = f({}), D = ae({ ...ue(P, n), enabled: S }), te = me(D.data), H = fe(D.data, o), $ = H.reduce((e, i) => e + i.fields.length, 0), h = S && D.isPending, w = o.filter(
41
+ (e) => ke(e, y, n) && !te.has(e.field)
42
+ ), J = w.filter((e) => X(u[e.field])), N = w.filter((e) => !X(u[e.field])), k = o.filter(Ce);
43
+ function ne() {
40
44
  const e = {};
41
45
  for (const r of o)
42
- e[r.field] = { include: !0, value: g[r.field] ?? null };
43
- C(e);
44
- const t = {};
45
- for (const r of w) t[r.field] = !0;
46
- M(t), j(!1), b(!0);
46
+ e[r.field] = { include: !0, value: u[r.field] ?? null };
47
+ I(e);
48
+ const i = {};
49
+ for (const r of k) i[r.field] = !0;
50
+ B(i), T(!1), z(!1), b(!0);
47
51
  }
48
- function B(e, t) {
49
- return JSON.stringify(t.value) !== JSON.stringify(g[e] ?? null);
52
+ function Q(e, i) {
53
+ return JSON.stringify(i.value) !== JSON.stringify(u[e] ?? null);
50
54
  }
51
- async function A() {
52
- var e, t;
53
- $(!0);
55
+ async function ie() {
56
+ var e, i;
57
+ E(!0);
54
58
  try {
55
- const r = {}, s = [];
56
- for (const a of S) {
57
- const d = T[a.field];
59
+ const r = {}, g = [];
60
+ for (const a of w) {
61
+ const d = M[a.field];
58
62
  if (d) {
59
63
  if (!d.include) {
60
- s.push(a.field);
64
+ g.push(a.field);
61
65
  continue;
62
66
  }
63
- B(a.field, d) && (r[a.field] = d.value);
67
+ Q(a.field, d) && (r[a.field] = d.value);
64
68
  }
65
69
  }
66
- const U = w.filter((a) => z[a.field]).map((a) => a.field), u = await O.request(
67
- ne(`/items/${n}/${c}/clone`, {
70
+ const s = k.filter((a) => A[a.field]).map((a) => a.field), m = await P.request(
71
+ ce(`/items/${n}/${c}/clone`, {
68
72
  field_overrides: r,
69
- exclude_fields: s,
70
- include_sub_rows: U
73
+ exclude_fields: g,
74
+ include_sub_rows: s
71
75
  })
72
76
  );
73
77
  b(!1);
74
- const I = (e = u == null ? void 0 : u.data) == null ? void 0 : e.id;
75
- if (I == null) {
76
- y.success("Item cloned — open it from the list");
78
+ const R = (e = m == null ? void 0 : m.data) == null ? void 0 : e.id;
79
+ if (R == null) {
80
+ C.success("Item cloned — open it from the list");
77
81
  return;
78
82
  }
79
- const V = new Map(o.map((a) => [a.field, a])), J = (((t = u == null ? void 0 : u.data) == null ? void 0 : t.not_copied) ?? []).map((a) => {
80
- const d = V.get(a.field);
81
- return d ? p(d) : E(a.field);
83
+ const le = new Map(o.map((a) => [a.field, a])), K = (((i = m == null ? void 0 : m.data) == null ? void 0 : i.not_copied) ?? []).map((a) => {
84
+ const d = le.get(a.field);
85
+ return d ? x(d) : Z(a.field);
82
86
  });
83
- J.length ? y.warning(`Item cloned — not copied: ${J.join(", ")}`, {
87
+ K.length ? C.warning(`Item cloned — not copied: ${K.join(", ")}`, {
84
88
  description: "You may not set these on a new record. Opening the copy."
85
- }) : y.success("Item cloned — opening the copy"), x(I), G.open({ collection: n, itemId: String(I) });
89
+ }) : C.success("Item cloned — opening the copy"), V(R), ee.open({ collection: n, itemId: String(R) });
86
90
  } catch {
87
- y.error("Failed to clone item");
91
+ C.error("Failed to clone item");
88
92
  } finally {
89
- $(!1);
93
+ E(!1);
90
94
  }
91
95
  }
92
- const H = (e, t) => C((r) => ({ ...r, [e]: { ...r[e], value: t } }));
96
+ const q = (e, i) => I((r) => ({ ...r, [e]: { ...r[e], value: i } }));
97
+ function G(e) {
98
+ const i = M[e.field];
99
+ if (!i) return null;
100
+ const r = Q(e.field, i), g = `clone-inc-${e.field}`;
101
+ return /* @__PURE__ */ l("div", { className: "flex items-start gap-2.5", "data-clone-field": e.field, children: [
102
+ /* @__PURE__ */ t(
103
+ U,
104
+ {
105
+ id: g,
106
+ checked: i.include,
107
+ "aria-label": `Copy ${x(e)}`,
108
+ onCheckedChange: () => I((s) => ({
109
+ ...s,
110
+ [e.field]: { ...s[e.field], include: !s[e.field].include }
111
+ })),
112
+ className: "mt-2.5"
113
+ }
114
+ ),
115
+ /* @__PURE__ */ t(
116
+ W,
117
+ {
118
+ htmlFor: g,
119
+ className: _(
120
+ "mt-2 w-36 shrink-0 break-words text-[12px] leading-snug",
121
+ !i.include && "text-slate-400 line-through dark:text-slate-500"
122
+ ),
123
+ children: x(e)
124
+ }
125
+ ),
126
+ /* @__PURE__ */ t("div", { className: _("min-w-0 flex-1", !i.include && "pointer-events-none opacity-40"), children: /* @__PURE__ */ t(
127
+ we,
128
+ {
129
+ field: e,
130
+ value: i.value,
131
+ onChange: (s) => q(e.field, s),
132
+ relations: y,
133
+ collection: n,
134
+ itemId: "new"
135
+ }
136
+ ) }),
137
+ r && i.include && /* @__PURE__ */ t(
138
+ "button",
139
+ {
140
+ type: "button",
141
+ "data-tip": "Back to the original value",
142
+ "aria-label": `Reset ${x(e)}`,
143
+ onClick: () => q(e.field, u[e.field] ?? null),
144
+ className: "mt-2.5 shrink-0 text-slate-400 hover:text-slate-600 dark:hover:text-foreground",
145
+ children: /* @__PURE__ */ t(oe, { className: "h-3.5 w-3.5" })
146
+ }
147
+ )
148
+ ] }, e.field);
149
+ }
93
150
  return /* @__PURE__ */ l(
94
- se,
151
+ pe,
95
152
  {
96
- open: N,
153
+ open: S,
97
154
  onOpenChange: (e) => {
98
- e ? Y() : b(!1);
155
+ e ? ne() : b(!1);
99
156
  },
100
157
  children: [
101
- /* @__PURE__ */ i(oe, { asChild: !0, children: /* @__PURE__ */ l(F, { size: "sm", variant: "outline", className: "gap-1.5", children: [
102
- /* @__PURE__ */ i(L, { className: "h-3.5 w-3.5" }),
103
- "Clone"
104
- ] }) }),
105
- /* @__PURE__ */ l(de, { className: "flex max-h-[85vh] max-w-xl flex-col overflow-hidden", children: [
106
- /* @__PURE__ */ l(ce, { className: "shrink-0 space-y-1.5 px-6 pt-6", children: [
107
- /* @__PURE__ */ i(ue, { className: "text-[15px]", children: "Clone item" }),
108
- /* @__PURE__ */ l(me, { className: "text-[12.5px] leading-relaxed", "data-clone-intro": !0, children: [
158
+ /* @__PURE__ */ t(he, { asChild: !0, children: /* @__PURE__ */ l(
159
+ O,
160
+ {
161
+ size: "sm",
162
+ variant: "outline",
163
+ className: "gap-1.5",
164
+ "data-clone-open": !0,
165
+ "data-tip": "Pick which values to copy; the copy is saved at once and starts at the first step.",
166
+ children: [
167
+ /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" }),
168
+ "Clone and save…"
169
+ ]
170
+ }
171
+ ) }),
172
+ /* @__PURE__ */ l(ge, { className: "flex max-h-[85vh] max-w-xl flex-col overflow-hidden", children: [
173
+ /* @__PURE__ */ l(xe, { className: "shrink-0 space-y-1.5 px-6 pt-6", children: [
174
+ /* @__PURE__ */ t(ye, { className: "truncate text-[15px]", children: p ? `Clone ${p}` : "Clone item" }),
175
+ /* @__PURE__ */ l(be, { className: "text-[12.5px] leading-relaxed", "data-clone-intro": !0, children: [
109
176
  "The copy starts at the first step with its own history.",
110
- !m && _ > 0 && /* @__PURE__ */ l(W, { children: [
177
+ !h && $ > 0 && /* @__PURE__ */ l(re, { children: [
111
178
  " ",
112
- _ === 1 ? "1 field is" : `${_} fields are`,
179
+ $ === 1 ? "1 field is" : `${$} fields are`,
113
180
  " never copied.",
114
181
  " ",
115
182
  /* @__PURE__ */ l(
@@ -117,15 +184,15 @@ function $e({
117
184
  {
118
185
  type: "button",
119
186
  "aria-expanded": v,
120
- onClick: () => j((e) => !e),
187
+ onClick: () => T((e) => !e),
121
188
  className: "inline-flex items-center gap-0.5 font-medium text-nvr-cyan hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 rounded",
122
189
  "data-clone-never-toggle": !0,
123
190
  children: [
124
191
  v ? "Hide" : "Show which",
125
- /* @__PURE__ */ i(
126
- Z,
192
+ /* @__PURE__ */ t(
193
+ Y,
127
194
  {
128
- className: D("h-3 w-3 transition-transform", v && "rotate-180")
195
+ className: _("h-3 w-3 transition-transform", v && "rotate-180")
129
196
  }
130
197
  )
131
198
  ]
@@ -133,20 +200,20 @@ function $e({
133
200
  )
134
201
  ] })
135
202
  ] }),
136
- v && !m && /* @__PURE__ */ i(
203
+ v && !h && /* @__PURE__ */ t(
137
204
  "dl",
138
205
  {
139
206
  className: "mt-1 space-y-1 rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-[12px] dark:border-border dark:bg-muted/40",
140
207
  "data-clone-never-list": !0,
141
- children: P.map((e) => /* @__PURE__ */ l("div", { className: "flex gap-2", children: [
142
- /* @__PURE__ */ i("dt", { className: "w-36 shrink-0 text-slate-500 dark:text-muted-foreground", children: e.label }),
143
- /* @__PURE__ */ i("dd", { className: "min-w-0 text-slate-700 dark:text-foreground", children: e.fields.map((t) => t.label).join(", ") })
208
+ children: H.map((e) => /* @__PURE__ */ l("div", { className: "flex gap-2", children: [
209
+ /* @__PURE__ */ t("dt", { className: "w-36 shrink-0 text-slate-500 dark:text-muted-foreground", children: e.label }),
210
+ /* @__PURE__ */ t("dd", { className: "min-w-0 text-slate-700 dark:text-foreground", children: e.fields.map((i) => i.label).join(", ") })
144
211
  ] }, e.label))
145
212
  }
146
213
  )
147
214
  ] }),
148
- /* @__PURE__ */ i("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: /* @__PURE__ */ l("div", { className: "space-y-4", children: [
149
- m && /* @__PURE__ */ i(
215
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: /* @__PURE__ */ l("div", { className: "space-y-4", children: [
216
+ h && /* @__PURE__ */ t(
150
217
  "p",
151
218
  {
152
219
  className: "text-[12px] text-slate-500 dark:text-muted-foreground",
@@ -154,101 +221,64 @@ function $e({
154
221
  children: "Checking which fields a copy keeps…"
155
222
  }
156
223
  ),
157
- !m && S.length > 0 && /* @__PURE__ */ l("div", { children: [
158
- /* @__PURE__ */ i("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Values the copy starts with" }),
159
- /* @__PURE__ */ i("div", { className: "space-y-2.5", children: S.map((e) => {
160
- const t = T[e.field];
161
- if (!t) return null;
162
- const r = B(e.field, t);
163
- return /* @__PURE__ */ l(
164
- "div",
224
+ !h && w.length > 0 && /* @__PURE__ */ l("div", { children: [
225
+ /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Values the copy starts with" }),
226
+ /* @__PURE__ */ l("div", { className: "space-y-2.5", children: [
227
+ J.map(G),
228
+ J.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Every field the copy could carry is empty on this record." })
229
+ ] }),
230
+ N.length > 0 && /* @__PURE__ */ l("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border", children: [
231
+ /* @__PURE__ */ l(
232
+ "button",
165
233
  {
166
- className: "flex items-start gap-2",
167
- "data-clone-field": e.field,
234
+ type: "button",
235
+ "aria-expanded": F,
236
+ onClick: () => z((e) => !e),
237
+ className: "inline-flex items-center gap-1 rounded text-[12px] font-medium text-slate-600 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:text-muted-foreground dark:hover:text-foreground",
238
+ "data-clone-empty-toggle": !0,
168
239
  children: [
169
- /* @__PURE__ */ i(
170
- q,
171
- {
172
- checked: t.include,
173
- "aria-label": `Copy ${p(e)}`,
174
- onCheckedChange: () => C((s) => ({
175
- ...s,
176
- [e.field]: { ...s[e.field], include: !s[e.field].include }
177
- })),
178
- className: "mt-2 shrink-0 scale-75"
179
- }
180
- ),
181
- /* @__PURE__ */ i(
182
- Q,
183
- {
184
- className: D(
185
- "mt-2.5 w-36 shrink-0 truncate text-[12px]",
186
- !t.include && "text-slate-400 line-through"
187
- ),
188
- children: p(e)
189
- }
190
- ),
191
- /* @__PURE__ */ i(
192
- "div",
240
+ /* @__PURE__ */ t(
241
+ Y,
193
242
  {
194
- className: D(
195
- "min-w-0 flex-1",
196
- !t.include && "pointer-events-none opacity-40"
197
- ),
198
- children: /* @__PURE__ */ i(
199
- pe,
200
- {
201
- field: e,
202
- value: t.value,
203
- onChange: (s) => H(e.field, s),
204
- relations: h,
205
- collection: n,
206
- itemId: "new"
207
- }
243
+ className: _(
244
+ "h-3.5 w-3.5 transition-transform",
245
+ !F && "-rotate-90"
208
246
  )
209
247
  }
210
248
  ),
211
- r && t.include && /* @__PURE__ */ i(
212
- "button",
213
- {
214
- type: "button",
215
- "data-tip": "Back to the original value",
216
- "aria-label": `Reset ${p(e)}`,
217
- onClick: () => H(e.field, g[e.field] ?? null),
218
- className: "mt-2.5 shrink-0 text-slate-400 hover:text-slate-600 dark:hover:text-foreground",
219
- children: /* @__PURE__ */ i(ee, { className: "h-3.5 w-3.5" })
220
- }
221
- )
249
+ N.length === 1 ? "1 empty field" : `${N.length} empty fields`,
250
+ " ",
251
+ /* @__PURE__ */ t("span", { className: "font-normal text-slate-500 dark:text-muted-foreground", children: "— copied empty unless you fill them" })
222
252
  ]
223
- },
224
- e.field
225
- );
226
- }) })
253
+ }
254
+ ),
255
+ F && /* @__PURE__ */ t("div", { className: "mt-2.5 space-y-2.5", "data-clone-empty-list": !0, children: N.map(G) })
256
+ ] })
227
257
  ] }),
228
- w.length > 0 && /* @__PURE__ */ l("div", { children: [
229
- /* @__PURE__ */ i("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Sub-rows" }),
230
- /* @__PURE__ */ i("div", { className: "space-y-2", children: w.map((e) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
231
- /* @__PURE__ */ i(
232
- q,
258
+ k.length > 0 && /* @__PURE__ */ l("div", { children: [
259
+ /* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Sub-rows" }),
260
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: k.map((e) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
261
+ /* @__PURE__ */ t(
262
+ U,
233
263
  {
234
- checked: !!z[e.field],
235
- onCheckedChange: (t) => M((r) => ({ ...r, [e.field]: t })),
236
- className: "shrink-0 scale-75"
264
+ id: `clone-sub-${e.field}`,
265
+ checked: !!A[e.field],
266
+ onCheckedChange: (i) => B((r) => ({ ...r, [e.field]: i === !0 }))
237
267
  }
238
268
  ),
239
- /* @__PURE__ */ l(Q, { className: "text-[12px]", children: [
269
+ /* @__PURE__ */ l(W, { htmlFor: `clone-sub-${e.field}`, className: "text-[12px]", children: [
240
270
  "Include ",
241
- p(e),
271
+ x(e),
242
272
  " rows"
243
273
  ] })
244
274
  ] }, e.field)) })
245
275
  ] })
246
276
  ] }) }),
247
- /* @__PURE__ */ l(fe, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
248
- /* @__PURE__ */ i(F, { variant: "outline", size: "sm", onClick: () => b(!1), children: "Cancel" }),
249
- /* @__PURE__ */ l(F, { size: "sm", disabled: R || m, onClick: A, children: [
250
- /* @__PURE__ */ i(L, { className: "mr-1.5 h-3.5 w-3.5" }),
251
- R ? "Cloning…" : "Clone"
277
+ /* @__PURE__ */ l(ve, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
278
+ /* @__PURE__ */ t(O, { variant: "outline", size: "sm", onClick: () => b(!1), children: "Cancel" }),
279
+ /* @__PURE__ */ l(O, { size: "sm", disabled: j || h, onClick: ie, children: [
280
+ /* @__PURE__ */ t(L, { className: "mr-1.5 h-3.5 w-3.5" }),
281
+ j ? "Cloning…" : "Clone"
252
282
  ] })
253
283
  ] })
254
284
  ] })
@@ -257,5 +287,5 @@ function $e({
257
287
  );
258
288
  }
259
289
  export {
260
- $e as CloneDialog
290
+ Ae as CloneDialog
261
291
  };
@@ -1,50 +1,64 @@
1
- import { jsx as s, jsxs as a } from "react/jsx-runtime";
2
- import { CornerDownRight as m } from "lucide-react";
3
- import { useDerivedCause as l, CAUSE_FRESH_MS as d, causeSentence as f } from "../../lib/derived-causes.js";
4
- import { liveMotionAllowed as u } from "../../lib/live-preference.js";
5
- import { formatRelative as c, cn as p, formatDate as x, formatDateTime as h } from "../../lib/utils.js";
6
- function k({
1
+ import { jsx as m, jsxs as o } from "react/jsx-runtime";
2
+ import { CornerDownRight as f } from "lucide-react";
3
+ import { useDerivedCause as u, CAUSE_FRESH_MS as p, causeSentence as h } from "../../lib/derived-causes.js";
4
+ import { liveMotionAllowed as x } from "../../lib/live-preference.js";
5
+ import { formatRelative as S, cn as g, formatDate as w, formatDateTime as D } from "../../lib/utils.js";
6
+ function y({
7
7
  collection: t,
8
- itemId: e,
8
+ itemId: n,
9
9
  field: r,
10
- type: n
10
+ type: i,
11
+ currency: s,
12
+ value: e
11
13
  }) {
12
- const i = l(t, e, r);
13
- return i ? /* @__PURE__ */ s(S, { cause: i, type: n }) : null;
14
+ const a = u(t, n, r);
15
+ return !a || e === null || e === "" || Array.isArray(e) && e.length === 0 ? null : /* @__PURE__ */ m(N, { cause: a, type: i, currency: s });
14
16
  }
15
- function o(t, e) {
17
+ function l(t, n, r) {
16
18
  if (t == null || t === "") return "empty";
17
- const r = String(e ?? "").toLowerCase();
18
- return r === "date" ? x(String(t)) : /date|time/.test(r) ? h(String(t)) : typeof t == "number" ? t.toLocaleString("en-US", { maximumFractionDigits: 2 }) : String(t);
19
+ const i = String(n ?? "").toLowerCase();
20
+ if (i === "date") return w(String(t));
21
+ if (/date|time/.test(i)) return D(String(t));
22
+ const s = typeof t == "number" ? t : Number(t);
23
+ if (r && Number.isFinite(s))
24
+ try {
25
+ return s.toLocaleString("en-US", { style: "currency", currency: r });
26
+ } catch {
27
+ }
28
+ return typeof t == "number" ? t.toLocaleString("en-US", { maximumFractionDigits: 2 }) : String(t);
19
29
  }
20
- function S({
30
+ function N({
21
31
  cause: t,
22
- type: e,
23
- now: r = Date.now()
32
+ type: n,
33
+ currency: r,
34
+ now: i = Date.now()
24
35
  }) {
25
- const n = r - Date.parse(t.at) < d && u();
26
- return /* @__PURE__ */ a(
36
+ const s = i - Date.parse(t.at) < p && x(), e = h(t, n, r), a = e.lastIndexOf(" "), d = a > 0 ? e.slice(0, a + 1) : "", c = a > 0 ? e.slice(a + 1) : e;
37
+ return /* @__PURE__ */ o(
27
38
  "p",
28
39
  {
29
40
  "data-derived-cause": t.field,
30
- "data-tip": `Was ${o(t.from, e)} · now ${o(t.to, e)}`,
31
- className: p(
41
+ "data-tip": `Was ${l(t.from, n, r)} · now ${l(t.to, n, r)}`,
42
+ className: g(
32
43
  "flex items-start gap-1 rounded px-0.5 text-[11.5px] leading-[1.35rem] text-slate-500 dark:text-slate-400",
33
- n && "nvr-derived-fresh"
44
+ s && "nvr-derived-fresh"
34
45
  ),
35
46
  children: [
36
- /* @__PURE__ */ s(
37
- m,
47
+ /* @__PURE__ */ m(
48
+ f,
38
49
  {
39
50
  className: "mt-[0.3rem] h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500",
40
51
  "aria-hidden": !0
41
52
  }
42
53
  ),
43
- /* @__PURE__ */ a("span", { className: "min-w-0", children: [
44
- f(t, e),
45
- /* @__PURE__ */ a("span", { className: "text-slate-400 dark:text-slate-500", children: [
46
- " · ",
47
- c(t.at)
54
+ /* @__PURE__ */ o("span", { className: "min-w-0", children: [
55
+ d,
56
+ /* @__PURE__ */ o("span", { className: "whitespace-nowrap", children: [
57
+ c,
58
+ /* @__PURE__ */ o("span", { className: "text-slate-400 dark:text-slate-500", children: [
59
+ " · ",
60
+ S(t.at)
61
+ ] })
48
62
  ] })
49
63
  ] })
50
64
  ]
@@ -52,6 +66,6 @@ function S({
52
66
  );
53
67
  }
54
68
  export {
55
- S as DerivedCauseLine,
56
- k as DerivedCauseNote
69
+ N as DerivedCauseLine,
70
+ y as DerivedCauseNote
57
71
  };