@poolse/react-ui 1.0.2 → 1.0.3
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 +33 -3
- 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 +33 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css +73 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -149,6 +149,14 @@ interface MessageBubbleProps {
|
|
|
149
149
|
* `userResolver` config.
|
|
150
150
|
*/
|
|
151
151
|
showSenderName?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Slot for a "show actions" affordance — typically a chevron
|
|
154
|
+
* rendered by `<MessageRow>` that toggles the actions popover on
|
|
155
|
+
* desktop click. Positioned absolutely at the top-trailing corner
|
|
156
|
+
* inside the bubble so it overlays the message border; hidden by
|
|
157
|
+
* CSS until the row is hovered.
|
|
158
|
+
*/
|
|
159
|
+
actionsTrigger?: ReactNode;
|
|
152
160
|
}
|
|
153
161
|
/**
|
|
154
162
|
* One message bubble. The default renderer for `<ConversationView>` —
|
|
@@ -159,7 +167,7 @@ interface MessageBubbleProps {
|
|
|
159
167
|
* (coral for self, surface-with-border for others), matching the
|
|
160
168
|
* brand-kit chat showcase.
|
|
161
169
|
*/
|
|
162
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
170
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
163
171
|
|
|
164
172
|
interface EditableMessageBubbleProps {
|
|
165
173
|
message: Message;
|
package/dist/index.d.ts
CHANGED
|
@@ -149,6 +149,14 @@ interface MessageBubbleProps {
|
|
|
149
149
|
* `userResolver` config.
|
|
150
150
|
*/
|
|
151
151
|
showSenderName?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Slot for a "show actions" affordance — typically a chevron
|
|
154
|
+
* rendered by `<MessageRow>` that toggles the actions popover on
|
|
155
|
+
* desktop click. Positioned absolutely at the top-trailing corner
|
|
156
|
+
* inside the bubble so it overlays the message border; hidden by
|
|
157
|
+
* CSS until the row is hovered.
|
|
158
|
+
*/
|
|
159
|
+
actionsTrigger?: ReactNode;
|
|
152
160
|
}
|
|
153
161
|
/**
|
|
154
162
|
* One message bubble. The default renderer for `<ConversationView>` —
|
|
@@ -159,7 +167,7 @@ interface MessageBubbleProps {
|
|
|
159
167
|
* (coral for self, surface-with-border for others), matching the
|
|
160
168
|
* brand-kit chat showcase.
|
|
161
169
|
*/
|
|
162
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
170
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
163
171
|
|
|
164
172
|
interface EditableMessageBubbleProps {
|
|
165
173
|
message: Message;
|
package/dist/index.js
CHANGED
|
@@ -898,7 +898,8 @@ function MessageBubble({
|
|
|
898
898
|
groupPosition = "standalone",
|
|
899
899
|
maxBodyLength = 0,
|
|
900
900
|
markdown = false,
|
|
901
|
-
showSenderName = false
|
|
901
|
+
showSenderName = false,
|
|
902
|
+
actionsTrigger
|
|
902
903
|
}) {
|
|
903
904
|
const isSelf = currentUserId !== null && message.sender_id === currentUserId;
|
|
904
905
|
const [expanded, setExpanded] = useState(false);
|
|
@@ -924,6 +925,7 @@ function MessageBubble({
|
|
|
924
925
|
}) : "";
|
|
925
926
|
const showQuoteCard = message.quoted_message !== void 0 && message.quoted_message !== null ? "full" : message.quoted_message_id ? "placeholder" : null;
|
|
926
927
|
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
928
|
+
actionsTrigger,
|
|
927
929
|
renderSenderName && /* @__PURE__ */ jsx("div", { className: "poolse-message__sender", style: { color: senderColorHex }, children: senderName }),
|
|
928
930
|
showQuoteCard === "full" && /* @__PURE__ */ jsx(
|
|
929
931
|
QuotedCard,
|
|
@@ -1365,6 +1367,7 @@ function MessageRow({
|
|
|
1365
1367
|
].filter(Boolean).join(" "),
|
|
1366
1368
|
"data-message-id": msg.id,
|
|
1367
1369
|
"data-actions-open": actionsOpen || void 0,
|
|
1370
|
+
"data-avatar": showAvatar && !isSelf ? true : void 0,
|
|
1368
1371
|
onClick: onRowClick,
|
|
1369
1372
|
children: [
|
|
1370
1373
|
editing ? /* @__PURE__ */ jsx(
|
|
@@ -1396,7 +1399,23 @@ function MessageRow({
|
|
|
1396
1399
|
showSenderName,
|
|
1397
1400
|
...readState ? { readState } : {},
|
|
1398
1401
|
...labelFor ? { labelFor } : {},
|
|
1399
|
-
...onQuotedClick ? { onQuotedClick } : {}
|
|
1402
|
+
...onQuotedClick ? { onQuotedClick } : {},
|
|
1403
|
+
...showActions ? {
|
|
1404
|
+
actionsTrigger: /* @__PURE__ */ jsx(
|
|
1405
|
+
"button",
|
|
1406
|
+
{
|
|
1407
|
+
type: "button",
|
|
1408
|
+
className: "poolse-message__chevron",
|
|
1409
|
+
"aria-label": "Show message actions",
|
|
1410
|
+
"aria-expanded": actionsOpen,
|
|
1411
|
+
onClick: (e) => {
|
|
1412
|
+
e.stopPropagation();
|
|
1413
|
+
setActionsOpen((o) => !o);
|
|
1414
|
+
},
|
|
1415
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "chevron-down", size: 14, label: null })
|
|
1416
|
+
}
|
|
1417
|
+
)
|
|
1418
|
+
} : {}
|
|
1400
1419
|
}
|
|
1401
1420
|
)
|
|
1402
1421
|
}
|
|
@@ -1574,7 +1593,18 @@ function ThreadView({
|
|
|
1574
1593
|
);
|
|
1575
1594
|
}
|
|
1576
1595
|
function defaultRenderReply(msg, currentUserId) {
|
|
1577
|
-
return /* @__PURE__ */ jsx(
|
|
1596
|
+
return /* @__PURE__ */ jsx(
|
|
1597
|
+
MessageRow,
|
|
1598
|
+
{
|
|
1599
|
+
msg,
|
|
1600
|
+
meId: currentUserId,
|
|
1601
|
+
reactions: true,
|
|
1602
|
+
attachments: true,
|
|
1603
|
+
actions: true,
|
|
1604
|
+
threads: false,
|
|
1605
|
+
quotations: false
|
|
1606
|
+
}
|
|
1607
|
+
);
|
|
1578
1608
|
}
|
|
1579
1609
|
function TypingIndicator({ typing, labelFor }) {
|
|
1580
1610
|
const ids = Array.from(typing);
|