@nivaro/react 0.3.116 → 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 (142) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +140 -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 +3855 -3785
  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/ReportView.js +1086 -1091
  27. package/dist/shared/components/ScreenRefreshButton.js +34 -32
  28. package/dist/shared/components/TipLayer.js +65 -58
  29. package/dist/shared/components/WidgetImageMenu.js +83 -43
  30. package/dist/shared/components/activity/RecordActivityStream.js +175 -173
  31. package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
  32. package/dist/shared/components/cbv/column-totals.js +62 -57
  33. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
  34. package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
  35. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
  36. package/dist/shared/components/charts/category-axis.js +93 -0
  37. package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
  38. package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
  39. package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
  40. package/dist/shared/components/collections-directory/page-model.js +72 -67
  41. package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
  42. package/dist/shared/components/integrations/SendStatus.js +65 -59
  43. package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
  44. package/dist/shared/components/integrations/console/SignalCard.js +237 -230
  45. package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
  46. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
  47. package/dist/shared/components/item-edit/CloneDialog.js +191 -161
  48. package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
  49. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
  50. package/dist/shared/components/item-edit/FieldComments.js +54 -53
  51. package/dist/shared/components/item-edit/FieldPointer.js +82 -67
  52. package/dist/shared/components/item-edit/FieldRow.js +106 -100
  53. package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
  54. package/dist/shared/components/item-edit/FilePickerField.js +452 -387
  55. package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
  56. package/dist/shared/components/item-edit/HeaderTools.js +94 -85
  57. package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
  58. package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
  59. package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
  60. package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
  61. package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
  62. package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
  63. package/dist/shared/components/item-edit/RecalcValue.js +57 -32
  64. package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
  65. package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
  66. package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
  67. package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
  68. package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
  69. package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
  70. package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
  71. package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
  72. package/dist/shared/components/item-edit/SectionPresence.js +18 -10
  73. package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
  74. package/dist/shared/components/item-edit/UserChip.js +1 -1
  75. package/dist/shared/components/item-edit/file-live.js +69 -54
  76. package/dist/shared/components/item-edit/layout-switch.js +98 -89
  77. package/dist/shared/components/item-edit/partner-needs.js +12 -12
  78. package/dist/shared/components/item-edit/removed-line.js +31 -25
  79. package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
  80. package/dist/shared/components/list/ListViewers.js +46 -35
  81. package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
  82. package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
  83. package/dist/shared/components/panels/AlertBanners.js +82 -72
  84. package/dist/shared/components/panels/BranchLanes.js +22 -22
  85. package/dist/shared/components/panels/CommentImages.js +123 -102
  86. package/dist/shared/components/panels/CommentPanel.js +186 -185
  87. package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
  88. package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
  89. package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
  90. package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
  91. package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
  92. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
  93. package/dist/shared/components/pipeline/PipelineEditorView.js +320 -299
  94. package/dist/shared/components/profile/AgentNameField.js +107 -81
  95. package/dist/shared/components/profile/AgentsPanel.js +184 -184
  96. package/dist/shared/components/profile/PersonAccess.js +599 -495
  97. package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
  98. package/dist/shared/components/profile/SignedInDevices.js +17 -17
  99. package/dist/shared/components/profile/primitives.js +1 -1
  100. package/dist/shared/components/queue/OwnerAvatars.js +91 -54
  101. package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
  102. package/dist/shared/components/queue/QueueWorklist.js +1002 -983
  103. package/dist/shared/components/support/AssignRules.js +1733 -0
  104. package/dist/shared/components/support/PersonPick.js +88 -0
  105. package/dist/shared/components/support/RequestList.js +790 -0
  106. package/dist/shared/components/support/ScreenShare.js +158 -152
  107. package/dist/shared/components/support/SupportRequestDialog.js +50 -48
  108. package/dist/shared/components/support/SupportView.js +140 -246
  109. package/dist/shared/components/support/TicketDetailSheet.js +82 -75
  110. package/dist/shared/components/support/TicketSlowScreens.js +9 -9
  111. package/dist/shared/components/support/assign-rules-text.js +171 -0
  112. package/dist/shared/components/support/support-list.js +125 -0
  113. package/dist/shared/components/ui/SimpleSelect.js +28 -20
  114. package/dist/shared/components/ui/checkbox.js +6 -6
  115. package/dist/shared/components/ui/select.js +43 -39
  116. package/dist/shared/components/ui/sheet.js +9 -9
  117. package/dist/shared/components/ui/switch.js +12 -11
  118. package/dist/shared/components/watch-list/WatchDock.js +532 -459
  119. package/dist/shared/components/watch-list/WatchExtras.js +332 -286
  120. package/dist/shared/components/watch-list/WatchRows.js +164 -140
  121. package/dist/shared/lib/activity-sentence.js +103 -91
  122. package/dist/shared/lib/agent-presence.js +27 -21
  123. package/dist/shared/lib/approval-progress.js +2 -2
  124. package/dist/shared/lib/copy-rules.js +31 -24
  125. package/dist/shared/lib/derived-causes.js +113 -78
  126. package/dist/shared/lib/grid-cursors.js +26 -26
  127. package/dist/shared/lib/label-flash.js +27 -0
  128. package/dist/shared/lib/list-return.js +137 -125
  129. package/dist/shared/lib/live-deltas.js +40 -34
  130. package/dist/shared/lib/live-groups.js +56 -52
  131. package/dist/shared/lib/live-preference.js +64 -59
  132. package/dist/shared/lib/live-screen.js +223 -192
  133. package/dist/shared/lib/partner-failure.js +11 -11
  134. package/dist/shared/lib/rollup-recalc.js +68 -64
  135. package/dist/shared/lib/screen-refresh.js +74 -68
  136. package/dist/shared/lib/screen-share.js +108 -104
  137. package/dist/shared/lib/send-status.js +77 -61
  138. package/dist/shared/lib/text-diff-window.js +29 -0
  139. package/dist/shared/lib/use-query-entry.js +17 -0
  140. package/dist/shared/lib/watch-list.js +210 -209
  141. package/dist/shared/lib/widget-image-render.js +72 -49
  142. package/package.json +1 -1
@@ -1,227 +1,247 @@
1
- import { jsxs as s, jsx as n, Fragment as p } from "react/jsx-runtime";
2
- import { useQueryClient as C, useQuery as R } from "@tanstack/react-query";
3
- import { Undo2 as T, ChevronDown as j, FileText as q, Plus as O, Minus as M, Pencil as W } from "lucide-react";
4
- import { useState as $ } from "react";
5
- import { useNivaroClient as A } from "../../context.js";
6
- import { get as B } from "../../lib/commands.js";
7
- import { useLiveRecordQueries as w, LIVE_ASPECTS as D } from "../../lib/live.js";
8
- import { cn as o } from "../../lib/utils.js";
1
+ import { jsxs as a, jsx as s, Fragment as p } from "react/jsx-runtime";
2
+ import { useQueryClient as R, useQuery as C } from "@tanstack/react-query";
3
+ import { Undo2 as O, ChevronDown as D, FileText as E, Plus as I, Minus as j, Pencil as q } from "lucide-react";
4
+ import { useState as _ } from "react";
5
+ import { useNivaroClient as F } from "../../context.js";
6
+ import { get as L } from "../../lib/commands.js";
7
+ import { numericIntlOptions as A } from "../../lib/format-value.js";
8
+ import { useLiveRecordQueries as w, LIVE_ASPECTS as M } from "../../lib/live.js";
9
+ import { cn as o, toLocalDateString as U, formatDateTime as W } from "../../lib/utils.js";
9
10
  import { RelativeTime as h } from "../RelativeTime.js";
10
- function v(a, t) {
11
- return ["resubmission", a, String(t)];
11
+ function $(n, t) {
12
+ return ["resubmission", n, String(t)];
12
13
  }
13
- function x(a) {
14
- return a.sent_back.by_you ? "What changed since you sent it back" : a.sent_back.by ? `What changed since ${a.sent_back.by} sent it back` : "What changed since it was sent back";
14
+ function x(n) {
15
+ return n.sent_back.by_you ? "What changed since you sent it back" : n.sent_back.by ? `What changed since ${n.sent_back.by} sent it back` : "What changed since it was sent back";
15
16
  }
16
- function E(a) {
17
- const t = [], e = a.fields.length;
17
+ function B(n) {
18
+ const t = [], e = n.fields.length;
18
19
  e > 0 && t.push(`${e} field${e === 1 ? "" : "s"}`);
19
- const i = a.lines.reduce((r, c) => r + c.added + c.changed + c.removed, 0);
20
- i > 0 && t.push(`${i} line${i === 1 ? "" : "s"}`);
21
- const l = a.files.length;
22
- return l > 0 && t.push(`${l} file${l === 1 ? "" : "s"}`), t.length > 0 ? `${t.join(" · ")} changed` : "Nothing changed";
20
+ const c = n.lines.reduce((r, d) => r + d.added + d.changed + d.removed, 0);
21
+ c > 0 && t.push(`${c} line${c === 1 ? "" : "s"}`);
22
+ const i = n.files.length;
23
+ return i > 0 && t.push(`${i} file${i === 1 ? "" : "s"}`), t.length > 0 ? `${t.join(" · ")} changed` : "Nothing changed";
23
24
  }
24
- function F(a) {
25
+ function K(n) {
25
26
  return [
26
- a.added ? `${a.added} added` : "",
27
- a.changed ? `${a.changed} changed` : "",
28
- a.removed ? `${a.removed} removed` : ""
27
+ n.added ? `${n.added} added` : "",
28
+ n.changed ? `${n.changed} changed` : "",
29
+ n.removed ? `${n.removed} removed` : ""
29
30
  ].filter(Boolean).join(", ");
30
31
  }
31
- function _(a, t, e = !0) {
32
- const i = A(), l = C(), r = t == null || t === "new" ? null : String(t), c = e && !!a && !!r, k = R({
33
- queryKey: v(a ?? "", r ?? ""),
34
- queryFn: () => i.request(
35
- B(`/pipelines/instance/${a}/${encodeURIComponent(r ?? "")}/resubmission`)
32
+ function S(n, t, e = !0) {
33
+ const c = F(), i = R(), r = t == null || t === "new" ? null : String(t), d = e && !!n && !!r, k = C({
34
+ queryKey: $(n ?? "", r ?? ""),
35
+ queryFn: () => c.request(
36
+ L(`/pipelines/instance/${n}/${encodeURIComponent(r ?? "")}/resubmission`)
36
37
  ).then((m) => {
37
38
  var y;
38
39
  return (y = m == null ? void 0 : m.data) != null && y.sent_back ? m.data : null;
39
40
  }),
40
- enabled: c,
41
+ enabled: d,
41
42
  staleTime: 3e4,
42
43
  retry: !1
43
- }), N = [...v(a ?? "", r ?? "")], g = k.data != null;
44
- return w(a, r, [N], {
45
- enabled: c && g,
44
+ }), N = [...$(n ?? "", r ?? "")], g = k.data != null;
45
+ return w(n, r, [N], {
46
+ enabled: d && g,
46
47
  debounceMs: 1e3,
47
48
  includeOwn: !0,
48
- client: l
49
- }), w(a, r, [N], {
50
- enabled: c && !g,
49
+ client: i
50
+ }), w(n, r, [N], {
51
+ enabled: d && !g,
51
52
  debounceMs: 1e3,
52
53
  includeOwn: !0,
53
- client: l,
54
- aspects: [D.state]
54
+ client: i,
55
+ aspects: [M.state]
55
56
  }), k;
56
57
  }
57
- const d = "text-slate-500 dark:text-slate-400", u = "font-medium text-slate-700 dark:text-slate-200";
58
- function b({ by: a, at: t }) {
59
- return /* @__PURE__ */ s("span", { className: o("block whitespace-nowrap text-[11px] sm:shrink-0 sm:text-[12px]", d), children: [
60
- a ? `${a} · ` : "",
61
- /* @__PURE__ */ n(h, { value: t })
58
+ const P = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Q = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
59
+ function v(n, t) {
60
+ if (!n || n === "(empty)") return n;
61
+ if (t.kind === "number") {
62
+ const e = Number(n);
63
+ return Number.isFinite(e) ? new Intl.NumberFormat(
64
+ "en-US",
65
+ A(
66
+ t.precision != null ? { precision: t.precision } : void 0,
67
+ t.format ?? void 0
68
+ )
69
+ ).format(e) : n;
70
+ }
71
+ return t.kind === "date" || Q.test(n) ? U(n) || n : (t.kind === "datetime" || P.test(n)) && W(n) || n;
72
+ }
73
+ const l = "text-slate-500 dark:text-slate-400", u = "font-medium text-slate-700 dark:text-slate-200";
74
+ function b({ by: n, at: t }) {
75
+ return /* @__PURE__ */ a("span", { className: o("block whitespace-nowrap text-[11px] sm:shrink-0 sm:text-[11.5px]", l), children: [
76
+ n ? `${n} · ` : "",
77
+ /* @__PURE__ */ s(h, { value: t })
62
78
  ] });
63
79
  }
64
- function f({ kind: a }) {
80
+ function f({ kind: n }) {
65
81
  const t = "mt-[3px] h-3 w-3 shrink-0";
66
- return a === "added" ? /* @__PURE__ */ n(O, { "aria-hidden": !0, className: o(t, "text-emerald-600 dark:text-emerald-400") }) : a === "removed" ? /* @__PURE__ */ n(M, { "aria-hidden": !0, className: o(t, "text-red-600 dark:text-red-400") }) : /* @__PURE__ */ n(W, { "aria-hidden": !0, className: o(t, "text-slate-400 dark:text-slate-500") });
82
+ return n === "added" ? /* @__PURE__ */ s(I, { "aria-hidden": !0, className: o(t, "text-emerald-600 dark:text-emerald-400") }) : n === "removed" ? /* @__PURE__ */ s(j, { "aria-hidden": !0, className: o(t, "text-red-600 dark:text-red-400") }) : /* @__PURE__ */ s(q, { "aria-hidden": !0, className: o(t, "text-slate-400 dark:text-slate-500") });
67
83
  }
68
- function I(a) {
84
+ function Y(n) {
69
85
  const t = [];
70
- for (const e of a.fields)
86
+ for (const e of n.fields)
71
87
  t.push({
72
88
  key: `f:${e.field}`,
73
- node: /* @__PURE__ */ s("div", { className: "flex items-start gap-2", "data-resub-field": e.field, children: [
74
- /* @__PURE__ */ n(f, { kind: "changed" }),
75
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1 sm:flex sm:items-start sm:gap-4", children: [
76
- /* @__PURE__ */ s("p", { className: "min-w-0 break-words sm:flex-1", children: [
77
- /* @__PURE__ */ n("span", { className: u, children: e.label }),
78
- e.auto ? /* @__PURE__ */ n("span", { className: d, children: " (updated automatically)" }) : null,
79
- /* @__PURE__ */ n("span", { className: d, children: ": " }),
80
- e.old !== "" && /* @__PURE__ */ s(p, { children: [
81
- /* @__PURE__ */ n("span", { className: "text-red-600 line-through decoration-red-300 dark:text-red-400 dark:decoration-red-500/50", children: e.old }),
82
- /* @__PURE__ */ s("span", { "aria-hidden": "true", className: d, children: [
89
+ node: /* @__PURE__ */ a("div", { className: "flex items-start gap-2", "data-resub-field": e.field, children: [
90
+ /* @__PURE__ */ s(f, { kind: "changed" }),
91
+ /* @__PURE__ */ a("div", { className: "min-w-0 flex-1 sm:flex sm:items-baseline sm:gap-3", children: [
92
+ /* @__PURE__ */ a("p", { className: "min-w-0 break-words", children: [
93
+ /* @__PURE__ */ s("span", { className: u, children: e.label }),
94
+ e.auto ? /* @__PURE__ */ s("span", { className: l, children: " (updated automatically)" }) : null,
95
+ /* @__PURE__ */ s("span", { className: l, children: ": " }),
96
+ e.old !== "" && /* @__PURE__ */ a(p, { children: [
97
+ e.old === "(empty)" ? (
98
+ // Nothing was there: say so quietly, never a struck-through "(empty)".
99
+ /* @__PURE__ */ s("span", { className: o("italic", l), children: "empty" })
100
+ ) : /* @__PURE__ */ s("span", { className: "text-red-600 line-through decoration-red-300 dark:text-red-400 dark:decoration-red-500/50", children: v(e.old, e) }),
101
+ /* @__PURE__ */ a("span", { "aria-hidden": "true", className: l, children: [
83
102
  " ",
84
103
  "→",
85
104
  " "
86
105
  ] }),
87
- /* @__PURE__ */ n("span", { className: "sr-only", children: " changed to " })
106
+ /* @__PURE__ */ s("span", { className: "sr-only", children: " changed to " })
88
107
  ] }),
89
- /* @__PURE__ */ n("span", { className: "text-emerald-700 dark:text-emerald-400", children: e.new })
108
+ /* @__PURE__ */ s("span", { className: "text-emerald-700 dark:text-emerald-400", children: v(e.new, e) })
90
109
  ] }),
91
- /* @__PURE__ */ n(b, { by: e.by, at: e.at })
110
+ /* @__PURE__ */ s(b, { by: e.by, at: e.at })
92
111
  ] })
93
112
  ] })
94
113
  });
95
- for (const e of a.lines) {
114
+ for (const e of n.lines) {
96
115
  for (const r of e.items)
97
116
  t.push({
98
117
  key: `l:${e.collection}:${r.kind}:${r.id || r.label}:${r.at}`,
99
- node: /* @__PURE__ */ s("div", { className: "flex items-start gap-2", "data-resub-line": r.kind, children: [
100
- /* @__PURE__ */ n(f, { kind: r.kind }),
101
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1 sm:flex sm:items-start sm:gap-4", children: [
102
- /* @__PURE__ */ s("p", { className: "min-w-0 break-words sm:flex-1", children: [
103
- /* @__PURE__ */ s("span", { className: d, children: [
118
+ node: /* @__PURE__ */ a("div", { className: "flex items-start gap-2", "data-resub-line": r.kind, children: [
119
+ /* @__PURE__ */ s(f, { kind: r.kind }),
120
+ /* @__PURE__ */ a("div", { className: "min-w-0 flex-1 sm:flex sm:items-baseline sm:gap-3", children: [
121
+ /* @__PURE__ */ a("p", { className: "min-w-0 break-words", children: [
122
+ /* @__PURE__ */ a("span", { className: l, children: [
104
123
  e.label,
105
124
  ": "
106
125
  ] }),
107
- /* @__PURE__ */ n("span", { className: u, children: r.label }),
108
- /* @__PURE__ */ n("span", { className: d, children: r.kind === "added" ? " added" : r.kind === "removed" ? " removed" : r.fields.length > 0 ? ` — ${r.fields.join(", ")} changed` : " changed" })
126
+ /* @__PURE__ */ s("span", { className: u, children: r.label }),
127
+ /* @__PURE__ */ s("span", { className: l, children: r.kind === "added" ? " added" : r.kind === "removed" ? " removed" : r.fields.length > 0 ? ` — ${r.fields.join(", ")} changed` : " changed" })
109
128
  ] }),
110
- /* @__PURE__ */ n(b, { by: r.by, at: r.at })
129
+ /* @__PURE__ */ s(b, { by: r.by, at: r.at })
111
130
  ] })
112
131
  ] })
113
132
  });
114
- const i = e.items.length, l = e.added + e.changed + e.removed;
115
- l > i && t.push({
133
+ const c = e.items.length, i = e.added + e.changed + e.removed;
134
+ i > c && t.push({
116
135
  key: `l:${e.collection}:more`,
117
- node: /* @__PURE__ */ s("p", { className: o("pl-5", d), children: [
136
+ node: /* @__PURE__ */ a("p", { className: o("pl-5", l), children: [
118
137
  e.label,
119
138
  ": ",
120
- l - i,
139
+ i - c,
121
140
  " more (",
122
- F(e),
141
+ K(e),
123
142
  " in all)"
124
143
  ] })
125
144
  });
126
145
  }
127
- for (const e of a.files)
146
+ for (const e of n.files)
128
147
  t.push({
129
148
  key: `file:${e.field}:${e.kind}:${e.name}:${e.at}`,
130
- node: /* @__PURE__ */ s("div", { className: "flex items-start gap-2", "data-resub-file": e.kind, children: [
131
- e.kind === "replaced" ? /* @__PURE__ */ n(q, { "aria-hidden": !0, className: "mt-[3px] h-3 w-3 shrink-0 text-slate-400" }) : /* @__PURE__ */ n(f, { kind: e.kind }),
132
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1 sm:flex sm:items-start sm:gap-4", children: [
133
- /* @__PURE__ */ s("p", { className: "min-w-0 break-words sm:flex-1", children: [
134
- /* @__PURE__ */ s("span", { className: d, children: [
149
+ node: /* @__PURE__ */ a("div", { className: "flex items-start gap-2", "data-resub-file": e.kind, children: [
150
+ e.kind === "replaced" ? /* @__PURE__ */ s(E, { "aria-hidden": !0, className: "mt-[3px] h-3 w-3 shrink-0 text-slate-400" }) : /* @__PURE__ */ s(f, { kind: e.kind }),
151
+ /* @__PURE__ */ a("div", { className: "min-w-0 flex-1 sm:flex sm:items-baseline sm:gap-3", children: [
152
+ /* @__PURE__ */ a("p", { className: "min-w-0 break-words", children: [
153
+ /* @__PURE__ */ a("span", { className: l, children: [
135
154
  e.field_label,
136
155
  ": "
137
156
  ] }),
138
- e.kind === "replaced" ? /* @__PURE__ */ s(p, { children: [
139
- /* @__PURE__ */ n("span", { className: u, children: e.name }),
140
- /* @__PURE__ */ n("span", { className: d, children: " replaced " }),
141
- /* @__PURE__ */ n("span", { className: "text-slate-500 line-through dark:text-slate-400", children: e.old_name ?? "a file" })
142
- ] }) : /* @__PURE__ */ s(p, { children: [
143
- /* @__PURE__ */ n("span", { className: u, children: e.name }),
144
- /* @__PURE__ */ n("span", { className: d, children: e.kind === "added" ? " added" : " removed" })
157
+ e.kind === "replaced" ? /* @__PURE__ */ a(p, { children: [
158
+ /* @__PURE__ */ s("span", { className: u, children: e.name }),
159
+ /* @__PURE__ */ s("span", { className: l, children: " replaced " }),
160
+ /* @__PURE__ */ s("span", { className: "text-slate-500 line-through dark:text-slate-400", children: e.old_name ?? "a file" })
161
+ ] }) : /* @__PURE__ */ a(p, { children: [
162
+ /* @__PURE__ */ s("span", { className: u, children: e.name }),
163
+ /* @__PURE__ */ s("span", { className: l, children: e.kind === "added" ? " added" : " removed" })
145
164
  ] })
146
165
  ] }),
147
- /* @__PURE__ */ n(b, { by: e.by, at: e.at })
166
+ /* @__PURE__ */ s(b, { by: e.by, at: e.at })
148
167
  ] })
149
168
  ] })
150
169
  });
151
170
  return t;
152
171
  }
153
- function S({
154
- data: a,
172
+ function T({
173
+ data: n,
155
174
  limit: t = 4
156
175
  }) {
157
- const [e, i] = $(!1), l = I(a);
158
- if (l.length === 0)
159
- return /* @__PURE__ */ n("p", { className: o("text-[12px]", d), "data-resub-empty": !0, children: "Nothing on the record changed since it was sent back." });
160
- const r = e ? l : l.slice(0, t);
161
- return /* @__PURE__ */ s("div", { className: "max-w-[880px] space-y-1.5 text-[12px] leading-snug", children: [
162
- r.map((c) => /* @__PURE__ */ n("div", { children: c.node }, c.key)),
163
- l.length > t && /* @__PURE__ */ n(
176
+ const [e, c] = _(!1), i = Y(n);
177
+ if (i.length === 0)
178
+ return /* @__PURE__ */ s("p", { className: o("text-[12px]", l), "data-resub-empty": !0, children: "Nothing on the record changed since it was sent back." });
179
+ const r = e ? i : i.slice(0, t);
180
+ return /* @__PURE__ */ a("div", { className: "max-w-[880px] space-y-1.5 text-[12px] leading-snug", children: [
181
+ r.map((d) => /* @__PURE__ */ s("div", { children: d.node }, d.key)),
182
+ i.length > t && /* @__PURE__ */ s(
164
183
  "button",
165
184
  {
166
185
  type: "button",
167
- onClick: () => i((c) => !c),
186
+ onClick: () => c((d) => !d),
168
187
  className: "pl-5 text-[11.5px] font-medium text-nvr-cyan hover:underline",
169
- children: e ? "Show fewer" : `Show ${l.length - t} more`
188
+ children: e ? "Show fewer" : `Show ${i.length - t} more`
170
189
  }
171
190
  )
172
191
  ] });
173
192
  }
174
- function K({ data: a }) {
175
- const t = a.sent_back;
176
- return /* @__PURE__ */ s("p", { className: o("text-[11.5px]", d), children: [
177
- "Sent back ",
178
- /* @__PURE__ */ n(h, { value: t.at }),
179
- t.to_label ? ` to ${t.to_label}` : "",
180
- a.returned.by ? ` · back from ${a.returned.by} ` : " · back ",
181
- /* @__PURE__ */ n(h, { value: a.returned.at })
193
+ function G({ data: n }) {
194
+ const t = n.sent_back, e = t.by_you ? "You" : t.by || "Someone";
195
+ return /* @__PURE__ */ a("p", { className: o("text-[11.5px]", l), children: [
196
+ e,
197
+ " sent it back ",
198
+ /* @__PURE__ */ s(h, { value: t.at }),
199
+ " · ",
200
+ n.returned.by ? `${n.returned.by} resubmitted ` : "Resubmitted ",
201
+ /* @__PURE__ */ s(h, { value: n.returned.at })
182
202
  ] });
183
203
  }
184
- function J({
185
- collection: a,
204
+ function ae({
205
+ collection: n,
186
206
  itemId: t
187
207
  }) {
188
- const { data: e } = _(a, t), [i, l] = $(null);
208
+ const { data: e } = S(n, t), [c, i] = _(null);
189
209
  if (!e) return null;
190
- const r = i ?? e.total > 0;
191
- return /* @__PURE__ */ s(
210
+ const r = c ?? e.total > 0;
211
+ return /* @__PURE__ */ a(
192
212
  "section",
193
213
  {
194
214
  className: "nvr-expand-in rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
195
215
  "data-resubmission-strip": !0,
196
216
  "aria-label": x(e),
197
217
  children: [
198
- /* @__PURE__ */ s(
218
+ /* @__PURE__ */ a(
199
219
  "button",
200
220
  {
201
221
  type: "button",
202
- onClick: () => l(!r),
222
+ onClick: () => i(!r),
203
223
  "aria-expanded": r,
204
224
  className: "flex w-full items-start gap-2.5 rounded-lg px-3.5 py-2.5 text-left hover:bg-slate-50/70 dark:hover:bg-white/[0.02]",
205
225
  children: [
206
- /* @__PURE__ */ n(
207
- T,
226
+ /* @__PURE__ */ s(
227
+ O,
208
228
  {
209
229
  "aria-hidden": !0,
210
230
  className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
211
231
  }
212
232
  ),
213
- /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
214
- /* @__PURE__ */ s("span", { className: "block text-[12.5px] font-medium text-slate-800 dark:text-slate-100", children: [
233
+ /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
234
+ /* @__PURE__ */ a("span", { className: "block text-[12.5px] font-medium text-slate-800 dark:text-slate-100", children: [
215
235
  x(e),
216
- /* @__PURE__ */ s("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: [
236
+ /* @__PURE__ */ s("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: B(e).split(" · ").map((d) => /* @__PURE__ */ a("span", { children: [
217
237
  " · ",
218
- E(e)
219
- ] })
238
+ /* @__PURE__ */ s("span", { className: "whitespace-nowrap", children: d })
239
+ ] }, d)) })
220
240
  ] }),
221
- /* @__PURE__ */ n(K, { data: e })
241
+ /* @__PURE__ */ s(G, { data: e })
222
242
  ] }),
223
- /* @__PURE__ */ n(
224
- j,
243
+ /* @__PURE__ */ s(
244
+ D,
225
245
  {
226
246
  "aria-hidden": !0,
227
247
  className: o(
@@ -233,14 +253,14 @@ function J({
233
253
  ]
234
254
  }
235
255
  ),
236
- r && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 px-3.5 pt-2 pb-2.5 dark:border-border/60", children: [
237
- e.sent_back.reason && /* @__PURE__ */ s(
256
+ r && /* @__PURE__ */ a("div", { className: "border-t border-slate-100 px-3.5 pt-2 pb-2.5 dark:border-border/60", children: [
257
+ e.sent_back.reason && /* @__PURE__ */ a(
238
258
  "p",
239
259
  {
240
260
  className: "mb-2 whitespace-pre-line break-words text-[12px] text-slate-600 dark:text-slate-300",
241
261
  "data-resub-reason": !0,
242
262
  children: [
243
- /* @__PURE__ */ s("span", { className: d, children: [
263
+ /* @__PURE__ */ a("span", { className: l, children: [
244
264
  e.sent_back.by_you ? "You asked" : "Asked",
245
265
  ": "
246
266
  ] }),
@@ -250,44 +270,45 @@ function J({
250
270
  ]
251
271
  }
252
272
  ),
253
- /* @__PURE__ */ n(S, { data: e, limit: 6 })
273
+ /* @__PURE__ */ s(T, { data: e, limit: 6 })
254
274
  ] })
255
275
  ]
256
276
  }
257
277
  );
258
278
  }
259
- function X({
260
- collection: a,
279
+ function re({
280
+ collection: n,
261
281
  item: t
262
282
  }) {
263
- const { data: e } = _(a, t);
264
- return e ? /* @__PURE__ */ s(
283
+ const { data: e } = S(n, t);
284
+ return e ? /* @__PURE__ */ a(
265
285
  "div",
266
286
  {
267
287
  className: "rounded-md border border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card",
268
288
  "data-resubmission-brief": !0,
269
289
  children: [
270
- /* @__PURE__ */ s("p", { className: "mb-1 text-[11.5px]", children: [
271
- /* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-foreground", children: x(e) }),
290
+ /* @__PURE__ */ a("p", { className: "mb-1 text-[11.5px]", children: [
291
+ /* @__PURE__ */ s("span", { className: "font-medium text-slate-700 dark:text-foreground", children: x(e) }),
272
292
  " ",
273
- /* @__PURE__ */ s("span", { className: d, children: [
293
+ /* @__PURE__ */ a("span", { className: l, children: [
274
294
  "(",
275
- /* @__PURE__ */ n(h, { value: e.sent_back.at }),
295
+ /* @__PURE__ */ s(h, { value: e.sent_back.at }),
276
296
  ")"
277
297
  ] })
278
298
  ] }),
279
- /* @__PURE__ */ n(S, { data: e, limit: 5 })
299
+ /* @__PURE__ */ s(T, { data: e, limit: 5 })
280
300
  ]
281
301
  }
282
302
  ) : null;
283
303
  }
284
304
  export {
285
- X as ResubmissionBrief,
286
- S as ResubmissionChanges,
287
- J as ResubmissionStrip,
288
- F as lineGroupCounts,
289
- v as resubmissionKey,
290
- E as resubmissionSummary,
305
+ re as ResubmissionBrief,
306
+ T as ResubmissionChanges,
307
+ ae as ResubmissionStrip,
308
+ K as lineGroupCounts,
309
+ v as resubValueText,
310
+ $ as resubmissionKey,
311
+ B as resubmissionSummary,
291
312
  x as resubmissionTitle,
292
- _ as useResubmissionDiff
313
+ S as useResubmissionDiff
293
314
  };
@@ -0,0 +1,163 @@
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import { useQuery as v } from "@tanstack/react-query";
3
+ import { X as w, Plus as N, ChevronsUpDown as g } from "lucide-react";
4
+ import { useState as k, useMemo as C } from "react";
5
+ import { useNivaroClient as L } from "../../context.js";
6
+ import { get as S } from "../../lib/commands.js";
7
+ import { Command as A, CommandInput as T, CommandList as _, CommandEmpty as P, CommandGroup as O, CommandItem as $ } from "../ui/command.js";
8
+ import { Popover as q, PopoverTrigger as F, PopoverContent as I } from "../ui/popover.js";
9
+ function b(o) {
10
+ let r = o;
11
+ if (typeof r == "string") {
12
+ const s = r.trim();
13
+ if (!s) return [];
14
+ try {
15
+ r = JSON.parse(s);
16
+ } catch {
17
+ r = s.split(",");
18
+ }
19
+ }
20
+ return Array.isArray(r) ? [...new Set(r.map((s) => String(s ?? "").trim()).filter(Boolean))] : [];
21
+ }
22
+ function f({
23
+ label: o,
24
+ value: r,
25
+ options: s,
26
+ onChange: i,
27
+ addLabel: d,
28
+ findLabel: p,
29
+ emptyText: m,
30
+ noneText: h
31
+ }) {
32
+ const [x, c] = k(!1), u = C(() => new Map(s.map((a) => [a.value.toLowerCase(), a])), [s]), t = s.filter((a) => !r.some((n) => n.toLowerCase() === a.value.toLowerCase()));
33
+ return /* @__PURE__ */ l(
34
+ "fieldset",
35
+ {
36
+ className: "m-0 flex min-w-0 flex-wrap items-center gap-1.5 border-0 p-0",
37
+ "aria-label": o,
38
+ children: [
39
+ r.length === 0 && /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: h }),
40
+ r.map((a) => {
41
+ const n = u.get(a.toLowerCase());
42
+ return /* @__PURE__ */ l(
43
+ "span",
44
+ {
45
+ className: "inline-flex h-6 items-center gap-1 rounded-md border border-slate-200 bg-slate-50 pl-2 pr-1 text-[12px] text-slate-700 dark:border-border dark:bg-muted dark:text-slate-200",
46
+ children: [
47
+ /* @__PURE__ */ e("span", { className: "max-w-[16rem] truncate", children: (n == null ? void 0 : n.label) ?? a }),
48
+ /* @__PURE__ */ e(
49
+ "button",
50
+ {
51
+ type: "button",
52
+ onClick: () => i(r.filter((y) => y !== a)),
53
+ "aria-label": `Remove ${(n == null ? void 0 : n.label) ?? a}`,
54
+ className: "rounded p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:hover:bg-slate-700 dark:hover:text-white",
55
+ children: /* @__PURE__ */ e(w, { className: "h-3 w-3" })
56
+ }
57
+ )
58
+ ]
59
+ },
60
+ a
61
+ );
62
+ }),
63
+ /* @__PURE__ */ l(q, { open: x, onOpenChange: c, children: [
64
+ /* @__PURE__ */ e(F, { asChild: !0, children: /* @__PURE__ */ l(
65
+ "button",
66
+ {
67
+ type: "button",
68
+ disabled: t.length === 0,
69
+ className: "inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-slate-300 px-2 text-[12px] text-slate-600 hover:border-slate-400 hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-border dark:text-slate-300 dark:hover:text-white",
70
+ children: [
71
+ /* @__PURE__ */ e(N, { className: "h-3 w-3" }),
72
+ " ",
73
+ d,
74
+ /* @__PURE__ */ e(g, { className: "h-3 w-3 opacity-60" })
75
+ ]
76
+ }
77
+ ) }),
78
+ /* @__PURE__ */ e(I, { align: "start", className: "w-64 p-0", children: /* @__PURE__ */ l(A, { children: [
79
+ /* @__PURE__ */ e(T, { placeholder: p }),
80
+ /* @__PURE__ */ l(_, { children: [
81
+ /* @__PURE__ */ e(P, { children: m }),
82
+ /* @__PURE__ */ e(O, { children: t.map((a) => /* @__PURE__ */ l(
83
+ $,
84
+ {
85
+ value: `${a.label} ${a.hint ?? ""} ${a.value}`,
86
+ onSelect: () => {
87
+ i([...r, a.value]), c(!1);
88
+ },
89
+ children: [
90
+ /* @__PURE__ */ e("span", { className: "truncate", children: a.label }),
91
+ a.hint && /* @__PURE__ */ e("span", { className: "ml-auto truncate font-mono text-[10.5px] text-slate-500 dark:text-slate-400", children: a.hint })
92
+ ]
93
+ },
94
+ a.value
95
+ )) })
96
+ ] })
97
+ ] }) })
98
+ ] })
99
+ ]
100
+ }
101
+ );
102
+ }
103
+ function J({
104
+ collection: o,
105
+ roles: r,
106
+ allowed: s,
107
+ states: i,
108
+ onSave: d
109
+ }) {
110
+ const p = L(), m = b(r), h = b(s), { data: x } = v({
111
+ queryKey: ["pipeline-start-state-roles"],
112
+ queryFn: () => p.request(
113
+ S("/roles")
114
+ ).then((t) => t.data).catch(() => []),
115
+ staleTime: 5 * 6e4
116
+ }), c = (x ?? []).filter((t) => !t.admin_access).map((t) => ({ value: String(t.id), label: t.name })), u = i.filter((t) => !t.is_initial).map((t) => ({ value: t.key, label: t.label, hint: t.key }));
117
+ return /* @__PURE__ */ l("div", { className: "mt-3 space-y-2.5 border-t border-slate-100 pt-3 dark:border-border", children: [
118
+ /* @__PURE__ */ l("div", { children: [
119
+ /* @__PURE__ */ e("div", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "Who may create records in a later step" }),
120
+ /* @__PURE__ */ l("p", { className: "mt-0.5 max-w-[72ch] text-[11.5px] text-slate-500 dark:text-slate-400", children: [
121
+ "An integration or person creating a ",
122
+ o,
123
+ " record can name the step it starts in (",
124
+ /* @__PURE__ */ e("code", { className: "font-mono", children: "start_state" }),
125
+ " in the API). Administrators always may. No transition runs, so its actions (partner pushes, emails set on the move) do not."
126
+ ] }),
127
+ /* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
128
+ f,
129
+ {
130
+ label: "Roles that may create records in a later step",
131
+ value: m,
132
+ options: c,
133
+ onChange: (t) => d({ start_state_roles: t }),
134
+ addLabel: "Add a role",
135
+ findLabel: "Find a role",
136
+ emptyText: "No role matches.",
137
+ noneText: "Administrators only"
138
+ }
139
+ ) })
140
+ ] }),
141
+ m.length > 0 && /* @__PURE__ */ l("div", { children: [
142
+ /* @__PURE__ */ e("div", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "Which steps" }),
143
+ /* @__PURE__ */ e("p", { className: "mt-0.5 max-w-[72ch] text-[11.5px] text-slate-500 dark:text-slate-400", children: "The steps those roles may start a record in. Leave empty to allow any step." }),
144
+ /* @__PURE__ */ e("div", { className: "mt-1.5", children: /* @__PURE__ */ e(
145
+ f,
146
+ {
147
+ label: "Steps those roles may start a record in",
148
+ value: h,
149
+ options: u,
150
+ onChange: (t) => d({ start_state_allowed: t }),
151
+ addLabel: "Add a step",
152
+ findLabel: "Find a step",
153
+ emptyText: "No step matches.",
154
+ noneText: "Any step"
155
+ }
156
+ ) })
157
+ ] })
158
+ ] });
159
+ }
160
+ export {
161
+ J as BindingStartStateSettings,
162
+ b as parseStartList
163
+ };