@poolse/react-ui 3.3.0 → 3.4.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/CHANGELOG.md +49 -0
- package/README.md +43 -1
- package/dist/index.cjs +664 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +148 -10
- package/dist/index.d.ts +148 -10
- package/dist/index.js +645 -179
- package/dist/index.js.map +1 -1
- package/dist/styles.css +388 -7
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CallParticipant, CallDevice, CallDeviceKind, Message, Uuid, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { SVGProps, ReactElement, ReactNode } from 'react';
|
|
5
|
-
import { UseRoom, UploadItem, ReactionMap } from '@poolse/react';
|
|
4
|
+
import { SVGProps, ReactElement, ReactNode, CSSProperties } from 'react';
|
|
5
|
+
import { GroupPosition, UseRoom, UploadItem, ReactionMap } from '@poolse/react';
|
|
6
|
+
import { ThemeInput, ColorSchemePreference, ResolvedTheme, ColorScheme } from '@poolse/theme';
|
|
7
|
+
export { BUILT_IN_THEME_IDS, BuiltInThemeId, ColorScheme, ColorSchemePreference, DEFAULT_THEME_ID, Theme, ThemeInput, createTheme, decodeTheme, encodeTheme } from '@poolse/theme';
|
|
6
8
|
|
|
7
9
|
interface CallVideoGridProps {
|
|
8
10
|
participants: CallParticipant[];
|
|
@@ -413,6 +415,14 @@ interface MessageBubbleProps {
|
|
|
413
415
|
* attachments yourself outside the bubble.
|
|
414
416
|
*/
|
|
415
417
|
showAttachments?: boolean;
|
|
418
|
+
/** `'12h'`, `'24h'` or a formatter for the timestamp. Defaults to the locale's. */
|
|
419
|
+
timeFormat?: TimeFormat;
|
|
420
|
+
/**
|
|
421
|
+
* Replace or wrap the `header` (sender label), `attachments` and
|
|
422
|
+
* `body` parts. Needs `slotContext` (MessageRow passes both).
|
|
423
|
+
*/
|
|
424
|
+
slots?: MessageSlots;
|
|
425
|
+
slotContext?: MessageSlotContext;
|
|
416
426
|
}
|
|
417
427
|
/**
|
|
418
428
|
* One message bubble. The default renderer for `<ConversationView>` —
|
|
@@ -423,7 +433,7 @@ interface MessageBubbleProps {
|
|
|
423
433
|
* (coral for self, surface-with-border for others), matching the
|
|
424
434
|
* brand-kit chat showcase.
|
|
425
435
|
*/
|
|
426
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, onSenderPress, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
436
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, onSenderPress, actionsTrigger, showAttachments, timeFormat, slots, slotContext, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
427
437
|
|
|
428
438
|
/** Who sent a message — what `onSenderPress` / `onAvatarPress` receive. */
|
|
429
439
|
interface MessageUser {
|
|
@@ -436,6 +446,62 @@ interface MessageUser {
|
|
|
436
446
|
avatarUrl: string | null;
|
|
437
447
|
}
|
|
438
448
|
|
|
449
|
+
/**
|
|
450
|
+
* - `bubbles` — chat bubbles, own messages on the right (the default).
|
|
451
|
+
* - `list` — Slack-style full-width rows: avatar, name and time once
|
|
452
|
+
* per run of messages, a hover toolbar.
|
|
453
|
+
* - `compact` — Discord/IRC-style dense lines: time, coloured name and
|
|
454
|
+
* text on one line.
|
|
455
|
+
*/
|
|
456
|
+
type ChatLayout = 'bubbles' | 'list' | 'compact';
|
|
457
|
+
type ChatDensity = 'comfortable' | 'compact';
|
|
458
|
+
/** `'12h'`, `'24h'`, or your own formatter. Omitted: the locale's default. */
|
|
459
|
+
type TimeFormat = '12h' | '24h' | ((date: Date) => string);
|
|
460
|
+
/** What each slot function receives. */
|
|
461
|
+
interface MessageSlotProps {
|
|
462
|
+
message: Message;
|
|
463
|
+
/** The viewer sent it. */
|
|
464
|
+
isSelf: boolean;
|
|
465
|
+
sender: MessageUser;
|
|
466
|
+
layout: ChatLayout;
|
|
467
|
+
/** First message of a same-sender run (always true in `compact`). */
|
|
468
|
+
isRunStart: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* What the slot renders by default (may be `null` — e.g. no header on
|
|
471
|
+
* a continuation message). Return it to keep the default, wrap it,
|
|
472
|
+
* or return something else.
|
|
473
|
+
*/
|
|
474
|
+
children: ReactNode;
|
|
475
|
+
}
|
|
476
|
+
type MessageSlot = (props: MessageSlotProps) => ReactNode;
|
|
477
|
+
/**
|
|
478
|
+
* Replace or wrap one part of every message, in any layout:
|
|
479
|
+
*
|
|
480
|
+
* - `header` — sender name and time (the name label in `bubbles`)
|
|
481
|
+
* - `body` — the text (or "Message deleted")
|
|
482
|
+
* - `attachments` — images and files
|
|
483
|
+
* - `reactions` — the reaction pills
|
|
484
|
+
* - `thread` — the "N replies" link
|
|
485
|
+
* - `actions` — the hover toolbar / actions popover
|
|
486
|
+
*/
|
|
487
|
+
interface MessageSlots {
|
|
488
|
+
header?: MessageSlot;
|
|
489
|
+
body?: MessageSlot;
|
|
490
|
+
attachments?: MessageSlot;
|
|
491
|
+
reactions?: MessageSlot;
|
|
492
|
+
thread?: MessageSlot;
|
|
493
|
+
actions?: MessageSlot;
|
|
494
|
+
}
|
|
495
|
+
type MessageSlotContext = Omit<MessageSlotProps, 'children'>;
|
|
496
|
+
/** Third argument to `renderMessage`. */
|
|
497
|
+
interface RenderMessageContext {
|
|
498
|
+
layout: ChatLayout;
|
|
499
|
+
groupPosition: GroupPosition;
|
|
500
|
+
isRunStart: boolean;
|
|
501
|
+
/** The row ConversationView would have rendered for this message. */
|
|
502
|
+
renderDefault: () => ReactNode;
|
|
503
|
+
}
|
|
504
|
+
|
|
439
505
|
interface ConversationViewProps {
|
|
440
506
|
conversationId: Uuid;
|
|
441
507
|
/** Placeholder when there are no messages. */
|
|
@@ -445,9 +511,44 @@ interface ConversationViewProps {
|
|
|
445
511
|
* COMPLETELY overrides the default per-message rendering — you
|
|
446
512
|
* get the raw message + currentUserId and own the bubble shape.
|
|
447
513
|
* Leave unset to use the brand-aligned defaults (with reactions,
|
|
448
|
-
* actions, attachments inline as configured below).
|
|
514
|
+
* actions, attachments inline as configured below). The third
|
|
515
|
+
* argument carries the layout and `renderDefault()`, the row this
|
|
516
|
+
* view would have drawn — return it for the messages you don't
|
|
517
|
+
* want to change.
|
|
449
518
|
*/
|
|
450
|
-
renderMessage?: (msg: Message, currentUserId: string | null) => ReactNode;
|
|
519
|
+
renderMessage?: (msg: Message, currentUserId: string | null, context: RenderMessageContext) => ReactNode;
|
|
520
|
+
/**
|
|
521
|
+
* How messages are drawn:
|
|
522
|
+
* * `'bubbles'` (default) — chat bubbles, yours on the right.
|
|
523
|
+
* * `'list'` — Slack-style full-width rows; avatar, name and time
|
|
524
|
+
* once per run, the time on hover for the rest, a hover toolbar
|
|
525
|
+
* (React · Reply · Thread · More), "N replies" under threads.
|
|
526
|
+
* * `'compact'` — Discord/IRC-style dense lines: time at the left,
|
|
527
|
+
* the name in the sender's colour, an accent bar on messages
|
|
528
|
+
* that mention you.
|
|
529
|
+
*/
|
|
530
|
+
layout?: ChatLayout;
|
|
531
|
+
/** `'comfortable'` (default) or `'compact'` spacing, in any layout. */
|
|
532
|
+
density?: ChatDensity;
|
|
533
|
+
/**
|
|
534
|
+
* Show avatars. Defaults: `list` on, `compact` off, `bubbles` per
|
|
535
|
+
* `avatars` (others' messages in group chats). Overrides `avatars`.
|
|
536
|
+
*/
|
|
537
|
+
showAvatars?: boolean;
|
|
538
|
+
/** `'12h'`, `'24h'` or a formatter. Defaults to the locale's. */
|
|
539
|
+
timeFormat?: TimeFormat;
|
|
540
|
+
/**
|
|
541
|
+
* Same-sender messages less than this many minutes apart form one
|
|
542
|
+
* run (one bubble cluster, one `list` header). Default 5.
|
|
543
|
+
*/
|
|
544
|
+
groupWindowMinutes?: number;
|
|
545
|
+
/**
|
|
546
|
+
* Replace or wrap one part of every message — `header`, `body`,
|
|
547
|
+
* `attachments`, `reactions`, `thread`, `actions` — in any layout.
|
|
548
|
+
* Each receives the message, sender, layout and its default
|
|
549
|
+
* rendering as `children`.
|
|
550
|
+
*/
|
|
551
|
+
slots?: MessageSlots;
|
|
451
552
|
/**
|
|
452
553
|
* Translate an `external_id` into a display name. Passed through to
|
|
453
554
|
* `MessageBubble`, `TypingIndicator`, `MentionInput`, `MemberList`.
|
|
@@ -499,7 +600,7 @@ interface ConversationViewProps {
|
|
|
499
600
|
* to render every bubble as standalone (uniform tails).
|
|
500
601
|
*/
|
|
501
602
|
grouping?: boolean;
|
|
502
|
-
/**
|
|
603
|
+
/** @deprecated Use `groupWindowMinutes`. */
|
|
503
604
|
groupingWindowMs?: number;
|
|
504
605
|
/**
|
|
505
606
|
* Insert a centered day-separator pill between messages whose
|
|
@@ -566,7 +667,7 @@ interface ConversationViewProps {
|
|
|
566
667
|
/** The call this client is already on, if any — its banner is hidden. */
|
|
567
668
|
currentCallId?: string | null;
|
|
568
669
|
}
|
|
569
|
-
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
670
|
+
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, groupWindowMinutes, layout, density, showAvatars, timeFormat, slots, daySeparators, senderLabels, avatars, onMarkedRead, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
570
671
|
|
|
571
672
|
interface ChatHeaderProps {
|
|
572
673
|
/** Conversation id — used to fetch the row + members for the title / presence dot. */
|
|
@@ -807,10 +908,16 @@ interface MessageActionsProps {
|
|
|
807
908
|
onEdit?: () => void;
|
|
808
909
|
/** Triggered when the user wants to delete. Only show on own messages. */
|
|
809
910
|
onDelete?: () => void;
|
|
911
|
+
/**
|
|
912
|
+
* Slack-style toolbar: React, Reply, Thread, then a "More" button
|
|
913
|
+
* whose menu holds Copy / Edit / Delete. Defaults to `false` (every
|
|
914
|
+
* action as its own button).
|
|
915
|
+
*/
|
|
916
|
+
moreMenu?: boolean;
|
|
810
917
|
/** Render any extra trailing action buttons (e.g. "Pin"). */
|
|
811
918
|
children?: ReactNode;
|
|
812
919
|
}
|
|
813
|
-
declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
920
|
+
declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, moreMenu, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
814
921
|
|
|
815
922
|
interface TypingIndicatorProps {
|
|
816
923
|
/** Set of `external_id`s currently typing — what `useTyping` returns. */
|
|
@@ -843,8 +950,11 @@ interface ThreadViewProps {
|
|
|
843
950
|
* brand-styled <MessageBubble>.
|
|
844
951
|
*/
|
|
845
952
|
renderMessage?: (msg: Message, currentUserId: string | null) => ReactNode;
|
|
953
|
+
/** Row layout for the replies — see `ChatLayout`. Defaults to `'bubbles'`. */
|
|
954
|
+
layout?: ChatLayout;
|
|
955
|
+
timeFormat?: TimeFormat;
|
|
846
956
|
}
|
|
847
|
-
declare function ThreadView({ conversationId, rootMessage, onClose, renderMessage, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
957
|
+
declare function ThreadView({ conversationId, rootMessage, onClose, renderMessage, layout, timeFormat, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
848
958
|
|
|
849
959
|
interface AvatarProps {
|
|
850
960
|
/** URL to a profile image. Renders initials fallback when omitted or load fails. */
|
|
@@ -1046,6 +1156,34 @@ interface MentionInputProps {
|
|
|
1046
1156
|
}
|
|
1047
1157
|
declare const MentionInput: react.ForwardRefExoticComponent<MentionInputProps & react.RefAttributes<MessageComposerHandle>>;
|
|
1048
1158
|
|
|
1159
|
+
interface PoolseThemeProps {
|
|
1160
|
+
/**
|
|
1161
|
+
* A built-in theme's id (`'coral'`, `'ocean'`, `'forest'`, `'grape'`,
|
|
1162
|
+
* `'slate'`, `'sunset'`, `'rose'`, `'mono'`) or a whole `Theme` from
|
|
1163
|
+
* `@poolse/theme` (`createTheme`, `decodeTheme`). Omit it to keep
|
|
1164
|
+
* the stylesheet's own colours.
|
|
1165
|
+
*/
|
|
1166
|
+
theme?: ThemeInput;
|
|
1167
|
+
/** `'system'` (default) follows the OS and updates when it changes. */
|
|
1168
|
+
colorScheme?: ColorSchemePreference;
|
|
1169
|
+
className?: string;
|
|
1170
|
+
style?: CSSProperties;
|
|
1171
|
+
children?: ReactNode;
|
|
1172
|
+
}
|
|
1173
|
+
interface PoolseThemeValue {
|
|
1174
|
+
/** The applied theme for the active scheme, or `null` when no `theme` was given. */
|
|
1175
|
+
theme: ResolvedTheme | null;
|
|
1176
|
+
colorScheme: ColorScheme;
|
|
1177
|
+
}
|
|
1178
|
+
/** The OS colour scheme, kept current. `'light'` during server rendering. */
|
|
1179
|
+
declare function useSystemColorScheme(): ColorScheme;
|
|
1180
|
+
declare function PoolseTheme({ theme, colorScheme, className, style, children, }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
|
|
1181
|
+
/**
|
|
1182
|
+
* The nearest `<PoolseTheme>`'s theme and scheme. Outside one, `theme`
|
|
1183
|
+
* is `null` and the scheme is the OS's.
|
|
1184
|
+
*/
|
|
1185
|
+
declare function useTheme(): PoolseThemeValue;
|
|
1186
|
+
|
|
1049
1187
|
type PoolseLogoVariant = 'lockup' | 'mark' | 'wordmark' | 'mono';
|
|
1050
1188
|
interface PoolseLogoProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
|
|
1051
1189
|
variant?: PoolseLogoVariant;
|
|
@@ -1068,4 +1206,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
1068
1206
|
*/
|
|
1069
1207
|
declare function PoolseFonts(): null;
|
|
1070
1208
|
|
|
1071
|
-
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, type MessageUser, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts };
|
|
1209
|
+
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallVideoGrid, type CallVideoGridProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, PoolseTheme, type PoolseThemeProps, type PoolseThemeValue, ReactionPicker, ReactionStrip, type ReactionStripProps, type RenderMessageContext, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, type TimeFormat, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts, useSystemColorScheme, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CallParticipant, CallDevice, CallDeviceKind, Message, Uuid, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { SVGProps, ReactElement, ReactNode } from 'react';
|
|
5
|
-
import { UseRoom, UploadItem, ReactionMap } from '@poolse/react';
|
|
4
|
+
import { SVGProps, ReactElement, ReactNode, CSSProperties } from 'react';
|
|
5
|
+
import { GroupPosition, UseRoom, UploadItem, ReactionMap } from '@poolse/react';
|
|
6
|
+
import { ThemeInput, ColorSchemePreference, ResolvedTheme, ColorScheme } from '@poolse/theme';
|
|
7
|
+
export { BUILT_IN_THEME_IDS, BuiltInThemeId, ColorScheme, ColorSchemePreference, DEFAULT_THEME_ID, Theme, ThemeInput, createTheme, decodeTheme, encodeTheme } from '@poolse/theme';
|
|
6
8
|
|
|
7
9
|
interface CallVideoGridProps {
|
|
8
10
|
participants: CallParticipant[];
|
|
@@ -413,6 +415,14 @@ interface MessageBubbleProps {
|
|
|
413
415
|
* attachments yourself outside the bubble.
|
|
414
416
|
*/
|
|
415
417
|
showAttachments?: boolean;
|
|
418
|
+
/** `'12h'`, `'24h'` or a formatter for the timestamp. Defaults to the locale's. */
|
|
419
|
+
timeFormat?: TimeFormat;
|
|
420
|
+
/**
|
|
421
|
+
* Replace or wrap the `header` (sender label), `attachments` and
|
|
422
|
+
* `body` parts. Needs `slotContext` (MessageRow passes both).
|
|
423
|
+
*/
|
|
424
|
+
slots?: MessageSlots;
|
|
425
|
+
slotContext?: MessageSlotContext;
|
|
416
426
|
}
|
|
417
427
|
/**
|
|
418
428
|
* One message bubble. The default renderer for `<ConversationView>` —
|
|
@@ -423,7 +433,7 @@ interface MessageBubbleProps {
|
|
|
423
433
|
* (coral for self, surface-with-border for others), matching the
|
|
424
434
|
* brand-kit chat showcase.
|
|
425
435
|
*/
|
|
426
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, onSenderPress, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
436
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, onSenderPress, actionsTrigger, showAttachments, timeFormat, slots, slotContext, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
427
437
|
|
|
428
438
|
/** Who sent a message — what `onSenderPress` / `onAvatarPress` receive. */
|
|
429
439
|
interface MessageUser {
|
|
@@ -436,6 +446,62 @@ interface MessageUser {
|
|
|
436
446
|
avatarUrl: string | null;
|
|
437
447
|
}
|
|
438
448
|
|
|
449
|
+
/**
|
|
450
|
+
* - `bubbles` — chat bubbles, own messages on the right (the default).
|
|
451
|
+
* - `list` — Slack-style full-width rows: avatar, name and time once
|
|
452
|
+
* per run of messages, a hover toolbar.
|
|
453
|
+
* - `compact` — Discord/IRC-style dense lines: time, coloured name and
|
|
454
|
+
* text on one line.
|
|
455
|
+
*/
|
|
456
|
+
type ChatLayout = 'bubbles' | 'list' | 'compact';
|
|
457
|
+
type ChatDensity = 'comfortable' | 'compact';
|
|
458
|
+
/** `'12h'`, `'24h'`, or your own formatter. Omitted: the locale's default. */
|
|
459
|
+
type TimeFormat = '12h' | '24h' | ((date: Date) => string);
|
|
460
|
+
/** What each slot function receives. */
|
|
461
|
+
interface MessageSlotProps {
|
|
462
|
+
message: Message;
|
|
463
|
+
/** The viewer sent it. */
|
|
464
|
+
isSelf: boolean;
|
|
465
|
+
sender: MessageUser;
|
|
466
|
+
layout: ChatLayout;
|
|
467
|
+
/** First message of a same-sender run (always true in `compact`). */
|
|
468
|
+
isRunStart: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* What the slot renders by default (may be `null` — e.g. no header on
|
|
471
|
+
* a continuation message). Return it to keep the default, wrap it,
|
|
472
|
+
* or return something else.
|
|
473
|
+
*/
|
|
474
|
+
children: ReactNode;
|
|
475
|
+
}
|
|
476
|
+
type MessageSlot = (props: MessageSlotProps) => ReactNode;
|
|
477
|
+
/**
|
|
478
|
+
* Replace or wrap one part of every message, in any layout:
|
|
479
|
+
*
|
|
480
|
+
* - `header` — sender name and time (the name label in `bubbles`)
|
|
481
|
+
* - `body` — the text (or "Message deleted")
|
|
482
|
+
* - `attachments` — images and files
|
|
483
|
+
* - `reactions` — the reaction pills
|
|
484
|
+
* - `thread` — the "N replies" link
|
|
485
|
+
* - `actions` — the hover toolbar / actions popover
|
|
486
|
+
*/
|
|
487
|
+
interface MessageSlots {
|
|
488
|
+
header?: MessageSlot;
|
|
489
|
+
body?: MessageSlot;
|
|
490
|
+
attachments?: MessageSlot;
|
|
491
|
+
reactions?: MessageSlot;
|
|
492
|
+
thread?: MessageSlot;
|
|
493
|
+
actions?: MessageSlot;
|
|
494
|
+
}
|
|
495
|
+
type MessageSlotContext = Omit<MessageSlotProps, 'children'>;
|
|
496
|
+
/** Third argument to `renderMessage`. */
|
|
497
|
+
interface RenderMessageContext {
|
|
498
|
+
layout: ChatLayout;
|
|
499
|
+
groupPosition: GroupPosition;
|
|
500
|
+
isRunStart: boolean;
|
|
501
|
+
/** The row ConversationView would have rendered for this message. */
|
|
502
|
+
renderDefault: () => ReactNode;
|
|
503
|
+
}
|
|
504
|
+
|
|
439
505
|
interface ConversationViewProps {
|
|
440
506
|
conversationId: Uuid;
|
|
441
507
|
/** Placeholder when there are no messages. */
|
|
@@ -445,9 +511,44 @@ interface ConversationViewProps {
|
|
|
445
511
|
* COMPLETELY overrides the default per-message rendering — you
|
|
446
512
|
* get the raw message + currentUserId and own the bubble shape.
|
|
447
513
|
* Leave unset to use the brand-aligned defaults (with reactions,
|
|
448
|
-
* actions, attachments inline as configured below).
|
|
514
|
+
* actions, attachments inline as configured below). The third
|
|
515
|
+
* argument carries the layout and `renderDefault()`, the row this
|
|
516
|
+
* view would have drawn — return it for the messages you don't
|
|
517
|
+
* want to change.
|
|
449
518
|
*/
|
|
450
|
-
renderMessage?: (msg: Message, currentUserId: string | null) => ReactNode;
|
|
519
|
+
renderMessage?: (msg: Message, currentUserId: string | null, context: RenderMessageContext) => ReactNode;
|
|
520
|
+
/**
|
|
521
|
+
* How messages are drawn:
|
|
522
|
+
* * `'bubbles'` (default) — chat bubbles, yours on the right.
|
|
523
|
+
* * `'list'` — Slack-style full-width rows; avatar, name and time
|
|
524
|
+
* once per run, the time on hover for the rest, a hover toolbar
|
|
525
|
+
* (React · Reply · Thread · More), "N replies" under threads.
|
|
526
|
+
* * `'compact'` — Discord/IRC-style dense lines: time at the left,
|
|
527
|
+
* the name in the sender's colour, an accent bar on messages
|
|
528
|
+
* that mention you.
|
|
529
|
+
*/
|
|
530
|
+
layout?: ChatLayout;
|
|
531
|
+
/** `'comfortable'` (default) or `'compact'` spacing, in any layout. */
|
|
532
|
+
density?: ChatDensity;
|
|
533
|
+
/**
|
|
534
|
+
* Show avatars. Defaults: `list` on, `compact` off, `bubbles` per
|
|
535
|
+
* `avatars` (others' messages in group chats). Overrides `avatars`.
|
|
536
|
+
*/
|
|
537
|
+
showAvatars?: boolean;
|
|
538
|
+
/** `'12h'`, `'24h'` or a formatter. Defaults to the locale's. */
|
|
539
|
+
timeFormat?: TimeFormat;
|
|
540
|
+
/**
|
|
541
|
+
* Same-sender messages less than this many minutes apart form one
|
|
542
|
+
* run (one bubble cluster, one `list` header). Default 5.
|
|
543
|
+
*/
|
|
544
|
+
groupWindowMinutes?: number;
|
|
545
|
+
/**
|
|
546
|
+
* Replace or wrap one part of every message — `header`, `body`,
|
|
547
|
+
* `attachments`, `reactions`, `thread`, `actions` — in any layout.
|
|
548
|
+
* Each receives the message, sender, layout and its default
|
|
549
|
+
* rendering as `children`.
|
|
550
|
+
*/
|
|
551
|
+
slots?: MessageSlots;
|
|
451
552
|
/**
|
|
452
553
|
* Translate an `external_id` into a display name. Passed through to
|
|
453
554
|
* `MessageBubble`, `TypingIndicator`, `MentionInput`, `MemberList`.
|
|
@@ -499,7 +600,7 @@ interface ConversationViewProps {
|
|
|
499
600
|
* to render every bubble as standalone (uniform tails).
|
|
500
601
|
*/
|
|
501
602
|
grouping?: boolean;
|
|
502
|
-
/**
|
|
603
|
+
/** @deprecated Use `groupWindowMinutes`. */
|
|
503
604
|
groupingWindowMs?: number;
|
|
504
605
|
/**
|
|
505
606
|
* Insert a centered day-separator pill between messages whose
|
|
@@ -566,7 +667,7 @@ interface ConversationViewProps {
|
|
|
566
667
|
/** The call this client is already on, if any — its banner is hidden. */
|
|
567
668
|
currentCallId?: string | null;
|
|
568
669
|
}
|
|
569
|
-
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
670
|
+
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, groupWindowMinutes, layout, density, showAvatars, timeFormat, slots, daySeparators, senderLabels, avatars, onMarkedRead, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
570
671
|
|
|
571
672
|
interface ChatHeaderProps {
|
|
572
673
|
/** Conversation id — used to fetch the row + members for the title / presence dot. */
|
|
@@ -807,10 +908,16 @@ interface MessageActionsProps {
|
|
|
807
908
|
onEdit?: () => void;
|
|
808
909
|
/** Triggered when the user wants to delete. Only show on own messages. */
|
|
809
910
|
onDelete?: () => void;
|
|
911
|
+
/**
|
|
912
|
+
* Slack-style toolbar: React, Reply, Thread, then a "More" button
|
|
913
|
+
* whose menu holds Copy / Edit / Delete. Defaults to `false` (every
|
|
914
|
+
* action as its own button).
|
|
915
|
+
*/
|
|
916
|
+
moreMenu?: boolean;
|
|
810
917
|
/** Render any extra trailing action buttons (e.g. "Pin"). */
|
|
811
918
|
children?: ReactNode;
|
|
812
919
|
}
|
|
813
|
-
declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
920
|
+
declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, moreMenu, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
814
921
|
|
|
815
922
|
interface TypingIndicatorProps {
|
|
816
923
|
/** Set of `external_id`s currently typing — what `useTyping` returns. */
|
|
@@ -843,8 +950,11 @@ interface ThreadViewProps {
|
|
|
843
950
|
* brand-styled <MessageBubble>.
|
|
844
951
|
*/
|
|
845
952
|
renderMessage?: (msg: Message, currentUserId: string | null) => ReactNode;
|
|
953
|
+
/** Row layout for the replies — see `ChatLayout`. Defaults to `'bubbles'`. */
|
|
954
|
+
layout?: ChatLayout;
|
|
955
|
+
timeFormat?: TimeFormat;
|
|
846
956
|
}
|
|
847
|
-
declare function ThreadView({ conversationId, rootMessage, onClose, renderMessage, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
957
|
+
declare function ThreadView({ conversationId, rootMessage, onClose, renderMessage, layout, timeFormat, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
848
958
|
|
|
849
959
|
interface AvatarProps {
|
|
850
960
|
/** URL to a profile image. Renders initials fallback when omitted or load fails. */
|
|
@@ -1046,6 +1156,34 @@ interface MentionInputProps {
|
|
|
1046
1156
|
}
|
|
1047
1157
|
declare const MentionInput: react.ForwardRefExoticComponent<MentionInputProps & react.RefAttributes<MessageComposerHandle>>;
|
|
1048
1158
|
|
|
1159
|
+
interface PoolseThemeProps {
|
|
1160
|
+
/**
|
|
1161
|
+
* A built-in theme's id (`'coral'`, `'ocean'`, `'forest'`, `'grape'`,
|
|
1162
|
+
* `'slate'`, `'sunset'`, `'rose'`, `'mono'`) or a whole `Theme` from
|
|
1163
|
+
* `@poolse/theme` (`createTheme`, `decodeTheme`). Omit it to keep
|
|
1164
|
+
* the stylesheet's own colours.
|
|
1165
|
+
*/
|
|
1166
|
+
theme?: ThemeInput;
|
|
1167
|
+
/** `'system'` (default) follows the OS and updates when it changes. */
|
|
1168
|
+
colorScheme?: ColorSchemePreference;
|
|
1169
|
+
className?: string;
|
|
1170
|
+
style?: CSSProperties;
|
|
1171
|
+
children?: ReactNode;
|
|
1172
|
+
}
|
|
1173
|
+
interface PoolseThemeValue {
|
|
1174
|
+
/** The applied theme for the active scheme, or `null` when no `theme` was given. */
|
|
1175
|
+
theme: ResolvedTheme | null;
|
|
1176
|
+
colorScheme: ColorScheme;
|
|
1177
|
+
}
|
|
1178
|
+
/** The OS colour scheme, kept current. `'light'` during server rendering. */
|
|
1179
|
+
declare function useSystemColorScheme(): ColorScheme;
|
|
1180
|
+
declare function PoolseTheme({ theme, colorScheme, className, style, children, }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
|
|
1181
|
+
/**
|
|
1182
|
+
* The nearest `<PoolseTheme>`'s theme and scheme. Outside one, `theme`
|
|
1183
|
+
* is `null` and the scheme is the OS's.
|
|
1184
|
+
*/
|
|
1185
|
+
declare function useTheme(): PoolseThemeValue;
|
|
1186
|
+
|
|
1049
1187
|
type PoolseLogoVariant = 'lockup' | 'mark' | 'wordmark' | 'mono';
|
|
1050
1188
|
interface PoolseLogoProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
|
|
1051
1189
|
variant?: PoolseLogoVariant;
|
|
@@ -1068,4 +1206,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
1068
1206
|
*/
|
|
1069
1207
|
declare function PoolseFonts(): null;
|
|
1070
1208
|
|
|
1071
|
-
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, type MessageUser, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts };
|
|
1209
|
+
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallVideoGrid, type CallVideoGridProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, PoolseTheme, type PoolseThemeProps, type PoolseThemeValue, ReactionPicker, ReactionStrip, type ReactionStripProps, type RenderMessageContext, RoomJoinBar, type RoomJoinBarProps, RoomStage, type RoomStageProps, ThreadView, type ThreadViewProps, type TimeFormat, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts, useSystemColorScheme, useTheme };
|