@nivaro/react 0.3.0 → 0.3.2

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 (33) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +341 -0
  4. package/dist/index.js +764 -723
  5. package/dist/shared/components/ClientChaosToolbar.js +410 -0
  6. package/dist/shared/components/LoadErrorNote.js +49 -0
  7. package/dist/shared/components/PretendDown.js +258 -0
  8. package/dist/shared/components/ProfileView.js +54 -49
  9. package/dist/shared/components/QueryErrorState.js +16 -0
  10. package/dist/shared/components/ReportView.js +1351 -1338
  11. package/dist/shared/components/WidgetSlot.js +438 -418
  12. package/dist/shared/components/chaos/DeclareIncidentButton.js +72 -0
  13. package/dist/shared/components/chaos/DrillBanner.js +119 -0
  14. package/dist/shared/components/chaos/DrillTag.js +62 -0
  15. package/dist/shared/components/chaos/GameDayStrip.js +61 -0
  16. package/dist/shared/components/chat/huddle/HuddleAudioUi.js +95 -92
  17. package/dist/shared/components/chat/huddle/HuddleCallBar.js +69 -64
  18. package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +40 -39
  19. package/dist/shared/components/chat/huddle/HuddleStageTools.js +30 -27
  20. package/dist/shared/components/chat/huddle/huddle-dismiss.js +12 -0
  21. package/dist/shared/components/chat/huddle/huddle-store.js +25 -20
  22. package/dist/shared/components/client-chaos-gate.js +51 -0
  23. package/dist/shared/components/integrations/console/SignalCard.js +172 -167
  24. package/dist/shared/components/layout-editor/EditorTopBar.js +108 -105
  25. package/dist/shared/components/layout-editor/LayoutEditor.js +514 -508
  26. package/dist/shared/components/notifications/NotificationAnalyticsView.js +18 -10
  27. package/dist/shared/components/pipeline/PipelineEditorView.js +495 -479
  28. package/dist/shared/components/pipeline/TeamsView.js +184 -169
  29. package/dist/shared/lib/client-chaos.js +359 -0
  30. package/dist/shared/lib/load-error.js +26 -0
  31. package/dist/shared/lib/socket-realtime.js +31 -30
  32. package/dist/shared/lib/worker-socket.js +108 -89
  33. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { jsxs as i, jsx as e, Fragment as C } from "react/jsx-runtime";
2
- import { Headphones as H, MicOff as M, Mic as j, ScreenShare as L, PhoneOff as P, MoreHorizontal as W, ChevronLeft as O, UserPlus as B, Hand as R, Presentation as I, PictureInPicture2 as A, Keyboard as D } from "lucide-react";
2
+ import { Headphones as H, MicOff as M, Mic as j, ScreenShare as W, PhoneOff as L, MoreHorizontal as P, ChevronLeft as O, UserPlus as B, Hand as R, Presentation as I, PictureInPicture2 as A, Keyboard as D } from "lucide-react";
3
3
  import { useRef as w, useState as g, useEffect as y } from "react";
4
4
  import { cn as b } from "../../../lib/utils.js";
5
5
  import { Popover as z, PopoverTrigger as E, PopoverContent as T } from "../../ui/popover.js";
@@ -8,46 +8,47 @@ import { HuddleCameraButton as K } from "./HuddleCamera.js";
8
8
  import { useHuddleCollab as V, HuddleNotesButton as q } from "./HuddleCollab.js";
9
9
  import { HuddleInviteButton as G, HuddleInviteList as J } from "./HuddlePeoplePicker.js";
10
10
  import { HuddleStageTools as Q } from "./HuddleStageTools.js";
11
- import { raiseHand as X } from "./huddle-reactions.js";
12
- import { huddleShortcuts as Y } from "./huddle-shortcuts.js";
13
- import { formatElapsed as Z } from "./huddle-store.js";
14
- import { useHuddleSpeaking as _, useHuddleShortcuts as $ } from "./useHuddleAudio.js";
11
+ import { useCloseOnWindowBlur as X } from "./huddle-dismiss.js";
12
+ import { raiseHand as Y } from "./huddle-reactions.js";
13
+ import { huddleShortcuts as Z } from "./huddle-shortcuts.js";
14
+ import { formatElapsed as _ } from "./huddle-store.js";
15
+ import { useHuddleSpeaking as $, useHuddleShortcuts as ee } from "./useHuddleAudio.js";
15
16
  const k = "flex h-6 w-6 shrink-0 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40", N = "text-slate-500 hover:bg-slate-200/70 hover:text-slate-800 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100", S = "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100";
16
- function ee(s) {
17
- const [d, a] = g(0);
17
+ function te(s) {
18
+ const [d, n] = g(0);
18
19
  return y(() => {
19
20
  const o = s.current;
20
21
  if (!o || typeof ResizeObserver > "u") return;
21
- const r = new ResizeObserver(([t]) => a(Math.round(t.contentRect.width)));
22
+ const r = new ResizeObserver(([t]) => n(Math.round(t.contentRect.width)));
22
23
  return r.observe(o), () => r.disconnect();
23
24
  }, [s]), d;
24
25
  }
25
- function te({ since: s }) {
26
+ function ne({ since: s }) {
26
27
  const [, d] = g(0);
27
28
  return y(() => {
28
- const a = setInterval(() => d((o) => o + 1), 1e3);
29
- return () => clearInterval(a);
30
- }, []), s ? /* @__PURE__ */ e("span", { className: "tabular-nums text-slate-500 dark:text-slate-400", "data-huddle-elapsed": !0, children: Z(Date.now() - s) }) : null;
29
+ const n = setInterval(() => d((o) => o + 1), 1e3);
30
+ return () => clearInterval(n);
31
+ }, []), s ? /* @__PURE__ */ e("span", { className: "tabular-nums text-slate-500 dark:text-slate-400", "data-huddle-elapsed": !0, children: _(Date.now() - s) }) : null;
31
32
  }
32
33
  function v({
33
34
  icon: s,
34
35
  children: d,
35
- onClick: a,
36
+ onClick: n,
36
37
  disabled: o,
37
38
  active: r,
38
39
  tip: t,
39
- data: p
40
+ data: h
40
41
  }) {
41
42
  return /* @__PURE__ */ i(
42
43
  "button",
43
44
  {
44
45
  type: "button",
45
46
  role: "menuitem",
46
- onClick: a,
47
+ onClick: n,
47
48
  disabled: o,
48
49
  className: "flex min-h-8 w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted focus-visible:bg-muted focus-visible:outline-none disabled:opacity-50 disabled:hover:bg-transparent dark:text-slate-200",
49
50
  "data-tip": t,
50
- "data-huddle-menu": p,
51
+ "data-huddle-menu": h,
51
52
  children: [
52
53
  /* @__PURE__ */ e(
53
54
  "span",
@@ -67,31 +68,35 @@ function v({
67
68
  function ae({
68
69
  room: s,
69
70
  huddle: d,
70
- pip: a,
71
+ pip: n,
71
72
  fold: o,
72
73
  followAction: r,
73
74
  renderAvatar: t
74
75
  }) {
75
- const [p, u] = g(!1), [f, l] = g("menu"), h = w(!1), x = d.state.status === "joining", m = !!d.state.handAt, c = (n) => () => {
76
- u(!1), n();
76
+ const [h, c] = g(!1), [f, l] = g("menu");
77
+ X(h, () => {
78
+ c(!1), l("menu");
79
+ });
80
+ const m = w(!1), x = d.state.status === "joining", p = !!d.state.handAt, u = (a) => () => {
81
+ c(!1), a();
77
82
  };
78
83
  return /* @__PURE__ */ i(
79
84
  z,
80
85
  {
81
- open: p,
82
- onOpenChange: (n) => {
83
- u(n), n || l("menu");
86
+ open: h,
87
+ onOpenChange: (a) => {
88
+ c(a), a || l("menu");
84
89
  },
85
90
  children: [
86
91
  /* @__PURE__ */ e(E, { asChild: !0, children: /* @__PURE__ */ e(
87
92
  "button",
88
93
  {
89
94
  type: "button",
90
- className: b(k, p ? S : N),
95
+ className: b(k, h ? S : N),
91
96
  "aria-label": "More huddle actions",
92
97
  "data-tip": "More",
93
98
  "data-huddle-more": !0,
94
- children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5", strokeWidth: 2 })
99
+ children: /* @__PURE__ */ e(P, { className: "h-3.5 w-3.5", strokeWidth: 2 })
95
100
  }
96
101
  ) }),
97
102
  /* @__PURE__ */ e(
@@ -102,8 +107,8 @@ function ae({
102
107
  "p-1",
103
108
  f === "invite" ? "w-[280px] max-w-[calc(100vw-16px)]" : "w-[232px]"
104
109
  ),
105
- onCloseAutoFocus: (n) => {
106
- h.current && (h.current = !1, n.preventDefault(), Y.setHelpOpen(!0));
110
+ onCloseAutoFocus: (a) => {
111
+ m.current && (m.current = !1, a.preventDefault(), Z.setHelpOpen(!0));
107
112
  },
108
113
  "data-huddle-more-menu": !0,
109
114
  children: f === "invite" ? /* @__PURE__ */ i("div", { children: [
@@ -124,7 +129,7 @@ function ae({
124
129
  {
125
130
  room: s,
126
131
  renderAvatar: t,
127
- onDone: () => u(!1)
132
+ onDone: () => c(!1)
128
133
  }
129
134
  )
130
135
  ] }) : /* @__PURE__ */ i("div", { role: "menu", "aria-label": "More huddle actions", className: "flex flex-col", children: [
@@ -133,18 +138,18 @@ function ae({
133
138
  v,
134
139
  {
135
140
  icon: /* @__PURE__ */ e(R, {}),
136
- onClick: c(() => X(!m)),
141
+ onClick: u(() => Y(!p)),
137
142
  disabled: x,
138
- active: m,
143
+ active: p,
139
144
  data: "hand",
140
- children: m ? "Lower your hand" : "Raise your hand"
145
+ children: p ? "Lower your hand" : "Raise your hand"
141
146
  }
142
147
  ),
143
148
  r && /* @__PURE__ */ e(
144
149
  v,
145
150
  {
146
151
  icon: /* @__PURE__ */ e(I, {}),
147
- onClick: c(r.run),
152
+ onClick: u(r.run),
148
153
  disabled: r.disabled,
149
154
  active: r.active,
150
155
  tip: r.tip,
@@ -152,15 +157,15 @@ function ae({
152
157
  children: r.label
153
158
  }
154
159
  ),
155
- a.supported && /* @__PURE__ */ e(
160
+ n.supported && /* @__PURE__ */ e(
156
161
  v,
157
162
  {
158
163
  icon: /* @__PURE__ */ e(A, {}),
159
- onClick: c(a.toggle),
160
- active: a.open,
161
- tip: a.open ? void 0 : "A small window that stays on top of other windows",
164
+ onClick: u(n.toggle),
165
+ active: n.open,
166
+ tip: n.open ? void 0 : "A small window that stays on top of other windows",
162
167
  data: "pip",
163
- children: a.open ? "Close the mini-player" : "Pop out a mini-player"
168
+ children: n.open ? "Close the mini-player" : "Pop out a mini-player"
164
169
  }
165
170
  ),
166
171
  /* @__PURE__ */ e(
@@ -168,7 +173,7 @@ function ae({
168
173
  {
169
174
  icon: /* @__PURE__ */ e(D, {}),
170
175
  onClick: () => {
171
- h.current = !0, u(!1);
176
+ m.current = !0, c(!1);
172
177
  },
173
178
  data: "shortcuts",
174
179
  children: /* @__PURE__ */ i("span", { className: "flex items-center justify-between gap-2", children: [
@@ -184,25 +189,25 @@ function ae({
184
189
  }
185
190
  );
186
191
  }
187
- function ve({
192
+ function ge({
188
193
  room: s,
189
194
  me: d,
190
- huddle: a,
195
+ huddle: n,
191
196
  pip: o,
192
197
  renderAvatar: r
193
198
  }) {
194
- const { state: t, support: p } = a, u = w(null), f = ee(u), l = f >= 460, h = f > 0 && f < 340, x = _(), { talking: m } = $(), c = V(s, a), n = t.status === "joining";
195
- return /* @__PURE__ */ i("div", { ref: u, className: "flex min-w-0 items-center gap-1.5 text-[11px]", "data-huddle-callbar": !0, children: [
199
+ const { state: t, support: h } = n, c = w(null), f = te(c), l = f >= 460, m = f > 0 && f < 340, x = $(), { talking: p } = ee(), u = V(s, n), a = t.status === "joining";
200
+ return /* @__PURE__ */ i("div", { ref: c, className: "flex min-w-0 items-center gap-1.5 text-[11px]", "data-huddle-callbar": !0, children: [
196
201
  /* @__PURE__ */ i(
197
202
  "span",
198
203
  {
199
204
  className: "inline-flex min-w-0 items-center gap-1 font-medium text-slate-700 dark:text-slate-200",
200
- "data-tip": l || n ? void 0 : "Huddle — time since it started",
205
+ "data-tip": l || a ? void 0 : "Huddle — time since it started",
201
206
  children: [
202
207
  /* @__PURE__ */ e(H, { className: "h-3.5 w-3.5 shrink-0 text-nvr-cyan", strokeWidth: 2, "aria-hidden": !0 }),
203
- n ? /* @__PURE__ */ e("span", { className: "truncate", children: "Connecting…" }) : /* @__PURE__ */ i(C, { children: [
208
+ a ? /* @__PURE__ */ e("span", { className: "truncate", children: "Connecting…" }) : /* @__PURE__ */ i(C, { children: [
204
209
  /* @__PURE__ */ e("span", { className: l ? void 0 : "sr-only", children: "Huddle" }),
205
- /* @__PURE__ */ e(te, { since: t.startedAt })
210
+ /* @__PURE__ */ e(ne, { since: t.startedAt })
206
211
  ] })
207
212
  ]
208
213
  }
@@ -220,50 +225,50 @@ function ve({
220
225
  "button",
221
226
  {
222
227
  type: "button",
223
- onClick: a.toggleMute,
224
- disabled: n,
228
+ onClick: n.toggleMute,
229
+ disabled: a,
225
230
  className: b(
226
231
  k,
227
- t.muted ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : m || x.selfSpeaking ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300" : "text-slate-600 hover:bg-slate-200/70 dark:text-slate-300 dark:hover:bg-white/10"
232
+ t.muted ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : p || x.selfSpeaking ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300" : "text-slate-600 hover:bg-slate-200/70 dark:text-slate-300 dark:hover:bg-white/10"
228
233
  ),
229
234
  "aria-pressed": t.muted,
230
235
  "aria-label": t.muted ? "Unmute microphone" : "Mute microphone",
231
- "data-tip": m ? "Talking — let go of Space to mute" : t.muted ? "Unmute (M)" : "Mute (M)",
236
+ "data-tip": p ? "Talking — let go of Space to mute" : t.muted ? "Unmute (M)" : "Mute (M)",
232
237
  "data-huddle-mute": t.muted ? "on" : "off",
233
- "data-huddle-ptt": m ? "on" : void 0,
238
+ "data-huddle-ptt": p ? "on" : void 0,
234
239
  children: t.muted ? /* @__PURE__ */ e(M, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ e(j, { className: "h-3.5 w-3.5", strokeWidth: 2 })
235
240
  }
236
241
  ),
237
- !n && /* @__PURE__ */ e(U, { muted: t.muted, variant: "chevron" })
242
+ !a && /* @__PURE__ */ e(U, { muted: t.muted, variant: "chevron" })
238
243
  ] }),
239
- /* @__PURE__ */ e(K, { disabled: n }),
240
- p.screen && /* @__PURE__ */ e(
244
+ /* @__PURE__ */ e(K, { disabled: a }),
245
+ h.screen && /* @__PURE__ */ e(
241
246
  "button",
242
247
  {
243
248
  type: "button",
244
- onClick: a.toggleShare,
245
- disabled: n,
249
+ onClick: n.toggleShare,
250
+ disabled: a,
246
251
  className: b(k, t.sharing ? S : N),
247
252
  "aria-pressed": t.sharing,
248
253
  "aria-label": t.sharing ? "Stop sharing your screen" : "Share your screen",
249
254
  "data-tip": t.sharing ? "Stop sharing (Shift+S)" : "Share screen (Shift+S)",
250
255
  "data-huddle-share": t.sharing ? "on" : "off",
251
- children: /* @__PURE__ */ e(L, { className: "h-3.5 w-3.5", strokeWidth: 2 })
256
+ children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5", strokeWidth: 2 })
252
257
  }
253
258
  ),
254
259
  /* @__PURE__ */ e("span", { className: "mx-1 h-3.5 w-px bg-slate-200 dark:bg-border", "aria-hidden": !0 }),
255
- /* @__PURE__ */ i(Q, { me: d, handAt: t.handAt, disabled: n, showHand: !h, children: [
256
- c.live && /* @__PURE__ */ e(q, { open: c.notes.open, unseen: c.notes.unseen }),
257
- !h && !n && /* @__PURE__ */ e(G, { room: s, renderAvatar: r })
260
+ /* @__PURE__ */ i(Q, { me: d, handAt: t.handAt, disabled: a, showHand: !m, children: [
261
+ u.live && /* @__PURE__ */ e(q, { open: u.notes.open, unseen: u.notes.unseen }),
262
+ !m && !a && /* @__PURE__ */ e(G, { room: s, renderAvatar: r })
258
263
  ] }),
259
264
  /* @__PURE__ */ e(
260
265
  ae,
261
266
  {
262
267
  room: s,
263
- huddle: a,
268
+ huddle: n,
264
269
  pip: o,
265
- fold: h,
266
- followAction: c.followAction,
270
+ fold: m,
271
+ followAction: u.followAction,
267
272
  renderAvatar: r
268
273
  }
269
274
  ),
@@ -272,7 +277,7 @@ function ve({
272
277
  "button",
273
278
  {
274
279
  type: "button",
275
- onClick: a.leave,
280
+ onClick: n.leave,
276
281
  className: b(
277
282
  "ml-1 flex h-6 shrink-0 items-center justify-center gap-1 rounded bg-red-50 text-[11px] font-medium text-red-700 transition-colors hover:bg-red-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:bg-red-500/15 dark:text-red-300 dark:hover:bg-red-500/25",
278
283
  l ? "px-2" : "w-7"
@@ -281,7 +286,7 @@ function ve({
281
286
  "data-tip": l ? "Leave (L)" : "Leave the huddle (L)",
282
287
  "data-huddle-leave": !0,
283
288
  children: [
284
- /* @__PURE__ */ e(P, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
289
+ /* @__PURE__ */ e(L, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
285
290
  l && "Leave"
286
291
  ]
287
292
  }
@@ -292,5 +297,5 @@ function ve({
292
297
  ] });
293
298
  }
294
299
  export {
295
- ve as HuddleCallBar
300
+ ge as HuddleCallBar
296
301
  };
@@ -6,31 +6,32 @@ import { toast as C } from "sonner";
6
6
  import { useNivaroClient as w } from "../../../context.js";
7
7
  import { get as H } from "../../../lib/commands.js";
8
8
  import { cn as h } from "../../../lib/utils.js";
9
- import { Command as P, CommandInput as T, CommandList as I, CommandEmpty as S, CommandGroup as j, CommandItem as L } from "../../ui/command.js";
10
- import { Popover as W, PopoverTrigger as q, PopoverContent as D } from "../../ui/popover.js";
9
+ import { Command as P, CommandInput as T, CommandList as I, CommandEmpty as S, CommandGroup as W, CommandItem as j } from "../../ui/command.js";
10
+ import { Popover as L, PopoverTrigger as q, PopoverContent as D } from "../../ui/popover.js";
11
11
  import { huddleCalls as E } from "./huddle-calls.js";
12
- function A(a, n, r = !0) {
13
- const l = w(), [o, m] = u(n);
12
+ import { useCloseOnWindowBlur as O } from "./huddle-dismiss.js";
13
+ function A(a, l, o = !0) {
14
+ const n = w(), [r, m] = u(l);
14
15
  return N(() => {
15
- const s = setTimeout(() => m(n), 180);
16
+ const s = setTimeout(() => m(l), 180);
16
17
  return () => clearTimeout(s);
17
- }, [n]), v({
18
- queryKey: ["nvr-huddle-people", a, o],
19
- queryFn: () => l.request(
20
- H("/chat/huddle/people", { room: a, q: o })
18
+ }, [l]), v({
19
+ queryKey: ["nvr-huddle-people", a, r],
20
+ queryFn: () => n.request(
21
+ H("/chat/huddle/people", { room: a, q: r })
21
22
  ).then((s) => s.data),
22
- enabled: r && !!a,
23
+ enabled: o && !!a,
23
24
  staleTime: 2e4,
24
25
  placeholderData: (s) => s
25
26
  });
26
27
  }
27
- const F = "flex items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] text-slate-700 aria-selected:bg-muted dark:text-slate-200";
28
- function O({
28
+ const B = "flex items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] text-slate-700 aria-selected:bg-muted dark:text-slate-200";
29
+ function F({
29
30
  room: a,
30
- selected: n,
31
- onPick: r,
32
- renderAvatar: l,
33
- placeholder: o = "Search people…",
31
+ selected: l,
32
+ onPick: o,
33
+ renderAvatar: n,
34
+ placeholder: r = "Search people…",
34
35
  excludeInHuddle: m
35
36
  }) {
36
37
  const [s, p] = u(""), { data: d, isLoading: x, isError: f } = A(a, s);
@@ -40,7 +41,7 @@ function O({
40
41
  {
41
42
  value: s,
42
43
  onValueChange: p,
43
- placeholder: o,
44
+ placeholder: r,
44
45
  className: "h-8 text-[12.5px]"
45
46
  }
46
47
  ),
@@ -48,18 +49,18 @@ function O({
48
49
  x && !d && /* @__PURE__ */ e("div", { className: "space-y-1.5 p-2", "aria-busy": "true", children: [0, 1, 2].map((t) => /* @__PURE__ */ e("div", { className: "h-7 animate-pulse rounded-md bg-slate-100 dark:bg-white/5" }, t)) }),
49
50
  f && /* @__PURE__ */ e("p", { className: "px-2 py-3 text-[11.5px] text-red-600 dark:text-red-300", children: "Could not load people. Try again in a moment." }),
50
51
  d && d.length === 0 && /* @__PURE__ */ e(S, { className: "py-4 text-[11.5px] text-slate-500 dark:text-slate-400", children: s ? "Nobody with that name can see this room." : "Nobody else can see this room." }),
51
- d && d.length > 0 && /* @__PURE__ */ e(j, { children: d.map((t) => {
52
- const c = !!m && t.in_huddle, g = n.has(t.id.toUpperCase());
52
+ d && d.length > 0 && /* @__PURE__ */ e(W, { children: d.map((t) => {
53
+ const c = !!m && t.in_huddle, g = l.has(t.id.toUpperCase());
53
54
  return /* @__PURE__ */ i(
54
- L,
55
+ j,
55
56
  {
56
57
  value: t.id,
57
58
  disabled: c,
58
- onSelect: () => !c && r(t),
59
- className: h(F, c && "opacity-50"),
59
+ onSelect: () => !c && o(t),
60
+ className: h(B, c && "opacity-50"),
60
61
  "data-huddle-person-row": t.id,
61
62
  children: [
62
- /* @__PURE__ */ e("span", { style: { lineHeight: 0 }, children: l(t.id, t.name) }),
63
+ /* @__PURE__ */ e("span", { style: { lineHeight: 0 }, children: n(t.id, t.name) }),
63
64
  /* @__PURE__ */ i("span", { className: "min-w-0 flex-1", children: [
64
65
  /* @__PURE__ */ e("span", { className: "block truncate", children: t.name }),
65
66
  t.title && /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-500 dark:text-slate-400", children: t.title })
@@ -85,38 +86,38 @@ function O({
85
86
  }
86
87
  function Q({
87
88
  room: a,
88
- renderAvatar: n,
89
- onDone: r
89
+ renderAvatar: l,
90
+ onDone: o
90
91
  }) {
91
92
  return /* @__PURE__ */ e(
92
- O,
93
+ F,
93
94
  {
94
95
  room: a,
95
96
  selected: /* @__PURE__ */ new Set(),
96
97
  excludeInHuddle: !0,
97
- renderAvatar: n,
98
+ renderAvatar: l,
98
99
  placeholder: "Who should join?",
99
- onPick: (l) => {
100
- E.invite(a, [l.id]), C(`Ringing ${l.name}`, { description: "They get a call and a notification." }), r();
100
+ onPick: (n) => {
101
+ E.invite(a, [n.id]), C(`Ringing ${n.name}`, { description: "They get a call and a notification." }), o();
101
102
  }
102
103
  }
103
104
  );
104
105
  }
105
- function X({
106
+ function Z({
106
107
  room: a,
107
- renderAvatar: n,
108
- className: r
108
+ renderAvatar: l,
109
+ className: o
109
110
  }) {
110
- const [l, o] = u(!1);
111
- return /* @__PURE__ */ i(W, { open: l, onOpenChange: o, children: [
111
+ const [n, r] = u(!1);
112
+ return O(n, () => r(!1)), /* @__PURE__ */ i(L, { open: n, onOpenChange: r, children: [
112
113
  /* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
113
114
  "button",
114
115
  {
115
116
  type: "button",
116
117
  className: h(
117
118
  "flex h-6 w-6 shrink-0 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-200/70 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
118
- l && "bg-slate-200/70 text-slate-800 dark:bg-white/10 dark:text-slate-100",
119
- r
119
+ n && "bg-slate-200/70 text-slate-800 dark:bg-white/10 dark:text-slate-100",
120
+ o
120
121
  ),
121
122
  "aria-label": "Add people to the huddle",
122
123
  "data-tip": "Add people — they get a call",
@@ -130,14 +131,14 @@ function X({
130
131
  align: "end",
131
132
  className: "w-[280px] max-w-[calc(100vw-16px)] p-1",
132
133
  "data-huddle-invite-picker": !0,
133
- children: /* @__PURE__ */ e(Q, { room: a, renderAvatar: n, onDone: () => o(!1) })
134
+ children: /* @__PURE__ */ e(Q, { room: a, renderAvatar: l, onDone: () => r(!1) })
134
135
  }
135
136
  )
136
137
  ] });
137
138
  }
138
139
  export {
139
- X as HuddleInviteButton,
140
+ Z as HuddleInviteButton,
140
141
  Q as HuddleInviteList,
141
- O as HuddlePeopleList,
142
+ F as HuddlePeopleList,
142
143
  A as useHuddlePeople
143
144
  };
@@ -1,27 +1,30 @@
1
1
  import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
2
  import { Hand as b, X as g, VideoOff as k, SmilePlus as w } from "lucide-react";
3
3
  import { useMemo as N, useSyncExternalStore as v, useState as S } from "react";
4
- import { cn as m } from "../../../lib/utils.js";
4
+ import { cn as h } from "../../../lib/utils.js";
5
5
  import { Popover as C, PopoverTrigger as H, PopoverContent as R } from "../../ui/popover.js";
6
6
  import { cameraStore as u } from "./huddle-camera.js";
7
- import { handQueue as j, raiseHand as y, lowerAllHands as L, reactionFeed as h, HUDDLE_REACTIONS as E, REACTION_LIFE_MS as W } from "./huddle-reactions.js";
8
- const p = "flex h-6 w-6 shrink-0 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40", f = "text-slate-500 hover:bg-slate-200/70 hover:text-slate-800 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100", x = "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100";
9
- function I({
7
+ import { useCloseOnWindowBlur as j } from "./huddle-dismiss.js";
8
+ import { handQueue as L, raiseHand as y, lowerAllHands as W, reactionFeed as m, HUDDLE_REACTIONS as E, REACTION_LIFE_MS as O } from "./huddle-reactions.js";
9
+ const f = "flex h-6 w-6 shrink-0 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40", p = "text-slate-500 hover:bg-slate-200/70 hover:text-slate-800 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100", x = "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100";
10
+ function _({
10
11
  me: a,
11
12
  handAt: s,
12
13
  disabled: t,
13
14
  showHand: n = !0,
14
15
  children: r
15
16
  }) {
16
- const [i, c] = S(!1), l = !!s;
17
+ const [i, d] = S(!1);
18
+ j(i, () => d(!1));
19
+ const l = !!s;
17
20
  return /* @__PURE__ */ o("div", { className: "flex items-center gap-0.5", "data-huddle-stage-tools": !0, children: [
18
- /* @__PURE__ */ o(C, { open: i, onOpenChange: c, children: [
21
+ /* @__PURE__ */ o(C, { open: i, onOpenChange: d, children: [
19
22
  /* @__PURE__ */ e(H, { asChild: !0, children: /* @__PURE__ */ e(
20
23
  "button",
21
24
  {
22
25
  type: "button",
23
26
  disabled: t,
24
- className: m(p, i ? x : f),
27
+ className: h(f, i ? x : p),
25
28
  "aria-label": "React",
26
29
  "data-tip": i ? void 0 : "React — everyone in the huddle sees it",
27
30
  "data-huddle-react": !0,
@@ -30,16 +33,16 @@ function I({
30
33
  ) }),
31
34
  /* @__PURE__ */ e(R, { side: "bottom", align: "center", className: "w-auto p-1", "data-huddle-reactions": !0, children: /* @__PURE__ */ o("fieldset", { className: "m-0 flex min-w-0 items-center gap-0.5 border-0 p-0", children: [
32
35
  /* @__PURE__ */ e("legend", { className: "sr-only", children: "Send a reaction" }),
33
- E.map((d) => /* @__PURE__ */ e(
36
+ E.map((c) => /* @__PURE__ */ e(
34
37
  "button",
35
38
  {
36
39
  type: "button",
37
- onClick: () => a && h.send(d, a.id),
40
+ onClick: () => a && m.send(c, a.id),
38
41
  className: "flex h-8 w-8 items-center justify-center rounded-md text-[17px] leading-none transition-transform hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan active:scale-90",
39
- "aria-label": `React ${d}`,
40
- children: d
42
+ "aria-label": `React ${c}`,
43
+ children: c
41
44
  },
42
- d
45
+ c
43
46
  ))
44
47
  ] }) })
45
48
  ] }),
@@ -49,7 +52,7 @@ function I({
49
52
  type: "button",
50
53
  onClick: () => y(!l),
51
54
  disabled: t,
52
- className: m(p, l ? x : f),
55
+ className: h(f, l ? x : p),
53
56
  "aria-pressed": l,
54
57
  "aria-label": l ? "Lower your hand" : "Raise your hand",
55
58
  "data-tip": l ? "Lower hand" : "Raise hand — you join the queue",
@@ -60,8 +63,8 @@ function I({
60
63
  r
61
64
  ] });
62
65
  }
63
- function M({ roster: a, self: s }) {
64
- const t = N(() => j(a), [a]);
66
+ function q({ roster: a, self: s }) {
67
+ const t = N(() => L(a), [a]);
65
68
  return t.length ? /* @__PURE__ */ o(
66
69
  "div",
67
70
  {
@@ -95,7 +98,7 @@ function M({ roster: a, self: s }) {
95
98
  "button",
96
99
  {
97
100
  type: "button",
98
- onClick: () => L(),
101
+ onClick: () => W(),
99
102
  className: "rounded px-1.5 py-0.5 font-medium text-slate-500 transition-colors hover:bg-slate-200/70 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
100
103
  "data-huddle-lower-all": !0,
101
104
  children: "Lower all"
@@ -105,7 +108,7 @@ function M({ roster: a, self: s }) {
105
108
  }
106
109
  ) : null;
107
110
  }
108
- function O({ r: a, name: s }) {
111
+ function P({ r: a, name: s }) {
109
112
  return /* @__PURE__ */ e("span", { className: "absolute bottom-1 -translate-x-1/2", style: { left: `${a.lane * 100}%` }, children: /* @__PURE__ */ o(
110
113
  "span",
111
114
  {
@@ -128,7 +131,7 @@ function O({ r: a, name: s }) {
128
131
  { transform: "translateY(-104px) scale(1)", opacity: 0 }
129
132
  ],
130
133
  {
131
- duration: W,
134
+ duration: O,
132
135
  easing: n ? "linear" : "cubic-bezier(0.16, 1, 0.3, 1)",
133
136
  fill: "forwards"
134
137
  }
@@ -142,15 +145,15 @@ function O({ r: a, name: s }) {
142
145
  }
143
146
  ) });
144
147
  }
145
- function _({
148
+ function z({
146
149
  roster: a,
147
150
  me: s
148
151
  }) {
149
- const t = v(h.subscribe, h.getSnapshot);
152
+ const t = v(m.subscribe, m.getSnapshot);
150
153
  if (!t.length) return null;
151
154
  const n = (r) => {
152
155
  var i;
153
- return r === (s == null ? void 0 : s.id) ? "You" : ((i = a.find((c) => c.user === r)) == null ? void 0 : i.name) ?? "Someone";
156
+ return r === (s == null ? void 0 : s.id) ? "You" : ((i = a.find((d) => d.user === r)) == null ? void 0 : i.name) ?? "Someone";
154
157
  };
155
158
  return /* @__PURE__ */ o(
156
159
  "div",
@@ -159,13 +162,13 @@ function _({
159
162
  "aria-live": "polite",
160
163
  "data-huddle-reaction-layer": !0,
161
164
  children: [
162
- t.map((r) => /* @__PURE__ */ e(O, { r, name: n(r.user) }, r.id)),
165
+ t.map((r) => /* @__PURE__ */ e(P, { r, name: n(r.user) }, r.id)),
163
166
  /* @__PURE__ */ e("span", { className: "sr-only", children: t.length ? `${n(t[t.length - 1].user)} reacted ${t[t.length - 1].emoji}` : "" })
164
167
  ]
165
168
  }
166
169
  );
167
170
  }
168
- function q() {
171
+ function B() {
169
172
  const a = v(u.subscribe, u.getSnapshot);
170
173
  return a.error ? /* @__PURE__ */ o(
171
174
  "div",
@@ -190,8 +193,8 @@ function q() {
190
193
  ) : null;
191
194
  }
192
195
  export {
193
- q as HuddleCameraNotice,
194
- M as HuddleHands,
195
- _ as HuddleReactionLayer,
196
- I as HuddleStageTools
196
+ B as HuddleCameraNotice,
197
+ q as HuddleHands,
198
+ z as HuddleReactionLayer,
199
+ _ as HuddleStageTools
197
200
  };
@@ -0,0 +1,12 @@
1
+ import { useRef as o, useEffect as u } from "react";
2
+ function f(e, n) {
3
+ const r = o(n);
4
+ r.current = n, u(() => {
5
+ if (!e || typeof window > "u") return;
6
+ const t = () => r.current();
7
+ return window.addEventListener("blur", t), () => window.removeEventListener("blur", t);
8
+ }, [e]);
9
+ }
10
+ export {
11
+ f as useCloseOnWindowBlur
12
+ };