@poolse/react-ui 2.22.0 → 2.24.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 +219 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +219 -9
- package/dist/index.js.map +1 -1
- package/dist/styles.css +549 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -372,7 +372,9 @@ function CallVideoTile({
|
|
|
372
372
|
className: "callgrid__avatar",
|
|
373
373
|
style: { background: userColor(participant.userId) },
|
|
374
374
|
"aria-hidden": "true",
|
|
375
|
-
children: initialsOf(
|
|
375
|
+
children: initialsOf(
|
|
376
|
+
participant.isSelf ? participant.name ?? label(participant.userId) : name
|
|
377
|
+
)
|
|
376
378
|
}
|
|
377
379
|
) }),
|
|
378
380
|
!hideName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "callgrid__caption", children: [
|
|
@@ -851,8 +853,8 @@ function PoolseFonts() {
|
|
|
851
853
|
return null;
|
|
852
854
|
}
|
|
853
855
|
function LiveCallBanner({ call, inCall, onJoin }) {
|
|
854
|
-
const what = call.media === "video" ? "Video call in progress" : "Voice call in progress";
|
|
855
|
-
const who = inCall > 0 ? `${inCall} on the call` : "Ringing";
|
|
856
|
+
const what = call.kind === "room" ? call.media === "video" ? "Video room" : "Voice room" : call.media === "video" ? "Video call in progress" : "Voice call in progress";
|
|
857
|
+
const who = inCall > 0 ? `${inCall} ${call.kind === "room" ? "in the room" : "on the call"}` : call.kind === "room" ? "Starting" : "Ringing";
|
|
856
858
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-live-call", role: "status", "aria-label": `${what}, ${who}`, children: [
|
|
857
859
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
858
860
|
PoolseIcon,
|
|
@@ -2764,8 +2766,10 @@ function ConversationView({
|
|
|
2764
2766
|
() => messages.filter((m) => react$1.isMessageVisibleTo(m, meIdForFeed)),
|
|
2765
2767
|
[messages, meIdForFeed]
|
|
2766
2768
|
);
|
|
2769
|
+
const receiptsVisible = react$1.receiptsOf(me).visible;
|
|
2770
|
+
const showReadState = readReceipts && receiptsVisible;
|
|
2767
2771
|
const maxReadByOthers = react.useMemo(() => {
|
|
2768
|
-
if (!
|
|
2772
|
+
if (!showReadState || !me) return null;
|
|
2769
2773
|
let max = 0;
|
|
2770
2774
|
let any = false;
|
|
2771
2775
|
for (const m of members) {
|
|
@@ -2780,7 +2784,7 @@ function ConversationView({
|
|
|
2780
2784
|
any = true;
|
|
2781
2785
|
}
|
|
2782
2786
|
return any ? max : null;
|
|
2783
|
-
}, [
|
|
2787
|
+
}, [showReadState, me, members, messages]);
|
|
2784
2788
|
const [editingId, setEditingId] = react.useState(null);
|
|
2785
2789
|
const [threadRootId, setThreadRootId] = react.useState(null);
|
|
2786
2790
|
const threadRoot = react.useMemo(
|
|
@@ -2933,7 +2937,7 @@ function ConversationView({
|
|
|
2933
2937
|
};
|
|
2934
2938
|
})() : msg;
|
|
2935
2939
|
const isSelf = me !== null && msg.sender_id === me.id;
|
|
2936
|
-
const readState =
|
|
2940
|
+
const readState = showReadState && isSelf && maxReadByOthers !== null ? maxReadByOthers >= msg.sequence ? "read" : "sent" : void 0;
|
|
2937
2941
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
2938
2942
|
showDaySeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-day-separator", "aria-hidden": "false", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: react$1.formatDayLabel(msg.inserted_at) }) }),
|
|
2939
2943
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2954,7 +2958,13 @@ function ConversationView({
|
|
|
2954
2958
|
...readState ? { readState } : {},
|
|
2955
2959
|
...labelFor ? { labelFor } : {},
|
|
2956
2960
|
editing: editingId === msg.id,
|
|
2957
|
-
|
|
2961
|
+
...react$1.canEditOwnMessage({
|
|
2962
|
+
isSelf,
|
|
2963
|
+
deleted: !!msg.deleted_at,
|
|
2964
|
+
receiptsVisible,
|
|
2965
|
+
readState,
|
|
2966
|
+
insertedAt: msg.inserted_at
|
|
2967
|
+
}) ? { onStartEdit: () => setEditingId(msg.id) } : {},
|
|
2958
2968
|
onCancelEdit: () => setEditingId(null),
|
|
2959
2969
|
onSaveEdit: async (body) => {
|
|
2960
2970
|
await edit(msg.id, body);
|
|
@@ -3635,6 +3645,206 @@ var PoolseInbox = react.forwardRef(function PoolseInbox2({
|
|
|
3635
3645
|
) : null
|
|
3636
3646
|
] });
|
|
3637
3647
|
});
|
|
3648
|
+
function RoomJoinBar({ room, allowStart = true }) {
|
|
3649
|
+
if (room.joined) return null;
|
|
3650
|
+
const live = room.live;
|
|
3651
|
+
if (live) {
|
|
3652
|
+
const isRoom = live.kind === "room";
|
|
3653
|
+
const what = isRoom ? live.media === "video" ? "Video room" : "Voice room" : live.media === "video" ? "Video call in progress" : "Call in progress";
|
|
3654
|
+
const n = room.presentIds.length;
|
|
3655
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-roombar poolse-roombar--live", role: "status", children: [
|
|
3656
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-roombar__dot", "aria-hidden": "true" }),
|
|
3657
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-roombar__text", children: [
|
|
3658
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: what }),
|
|
3659
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: n > 0 ? ` \xB7 ${n} in the room` : " \xB7 starting" })
|
|
3660
|
+
] }),
|
|
3661
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-roombar__actions", children: [
|
|
3662
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3663
|
+
"button",
|
|
3664
|
+
{
|
|
3665
|
+
type: "button",
|
|
3666
|
+
className: "poolse-roombar__btn",
|
|
3667
|
+
onClick: () => void room.join("audio"),
|
|
3668
|
+
disabled: room.joining,
|
|
3669
|
+
children: [
|
|
3670
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
|
|
3671
|
+
" Join"
|
|
3672
|
+
]
|
|
3673
|
+
}
|
|
3674
|
+
),
|
|
3675
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3676
|
+
"button",
|
|
3677
|
+
{
|
|
3678
|
+
type: "button",
|
|
3679
|
+
className: "poolse-roombar__btn poolse-roombar__btn--primary",
|
|
3680
|
+
onClick: () => void room.join("video"),
|
|
3681
|
+
disabled: room.joining,
|
|
3682
|
+
children: [
|
|
3683
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "video", size: 15, label: null }),
|
|
3684
|
+
" Join with video"
|
|
3685
|
+
]
|
|
3686
|
+
}
|
|
3687
|
+
)
|
|
3688
|
+
] })
|
|
3689
|
+
] });
|
|
3690
|
+
}
|
|
3691
|
+
if (!allowStart) return null;
|
|
3692
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-roombar", children: [
|
|
3693
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-roombar__text", children: "Start a room \u2014 nobody is rung, anyone here can drop in" }),
|
|
3694
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-roombar__actions", children: [
|
|
3695
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3696
|
+
"button",
|
|
3697
|
+
{
|
|
3698
|
+
type: "button",
|
|
3699
|
+
className: "poolse-roombar__btn",
|
|
3700
|
+
onClick: () => void room.join("audio"),
|
|
3701
|
+
disabled: room.joining,
|
|
3702
|
+
children: [
|
|
3703
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "mic", size: 15, label: null }),
|
|
3704
|
+
" Voice"
|
|
3705
|
+
]
|
|
3706
|
+
}
|
|
3707
|
+
),
|
|
3708
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3709
|
+
"button",
|
|
3710
|
+
{
|
|
3711
|
+
type: "button",
|
|
3712
|
+
className: "poolse-roombar__btn poolse-roombar__btn--primary",
|
|
3713
|
+
onClick: () => void room.join("video"),
|
|
3714
|
+
disabled: room.joining,
|
|
3715
|
+
children: [
|
|
3716
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "video", size: 15, label: null }),
|
|
3717
|
+
" Video"
|
|
3718
|
+
]
|
|
3719
|
+
}
|
|
3720
|
+
)
|
|
3721
|
+
] })
|
|
3722
|
+
] });
|
|
3723
|
+
}
|
|
3724
|
+
function RoomStage({ room, title, labelFor, className }) {
|
|
3725
|
+
const media = room.media;
|
|
3726
|
+
const [menu, setMenu] = react.useState(null);
|
|
3727
|
+
const elapsed = useElapsed(room.live?.started_at ?? null, media.status === "connected");
|
|
3728
|
+
const openMenu = react.useCallback(
|
|
3729
|
+
(kind) => {
|
|
3730
|
+
media.refreshDevices();
|
|
3731
|
+
setMenu((current) => current === kind ? null : kind);
|
|
3732
|
+
},
|
|
3733
|
+
[media]
|
|
3734
|
+
);
|
|
3735
|
+
const count = media.participants.length;
|
|
3736
|
+
const status = media.status === "connecting" || room.joining ? "Connecting\u2026" : `${count} in the room${elapsed ? ` \xB7 ${elapsed}` : ""}`;
|
|
3737
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: ["poolse-room", className].filter(Boolean).join(" "), "aria-label": "Room", children: [
|
|
3738
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "poolse-room__head", children: [
|
|
3739
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__title", children: title ?? "Room" }),
|
|
3740
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-room__status", children: status })
|
|
3741
|
+
] }),
|
|
3742
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__stage", children: count > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3743
|
+
CallVideoGrid,
|
|
3744
|
+
{
|
|
3745
|
+
participants: media.participants,
|
|
3746
|
+
...labelFor ? { labelFor } : {},
|
|
3747
|
+
onLocalClick: media.cameraEnabled ? () => void media.switchCamera() : void 0
|
|
3748
|
+
}
|
|
3749
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-room__waiting", children: "Connecting\u2026" }) }),
|
|
3750
|
+
room.error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "poolse-room__error", children: room.error.message }),
|
|
3751
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-room__bar", children: [
|
|
3752
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
3753
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3754
|
+
CallControlButton,
|
|
3755
|
+
{
|
|
3756
|
+
icon: media.micEnabled ? "mic" : "mic-off",
|
|
3757
|
+
active: !media.micEnabled,
|
|
3758
|
+
label: media.micEnabled ? "Mute" : "Unmute",
|
|
3759
|
+
onClick: () => void media.toggleMic(),
|
|
3760
|
+
hasMenu: media.devices.audioinput.length > 0,
|
|
3761
|
+
onMenuClick: () => openMenu("audioinput")
|
|
3762
|
+
}
|
|
3763
|
+
),
|
|
3764
|
+
menu === "audioinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3765
|
+
CallDeviceMenu,
|
|
3766
|
+
{
|
|
3767
|
+
title: "Microphone",
|
|
3768
|
+
devices: media.devices.audioinput,
|
|
3769
|
+
activeId: media.activeDevices.audioinput,
|
|
3770
|
+
onSelect: (kind, id) => void media.selectDevice(kind, id),
|
|
3771
|
+
onClose: () => setMenu(null)
|
|
3772
|
+
}
|
|
3773
|
+
)
|
|
3774
|
+
] }),
|
|
3775
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
3776
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3777
|
+
CallControlButton,
|
|
3778
|
+
{
|
|
3779
|
+
icon: media.cameraEnabled ? "video" : "video-off",
|
|
3780
|
+
active: !media.cameraEnabled,
|
|
3781
|
+
label: media.cameraEnabled ? "Camera" : "Camera off",
|
|
3782
|
+
onClick: () => void media.toggleCamera(),
|
|
3783
|
+
disabled: media.devices.videoinput.length === 0 && !media.cameraEnabled,
|
|
3784
|
+
hasMenu: media.devices.videoinput.length > 0,
|
|
3785
|
+
onMenuClick: () => openMenu("videoinput")
|
|
3786
|
+
}
|
|
3787
|
+
),
|
|
3788
|
+
menu === "videoinput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3789
|
+
CallDeviceMenu,
|
|
3790
|
+
{
|
|
3791
|
+
title: "Camera",
|
|
3792
|
+
devices: media.devices.videoinput,
|
|
3793
|
+
activeId: media.activeDevices.videoinput,
|
|
3794
|
+
onSelect: (kind, id) => void media.selectDevice(kind, id),
|
|
3795
|
+
onClose: () => setMenu(null)
|
|
3796
|
+
}
|
|
3797
|
+
)
|
|
3798
|
+
] }),
|
|
3799
|
+
media.devices.audiooutput.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callsheet__control", children: [
|
|
3800
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3801
|
+
CallControlButton,
|
|
3802
|
+
{
|
|
3803
|
+
icon: "speaker",
|
|
3804
|
+
label: "Speaker",
|
|
3805
|
+
onClick: () => openMenu("audiooutput")
|
|
3806
|
+
}
|
|
3807
|
+
),
|
|
3808
|
+
menu === "audiooutput" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3809
|
+
CallDeviceMenu,
|
|
3810
|
+
{
|
|
3811
|
+
title: "Speaker",
|
|
3812
|
+
devices: media.devices.audiooutput,
|
|
3813
|
+
activeId: media.activeDevices.audiooutput,
|
|
3814
|
+
onSelect: (kind, id) => void media.selectDevice(kind, id),
|
|
3815
|
+
onClose: () => setMenu(null)
|
|
3816
|
+
}
|
|
3817
|
+
)
|
|
3818
|
+
] }),
|
|
3819
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3820
|
+
CallControlButton,
|
|
3821
|
+
{
|
|
3822
|
+
icon: "phone-off",
|
|
3823
|
+
tone: "danger",
|
|
3824
|
+
large: true,
|
|
3825
|
+
label: "Leave",
|
|
3826
|
+
onClick: room.leave
|
|
3827
|
+
}
|
|
3828
|
+
)
|
|
3829
|
+
] })
|
|
3830
|
+
] });
|
|
3831
|
+
}
|
|
3832
|
+
function useElapsed(startedAt, running) {
|
|
3833
|
+
const [, tick] = react.useState(0);
|
|
3834
|
+
react.useEffect(() => {
|
|
3835
|
+
if (!running) return;
|
|
3836
|
+
const id = setInterval(() => tick((n) => n + 1), 1e3);
|
|
3837
|
+
return () => clearInterval(id);
|
|
3838
|
+
}, [running]);
|
|
3839
|
+
if (!running || !startedAt) return null;
|
|
3840
|
+
const start = Date.parse(startedAt);
|
|
3841
|
+
if (!Number.isFinite(start)) return null;
|
|
3842
|
+
const total = Math.max(0, Math.floor((Date.now() - start) / 1e3));
|
|
3843
|
+
const h = Math.floor(total / 3600);
|
|
3844
|
+
const m = Math.floor(total % 3600 / 60);
|
|
3845
|
+
const s = String(total % 60).padStart(2, "0");
|
|
3846
|
+
return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${s}` : `${m}:${s}`;
|
|
3847
|
+
}
|
|
3638
3848
|
var MARK_PATHS = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3639
3849
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3640
3850
|
"path",
|
|
@@ -3767,6 +3977,8 @@ exports.PoolseInbox = PoolseInbox;
|
|
|
3767
3977
|
exports.PoolseLogo = PoolseLogo;
|
|
3768
3978
|
exports.ReactionPicker = ReactionPicker;
|
|
3769
3979
|
exports.ReactionStrip = ReactionStrip;
|
|
3980
|
+
exports.RoomJoinBar = RoomJoinBar;
|
|
3981
|
+
exports.RoomStage = RoomStage;
|
|
3770
3982
|
exports.ThreadView = ThreadView;
|
|
3771
3983
|
exports.TypingIndicator = TypingIndicator;
|
|
3772
3984
|
exports.UploadQueueStrip = UploadQueueStrip;
|