@poolse/react-ui 2.10.0 → 2.11.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.
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var react$1 = require('@poolse/react');
5
4
  var react = require('react');
6
5
  var jsxRuntime = require('react/jsx-runtime');
6
+ var react$1 = require('@poolse/react');
7
7
  var ReactMarkdown = require('react-markdown');
8
8
  var remarkGfm = require('remark-gfm');
9
9
 
@@ -12,7 +12,44 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
  var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
13
13
  var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
14
14
 
15
- // src/ConversationView.tsx
15
+ // src/CallVideoGrid.tsx
16
+ function CallVideoGrid({ participants, labelFor, className }) {
17
+ const label = labelFor ?? ((id) => `User ${id.slice(0, 6)}`);
18
+ if (participants.length === 0) return null;
19
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: className ?? "callgrid", children: participants.map((participant) => /* @__PURE__ */ jsxRuntime.jsx(CallVideoTile, { participant, label }, participant.userId)) });
20
+ }
21
+ function CallVideoTile({
22
+ participant,
23
+ label
24
+ }) {
25
+ const ref = react.useRef(null);
26
+ const track = participant.videoTrack;
27
+ react.useEffect(() => {
28
+ const element = ref.current;
29
+ if (!element || !track) return;
30
+ track.attach(element);
31
+ return () => {
32
+ track.detach(element);
33
+ };
34
+ }, [track]);
35
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `callgrid__tile${participant.speaking ? " callgrid__tile--speaking" : ""}`, children: [
36
+ track ? /* @__PURE__ */ jsxRuntime.jsx(
37
+ "video",
38
+ {
39
+ ref,
40
+ className: "callgrid__video",
41
+ autoPlay: true,
42
+ playsInline: true,
43
+ muted: participant.isSelf,
44
+ style: participant.isSelf ? { transform: "scaleX(-1)" } : void 0
45
+ }
46
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callgrid__placeholder", "aria-hidden": "true", children: label(participant.userId).slice(0, 1).toUpperCase() }),
47
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callgrid__caption", children: [
48
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "callgrid__name", children: participant.isSelf ? "You" : participant.name ?? label(participant.userId) }),
49
+ !participant.micEnabled && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "callgrid__muted", children: "muted" })
50
+ ] })
51
+ ] });
52
+ }
16
53
  var FONT_HREF = "https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,800&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";
17
54
  var FONT_HREF_PRECONNECT_GOOGLE = "https://fonts.googleapis.com";
18
55
  var FONT_HREF_PRECONNECT_STATIC = "https://fonts.gstatic.com";
@@ -3012,6 +3049,7 @@ function PoolseLogo({
3012
3049
 
3013
3050
  exports.AttachmentPreview = AttachmentPreview;
3014
3051
  exports.Avatar = Avatar;
3052
+ exports.CallVideoGrid = CallVideoGrid;
3015
3053
  exports.ChatHeader = ChatHeader;
3016
3054
  exports.ConversationList = ConversationList;
3017
3055
  exports.ConversationView = ConversationView;