@poolse/react-ui 1.0.0-beta.0 → 1.0.0-rc.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.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Uuid, Message, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
3
3
  import { ReactNode, SVGProps, ReactElement } from 'react';
4
- import { ReactionMap } from '@poolse/react';
4
+ import { UploadItem, ReactionMap } from '@poolse/react';
5
5
 
6
6
  interface ConversationViewProps {
7
7
  conversationId: Uuid;
@@ -42,6 +42,47 @@ interface ConversationViewProps {
42
42
  quotations?: boolean;
43
43
  /** Check-double glyph on own messages once another member's read cursor advances past them. */
44
44
  readReceipts?: boolean;
45
+ /**
46
+ * Render message bodies as Markdown (bold, italic, lists, code,
47
+ * blockquotes, strikethrough, autolinks, ==highlight==). Defaults
48
+ * to `true`. Set `false` for raw-text rendering.
49
+ */
50
+ markdown?: boolean;
51
+ /**
52
+ * Trim message bodies longer than this many characters and show a
53
+ * "Read more" toggle. Defaults to 200. Set 0 to disable.
54
+ */
55
+ maxBodyLength?: number;
56
+ /**
57
+ * Group consecutive messages from the same sender within
58
+ * `groupingWindowMs` (default 5 min) on the same day into a single
59
+ * visual cluster — only the LAST bubble in a cluster shows the
60
+ * asymmetric tail corner, matching WhatsApp / iMessage. Set false
61
+ * to render every bubble as standalone (uniform tails).
62
+ */
63
+ grouping?: boolean;
64
+ /** Milliseconds between same-sender messages to still count as a group. Default 5 min. */
65
+ groupingWindowMs?: number;
66
+ /**
67
+ * Insert a centered day-separator pill between messages whose
68
+ * calendar day differs. Defaults to true.
69
+ */
70
+ daySeparators?: boolean;
71
+ /**
72
+ * Show a colored sender label above other-side bubbles in group
73
+ * chats. Resolved via the customer's `userResolver`.
74
+ * * `'auto'` — on when the conversation has more than 2 members
75
+ * * `'always'` — even in DMs (rarely useful)
76
+ * * `'never'` — disable entirely
77
+ * Defaults to `'auto'`.
78
+ */
79
+ senderLabels?: 'auto' | 'always' | 'never';
80
+ /**
81
+ * Show participant avatars to the LEFT of other-side bubbles in
82
+ * group chats. Same `auto | always | never` semantics as
83
+ * `senderLabels`. Defaults to `'auto'`.
84
+ */
85
+ avatars?: 'auto' | 'always' | 'never';
45
86
  /**
46
87
  * Fired once after the caller's auto-mark-read fires for a fresh
47
88
  * message. Useful for clearing a sidebar unread badge before the
@@ -50,8 +91,16 @@ interface ConversationViewProps {
50
91
  */
51
92
  onMarkedRead?: (conversationId: string) => void;
52
93
  }
53
- declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
94
+ declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
54
95
 
96
+ /**
97
+ * Position of this bubble within a same-sender, same-day, ≤5-min
98
+ * cluster. Drives the tail-corner rendering: only `last` and
99
+ * `standalone` get the asymmetric tail, matching the WhatsApp /
100
+ * iMessage convention where consecutive bursts read as a single
101
+ * unit with one trailing tail.
102
+ */
103
+ type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';
55
104
  interface MessageBubbleProps {
56
105
  message: Message;
57
106
  /** Used to decide left/right alignment + color, and whether to show the read-receipt glyph. */
@@ -75,6 +124,31 @@ interface MessageBubbleProps {
75
124
  * No-op when omitted.
76
125
  */
77
126
  onQuotedClick?: (quotedMessageId: Uuid) => void;
127
+ /**
128
+ * Where this bubble sits within a same-sender cluster (see
129
+ * BubbleGroupPosition). Defaults to `standalone`.
130
+ */
131
+ groupPosition?: BubbleGroupPosition;
132
+ /**
133
+ * When > 0, truncates the body at this many characters and shows a
134
+ * "Read more" toggle to expand. Defaults to 0 (no truncation).
135
+ */
136
+ maxBodyLength?: number;
137
+ /**
138
+ * Render the body as GitHub-flavored Markdown (bold, italic, lists,
139
+ * fenced code, blockquotes, strikethrough, autolinks). Defaults to
140
+ * `false`. `<ConversationView>` flips this on by default.
141
+ */
142
+ markdown?: boolean;
143
+ /**
144
+ * Show a colored sender label above the body for other-side
145
+ * bubbles. Only meaningful in group chats (3+ participants) and
146
+ * only on the FIRST / STANDALONE bubble of a cluster (continuation
147
+ * bubbles share the cluster's identity). The label name comes
148
+ * from the SDK's `useUser` hook via the customer's
149
+ * `userResolver` config.
150
+ */
151
+ showSenderName?: boolean;
78
152
  }
79
153
  /**
80
154
  * One message bubble. The default renderer for `<ConversationView>` —
@@ -85,7 +159,7 @@ interface MessageBubbleProps {
85
159
  * (coral for self, surface-with-border for others), matching the
86
160
  * brand-kit chat showcase.
87
161
  */
88
- declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
162
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
89
163
 
90
164
  interface EditableMessageBubbleProps {
91
165
  message: Message;
@@ -199,6 +273,22 @@ interface AvatarProps {
199
273
  }
200
274
  declare function Avatar({ src, name, online, size, className }: AvatarProps): react_jsx_runtime.JSX.Element;
201
275
 
276
+ interface UserNameProps {
277
+ userId: Uuid | null | undefined;
278
+ /** Sync override. When set, skips the async resolver entirely. */
279
+ labelFor?: (userId: Uuid) => string;
280
+ /** What to render when the userId itself is null (e.g. system messages). */
281
+ emptyFallback?: string;
282
+ className?: string;
283
+ }
284
+ declare function UserName({ userId, labelFor, emptyFallback, className, }: UserNameProps): react_jsx_runtime.JSX.Element;
285
+ /**
286
+ * Same priority chain as the component but as a plain hook so callers
287
+ * that need the resolved name in a string context (aria-label,
288
+ * tooltip, etc.) don't have to render an extra element.
289
+ */
290
+ declare function useDisplayName(userId: Uuid | null | undefined, labelFor?: (userId: Uuid) => string, emptyFallback?: string): string;
291
+
202
292
  interface ConversationListProps {
203
293
  /** Currently selected conversation id — sets `aria-current` + selected styling. */
204
294
  selectedId?: string | null;
@@ -279,6 +369,18 @@ interface AttachmentPreviewProps {
279
369
  }
280
370
  declare function AttachmentPreview({ attachment, onClick }: AttachmentPreviewProps): react_jsx_runtime.JSX.Element;
281
371
 
372
+ interface UploadQueueStripProps {
373
+ items: UploadItem[];
374
+ onCancel: (localId: string) => void;
375
+ onDismiss: (localId: string) => void;
376
+ }
377
+ /**
378
+ * Strip of pending / uploading / errored attachments shown above the
379
+ * composer. Ready items aren't included — they get cleared by the
380
+ * parent once the send completes.
381
+ */
382
+ declare function UploadQueueStrip({ items, onCancel, onDismiss }: UploadQueueStripProps): react_jsx_runtime.JSX.Element | null;
383
+
282
384
  interface ReactionStripProps {
283
385
  messageId: Uuid;
284
386
  conversationId: Uuid;
@@ -535,4 +637,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
535
637
  */
536
638
  declare function PoolseFonts(): null;
537
639
 
538
- export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, type IconName, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, usePoolseFonts };
640
+ export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, type IconName, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, useDisplayName, usePoolseFonts };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Uuid, Message, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
3
3
  import { ReactNode, SVGProps, ReactElement } from 'react';
4
- import { ReactionMap } from '@poolse/react';
4
+ import { UploadItem, ReactionMap } from '@poolse/react';
5
5
 
6
6
  interface ConversationViewProps {
7
7
  conversationId: Uuid;
@@ -42,6 +42,47 @@ interface ConversationViewProps {
42
42
  quotations?: boolean;
43
43
  /** Check-double glyph on own messages once another member's read cursor advances past them. */
44
44
  readReceipts?: boolean;
45
+ /**
46
+ * Render message bodies as Markdown (bold, italic, lists, code,
47
+ * blockquotes, strikethrough, autolinks, ==highlight==). Defaults
48
+ * to `true`. Set `false` for raw-text rendering.
49
+ */
50
+ markdown?: boolean;
51
+ /**
52
+ * Trim message bodies longer than this many characters and show a
53
+ * "Read more" toggle. Defaults to 200. Set 0 to disable.
54
+ */
55
+ maxBodyLength?: number;
56
+ /**
57
+ * Group consecutive messages from the same sender within
58
+ * `groupingWindowMs` (default 5 min) on the same day into a single
59
+ * visual cluster — only the LAST bubble in a cluster shows the
60
+ * asymmetric tail corner, matching WhatsApp / iMessage. Set false
61
+ * to render every bubble as standalone (uniform tails).
62
+ */
63
+ grouping?: boolean;
64
+ /** Milliseconds between same-sender messages to still count as a group. Default 5 min. */
65
+ groupingWindowMs?: number;
66
+ /**
67
+ * Insert a centered day-separator pill between messages whose
68
+ * calendar day differs. Defaults to true.
69
+ */
70
+ daySeparators?: boolean;
71
+ /**
72
+ * Show a colored sender label above other-side bubbles in group
73
+ * chats. Resolved via the customer's `userResolver`.
74
+ * * `'auto'` — on when the conversation has more than 2 members
75
+ * * `'always'` — even in DMs (rarely useful)
76
+ * * `'never'` — disable entirely
77
+ * Defaults to `'auto'`.
78
+ */
79
+ senderLabels?: 'auto' | 'always' | 'never';
80
+ /**
81
+ * Show participant avatars to the LEFT of other-side bubbles in
82
+ * group chats. Same `auto | always | never` semantics as
83
+ * `senderLabels`. Defaults to `'auto'`.
84
+ */
85
+ avatars?: 'auto' | 'always' | 'never';
45
86
  /**
46
87
  * Fired once after the caller's auto-mark-read fires for a fresh
47
88
  * message. Useful for clearing a sidebar unread badge before the
@@ -50,8 +91,16 @@ interface ConversationViewProps {
50
91
  */
51
92
  onMarkedRead?: (conversationId: string) => void;
52
93
  }
53
- declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
94
+ declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
54
95
 
96
+ /**
97
+ * Position of this bubble within a same-sender, same-day, ≤5-min
98
+ * cluster. Drives the tail-corner rendering: only `last` and
99
+ * `standalone` get the asymmetric tail, matching the WhatsApp /
100
+ * iMessage convention where consecutive bursts read as a single
101
+ * unit with one trailing tail.
102
+ */
103
+ type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';
55
104
  interface MessageBubbleProps {
56
105
  message: Message;
57
106
  /** Used to decide left/right alignment + color, and whether to show the read-receipt glyph. */
@@ -75,6 +124,31 @@ interface MessageBubbleProps {
75
124
  * No-op when omitted.
76
125
  */
77
126
  onQuotedClick?: (quotedMessageId: Uuid) => void;
127
+ /**
128
+ * Where this bubble sits within a same-sender cluster (see
129
+ * BubbleGroupPosition). Defaults to `standalone`.
130
+ */
131
+ groupPosition?: BubbleGroupPosition;
132
+ /**
133
+ * When > 0, truncates the body at this many characters and shows a
134
+ * "Read more" toggle to expand. Defaults to 0 (no truncation).
135
+ */
136
+ maxBodyLength?: number;
137
+ /**
138
+ * Render the body as GitHub-flavored Markdown (bold, italic, lists,
139
+ * fenced code, blockquotes, strikethrough, autolinks). Defaults to
140
+ * `false`. `<ConversationView>` flips this on by default.
141
+ */
142
+ markdown?: boolean;
143
+ /**
144
+ * Show a colored sender label above the body for other-side
145
+ * bubbles. Only meaningful in group chats (3+ participants) and
146
+ * only on the FIRST / STANDALONE bubble of a cluster (continuation
147
+ * bubbles share the cluster's identity). The label name comes
148
+ * from the SDK's `useUser` hook via the customer's
149
+ * `userResolver` config.
150
+ */
151
+ showSenderName?: boolean;
78
152
  }
79
153
  /**
80
154
  * One message bubble. The default renderer for `<ConversationView>` —
@@ -85,7 +159,7 @@ interface MessageBubbleProps {
85
159
  * (coral for self, surface-with-border for others), matching the
86
160
  * brand-kit chat showcase.
87
161
  */
88
- declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
162
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
89
163
 
90
164
  interface EditableMessageBubbleProps {
91
165
  message: Message;
@@ -199,6 +273,22 @@ interface AvatarProps {
199
273
  }
200
274
  declare function Avatar({ src, name, online, size, className }: AvatarProps): react_jsx_runtime.JSX.Element;
201
275
 
276
+ interface UserNameProps {
277
+ userId: Uuid | null | undefined;
278
+ /** Sync override. When set, skips the async resolver entirely. */
279
+ labelFor?: (userId: Uuid) => string;
280
+ /** What to render when the userId itself is null (e.g. system messages). */
281
+ emptyFallback?: string;
282
+ className?: string;
283
+ }
284
+ declare function UserName({ userId, labelFor, emptyFallback, className, }: UserNameProps): react_jsx_runtime.JSX.Element;
285
+ /**
286
+ * Same priority chain as the component but as a plain hook so callers
287
+ * that need the resolved name in a string context (aria-label,
288
+ * tooltip, etc.) don't have to render an extra element.
289
+ */
290
+ declare function useDisplayName(userId: Uuid | null | undefined, labelFor?: (userId: Uuid) => string, emptyFallback?: string): string;
291
+
202
292
  interface ConversationListProps {
203
293
  /** Currently selected conversation id — sets `aria-current` + selected styling. */
204
294
  selectedId?: string | null;
@@ -279,6 +369,18 @@ interface AttachmentPreviewProps {
279
369
  }
280
370
  declare function AttachmentPreview({ attachment, onClick }: AttachmentPreviewProps): react_jsx_runtime.JSX.Element;
281
371
 
372
+ interface UploadQueueStripProps {
373
+ items: UploadItem[];
374
+ onCancel: (localId: string) => void;
375
+ onDismiss: (localId: string) => void;
376
+ }
377
+ /**
378
+ * Strip of pending / uploading / errored attachments shown above the
379
+ * composer. Ready items aren't included — they get cleared by the
380
+ * parent once the send completes.
381
+ */
382
+ declare function UploadQueueStrip({ items, onCancel, onDismiss }: UploadQueueStripProps): react_jsx_runtime.JSX.Element | null;
383
+
282
384
  interface ReactionStripProps {
283
385
  messageId: Uuid;
284
386
  conversationId: Uuid;
@@ -535,4 +637,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
535
637
  */
536
638
  declare function PoolseFonts(): null;
537
639
 
538
- export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, type IconName, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, usePoolseFonts };
640
+ export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, type IconName, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, useDisplayName, usePoolseFonts };