@nivaro/react 0.2.56 → 0.3.0

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 (59) hide show
  1. package/dist/components/slots/TasksSlot.js +31 -29
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +73 -1
  5. package/dist/index.js +515 -505
  6. package/dist/shared/components/ItemEditForm.js +666 -658
  7. package/dist/shared/components/MyWorkView.js +47 -37
  8. package/dist/shared/components/ProfileView.js +163 -144
  9. package/dist/shared/components/ai/AiPlanCard.js +427 -0
  10. package/dist/shared/components/ai/AiPlanChanges.js +117 -0
  11. package/dist/shared/components/ai/TaskDo.js +1022 -0
  12. package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
  13. package/dist/shared/components/chat/ChatPanel.js +1356 -1317
  14. package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
  15. package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
  16. package/dist/shared/components/chat/chat-core.js +273 -264
  17. package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
  18. package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
  19. package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
  20. package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
  21. package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
  22. package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
  23. package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
  24. package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
  25. package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
  26. package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
  27. package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
  28. package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
  29. package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
  30. package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
  31. package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
  32. package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
  33. package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
  34. package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
  35. package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
  36. package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
  37. package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
  38. package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
  39. package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
  40. package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
  41. package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
  42. package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
  43. package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
  44. package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
  45. package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
  46. package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
  47. package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
  48. package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
  49. package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
  50. package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
  51. package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
  52. package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
  53. package/dist/shared/components/item-edit/GroupSection.js +1 -0
  54. package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
  55. package/dist/shared/components/item-edit/UserChip.js +145 -142
  56. package/dist/shared/components/panels/TaskPanel.js +51 -49
  57. package/dist/shared/components/support/TicketDetailSheet.js +57 -42
  58. package/dist/shared/lib/notification-sound.js +25 -16
  59. package/package.json +2 -1
@@ -0,0 +1,320 @@
1
+ import { jsx as r, jsxs as d, Fragment as v } from "react/jsx-runtime";
2
+ import { X as $, NotebookPen as I } from "lucide-react";
3
+ import { useState as _, useSyncExternalStore as F, useEffect as f, useRef as A, useId as W, useMemo as D } from "react";
4
+ import { createPortal as U } from "react-dom";
5
+ import { toast as N } from "sonner";
6
+ import { useNavigation as q, defaultItemUrl as K } from "../../../context.js";
7
+ import { useOptionalRealtime as B } from "../../../lib/realtime.js";
8
+ import { cn as w } from "../../../lib/utils.js";
9
+ import { useChatConfig as T } from "../chat-core.js";
10
+ import { useRoomRecord as L } from "../chat-hooks.js";
11
+ import { FormattedMessage as z } from "../MessageFormat.js";
12
+ import { attachHuddleCollab as j, huddleNotes as g, huddleFollow as i, noteBytes as X, NOTE_MAX_BYTES as E } from "./huddle-collab-store.js";
13
+ import { huddleStore as P } from "./huddle-store.js";
14
+ const Y = "relative 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", G = "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", J = "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100";
15
+ function M() {
16
+ return F(g.subscribe, g.getSnapshot);
17
+ }
18
+ function O() {
19
+ return F(i.subscribe, i.getSnapshot);
20
+ }
21
+ function Q(e, t) {
22
+ return !e.startsWith("dm:") && !e.startsWith("ch:") && e !== t && e.includes(":");
23
+ }
24
+ function b(e) {
25
+ return (e == null ? void 0 : e.trim()) || "Someone";
26
+ }
27
+ function fe(e, t) {
28
+ var m;
29
+ const n = B();
30
+ f(() => j(n), [n]);
31
+ const s = T(), c = M(), l = O(), o = Q(e, s.globalRoom), u = L(e, o && t.inThis), p = t.state.status === "live" && c.room === e;
32
+ let h = null;
33
+ if (p && o) {
34
+ const y = l.presenter && !l.presenting;
35
+ h = l.presenting ? {
36
+ label: "Stop presenting",
37
+ tip: "Everyone keeps the page they are on",
38
+ disabled: !1,
39
+ active: !0,
40
+ run: () => i.stopPresenting()
41
+ } : y ? {
42
+ label: l.asked === "pending" ? "Asked to present…" : "Ask to present",
43
+ tip: `${b((m = l.presenter) == null ? void 0 : m.name)} is presenting — ask to take over`,
44
+ disabled: l.asked === "pending",
45
+ active: !1,
46
+ run: () => i.start(u)
47
+ } : {
48
+ label: "Follow me",
49
+ tip: u ? "Everyone in the huddle follows your tab and section on this record" : "Opening the record…",
50
+ disabled: !u,
51
+ active: !1,
52
+ run: () => i.start(u)
53
+ };
54
+ }
55
+ return { live: p, notes: c, followAction: h };
56
+ }
57
+ function xe({ open: e, unseen: t }) {
58
+ return /* @__PURE__ */ d(
59
+ "button",
60
+ {
61
+ type: "button",
62
+ onClick: () => g.setOpen(!e),
63
+ className: w(Y, e ? J : G),
64
+ "aria-expanded": e,
65
+ "aria-controls": "nvr-huddle-notes",
66
+ "aria-label": t ? "Shared notes (changed)" : "Shared notes",
67
+ "data-tip": e ? "Hide the notes" : "Shared notes — posted to the room when the huddle ends",
68
+ "data-huddle-notes-toggle": !0,
69
+ children: [
70
+ /* @__PURE__ */ r(I, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
71
+ t && /* @__PURE__ */ r(
72
+ "span",
73
+ {
74
+ className: "absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-nvr-cyan ring-2 ring-slate-50 dark:ring-background",
75
+ "aria-hidden": !0
76
+ }
77
+ )
78
+ ]
79
+ }
80
+ );
81
+ }
82
+ function be({ room: e }) {
83
+ var y;
84
+ const t = M(), n = T(), [s, c] = _("write"), l = A(null), o = W(), [, u] = _(0);
85
+ f(() => {
86
+ if (!t.open || !t.lastAt) return;
87
+ const a = setInterval(() => u((H) => H + 1), 3e4);
88
+ return () => clearInterval(a);
89
+ }, [t.open, t.lastAt]), f(() => {
90
+ var a;
91
+ t.open && s === "write" && ((a = l.current) == null || a.focus({ preventScroll: !0 }));
92
+ }, [t.open, s]);
93
+ const p = D(() => X(t.text), [t.text]);
94
+ if (!t.open || t.room !== e) return null;
95
+ const h = p > E * 0.8, m = t.pending ? "Saving…" : (y = t.lastBy) != null && y.name ? `${b(t.lastBy.name)} edited ${V(t.lastAt)}` : t.lastAt ? "Shared with the huddle" : null;
96
+ return /* @__PURE__ */ d(
97
+ "section",
98
+ {
99
+ id: "nvr-huddle-notes",
100
+ "aria-label": "Huddle notes",
101
+ className: "mt-1.5 rounded-md border border-slate-200 bg-white transition-colors focus-within:border-nvr-cyan dark:border-border dark:bg-card motion-safe:animate-in motion-safe:fade-in motion-safe:duration-150",
102
+ "data-huddle-notes": !0,
103
+ children: [
104
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-1 border-b border-slate-200 px-1.5 py-1 dark:border-border", children: [
105
+ ["write", "preview"].map((a) => /* @__PURE__ */ r(
106
+ "button",
107
+ {
108
+ type: "button",
109
+ onClick: () => c(a),
110
+ className: w(
111
+ "h-6 rounded px-2 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
112
+ s === a ? "bg-slate-100 text-slate-900 dark:bg-muted dark:text-slate-100" : "text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-100"
113
+ ),
114
+ "aria-pressed": s === a,
115
+ children: a === "write" ? "Write" : "Preview"
116
+ },
117
+ a
118
+ )),
119
+ /* @__PURE__ */ r(
120
+ "span",
121
+ {
122
+ className: "ml-auto min-w-0 truncate pr-1 text-[11px] text-slate-500 dark:text-slate-400",
123
+ "aria-live": "polite",
124
+ children: m
125
+ }
126
+ ),
127
+ h && /* @__PURE__ */ d(
128
+ "span",
129
+ {
130
+ className: w(
131
+ "shrink-0 pr-1 text-[11px] tabular-nums",
132
+ p > E ? "text-red-600 dark:text-red-300" : "text-amber-700 dark:text-amber-300"
133
+ ),
134
+ children: [
135
+ (p / 1024).toFixed(1),
136
+ " / 20 KB"
137
+ ]
138
+ }
139
+ )
140
+ ] }),
141
+ s === "write" ? /* @__PURE__ */ r(
142
+ "textarea",
143
+ {
144
+ ref: l,
145
+ value: t.text,
146
+ onChange: (a) => g.setText(a.target.value),
147
+ onKeyDown: (a) => {
148
+ a.key === "Escape" && a.currentTarget.blur();
149
+ },
150
+ rows: 5,
151
+ placeholder: "Decisions, owners, next steps…\n**bold**, _italic_, - lists and `code` work.",
152
+ className: "block max-h-[260px] min-h-[96px] w-full resize-y bg-transparent px-2.5 py-2 text-[12.5px] leading-relaxed text-slate-800 outline-none placeholder:text-slate-500 dark:text-slate-100 dark:placeholder:text-slate-400",
153
+ "aria-describedby": o,
154
+ "aria-invalid": !!t.error,
155
+ "data-huddle-notes-input": !0
156
+ }
157
+ ) : /* @__PURE__ */ r("div", { className: "max-h-[260px] min-h-[96px] overflow-y-auto px-2.5 py-2 text-[12.5px] leading-relaxed text-slate-800 dark:text-slate-100", children: t.text.trim() ? /* @__PURE__ */ r(
158
+ z,
159
+ {
160
+ text: t.text,
161
+ mine: !1,
162
+ entityPattern: n.entityPattern,
163
+ renderToken: (a, H) => /* @__PURE__ */ r("span", { children: a.text }, H)
164
+ }
165
+ ) : /* @__PURE__ */ r("span", { className: "text-slate-500 dark:text-slate-400", children: "Nothing written yet." }) }),
166
+ /* @__PURE__ */ r(
167
+ "p",
168
+ {
169
+ id: o,
170
+ className: w(
171
+ "border-t border-slate-200 px-2.5 py-1 text-[11px] dark:border-border",
172
+ t.error ? "text-red-600 dark:text-red-300" : "text-slate-500 dark:text-slate-400"
173
+ ),
174
+ role: t.error ? "alert" : void 0,
175
+ children: t.error ?? "Everyone in the huddle can edit. When the huddle ends the notes are posted to this room."
176
+ }
177
+ )
178
+ ]
179
+ }
180
+ );
181
+ }
182
+ function V(e) {
183
+ if (!e) return "";
184
+ const t = Math.round((Date.now() - e) / 1e3);
185
+ if (t < 45) return "just now";
186
+ const n = Math.round(t / 60);
187
+ return n < 60 ? `${n} min ago` : `${Math.round(n / 60)} h ago`;
188
+ }
189
+ let k = [], Z = 1;
190
+ const S = /* @__PURE__ */ new Set();
191
+ function ee() {
192
+ const e = Z++;
193
+ k = [...k, e];
194
+ for (const n of S) n();
195
+ return Object.assign(() => {
196
+ k = k.filter((n) => n !== e);
197
+ for (const n of S) n();
198
+ }, { id: e });
199
+ }
200
+ function ge() {
201
+ const e = B(), t = q(), [n, s] = _(null), c = F(
202
+ (o) => (S.add(o), () => {
203
+ S.delete(o);
204
+ }),
205
+ () => n !== null && k[0] === n,
206
+ () => !1
207
+ );
208
+ f(() => {
209
+ const o = ee();
210
+ return s(o.id), o;
211
+ }, []), f(() => j(e), [e]), f(() => {
212
+ if (c)
213
+ return g.onUnpostedNote(({ room: o, reason: u }) => {
214
+ var p;
215
+ N.warning("Huddle notes were not posted", {
216
+ description: `${((p = u[0]) == null ? void 0 : p.toUpperCase()) ?? ""}${u.slice(1)}. Copy them before they expire.`,
217
+ duration: 3e4,
218
+ action: {
219
+ label: "Copy notes",
220
+ onClick: () => {
221
+ var m;
222
+ const h = g.endedNote(o);
223
+ if (!h) return void N.error("The notes are no longer available.");
224
+ (m = navigator.clipboard) == null || m.writeText(h).then(() => N.success("Notes copied")).catch(() => N.error("Could not copy the notes."));
225
+ }
226
+ }
227
+ });
228
+ });
229
+ }, [c]);
230
+ const l = A(t);
231
+ return l.current = t, f(() => {
232
+ if (c)
233
+ return i.setNavigator({
234
+ navigate: (o) => l.current.navigate(o),
235
+ urlFor: (o) => (l.current.itemUrl ?? K)(o)
236
+ }), () => i.setNavigator(null);
237
+ }, [c]), !c || typeof document > "u" ? null : U(/* @__PURE__ */ r(te, {}), document.body);
238
+ }
239
+ function te() {
240
+ const e = O(), t = F(P.subscribe, P.getSnapshot);
241
+ if (!e.room || t.status !== "live" || t.room !== e.room) return null;
242
+ let n = null;
243
+ if (e.error)
244
+ n = /* @__PURE__ */ d(v, { children: [
245
+ /* @__PURE__ */ r("span", { className: "min-w-0 truncate text-red-700 dark:text-red-200", children: e.error }),
246
+ /* @__PURE__ */ r(x, { onClick: () => i.clearError(), "aria-label": "Dismiss", children: /* @__PURE__ */ r($, { className: "h-3.5 w-3.5", strokeWidth: 2 }) })
247
+ ] });
248
+ else if (e.presenting && e.request) {
249
+ const s = e.request;
250
+ n = /* @__PURE__ */ d(v, { children: [
251
+ /* @__PURE__ */ r(C, { name: b(s.name), rest: "asks to present" }),
252
+ /* @__PURE__ */ r(x, { onClick: () => i.handOver(s.socket), primary: !0, "data-huddle-handover": !0, children: "Hand over" }),
253
+ /* @__PURE__ */ r(x, { onClick: () => i.decline(s.socket), "data-huddle-keep": !0, children: "Keep presenting" })
254
+ ] });
255
+ } else e.presenting ? n = /* @__PURE__ */ d(v, { children: [
256
+ /* @__PURE__ */ r(R, {}),
257
+ /* @__PURE__ */ r("span", { className: "min-w-0 truncate", children: "You are presenting — the huddle follows your page" }),
258
+ /* @__PURE__ */ r(x, { onClick: () => i.stopPresenting(), "data-huddle-stop-presenting": !0, children: "Stop" })
259
+ ] }) : e.presenter && e.following ? n = /* @__PURE__ */ d(v, { children: [
260
+ /* @__PURE__ */ r(R, {}),
261
+ e.asked === "declined" ? /* @__PURE__ */ r(C, { name: b(e.presenter.name), rest: "is still presenting" }) : /* @__PURE__ */ r(C, { lead: "Following", name: b(e.presenter.name) }),
262
+ /* @__PURE__ */ r(x, { onClick: () => i.stopFollowing(), "data-huddle-stop-following": !0, children: "Stop" })
263
+ ] }) : e.presenter && (n = /* @__PURE__ */ d(v, { children: [
264
+ /* @__PURE__ */ r(C, { name: b(e.presenter.name), rest: "is presenting" }),
265
+ /* @__PURE__ */ r(x, { onClick: () => i.resume(), "data-huddle-resume": !0, children: "Follow" })
266
+ ] }));
267
+ return n ? (
268
+ // Rendered inside ChatPanel's backdrop in the React tree: clicks must not close the panel.
269
+ // biome-ignore lint/a11y/noStaticElementInteractions: stops bubbling only
270
+ // biome-ignore lint/a11y/useKeyWithClickEvents: stops bubbling only
271
+ /* @__PURE__ */ r(
272
+ "div",
273
+ {
274
+ role: "status",
275
+ onClick: (s) => s.stopPropagation(),
276
+ className: "fixed bottom-5 left-1/2 z-50 flex min-h-9 w-max max-w-[calc(100vw-32px)] -translate-x-1/2 flex-wrap items-center justify-end gap-x-2 gap-y-1 rounded-[18px] border py-1 border-slate-200 bg-white pl-3 pr-1 text-[12px] text-slate-800 shadow-[0_4px_16px_rgba(0,0,0,0.10),0_1px_4px_rgba(0,0,0,0.06)] dark:border-border dark:bg-card dark:text-slate-100 motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2 motion-safe:duration-200",
277
+ "data-huddle-follow-chip": !0,
278
+ "data-nvr-dock-aware": !0,
279
+ children: n
280
+ }
281
+ )
282
+ ) : null;
283
+ }
284
+ function C({ lead: e, name: t, rest: n }) {
285
+ return /* @__PURE__ */ d("span", { className: "flex min-w-[120px] flex-1 items-baseline gap-1", children: [
286
+ e && /* @__PURE__ */ r("span", { className: "shrink-0", children: e }),
287
+ /* @__PURE__ */ r("span", { className: "min-w-0 truncate font-medium", children: t }),
288
+ n && /* @__PURE__ */ r("span", { className: "shrink-0", children: n })
289
+ ] });
290
+ }
291
+ function R() {
292
+ return /* @__PURE__ */ d("span", { className: "relative flex h-2 w-2 shrink-0", "aria-hidden": !0, children: [
293
+ /* @__PURE__ */ r("span", { className: "absolute inline-flex h-full w-full rounded-full bg-nvr-cyan opacity-60 motion-safe:animate-ping" }),
294
+ /* @__PURE__ */ r("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-nvr-cyan" })
295
+ ] });
296
+ }
297
+ function x({
298
+ primary: e,
299
+ className: t,
300
+ ...n
301
+ }) {
302
+ return /* @__PURE__ */ r(
303
+ "button",
304
+ {
305
+ type: "button",
306
+ ...n,
307
+ className: w(
308
+ "inline-flex h-7 shrink-0 items-center justify-center rounded-full px-2.5 text-[11.5px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
309
+ e ? "bg-nvr-cyan text-white hover:brightness-95" : "text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-white/10 dark:hover:text-slate-100",
310
+ t
311
+ )
312
+ }
313
+ );
314
+ }
315
+ export {
316
+ ge as HuddleFollowHost,
317
+ xe as HuddleNotesButton,
318
+ be as HuddleNotesPanel,
319
+ fe as useHuddleCollab
320
+ };
@@ -1,143 +1,104 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import { MicOff as p, Mic as x, ScreenShareOff as k, ScreenShare as y, PhoneOff as w, Headphones as l } from "lucide-react";
3
- import { cn as d } from "../../../lib/utils.js";
4
- import { canOpenChatRoom as c, openChatRoom as N } from "../chat-core.js";
5
- import { peerSummary as h } from "./huddle-store.js";
6
- const S = "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 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";
7
- function H({
8
- room: u,
9
- roomLabel: o,
10
- huddle: r,
11
- renderAvatar: m
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { Headphones as h, ChevronDown as k } from "lucide-react";
3
+ import { canOpenChatRoom as u, openChatRoom as x } from "../chat-core.js";
4
+ import { PreJoinCheck as y } from "./HuddleAudioUi.js";
5
+ import { peerSummary as m } from "./huddle-store.js";
6
+ import { useHuddleSpeaking as w } from "./useHuddleAudio.js";
7
+ const N = "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 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", j = "flex h-7 w-4 shrink-0 items-center justify-center rounded-md text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-500 dark:hover:bg-white/10 dark:hover:text-slate-100";
8
+ function f({ onJoin: a }) {
9
+ return /* @__PURE__ */ e(y, { onJoin: a, children: /* @__PURE__ */ e(
10
+ "button",
11
+ {
12
+ type: "button",
13
+ className: j,
14
+ "aria-label": "Check your microphone before joining",
15
+ "data-tip": "Check your microphone first",
16
+ "data-huddle-prejoin": !0,
17
+ children: /* @__PURE__ */ e(k, { className: "h-3 w-3", strokeWidth: 2 })
18
+ }
19
+ ) });
20
+ }
21
+ function W({
22
+ room: a,
23
+ roomLabel: s,
24
+ huddle: t,
25
+ renderAvatar: p
12
26
  }) {
13
- const { enabled: b, support: f, state: e, roster: a, inThis: g, inOther: v } = r;
27
+ const { enabled: b, state: l, roster: n, inThis: v, inOther: g } = t, c = w();
14
28
  if (!b) return null;
15
- if (v && e.room) {
16
- const n = e.room;
17
- return /* @__PURE__ */ i(
29
+ const d = c.selfSpeaking || Object.keys(c.speaking).length > 0;
30
+ if (g && l.room) {
31
+ const i = l.room;
32
+ return /* @__PURE__ */ r(
18
33
  "button",
19
34
  {
20
35
  type: "button",
21
- onClick: () => c() ? N(n) : r.leave(),
36
+ onClick: () => u() ? x(i) : t.leave(),
22
37
  className: "flex h-7 items-center gap-1.5 rounded-md bg-nvr-cyan/10 px-2 text-[11px] font-medium text-slate-700 transition-colors hover:bg-nvr-cyan/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-100",
23
- "data-tip": c() ? "Back to the room you are talking in" : "Leave that huddle",
38
+ "data-tip": u() ? "Back to the room you are talking in" : "Leave that huddle",
24
39
  "data-huddle-elsewhere": !0,
25
40
  children: [
26
- /* @__PURE__ */ i("span", { className: "relative flex h-2 w-2", children: [
27
- /* @__PURE__ */ t("span", { className: "absolute inline-flex h-full w-full rounded-full bg-nvr-cyan opacity-60 motion-safe:animate-ping" }),
28
- /* @__PURE__ */ t("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-nvr-cyan" })
41
+ /* @__PURE__ */ r("span", { className: "relative flex h-2 w-2", "data-huddle-elsewhere-speaking": d, children: [
42
+ d && /* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full rounded-full bg-nvr-cyan opacity-60 motion-safe:animate-ping" }),
43
+ /* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-nvr-cyan" })
29
44
  ] }),
30
45
  "In a huddle"
31
46
  ]
32
47
  }
33
48
  );
34
49
  }
35
- if (g) {
36
- const n = e.status === "joining";
37
- return /* @__PURE__ */ i(
38
- "fieldset",
39
- {
40
- className: "m-0 flex h-7 min-w-0 items-center gap-0.5 rounded-md border border-slate-200 bg-white p-0 px-0.5 dark:border-border dark:bg-card",
41
- "data-huddle-controls": !0,
42
- children: [
43
- /* @__PURE__ */ t("legend", { className: "sr-only", children: "Huddle controls" }),
44
- /* @__PURE__ */ t(
45
- "button",
46
- {
47
- type: "button",
48
- onClick: r.toggleMute,
49
- disabled: n,
50
- className: d(
51
- "flex h-6 w-6 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40",
52
- e.muted ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : "text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-white/10"
53
- ),
54
- "aria-pressed": e.muted,
55
- "aria-label": e.muted ? "Unmute microphone" : "Mute microphone",
56
- "data-tip": e.muted ? "Unmute" : "Mute",
57
- "data-huddle-mute": e.muted ? "on" : "off",
58
- children: e.muted ? /* @__PURE__ */ t(p, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ t(x, { className: "h-3.5 w-3.5", strokeWidth: 2 })
59
- }
60
- ),
61
- f.screen && /* @__PURE__ */ t(
62
- "button",
63
- {
64
- type: "button",
65
- onClick: r.toggleShare,
66
- disabled: n,
67
- className: d(
68
- "flex h-6 w-6 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40",
69
- e.sharing ? "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100" : "text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-white/10"
70
- ),
71
- "aria-pressed": e.sharing,
72
- "aria-label": e.sharing ? "Stop sharing your screen" : "Share your screen",
73
- "data-tip": e.sharing ? "Stop sharing" : "Share screen",
74
- "data-huddle-share": e.sharing ? "on" : "off",
75
- children: e.sharing ? /* @__PURE__ */ t(k, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ t(y, { className: "h-3.5 w-3.5", strokeWidth: 2 })
76
- }
77
- ),
78
- /* @__PURE__ */ i(
79
- "button",
80
- {
81
- type: "button",
82
- onClick: r.leave,
83
- className: "flex h-6 items-center gap-1 rounded px-1.5 text-[11px] font-medium text-red-600 transition-colors hover:bg-red-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-red-300 dark:hover:bg-red-500/15",
84
- "aria-label": "Leave the huddle",
85
- "data-huddle-leave": !0,
86
- children: [
87
- /* @__PURE__ */ t(w, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
88
- "Leave"
89
- ]
90
- }
91
- )
92
- ]
93
- }
94
- );
50
+ if (v) return null;
51
+ if (n.length > 0) {
52
+ const i = n.slice(0, 3);
53
+ return /* @__PURE__ */ r("span", { className: "flex items-center", children: [
54
+ /* @__PURE__ */ r(
55
+ "button",
56
+ {
57
+ type: "button",
58
+ onClick: t.join,
59
+ className: "flex h-7 items-center gap-1.5 rounded-md border border-slate-200 bg-white pl-1 pr-2 text-[11px] font-medium text-slate-700 transition-colors hover:border-nvr-cyan hover:bg-nvr-cyan/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:border-border dark:bg-card dark:text-slate-100",
60
+ "data-tip": `${m(n)} in a huddle — join`,
61
+ "aria-label": `Join the huddle in ${s} (${m(n)})`,
62
+ "data-huddle-join": !0,
63
+ children: [
64
+ /* @__PURE__ */ e("span", { className: "flex -space-x-1.5", children: i.map((o) => /* @__PURE__ */ e(
65
+ "span",
66
+ {
67
+ className: "rounded-full ring-2 ring-white dark:ring-card",
68
+ style: { lineHeight: 0 },
69
+ children: p(o.user, o.name)
70
+ },
71
+ o.socket
72
+ )) }),
73
+ n.length > 3 && /* @__PURE__ */ r("span", { className: "text-slate-500 dark:text-slate-400", children: [
74
+ "+",
75
+ n.length - 3
76
+ ] }),
77
+ /* @__PURE__ */ e(h, { className: "h-3.5 w-3.5 text-nvr-cyan", strokeWidth: 2 }),
78
+ "Join"
79
+ ]
80
+ }
81
+ ),
82
+ /* @__PURE__ */ e(f, { onJoin: t.join })
83
+ ] });
95
84
  }
96
- if (a.length > 0) {
97
- const n = a.slice(0, 3);
98
- return /* @__PURE__ */ i(
85
+ return /* @__PURE__ */ r("span", { className: "flex items-center", children: [
86
+ /* @__PURE__ */ e(
99
87
  "button",
100
88
  {
101
89
  type: "button",
102
- onClick: r.join,
103
- className: "flex h-7 items-center gap-1.5 rounded-md border border-slate-200 bg-white pl-1 pr-2 text-[11px] font-medium text-slate-700 transition-colors hover:border-nvr-cyan hover:bg-nvr-cyan/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:border-border dark:bg-card dark:text-slate-100",
104
- "data-tip": `${h(a)} in a huddle — join`,
105
- "aria-label": `Join the huddle in ${o} (${h(a)})`,
106
- "data-huddle-join": !0,
107
- children: [
108
- /* @__PURE__ */ t("span", { className: "flex -space-x-1.5", children: n.map((s) => /* @__PURE__ */ t(
109
- "span",
110
- {
111
- className: "rounded-full ring-2 ring-white dark:ring-card",
112
- style: { lineHeight: 0 },
113
- children: m(s.user, s.name)
114
- },
115
- s.socket
116
- )) }),
117
- a.length > 3 && /* @__PURE__ */ i("span", { className: "text-slate-500 dark:text-slate-400", children: [
118
- "+",
119
- a.length - 3
120
- ] }),
121
- /* @__PURE__ */ t(l, { className: "h-3.5 w-3.5 text-nvr-cyan", strokeWidth: 2 }),
122
- "Join"
123
- ]
90
+ onClick: t.join,
91
+ className: N,
92
+ "aria-label": `Start a huddle in ${s}`,
93
+ "data-tip": "Start a huddle — talk with whoever is here",
94
+ "data-huddle-start": !0,
95
+ "data-room": a,
96
+ children: /* @__PURE__ */ e(h, { className: "h-4 w-4", strokeWidth: 2 })
124
97
  }
125
- );
126
- }
127
- return /* @__PURE__ */ t(
128
- "button",
129
- {
130
- type: "button",
131
- onClick: r.join,
132
- className: S,
133
- "aria-label": `Start a huddle in ${o}`,
134
- "data-tip": "Start a huddle — talk with whoever is here",
135
- "data-huddle-start": !0,
136
- "data-room": u,
137
- children: /* @__PURE__ */ t(l, { className: "h-4 w-4", strokeWidth: 2 })
138
- }
139
- );
98
+ ),
99
+ /* @__PURE__ */ e(f, { onJoin: t.join })
100
+ ] });
140
101
  }
141
102
  export {
142
- H as HuddleControls
103
+ W as HuddleControls
143
104
  };