@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,244 +1,278 @@
1
- import { jsxs as o, jsx as d } from "react/jsx-runtime";
2
- import { useQueryClient as E, useQuery as L, useMutation as $ } from "@tanstack/react-query";
3
- import { CalendarCheck as K, CalendarX as Q, Loader2 as V, CalendarClock as j } from "lucide-react";
4
- import { useMemo as R, useState as O, useId as B } from "react";
5
- import { useNivaroClient as F } from "../../context.js";
6
- import { get as H, del as W, patch as X, post as Y } from "../../lib/commands.js";
1
+ import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
+ import { useQueryClient as F, useQuery as L, useMutation as S } from "@tanstack/react-query";
3
+ import { CalendarCheck as B, CalendarX as H, Loader2 as K, CalendarClock as Q, AlertCircle as V } from "lucide-react";
4
+ import { useMemo as P, useState as O, useId as j } from "react";
5
+ import { useNivaroClient as M } from "../../context.js";
6
+ import { get as W, del as G, patch as X, post as Y } from "../../lib/commands.js";
7
7
  import { useDeadlineNow as z } from "../../lib/deadline-ticker.js";
8
- import { toastError as S } from "../../lib/error-toast.js";
9
- import { useLiveRecord as G, batchTouches as J, LIVE_ASPECTS as Z } from "../../lib/live.js";
10
- import { readableRecent as w, chipOf as ee, whenText as g, countdownPart as N, fullSentence as te, changeSentence as ae, isDue as ne } from "../../lib/scheduled-countdown.js";
11
- import { cn as P, titleCase as de } from "../../lib/utils.js";
12
- import { ConfirmButton as D } from "../profile/primitives.js";
13
- import { Input as re } from "../ui/input.js";
14
- import { Popover as se, PopoverTrigger as le, PopoverContent as ie } from "../ui/popover.js";
15
- import { formatDisplayValue as oe } from "./GroupSection.js";
16
- function ce(e, t) {
8
+ import { toastError as T } from "../../lib/error-toast.js";
9
+ import { useLiveRecord as J, batchTouches as Z, LIVE_ASPECTS as ee } from "../../lib/live.js";
10
+ import { readableRecent as te, chipOf as ae, whenText as b, countdownPart as _, fullSentence as ne, changeSentence as re, isDue as de } from "../../lib/scheduled-countdown.js";
11
+ import { cn as R, titleCase as se } from "../../lib/utils.js";
12
+ import { ConfirmButton as I } from "../profile/primitives.js";
13
+ import { Input as ie } from "../ui/input.js";
14
+ import { Popover as le, PopoverTrigger as oe, PopoverContent as ce } from "../ui/popover.js";
15
+ import { formatDisplayValue as ue } from "./GroupSection.js";
16
+ function me(e, t) {
17
17
  return ["scheduled-changes", e, t, "recent"];
18
18
  }
19
- function ue(e) {
19
+ function A(e) {
20
20
  const t = new Date(e);
21
21
  if (Number.isNaN(t.getTime())) return "";
22
- const n = (l) => String(l).padStart(2, "0");
23
- return `${t.getFullYear()}-${n(t.getMonth() + 1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`;
22
+ const r = (i) => String(i).padStart(2, "0");
23
+ return `${t.getFullYear()}-${r(t.getMonth() + 1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`;
24
24
  }
25
- const me = {
25
+ function pe() {
26
+ const e = new Date(Date.now() + 18e5);
27
+ return e.setMinutes(0, 0, 0), e.setHours(e.getHours() + 1), e.toISOString();
28
+ }
29
+ const he = {
26
30
  pending: "border-slate-200 bg-slate-50 text-slate-600 hover:bg-slate-100 dark:border-border dark:bg-muted dark:text-slate-300 dark:hover:bg-muted/70",
27
31
  applying: "border-sky-200 bg-sky-50 text-sky-800 hover:bg-sky-100 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300 dark:hover:bg-sky-500/15",
28
32
  "waiting-admin": "border-amber-200 bg-amber-50 text-amber-800 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 dark:hover:bg-amber-500/15",
29
33
  applied: "border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400 dark:hover:bg-emerald-500/15",
30
34
  failed: "border-red-200 bg-red-50 text-red-700 hover:bg-red-100 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400 dark:hover:bg-red-500/15"
31
35
  };
32
- function qe({
36
+ function Ae({
33
37
  collection: e,
34
38
  itemId: t,
35
- fields: n,
36
- relations: l
39
+ fields: r,
40
+ relations: i
37
41
  }) {
38
- const u = F(), h = E(), b = ce(e, t), { data: x } = L({
39
- queryKey: b,
40
- queryFn: () => u.request(
41
- H(`/scheduled-changes/${e}/${encodeURIComponent(t)}`, {
42
+ const m = M(), g = F(), k = me(e, t), { data: x } = L({
43
+ queryKey: k,
44
+ queryFn: () => m.request(
45
+ W(`/scheduled-changes/${e}/${encodeURIComponent(t)}`, {
42
46
  status: "recent"
43
47
  })
44
48
  ).then((a) => a.data ?? []).catch(() => []),
45
49
  staleTime: 6e4
46
50
  });
47
- G(
51
+ J(
48
52
  e,
49
53
  t,
50
54
  (a) => {
51
- J(a, Z.scheduled) && h.invalidateQueries({ queryKey: b });
55
+ Z(a, ee.scheduled) && g.invalidateQueries({ queryKey: k });
52
56
  },
53
57
  { includeOwn: !0, debounceMs: 300 }
54
58
  );
55
- const c = R(() => w(x, n), [x, n]), m = z(c.length > 0), [f, k] = O(!1), y = R(() => new Map((n ?? []).map((a) => [a.field, a])), [n]), v = (a) => (l ?? []).some(
56
- (p) => p.many_collection === e && p.many_field === a && !p.junction_field
57
- ), _ = (a) => {
58
- var p;
59
- return ((p = y.get(a)) == null ? void 0 : p.label) || de(a.replace(/_/g, " "));
60
- }, C = (a, p) => v(a) ? "a new value" : oe(p, y.get(a)), r = (a) => ae(a.changes ?? {}, _, C), q = ee(c, m);
61
- if (!q) return null;
62
- const { kind: s, row: i } = q, M = c.filter((a) => a.status === "pending" || a.status === "applying").length, I = s === "pending" || s === "applying" ? M - 1 : 0, U = s === "applied" ? K : s === "failed" ? Q : s === "applying" ? V : j, A = s === "pending" ? `${r(i)} · Applies at ${g(i.scheduled_at, m)} (${N(i.scheduled_at, m)})` : s === "applying" ? `${r(i)} · Applying now…` : s === "waiting-admin" ? `${r(i)} · ${N(i.scheduled_at, m)}, waiting for an administrator` : s === "applied" ? `Applied: ${r(i)}` : `Failed — ${i.error_message || "not applied"}`;
63
- return /* @__PURE__ */ o(se, { open: f, onOpenChange: k, children: [
64
- /* @__PURE__ */ d(le, { asChild: !0, children: /* @__PURE__ */ o(
59
+ const u = P(() => te(x, r), [x, r]), p = z(u.length > 0), [c, f] = O(!1), y = P(() => new Map((r ?? []).map((a) => [a.field, a])), [r]), v = (a) => (i ?? []).some(
60
+ (h) => h.many_collection === e && h.many_field === a && !h.junction_field
61
+ ), C = (a) => {
62
+ var h;
63
+ return ((h = y.get(a)) == null ? void 0 : h.label) || se(a.replace(/_/g, " "));
64
+ }, $ = (a, h) => v(a) ? "a new value" : ue(h, y.get(a)), d = (a) => re(a.changes ?? {}, C, $), w = ae(u, p);
65
+ if (!w) return null;
66
+ const { kind: s, row: o } = w, U = u.filter((a) => a.status === "pending" || a.status === "applying").length, D = s === "pending" || s === "applying" ? U - 1 : 0, q = s === "applied" ? B : s === "failed" ? H : s === "applying" ? K : Q, E = s === "pending" ? `${d(o)} · Applies at ${b(o.scheduled_at, p)} (${_(o.scheduled_at, p)})` : s === "applying" ? `${d(o)} · Applying now…` : s === "waiting-admin" ? `${d(o)} · ${_(o.scheduled_at, p)}, waiting for an administrator` : s === "applied" ? `Applied: ${d(o)}` : (
67
+ // One word for this state in the chip and the popover: "Not applied".
68
+ `Not applied: ${d(o)}`
69
+ );
70
+ return /* @__PURE__ */ l(le, { open: c, onOpenChange: f, children: [
71
+ /* @__PURE__ */ n(oe, { asChild: !0, children: /* @__PURE__ */ l(
65
72
  "button",
66
73
  {
67
74
  type: "button",
68
75
  "data-scheduled-chip": !0,
69
76
  "data-kind": s,
70
77
  "aria-live": "polite",
71
- "data-tip": s === "pending" ? te(r(i), g(i.scheduled_at, m), i.created_by_name) : s === "failed" ? `${r(i)} — not applied: ${i.error_message ?? ""}` : void 0,
72
- className: P(
73
- "inline-flex max-w-[360px] items-center gap-1 rounded-full border px-1.5 py-px text-[9.5px] font-medium transition-colors duration-300",
74
- me[s]
78
+ "data-tip": s === "pending" ? ne(d(o), b(o.scheduled_at, p), o.created_by_name) : s === "failed" ? `${d(o)} — not applied: ${o.error_message ?? ""}` : void 0,
79
+ className: R(
80
+ "inline-flex max-w-full items-start gap-1 rounded-[9px] border px-1.5 py-px text-left text-[9.5px] font-medium leading-[14px] transition-colors duration-300 sm:max-w-[420px]",
81
+ he[s]
75
82
  ),
76
83
  children: [
77
- /* @__PURE__ */ d(
78
- U,
84
+ /* @__PURE__ */ n(
85
+ q,
79
86
  {
80
87
  "aria-hidden": !0,
81
- className: P(
82
- "h-2.5 w-2.5 shrink-0",
88
+ className: R(
89
+ "mt-[2px] h-2.5 w-2.5 shrink-0",
83
90
  s === "pending" && "text-nvr-cyan",
84
91
  s === "applying" && "motion-safe:animate-spin"
85
92
  )
86
93
  }
87
94
  ),
88
- /* @__PURE__ */ d("span", { className: "truncate tabular-nums", children: A }),
89
- I > 0 && /* @__PURE__ */ o("span", { className: "shrink-0 opacity-70", children: [
95
+ /* @__PURE__ */ n("span", { className: "min-w-0 tabular-nums [overflow-wrap:anywhere]", children: E }),
96
+ D > 0 && /* @__PURE__ */ l("span", { className: "shrink-0 opacity-70", children: [
90
97
  "+",
91
- I
98
+ D
92
99
  ] })
93
100
  ]
94
101
  }
95
102
  ) }),
96
- /* @__PURE__ */ o(ie, { align: "start", className: "w-[340px] p-0", "data-scheduled-panel": !0, children: [
97
- /* @__PURE__ */ d("div", { className: "border-b border-slate-100 px-3 py-2 dark:border-border", children: /* @__PURE__ */ d("p", { className: "text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: c.length === 1 ? "Scheduled change" : `${c.length} scheduled changes` }) }),
98
- /* @__PURE__ */ d("ul", { className: "max-h-[320px] divide-y divide-slate-100 overflow-y-auto dark:divide-border", children: c.map((a) => /* @__PURE__ */ d(
99
- he,
100
- {
101
- row: a,
102
- now: m,
103
- sentence: r(a),
104
- onChanged: () => void h.invalidateQueries({ queryKey: b })
105
- },
106
- a.id
107
- )) })
108
- ] })
103
+ /* @__PURE__ */ l(
104
+ ce,
105
+ {
106
+ align: "start",
107
+ collisionPadding: 16,
108
+ className: "w-[min(340px,calc(100vw-2rem))] p-0",
109
+ "data-scheduled-panel": !0,
110
+ children: [
111
+ /* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-3 py-2 dark:border-border", children: /* @__PURE__ */ n("p", { className: "text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: u.length === 1 ? "Scheduled change" : `${u.length} scheduled changes` }) }),
112
+ /* @__PURE__ */ n("ul", { className: "max-h-[320px] divide-y divide-slate-100 overflow-y-auto dark:divide-border", children: u.map((a) => /* @__PURE__ */ n(
113
+ fe,
114
+ {
115
+ row: a,
116
+ now: p,
117
+ sentence: d(a),
118
+ onChanged: () => void g.invalidateQueries({ queryKey: k })
119
+ },
120
+ a.id
121
+ )) })
122
+ ]
123
+ }
124
+ )
109
125
  ] });
110
126
  }
111
- function pe({ row: e, now: t }) {
112
- const n = e.status ?? "pending", l = e.executed_at ? g(e.executed_at, t) : null;
113
- if (n === "pending" || n === "applying") {
114
- const u = ne(e.scheduled_at, t), h = n === "applying" || u && e.auto_apply !== !1 ? `${g(e.scheduled_at, t)} · applying now…` : u ? `${g(e.scheduled_at, t)} · ${N(e.scheduled_at, t)} — waiting for an administrator` : `Applies at ${g(e.scheduled_at, t)} · ${N(e.scheduled_at, t)}`;
115
- return /* @__PURE__ */ d(
127
+ function ge({ row: e, now: t }) {
128
+ const r = e.status ?? "pending", i = e.executed_at ? b(e.executed_at, t) : null;
129
+ if (r === "pending" || r === "applying") {
130
+ const m = de(e.scheduled_at, t), g = r === "applying" || m && e.auto_apply !== !1 ? `${b(e.scheduled_at, t)} · applying now…` : m ? `${b(e.scheduled_at, t)} · ${_(e.scheduled_at, t)} — waiting for an administrator` : `Applies at ${b(e.scheduled_at, t)} · ${_(e.scheduled_at, t)}`;
131
+ return /* @__PURE__ */ n(
116
132
  "p",
117
133
  {
118
- className: P(
134
+ className: R(
119
135
  "mt-0.5 text-[11.5px] tabular-nums",
120
- u && e.auto_apply === !1 ? "text-amber-700 dark:text-amber-300" : "text-slate-500 dark:text-slate-400"
136
+ m && e.auto_apply === !1 ? "text-amber-700 dark:text-amber-300" : "text-slate-500 dark:text-slate-400"
121
137
  ),
122
- children: h
138
+ children: g
123
139
  }
124
140
  );
125
141
  }
126
- return n === "executed" ? /* @__PURE__ */ o("p", { className: "mt-0.5 text-[11.5px] tabular-nums text-emerald-700 dark:text-emerald-400", children: [
142
+ return r === "executed" ? /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11.5px] tabular-nums text-emerald-700 dark:text-emerald-400", children: [
127
143
  "Applied",
128
- l ? ` at ${l}` : "",
144
+ i ? ` at ${i}` : "",
129
145
  e.applied_on_time === !1 ? " by an administrator" : ""
130
- ] }) : n === "failed" ? /* @__PURE__ */ o("p", { className: "mt-0.5 text-[11.5px] text-red-700 dark:text-red-400", children: [
131
- "Not applied",
132
- l ? ` (${l})` : "",
133
- ": ",
134
- e.error_message || "it was refused",
135
- ". Nothing on the record was changed."
136
- ] }) : /* @__PURE__ */ o("p", { className: "mt-0.5 text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400", children: [
146
+ ] }) : r === "failed" ? /* @__PURE__ */ l("div", { className: "mt-1 flex items-start gap-1.5 text-[11.5px] leading-snug", children: [
147
+ /* @__PURE__ */ n(V, { "aria-hidden": !0, className: "mt-px h-3.5 w-3.5 shrink-0 text-red-500" }),
148
+ /* @__PURE__ */ l("p", { className: "text-slate-600 dark:text-slate-300", children: [
149
+ /* @__PURE__ */ n("span", { className: "font-medium text-red-700 dark:text-red-400", children: "Not applied" }),
150
+ i ? ` (${i})` : "",
151
+ " — ",
152
+ e.error_message || "it was refused",
153
+ ". Nothing on the record was changed."
154
+ ] })
155
+ ] }) : /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400", children: [
137
156
  "Undone",
138
- l ? ` at ${l}` : ""
157
+ i ? ` at ${i}` : ""
139
158
  ] });
140
159
  }
141
- const T = "rounded px-1.5 py-0.5 text-[11.5px] font-medium text-slate-600 hover:bg-muted dark:text-slate-300";
142
- function he({
160
+ const N = "inline-flex h-7 items-center rounded-md border border-slate-200 bg-white px-2.5 text-[11.5px] font-medium text-slate-700 transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-50 dark:border-border dark:bg-transparent dark:text-slate-200 dark:hover:bg-muted", be = "inline-flex h-7 items-center rounded-md border border-red-200 bg-white px-2.5 text-[11.5px] font-medium text-red-700 transition-colors hover:bg-red-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-400 disabled:opacity-50 dark:border-red-500/40 dark:bg-transparent dark:text-red-400 dark:hover:bg-red-500/10", xe = "inline-flex h-7 items-center rounded-md border border-red-600 bg-red-600 px-2.5 text-[11.5px] font-medium text-white transition-colors hover:bg-red-700 dark:border-red-500 dark:bg-red-500/90";
161
+ function fe({
143
162
  row: e,
144
163
  now: t,
145
- sentence: n,
146
- onChanged: l
164
+ sentence: r,
165
+ onChanged: i
147
166
  }) {
148
- const u = F(), h = B(), [b, x] = O(!1), [c, m] = O(() => ue(e.scheduled_at)), f = e.status ?? "pending", k = $({
149
- mutationFn: () => u.request(W(`/scheduled-changes/${encodeURIComponent(e.id)}`)),
150
- onSuccess: l,
151
- onError: (r) => S(r, "Could not cancel the change")
152
- }), y = $({
153
- mutationFn: () => u.request(
167
+ const m = M(), g = j(), [k, x] = O(!1), [u, p] = O(() => A(e.scheduled_at)), c = e.status ?? "pending", f = S({
168
+ mutationFn: () => m.request(G(`/scheduled-changes/${encodeURIComponent(e.id)}`)),
169
+ onSuccess: i,
170
+ onError: (d) => T(d, c === "failed" ? "Could not dismiss it" : "Could not cancel the change")
171
+ }), y = S({
172
+ mutationFn: () => m.request(
154
173
  X(`/scheduled-changes/${encodeURIComponent(e.id)}`, {
155
174
  // datetime-local is the viewer's local time; the API stores UTC.
156
- scheduled_at: new Date(c).toISOString()
175
+ scheduled_at: new Date(u).toISOString()
157
176
  })
158
177
  ),
159
178
  onSuccess: () => {
160
- x(!1), l();
179
+ x(!1), i();
161
180
  },
162
- onError: (r) => S(r, "Could not move the change")
163
- }), v = $({
164
- mutationFn: () => u.request(Y(`/scheduled-changes/${encodeURIComponent(e.id)}/undo`, {})),
165
- onSuccess: l,
166
- onError: (r) => S(r, "Could not undo the change")
167
- }), _ = c !== "" && !Number.isNaN(new Date(c).getTime()), C = f === "executed" && e.can_undo === !0 && !!e.undo_until && new Date(e.undo_until).getTime() > t;
168
- return /* @__PURE__ */ o("li", { className: "px-3 py-2.5", "data-scheduled-row": e.id, "data-status": f, children: [
169
- /* @__PURE__ */ d("p", { className: "text-[12.5px] font-medium leading-snug text-slate-800 dark:text-slate-100", children: n }),
170
- /* @__PURE__ */ d(pe, { row: e, now: t }),
171
- e.created_by_name && /* @__PURE__ */ o("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: [
181
+ onError: (d) => T(
182
+ d,
183
+ c === "failed" ? "Could not schedule it again" : "Could not move the change"
184
+ )
185
+ }), v = S({
186
+ mutationFn: () => m.request(Y(`/scheduled-changes/${encodeURIComponent(e.id)}/undo`, {})),
187
+ onSuccess: i,
188
+ onError: (d) => T(d, "Could not undo the change")
189
+ }), C = u !== "" && !Number.isNaN(new Date(u).getTime()), $ = c === "executed" && e.can_undo === !0 && !!e.undo_until && new Date(e.undo_until).getTime() > t;
190
+ return /* @__PURE__ */ l("li", { className: "px-3 py-2.5", "data-scheduled-row": e.id, "data-status": c, children: [
191
+ /* @__PURE__ */ n("p", { className: "text-[12.5px] font-medium leading-snug text-slate-800 dark:text-slate-100", children: r }),
192
+ /* @__PURE__ */ n(ge, { row: e, now: t }),
193
+ e.created_by_name && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: [
172
194
  "Scheduled by ",
173
195
  e.created_by_name
174
196
  ] }),
175
- e.can_manage && f === "pending" && (b ? /* @__PURE__ */ o("div", { className: "mt-2 flex items-center gap-1.5", children: [
176
- /* @__PURE__ */ d("label", { htmlFor: h, className: "sr-only", children: "New time" }),
177
- /* @__PURE__ */ d(
178
- re,
197
+ e.can_manage && (c === "pending" || c === "failed") && (k ? /* @__PURE__ */ l("div", { className: "mt-2 flex items-center gap-1.5", children: [
198
+ /* @__PURE__ */ n("label", { htmlFor: g, className: "sr-only", children: c === "failed" ? "Try again at" : "New time" }),
199
+ /* @__PURE__ */ n(
200
+ ie,
179
201
  {
180
- id: h,
202
+ id: g,
181
203
  type: "datetime-local",
182
- value: c,
183
- onChange: (r) => m(r.target.value),
204
+ value: u,
205
+ onChange: (d) => p(d.target.value),
184
206
  className: "h-7 flex-1 text-[12px]"
185
207
  }
186
208
  ),
187
- /* @__PURE__ */ d(
209
+ /* @__PURE__ */ n(
188
210
  "button",
189
211
  {
190
212
  type: "button",
191
- disabled: !_ || y.isPending,
213
+ disabled: !C || y.isPending,
192
214
  onClick: () => y.mutate(),
193
215
  className: "h-7 rounded-md bg-nvr-cyan px-2.5 text-[11.5px] font-medium text-white disabled:opacity-50",
194
216
  children: "Save"
195
217
  }
196
218
  ),
197
- /* @__PURE__ */ d(
219
+ /* @__PURE__ */ n("button", { type: "button", onClick: () => x(!1), className: N, children: "Back" })
220
+ ] }) : /* @__PURE__ */ l("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
221
+ /* @__PURE__ */ n(
198
222
  "button",
199
223
  {
200
224
  type: "button",
201
- onClick: () => x(!1),
202
- className: "h-7 rounded-md px-2 text-[11.5px] text-slate-500 hover:bg-muted dark:text-slate-400",
203
- children: "Back"
225
+ onClick: () => {
226
+ c === "failed" && p(A(pe())), x(!0);
227
+ },
228
+ className: N,
229
+ children: c === "failed" ? "Reschedule…" : "Move…"
204
230
  }
205
- )
206
- ] }) : /* @__PURE__ */ o("div", { className: "mt-1.5 flex items-center gap-1", children: [
207
- /* @__PURE__ */ d("button", { type: "button", onClick: () => x(!0), className: T, children: "Move…" }),
208
- /* @__PURE__ */ d(
209
- D,
231
+ ),
232
+ c === "failed" ? /* @__PURE__ */ n(
233
+ "button",
234
+ {
235
+ type: "button",
236
+ onClick: () => f.mutate(),
237
+ disabled: f.isPending,
238
+ "data-tip": "Take this off the record header. Nothing on the record changes.",
239
+ className: N,
240
+ children: "Dismiss"
241
+ }
242
+ ) : /* @__PURE__ */ n(
243
+ I,
210
244
  {
211
- onConfirm: () => k.mutate(),
212
- disabled: k.isPending,
245
+ onConfirm: () => f.mutate(),
246
+ disabled: f.isPending,
213
247
  title: "Cancel this change",
214
248
  confirmLabel: "Cancel it?",
215
- className: T,
216
- armedClassName: "rounded px-1.5 py-0.5 text-[11.5px] font-medium text-red-600 bg-red-50 dark:bg-red-500/10 dark:text-red-400",
249
+ className: be,
250
+ armedClassName: xe,
217
251
  children: "Cancel change"
218
252
  }
219
253
  )
220
254
  ] })),
221
- C && /* @__PURE__ */ o("div", { className: "mt-1.5 flex items-center gap-2", children: [
222
- /* @__PURE__ */ d(
223
- D,
255
+ $ && /* @__PURE__ */ l("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: [
256
+ /* @__PURE__ */ n(
257
+ I,
224
258
  {
225
259
  onConfirm: () => v.mutate(),
226
260
  disabled: v.isPending,
227
261
  title: "Put back the values this change replaced",
228
262
  confirmLabel: "Undo it?",
229
- className: T,
230
- armedClassName: "rounded px-1.5 py-0.5 text-[11.5px] font-medium text-amber-800 bg-amber-50 dark:bg-amber-500/10 dark:text-amber-300",
263
+ className: N,
264
+ armedClassName: "inline-flex h-7 items-center rounded-md border border-amber-300 bg-amber-50 px-2.5 text-[11.5px] font-medium text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",
231
265
  children: "Undo"
232
266
  }
233
267
  ),
234
- /* @__PURE__ */ o("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
235
- "until ",
236
- g(e.undo_until, t)
268
+ /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
269
+ "Possible until ",
270
+ b(e.undo_until, t)
237
271
  ] })
238
272
  ] })
239
273
  ] });
240
274
  }
241
275
  export {
242
- qe as ScheduledChangeChip,
243
- ce as scheduledChangesKey
276
+ Ae as ScheduledChangeChip,
277
+ me as scheduledChangesKey
244
278
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as a, jsxs as c } from "react/jsx-runtime";
2
- import { useMemo as g } from "react";
3
- import { useFieldEditors as x, sectionPresence as u, sectionPresenceText as b } from "../../lib/co-edit.js";
2
+ import { useMemo as x } from "react";
3
+ import { useFieldEditors as g, sectionPresence as u, sectionPresenceText as b } from "../../lib/co-edit.js";
4
4
  import { cursorColor as k } from "../../lib/grid-cursors.js";
5
5
  function w(t) {
6
6
  return t.split(/\s+/).filter(Boolean).map((i) => i[0]).join("").slice(0, 2).toUpperCase() || "?";
@@ -28,7 +28,7 @@ function v({
28
28
  relations: h,
29
29
  label: f
30
30
  }) {
31
- const o = x(t, i), p = Object.keys(o).length > 0, e = g(() => {
31
+ const o = g(t, i), p = Object.keys(o).length > 0, e = x(() => {
32
32
  if (!p) return [];
33
33
  const r = new Set(m.map((n) => n.field)), s = new Set(
34
34
  h.filter(
@@ -50,21 +50,29 @@ function v({
50
50
  children: [
51
51
  /* @__PURE__ */ c("span", { className: "flex items-center pl-1", "aria-hidden": !0, children: [
52
52
  l.map((r, s) => (
53
- // The first face sits on top; the next tucks behind it, initials still readable.
53
+ // Each later face sits ON TOP of the one before, overlapping only 4 px of its 20 —
54
+ // the 2 px surface-coloured ring cuts it out, so every pair of initials stays whole.
54
55
  /* @__PURE__ */ a(
55
56
  "span",
56
57
  {
57
- className: s > 0 ? "-ml-1.5 flex" : "flex",
58
- style: { zIndex: l.length - s, position: "relative" },
58
+ className: s > 0 ? "-ml-1 flex" : "flex",
59
+ style: { zIndex: s + 1, position: "relative" },
59
60
  children: /* @__PURE__ */ a(y, { person: r, size: 20 })
60
61
  },
61
62
  r.id
62
63
  )
63
64
  )),
64
- e.length > l.length && /* @__PURE__ */ c("span", { className: "relative -ml-1.5 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-slate-100 px-1 text-[9px] font-semibold text-slate-600 ring-2 ring-white dark:bg-slate-700 dark:text-slate-200 dark:ring-card", children: [
65
- "+",
66
- e.length - l.length
67
- ] })
65
+ e.length > l.length && /* @__PURE__ */ c(
66
+ "span",
67
+ {
68
+ style: { zIndex: l.length + 1 },
69
+ className: "relative -ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-slate-100 px-1 text-[9px] font-semibold text-slate-600 ring-2 ring-white dark:bg-slate-700 dark:text-slate-200 dark:ring-card",
70
+ children: [
71
+ "+",
72
+ e.length - l.length
73
+ ]
74
+ }
75
+ )
68
76
  ] }),
69
77
  /* @__PURE__ */ a("span", { "aria-hidden": !0, className: "hidden text-[11px] text-slate-500 sm:inline dark:text-slate-400", children: e.length === 1 ? `${e[0].name} is here` : e.length === 2 ? `${e[0].name.split(" ")[0]} and ${e[1].name.split(" ")[0]} are here` : `${e.length} people here` })
70
78
  ]