@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,108 +1,130 @@
1
- import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
- import { useQueryClient as k, useQuery as C } from "@tanstack/react-query";
3
- import { useEffect as D, useState as U } from "react";
4
- import { useNivaroClient as q } from "../../context.js";
5
- import { post as A } from "../../lib/commands.js";
6
- import { HEADER_LABEL as H, HEADER_VALUE_LINE as R, HEADER_VALUE_HERO as T, HEADER_SUB as O, HEADER_TILE as $ } from "../../lib/header-strip.js";
7
- import { cn as _ } from "../../lib/utils.js";
8
- import { Popover as F, PopoverTrigger as Q, PopoverContent as W } from "../ui/popover.js";
9
- function M({ collection: l, itemId: s, field: o, config: r, onOpen: E, ...v }) {
10
- const N = q(), p = k();
11
- D(() => {
1
+ import { jsxs as n, jsx as l } from "react/jsx-runtime";
2
+ import { useQueryClient as F, useQuery as Q } from "@tanstack/react-query";
3
+ import { useEffect as E, useState as v, useRef as W } from "react";
4
+ import { useNivaroClient as K } from "../../context.js";
5
+ import { post as P } from "../../lib/commands.js";
6
+ import { HEADER_LABEL as V, HEADER_VALUE_LINE as j, HEADER_VALUE_HERO as B, HEADER_SUB as z, HEADER_TILE as G } from "../../lib/header-strip.js";
7
+ import { cn as U } from "../../lib/utils.js";
8
+ import { Popover as J, PopoverTrigger as M, PopoverContent as X } from "../ui/popover.js";
9
+ import { RecalcValue as Y } from "./RecalcValue.js";
10
+ function oe({
11
+ collection: o,
12
+ itemId: a,
13
+ field: i,
14
+ config: r,
15
+ onOpen: k,
16
+ recalculating: h,
17
+ ...C
18
+ }) {
19
+ const R = K(), f = F();
20
+ E(() => {
12
21
  let t = null;
13
- const L = p.getQueryCache().subscribe((u) => {
14
- var f;
15
- if (u.type !== "updated" || ((f = u.action) == null ? void 0 : f.type) !== "success") return;
16
- const c = u.query.queryKey, m = c == null ? void 0 : c[0];
17
- typeof m != "string" || !m.startsWith("o2m-rows") && !m.startsWith("nested") || u.query.state.dataUpdateCount <= 1 || m.startsWith("o2m-rows") && String(c[3]) !== String(s) || (t && clearTimeout(t), t = setTimeout(
18
- () => void p.invalidateQueries({ queryKey: ["child-summary", l, s] }),
22
+ const _ = f.getQueryCache().subscribe((d) => {
23
+ var D;
24
+ if (d.type !== "updated" || ((D = d.action) == null ? void 0 : D.type) !== "success") return;
25
+ const m = d.query.queryKey, p = m == null ? void 0 : m[0];
26
+ typeof p != "string" || !p.startsWith("o2m-rows") && !p.startsWith("nested") || d.query.state.dataUpdateCount <= 1 || p.startsWith("o2m-rows") && String(m[3]) !== String(a) || (t && clearTimeout(t), t = setTimeout(
27
+ () => void f.invalidateQueries({ queryKey: ["child-summary", o, a] }),
19
28
  400
20
29
  ));
21
30
  });
22
31
  return () => {
23
- L(), t && clearTimeout(t);
32
+ _(), t && clearTimeout(t);
24
33
  };
25
- }, [p, l, s]);
26
- const { data: e, isLoading: y } = C({
27
- queryKey: ["child-summary", l, s, o, r.formula, r.positive_only],
28
- queryFn: () => N.request(
29
- A(`/items/${l}/${s}/child-summary`, {
30
- field: o,
34
+ }, [f, o, a]);
35
+ const { data: e, isLoading: N, dataUpdatedAt: S } = Q({
36
+ queryKey: ["child-summary", o, a, i, r.formula, r.positive_only],
37
+ queryFn: () => R.request(
38
+ P(`/items/${o}/${a}/child-summary`, {
39
+ field: i,
31
40
  formula: r.formula,
32
41
  positive_only: r.positive_only !== !1,
33
42
  row_label: r.row_label
34
43
  })
35
44
  ).then((t) => t.data),
36
- enabled: !!s && s !== "new",
45
+ enabled: !!a && a !== "new",
37
46
  staleTime: 3e4,
38
47
  placeholderData: (t) => t
39
- }), [S, b] = U(!1);
40
- if (!e && !y || e && e.count === 0 && r.hide_when_zero !== !1) return null;
41
- const g = e ? r.format === "number" ? e.total.toLocaleString("en-US", { maximumFractionDigits: 2 }) : e.total.toLocaleString("en-US", { style: "currency", currency: "USD" }) : "—", i = r.count_label ?? "rows", d = !!(e != null && e.first_id), x = (t) => r.format === "number" ? t.toLocaleString("en-US", { maximumFractionDigits: 2 }) : t.toLocaleString("en-US", { style: "currency", currency: "USD" }), w = (t) => {
42
- e && (b(!1), E({ childCollection: e.child_collection, fkField: e.fk_field, rowId: t, field: o }));
43
- }, h = (e == null ? void 0 : e.items) ?? [];
44
- return /* @__PURE__ */ a(F, { open: S, onOpenChange: b, children: [
45
- /* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ a(
48
+ }), [T, w] = v(!1), A = !!e && !!(h != null && h(e.child_collection)), [s, u] = v(null), [q, L] = v(!1), y = W(s);
49
+ y.current = s, E(() => {
50
+ A ? u({ endedAt: null }) : y.current && y.current.endedAt == null && u({ endedAt: Date.now() });
51
+ }, [A]), E(() => {
52
+ if (!s || s.endedAt == null) return;
53
+ if (S > s.endedAt) {
54
+ u(null), L(!0);
55
+ const _ = setTimeout(() => L(!1), 1400);
56
+ return () => clearTimeout(_);
57
+ }
58
+ const t = setTimeout(() => u(null), 15e3);
59
+ return () => clearTimeout(t);
60
+ }, [s, S]);
61
+ const H = s ? "pending" : q ? "landed" : null;
62
+ if (!e && !N || e && e.count === 0 && r.hide_when_zero !== !1) return null;
63
+ const O = e ? r.format === "number" ? e.total.toLocaleString("en-US", { maximumFractionDigits: 2 }) : e.total.toLocaleString("en-US", { style: "currency", currency: "USD" }) : "—", c = r.count_label ?? "rows", b = !!(e != null && e.first_id), g = (t) => r.format === "number" ? t.toLocaleString("en-US", { maximumFractionDigits: 2 }) : t.toLocaleString("en-US", { style: "currency", currency: "USD" }), $ = (t) => {
64
+ e && (w(!1), k({ childCollection: e.child_collection, fkField: e.fk_field, rowId: t, field: i }));
65
+ }, x = (e == null ? void 0 : e.items) ?? [];
66
+ return /* @__PURE__ */ n(J, { open: T, onOpenChange: w, children: [
67
+ /* @__PURE__ */ l(M, { asChild: !0, children: /* @__PURE__ */ n(
46
68
  "button",
47
69
  {
48
70
  type: "button",
49
- disabled: !d,
50
- className: _(
51
- $,
71
+ disabled: !b,
72
+ className: U(
73
+ G,
52
74
  "text-left",
53
- d ? "cursor-pointer" : "cursor-default hover:bg-transparent dark:hover:bg-transparent"
75
+ b ? "cursor-pointer" : "cursor-default hover:bg-transparent dark:hover:bg-transparent"
54
76
  ),
55
- "data-tip": d ? `Which ${i} contribute` : void 0,
56
- "data-header-summary": o,
77
+ "data-tip": b ? `Which ${c} contribute` : void 0,
78
+ "data-header-summary": i,
57
79
  "data-header-money": "",
58
- ...v,
80
+ ...C,
59
81
  children: [
60
- /* @__PURE__ */ n("span", { className: H, "data-header-label": !0, children: r.label }),
61
- /* @__PURE__ */ a("span", { className: `${R} items-baseline`, "data-header-value": !0, children: [
62
- /* @__PURE__ */ n("span", { className: _(T, y && !e && "text-slate-300"), children: g }),
63
- e && /* @__PURE__ */ a("span", { className: O, children: [
82
+ /* @__PURE__ */ l("span", { className: V, "data-header-label": !0, children: r.label }),
83
+ /* @__PURE__ */ n("span", { className: `${j} items-baseline`, "data-header-value": !0, children: [
84
+ /* @__PURE__ */ l(Y, { state: H, inline: !0, children: /* @__PURE__ */ l("span", { className: U(B, N && !e && "text-slate-300"), children: O }) }),
85
+ e && /* @__PURE__ */ n("span", { className: z, children: [
64
86
  "across ",
65
87
  e.count,
66
88
  " ",
67
- e.count === 1 ? i.replace(/s$/, "") : i
89
+ e.count === 1 ? c.replace(/s$/, "") : c
68
90
  ] })
69
91
  ] })
70
92
  ]
71
93
  }
72
94
  ) }),
73
- /* @__PURE__ */ a(W, { align: "start", className: "w-[360px] p-2 text-[11.5px]", children: [
74
- /* @__PURE__ */ a("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: [
95
+ /* @__PURE__ */ n(X, { align: "start", className: "w-[360px] p-2 text-[11.5px]", children: [
96
+ /* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: [
75
97
  r.label,
76
98
  " — ",
77
99
  (e == null ? void 0 : e.count) ?? 0,
78
100
  " ",
79
- i
101
+ c
80
102
  ] }),
81
- /* @__PURE__ */ a("div", { className: "max-h-[260px] space-y-px overflow-y-auto", children: [
82
- h.map((t) => /* @__PURE__ */ a(
103
+ /* @__PURE__ */ n("div", { className: "max-h-[260px] space-y-px overflow-y-auto", children: [
104
+ x.map((t) => /* @__PURE__ */ n(
83
105
  "button",
84
106
  {
85
107
  type: "button",
86
- onClick: () => w(t.id),
108
+ onClick: () => $(t.id),
87
109
  className: "flex w-full items-baseline gap-2 rounded px-1.5 py-1 text-left hover:bg-slate-50 dark:hover:bg-muted",
88
110
  "data-tip": "Open this line",
89
111
  children: [
90
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: t.label }),
91
- /* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-900 dark:text-slate-100", children: x(t.value) })
112
+ /* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: t.label }),
113
+ /* @__PURE__ */ l("span", { className: "shrink-0 font-mono tabular-nums text-slate-900 dark:text-slate-100", children: g(t.value) })
92
114
  ]
93
115
  },
94
116
  t.id
95
117
  )),
96
- e && e.count > h.length && /* @__PURE__ */ a("p", { className: "px-1.5 py-1 text-[10.5px] text-slate-400", children: [
118
+ e && e.count > x.length && /* @__PURE__ */ n("p", { className: "px-1.5 py-1 text-[10.5px] text-slate-400", children: [
97
119
  "+",
98
- e.count - h.length,
120
+ e.count - x.length,
99
121
  " more"
100
122
  ] })
101
123
  ] }),
102
- e && /* @__PURE__ */ n("p", { className: "border-t border-slate-100 px-1.5 pt-1.5 text-right font-medium text-slate-700 dark:border-border dark:text-slate-200", children: x(e.total) })
124
+ e && /* @__PURE__ */ l("p", { className: "border-t border-slate-100 px-1.5 pt-1.5 text-right font-medium text-slate-700 dark:border-border dark:text-slate-200", children: g(e.total) })
103
125
  ] })
104
126
  ] });
105
127
  }
106
128
  export {
107
- M as HeaderSummaryChip
129
+ oe as HeaderSummaryChip
108
130
  };
@@ -1,62 +1,71 @@
1
- import { jsx as v, jsxs as W } from "react/jsx-runtime";
2
- import { MoreHorizontal as N } from "lucide-react";
3
- import { useRef as b, useState as R, useEffect as _ } from "react";
4
- import { createPortal as L } from "react-dom";
5
- import { cn as y } from "../../lib/utils.js";
6
- function B(c, t) {
1
+ import { jsx as w, jsxs as M } from "react/jsx-runtime";
2
+ import { MoreHorizontal as B } from "lucide-react";
3
+ import { useRef as v, useState as E, useEffect as y } from "react";
4
+ import { createPortal as z } from "react-dom";
5
+ import { cn as R } from "../../lib/utils.js";
6
+ function O(c, t) {
7
7
  const d = c.target;
8
8
  if (!(d != null && d.closest)) return !0;
9
9
  if (d.closest("[data-radix-popper-content-wrapper]")) return !1;
10
10
  const a = d.closest('[role="dialog"]');
11
11
  return !a || !!(t && a.contains(t));
12
12
  }
13
- function D({ children: c }) {
14
- var g, x;
15
- const t = b(null), d = b(null), [a, i] = R(!1), u = b(!1);
13
+ function P({ children: c }) {
14
+ var m, _;
15
+ const t = v(null), d = v(null), [a, i] = E(!1), u = v(!1);
16
16
  u.current = a;
17
- const n = b(0), o = b(0), [s, l] = R(!1);
18
- if (_(() => {
19
- var k, C;
20
- const e = (k = t.current) == null ? void 0 : k.closest("[data-nvr-header-row]");
17
+ const n = v(0), o = v(0), [s, l] = E(!1);
18
+ if (y(() => {
19
+ var C, N;
20
+ const e = (C = t.current) == null ? void 0 : C.closest("[data-nvr-header-row]");
21
21
  if (!e) return;
22
- const f = () => {
22
+ const p = () => {
23
23
  if (!u.current) {
24
24
  e.scrollWidth > e.clientWidth + 2 && (n.current = e.scrollWidth, i(!0), l(!1));
25
25
  return;
26
26
  }
27
- const E = e.hasAttribute("data-nvr-header-wrap");
28
- !E && e.scrollWidth > e.clientWidth + 2 ? (o.current = e.scrollWidth, e.setAttribute("data-nvr-header-wrap", "")) : E && e.clientWidth > o.current + 32 ? e.removeAttribute("data-nvr-header-wrap") : !E && n.current > 0 && e.clientWidth > n.current + 32 && i(!1);
27
+ const W = e.hasAttribute("data-nvr-header-wrap");
28
+ !W && e.scrollWidth > e.clientWidth + 2 ? (o.current = e.scrollWidth, e.setAttribute("data-nvr-header-wrap", "")) : W && e.clientWidth > o.current + 32 ? e.removeAttribute("data-nvr-header-wrap") : !W && n.current > 0 && e.clientWidth > n.current + 32 && i(!1);
29
29
  };
30
- f();
31
- const w = new ResizeObserver(f);
32
- w.observe(e);
33
- const p = (C = t.current) == null ? void 0 : C.parentElement;
34
- return p && p !== e && w.observe(p), () => w.disconnect();
35
- }), _(() => {
30
+ p();
31
+ const x = new ResizeObserver(p);
32
+ x.observe(e);
33
+ const h = (N = t.current) == null ? void 0 : N.parentElement;
34
+ h && h !== e && x.observe(h);
35
+ let g = 0;
36
+ const k = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
37
+ g || (g = requestAnimationFrame(() => {
38
+ g = 0, p();
39
+ }));
40
+ });
41
+ return k == null || k.observe(e, { childList: !0, subtree: !0 }), () => {
42
+ x.disconnect(), k == null || k.disconnect(), g && cancelAnimationFrame(g);
43
+ };
44
+ }), y(() => {
36
45
  if (!s) return;
37
- const e = (f) => {
38
- f.key !== "Escape" || !B(f, t.current) || (f.stopPropagation(), l(!1));
46
+ const e = (p) => {
47
+ p.key !== "Escape" || !O(p, t.current) || (p.stopPropagation(), l(!1));
39
48
  };
40
49
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
41
- }, [s]), _(() => {
50
+ }, [s]), y(() => {
42
51
  if (!s) return;
43
- const e = (w) => {
44
- const p = w.target;
45
- if (p.closest("[data-nvr-header-tools-panel]") || p.closest("[data-nvr-header-tools-btn]") || p.closest("[data-nvr-header-menu-panel]") || p.closest("[data-radix-popper-content-wrapper]"))
52
+ const e = (x) => {
53
+ const h = x.target;
54
+ if (h.closest("[data-nvr-header-tools-panel]") || h.closest("[data-nvr-header-tools-btn]") || h.closest("[data-nvr-header-menu-panel]") || h.closest("[data-radix-popper-content-wrapper]"))
46
55
  return;
47
- const k = p.closest('[role="dialog"]');
48
- k && !k.contains(t.current) || l(!1);
49
- }, f = (w) => {
50
- w.target.closest("[data-nvr-header-menu-panel] [data-nvr-menu-close]") && l(!1);
56
+ const g = h.closest('[role="dialog"]');
57
+ g && !g.contains(t.current) || l(!1);
58
+ }, p = (x) => {
59
+ x.target.closest("[data-nvr-header-menu-panel] [data-nvr-menu-close]") && l(!1);
51
60
  };
52
- return window.addEventListener("mousedown", e, !0), window.addEventListener("click", f), () => {
53
- window.removeEventListener("mousedown", e, !0), window.removeEventListener("click", f);
61
+ return window.addEventListener("mousedown", e, !0), window.addEventListener("click", p), () => {
62
+ window.removeEventListener("mousedown", e, !0), window.removeEventListener("click", p);
54
63
  };
55
64
  }, [s]), !a)
56
- return /* @__PURE__ */ v("div", { ref: t, className: "contents", "data-nvr-header-tools": "inline", children: c });
57
- const r = s ? (g = d.current) == null ? void 0 : g.getBoundingClientRect() : void 0, h = ((x = d.current) == null ? void 0 : x.closest('[role="dialog"]')) ?? document.body, m = r ? r.right - (h === document.body ? 0 : h.getBoundingClientRect().left) - 16 : 440;
58
- return /* @__PURE__ */ W("div", { ref: t, className: "flex shrink-0 items-center", "data-nvr-header-tools": "folded", children: [
59
- /* @__PURE__ */ v(
65
+ return /* @__PURE__ */ w("div", { ref: t, className: "contents", "data-nvr-header-tools": "inline", children: c });
66
+ const r = s ? (m = d.current) == null ? void 0 : m.getBoundingClientRect() : void 0, f = ((_ = d.current) == null ? void 0 : _.closest('[role="dialog"]')) ?? document.body, b = r ? r.right - (f === document.body ? 0 : f.getBoundingClientRect().left) - 16 : 440;
67
+ return /* @__PURE__ */ M("div", { ref: t, className: "flex shrink-0 items-center", "data-nvr-header-tools": "folded", children: [
68
+ /* @__PURE__ */ w(
60
69
  "button",
61
70
  {
62
71
  ref: d,
@@ -66,44 +75,44 @@ function D({ children: c }) {
66
75
  "aria-label": "More tools",
67
76
  "data-tip": "More tools",
68
77
  onClick: () => l((e) => !e),
69
- className: y(
78
+ className: R(
70
79
  "inline-flex h-9 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground dark:bg-transparent dark:hover:bg-accent",
71
80
  s && "bg-accent text-accent-foreground dark:bg-accent"
72
81
  ),
73
- children: /* @__PURE__ */ v(N, { className: "h-4 w-4" })
82
+ children: /* @__PURE__ */ w(B, { className: "h-4 w-4" })
74
83
  }
75
84
  ),
76
- s && r && L(
77
- /* @__PURE__ */ v(
85
+ s && r && z(
86
+ /* @__PURE__ */ w(
78
87
  "div",
79
88
  {
80
89
  "data-nvr-header-tools-panel": !0,
81
- style: h === document.body ? {
90
+ style: f === document.body ? {
82
91
  position: "fixed",
83
92
  top: r.bottom + 6,
84
93
  right: Math.max(8, window.innerWidth - r.right),
85
- maxWidth: Math.min(440, m),
94
+ maxWidth: Math.min(440, b),
86
95
  zIndex: 110
87
96
  } : {
88
97
  position: "absolute",
89
- top: r.bottom - h.getBoundingClientRect().top + 6,
90
- right: Math.max(8, h.getBoundingClientRect().right - r.right),
91
- maxWidth: Math.min(440, m),
98
+ top: r.bottom - f.getBoundingClientRect().top + 6,
99
+ right: Math.max(8, f.getBoundingClientRect().right - r.right),
100
+ maxWidth: Math.min(440, b),
92
101
  zIndex: 110
93
102
  },
94
103
  className: "flex flex-wrap items-center justify-end gap-1.5 rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card [&_[data-nvr-header-tool-group]]:h-auto [&_[data-nvr-header-tool-group]]:min-h-9 [&_[data-nvr-header-tool-group]]:max-w-full [&_[data-nvr-header-tool-group]]:shrink [&_[data-nvr-header-tool-group]]:flex-wrap",
95
104
  children: c
96
105
  }
97
106
  ),
98
- h
107
+ f
99
108
  )
100
109
  ] });
101
110
  }
102
- function P(c, t) {
103
- const [d, a] = R(!1), i = b(!1);
111
+ function T(c, t) {
112
+ const [d, a] = E(!1), i = v(!1);
104
113
  i.current = d;
105
- const u = b(0);
106
- return _(() => {
114
+ const u = v(0);
115
+ return y(() => {
107
116
  const n = c.current, o = n == null ? void 0 : n.closest("[data-nvr-header-row]");
108
117
  if (!t || !n || !o) {
109
118
  !t && i.current && a(!1);
@@ -125,34 +134,34 @@ function P(c, t) {
125
134
  return l.observe(o), n.parentElement && n.parentElement !== o && l.observe(n.parentElement), () => l.disconnect();
126
135
  }), d;
127
136
  }
128
- const z = 240;
129
- function M(c, t) {
130
- return Math.max(8, Math.min(c, t - z - 8));
137
+ const A = 240;
138
+ function L(c, t) {
139
+ return Math.max(8, Math.min(c, t - A - 8));
131
140
  }
132
- function T({
141
+ function q({
133
142
  children: c,
134
143
  label: t = "More",
135
144
  className: d
136
145
  }) {
137
146
  var s, l;
138
- const a = b(null), [i, u] = R(!1);
139
- _(() => {
147
+ const a = v(null), [i, u] = E(!1);
148
+ y(() => {
140
149
  if (!i) return;
141
- const r = (m) => {
142
- var x;
143
- const g = m.target;
144
- g.closest("[data-nvr-header-menu-panel]") || g.closest("[data-nvr-header-menu-btn]") || g.closest("[data-radix-popper-content-wrapper]") || // A dialog opened from a menu row, not one hosting the form.
145
- g.closest('[role="dialog"]') && !((x = g.closest('[role="dialog"]')) != null && x.contains(a.current)) || u(!1);
146
- }, h = (m) => {
147
- m.key !== "Escape" || !B(m, a.current) || (m.stopPropagation(), u(!1));
150
+ const r = (b) => {
151
+ var _;
152
+ const m = b.target;
153
+ m.closest("[data-nvr-header-menu-panel]") || m.closest("[data-nvr-header-menu-btn]") || m.closest("[data-radix-popper-content-wrapper]") || // A dialog opened from a menu row, not one hosting the form.
154
+ m.closest('[role="dialog"]') && !((_ = m.closest('[role="dialog"]')) != null && _.contains(a.current)) || u(!1);
155
+ }, f = (b) => {
156
+ b.key !== "Escape" || !O(b, a.current) || (b.stopPropagation(), u(!1));
148
157
  };
149
- return window.addEventListener("mousedown", r, !0), window.addEventListener("keydown", h, !0), () => {
150
- window.removeEventListener("mousedown", r, !0), window.removeEventListener("keydown", h, !0);
158
+ return window.addEventListener("mousedown", r, !0), window.addEventListener("keydown", f, !0), () => {
159
+ window.removeEventListener("mousedown", r, !0), window.removeEventListener("keydown", f, !0);
151
160
  };
152
161
  }, [i]);
153
162
  const n = i ? (s = a.current) == null ? void 0 : s.getBoundingClientRect() : void 0, o = ((l = a.current) == null ? void 0 : l.closest('[role="dialog"]')) ?? document.body;
154
- return /* @__PURE__ */ W("div", { className: y("relative shrink-0", d), children: [
155
- /* @__PURE__ */ W(
163
+ return /* @__PURE__ */ M("div", { className: R("relative shrink-0", d), children: [
164
+ /* @__PURE__ */ M(
156
165
  "button",
157
166
  {
158
167
  ref: a,
@@ -163,18 +172,18 @@ function T({
163
172
  "aria-label": t,
164
173
  "data-tip": "More actions",
165
174
  onClick: () => u((r) => !r),
166
- className: y(
175
+ className: R(
167
176
  "inline-flex h-9 items-center gap-1 rounded-md border border-input bg-background px-2.5 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground dark:bg-transparent dark:hover:bg-accent",
168
177
  i && "bg-accent text-accent-foreground dark:bg-accent"
169
178
  ),
170
179
  children: [
171
- /* @__PURE__ */ v(N, { className: "h-4 w-4" }),
172
- /* @__PURE__ */ v("span", { className: "hidden lg:inline", children: t })
180
+ /* @__PURE__ */ w(B, { className: "h-4 w-4" }),
181
+ /* @__PURE__ */ w("span", { className: "hidden lg:inline", children: t })
173
182
  ]
174
183
  }
175
184
  ),
176
- i && n && L(
177
- /* @__PURE__ */ v(
185
+ i && n && z(
186
+ /* @__PURE__ */ w(
178
187
  "div",
179
188
  {
180
189
  "data-nvr-header-menu-panel": !0,
@@ -185,18 +194,18 @@ function T({
185
194
  style: o === document.body ? {
186
195
  position: "fixed",
187
196
  top: n.bottom + 6,
188
- right: M(window.innerWidth - n.right, window.innerWidth),
197
+ right: L(window.innerWidth - n.right, window.innerWidth),
189
198
  zIndex: 110
190
199
  } : {
191
200
  position: "absolute",
192
201
  top: n.bottom - o.getBoundingClientRect().top + 6,
193
- right: M(
202
+ right: L(
194
203
  o.getBoundingClientRect().right - n.right,
195
204
  o.getBoundingClientRect().width
196
205
  ),
197
206
  zIndex: 110
198
207
  },
199
- className: y(
208
+ className: R(
200
209
  "flex w-[240px] flex-col gap-px rounded-lg border border-slate-200 bg-white p-1 shadow-xl dark:border-border dark:bg-card",
201
210
  "[&_button]:h-8 [&_button]:w-full [&_button]:justify-start [&_button]:gap-2 [&_button]:rounded-sm [&_button]:border-0 [&_button]:bg-transparent [&_button]:px-2 [&_button]:text-[12.5px] [&_button]:font-medium [&_button]:shadow-none",
202
211
  "[&_button:hover]:bg-accent [&_button:hover]:text-accent-foreground [&_button_svg]:h-3.5 [&_button_svg]:w-3.5 [&_button_svg]:shrink-0 [&_button_svg]:text-slate-500",
@@ -209,15 +218,15 @@ function T({
209
218
  )
210
219
  ] });
211
220
  }
212
- function F({
221
+ function K({
213
222
  children: c,
214
223
  className: t
215
224
  }) {
216
- return /* @__PURE__ */ v(
225
+ return /* @__PURE__ */ w(
217
226
  "div",
218
227
  {
219
228
  "data-nvr-header-tool-group": !0,
220
- className: y(
229
+ className: R(
221
230
  "inline-flex h-9 shrink-0 items-center rounded-md border border-input bg-background px-0.5 shadow-sm [&>*+*]:border-l [&>*+*]:border-input/70",
222
231
  t
223
232
  ),
@@ -226,9 +235,9 @@ function F({
226
235
  );
227
236
  }
228
237
  export {
229
- T as HeaderMenu,
230
- F as HeaderToolGroup,
231
- D as HeaderTools,
232
- M as menuRight,
233
- P as useHeaderFold
238
+ q as HeaderMenu,
239
+ K as HeaderToolGroup,
240
+ P as HeaderTools,
241
+ L as menuRight,
242
+ T as useHeaderFold
234
243
  };