@poolse/react-ui 1.0.6 → 2.0.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 +104 -0
- package/README.md +268 -50
- package/dist/index.cjs +123 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -33
- package/dist/index.d.ts +52 -33
- package/dist/index.js +123 -88
- package/dist/index.js.map +1 -1
- package/dist/styles.css +216 -12
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -16,8 +16,13 @@ interface ConversationViewProps {
|
|
|
16
16
|
* actions, attachments inline as configured below).
|
|
17
17
|
*/
|
|
18
18
|
renderMessage?: (msg: Message, currentUserId: string | null) => ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Translate an `external_id` into a display name. Passed through to
|
|
21
|
+
* `MessageBubble`, `TypingIndicator`, `MentionInput`, `MemberList`.
|
|
22
|
+
* Falls back to the SDK's `userResolver` (and then the external_id
|
|
23
|
+
* itself) when omitted.
|
|
24
|
+
*/
|
|
25
|
+
labelFor?: (externalId: string) => string;
|
|
21
26
|
/**
|
|
22
27
|
* Auto-load the brand fonts on mount. Defaults to `true`. Set to
|
|
23
28
|
* `false` when the host app already loads them, or when CSP
|
|
@@ -115,10 +120,10 @@ interface MessageBubbleProps {
|
|
|
115
120
|
readState?: 'sent' | 'read';
|
|
116
121
|
/**
|
|
117
122
|
* Optional friendly label for a quoted message's sender. Same shape
|
|
118
|
-
* as `<MemberList labelFor>` —
|
|
119
|
-
*
|
|
123
|
+
* as `<MemberList labelFor>` — `(externalId) => string` looking up a
|
|
124
|
+
* display name from the local member roster.
|
|
120
125
|
*/
|
|
121
|
-
labelFor?: (
|
|
126
|
+
labelFor?: (externalId: string) => string;
|
|
122
127
|
/**
|
|
123
128
|
* Called when the user clicks the quoted card. Typically used to
|
|
124
129
|
* scroll the chat to the original message + flash a highlight.
|
|
@@ -158,6 +163,13 @@ interface MessageBubbleProps {
|
|
|
158
163
|
* CSS until the row is hovered.
|
|
159
164
|
*/
|
|
160
165
|
actionsTrigger?: ReactNode;
|
|
166
|
+
/**
|
|
167
|
+
* Render the message's attachments INSIDE the bubble (WhatsApp-
|
|
168
|
+
* style): images mosaic at the top, file cards below, then the
|
|
169
|
+
* message body. Defaults to `true`. Pass `false` if you're rendering
|
|
170
|
+
* attachments yourself outside the bubble.
|
|
171
|
+
*/
|
|
172
|
+
showAttachments?: boolean;
|
|
161
173
|
}
|
|
162
174
|
/**
|
|
163
175
|
* One message bubble. The default renderer for `<ConversationView>` —
|
|
@@ -168,7 +180,7 @@ interface MessageBubbleProps {
|
|
|
168
180
|
* (coral for self, surface-with-border for others), matching the
|
|
169
181
|
* brand-kit chat showcase.
|
|
170
182
|
*/
|
|
171
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
183
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
172
184
|
|
|
173
185
|
interface EditableMessageBubbleProps {
|
|
174
186
|
message: Message;
|
|
@@ -209,8 +221,8 @@ interface MessageComposerProps {
|
|
|
209
221
|
replyingTo?: Message | null;
|
|
210
222
|
/** User clicked the (x) on the reply chip. Caller clears `replyingTo`. */
|
|
211
223
|
onCancelReply?: () => void;
|
|
212
|
-
/** Friendly display label for the quoted sender
|
|
213
|
-
labelFor?: (
|
|
224
|
+
/** Friendly display label for the quoted sender, keyed by `external_id`. */
|
|
225
|
+
labelFor?: (externalId: string) => string;
|
|
214
226
|
/**
|
|
215
227
|
* Show the paperclip + queue strip + accept dropped files via
|
|
216
228
|
* `ref.current.addFiles(files)`. Default `true`. Set `false` to
|
|
@@ -262,10 +274,14 @@ interface MessageActionsProps {
|
|
|
262
274
|
declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
263
275
|
|
|
264
276
|
interface TypingIndicatorProps {
|
|
265
|
-
/** Set of
|
|
277
|
+
/** Set of `external_id`s currently typing — what `useTyping` returns. */
|
|
266
278
|
typing: Set<string>;
|
|
267
|
-
/**
|
|
268
|
-
|
|
279
|
+
/**
|
|
280
|
+
* Resolves an `external_id` to a display label. Defaults to the
|
|
281
|
+
* SDK's `userResolver` (and falls back to the external_id itself
|
|
282
|
+
* when the resolver isn't configured).
|
|
283
|
+
*/
|
|
284
|
+
labelFor?: (externalId: string) => string;
|
|
269
285
|
}
|
|
270
286
|
/**
|
|
271
287
|
* Animated 3-dot typing bubble with an inline name label. Hidden
|
|
@@ -305,20 +321,21 @@ interface AvatarProps {
|
|
|
305
321
|
declare function Avatar({ src, name, online, size, className }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
306
322
|
|
|
307
323
|
interface UserNameProps {
|
|
308
|
-
|
|
324
|
+
/** The tenant's user identifier — what your `userResolver` consumes. */
|
|
325
|
+
externalId: string | null | undefined;
|
|
309
326
|
/** Sync override. When set, skips the async resolver entirely. */
|
|
310
|
-
labelFor?: (
|
|
311
|
-
/** What to render when
|
|
327
|
+
labelFor?: (externalId: string) => string;
|
|
328
|
+
/** What to render when `externalId` itself is null (e.g. system messages). */
|
|
312
329
|
emptyFallback?: string;
|
|
313
330
|
className?: string;
|
|
314
331
|
}
|
|
315
|
-
declare function UserName({
|
|
332
|
+
declare function UserName({ externalId, labelFor, emptyFallback, className, }: UserNameProps): react_jsx_runtime.JSX.Element;
|
|
316
333
|
/**
|
|
317
334
|
* Same priority chain as the component but as a plain hook so callers
|
|
318
335
|
* that need the resolved name in a string context (aria-label,
|
|
319
336
|
* tooltip, etc.) don't have to render an extra element.
|
|
320
337
|
*/
|
|
321
|
-
declare function useDisplayName(
|
|
338
|
+
declare function useDisplayName(externalId: string | null | undefined, labelFor?: (externalId: string) => string, emptyFallback?: string): string;
|
|
322
339
|
|
|
323
340
|
interface ConversationListProps {
|
|
324
341
|
/** Currently selected conversation id — sets `aria-current` + selected styling. */
|
|
@@ -354,24 +371,25 @@ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState
|
|
|
354
371
|
interface MemberListProps {
|
|
355
372
|
conversationId: Uuid;
|
|
356
373
|
/**
|
|
357
|
-
* Resolve
|
|
358
|
-
*
|
|
359
|
-
*
|
|
374
|
+
* Resolve an `external_id` to a friendly display name. When omitted,
|
|
375
|
+
* the SDK's `userResolver` is used (and the external_id is shown as
|
|
376
|
+
* a fallback while the resolver loads / returns null).
|
|
360
377
|
*/
|
|
361
|
-
labelFor?: (
|
|
378
|
+
labelFor?: (externalId: string) => string;
|
|
362
379
|
/**
|
|
363
|
-
* Resolve an avatar URL by
|
|
364
|
-
* is used when not provided or when this returns null.
|
|
380
|
+
* Resolve an avatar URL by `external_id`. Optional — initials
|
|
381
|
+
* fallback is used when not provided or when this returns null.
|
|
365
382
|
*/
|
|
366
|
-
avatarFor?: (
|
|
383
|
+
avatarFor?: (externalId: string) => string | null;
|
|
367
384
|
/**
|
|
368
|
-
* Override the online set with a caller-supplied source
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
385
|
+
* Override the online set with a caller-supplied source of
|
|
386
|
+
* `external_id`s. By default MemberList wires
|
|
387
|
+
* `usePresence(conversationId).online` itself, so the presence dots
|
|
388
|
+
* light up out-of-the-box. Pass an explicit `Set` when you want to
|
|
389
|
+
* merge presence with other signals (typing, focus, etc), or an
|
|
390
|
+
* empty `new Set()` to disable the dots entirely.
|
|
373
391
|
*/
|
|
374
|
-
|
|
392
|
+
onlineExternalIds?: Set<string>;
|
|
375
393
|
/**
|
|
376
394
|
* If provided, surfaces a "remove" icon next to each member that
|
|
377
395
|
* the caller is allowed to remove. The caller is responsible for
|
|
@@ -383,7 +401,7 @@ interface MemberListProps {
|
|
|
383
401
|
/** Custom empty state when the conversation has zero members. */
|
|
384
402
|
emptyState?: ReactNode;
|
|
385
403
|
}
|
|
386
|
-
declare function MemberList({ conversationId, labelFor, avatarFor,
|
|
404
|
+
declare function MemberList({ conversationId, labelFor, avatarFor, onlineExternalIds, canRemove, renderItem, emptyState, }: MemberListProps): react_jsx_runtime.JSX.Element;
|
|
387
405
|
|
|
388
406
|
interface AttachmentPreviewProps {
|
|
389
407
|
/**
|
|
@@ -458,10 +476,11 @@ interface MentionInputProps {
|
|
|
458
476
|
placeholder?: string;
|
|
459
477
|
disabled?: boolean;
|
|
460
478
|
/**
|
|
461
|
-
* Resolve a
|
|
462
|
-
* Defaults to the
|
|
479
|
+
* Resolve a member's `external_id` to a display name for the @
|
|
480
|
+
* dropdown. Defaults to the SDK's `userResolver`, falling back to
|
|
481
|
+
* the external_id itself when no resolver is configured.
|
|
463
482
|
*/
|
|
464
|
-
labelFor?: (
|
|
483
|
+
labelFor?: (externalId: string) => string;
|
|
465
484
|
/**
|
|
466
485
|
* Caller-owned "I'm replying to this message" state. Mirrors
|
|
467
486
|
* `<MessageComposer replyingTo>` — renders a quote chip above the
|
package/dist/index.d.ts
CHANGED
|
@@ -16,8 +16,13 @@ interface ConversationViewProps {
|
|
|
16
16
|
* actions, attachments inline as configured below).
|
|
17
17
|
*/
|
|
18
18
|
renderMessage?: (msg: Message, currentUserId: string | null) => ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Translate an `external_id` into a display name. Passed through to
|
|
21
|
+
* `MessageBubble`, `TypingIndicator`, `MentionInput`, `MemberList`.
|
|
22
|
+
* Falls back to the SDK's `userResolver` (and then the external_id
|
|
23
|
+
* itself) when omitted.
|
|
24
|
+
*/
|
|
25
|
+
labelFor?: (externalId: string) => string;
|
|
21
26
|
/**
|
|
22
27
|
* Auto-load the brand fonts on mount. Defaults to `true`. Set to
|
|
23
28
|
* `false` when the host app already loads them, or when CSP
|
|
@@ -115,10 +120,10 @@ interface MessageBubbleProps {
|
|
|
115
120
|
readState?: 'sent' | 'read';
|
|
116
121
|
/**
|
|
117
122
|
* Optional friendly label for a quoted message's sender. Same shape
|
|
118
|
-
* as `<MemberList labelFor>` —
|
|
119
|
-
*
|
|
123
|
+
* as `<MemberList labelFor>` — `(externalId) => string` looking up a
|
|
124
|
+
* display name from the local member roster.
|
|
120
125
|
*/
|
|
121
|
-
labelFor?: (
|
|
126
|
+
labelFor?: (externalId: string) => string;
|
|
122
127
|
/**
|
|
123
128
|
* Called when the user clicks the quoted card. Typically used to
|
|
124
129
|
* scroll the chat to the original message + flash a highlight.
|
|
@@ -158,6 +163,13 @@ interface MessageBubbleProps {
|
|
|
158
163
|
* CSS until the row is hovered.
|
|
159
164
|
*/
|
|
160
165
|
actionsTrigger?: ReactNode;
|
|
166
|
+
/**
|
|
167
|
+
* Render the message's attachments INSIDE the bubble (WhatsApp-
|
|
168
|
+
* style): images mosaic at the top, file cards below, then the
|
|
169
|
+
* message body. Defaults to `true`. Pass `false` if you're rendering
|
|
170
|
+
* attachments yourself outside the bubble.
|
|
171
|
+
*/
|
|
172
|
+
showAttachments?: boolean;
|
|
161
173
|
}
|
|
162
174
|
/**
|
|
163
175
|
* One message bubble. The default renderer for `<ConversationView>` —
|
|
@@ -168,7 +180,7 @@ interface MessageBubbleProps {
|
|
|
168
180
|
* (coral for self, surface-with-border for others), matching the
|
|
169
181
|
* brand-kit chat showcase.
|
|
170
182
|
*/
|
|
171
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
183
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
172
184
|
|
|
173
185
|
interface EditableMessageBubbleProps {
|
|
174
186
|
message: Message;
|
|
@@ -209,8 +221,8 @@ interface MessageComposerProps {
|
|
|
209
221
|
replyingTo?: Message | null;
|
|
210
222
|
/** User clicked the (x) on the reply chip. Caller clears `replyingTo`. */
|
|
211
223
|
onCancelReply?: () => void;
|
|
212
|
-
/** Friendly display label for the quoted sender
|
|
213
|
-
labelFor?: (
|
|
224
|
+
/** Friendly display label for the quoted sender, keyed by `external_id`. */
|
|
225
|
+
labelFor?: (externalId: string) => string;
|
|
214
226
|
/**
|
|
215
227
|
* Show the paperclip + queue strip + accept dropped files via
|
|
216
228
|
* `ref.current.addFiles(files)`. Default `true`. Set `false` to
|
|
@@ -262,10 +274,14 @@ interface MessageActionsProps {
|
|
|
262
274
|
declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
263
275
|
|
|
264
276
|
interface TypingIndicatorProps {
|
|
265
|
-
/** Set of
|
|
277
|
+
/** Set of `external_id`s currently typing — what `useTyping` returns. */
|
|
266
278
|
typing: Set<string>;
|
|
267
|
-
/**
|
|
268
|
-
|
|
279
|
+
/**
|
|
280
|
+
* Resolves an `external_id` to a display label. Defaults to the
|
|
281
|
+
* SDK's `userResolver` (and falls back to the external_id itself
|
|
282
|
+
* when the resolver isn't configured).
|
|
283
|
+
*/
|
|
284
|
+
labelFor?: (externalId: string) => string;
|
|
269
285
|
}
|
|
270
286
|
/**
|
|
271
287
|
* Animated 3-dot typing bubble with an inline name label. Hidden
|
|
@@ -305,20 +321,21 @@ interface AvatarProps {
|
|
|
305
321
|
declare function Avatar({ src, name, online, size, className }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
306
322
|
|
|
307
323
|
interface UserNameProps {
|
|
308
|
-
|
|
324
|
+
/** The tenant's user identifier — what your `userResolver` consumes. */
|
|
325
|
+
externalId: string | null | undefined;
|
|
309
326
|
/** Sync override. When set, skips the async resolver entirely. */
|
|
310
|
-
labelFor?: (
|
|
311
|
-
/** What to render when
|
|
327
|
+
labelFor?: (externalId: string) => string;
|
|
328
|
+
/** What to render when `externalId` itself is null (e.g. system messages). */
|
|
312
329
|
emptyFallback?: string;
|
|
313
330
|
className?: string;
|
|
314
331
|
}
|
|
315
|
-
declare function UserName({
|
|
332
|
+
declare function UserName({ externalId, labelFor, emptyFallback, className, }: UserNameProps): react_jsx_runtime.JSX.Element;
|
|
316
333
|
/**
|
|
317
334
|
* Same priority chain as the component but as a plain hook so callers
|
|
318
335
|
* that need the resolved name in a string context (aria-label,
|
|
319
336
|
* tooltip, etc.) don't have to render an extra element.
|
|
320
337
|
*/
|
|
321
|
-
declare function useDisplayName(
|
|
338
|
+
declare function useDisplayName(externalId: string | null | undefined, labelFor?: (externalId: string) => string, emptyFallback?: string): string;
|
|
322
339
|
|
|
323
340
|
interface ConversationListProps {
|
|
324
341
|
/** Currently selected conversation id — sets `aria-current` + selected styling. */
|
|
@@ -354,24 +371,25 @@ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState
|
|
|
354
371
|
interface MemberListProps {
|
|
355
372
|
conversationId: Uuid;
|
|
356
373
|
/**
|
|
357
|
-
* Resolve
|
|
358
|
-
*
|
|
359
|
-
*
|
|
374
|
+
* Resolve an `external_id` to a friendly display name. When omitted,
|
|
375
|
+
* the SDK's `userResolver` is used (and the external_id is shown as
|
|
376
|
+
* a fallback while the resolver loads / returns null).
|
|
360
377
|
*/
|
|
361
|
-
labelFor?: (
|
|
378
|
+
labelFor?: (externalId: string) => string;
|
|
362
379
|
/**
|
|
363
|
-
* Resolve an avatar URL by
|
|
364
|
-
* is used when not provided or when this returns null.
|
|
380
|
+
* Resolve an avatar URL by `external_id`. Optional — initials
|
|
381
|
+
* fallback is used when not provided or when this returns null.
|
|
365
382
|
*/
|
|
366
|
-
avatarFor?: (
|
|
383
|
+
avatarFor?: (externalId: string) => string | null;
|
|
367
384
|
/**
|
|
368
|
-
* Override the online set with a caller-supplied source
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
385
|
+
* Override the online set with a caller-supplied source of
|
|
386
|
+
* `external_id`s. By default MemberList wires
|
|
387
|
+
* `usePresence(conversationId).online` itself, so the presence dots
|
|
388
|
+
* light up out-of-the-box. Pass an explicit `Set` when you want to
|
|
389
|
+
* merge presence with other signals (typing, focus, etc), or an
|
|
390
|
+
* empty `new Set()` to disable the dots entirely.
|
|
373
391
|
*/
|
|
374
|
-
|
|
392
|
+
onlineExternalIds?: Set<string>;
|
|
375
393
|
/**
|
|
376
394
|
* If provided, surfaces a "remove" icon next to each member that
|
|
377
395
|
* the caller is allowed to remove. The caller is responsible for
|
|
@@ -383,7 +401,7 @@ interface MemberListProps {
|
|
|
383
401
|
/** Custom empty state when the conversation has zero members. */
|
|
384
402
|
emptyState?: ReactNode;
|
|
385
403
|
}
|
|
386
|
-
declare function MemberList({ conversationId, labelFor, avatarFor,
|
|
404
|
+
declare function MemberList({ conversationId, labelFor, avatarFor, onlineExternalIds, canRemove, renderItem, emptyState, }: MemberListProps): react_jsx_runtime.JSX.Element;
|
|
387
405
|
|
|
388
406
|
interface AttachmentPreviewProps {
|
|
389
407
|
/**
|
|
@@ -458,10 +476,11 @@ interface MentionInputProps {
|
|
|
458
476
|
placeholder?: string;
|
|
459
477
|
disabled?: boolean;
|
|
460
478
|
/**
|
|
461
|
-
* Resolve a
|
|
462
|
-
* Defaults to the
|
|
479
|
+
* Resolve a member's `external_id` to a display name for the @
|
|
480
|
+
* dropdown. Defaults to the SDK's `userResolver`, falling back to
|
|
481
|
+
* the external_id itself when no resolver is configured.
|
|
463
482
|
*/
|
|
464
|
-
labelFor?: (
|
|
483
|
+
labelFor?: (externalId: string) => string;
|
|
465
484
|
/**
|
|
466
485
|
* Caller-owned "I'm replying to this message" state. Mirrors
|
|
467
486
|
* `<MessageComposer replyingTo>` — renders a quote chip above the
|