@poolse/react-ui 1.0.2 → 1.0.4
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 +56 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +56 -11
- package/dist/index.js.map +1 -1
- package/dist/styles.css +100 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -905,7 +905,8 @@ function MessageBubble({
|
|
|
905
905
|
groupPosition = "standalone",
|
|
906
906
|
maxBodyLength = 0,
|
|
907
907
|
markdown = false,
|
|
908
|
-
showSenderName = false
|
|
908
|
+
showSenderName = false,
|
|
909
|
+
actionsTrigger
|
|
909
910
|
}) {
|
|
910
911
|
const isSelf = currentUserId !== null && message.sender_id === currentUserId;
|
|
911
912
|
const [expanded, setExpanded] = react.useState(false);
|
|
@@ -931,6 +932,7 @@ function MessageBubble({
|
|
|
931
932
|
}) : "";
|
|
932
933
|
const showQuoteCard = message.quoted_message !== void 0 && message.quoted_message !== null ? "full" : message.quoted_message_id ? "placeholder" : null;
|
|
933
934
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
935
|
+
actionsTrigger,
|
|
934
936
|
renderSenderName && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__sender", style: { color: senderColorHex }, children: senderName }),
|
|
935
937
|
showQuoteCard === "full" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
936
938
|
QuotedCard,
|
|
@@ -1227,7 +1229,6 @@ function ReactionPicker({
|
|
|
1227
1229
|
className: "poolse-reaction-picker",
|
|
1228
1230
|
role: "menu",
|
|
1229
1231
|
"aria-label": "Pick a reaction",
|
|
1230
|
-
style: { position: "absolute", bottom: "100%", left: 0, marginBottom: 6 },
|
|
1231
1232
|
onKeyDown: onKey,
|
|
1232
1233
|
children: COMMON_EMOJIS.map((e) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1233
1234
|
"button",
|
|
@@ -1372,6 +1373,7 @@ function MessageRow({
|
|
|
1372
1373
|
].filter(Boolean).join(" "),
|
|
1373
1374
|
"data-message-id": msg.id,
|
|
1374
1375
|
"data-actions-open": actionsOpen || void 0,
|
|
1376
|
+
"data-avatar": showAvatar && !isSelf ? true : void 0,
|
|
1375
1377
|
onClick: onRowClick,
|
|
1376
1378
|
children: [
|
|
1377
1379
|
editing ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1403,7 +1405,23 @@ function MessageRow({
|
|
|
1403
1405
|
showSenderName,
|
|
1404
1406
|
...readState ? { readState } : {},
|
|
1405
1407
|
...labelFor ? { labelFor } : {},
|
|
1406
|
-
...onQuotedClick ? { onQuotedClick } : {}
|
|
1408
|
+
...onQuotedClick ? { onQuotedClick } : {},
|
|
1409
|
+
...showActions ? {
|
|
1410
|
+
actionsTrigger: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1411
|
+
"button",
|
|
1412
|
+
{
|
|
1413
|
+
type: "button",
|
|
1414
|
+
className: "poolse-message__chevron",
|
|
1415
|
+
"aria-label": "Show message actions",
|
|
1416
|
+
"aria-expanded": actionsOpen,
|
|
1417
|
+
onClick: (e) => {
|
|
1418
|
+
e.stopPropagation();
|
|
1419
|
+
setActionsOpen((o) => !o);
|
|
1420
|
+
},
|
|
1421
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "chevron-down", size: 14, label: null })
|
|
1422
|
+
}
|
|
1423
|
+
)
|
|
1424
|
+
} : {}
|
|
1407
1425
|
}
|
|
1408
1426
|
)
|
|
1409
1427
|
}
|
|
@@ -1516,10 +1534,20 @@ function ThreadView({
|
|
|
1516
1534
|
renderMessage
|
|
1517
1535
|
}) {
|
|
1518
1536
|
const { me } = react$1.useMe();
|
|
1519
|
-
const {
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1537
|
+
const {
|
|
1538
|
+
replies,
|
|
1539
|
+
loading,
|
|
1540
|
+
error,
|
|
1541
|
+
hasMore,
|
|
1542
|
+
loadMore,
|
|
1543
|
+
sendReply,
|
|
1544
|
+
edit,
|
|
1545
|
+
delete: deleteReply
|
|
1546
|
+
} = react$1.useThread(conversationId, rootMessage.id);
|
|
1547
|
+
const [editingId, setEditingId] = react.useState(null);
|
|
1548
|
+
react.useEffect(() => {
|
|
1549
|
+
setEditingId(null);
|
|
1550
|
+
}, [rootMessage.id]);
|
|
1523
1551
|
const listRef = react.useRef(null);
|
|
1524
1552
|
const closeBtnRef = react.useRef(null);
|
|
1525
1553
|
const lastReplyIdRef = react.useRef(null);
|
|
@@ -1540,7 +1568,27 @@ function ThreadView({
|
|
|
1540
1568
|
document.addEventListener("keydown", onKey);
|
|
1541
1569
|
return () => document.removeEventListener("keydown", onKey);
|
|
1542
1570
|
}, [onClose]);
|
|
1543
|
-
const
|
|
1571
|
+
const renderDefault = (msg) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1572
|
+
MessageRow,
|
|
1573
|
+
{
|
|
1574
|
+
msg,
|
|
1575
|
+
meId: me?.id ?? null,
|
|
1576
|
+
reactions: true,
|
|
1577
|
+
attachments: true,
|
|
1578
|
+
actions: true,
|
|
1579
|
+
threads: false,
|
|
1580
|
+
quotations: false,
|
|
1581
|
+
editing: editingId === msg.id,
|
|
1582
|
+
onStartEdit: () => setEditingId(msg.id),
|
|
1583
|
+
onCancelEdit: () => setEditingId(null),
|
|
1584
|
+
onSaveEdit: async (body) => {
|
|
1585
|
+
await edit(msg.id, body);
|
|
1586
|
+
setEditingId(null);
|
|
1587
|
+
},
|
|
1588
|
+
onDelete: () => void deleteReply(msg.id)
|
|
1589
|
+
}
|
|
1590
|
+
);
|
|
1591
|
+
const renderOne = renderMessage ? (msg, currentUserId) => renderMessage(msg, currentUserId) : (msg) => renderDefault(msg);
|
|
1544
1592
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1545
1593
|
"aside",
|
|
1546
1594
|
{
|
|
@@ -1580,9 +1628,6 @@ function ThreadView({
|
|
|
1580
1628
|
}
|
|
1581
1629
|
);
|
|
1582
1630
|
}
|
|
1583
|
-
function defaultRenderReply(msg, currentUserId) {
|
|
1584
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MessageBubble, { message: msg, currentUserId });
|
|
1585
|
-
}
|
|
1586
1631
|
function TypingIndicator({ typing, labelFor }) {
|
|
1587
1632
|
const ids = Array.from(typing);
|
|
1588
1633
|
const isTyping = ids.length > 0;
|