@poolse/react-ui 3.2.0-dev.1 → 3.2.0-dev.3

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.
package/dist/index.d.cts CHANGED
@@ -78,6 +78,14 @@ declare const ICONS: {
78
78
  readonly vb: "0 0 24 24";
79
79
  readonly d: "<circle cx=\"12\" cy=\"12\" r=\"8.6\"/><circle cx=\"9\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"15\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><path d=\"M8.4 14.2a4.6 4.6 0 0 0 7.2 0\"/>";
80
80
  };
81
+ readonly fullscreen: {
82
+ readonly vb: "0 0 24 24";
83
+ readonly d: "<path d=\"M4 9V5.5A1.5 1.5 0 0 1 5.5 4H9\"/><path d=\"M15 4h3.5A1.5 1.5 0 0 1 20 5.5V9\"/><path d=\"M20 15v3.5a1.5 1.5 0 0 1-1.5 1.5H15\"/><path d=\"M9 20H5.5A1.5 1.5 0 0 1 4 18.5V15\"/>";
84
+ };
85
+ readonly 'fullscreen-exit': {
86
+ readonly vb: "0 0 24 24";
87
+ readonly d: "<path d=\"M9 4v3.5A1.5 1.5 0 0 1 7.5 9H4\"/><path d=\"M20 9h-3.5A1.5 1.5 0 0 1 15 7.5V4\"/><path d=\"M15 20v-3.5a1.5 1.5 0 0 1 1.5-1.5H20\"/><path d=\"M4 15h3.5A1.5 1.5 0 0 1 9 16.5V20\"/>";
88
+ };
81
89
  readonly headphones: {
82
90
  readonly vb: "0 0 24 24";
83
91
  readonly d: "<path d=\"M4 14v-2a8 8 0 0 1 16 0v2\"/><path d=\"M4 14h2.6a1.4 1.4 0 0 1 1.4 1.4v3.2A1.4 1.4 0 0 1 6.6 20H5.4A1.4 1.4 0 0 1 4 18.6Z\"/><path d=\"M20 14h-2.6a1.4 1.4 0 0 0-1.4 1.4v3.2A1.4 1.4 0 0 0 17.4 20h1.2A1.4 1.4 0 0 0 20 18.6Z\"/>";
@@ -158,6 +166,14 @@ declare const ICONS: {
158
166
  readonly vb: "0 0 24 24";
159
167
  readonly d: "<path d=\"M9 7 4 12l5 5\"/><path d=\"M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20\"/>";
160
168
  };
169
+ readonly 'screen-share': {
170
+ readonly vb: "0 0 24 24";
171
+ readonly d: "<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M12 13V7.4\"/><path d=\"M9.4 9.8 12 7.2l2.6 2.6\"/>";
172
+ };
173
+ readonly 'screen-share-off': {
174
+ readonly vb: "0 0 24 24";
175
+ readonly d: "<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M9.6 8 14.4 12.6\"/><path d=\"M14.4 8 9.6 12.6\"/>";
176
+ };
161
177
  readonly search: {
162
178
  readonly vb: "0 0 24 24";
163
179
  readonly d: "<circle cx=\"11\" cy=\"11\" r=\"6.8\"/><path d=\"M20.8 20.8 16 16\"/>";
@@ -226,7 +242,7 @@ declare const ICONS: {
226
242
  type IconName = keyof typeof ICONS;
227
243
 
228
244
  interface PoolseIconProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
229
- /** Icon name — see {@link IconName} for the full list of 41 icons. */
245
+ /** Icon name — see {@link IconName} for the full list of 45 icons. */
230
246
  name: IconName;
231
247
  /** Width + height in pixels. Defaults to `1.2em` so the icon scales with surrounding text. */
232
248
  size?: number | string;
@@ -621,8 +637,9 @@ interface RoomStageProps {
621
637
  }
622
638
  /**
623
639
  * The room you are in: everyone's video (or their initial while their
624
- * camera is off), and the controls — microphone, camera and output, each
625
- * with a device picker, and Leave. Fills its container: give it the
640
+ * camera is off), a shared screen large when someone shares, and the
641
+ * controls — microphone, camera and output, each with a device picker,
642
+ * screen sharing where the browser and the workspace allow it, and Leave. Fills its container: give it the
626
643
  * space your layout has for the stage.
627
644
  */
628
645
  declare function RoomStage({ room, title, labelFor, className }: RoomStageProps): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -78,6 +78,14 @@ declare const ICONS: {
78
78
  readonly vb: "0 0 24 24";
79
79
  readonly d: "<circle cx=\"12\" cy=\"12\" r=\"8.6\"/><circle cx=\"9\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"15\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><path d=\"M8.4 14.2a4.6 4.6 0 0 0 7.2 0\"/>";
80
80
  };
81
+ readonly fullscreen: {
82
+ readonly vb: "0 0 24 24";
83
+ readonly d: "<path d=\"M4 9V5.5A1.5 1.5 0 0 1 5.5 4H9\"/><path d=\"M15 4h3.5A1.5 1.5 0 0 1 20 5.5V9\"/><path d=\"M20 15v3.5a1.5 1.5 0 0 1-1.5 1.5H15\"/><path d=\"M9 20H5.5A1.5 1.5 0 0 1 4 18.5V15\"/>";
84
+ };
85
+ readonly 'fullscreen-exit': {
86
+ readonly vb: "0 0 24 24";
87
+ readonly d: "<path d=\"M9 4v3.5A1.5 1.5 0 0 1 7.5 9H4\"/><path d=\"M20 9h-3.5A1.5 1.5 0 0 1 15 7.5V4\"/><path d=\"M15 20v-3.5a1.5 1.5 0 0 1 1.5-1.5H20\"/><path d=\"M4 15h3.5A1.5 1.5 0 0 1 9 16.5V20\"/>";
88
+ };
81
89
  readonly headphones: {
82
90
  readonly vb: "0 0 24 24";
83
91
  readonly d: "<path d=\"M4 14v-2a8 8 0 0 1 16 0v2\"/><path d=\"M4 14h2.6a1.4 1.4 0 0 1 1.4 1.4v3.2A1.4 1.4 0 0 1 6.6 20H5.4A1.4 1.4 0 0 1 4 18.6Z\"/><path d=\"M20 14h-2.6a1.4 1.4 0 0 0-1.4 1.4v3.2A1.4 1.4 0 0 0 17.4 20h1.2A1.4 1.4 0 0 0 20 18.6Z\"/>";
@@ -158,6 +166,14 @@ declare const ICONS: {
158
166
  readonly vb: "0 0 24 24";
159
167
  readonly d: "<path d=\"M9 7 4 12l5 5\"/><path d=\"M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20\"/>";
160
168
  };
169
+ readonly 'screen-share': {
170
+ readonly vb: "0 0 24 24";
171
+ readonly d: "<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M12 13V7.4\"/><path d=\"M9.4 9.8 12 7.2l2.6 2.6\"/>";
172
+ };
173
+ readonly 'screen-share-off': {
174
+ readonly vb: "0 0 24 24";
175
+ readonly d: "<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M9.6 8 14.4 12.6\"/><path d=\"M14.4 8 9.6 12.6\"/>";
176
+ };
161
177
  readonly search: {
162
178
  readonly vb: "0 0 24 24";
163
179
  readonly d: "<circle cx=\"11\" cy=\"11\" r=\"6.8\"/><path d=\"M20.8 20.8 16 16\"/>";
@@ -226,7 +242,7 @@ declare const ICONS: {
226
242
  type IconName = keyof typeof ICONS;
227
243
 
228
244
  interface PoolseIconProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
229
- /** Icon name — see {@link IconName} for the full list of 41 icons. */
245
+ /** Icon name — see {@link IconName} for the full list of 45 icons. */
230
246
  name: IconName;
231
247
  /** Width + height in pixels. Defaults to `1.2em` so the icon scales with surrounding text. */
232
248
  size?: number | string;
@@ -621,8 +637,9 @@ interface RoomStageProps {
621
637
  }
622
638
  /**
623
639
  * The room you are in: everyone's video (or their initial while their
624
- * camera is off), and the controls — microphone, camera and output, each
625
- * with a device picker, and Leave. Fills its container: give it the
640
+ * camera is off), a shared screen large when someone shares, and the
641
+ * controls — microphone, camera and output, each with a device picker,
642
+ * screen sharing where the browser and the workspace allow it, and Leave. Fills its container: give it the
626
643
  * space your layout has for the stage.
627
644
  */
628
645
  declare function RoomStage({ room, title, labelFor, className }: RoomStageProps): react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -73,6 +73,14 @@ var ICONS = {
73
73
  vb: "0 0 24 24",
74
74
  d: '<circle cx="12" cy="12" r="8.6"/><circle cx="9" cy="10" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1" fill="currentColor" stroke="none"/><path d="M8.4 14.2a4.6 4.6 0 0 0 7.2 0"/>'
75
75
  },
76
+ fullscreen: {
77
+ vb: "0 0 24 24",
78
+ d: '<path d="M4 9V5.5A1.5 1.5 0 0 1 5.5 4H9"/><path d="M15 4h3.5A1.5 1.5 0 0 1 20 5.5V9"/><path d="M20 15v3.5a1.5 1.5 0 0 1-1.5 1.5H15"/><path d="M9 20H5.5A1.5 1.5 0 0 1 4 18.5V15"/>'
79
+ },
80
+ "fullscreen-exit": {
81
+ vb: "0 0 24 24",
82
+ d: '<path d="M9 4v3.5A1.5 1.5 0 0 1 7.5 9H4"/><path d="M20 9h-3.5A1.5 1.5 0 0 1 15 7.5V4"/><path d="M15 20v-3.5a1.5 1.5 0 0 1 1.5-1.5H20"/><path d="M4 15h3.5A1.5 1.5 0 0 1 9 16.5V20"/>'
83
+ },
76
84
  headphones: {
77
85
  vb: "0 0 24 24",
78
86
  d: '<path d="M4 14v-2a8 8 0 0 1 16 0v2"/><path d="M4 14h2.6a1.4 1.4 0 0 1 1.4 1.4v3.2A1.4 1.4 0 0 1 6.6 20H5.4A1.4 1.4 0 0 1 4 18.6Z"/><path d="M20 14h-2.6a1.4 1.4 0 0 0-1.4 1.4v3.2A1.4 1.4 0 0 0 17.4 20h1.2A1.4 1.4 0 0 0 20 18.6Z"/>'
@@ -153,6 +161,14 @@ var ICONS = {
153
161
  vb: "0 0 24 24",
154
162
  d: '<path d="M9 7 4 12l5 5"/><path d="M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20"/>'
155
163
  },
164
+ "screen-share": {
165
+ vb: "0 0 24 24",
166
+ d: '<rect x="2.6" y="4" width="18.8" height="12.6" rx="2"/><path d="M8.4 20.4h7.2"/><path d="M12 16.6v3.8"/><path d="M12 13V7.4"/><path d="M9.4 9.8 12 7.2l2.6 2.6"/>'
167
+ },
168
+ "screen-share-off": {
169
+ vb: "0 0 24 24",
170
+ d: '<rect x="2.6" y="4" width="18.8" height="12.6" rx="2"/><path d="M8.4 20.4h7.2"/><path d="M12 16.6v3.8"/><path d="M9.6 8 14.4 12.6"/><path d="M14.4 8 9.6 12.6"/>'
171
+ },
156
172
  search: {
157
173
  vb: "0 0 24 24",
158
174
  d: '<circle cx="11" cy="11" r="6.8"/><path d="M20.8 20.8 16 16"/>'
@@ -255,6 +271,47 @@ function PoolseIcon({
255
271
  }
256
272
  );
257
273
  }
274
+ function fullscreenElement() {
275
+ return document.fullscreenElement ?? document.webkitFullscreenElement ?? null;
276
+ }
277
+ function elementFullscreenEnabled() {
278
+ if (typeof document === "undefined") return false;
279
+ return Boolean(
280
+ document.fullscreenEnabled || document.webkitFullscreenEnabled
281
+ );
282
+ }
283
+ function useFullscreen(target, fallbackVideo) {
284
+ const [active, setActive] = useState(false);
285
+ const [supported, setSupported] = useState(false);
286
+ useEffect(() => {
287
+ setSupported(elementFullscreenEnabled() || Boolean(fallbackVideo));
288
+ const sync = () => setActive(target.current != null && fullscreenElement() === target.current);
289
+ document.addEventListener("fullscreenchange", sync);
290
+ document.addEventListener("webkitfullscreenchange", sync);
291
+ return () => {
292
+ document.removeEventListener("fullscreenchange", sync);
293
+ document.removeEventListener("webkitfullscreenchange", sync);
294
+ };
295
+ }, [target, fallbackVideo]);
296
+ const toggle = useCallback(() => {
297
+ const el = target.current;
298
+ if (!el) return;
299
+ if (fullscreenElement() === el) {
300
+ if (document.exitFullscreen) void document.exitFullscreen().catch(() => {
301
+ });
302
+ else document.webkitExitFullscreen?.();
303
+ return;
304
+ }
305
+ if (elementFullscreenEnabled()) {
306
+ if (el.requestFullscreen) void el.requestFullscreen().catch(() => {
307
+ });
308
+ else el.webkitRequestFullscreen?.();
309
+ return;
310
+ }
311
+ fallbackVideo?.current?.webkitEnterFullscreen?.();
312
+ }, [target, fallbackVideo]);
313
+ return { active, supported, toggle };
314
+ }
258
315
 
259
316
  // src/userColor.ts
260
317
  var PALETTE = [
@@ -292,6 +349,14 @@ function CallVideoGrid({
292
349
  const self = participants.find((p) => p.isSelf) ?? null;
293
350
  const others = useMemo(() => participants.filter((p) => !p.isSelf), [participants]);
294
351
  if (participants.length === 0) return null;
352
+ const presenter = others.find((p) => p.screenSharing && p.screenTrack) ?? (self?.screenSharing && self.screenTrack ? self : null);
353
+ if (presenter) {
354
+ const faces = [...others, ...self ? [self] : []];
355
+ return /* @__PURE__ */ jsxs("div", { className: className ?? "callpresent", children: [
356
+ /* @__PURE__ */ jsx(ScreenTile, { participant: presenter, label }),
357
+ /* @__PURE__ */ jsx("div", { className: "callpresent__strip", children: faces.map((participant) => /* @__PURE__ */ jsx(CallVideoTile, { participant, label }, participant.userId)) })
358
+ ] });
359
+ }
295
360
  if (others.length <= 1) {
296
361
  const spotlight = others[0] ?? self;
297
362
  if (!spotlight) return null;
@@ -376,6 +441,67 @@ function CallVideoTile({
376
441
  ] })
377
442
  ] });
378
443
  }
444
+ function ScreenTile({
445
+ participant,
446
+ label
447
+ }) {
448
+ const ref = useRef(null);
449
+ const tile = useRef(null);
450
+ const fullscreen = useFullscreen(tile, ref);
451
+ const track = participant.screenTrack;
452
+ const name = participant.isSelf ? "Your screen" : `${participant.name ?? label(participant.userId)}'s screen`;
453
+ useEffect(() => {
454
+ const element = ref.current;
455
+ if (!element || !track) return;
456
+ track.attach(element);
457
+ return () => {
458
+ track.detach(element);
459
+ };
460
+ }, [track]);
461
+ return /* @__PURE__ */ jsxs(
462
+ "div",
463
+ {
464
+ ref: tile,
465
+ className: "callpresent__screen",
466
+ onDoubleClick: fullscreen.supported ? fullscreen.toggle : void 0,
467
+ children: [
468
+ /* @__PURE__ */ jsx(
469
+ "video",
470
+ {
471
+ ref,
472
+ className: "callgrid__video",
473
+ autoPlay: true,
474
+ playsInline: true,
475
+ muted: true,
476
+ style: { objectFit: "contain" }
477
+ }
478
+ ),
479
+ /* @__PURE__ */ jsxs("div", { className: "callgrid__caption", children: [
480
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "screen-share", size: 13, label: null }),
481
+ /* @__PURE__ */ jsx("span", { className: "callgrid__name", children: name })
482
+ ] }),
483
+ fullscreen.supported && /* @__PURE__ */ jsx(
484
+ "button",
485
+ {
486
+ type: "button",
487
+ className: "callpresent__fullscreen",
488
+ onClick: fullscreen.toggle,
489
+ "aria-label": fullscreen.active ? "Exit full screen" : "Full screen",
490
+ title: fullscreen.active ? "Exit full screen" : "Full screen",
491
+ children: /* @__PURE__ */ jsx(
492
+ PoolseIcon,
493
+ {
494
+ name: fullscreen.active ? "fullscreen-exit" : "fullscreen",
495
+ size: 18,
496
+ label: null
497
+ }
498
+ )
499
+ }
500
+ )
501
+ ]
502
+ }
503
+ );
504
+ }
379
505
  function FloatingSelf({
380
506
  children,
381
507
  onClick
@@ -3500,6 +3626,8 @@ function RoomJoinBar({ room, allowStart = true }) {
3500
3626
  }
3501
3627
  function RoomStage({ room, title, labelFor, className }) {
3502
3628
  const media = room.media;
3629
+ const stage = useRef(null);
3630
+ const fullscreen = useFullscreen(stage);
3503
3631
  const [menu, setMenu] = useState(null);
3504
3632
  const elapsed = useElapsed(room.live?.started_at ?? null, media.status === "connected");
3505
3633
  const openMenu = useCallback(
@@ -3510,101 +3638,142 @@ function RoomStage({ room, title, labelFor, className }) {
3510
3638
  [media]
3511
3639
  );
3512
3640
  const count = media.participants.length;
3641
+ const canShare = media.canShareScreen && room.live?.screen_share_allowed !== false;
3513
3642
  const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
3514
- return /* @__PURE__ */ jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
3515
- /* @__PURE__ */ jsxs("header", { className: "poolse-room__head", children: [
3516
- /* @__PURE__ */ jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
3517
- /* @__PURE__ */ jsx("span", { className: "poolse-room__status", children: status })
3518
- ] }),
3519
- /* @__PURE__ */ jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsx(
3520
- CallVideoGrid,
3521
- {
3522
- participants: media.participants,
3523
- ...labelFor ? { labelFor } : {},
3524
- onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3525
- }
3526
- ) : /* @__PURE__ */ jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3527
- room.error && /* @__PURE__ */ jsx("p", { className: "poolse-room__error", children: room.error.message }),
3528
- /* @__PURE__ */ jsxs("div", { className: "poolse-room__bar", children: [
3529
- /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3530
- /* @__PURE__ */ jsx(
3531
- CallControlButton,
3532
- {
3533
- icon: media.micEnabled ? "mic" : "mic-off",
3534
- active: !media.micEnabled,
3535
- label: media.micEnabled ? "Mute" : "Unmute",
3536
- onClick: () => void media.toggleMic(),
3537
- hasMenu: media.devices.audioinput.length > 0,
3538
- onMenuClick: () => openMenu("audioinput")
3539
- }
3540
- ),
3541
- menu === "audioinput" && /* @__PURE__ */ jsx(
3542
- CallDeviceMenu,
3543
- {
3544
- title: "Microphone",
3545
- devices: media.devices.audioinput,
3546
- activeId: media.activeDevices.audioinput,
3547
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3548
- onClose: () => setMenu(null)
3549
- }
3550
- )
3551
- ] }),
3552
- /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3553
- /* @__PURE__ */ jsx(
3554
- CallControlButton,
3555
- {
3556
- icon: media.cameraEnabled ? "video" : "video-off",
3557
- active: !media.cameraEnabled,
3558
- label: media.cameraEnabled ? "Camera" : "Camera off",
3559
- onClick: () => void media.toggleCamera(),
3560
- disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
3561
- hasMenu: media.devices.videoinput.length > 0,
3562
- onMenuClick: () => openMenu("videoinput")
3563
- }
3564
- ),
3565
- menu === "videoinput" && /* @__PURE__ */ jsx(
3566
- CallDeviceMenu,
3567
- {
3568
- title: "Camera",
3569
- devices: media.devices.videoinput,
3570
- activeId: media.activeDevices.videoinput,
3571
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3572
- onClose: () => setMenu(null)
3573
- }
3574
- )
3575
- ] }),
3576
- media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3577
- /* @__PURE__ */ jsx(
3578
- CallControlButton,
3579
- {
3580
- icon: "speaker",
3581
- label: "Speaker",
3582
- onClick: () => openMenu("audiooutput")
3583
- }
3584
- ),
3585
- menu === "audiooutput" && /* @__PURE__ */ jsx(
3586
- CallDeviceMenu,
3643
+ return /* @__PURE__ */ jsxs(
3644
+ "section",
3645
+ {
3646
+ ref: stage,
3647
+ className: ["poolse-room", className].filter(Boolean).join(" "),
3648
+ "aria-label": "Room",
3649
+ children: [
3650
+ /* @__PURE__ */ jsxs("header", { className: "poolse-room__head", children: [
3651
+ /* @__PURE__ */ jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
3652
+ /* @__PURE__ */ jsx("span", { className: "poolse-room__status", children: status }),
3653
+ fullscreen.supported && /* @__PURE__ */ jsx(
3654
+ "button",
3655
+ {
3656
+ type: "button",
3657
+ className: "poolse-room__fullscreen",
3658
+ onClick: fullscreen.toggle,
3659
+ "aria-label": fullscreen.active ? "Exit full screen" : "Full screen",
3660
+ title: fullscreen.active ? "Exit full screen" : "Full screen",
3661
+ children: /* @__PURE__ */ jsx(
3662
+ PoolseIcon,
3663
+ {
3664
+ name: fullscreen.active ? "fullscreen-exit" : "fullscreen",
3665
+ size: 17,
3666
+ label: null
3667
+ }
3668
+ )
3669
+ }
3670
+ )
3671
+ ] }),
3672
+ /* @__PURE__ */ jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsx(
3673
+ CallVideoGrid,
3587
3674
  {
3588
- title: "Speaker",
3589
- devices: media.devices.audiooutput,
3590
- activeId: media.activeDevices.audiooutput,
3591
- onSelect: (kind, id) => void media.selectDevice(kind, id),
3592
- onClose: () => setMenu(null)
3675
+ participants: media.participants,
3676
+ ...labelFor ? { labelFor } : {},
3677
+ onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3593
3678
  }
3594
- )
3595
- ] }),
3596
- /* @__PURE__ */ jsx(
3597
- CallControlButton,
3598
- {
3599
- icon: "phone-off",
3600
- tone: "danger",
3601
- large: true,
3602
- label: "Leave",
3603
- onClick: room.leave
3604
- }
3605
- )
3606
- ] })
3607
- ] });
3679
+ ) : /* @__PURE__ */ jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3680
+ media.screenSharing && /* @__PURE__ */ jsxs("div", { className: "poolse-room__sharing", role: "status", children: [
3681
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "screen-share", size: 15, label: null }),
3682
+ /* @__PURE__ */ jsx("span", { children: "You are sharing your screen" }),
3683
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void media.setScreenShareEnabled(false), children: "Stop sharing" })
3684
+ ] }),
3685
+ room.error && /* @__PURE__ */ jsx("p", { className: "poolse-room__error", children: room.error.message }),
3686
+ /* @__PURE__ */ jsxs("div", { className: "poolse-room__bar", children: [
3687
+ /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3688
+ /* @__PURE__ */ jsx(
3689
+ CallControlButton,
3690
+ {
3691
+ icon: media.micEnabled ? "mic" : "mic-off",
3692
+ active: !media.micEnabled,
3693
+ label: media.micEnabled ? "Mute" : "Unmute",
3694
+ onClick: () => void media.toggleMic(),
3695
+ hasMenu: media.devices.audioinput.length > 0,
3696
+ onMenuClick: () => openMenu("audioinput")
3697
+ }
3698
+ ),
3699
+ menu === "audioinput" && /* @__PURE__ */ jsx(
3700
+ CallDeviceMenu,
3701
+ {
3702
+ title: "Microphone",
3703
+ devices: media.devices.audioinput,
3704
+ activeId: media.activeDevices.audioinput,
3705
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3706
+ onClose: () => setMenu(null)
3707
+ }
3708
+ )
3709
+ ] }),
3710
+ /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3711
+ /* @__PURE__ */ jsx(
3712
+ CallControlButton,
3713
+ {
3714
+ icon: media.cameraEnabled ? "video" : "video-off",
3715
+ active: !media.cameraEnabled,
3716
+ label: media.cameraEnabled ? "Camera" : "Camera off",
3717
+ onClick: () => void media.toggleCamera(),
3718
+ disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
3719
+ hasMenu: media.devices.videoinput.length > 0,
3720
+ onMenuClick: () => openMenu("videoinput")
3721
+ }
3722
+ ),
3723
+ menu === "videoinput" && /* @__PURE__ */ jsx(
3724
+ CallDeviceMenu,
3725
+ {
3726
+ title: "Camera",
3727
+ devices: media.devices.videoinput,
3728
+ activeId: media.activeDevices.videoinput,
3729
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3730
+ onClose: () => setMenu(null)
3731
+ }
3732
+ )
3733
+ ] }),
3734
+ (canShare || media.screenSharing) && /* @__PURE__ */ jsx(
3735
+ CallControlButton,
3736
+ {
3737
+ icon: media.screenSharing ? "screen-share-off" : "screen-share",
3738
+ active: media.screenSharing,
3739
+ label: media.screenSharing ? "Stop sharing" : "Share screen",
3740
+ onClick: () => void media.toggleScreenShare()
3741
+ }
3742
+ ),
3743
+ media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3744
+ /* @__PURE__ */ jsx(
3745
+ CallControlButton,
3746
+ {
3747
+ icon: "speaker",
3748
+ label: "Speaker",
3749
+ onClick: () => openMenu("audiooutput")
3750
+ }
3751
+ ),
3752
+ menu === "audiooutput" && /* @__PURE__ */ jsx(
3753
+ CallDeviceMenu,
3754
+ {
3755
+ title: "Speaker",
3756
+ devices: media.devices.audiooutput,
3757
+ activeId: media.activeDevices.audiooutput,
3758
+ onSelect: (kind, id) => void media.selectDevice(kind, id),
3759
+ onClose: () => setMenu(null)
3760
+ }
3761
+ )
3762
+ ] }),
3763
+ /* @__PURE__ */ jsx(
3764
+ CallControlButton,
3765
+ {
3766
+ icon: "phone-off",
3767
+ tone: "danger",
3768
+ large: true,
3769
+ label: "Leave",
3770
+ onClick: room.leave
3771
+ }
3772
+ )
3773
+ ] })
3774
+ ]
3775
+ }
3776
+ );
3608
3777
  }
3609
3778
  function useElapsed(startedAt, running) {
3610
3779
  const [, tick] = useState(0);