@poolse/react-ui 3.2.0-dev.0 → 3.2.0-dev.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.
package/dist/index.d.cts CHANGED
@@ -158,6 +158,14 @@ declare const ICONS: {
158
158
  readonly vb: "0 0 24 24";
159
159
  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
160
  };
161
+ readonly 'screen-share': {
162
+ readonly vb: "0 0 24 24";
163
+ 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\"/>";
164
+ };
165
+ readonly 'screen-share-off': {
166
+ readonly vb: "0 0 24 24";
167
+ 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\"/>";
168
+ };
161
169
  readonly search: {
162
170
  readonly vb: "0 0 24 24";
163
171
  readonly d: "<circle cx=\"11\" cy=\"11\" r=\"6.8\"/><path d=\"M20.8 20.8 16 16\"/>";
@@ -226,7 +234,7 @@ declare const ICONS: {
226
234
  type IconName = keyof typeof ICONS;
227
235
 
228
236
  interface PoolseIconProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
229
- /** Icon name — see {@link IconName} for the full list of 41 icons. */
237
+ /** Icon name — see {@link IconName} for the full list of 43 icons. */
230
238
  name: IconName;
231
239
  /** Width + height in pixels. Defaults to `1.2em` so the icon scales with surrounding text. */
232
240
  size?: number | string;
@@ -621,8 +629,9 @@ interface RoomStageProps {
621
629
  }
622
630
  /**
623
631
  * 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
632
+ * camera is off), a shared screen large when someone shares, and the
633
+ * controls — microphone, camera and output, each with a device picker,
634
+ * screen sharing where the browser and the workspace allow it, and Leave. Fills its container: give it the
626
635
  * space your layout has for the stage.
627
636
  */
628
637
  declare function RoomStage({ room, title, labelFor, className }: RoomStageProps): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -158,6 +158,14 @@ declare const ICONS: {
158
158
  readonly vb: "0 0 24 24";
159
159
  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
160
  };
161
+ readonly 'screen-share': {
162
+ readonly vb: "0 0 24 24";
163
+ 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\"/>";
164
+ };
165
+ readonly 'screen-share-off': {
166
+ readonly vb: "0 0 24 24";
167
+ 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\"/>";
168
+ };
161
169
  readonly search: {
162
170
  readonly vb: "0 0 24 24";
163
171
  readonly d: "<circle cx=\"11\" cy=\"11\" r=\"6.8\"/><path d=\"M20.8 20.8 16 16\"/>";
@@ -226,7 +234,7 @@ declare const ICONS: {
226
234
  type IconName = keyof typeof ICONS;
227
235
 
228
236
  interface PoolseIconProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
229
- /** Icon name — see {@link IconName} for the full list of 41 icons. */
237
+ /** Icon name — see {@link IconName} for the full list of 43 icons. */
230
238
  name: IconName;
231
239
  /** Width + height in pixels. Defaults to `1.2em` so the icon scales with surrounding text. */
232
240
  size?: number | string;
@@ -621,8 +629,9 @@ interface RoomStageProps {
621
629
  }
622
630
  /**
623
631
  * 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
632
+ * camera is off), a shared screen large when someone shares, and the
633
+ * controls — microphone, camera and output, each with a device picker,
634
+ * screen sharing where the browser and the workspace allow it, and Leave. Fills its container: give it the
626
635
  * space your layout has for the stage.
627
636
  */
628
637
  declare function RoomStage({ room, title, labelFor, className }: RoomStageProps): react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -153,6 +153,14 @@ var ICONS = {
153
153
  vb: "0 0 24 24",
154
154
  d: '<path d="M9 7 4 12l5 5"/><path d="M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20"/>'
155
155
  },
156
+ "screen-share": {
157
+ vb: "0 0 24 24",
158
+ 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"/>'
159
+ },
160
+ "screen-share-off": {
161
+ vb: "0 0 24 24",
162
+ 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"/>'
163
+ },
156
164
  search: {
157
165
  vb: "0 0 24 24",
158
166
  d: '<circle cx="11" cy="11" r="6.8"/><path d="M20.8 20.8 16 16"/>'
@@ -292,6 +300,14 @@ function CallVideoGrid({
292
300
  const self = participants.find((p) => p.isSelf) ?? null;
293
301
  const others = useMemo(() => participants.filter((p) => !p.isSelf), [participants]);
294
302
  if (participants.length === 0) return null;
303
+ const presenter = others.find((p) => p.screenSharing && p.screenTrack) ?? (self?.screenSharing && self.screenTrack ? self : null);
304
+ if (presenter) {
305
+ const faces = [...others, ...self ? [self] : []];
306
+ return /* @__PURE__ */ jsxs("div", { className: className ?? "callpresent", children: [
307
+ /* @__PURE__ */ jsx(ScreenTile, { participant: presenter, label }),
308
+ /* @__PURE__ */ jsx("div", { className: "callpresent__strip", children: faces.map((participant) => /* @__PURE__ */ jsx(CallVideoTile, { participant, label }, participant.userId)) })
309
+ ] });
310
+ }
295
311
  if (others.length <= 1) {
296
312
  const spotlight = others[0] ?? self;
297
313
  if (!spotlight) return null;
@@ -376,6 +392,39 @@ function CallVideoTile({
376
392
  ] })
377
393
  ] });
378
394
  }
395
+ function ScreenTile({
396
+ participant,
397
+ label
398
+ }) {
399
+ const ref = useRef(null);
400
+ const track = participant.screenTrack;
401
+ const name = participant.isSelf ? "Your screen" : `${participant.name ?? label(participant.userId)}'s screen`;
402
+ useEffect(() => {
403
+ const element = ref.current;
404
+ if (!element || !track) return;
405
+ track.attach(element);
406
+ return () => {
407
+ track.detach(element);
408
+ };
409
+ }, [track]);
410
+ return /* @__PURE__ */ jsxs("div", { className: "callpresent__screen", children: [
411
+ /* @__PURE__ */ jsx(
412
+ "video",
413
+ {
414
+ ref,
415
+ className: "callgrid__video",
416
+ autoPlay: true,
417
+ playsInline: true,
418
+ muted: true,
419
+ style: { objectFit: "contain" }
420
+ }
421
+ ),
422
+ /* @__PURE__ */ jsxs("div", { className: "callgrid__caption", children: [
423
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "screen-share", size: 13, label: null }),
424
+ /* @__PURE__ */ jsx("span", { className: "callgrid__name", children: name })
425
+ ] })
426
+ ] });
427
+ }
379
428
  function FloatingSelf({
380
429
  children,
381
430
  onClick
@@ -3510,6 +3559,7 @@ function RoomStage({ room, title, labelFor, className }) {
3510
3559
  [media]
3511
3560
  );
3512
3561
  const count = media.participants.length;
3562
+ const canShare = media.canShareScreen && room.live?.screen_share_allowed !== false;
3513
3563
  const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
3514
3564
  return /* @__PURE__ */ jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
3515
3565
  /* @__PURE__ */ jsxs("header", { className: "poolse-room__head", children: [
@@ -3524,6 +3574,11 @@ function RoomStage({ room, title, labelFor, className }) {
3524
3574
  onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
3525
3575
  }
3526
3576
  ) : /* @__PURE__ */ jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
3577
+ media.screenSharing && /* @__PURE__ */ jsxs("div", { className: "poolse-room__sharing", role: "status", children: [
3578
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "screen-share", size: 15, label: null }),
3579
+ /* @__PURE__ */ jsx("span", { children: "You are sharing your screen" }),
3580
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => void media.setScreenShareEnabled(false), children: "Stop sharing" })
3581
+ ] }),
3527
3582
  room.error && /* @__PURE__ */ jsx("p", { className: "poolse-room__error", children: room.error.message }),
3528
3583
  /* @__PURE__ */ jsxs("div", { className: "poolse-room__bar", children: [
3529
3584
  /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
@@ -3573,6 +3628,15 @@ function RoomStage({ room, title, labelFor, className }) {
3573
3628
  }
3574
3629
  )
3575
3630
  ] }),
3631
+ (canShare || media.screenSharing) && /* @__PURE__ */ jsx(
3632
+ CallControlButton,
3633
+ {
3634
+ icon: media.screenSharing ? "screen-share-off" : "screen-share",
3635
+ active: media.screenSharing,
3636
+ label: media.screenSharing ? "Stop sharing" : "Share screen",
3637
+ onClick: () => void media.toggleScreenShare()
3638
+ }
3639
+ ),
3576
3640
  media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxs("span", { className: "callsheet__control", children: [
3577
3641
  /* @__PURE__ */ jsx(
3578
3642
  CallControlButton,