@nivaro/react 0.3.49 → 0.3.51

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 (46) hide show
  1. package/dist/components/InlineGridField.js +166 -105
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +38 -4
  5. package/dist/shared/components/ItemEditForm.js +5258 -5034
  6. package/dist/shared/components/QueryTable.js +489 -347
  7. package/dist/shared/components/ReportView.js +105 -99
  8. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  9. package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
  10. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  11. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  12. package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
  13. package/dist/shared/components/item-edit/FieldRow.js +402 -370
  14. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  15. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  16. package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
  17. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  18. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  19. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  20. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  22. package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
  23. package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
  24. package/dist/shared/components/item-edit/UserChip.js +233 -200
  25. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  26. package/dist/shared/components/item-edit/header-midair.js +51 -0
  27. package/dist/shared/components/item-edit/helpers.js +181 -155
  28. package/dist/shared/components/item-edit/line-midair.js +207 -0
  29. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  30. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  31. package/dist/shared/components/panels/CommentPanel.js +290 -284
  32. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  33. package/dist/shared/components/panels/PipelinePanel.js +1241 -992
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  35. package/dist/shared/components/panels/TaskPanel.js +71 -61
  36. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  37. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  38. package/dist/shared/components/queue/QueueWorklist.js +925 -871
  39. package/dist/shared/components/queue/column-chooser.js +21 -0
  40. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  41. package/dist/shared/components/ui/number-draft-input.js +93 -0
  42. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  43. package/dist/shared/lib/draft-store.js +48 -34
  44. package/dist/shared/lib/error-hints.js +1 -0
  45. package/dist/shared/lib/query-stats.js +60 -60
  46. package/package.json +1 -1
@@ -1,114 +1,138 @@
1
1
  import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
- import { useQuery as P } from "@tanstack/react-query";
3
- import { UserCheck as S, Mail as U, Phone as q, Building2 as D, User as $, Clock as z, MessageCircle as F, ExternalLink as K, RefreshCw as W, LogOut as H } from "lucide-react";
4
- import R, { useState as O, useRef as C, useEffect as B } from "react";
5
- import { createPortal as J } from "react-dom";
6
- import { useOptionalNivaroClient as T, useNavigation as Q, useItemEditAuth as Z } from "../../context.js";
7
- import { get as L, post as V } from "../../lib/commands.js";
8
- import { userCardQuery as G } from "../../lib/user-cards.js";
2
+ import { useQuery as C } from "@tanstack/react-query";
3
+ import { UserCheck as U, Mail as q, Phone as D, Building2 as F, User as O, Clock as z, MessageCircle as K, ExternalLink as W, RefreshCw as H, LogOut as J } from "lucide-react";
4
+ import R, { useState as P, useRef as N, useEffect as $ } from "react";
5
+ import { createPortal as Z } from "react-dom";
6
+ import { useOptionalNivaroClient as S, useNavigation as V, useItemEditAuth as G } from "../../context.js";
7
+ import { get as B, post as X } from "../../lib/commands.js";
8
+ import { userCardQuery as L } from "../../lib/user-cards.js";
9
9
  import { cn as j } from "../../lib/utils.js";
10
- import { canOpenDm as X, openDmWith as Y } from "../chat/chat-core.js";
11
- import { HuddlePresenceLine as A } from "../chat/huddle/HuddleLiveBadge.js";
12
- import { useHuddleLive as I } from "../chat/huddle/huddle-live.js";
10
+ import { canOpenDm as Y, openDmWith as A } from "../chat/chat-core.js";
11
+ import { HuddlePresenceLine as I } from "../chat/huddle/HuddleLiveBadge.js";
12
+ import { useHuddleLive as Q } from "../chat/huddle/huddle-live.js";
13
13
  import { MailSuppressedPill as ee } from "../profile/MailSuppressedPill.js";
14
14
  import { useReloadTheirTabs as te, useSignOutEverywhere as ae } from "../profile/session-actions.js";
15
15
  import { useCardPresence as ne } from "../profile/usePersonPresence.js";
16
16
  import { UserAvatar as _ } from "../UserAvatar.js";
17
17
  import { Popover as re, PopoverTrigger as le, PopoverContent as se } from "../ui/popover.js";
18
- function E(e, r, i) {
19
- const s = C(r);
20
- s.current = r;
21
- const d = C(i);
22
- d.current = i, B(() => {
18
+ function E(e, n, r) {
19
+ const s = N(n);
20
+ s.current = n;
21
+ const d = N(r);
22
+ d.current = r, $(() => {
23
23
  if (!e) return;
24
- const o = (n) => {
25
- const f = n.target;
24
+ const c = (a) => {
25
+ const f = a.target;
26
26
  f && s.current(f) || d.current();
27
27
  }, m = () => d.current();
28
- return document.addEventListener("pointerdown", o, !0), window.addEventListener("blur", m), () => {
29
- document.removeEventListener("pointerdown", o, !0), window.removeEventListener("blur", m);
28
+ return document.addEventListener("pointerdown", c, !0), window.addEventListener("blur", m), () => {
29
+ document.removeEventListener("pointerdown", c, !0), window.removeEventListener("blur", m);
30
30
  };
31
31
  }, [e]);
32
32
  }
33
- function ie({
33
+ function ie(e) {
34
+ const n = String(e ?? "").trim();
35
+ return !n || /^redacted\b/i.test(n) ? "" : n.split(/\s+/).map((r) => r[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
36
+ }
37
+ function oe(e, n) {
38
+ const r = String(e ?? "").trim();
39
+ return r || [n == null ? void 0 : n.first_name, n == null ? void 0 : n.last_name].filter(Boolean).join(" ").trim();
40
+ }
41
+ function de({
42
+ user: e,
43
+ avatarCls: n
44
+ }) {
45
+ const r = S(), { data: s } = C({
46
+ ...L(r, e.id),
47
+ enabled: !!r && !!e.id && !String(e.name ?? "").trim(),
48
+ staleTime: 30 * 6e4,
49
+ retry: !1
50
+ }), d = oe(e.name, s), c = ie(d), m = /^redacted\b/i.test(d);
51
+ return /* @__PURE__ */ t(
52
+ "span",
53
+ {
54
+ className: "inline-flex",
55
+ "data-tip": m ? "Former user (account redacted)" : d || void 0,
56
+ children: /* @__PURE__ */ t(
57
+ _,
58
+ {
59
+ userId: e.id,
60
+ className: "h-6 w-6 border-2 border-white dark:border-slate-900",
61
+ fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: n, children: c || /* @__PURE__ */ t(O, { className: "h-3 w-3", "aria-hidden": !0 }) })
62
+ }
63
+ )
64
+ }
65
+ );
66
+ }
67
+ function ce({
34
68
  users: e,
35
- showSingleName: r = !0
69
+ showSingleName: n = !0
36
70
  }) {
37
- const i = C(null), s = C(null), d = C(null), [o, m] = O(null), [n, f] = O({ x: 0, y: 0 }), g = () => {
71
+ const r = N(null), s = N(null), d = N(null), [c, m] = P(null), [a, f] = P({ x: 0, y: 0 }), b = () => {
38
72
  d.current && clearTimeout(d.current), d.current = null;
39
- }, u = (a) => {
40
- var h;
41
- g();
42
- const p = (h = i.current) == null ? void 0 : h.getBoundingClientRect();
43
- p && f({ x: p.left, y: p.bottom + 6 }), m((x) => x === "pin" ? "pin" : a);
73
+ }, u = (i) => {
74
+ var x;
75
+ b();
76
+ const o = (x = r.current) == null ? void 0 : x.getBoundingClientRect();
77
+ o && f({ x: o.left, y: o.bottom + 6 }), m((h) => h === "pin" ? "pin" : i);
44
78
  }, y = () => {
45
- g(), d.current = setTimeout(() => m((a) => a === "pin" ? a : null), 160);
79
+ b(), d.current = setTimeout(() => m((i) => i === "pin" ? i : null), 160);
46
80
  };
47
- R.useLayoutEffect(() => {
48
- var b;
49
- if (!o) return;
50
- const a = s.current;
51
- if (!a) return;
52
- const p = a.getBoundingClientRect();
53
- let { x: h, y: x } = n;
54
- if (p.right > window.innerWidth - 8 && (h = Math.max(8, window.innerWidth - p.width - 8)), p.bottom > window.innerHeight - 8) {
55
- const k = (b = i.current) == null ? void 0 : b.getBoundingClientRect();
56
- x = Math.max(8, ((k == null ? void 0 : k.top) ?? x) - p.height - 6);
81
+ if (R.useLayoutEffect(() => {
82
+ var w;
83
+ if (!c) return;
84
+ const i = s.current;
85
+ if (!i) return;
86
+ const o = i.getBoundingClientRect();
87
+ let { x, y: h } = a;
88
+ if (o.right > window.innerWidth - 8 && (x = Math.max(8, window.innerWidth - o.width - 8)), o.bottom > window.innerHeight - 8) {
89
+ const g = (w = r.current) == null ? void 0 : w.getBoundingClientRect();
90
+ h = Math.max(8, ((g == null ? void 0 : g.top) ?? h) - o.height - 6);
57
91
  }
58
- (h !== n.x || x !== n.y) && f({ x: h, y: x });
59
- }, [o, n]), E(
60
- !!o,
61
- (a) => {
62
- var p, h, x;
92
+ (x !== a.x || h !== a.y) && f({ x, y: h });
93
+ }, [c, a]), E(
94
+ !!c,
95
+ (i) => {
96
+ var o, x, h;
63
97
  return (
64
98
  // Clicks inside the user-card popover (portaled by Radix) keep the
65
99
  // roster mounted — closing would unmount the card mid-click.
66
- !!((p = a.closest) != null && p.call(a, "[data-radix-popper-content-wrapper]")) || !!((h = s.current) != null && h.contains(a)) || !!((x = i.current) != null && x.contains(a))
100
+ !!((o = i.closest) != null && o.call(i, "[data-radix-popper-content-wrapper]")) || !!((x = s.current) != null && x.contains(i)) || !!((h = r.current) != null && h.contains(i))
67
101
  );
68
102
  },
69
103
  () => m(null)
70
- );
71
- const c = (a) => a.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
72
- if (e.length === 0)
104
+ ), e.length === 0)
73
105
  return /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", "data-roster-empty": !0, children: "—" });
74
- const w = e.slice(0, 4), v = e.length - w.length, N = "flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-[#c7f0fb] text-[10px] font-bold leading-none text-[#04516b] dark:border-slate-900 dark:bg-[#0c3b4a] dark:text-[#7dd8f2]";
106
+ const p = e.slice(0, 4), v = e.length - p.length, k = "flex h-6 w-6 items-center justify-center rounded-full border-2 border-white bg-[#c7f0fb] text-[10px] font-bold leading-none text-[#04516b] dark:border-slate-900 dark:bg-[#0c3b4a] dark:text-[#7dd8f2]";
75
107
  return /* @__PURE__ */ l(
76
108
  "span",
77
109
  {
78
- ref: i,
110
+ ref: r,
79
111
  onMouseEnter: () => u("hover"),
80
112
  onMouseLeave: y,
81
- onClick: (a) => {
82
- a.stopPropagation(), u("pin");
113
+ onClick: (i) => {
114
+ i.stopPropagation(), u("pin");
83
115
  },
84
116
  className: "inline-flex cursor-pointer items-center",
85
117
  children: [
86
- /* @__PURE__ */ t("span", { className: "flex -space-x-2", children: w.map((a) => /* @__PURE__ */ t(
87
- _,
88
- {
89
- userId: a.id,
90
- className: "h-6 w-6 border-2 border-white dark:border-slate-900",
91
- fallback: /* @__PURE__ */ t("span", { "data-copy-skip": !0, "aria-hidden": "true", className: N, children: c(a.name) })
92
- },
93
- a.id
94
- )) }),
118
+ /* @__PURE__ */ t("span", { className: "flex -space-x-2", children: p.map((i) => /* @__PURE__ */ t(de, { user: i, avatarCls: k }, i.id)) }),
95
119
  v > 0 && /* @__PURE__ */ l("span", { className: "ml-1 rounded-full bg-slate-200 px-1.5 py-0.5 text-[10.5px] font-bold leading-none text-slate-600 dark:bg-slate-700 dark:text-slate-300", children: [
96
120
  "+",
97
121
  v
98
122
  ] }),
99
- r && e.length === 1 && /* @__PURE__ */ t("span", { className: "ml-1.5 max-w-[130px] truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e[0].name }),
100
- o && J(
123
+ n && e.length === 1 && /* @__PURE__ */ t("span", { className: "ml-1.5 max-w-[130px] truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e[0].name }),
124
+ c && Z(
101
125
  /* @__PURE__ */ l(
102
126
  "div",
103
127
  {
104
128
  ref: s,
105
- style: oe(i.current, n),
106
- onMouseEnter: g,
129
+ style: me(r.current, a),
130
+ onMouseEnter: b,
107
131
  onMouseLeave: y,
108
- onMouseDown: (a) => {
109
- a.stopPropagation(), m("pin");
132
+ onMouseDown: (i) => {
133
+ i.stopPropagation(), m("pin");
110
134
  },
111
- onClick: (a) => a.stopPropagation(),
135
+ onClick: (i) => i.stopPropagation(),
112
136
  className: "w-max min-w-[190px] max-w-[300px] rounded-lg border border-slate-200 bg-white py-1.5 shadow-xl dark:border-slate-600 dark:bg-slate-800",
113
137
  children: [
114
138
  /* @__PURE__ */ l("p", { className: "px-3 pb-1 text-[10px] font-bold uppercase tracking-wide text-slate-400", children: [
@@ -116,11 +140,11 @@ function ie({
116
140
  " user",
117
141
  e.length === 1 ? "" : "s"
118
142
  ] }),
119
- e.map((a) => /* @__PURE__ */ t("div", { className: "flex px-2 py-0.5", children: /* @__PURE__ */ t(me, { userId: a.id, size: "compact" }) }, a.id))
143
+ e.map((i) => /* @__PURE__ */ t("div", { className: "flex px-2 py-0.5", children: /* @__PURE__ */ t(xe, { userId: i.id, size: "compact" }) }, i.id))
120
144
  ]
121
145
  }
122
146
  ),
123
- M(i.current)
147
+ M(r.current)
124
148
  )
125
149
  ]
126
150
  }
@@ -129,43 +153,50 @@ function ie({
129
153
  function M(e) {
130
154
  return (e == null ? void 0 : e.closest('[role="dialog"]')) ?? document.body;
131
155
  }
132
- function oe(e, r) {
133
- const i = M(e);
134
- if (i === document.body) return { position: "fixed", left: r.x, top: r.y, zIndex: 50 };
135
- const s = i.getBoundingClientRect();
136
- return { position: "absolute", left: r.x - s.left, top: r.y - s.top, zIndex: 120 };
156
+ function me(e, n) {
157
+ const r = M(e);
158
+ if (r === document.body) return { position: "fixed", left: n.x, top: n.y, zIndex: 50 };
159
+ const s = r.getBoundingClientRect();
160
+ return { position: "absolute", left: n.x - s.left, top: n.y - s.top, zIndex: 120 };
137
161
  }
138
- function Te({
162
+ function $e({
139
163
  collection: e,
140
- itemId: r
164
+ itemId: n
141
165
  }) {
142
- const i = T(), { data: s = [], isLoading: d } = P({
143
- queryKey: ["pipeline-owners-resolved", e, r],
144
- queryFn: () => i.request(
145
- V(`/pipelines/instance/${e}/owners/batch`, { ids: [r] })
146
- ).then((o) => {
147
- var m;
148
- return ((m = o.data) == null ? void 0 : m[r]) ?? [];
166
+ const r = S(), {
167
+ data: s = [],
168
+ isLoading: d,
169
+ isFetching: c
170
+ } = C({
171
+ queryKey: ["pipeline-owners-resolved", e, n],
172
+ queryFn: () => r.request(
173
+ X(`/pipelines/instance/${e}/owners/batch`, { ids: [n] })
174
+ ).then((m) => {
175
+ var a;
176
+ return ((a = m.data) == null ? void 0 : a[n]) ?? [];
149
177
  }),
150
- enabled: !!i && !!e && !!r && r !== "new",
151
- staleTime: 3e4
178
+ enabled: !!r && !!e && !!n && n !== "new",
179
+ staleTime: 3e4,
180
+ // Keep this RECORD's last answer while a move re-asks (the tile used to go
181
+ // blank for ~2 s after Submit) — never another record's (b01-N15).
182
+ placeholderData: (m, a) => (a == null ? void 0 : a.queryKey[1]) === e && String(a == null ? void 0 : a.queryKey[2]) === String(n) ? m : void 0
152
183
  });
153
- return d ? /* @__PURE__ */ t("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" }) : /* @__PURE__ */ t(ie, { users: s });
184
+ return d || c && s.length === 0 ? /* @__PURE__ */ t("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" }) : /* @__PURE__ */ t(ce, { users: s });
154
185
  }
155
- function $e({
186
+ function Be({
156
187
  collection: e,
157
- itemId: r,
158
- label: i
188
+ itemId: n,
189
+ label: r
159
190
  }) {
160
- const s = T(), { data: d = [] } = P({
161
- queryKey: ["pipeline-instance-owners", e, r],
162
- queryFn: () => s.request(L(`/pipelines/instance/${e}/${r}/owners`)).then((n) => n.data ?? []),
163
- enabled: !!s && !!e && !!r && r !== "new",
191
+ const s = S(), { data: d = [] } = C({
192
+ queryKey: ["pipeline-instance-owners", e, n],
193
+ queryFn: () => s.request(B(`/pipelines/instance/${e}/${n}/owners`)).then((a) => a.data ?? []),
194
+ enabled: !!s && !!e && !!n && n !== "new",
164
195
  staleTime: 3e4
165
- }), o = (n) => [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email, m = (n) => o(n).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
196
+ }), c = (a) => [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email, m = (a) => c(a).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
166
197
  return /* @__PURE__ */ l("div", { children: [
167
- /* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-slate-400 mb-1.5", children: i }),
168
- d.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: d.map((n) => /* @__PURE__ */ l(
198
+ /* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-slate-400 mb-1.5", children: r }),
199
+ d.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: d.map((a) => /* @__PURE__ */ l(
169
200
  "div",
170
201
  {
171
202
  className: "flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5",
@@ -173,49 +204,49 @@ function $e({
173
204
  /* @__PURE__ */ t(
174
205
  _,
175
206
  {
176
- userId: n.id,
207
+ userId: a.id,
177
208
  className: "h-6 w-6",
178
- fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: m(n) })
209
+ fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: m(a) })
179
210
  }
180
211
  ),
181
- /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700", children: o(n) })
212
+ /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700", children: c(a) })
182
213
  ]
183
214
  },
184
- n.id
215
+ a.id
185
216
  )) })
186
217
  ] });
187
218
  }
188
- function de({
219
+ function pe({
189
220
  user: e,
190
- userId: r,
191
- initials: i,
221
+ userId: n,
222
+ initials: r,
192
223
  navigate: s,
193
224
  profileUrl: d,
194
- online: o,
225
+ online: c,
195
226
  cardId: m,
196
- onAction: n,
227
+ onAction: a,
197
228
  open: f = !1
198
229
  }) {
199
230
  var h;
200
- const { isAdmin: g, userId: u } = Z(), y = !!u && u.toUpperCase() === r.toUpperCase(), c = ne(r, f), w = I().roomOf(r), v = ((h = e == null ? void 0 : e.manager_name) == null ? void 0 : h.trim()) || null, N = (() => {
201
- const x = e == null ? void 0 : e.timezone;
202
- if (!x) return null;
231
+ const { isAdmin: b, userId: u } = G(), y = !!u && u.toUpperCase() === n.toUpperCase(), p = ne(n, f), v = Q().roomOf(n), k = ((h = e == null ? void 0 : e.manager_name) == null ? void 0 : h.trim()) || null, i = (() => {
232
+ const w = e == null ? void 0 : e.timezone;
233
+ if (!w) return null;
203
234
  try {
204
- const b = Intl.DateTimeFormat().resolvedOptions().timeZone;
205
- return x === b ? null : new Intl.DateTimeFormat(void 0, {
235
+ const g = Intl.DateTimeFormat().resolvedOptions().timeZone;
236
+ return w === g ? null : new Intl.DateTimeFormat(void 0, {
206
237
  hour: "numeric",
207
238
  minute: "2-digit",
208
- timeZone: x
239
+ timeZone: w
209
240
  }).format(/* @__PURE__ */ new Date());
210
241
  } catch {
211
242
  return null;
212
243
  }
213
- })(), p = !!o || !!c.word ? c.word ? null : "Just now" : e != null && e.last_access ? (() => {
214
- const x = Date.now() - new Date(e.last_access).getTime(), b = Math.floor(x / 6e4);
215
- if (b < 2) return "Just now";
216
- if (b < 60) return `${b}m ago`;
217
- const k = Math.floor(b / 60);
218
- return k < 24 ? `${k}h ago` : `${Math.floor(k / 24)}d ago`;
244
+ })(), x = !!c || !!p.word ? p.word ? null : "Just now" : e != null && e.last_access ? (() => {
245
+ const w = Date.now() - new Date(e.last_access).getTime(), g = Math.floor(w / 6e4);
246
+ if (g < 2) return "Just now";
247
+ if (g < 60) return `${g}m ago`;
248
+ const T = Math.floor(g / 60);
249
+ return T < 24 ? `${T}h ago` : `${Math.floor(T / 24)}d ago`;
219
250
  })() : null;
220
251
  return /* @__PURE__ */ l(
221
252
  se,
@@ -228,25 +259,25 @@ function de({
228
259
  /* @__PURE__ */ t(
229
260
  _,
230
261
  {
231
- userId: r,
262
+ userId: n,
232
263
  className: "h-12 w-12 ring-2 ring-white shadow-sm dark:ring-card",
233
- fallback: /* @__PURE__ */ t("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[15px] font-bold text-nvr-navy dark:text-nvr-cyan ring-2 ring-white dark:ring-card shadow-sm", children: i })
264
+ fallback: /* @__PURE__ */ t("span", { className: "flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[15px] font-bold text-nvr-navy dark:text-nvr-cyan ring-2 ring-white dark:ring-card shadow-sm", children: r })
234
265
  }
235
266
  ),
236
267
  /* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
237
268
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
238
- (o || c.word) && /* @__PURE__ */ t(
269
+ (c || p.word) && /* @__PURE__ */ t(
239
270
  "span",
240
271
  {
241
- "data-card-presence": c.word ?? "online",
272
+ "data-card-presence": p.word ?? "online",
242
273
  className: j(
243
274
  "h-2 w-2 shrink-0 rounded-full ring-2 ring-white dark:ring-card",
244
- c.word === "away" ? "bg-white ring-amber-400 dark:bg-card" : c.word === "idle" ? "bg-amber-400" : "bg-emerald-400"
275
+ p.word === "away" ? "bg-white ring-amber-400 dark:bg-card" : p.word === "idle" ? "bg-amber-400" : "bg-emerald-400"
245
276
  ),
246
- title: c.word === "away" ? "Away" : c.word === "idle" ? "Idle" : "Online"
277
+ title: p.word === "away" ? "Away" : p.word === "idle" ? "Idle" : "Online"
247
278
  }
248
279
  ),
249
- /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100 truncate", children: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : r }),
280
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100 truncate", children: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : n }),
250
281
  (e == null ? void 0 : e.status) && e.status !== "active" && /* @__PURE__ */ t(
251
282
  "span",
252
283
  {
@@ -256,24 +287,24 @@ function de({
256
287
  )
257
288
  ] }),
258
289
  ((e == null ? void 0 : e.title) || (e == null ? void 0 : e.department)) && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-500 dark:text-slate-400 truncate mt-0.5", children: [e.title, e.department].filter(Boolean).join(" · ") }),
259
- c.word && /* @__PURE__ */ l(
290
+ p.word && /* @__PURE__ */ l(
260
291
  "p",
261
292
  {
262
293
  className: "mt-0.5 truncate text-[11px] text-slate-500 dark:text-slate-400",
263
294
  "data-card-presence-line": !0,
264
295
  children: [
265
- c.word === "away" ? "Away" : c.word === "idle" ? `Idle${c.minutes ? ` · ${c.minutes}m` : ""}` : "Online now",
266
- c.page ? ` · on ${c.page}` : ""
296
+ p.word === "away" ? "Away" : p.word === "idle" ? `Idle${p.minutes ? ` · ${p.minutes}m` : ""}` : "Online now",
297
+ p.page ? ` · on ${p.page}` : ""
267
298
  ]
268
299
  }
269
300
  ),
270
- /* @__PURE__ */ t(A, { label: (w == null ? void 0 : w.label) ?? null, className: "mt-0.5" }),
271
- N && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: [
301
+ /* @__PURE__ */ t(I, { label: (v == null ? void 0 : v.label) ?? null, className: "mt-0.5" }),
302
+ i && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: [
272
303
  "Local time: ",
273
- N
304
+ i
274
305
  ] }),
275
306
  (e == null ? void 0 : e.is_out_of_office) && /* @__PURE__ */ l("span", { className: "mt-1 inline-flex items-center gap-1 rounded-full bg-amber-100 dark:bg-amber-900/30 px-1.5 py-px text-[10px] font-medium text-amber-700 dark:text-amber-400", children: [
276
- /* @__PURE__ */ t(S, { className: "h-2.5 w-2.5" }),
307
+ /* @__PURE__ */ t(U, { className: "h-2.5 w-2.5" }),
277
308
  " Out of office"
278
309
  ] }),
279
310
  /* @__PURE__ */ t(
@@ -281,7 +312,7 @@ function de({
281
312
  {
282
313
  email: e == null ? void 0 : e.email,
283
314
  enabled: f,
284
- canClear: g,
315
+ canClear: b,
285
316
  className: "mt-1"
286
317
  }
287
318
  )
@@ -294,7 +325,7 @@ function de({
294
325
  href: `mailto:${e.email}`,
295
326
  className: "flex items-center gap-2 text-[12px] text-slate-600 dark:text-slate-300 hover:text-nvr-navy dark:hover:text-nvr-cyan transition-colors truncate group",
296
327
  children: [
297
- /* @__PURE__ */ t(U, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 group-hover:text-nvr-cyan transition-colors" }),
328
+ /* @__PURE__ */ t(q, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 group-hover:text-nvr-cyan transition-colors" }),
298
329
  /* @__PURE__ */ t("span", { className: "truncate", children: e.email })
299
330
  ]
300
331
  }
@@ -305,30 +336,30 @@ function de({
305
336
  href: `tel:${e.phone}`,
306
337
  className: "flex items-center gap-2 text-[12px] text-slate-600 dark:text-slate-300 hover:text-nvr-navy dark:hover:text-nvr-cyan transition-colors group",
307
338
  children: [
308
- /* @__PURE__ */ t(q, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 group-hover:text-nvr-cyan transition-colors" }),
339
+ /* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 group-hover:text-nvr-cyan transition-colors" }),
309
340
  /* @__PURE__ */ t("span", { children: e.phone })
310
341
  ]
311
342
  }
312
343
  )
313
344
  ] }),
314
- ((e == null ? void 0 : e.role_name) || v || p) && /* @__PURE__ */ l("div", { className: "px-4 py-3 space-y-1.5 border-b border-slate-100 dark:border-border", children: [
345
+ ((e == null ? void 0 : e.role_name) || k || x) && /* @__PURE__ */ l("div", { className: "px-4 py-3 space-y-1.5 border-b border-slate-100 dark:border-border", children: [
315
346
  (e == null ? void 0 : e.role_name) && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
316
- /* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0" }),
347
+ /* @__PURE__ */ t(F, { className: "h-3.5 w-3.5 shrink-0" }),
317
348
  /* @__PURE__ */ t("span", { children: e.role_name })
318
349
  ] }),
319
- v && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
320
- /* @__PURE__ */ t($, { className: "h-3.5 w-3.5 shrink-0" }),
350
+ k && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
351
+ /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5 shrink-0" }),
321
352
  /* @__PURE__ */ l("span", { children: [
322
353
  "Reports to",
323
354
  " ",
324
- /* @__PURE__ */ t("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: v })
355
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: k })
325
356
  ] })
326
357
  ] }),
327
- p && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-400", children: [
358
+ x && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 text-[11px] text-slate-400", children: [
328
359
  /* @__PURE__ */ t(z, { className: "h-3.5 w-3.5 shrink-0" }),
329
360
  /* @__PURE__ */ l("span", { children: [
330
361
  "Last seen ",
331
- p
362
+ x
332
363
  ] })
333
364
  ] })
334
365
  ] }),
@@ -338,28 +369,28 @@ function de({
338
369
  {
339
370
  type: "button",
340
371
  onClick: () => {
341
- n == null || n(), s(d);
372
+ a == null || a(), s(d);
342
373
  },
343
374
  className: "flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-accent transition-colors",
344
375
  children: [
345
- /* @__PURE__ */ t($, { className: "h-3.5 w-3.5" }),
376
+ /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
346
377
  " View profile"
347
378
  ]
348
379
  }
349
380
  ),
350
- X() && /* @__PURE__ */ l(
381
+ Y() && /* @__PURE__ */ l(
351
382
  "button",
352
383
  {
353
384
  type: "button",
354
385
  onClick: () => {
355
- n == null || n(), Y(
356
- r,
386
+ a == null || a(), A(
387
+ n,
357
388
  e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : void 0
358
389
  );
359
390
  },
360
391
  className: "flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-accent transition-colors",
361
392
  children: [
362
- /* @__PURE__ */ t(F, { className: "h-3.5 w-3.5" }),
393
+ /* @__PURE__ */ t(K, { className: "h-3.5 w-3.5" }),
363
394
  " Message"
364
395
  ]
365
396
  }
@@ -369,40 +400,40 @@ function de({
369
400
  {
370
401
  type: "button",
371
402
  onClick: () => {
372
- n == null || n(), window.location.href = `mailto:${e.email}`;
403
+ a == null || a(), window.location.href = `mailto:${e.email}`;
373
404
  },
374
405
  className: "flex flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1.5 text-[11px] font-medium text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-accent transition-colors",
375
406
  children: [
376
- /* @__PURE__ */ t(K, { className: "h-3.5 w-3.5" }),
407
+ /* @__PURE__ */ t(W, { className: "h-3.5 w-3.5" }),
377
408
  " Email"
378
409
  ]
379
410
  }
380
411
  )
381
412
  ] }),
382
- g && !y && /* @__PURE__ */ t(
383
- ce,
413
+ b && !y && /* @__PURE__ */ t(
414
+ fe,
384
415
  {
385
- userId: r,
386
- name: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : r,
387
- onDone: n
416
+ userId: n,
417
+ name: e ? [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email : n,
418
+ onDone: a
388
419
  }
389
420
  )
390
421
  ]
391
422
  }
392
423
  );
393
424
  }
394
- function ce({
425
+ function fe({
395
426
  userId: e,
396
- name: r,
397
- onDone: i
427
+ name: n,
428
+ onDone: r
398
429
  }) {
399
- const [s, d] = O(!1);
400
- B(() => {
430
+ const [s, d] = P(!1);
431
+ $(() => {
401
432
  if (!s) return;
402
433
  const f = setTimeout(() => d(!1), 4e3);
403
434
  return () => clearTimeout(f);
404
435
  }, [s]);
405
- const o = te(e, { onDone: i }), m = ae(e, r, { onDone: i }), n = "flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] font-medium transition-colors disabled:opacity-50";
436
+ const c = te(e, { onDone: r }), m = ae(e, n, { onDone: r }), a = "flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] font-medium transition-colors disabled:opacity-50";
406
437
  return /* @__PURE__ */ l(
407
438
  "div",
408
439
  {
@@ -413,17 +444,17 @@ function ce({
413
444
  "button",
414
445
  {
415
446
  type: "button",
416
- disabled: o.isPending,
417
- onClick: () => o.mutate({}),
447
+ disabled: c.isPending,
448
+ onClick: () => c.mutate({}),
418
449
  "data-tip": "Every tab they have open shows a 15-second countdown, then reloads",
419
450
  className: j(
420
- n,
451
+ a,
421
452
  "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
422
453
  ),
423
454
  "data-user-card-reload": !0,
424
455
  children: [
425
- /* @__PURE__ */ t(W, { className: j("h-3.5 w-3.5", o.isPending && "animate-spin") }),
426
- o.isPending ? "Sending…" : "Reload tabs"
456
+ /* @__PURE__ */ t(H, { className: j("h-3.5 w-3.5", c.isPending && "animate-spin") }),
457
+ c.isPending ? "Sending…" : "Reload tabs"
427
458
  ]
428
459
  }
429
460
  ),
@@ -435,12 +466,12 @@ function ce({
435
466
  onClick: () => s ? m.mutate() : d(!0),
436
467
  "data-tip": s ? "Click again to sign them out of every session" : "Ends every session they have, on every app — they can sign in again",
437
468
  className: j(
438
- n,
469
+ a,
439
470
  s ? "bg-red-600 text-white hover:bg-red-700" : "text-amber-800 hover:bg-amber-50 dark:text-amber-300 dark:hover:bg-amber-500/10"
440
471
  ),
441
472
  "data-user-card-sign-out": s ? "armed" : "",
442
473
  children: [
443
- /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5" }),
474
+ /* @__PURE__ */ t(J, { className: "h-3.5 w-3.5" }),
444
475
  m.isPending ? "Signing out…" : s ? "Confirm sign out" : "Sign out"
445
476
  ]
446
477
  }
@@ -449,37 +480,37 @@ function ce({
449
480
  }
450
481
  );
451
482
  }
452
- function me({
483
+ function xe({
453
484
  userId: e,
454
- size: r = "default",
455
- children: i
485
+ size: n = "default",
486
+ children: r
456
487
  }) {
457
- const s = T(), { navigate: d, userUrl: o } = Q(), m = o ? o(e) : `/users/${e}`, [n, f] = O(!1), g = R.useId();
488
+ const s = S(), { navigate: d, userUrl: c } = V(), m = c ? c(e) : `/users/${e}`, [a, f] = P(!1), b = R.useId();
458
489
  E(
459
- n,
460
- (a) => {
461
- var p, h, x, b;
462
- return !!((p = a.closest) != null && p.call(a, `[data-nvr-user-card="${CSS.escape(g)}"]`)) || !!((h = a.closest) != null && h.call(a, `[data-nvr-user-chip="${CSS.escape(g)}"]`)) || // Anything else floating above the card (a tooltip, a nested menu).
463
- !!((x = a.closest) != null && x.call(a, "[data-radix-popper-content-wrapper]")) && !((b = a.closest) != null && b.call(a, "[data-nvr-user-card]"));
490
+ a,
491
+ (o) => {
492
+ var x, h, w, g;
493
+ return !!((x = o.closest) != null && x.call(o, `[data-nvr-user-card="${CSS.escape(b)}"]`)) || !!((h = o.closest) != null && h.call(o, `[data-nvr-user-chip="${CSS.escape(b)}"]`)) || // Anything else floating above the card (a tooltip, a nested menu).
494
+ !!((w = o.closest) != null && w.call(o, "[data-radix-popper-content-wrapper]")) && !((g = o.closest) != null && g.call(o, "[data-nvr-user-card]"));
464
495
  },
465
496
  () => f(!1)
466
497
  );
467
- const { data: u, isLoading: y } = P({
468
- ...G(s, e),
498
+ const { data: u, isLoading: y } = C({
499
+ ...L(s, e),
469
500
  enabled: !!s && !!e,
470
501
  staleTime: 12e4
471
- }), { data: c } = P({
502
+ }), { data: p } = C({
472
503
  queryKey: ["user-presence", e],
473
- queryFn: () => s.request(L(`/presence/users/${e}`)).then((a) => a),
474
- enabled: !!s && !!e && n,
504
+ queryFn: () => s.request(B(`/presence/users/${e}`)).then((o) => o),
505
+ enabled: !!s && !!e && a,
475
506
  staleTime: 15e3,
476
- refetchInterval: n ? 2e4 : !1
477
- }), w = u ? [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email : e, v = w.split(" ").map((a) => a[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), N = (c == null ? void 0 : c.online) ?? !1;
478
- return y && !i ? r === "compact" ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5", children: [
507
+ refetchInterval: a ? 2e4 : !1
508
+ }), v = u ? [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email : e, k = v.split(" ").map((o) => o[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), i = (p == null ? void 0 : p.online) ?? !1;
509
+ return y && !r ? n === "compact" ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5", children: [
479
510
  /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 rounded-full animate-pulse bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
480
511
  /* @__PURE__ */ t("span", { className: "animate-pulse h-2.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" })
481
- ] }) : /* @__PURE__ */ l(re, { open: n, onOpenChange: f, children: [
482
- /* @__PURE__ */ t(le, { asChild: !0, "data-nvr-user-chip": g, children: i || (r === "compact" ? /* @__PURE__ */ l("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 dark:bg-slate-800 py-px pl-px pr-1.5 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors", children: [
512
+ ] }) : /* @__PURE__ */ l(re, { open: a, onOpenChange: f, children: [
513
+ /* @__PURE__ */ t(le, { asChild: !0, "data-nvr-user-chip": b, children: r || (n === "compact" ? /* @__PURE__ */ l("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 dark:bg-slate-800 py-px pl-px pr-1.5 hover:bg-slate-200 dark:hover:bg-slate-700 transition-colors", children: [
483
514
  /* @__PURE__ */ t(
484
515
  _,
485
516
  {
@@ -491,12 +522,12 @@ function me({
491
522
  "data-copy-skip": !0,
492
523
  "aria-hidden": "true",
493
524
  className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan",
494
- children: v
525
+ children: k
495
526
  }
496
527
  )
497
528
  }
498
529
  ),
499
- /* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children: w })
530
+ /* @__PURE__ */ t("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-300", children: v })
500
531
  ] }) : /* @__PURE__ */ l("div", { className: "inline-flex cursor-pointer items-center gap-1.5 rounded-full border border-slate-200 bg-slate-50 py-0.5 pl-0.5 pr-2.5 hover:bg-slate-100 dark:border-border dark:bg-card dark:hover:bg-accent transition-colors", children: [
501
532
  /* @__PURE__ */ t(
502
533
  _,
@@ -509,33 +540,35 @@ function me({
509
540
  "data-copy-skip": !0,
510
541
  "aria-hidden": "true",
511
542
  className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan",
512
- children: v
543
+ children: k
513
544
  }
514
545
  )
515
546
  }
516
547
  ),
517
- /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children: w })
548
+ /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-700 dark:text-slate-300", children: v })
518
549
  ] })) }),
519
550
  /* @__PURE__ */ t(
520
- de,
551
+ pe,
521
552
  {
522
553
  user: u,
523
554
  userId: e,
524
- initials: v,
555
+ initials: k,
525
556
  navigate: d,
526
557
  profileUrl: m,
527
- online: N,
528
- cardId: g,
558
+ online: i,
559
+ cardId: b,
529
560
  onAction: () => f(!1),
530
- open: n
561
+ open: a
531
562
  }
532
563
  )
533
564
  ] });
534
565
  }
535
566
  export {
536
- $e as OwnersInline,
537
- Te as OwnersInlineCompact,
538
- ce as UserCardAdminRow,
539
- me as UserChip,
540
- ie as UserRosterCluster
567
+ Be as OwnersInline,
568
+ $e as OwnersInlineCompact,
569
+ fe as UserCardAdminRow,
570
+ xe as UserChip,
571
+ ce as UserRosterCluster,
572
+ ie as rosterInitials,
573
+ oe as rosterName
541
574
  };