@poolse/react-ui 2.21.0 → 2.23.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 +99 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -5
- package/dist/index.d.ts +32 -5
- package/dist/index.js +100 -19
- package/dist/index.js.map +1 -1
- package/dist/styles.css +70 -0
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -850,6 +850,26 @@ function PoolseFonts() {
|
|
|
850
850
|
usePoolseFonts(true);
|
|
851
851
|
return null;
|
|
852
852
|
}
|
|
853
|
+
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
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-live-call", role: "status", "aria-label": `${what}, ${who}`, children: [
|
|
857
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
858
|
+
PoolseIcon,
|
|
859
|
+
{
|
|
860
|
+
name: call.media === "video" ? "video" : "phone",
|
|
861
|
+
size: 16,
|
|
862
|
+
label: null,
|
|
863
|
+
className: "poolse-live-call__icon"
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-live-call__text", children: [
|
|
867
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-live-call__title", children: what }),
|
|
868
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-live-call__meta", children: who })
|
|
869
|
+
] }),
|
|
870
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "poolse-live-call__join", onClick: () => onJoin(call), children: "Join" })
|
|
871
|
+
] });
|
|
872
|
+
}
|
|
853
873
|
|
|
854
874
|
// src/listAutocomplete.ts
|
|
855
875
|
var UNORDERED_RE = /^(\s*)([-*+]) (.*)$/;
|
|
@@ -1476,27 +1496,49 @@ function computeInitials(name) {
|
|
|
1476
1496
|
const parts = name.trim().split(/\s+/).slice(0, 2);
|
|
1477
1497
|
return parts.map((p) => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
|
|
1478
1498
|
}
|
|
1479
|
-
function CallLogRow({ msg, meId }) {
|
|
1499
|
+
function CallLogRow({ msg, meId, onCallBack }) {
|
|
1480
1500
|
const display = react$1.callLogDisplayFor(msg, meId);
|
|
1481
1501
|
if (!display) return null;
|
|
1482
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1502
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1503
|
+
CallLogLine,
|
|
1504
|
+
{
|
|
1505
|
+
display,
|
|
1506
|
+
insertedAt: msg.inserted_at,
|
|
1507
|
+
...onCallBack ? { onCallBack } : {}
|
|
1508
|
+
}
|
|
1509
|
+
);
|
|
1483
1510
|
}
|
|
1484
|
-
function CallLogLine({
|
|
1511
|
+
function CallLogLine({
|
|
1512
|
+
display,
|
|
1513
|
+
insertedAt,
|
|
1514
|
+
onCallBack
|
|
1515
|
+
}) {
|
|
1485
1516
|
const time = formatTime(insertedAt);
|
|
1486
1517
|
const icon = display.media === "video" ? "video" : "phone";
|
|
1487
1518
|
const label = [display.title, display.detail, time].filter(Boolean).join(", ");
|
|
1488
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1519
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1489
1520
|
"div",
|
|
1490
1521
|
{
|
|
1491
1522
|
className: `poolse-call-log${display.missed ? " poolse-call-log--missed" : ""}`,
|
|
1492
1523
|
role: "note",
|
|
1493
1524
|
"aria-label": label,
|
|
1494
|
-
children:
|
|
1495
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1525
|
+
children: [
|
|
1526
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "poolse-call-log__chip", children: [
|
|
1527
|
+
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: icon, size: 13, label: null, className: "poolse-call-log__icon" }),
|
|
1528
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-call-log__title", children: display.title }),
|
|
1529
|
+
display.detail && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-call-log__detail", children: display.detail }),
|
|
1530
|
+
time && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-call-log__time", children: time })
|
|
1531
|
+
] }),
|
|
1532
|
+
display.callBack && onCallBack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1533
|
+
"button",
|
|
1534
|
+
{
|
|
1535
|
+
type: "button",
|
|
1536
|
+
className: "poolse-call-log__call-back",
|
|
1537
|
+
onClick: () => onCallBack(display.media),
|
|
1538
|
+
children: "Call back"
|
|
1539
|
+
}
|
|
1540
|
+
)
|
|
1541
|
+
]
|
|
1500
1542
|
}
|
|
1501
1543
|
);
|
|
1502
1544
|
}
|
|
@@ -2166,7 +2208,14 @@ function ActionButton({
|
|
|
2166
2208
|
function MessageRow(props) {
|
|
2167
2209
|
const callLog = react$1.callLogDisplayFor(props.msg, props.meId);
|
|
2168
2210
|
if (callLog !== void 0) {
|
|
2169
|
-
return callLog ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2211
|
+
return callLog ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2212
|
+
CallLogRow,
|
|
2213
|
+
{
|
|
2214
|
+
msg: props.msg,
|
|
2215
|
+
meId: props.meId,
|
|
2216
|
+
...props.onCallBack ? { onCallBack: props.onCallBack } : {}
|
|
2217
|
+
}
|
|
2218
|
+
) : null;
|
|
2170
2219
|
}
|
|
2171
2220
|
return /* @__PURE__ */ jsxRuntime.jsx(BubbleMessageRow, { ...props });
|
|
2172
2221
|
}
|
|
@@ -2604,7 +2653,10 @@ function ConversationView({
|
|
|
2604
2653
|
daySeparators = TRUE,
|
|
2605
2654
|
senderLabels = "auto",
|
|
2606
2655
|
avatars = "auto",
|
|
2607
|
-
onMarkedRead
|
|
2656
|
+
onMarkedRead,
|
|
2657
|
+
onCallBack,
|
|
2658
|
+
onJoinCall,
|
|
2659
|
+
currentCallId = null
|
|
2608
2660
|
}) {
|
|
2609
2661
|
usePoolseFonts(loadFonts);
|
|
2610
2662
|
const { me } = react$1.useMe();
|
|
@@ -2712,8 +2764,10 @@ function ConversationView({
|
|
|
2712
2764
|
() => messages.filter((m) => react$1.isMessageVisibleTo(m, meIdForFeed)),
|
|
2713
2765
|
[messages, meIdForFeed]
|
|
2714
2766
|
);
|
|
2767
|
+
const receiptsVisible = react$1.receiptsOf(me).visible;
|
|
2768
|
+
const showReadState = readReceipts && receiptsVisible;
|
|
2715
2769
|
const maxReadByOthers = react.useMemo(() => {
|
|
2716
|
-
if (!
|
|
2770
|
+
if (!showReadState || !me) return null;
|
|
2717
2771
|
let max = 0;
|
|
2718
2772
|
let any = false;
|
|
2719
2773
|
for (const m of members) {
|
|
@@ -2728,7 +2782,7 @@ function ConversationView({
|
|
|
2728
2782
|
any = true;
|
|
2729
2783
|
}
|
|
2730
2784
|
return any ? max : null;
|
|
2731
|
-
}, [
|
|
2785
|
+
}, [showReadState, me, members, messages]);
|
|
2732
2786
|
const [editingId, setEditingId] = react.useState(null);
|
|
2733
2787
|
const [threadRootId, setThreadRootId] = react.useState(null);
|
|
2734
2788
|
const threadRoot = react.useMemo(
|
|
@@ -2823,6 +2877,15 @@ function ConversationView({
|
|
|
2823
2877
|
onDragLeave,
|
|
2824
2878
|
onDrop,
|
|
2825
2879
|
children: [
|
|
2880
|
+
onJoinCall && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2881
|
+
JoinBanner,
|
|
2882
|
+
{
|
|
2883
|
+
conversationId,
|
|
2884
|
+
meId: me?.id ?? null,
|
|
2885
|
+
currentCallId,
|
|
2886
|
+
onJoin: onJoinCall
|
|
2887
|
+
}
|
|
2888
|
+
),
|
|
2826
2889
|
status !== "connected" && status !== "idle" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2827
2890
|
"div",
|
|
2828
2891
|
{
|
|
@@ -2872,7 +2935,7 @@ function ConversationView({
|
|
|
2872
2935
|
};
|
|
2873
2936
|
})() : msg;
|
|
2874
2937
|
const isSelf = me !== null && msg.sender_id === me.id;
|
|
2875
|
-
const readState =
|
|
2938
|
+
const readState = showReadState && isSelf && maxReadByOthers !== null ? maxReadByOthers >= msg.sequence ? "read" : "sent" : void 0;
|
|
2876
2939
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
2877
2940
|
showDaySeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-day-separator", "aria-hidden": "false", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: react$1.formatDayLabel(msg.inserted_at) }) }),
|
|
2878
2941
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2893,7 +2956,13 @@ function ConversationView({
|
|
|
2893
2956
|
...readState ? { readState } : {},
|
|
2894
2957
|
...labelFor ? { labelFor } : {},
|
|
2895
2958
|
editing: editingId === msg.id,
|
|
2896
|
-
|
|
2959
|
+
...react$1.canEditOwnMessage({
|
|
2960
|
+
isSelf,
|
|
2961
|
+
deleted: !!msg.deleted_at,
|
|
2962
|
+
receiptsVisible,
|
|
2963
|
+
readState,
|
|
2964
|
+
insertedAt: msg.inserted_at
|
|
2965
|
+
}) ? { onStartEdit: () => setEditingId(msg.id) } : {},
|
|
2897
2966
|
onCancelEdit: () => setEditingId(null),
|
|
2898
2967
|
onSaveEdit: async (body) => {
|
|
2899
2968
|
await edit(msg.id, body);
|
|
@@ -2902,7 +2971,8 @@ function ConversationView({
|
|
|
2902
2971
|
onDelete: () => void deleteMsg(msg.id),
|
|
2903
2972
|
onOpenThread: () => setThreadRootId(msg.id),
|
|
2904
2973
|
onQuote: () => setReplyingTo(msg),
|
|
2905
|
-
onQuotedClick: scrollToOriginal
|
|
2974
|
+
onQuotedClick: scrollToOriginal,
|
|
2975
|
+
...onCallBack ? { onCallBack } : {}
|
|
2906
2976
|
}
|
|
2907
2977
|
)
|
|
2908
2978
|
] }, msg.id);
|
|
@@ -2949,6 +3019,17 @@ function ConversationView({
|
|
|
2949
3019
|
) })
|
|
2950
3020
|
] });
|
|
2951
3021
|
}
|
|
3022
|
+
function JoinBanner({
|
|
3023
|
+
conversationId,
|
|
3024
|
+
meId,
|
|
3025
|
+
currentCallId,
|
|
3026
|
+
onJoin
|
|
3027
|
+
}) {
|
|
3028
|
+
const { call, participantIds } = react$1.useLiveCall(conversationId);
|
|
3029
|
+
if (!call || call.id === currentCallId) return null;
|
|
3030
|
+
if (meId !== null && participantIds.includes(meId)) return null;
|
|
3031
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LiveCallBanner, { call, inCall: participantIds.length, onJoin });
|
|
3032
|
+
}
|
|
2952
3033
|
function ChatHeader({
|
|
2953
3034
|
conversationId,
|
|
2954
3035
|
labelFor,
|
|
@@ -3682,6 +3763,7 @@ exports.ConversationList = ConversationList;
|
|
|
3682
3763
|
exports.ConversationView = ConversationView;
|
|
3683
3764
|
exports.EditableMessageBubble = EditableMessageBubble;
|
|
3684
3765
|
exports.GroupDetailsSheet = GroupDetailsSheet;
|
|
3766
|
+
exports.LiveCallBanner = LiveCallBanner;
|
|
3685
3767
|
exports.MemberList = MemberList;
|
|
3686
3768
|
exports.MentionInput = MentionInput;
|
|
3687
3769
|
exports.MessageActions = MessageActions;
|