@nivaro/react 0.3.63 β†’ 0.3.65

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 (64) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +54 -5
  4. package/dist/shared/components/CollectionBrowserView.js +3029 -2947
  5. package/dist/shared/components/ConformanceView.js +235 -221
  6. package/dist/shared/components/DataTable.js +478 -459
  7. package/dist/shared/components/ItemEditForm.js +4469 -4266
  8. package/dist/shared/components/PageRenderer.js +146 -138
  9. package/dist/shared/components/RecordDrilldownSheet.js +73 -65
  10. package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
  11. package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
  12. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
  13. package/dist/shared/components/bulk/bulk-field-options.js +29 -23
  14. package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
  15. package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
  16. package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
  17. package/dist/shared/components/integrations/SendCurrentData.js +126 -0
  18. package/dist/shared/components/item-edit/CatalogPickerField.js +1530 -1437
  19. package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
  20. package/dist/shared/components/item-edit/FieldRow.js +413 -403
  21. package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
  22. package/dist/shared/components/item-edit/M2MCombobox.js +172 -168
  23. package/dist/shared/components/item-edit/MidairCollisionDialog.js +341 -114
  24. package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
  25. package/dist/shared/components/item-edit/PlanGrid.js +783 -724
  26. package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
  27. package/dist/shared/components/item-edit/RecordInsights.js +113 -111
  28. package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
  29. package/dist/shared/components/item-edit/RelationCombobox.js +332 -314
  30. package/dist/shared/components/item-edit/cascade-clear-notice.js +52 -0
  31. package/dist/shared/components/item-edit/collision-format.js +37 -0
  32. package/dist/shared/components/item-edit/field-a11y.js +25 -0
  33. package/dist/shared/components/item-edit/line-merge.js +58 -0
  34. package/dist/shared/components/item-edit/line-midair.js +94 -87
  35. package/dist/shared/components/item-edit/move-guard.js +17 -0
  36. package/dist/shared/components/item-edit/picker-search.js +22 -15
  37. package/dist/shared/components/item-edit/rail-width.js +8 -0
  38. package/dist/shared/components/monitoring/InactiveUserLinksView.js +322 -291
  39. package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
  40. package/dist/shared/components/panels/CommentPanel.js +142 -136
  41. package/dist/shared/components/panels/ItemLockBanner.js +246 -240
  42. package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
  43. package/dist/shared/components/panels/RevisionsPanel.js +106 -102
  44. package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
  45. package/dist/shared/components/panels/SlaClock.js +90 -68
  46. package/dist/shared/components/queue/QueueItemSheet.js +94 -87
  47. package/dist/shared/components/queue/QueueWorklist.js +1502 -1354
  48. package/dist/shared/components/queue/worklist-csv.js +75 -0
  49. package/dist/shared/components/queue/worklist-helpers.js +20 -0
  50. package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
  51. package/dist/shared/lib/bulk-copy.js +17 -0
  52. package/dist/shared/lib/cbv-export.js +122 -0
  53. package/dist/shared/lib/delete-offer.js +13 -0
  54. package/dist/shared/lib/error-hints.js +1 -0
  55. package/dist/shared/lib/leave-guard.js +41 -26
  56. package/dist/shared/lib/list-link.js +72 -56
  57. package/dist/shared/lib/live-queries.js +32 -30
  58. package/dist/shared/lib/moved-notice.js +25 -0
  59. package/dist/shared/lib/notification-target.js +56 -54
  60. package/dist/shared/lib/obligation-banner.js +11 -8
  61. package/dist/shared/lib/obligation-reason-text.js +6 -6
  62. package/dist/shared/lib/sort-cycle.js +6 -0
  63. package/dist/shared/lib/summary-mode.js +59 -41
  64. package/package.json +1 -1
@@ -22,23 +22,23 @@ import { Separator as fe } from "../ui/separator.js";
22
22
  import { Textarea as tt } from "../ui/textarea.js";
23
23
  import { RecordEventPathSheet as nt } from "./IntegrationActivitySection.js";
24
24
  const Ne = ["πŸ‘", "βœ…", "πŸ‘€", "πŸŽ‰", "❀️", "πŸ˜‚"];
25
- function at(t) {
25
+ function rt(t) {
26
26
  var d, c, h, m;
27
27
  return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((m = (h = t.email) == null ? void 0 : h[0]) == null ? void 0 : m.toUpperCase()) || "?";
28
28
  }
29
- function rt({ comment: t }) {
30
- const i = (t.mentions ?? []).filter(
29
+ function at({ comment: t }) {
30
+ const l = (t.mentions ?? []).filter(
31
31
  (d) => {
32
32
  var c;
33
33
  return d.id && String(d.id).toUpperCase() !== String(((c = t.user) == null ? void 0 : c.id) ?? "").toUpperCase();
34
34
  }
35
35
  );
36
- return i.length === 0 ? null : /* @__PURE__ */ e(
36
+ return l.length === 0 ? null : /* @__PURE__ */ e(
37
37
  "p",
38
38
  {
39
39
  className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px]",
40
40
  "data-mention-receipts": !0,
41
- children: i.map((d) => {
41
+ children: l.map((d) => {
42
42
  const c = [d.first_name, d.last_name].filter(Boolean).join(" ") || d.email || "Someone";
43
43
  return /* @__PURE__ */ s(
44
44
  "span",
@@ -58,18 +58,18 @@ function rt({ comment: t }) {
58
58
  }
59
59
  );
60
60
  }
61
- function ae(t) {
61
+ function re(t) {
62
62
  return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
63
63
  }
64
64
  function st({
65
65
  field: t,
66
- label: i,
66
+ label: l,
67
67
  resolved: d,
68
68
  onJump: c
69
69
  }) {
70
70
  const h = /* @__PURE__ */ s(Y, { children: [
71
71
  "on ",
72
- /* @__PURE__ */ e("span", { className: "font-medium", children: i }),
72
+ /* @__PURE__ */ e("span", { className: "font-medium", children: l }),
73
73
  d && /* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-slate-500", children: " Β· resolved" })
74
74
  ] }), m = "inline-flex min-w-0 max-w-[220px] items-center gap-1 truncate rounded-full border border-slate-200 bg-slate-50 px-1.5 py-px text-[10.5px] text-slate-600 dark:border-border dark:bg-muted dark:text-slate-300";
75
75
  return c ? /* @__PURE__ */ e(
@@ -78,22 +78,22 @@ function st({
78
78
  type: "button",
79
79
  "data-comment-field": t,
80
80
  onClick: c,
81
- "data-tip": `Go to ${i}`,
81
+ "data-tip": `Go to ${l}`,
82
82
  className: `${m} transition-colors hover:border-nvr-cyan/50 hover:text-[#0e7490] dark:hover:text-nvr-cyan`,
83
83
  children: h
84
84
  }
85
85
  ) : /* @__PURE__ */ e("span", { "data-comment-field": t, className: m, children: h });
86
86
  }
87
- function ot(t, i) {
88
- const c = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
89
- return c ? { start: i - c[2].length - 1, query: c[2] } : null;
87
+ function ot(t, l) {
88
+ const c = t.slice(0, l).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
89
+ return c ? { start: l - c[2].length - 1, query: c[2] } : null;
90
90
  }
91
91
  function ge(t) {
92
92
  return t.email.split("@")[0];
93
93
  }
94
- function re({
94
+ function ae({
95
95
  value: t,
96
- onChange: i,
96
+ onChange: l,
97
97
  ...d
98
98
  }) {
99
99
  const c = oe(), h = U(null), [m, C] = N(null), [y, w] = N(0), v = Ae((m == null ? void 0 : m.query) ?? "", 200), { data: q = [] } = z({
@@ -113,9 +113,9 @@ function re({
113
113
  staleTime: 5e3
114
114
  }), _ = (n) => {
115
115
  var p;
116
- const l = (p = E == null ? void 0 : E.data) == null ? void 0 : p.find((b) => String(b.user_id).toUpperCase() === n.toUpperCase());
117
- return l ? l.is_idle || l.away ? 1 : 0 : 2;
118
- }, u = [...q].sort((n, l) => _(n.id) - _(l.id)), { data: D = [] } = z({
116
+ const i = (p = E == null ? void 0 : E.data) == null ? void 0 : p.find((b) => String(b.user_id).toUpperCase() === n.toUpperCase());
117
+ return i ? i.is_idle || i.away ? 1 : 0 : 2;
118
+ }, u = [...q].sort((n, i) => _(n.id) - _(i.id)), { data: D = [] } = z({
119
119
  queryKey: ["mention-roles"],
120
120
  queryFn: () => c.request(W("/chat/roles")).then((n) => n.data).catch(() => []),
121
121
  enabled: !!m,
@@ -130,22 +130,22 @@ function re({
130
130
  }
131
131
  const n = h.current.getBoundingClientRect();
132
132
  $({ top: n.bottom + 4, left: n.left, width: Math.min(n.width, 360) });
133
- const l = (b) => {
133
+ const i = (b) => {
134
134
  var g;
135
135
  (g = O.current) != null && g.contains(b.target) || C(null);
136
136
  }, p = () => C(null);
137
- return window.addEventListener("scroll", l, !0), window.addEventListener("resize", p), () => {
138
- window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", p);
137
+ return window.addEventListener("scroll", i, !0), window.addEventListener("resize", p), () => {
138
+ window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", p);
139
139
  };
140
140
  }, [P]);
141
141
  function G(n) {
142
- const l = ot(n.value, n.selectionStart ?? n.value.length);
143
- C(l), l || w(0);
142
+ const i = ot(n.value, n.selectionStart ?? n.value.length);
143
+ C(i), i || w(0);
144
144
  }
145
145
  function T(n) {
146
146
  if (!m || !h.current) return;
147
- const l = h.current.selectionStart ?? t.length, p = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${ge(n)} `, b = t.slice(0, m.start) + p + t.slice(l);
148
- i(b), C(null), w(0);
147
+ const i = h.current.selectionStart ?? t.length, p = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${ge(n)} `, b = t.slice(0, m.start) + p + t.slice(i);
148
+ l(b), C(null), w(0);
149
149
  const g = m.start + p.length;
150
150
  requestAnimationFrame(() => {
151
151
  var j, A;
@@ -155,17 +155,17 @@ function re({
155
155
  function H(n) {
156
156
  if (P)
157
157
  if (n.key === "ArrowDown")
158
- n.preventDefault(), w((l) => (l + 1) % o);
158
+ n.preventDefault(), w((i) => (i + 1) % o);
159
159
  else if (n.key === "ArrowUp")
160
- n.preventDefault(), w((l) => (l - 1 + o) % o);
160
+ n.preventDefault(), w((i) => (i - 1 + o) % o);
161
161
  else if (n.key === "Enter" || n.key === "Tab") {
162
162
  n.preventDefault();
163
- const l = Math.min(y, o - 1), p = k ? 1 : 0, b = p + u.length;
164
- if (k && l === 0) T("__owners__");
165
- else if (l >= b) {
166
- const g = S[l - b];
163
+ const i = Math.min(y, o - 1), p = k ? 1 : 0, b = p + u.length;
164
+ if (k && i === 0) T("__owners__");
165
+ else if (i >= b) {
166
+ const g = S[i - b];
167
167
  g && T({ role: g.name });
168
- } else T(u[l - p]);
168
+ } else T(u[i - p]);
169
169
  } else n.key === "Escape" && (n.preventDefault(), C(null));
170
170
  }
171
171
  return /* @__PURE__ */ s("div", { className: "relative", children: [
@@ -176,7 +176,7 @@ function re({
176
176
  ref: h,
177
177
  value: t,
178
178
  onChange: (n) => {
179
- i(n.target.value), G(n.target);
179
+ l(n.target.value), G(n.target);
180
180
  },
181
181
  onKeyDown: H,
182
182
  onClick: (n) => G(n.currentTarget),
@@ -211,9 +211,9 @@ function re({
211
211
  ]
212
212
  }
213
213
  ),
214
- u.map((n, l) => {
214
+ u.map((n, i) => {
215
215
  var g, j;
216
- const p = k ? l + 1 : l, b = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email;
216
+ const p = k ? i + 1 : i, b = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email;
217
217
  return /* @__PURE__ */ s(
218
218
  "button",
219
219
  {
@@ -255,8 +255,8 @@ function re({
255
255
  n.id
256
256
  );
257
257
  }),
258
- S.map((n, l) => {
259
- const p = u.length + (k ? 1 : 0) + l;
258
+ S.map((n, i) => {
259
+ const p = u.length + (k ? 1 : 0) + i;
260
260
  return /* @__PURE__ */ s(
261
261
  "button",
262
262
  {
@@ -300,14 +300,19 @@ const lt = {
300
300
  people: "People",
301
301
  system: "System",
302
302
  integration: "Integration"
303
- }, it = "integrations:";
304
- function dt({
303
+ };
304
+ function it(t) {
305
+ const l = t.kind === "comment" ? t.comment.text : t.note.text;
306
+ return (t.kind === "comment" ? l.replace(/<[^>]*>/g, " ") : l).replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
307
+ }
308
+ const dt = "integrations:";
309
+ function ct({
305
310
  note: t,
306
- collection: i,
311
+ collection: l,
307
312
  item: d
308
313
  }) {
309
314
  var P;
310
- const c = Le(), [h, m] = N(!1), C = t.source === "external" && !!t.provider && !t.provider.startsWith(it), y = oe(), w = ve(), [v, q] = N(!1), F = L({
315
+ const c = Le(), [h, m] = N(!1), C = t.source === "external" && !!t.provider && !t.provider.startsWith(dt), y = oe(), w = ve(), [v, q] = N(!1), F = L({
311
316
  mutationFn: (o) => y.request(B(`/comments/${t.comment_id}/reactions`, { emoji: o })),
312
317
  onSuccess: () => {
313
318
  q(!1), w.invalidateQueries({ queryKey: ["comments-related"] }), w.invalidateQueries({ queryKey: ["row-comment-counts"] });
@@ -374,7 +379,7 @@ function dt({
374
379
  {
375
380
  activityId: t.inbound.activity_id,
376
381
  callerName: t.label,
377
- collection: i,
382
+ collection: l,
378
383
  itemId: d,
379
384
  align: "end",
380
385
  children: /* @__PURE__ */ e(
@@ -460,7 +465,7 @@ function dt({
460
465
  target: h ? {
461
466
  source: t.provider,
462
467
  id: t.id.replace(/^external:/, ""),
463
- record: { collection: i, item: d }
468
+ record: { collection: l, item: d }
464
469
  } : null,
465
470
  event: { label: t.label },
466
471
  onClose: () => m(!1)
@@ -468,9 +473,9 @@ function dt({
468
473
  )
469
474
  ] });
470
475
  }
471
- function Ft({
476
+ function Rt({
472
477
  collection: t,
473
- item: i,
478
+ item: l,
474
479
  title: d,
475
480
  defaultExpanded: c,
476
481
  queuedComments: h,
@@ -483,90 +488,90 @@ function Ft({
483
488
  }, [c]);
484
489
  const [u, D] = N(""), S = U(C);
485
490
  S.current = C, Q(() => {
486
- var a;
487
- (a = S.current) == null || a.call(S, u);
491
+ var r;
492
+ (r = S.current) == null || r.call(S, u);
488
493
  }, [u]);
489
494
  const [k, P] = N(!1), o = async () => {
490
- var a;
495
+ var r;
491
496
  if (!(!u.trim() || k)) {
492
497
  P(!0);
493
498
  try {
494
- const r = await y.request(
499
+ const a = await y.request(
495
500
  B("/ai/cleanup", { text: u })
496
501
  );
497
- (a = r.data) != null && a.text && D(r.data.text);
502
+ (r = a.data) != null && r.text && D(a.data.text);
498
503
  } catch {
499
504
  } finally {
500
505
  P(!1);
501
506
  }
502
507
  }
503
- }, f = ze(t, i, "note"), $ = Ue(t, i, "note"), O = U(0);
508
+ }, f = ze(t, l, "note"), $ = Ue(t, l, "note"), O = U(0);
504
509
  Q(() => {
505
510
  if (!u.trim()) {
506
511
  O.current && $("stop"), O.current = 0;
507
512
  return;
508
513
  }
509
- const a = Date.now();
510
- a - O.current < 2500 || (O.current = a, $("start"));
514
+ const r = Date.now();
515
+ r - O.current < 2500 || (O.current = r, $("start"));
511
516
  }, [u, $]), Q(() => () => $("stop"), [$]);
512
- const [G, T] = N(null), [H, n] = N(null), [l, p] = N(""), b = !i || i === "new", g = ["comments", t, String(i)], { data: j, isLoading: A, isError: we } = z({
517
+ const [G, T] = N(null), [H, n] = N(null), [i, p] = N(""), b = !l || l === "new", g = ["comments", t, String(l)], { data: j, isLoading: A, isError: we } = z({
513
518
  queryKey: g,
514
- queryFn: () => y.request(W("/comments", { collection: t, item: i })).then((a) => a.data),
519
+ queryFn: () => y.request(W("/comments", { collection: t, item: l })).then((r) => r.data),
515
520
  enabled: !b
516
- }), ie = V(() => (j ?? []).filter((a) => !a.deleted), [j]), { data: _e } = z({
517
- queryKey: ["comments-related", t, String(i)],
518
- queryFn: () => y.request(W("/comments/related", { collection: t, item: i })).then((a) => a.data ?? []).catch(() => []),
521
+ }), ie = V(() => (j ?? []).filter((r) => !r.deleted), [j]), { data: _e } = z({
522
+ queryKey: ["comments-related", t, String(l)],
523
+ queryFn: () => y.request(W("/comments/related", { collection: t, item: l })).then((r) => r.data ?? []).catch(() => []),
519
524
  enabled: !b,
520
525
  staleTime: 3e4
521
526
  }), de = _e ?? [], R = V(() => {
522
- const a = ie.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), r = de.map((x) => ({ kind: "related", at: x.created_at, note: x }));
523
- return [...a, ...r].sort((x, K) => new Date(K.at).getTime() - new Date(x.at).getTime());
527
+ const r = ie.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), a = de.map((x) => ({ kind: "related", at: x.created_at, note: x }));
528
+ return [...r, ...a].sort((x, K) => new Date(K.at).getTime() - new Date(x.at).getTime());
524
529
  }, [ie, de]), [X, Ce] = N(() => /* @__PURE__ */ new Set()), [J, Se] = N(""), ce = V(() => {
525
- const a = { people: 0, system: 0, integration: 0 };
526
- for (const r of R) a[ye(r)]++;
527
- return a;
530
+ const r = { people: 0, system: 0, integration: 0 };
531
+ for (const a of R) r[ye(a)]++;
532
+ return r;
528
533
  }, [R]), me = b ? (h ?? []).length : ce.people, ee = V(() => {
529
- const a = J.trim().toLowerCase();
530
- return R.filter((r) => X.has(ye(r)) ? !1 : a ? (r.kind === "comment" ? `${r.comment.text} ${ae(r.comment.user)}` : `${r.note.text} ${r.note.user_name ?? ""} ${r.note.label} ${r.note.context ?? ""} ${r.note.provider ?? ""}`).toLowerCase().includes(a) : !0);
531
- }, [R, X, J]), $e = (a) => Ce((r) => {
532
- const x = new Set(r);
533
- return x.has(a) ? x.delete(a) : x.add(a), x;
534
+ const r = J.trim().toLowerCase();
535
+ return R.filter((a) => X.has(ye(a)) ? !1 : r ? (a.kind === "comment" ? `${a.comment.text} ${re(a.comment.user)}` : `${a.note.text} ${a.note.user_name ?? ""} ${a.note.label} ${a.note.context ?? ""} ${a.note.provider ?? ""}`).toLowerCase().includes(r) : !0);
536
+ }, [R, X, J]), $e = (r) => Ce((a) => {
537
+ const x = new Set(a);
538
+ return x.has(r) ? x.delete(r) : x.add(r), x;
534
539
  }), qe = X.size > 0 || J.trim() !== "", te = L({
535
- mutationFn: (a) => y.request(B("/comments", { collection: t, item: i, text: a })),
540
+ mutationFn: (r) => y.request(B("/comments", { collection: t, item: l, text: r })),
536
541
  onSuccess: () => {
537
542
  v.invalidateQueries({ queryKey: g }), D("");
538
543
  },
539
544
  onError: () => I.error("Failed to post comment")
540
545
  }), ue = L({
541
- mutationFn: ({ id: a, text: r }) => y.request(Ke(`/comments/${a}`, { text: r })),
546
+ mutationFn: ({ id: r, text: a }) => y.request(Ke(`/comments/${r}`, { text: a })),
542
547
  onSuccess: () => {
543
548
  v.invalidateQueries({ queryKey: g }), T(null), p("");
544
549
  },
545
550
  onError: () => I.error("Failed to update comment")
546
551
  }), ne = L({
547
- mutationFn: (a) => y.request(Be(`/comments/${a}`)),
552
+ mutationFn: (r) => y.request(Be(`/comments/${r}`)),
548
553
  onSuccess: () => v.invalidateQueries({ queryKey: g }),
549
554
  onError: () => I.error("Failed to delete comment")
550
555
  }), pe = L({
551
- mutationFn: ({ id: a, emoji: r }) => y.request(B(`/comments/${a}/reactions`, { emoji: r })),
556
+ mutationFn: ({ id: r, emoji: a }) => y.request(B(`/comments/${r}/reactions`, { emoji: a })),
552
557
  onSuccess: () => v.invalidateQueries({ queryKey: g }),
553
558
  onError: () => I.error("Failed to react")
554
559
  }), [xe, he] = N(null), Ee = L({
555
- mutationFn: (a) => y.request(
560
+ mutationFn: (r) => y.request(
556
561
  B("/tasks", {
557
562
  collection: t,
558
- item: i,
559
- title: a.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
563
+ item: l,
564
+ title: r.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
560
565
  assignee: w
561
566
  })
562
567
  ),
563
568
  onSuccess: () => {
564
- Ge(v, t, i), I.success("Task created from comment β€” assigned to you");
569
+ Ge(v, t, l), I.success("Task created from comment β€” assigned to you");
565
570
  },
566
571
  onError: () => I.error("Could not create a task")
567
572
  });
568
- function be(a) {
569
- a.preventDefault(), u.trim() && (b && m ? (m(u.trim()), D("")) : te.mutate(u.trim()));
573
+ function be(r) {
574
+ r.preventDefault(), u.trim() && (b && m ? (m(u.trim()), D("")) : te.mutate(u.trim()));
570
575
  }
571
576
  return (
572
577
  // Addressable from elsewhere (the summary panel jumps here), which needs
@@ -583,7 +588,7 @@ function Ft({
583
588
  {
584
589
  type: "button",
585
590
  "data-panel-toggle": "notes",
586
- onClick: () => E((a) => !a),
591
+ onClick: () => E((r) => !r),
587
592
  className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
588
593
  children: [
589
594
  /* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
@@ -605,10 +610,10 @@ function Ft({
605
610
  )
606
611
  ] }),
607
612
  !F && !b && R.length > 0 && (() => {
608
- const a = R[0], r = a.kind === "comment" ? ae(a.comment.user) : a.note.user_name ?? "System", x = (a.kind === "comment" ? a.comment.text : a.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
613
+ const r = R[0], a = r.kind === "comment" ? re(r.comment.user) : r.note.user_name ?? "System", x = it(r);
609
614
  return x ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
610
615
  /* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
611
- r,
616
+ a,
612
617
  ":"
613
618
  ] }),
614
619
  " ",
@@ -621,7 +626,7 @@ function Ft({
621
626
  F && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: b ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
622
627
  /* @__PURE__ */ s("form", { onSubmit: be, className: "space-y-2", children: [
623
628
  /* @__PURE__ */ e(
624
- re,
629
+ ae,
625
630
  {
626
631
  value: u,
627
632
  onChange: D,
@@ -637,22 +642,22 @@ function Ft({
637
642
  ] }),
638
643
  (h ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
639
644
  /* @__PURE__ */ e(fe, {}),
640
- (h ?? []).map((a, r) => /* @__PURE__ */ s(
645
+ (h ?? []).map((r, a) => /* @__PURE__ */ s(
641
646
  "div",
642
647
  {
643
648
  className: "flex items-start gap-2.5 rounded-lg border border-dashed border-amber-200/70 bg-amber-50/40 px-3 py-2 dark:border-amber-500/20 dark:bg-amber-500/5",
644
649
  children: [
645
650
  /* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
646
- /* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: a })
651
+ /* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: r })
647
652
  ]
648
653
  },
649
- r
654
+ a
650
655
  ))
651
656
  ] })
652
657
  ] }) : /* @__PURE__ */ s(Y, { children: [
653
658
  /* @__PURE__ */ s("form", { onSubmit: be, className: "space-y-2", children: [
654
659
  /* @__PURE__ */ e(
655
- re,
660
+ ae,
656
661
  {
657
662
  value: u,
658
663
  onChange: D,
@@ -693,31 +698,31 @@ function Ft({
693
698
  ),
694
699
  /* @__PURE__ */ e(fe, { className: "my-4" }),
695
700
  R.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
696
- ["people", "system", "integration"].map((a) => {
697
- const r = !X.has(a), x = ce[a];
701
+ ["people", "system", "integration"].map((r) => {
702
+ const a = !X.has(r), x = ce[r];
698
703
  return /* @__PURE__ */ s(
699
704
  "button",
700
705
  {
701
706
  type: "button",
702
- onClick: () => $e(a),
703
- "aria-pressed": r,
704
- "data-notes-filter": a,
705
- disabled: x === 0 && r,
706
- className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${r ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
707
- title: a === "people" ? "Comments and notes people wrote" : a === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
707
+ onClick: () => $e(r),
708
+ "aria-pressed": a,
709
+ "data-notes-filter": r,
710
+ disabled: x === 0 && a,
711
+ className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${a ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
712
+ title: r === "people" ? "Comments and notes people wrote" : r === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
708
713
  children: [
709
- lt[a],
714
+ lt[r],
710
715
  /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: x })
711
716
  ]
712
717
  },
713
- a
718
+ r
714
719
  );
715
720
  }),
716
721
  /* @__PURE__ */ e(
717
722
  "input",
718
723
  {
719
724
  value: J,
720
- onChange: (a) => Se(a.target.value),
725
+ onChange: (r) => Se(r.target.value),
721
726
  placeholder: "Search notes…",
722
727
  "aria-label": "Search notes",
723
728
  "data-notes-search": !0,
@@ -730,51 +735,51 @@ function Ft({
730
735
  R.length
731
736
  ] })
732
737
  ] }),
733
- A ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((a) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
738
+ A ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((r) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
734
739
  /* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
735
740
  /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
736
741
  /* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
737
742
  /* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
738
743
  ] })
739
- ] }, a)) }) : we ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : R.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : ee.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match β€” clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: ee.map((a) => {
740
- if (a.kind === "related")
744
+ ] }, r)) }) : we ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : R.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : ee.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match β€” clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: ee.map((r) => {
745
+ if (r.kind === "related")
741
746
  return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
742
- dt,
747
+ ct,
743
748
  {
744
- note: a.note,
749
+ note: r.note,
745
750
  collection: t,
746
- item: String(i)
751
+ item: String(l)
747
752
  }
748
- ) }, a.note.id);
749
- const r = a.comment, x = w === r.user.id, K = G === r.id;
753
+ ) }, r.note.id);
754
+ const a = r.comment, x = w === a.user.id, K = G === a.id;
750
755
  return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
751
756
  /* @__PURE__ */ e(
752
757
  Ze,
753
758
  {
754
- userId: r.user.id,
759
+ userId: a.user.id,
755
760
  className: "h-8 w-8",
756
- fallback: /* @__PURE__ */ e(Ye, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(et, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: at(r.user) }) })
761
+ fallback: /* @__PURE__ */ e(Ye, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(et, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: rt(a.user) }) })
757
762
  }
758
763
  ),
759
764
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
760
765
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
761
- /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ae(r.user) }),
762
- /* @__PURE__ */ e(Xe, { label: r.via_agent }),
763
- /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(r.created_at) }),
764
- r.updated_at && r.updated_at !== r.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
765
- r.field && /* @__PURE__ */ e(
766
+ /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: re(a.user) }),
767
+ /* @__PURE__ */ e(Xe, { label: a.via_agent }),
768
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(a.created_at) }),
769
+ a.updated_at && a.updated_at !== a.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
770
+ a.field && /* @__PURE__ */ e(
766
771
  st,
767
772
  {
768
- field: r.field,
769
- label: (q == null ? void 0 : q.labelOf(r.field)) ?? He(r.field),
770
- resolved: !!r.resolved_at,
771
- onJump: q ? () => q.jump(r.field) : void 0
773
+ field: a.field,
774
+ label: (q == null ? void 0 : q.labelOf(a.field)) ?? He(a.field),
775
+ resolved: !!a.resolved_at,
776
+ onJump: q ? () => q.jump(a.field) : void 0
772
777
  }
773
778
  ),
774
779
  !K && /* @__PURE__ */ s(
775
780
  "div",
776
781
  {
777
- className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${H === r.id ? "opacity-100" : "opacity-0"}`,
782
+ className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${H === a.id ? "opacity-100" : "opacity-0"}`,
778
783
  children: [
779
784
  /* @__PURE__ */ e(
780
785
  "button",
@@ -783,20 +788,20 @@ function Ft({
783
788
  title: "Make a task from this comment",
784
789
  "aria-label": "Make a task from this comment",
785
790
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
786
- onClick: () => Ee.mutate(r),
791
+ onClick: () => Ee.mutate(a),
787
792
  children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
788
793
  }
789
794
  ),
790
- x && (H === r.id ? /* @__PURE__ */ s(Y, { children: [
795
+ x && (H === a.id ? /* @__PURE__ */ s(Y, { children: [
791
796
  /* @__PURE__ */ e(
792
797
  "button",
793
798
  {
794
799
  type: "button",
795
800
  autoFocus: !0,
796
801
  disabled: ne.isPending,
797
- "data-comment-delete-confirm": r.id,
802
+ "data-comment-delete-confirm": a.id,
798
803
  className: "rounded bg-red-600 px-1.5 py-px text-[10.5px] font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-60",
799
- onClick: () => ne.mutate(r.id, {
804
+ onClick: () => ne.mutate(a.id, {
800
805
  onSettled: () => n(null)
801
806
  }),
802
807
  children: ne.isPending ? "Deleting…" : "Delete comment?"
@@ -820,7 +825,7 @@ function Ft({
820
825
  "aria-label": "Edit comment",
821
826
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
822
827
  onClick: () => {
823
- T(r.id), p(r.text);
828
+ T(a.id), p(a.text);
824
829
  },
825
830
  children: /* @__PURE__ */ e(Fe, { className: "h-3 w-3" })
826
831
  }
@@ -832,7 +837,7 @@ function Ft({
832
837
  title: "Delete comment",
833
838
  "aria-label": "Delete comment",
834
839
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
835
- onClick: () => n(r.id),
840
+ onClick: () => n(a.id),
836
841
  children: /* @__PURE__ */ e(Re, { className: "h-3 w-3" })
837
842
  }
838
843
  )
@@ -843,9 +848,9 @@ function Ft({
843
848
  ] }),
844
849
  K ? /* @__PURE__ */ s("div", { className: "mt-1.5 space-y-2", children: [
845
850
  /* @__PURE__ */ e(
846
- re,
851
+ ae,
847
852
  {
848
- value: l,
853
+ value: i,
849
854
  onChange: p,
850
855
  rows: 3,
851
856
  className: "text-[13px]"
@@ -857,8 +862,8 @@ function Ft({
857
862
  {
858
863
  size: "sm",
859
864
  className: "h-7 gap-1.5",
860
- disabled: !l.trim() || ue.isPending,
861
- onClick: () => ue.mutate({ id: r.id, text: l.trim() }),
865
+ disabled: !i.trim() || ue.isPending,
866
+ onClick: () => ue.mutate({ id: a.id, text: i.trim() }),
862
867
  children: [
863
868
  /* @__PURE__ */ e(Me, { className: "h-3 w-3" }),
864
869
  " Save"
@@ -881,14 +886,14 @@ function Ft({
881
886
  }
882
887
  )
883
888
  ] })
884
- ] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(se, { text: r.text }) }),
885
- !K && /* @__PURE__ */ e(rt, { comment: r }),
889
+ ] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(se, { text: a.text }) }),
890
+ !K && /* @__PURE__ */ e(at, { comment: a }),
886
891
  !K && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
887
- (r.reactions ?? []).map((M) => /* @__PURE__ */ s(
892
+ (a.reactions ?? []).map((M) => /* @__PURE__ */ s(
888
893
  "button",
889
894
  {
890
895
  type: "button",
891
- onClick: () => pe.mutate({ id: r.id, emoji: M.emoji }),
896
+ onClick: () => pe.mutate({ id: a.id, emoji: M.emoji }),
892
897
  className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${M.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
893
898
  children: [
894
899
  M.emoji,
@@ -902,18 +907,18 @@ function Ft({
902
907
  "button",
903
908
  {
904
909
  type: "button",
905
- onClick: () => he(xe === r.id ? null : r.id),
910
+ onClick: () => he(xe === a.id ? null : a.id),
906
911
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
907
912
  "aria-label": "Add reaction",
908
913
  children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
909
914
  }
910
915
  ),
911
- xe === r.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: Ne.map((M) => /* @__PURE__ */ e(
916
+ xe === a.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: Ne.map((M) => /* @__PURE__ */ e(
912
917
  "button",
913
918
  {
914
919
  type: "button",
915
920
  onClick: () => {
916
- pe.mutate({ id: r.id, emoji: M }), he(null);
921
+ pe.mutate({ id: a.id, emoji: M }), he(null);
917
922
  },
918
923
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
919
924
  children: M
@@ -923,7 +928,7 @@ function Ft({
923
928
  ] })
924
929
  ] })
925
930
  ] })
926
- ] }, r.id);
931
+ ] }, a.id);
927
932
  }) })
928
933
  ] }) })
929
934
  ]
@@ -932,6 +937,7 @@ function Ft({
932
937
  );
933
938
  }
934
939
  export {
935
- Ft as CommentPanel,
936
- re as MentionTextarea
940
+ Rt as CommentPanel,
941
+ ae as MentionTextarea,
942
+ it as notePreviewText
937
943
  };