@poolse/react-ui 3.0.0 → 3.2.0-dev.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 CHANGED
@@ -4,6 +4,21 @@ All notable changes to `@poolse/react-ui` are documented here. Format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
5
  [semver](https://semver.org).
6
6
 
7
+ ## [3.2.0-dev.0] — 2026-11-04 (prerelease, npm tag `dev`)
8
+
9
+ ### Added
10
+
11
+ - `<ConversationView>` shows AI agent replies as they're written: the
12
+ agent appears as typing, then its reply streams into a bubble with a
13
+ caret, and is replaced by the finished message.
14
+
15
+ ## [3.1.0] — 2026-10-27
16
+
17
+ ### Changed
18
+
19
+ - Moves with `@poolse/sdk` and `@poolse/react` 3.1.0 (reconnect catch-up,
20
+ user-channel call events). README rewritten against the code;
21
+ `CallControlButton` docs corrected (it is styled by `styles.css`).
7
22
 
8
23
  ## [3.0.0] — 2026-10-26
9
24
 
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # `@poolse/react-ui`
2
2
 
3
- Drop-in React chat components — `<ConversationView>` mounts the whole chat surface in one component, or compose the building blocks (`<MessageBubble>`, `<MessageComposer>`, `<ConversationList>`, `<MemberList>`, `<ThreadView>`, `<MentionInput>`, `<TypingIndicator>`, `<ReactionPicker>`) for custom layouts. CSS-variable theming — re-skin without a rebuild. Built for Next.js + React 18+.
3
+ Prebuilt React web components for [poolse](https://poolse.dev):
4
+ `<PoolseInbox>` for a whole inbox, `<ConversationView>` for one chat, room UI,
5
+ and the pieces they are built from. Themed with CSS variables. Built on
6
+ [`@poolse/react`](https://www.npmjs.com/package/@poolse/react).
4
7
 
5
- > **Source-available alternative to Sendbird UIKit, Stream Chat React UI, TalkJS, and CometChat React UI Kit.** Same component names + prop shapes as [`@poolse/react-native`](https://www.npmjs.com/package/@poolse/react-native) so cross-platform code stays mechanical to port.
6
-
7
- Sits on top of [`@poolse/react`](https://www.npmjs.com/package/@poolse/react) (hooks) and [`@poolse/sdk`](https://www.npmjs.com/package/@poolse/sdk) (client).
8
-
9
- > **⚠️ Upgrading from 1.x?** See [MIGRATING.md](https://github.com/poolse-hq/js-sdk/blob/main/MIGRATING.md). Every `labelFor` / `avatarFor` / `onlineUserIds` prop is now keyed by `external_id`. `<UserName>` and `useDisplayName` switched from `userId` to `externalId`.
8
+ Full reference: <https://poolse.dev/docs/sdk/react-ui>
10
9
 
11
10
  ## Install
12
11
 
@@ -18,318 +17,71 @@ npm install @poolse/react-ui @poolse/react @poolse/sdk
18
17
  import '@poolse/react-ui/styles.css';
19
18
  ```
20
19
 
21
- Import the stylesheet **once** at your app root. It defines the `--poolse-*` design tokens and the component styles.
20
+ Peer: `react` ≥ 18. The build starts with `'use client'`. Rooms also need
21
+ `livekit-client` in your app.
22
22
 
23
23
  ## Quick start
24
24
 
25
25
  ```tsx
26
+ 'use client';
27
+
28
+ import '@poolse/react-ui/styles.css';
26
29
  import { PoolseProvider } from '@poolse/react';
27
30
  import { ConversationView } from '@poolse/react-ui';
28
- import '@poolse/react-ui/styles.css';
29
31
 
30
- export function App() {
32
+ export function Chat({ conversationId }: { conversationId: string }) {
31
33
  return (
32
- <PoolseProvider
33
- config={{
34
- getToken: async () => {
35
- const res = await fetch('/api/chat-token', { method: 'POST' });
36
- const { token } = await res.json();
37
- return token;
38
- },
39
- }}
40
- >
41
- <ConversationView conversationId="00000000-0000-0000-0000-000000000000" />
34
+ <PoolseProvider config={config}>
35
+ <div style={{ height: '100vh' }}>
36
+ <ConversationView conversationId={conversationId} />
37
+ </div>
42
38
  </PoolseProvider>
43
39
  );
44
40
  }
45
41
  ```
46
42
 
47
- That's a complete chat surface. On mount it injects the brand fonts (Bricolage Grotesque, Hanken Grotesk, JetBrains Mono) via a Google Fonts `<link>`. Pass `loadFonts={false}` if your host app already loads them or your CSP forbids dynamic injection.
48
-
49
- ## `<ConversationView>`
50
-
51
- The default composed surface. Every feature is on a flag you can turn off.
52
-
53
- ```tsx
54
- <ConversationView
55
- conversationId={id}
56
-
57
- // Feature toggles (all default true unless noted)
58
- reactions
59
- mentions
60
- attachments
61
- actions
62
- threads
63
- quotations
64
- readReceipts
65
- markdown
66
- grouping
67
- daySeparators
68
-
69
- // Behavioral knobs
70
- maxBodyLength={200} // 0 disables the "Read more" trim
71
- groupingWindowMs={300000} // 5 min — same-sender messages within this window cluster
72
- senderLabels="auto" // 'auto' (on for 3+ members) | 'always' | 'never'
73
- avatars="auto" // same
74
-
75
- // Customer wiring
76
- labelFor={(userId) => /* … */}
77
- onMarkedRead={(convId) => /* clear sidebar badge */}
78
- renderMessage={(msg, currentUserId) => /* fully custom row */}
79
- emptyState={<div>Say hi.</div>}
80
- loadFonts // default true
81
- />
82
- ```
83
-
84
- ### What it gives you
85
-
86
- - **Message list with infinite-scroll-up.** Top-sentinel `IntersectionObserver` fires `loadMore()` when the user gets within ~400px of the top.
87
- - **Smart auto-scroll.** Stays pinned to the bottom while the user is at the bottom; otherwise increments a "N new messages" badge.
88
- - **Auto mark-read.** When the latest message is in view, fires `markReadUpTo` once per fresh tail. Drives both your own progress (`onMarkedRead` callback) and the server-broadcast read receipt that flips other users' double-check glyph.
89
- - **Drag-and-drop attachments.** The whole conversation pane accepts a file drop and forwards it to the composer's upload queue.
90
- - **Quote-reply chip** above the composer when `quotations` is on. The chip carries the quoted sender + a snippet, and Esc dismisses it.
91
- - **Realtime status banner.** Renders "Connecting…" / "Reconnecting…" / "Disconnected" pills when the socket isn't connected.
92
- - **Thread side-pane** opens on the right when the user clicks "Reply in thread"; below 760px it goes full-screen.
93
- - **Day separators.** "Today" / "Yesterday" / weekday name / `26 May 2024` between calendar days.
94
- - **Message clustering.** Same sender, same day, within `groupingWindowMs` (default 5 min) — clustered with a single asymmetric tail on the last bubble (iMessage / WhatsApp convention).
95
- - **Markdown bodies.** GitHub-flavored, sanitized: bold/italic/lists/code/blockquotes/strikethrough/autolinks. URLs render with `target="_blank" rel="noopener noreferrer nofollow"`.
96
- - **Long-message trim.** Bodies past `maxBodyLength` collapse to a `Read more` toggle.
97
-
98
- ### `renderMessage` escape hatch
99
-
100
- `renderMessage` completely replaces the default `<MessageRow>` for each message — you own the layout from the bubble outward. Group position, avatars, sender labels, hover actions: none of that is wired automatically when you take the slot.
101
-
102
- ```tsx
103
- <ConversationView
104
- conversationId={id}
105
- renderMessage={(msg, currentUserId) => (
106
- <MyCustomBubble message={msg} isSelf={msg.sender_id === currentUserId} />
107
- )}
108
- />
109
- ```
110
-
111
- If you want to keep most of the default behavior, render `<MessageRow>` yourself with the props you'd like to flip.
43
+ `ConversationView` feature flags, all on by default: `reactions`,
44
+ `mentions`, `attachments`, `actions`, `threads`, `quotations`,
45
+ `readReceipts`, `markdown`, `grouping`, `daySeparators`. Other props:
46
+ `labelFor`, `renderMessage`, `emptyState`, `loadFonts`, `maxBodyLength`
47
+ (200), `groupingWindowMs` (300000), `senderLabels` and `avatars`
48
+ (`'auto' | 'always' | 'never'`), `onMarkedRead`, `onCallBack`,
49
+ `onJoinCall`, `currentCallId`.
112
50
 
113
51
  ## Components
114
52
 
115
- ### Composed surfaces
116
-
117
- | Component | What |
118
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
119
- | `<PoolseInbox>` | Full inbox shell — two-column side-by-side list + detail on wide viewports, push-pane on ≤720px. Imperative ref API for `open`, `openDirect`, `openGroup`, `promptNewChat`, `promptNewGroup`, `close`. Built-in user picker + group-details sheet when a `users` directory is provided. |
120
- | `<ConversationView>` | Full chat (above) — `useMessages` + `useMembers` + `useTyping` + composer + thread pane wired together. |
121
- | `<ChatHeader>` | Standalone title bar — direct chats resolve the OTHER member's name + avatar via `labelFor` / `avatarFor`, groups show member count, presence-driven green dot. Optional `onBack`, `onPress`, `onMembersPress`, plus a free-form `rightSlot` for custom actions (e.g. an "Invite" button). |
122
- | `<ThreadView>` | The right-side reply pane. `useThread`-driven; close button + Esc + drag-drop. Used internally by `<ConversationView>`; export it for custom layouts. |
123
-
124
- ### Sheets / modals
125
-
126
- | Component | What |
127
- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
128
- | `<UserPickerSheet>` | Modal for picking a direct-chat target or a group's members. `mode: 'single'` is one-tap-to-start, `mode: 'group'` adds a name input + multi-select. Accepts an `InboxUser` directory. |
129
- | `<GroupDetailsSheet>` | Modal showing a group's name, avatar, and the existing `<MemberList>` roster with presence dots. Optional `footer` slot for "Leave group" / "Invite" actions. |
130
-
131
- ### Message surface
132
-
133
- | Component | What |
134
- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
135
- | `<MessageRow>` | One fully-wired row: bubble + (optional) avatar + reaction strip + thread pill + hover actions. Owns a single `useReactions` instance shared by the inline strip and the picker. |
136
- | `<MessageBubble>` | Just the bubble — sender label, quoted card, attachments, body, meta. Pure presentational; takes `Message` + `currentUserId`. |
137
- | `<EditableMessageBubble>` | `<MessageBubble>` plus an in-place edit mode (textarea, Enter to save, Esc to cancel). Controlled via the `editing` prop. |
138
- | `<MessageActions>` | Hover popover with the react / reply / quote / copy / edit / delete affordances. |
139
- | `<TypingIndicator>` | Three bouncing dots + a `role="status"` live region announcing "Alice is typing" / "Alice and Bob are typing" / "3 people are typing". |
140
-
141
- ### Composer
142
-
143
- | Component | What |
144
- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
145
- | `<MessageComposer>` | Pill input + send button + paperclip → upload queue. Smart list continuation (Enter on `- item` repeats the bullet). Exposes an imperative `addFiles(files)` via `ref` for drag-drop callers. |
146
- | `<MentionInput>` | Same as `<MessageComposer>` but with `@`-autocomplete from the conversation's member list. `combobox` ARIA, keyboard-navigable dropdown. Sends `MessageCreateRequest` shape (including `mentions[]`) on submit. |
147
- | `<UploadQueueStrip>` | Renders one chip per item in the composer's upload queue — pending/uploading/ready/error — with cancel + dismiss. Live progress bar driven by the SDK's XHR-based upload. |
148
-
149
- ### Attachments
150
-
151
- | Component | What |
152
- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
153
- | `<AttachmentPreview>` | Inline image (lazy thumbnail → fullscreen lightbox on click) or a file card with download. Resolves the presigned URL via `useAttachmentUrl`. |
154
-
155
- ### Conversation roster
156
-
157
- | Component | What |
158
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
159
- | `<ConversationList>` | Sidebar list of the user's conversations. Avatar + name + `last_message_preview` + timestamp + unread pill. Direct rows resolve the other member's name/avatar via `labelFor` / `avatarFor` (the same resolvers `<ChatHeader>` and `<PoolseInbox>` take), so a customer can wire one mapping everywhere. Controlled mode: pass `conversations`/`loading`/`error` to render from external state instead of `useConversations()`. |
160
- | `<MemberList>` | Roster for one conversation. Role badges, online dot, optional remove button gated by a `canRemove(membership)` predicate. |
161
-
162
- ### Reactions
163
-
164
- | Component | What |
165
- | ------------------ | ------------------------------------------------------------------------------------------------ |
166
- | `<ReactionStrip>` | Inline emoji pills with counts + "your reaction" highlight; optional picker button on the right. |
167
- | `<ReactionPicker>` | Standalone emoji popover. Six common emojis, arrow-key navigation, Esc closes. |
168
-
169
- ### Identity
170
-
171
- | Component | What |
172
- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
173
- | `<Avatar>` | Circular image with initials fallback + green presence dot. `size: 'sm' \| 'md' \| 'lg'`. |
174
- | `<UserName>` / `useDisplayName` | Resolve a `user_id` to a display string via the configured `userResolver`, with a `labelFor` sync override and a stable fallback (`User abc123`) when nothing is available. |
175
-
176
- ### Brand chrome
177
-
178
- | Component | What |
179
- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
180
- | `<PoolseIcon name="…">` | One SVG icon from a built-in set (41 names: `attachment`, `bell`, `check`, `chevron-down`, `close`, `download`, `edit`, `emoji`, `heart`, `image`, `message`, `messages`, `pin`, `plus`, `presence`, `pulse`, `reply`, `search`, `send`, `send-fill`, `settings`, `thumbs-up`, `trash`, `typing`, `user`, `users`, `webhook`, …). Pass `label={null}` for purely decorative. |
181
- | `<PoolseLogo>` | Brand mark / lockup / wordmark / mono (single-color) variants. |
182
- | `<PoolseFonts />` / `usePoolseFonts()` | Inject the Google Fonts link into `<head>` (idempotent). `<ConversationView>` calls this automatically unless you pass `loadFonts={false}`. |
183
-
184
- ## Attachments inside the bubble (1.1.0+)
185
-
186
- As of 1.1.0, `<MessageBubble>` renders attachments **inside** the bubble (WhatsApp / iMessage convention) rather than as a separate block under it.
187
-
188
- The layout chooses a grid template by image count:
189
-
190
- | Count | Layout |
191
- | --------- | ----------------------------------------------------------------------------- |
192
- | 1 image | Single full-bleed tile, natural aspect, capped at 360px tall. |
193
- | 2 images | Two equal squares, side-by-side. |
194
- | 3 images | One 16:9 hero on top + two squares beneath. |
195
- | 4+ images | 2×2 grid. The 4th tile shows a `+N more` overlay when the total exceeds four. |
196
-
197
- Non-image attachments (PDFs, etc.) render as stacked file cards inside the bubble's padded area, below the image mosaic. On self-bubbles the cards tint white-on-coral to read against the brand color.
198
-
199
- When a message has **only** images (no body text and no file cards), the meta row (time + read tick) becomes a small dark pill overlaid on the bottom-right of the mosaic — same convention as WhatsApp.
200
-
201
- The bubble has `overflow: hidden` so the mosaic is clipped to the bubble's rounded corners and the asymmetric tail.
202
-
203
- ### Opting out
204
-
205
- ```tsx
206
- <MessageBubble message={msg} currentUserId={meId} showAttachments={false} />
207
- ```
208
-
209
- Pass `showAttachments={false}` to suppress in-bubble attachments — useful if you want to render them yourself outside the bubble. `<MessageRow>` forwards its `attachments` flag to this prop, and `<ConversationView>`'s `attachments` flag forwards to `<MessageRow>`.
210
-
211
- ### Migration from 1.0.x
212
-
213
- Anything customizing `.poolse-message-row__attachments` in your stylesheet won't match anymore — that class is no longer rendered. The new class names are:
214
-
215
- - `.poolse-message__media` — image mosaic container
216
- - `.poolse-message__media--n1` / `--n2` / `--n3` / `--n4` — count-specific grid templates
217
- - `.poolse-message__media-tile` — one image cell
218
- - `.poolse-message__media-overflow` — the `+N more` overlay
219
- - `.poolse-message__files` — file-card stack
220
- - `.poolse-message__meta--overlay` — modifier applied to `.poolse-message__meta` in image-only mode
221
- - `.poolse-message--has-media` / `--media-only` — parent state modifiers
222
-
223
- If you weren't styling the old class, you don't need to do anything — the new layout is on by default.
53
+ - Composed: `PoolseInbox` (with a ref: `open`, `openDirect`, `openGroup`,
54
+ `promptNewChat`, `promptNewGroup`, `close`), `ConversationView`,
55
+ `ChatHeader`, `ThreadView`.
56
+ - Sheets: `UserPickerSheet`, `GroupDetailsSheet`.
57
+ - Messages: `MessageBubble`, `EditableMessageBubble`, `MessageActions`,
58
+ `TypingIndicator`, `CallLogRow`, `LiveCallBanner`.
59
+ - Composer: `MessageComposer` (ref: `addFiles`), `MentionInput`,
60
+ `UploadQueueStrip`, `AttachmentPreview`.
61
+ - Lists: `ConversationList`, `MemberList`.
62
+ - Reactions: `ReactionStrip`, `ReactionPicker`.
63
+ - Rooms and calls: `RoomJoinBar`, `RoomStage` (both take `useRoom()` from
64
+ `@poolse/react`), `CallVideoGrid`, `CallControlButton`, `CallDeviceMenu`.
65
+ - Identity and brand: `Avatar`, `UserName`, `useDisplayName`, `PoolseIcon`,
66
+ `PoolseLogo`, `PoolseFonts`, `usePoolseFonts`.
67
+
68
+ Every `labelFor` / `avatarFor` takes your user id (`external_id`), except on
69
+ `CallVideoGrid` and `RoomStage`, where it takes the poolse user id.
224
70
 
225
71
  ## Theming
226
72
 
227
- Every color, radius, shadow, and font in the kit is a CSS variable. Override them in your own stylesheet — no JS, no rebuild:
228
-
229
- ```css
230
- :root {
231
- --poolse-brand: #0070f3; /* primary action */
232
- --poolse-brand-soft: #e0eaff; /* tinted fills, hover, badges */
233
- --poolse-brand-strong: #0050b3; /* AA text on light surfaces */
234
- --poolse-on-brand: #ffffff; /* foreground on brand */
235
- }
236
- ```
237
-
238
- The full token set:
239
-
240
- ```css
241
- /* Brand & surfaces */
242
- --poolse-brand /* primary action (default Pulse Coral #ff5436) */
243
- --poolse-brand-strong /* AA text on light */
244
- --poolse-brand-soft /* tinted fills, badges, hover */
245
- --poolse-on-brand /* foreground on brand */
246
- --poolse-paper /* page background */
247
- --poolse-surface /* cards, panels */
248
- --poolse-surface-2 /* insets, fields */
249
- --poolse-ink /* primary text */
250
- --poolse-ink-2 /* secondary text */
251
- --poolse-ink-3 /* tertiary, hints */
252
- --poolse-border /* hairline borders */
253
-
254
- /* Semantic */
255
- --poolse-presence /* online dot */
256
- --poolse-success
257
- --poolse-warning
258
- --poolse-error /* distinct from coral */
259
- --poolse-info
260
-
261
- /* Typography */
262
- --poolse-font-display /* Bricolage Grotesque */
263
- --poolse-font-body /* Hanken Grotesk */
264
- --poolse-font-mono /* JetBrains Mono */
265
- --poolse-font-size /* default 15px */
266
- --poolse-line-height /* default 1.5 */
267
-
268
- /* Radii */
269
- --poolse-radius-sm /* 8px */
270
- --poolse-radius-md /* 12px */
271
- --poolse-radius-lg /* 16px */
272
- --poolse-radius-xl /* 24px */
273
- --poolse-radius-pill /* 999px */
274
-
275
- /* Shadows (warm-tinted) */
276
- --poolse-shadow-sm
277
- --poolse-shadow-md
278
- --poolse-shadow-lg
279
- ```
280
-
281
- ### Dark mode
282
-
283
- The stylesheet ships with a dark theme keyed off the user's `prefers-color-scheme`. To force a mode, set `data-theme="dark"` or `data-theme="light"` on any ancestor of the chat surface:
284
-
285
- ```html
286
- <div data-theme="dark">
287
- <ConversationView ... />
288
- </div>
289
- ```
290
-
291
- ## Accessibility
292
-
293
- - `<div role="log" aria-live="polite" aria-relevant="additions">` on the message list — screen readers announce new messages but not the initial load.
294
- - `<aside role="complementary" aria-label="Message thread">` on the thread pane. Esc closes; close button auto-focuses on mount.
295
- - `<MentionInput>` is a proper combobox: `role="combobox"`, `aria-expanded`, `aria-controls`, `aria-autocomplete="list"`, `aria-activedescendant` on the input; the dropdown is `role="listbox"` with `role="option"` items.
296
- - `<ReactionPicker>` is `role="menu"` / `role="menuitem"` with arrow-key navigation and Esc to close.
297
- - `<TypingIndicator>` is `role="status" aria-live="polite" aria-atomic="true"`; the dots themselves are `aria-hidden`.
298
- - `<Avatar>` is `role="img" aria-label="{name}"` even when rendering initials.
299
- - Touch reveal: the hover action menu on `<MessageRow>` is hidden on `(hover: none)` and switches to tap-toggle on the bubble itself, so you don't lose actions on mobile.
300
- - The image lightbox locks body scroll while open, closes on Esc and on backdrop click, and keeps the image itself non-dismissable (so a click on the image doesn't accidentally close).
301
- - The whole kit honors `prefers-reduced-motion` for the typing indicator, the message-row hover transitions, and the thread pane slide-in.
302
-
303
- Touch targets in the composer are 44px; the textarea uses 16px so iOS doesn't auto-zoom on focus; the lightbox + composer apply `safe-area-inset` padding for notched devices.
304
-
305
- ## Customization layers
306
-
307
- In order of escalating control:
308
-
309
- 1. **CSS variables.** Re-skin without touching JS.
310
- 2. **Feature flags on `<ConversationView>`.** Turn whole features off (`reactions={false}`, `threads={false}`, etc.).
311
- 3. **Render-prop slots.** Replace individual rows: `<ConversationView renderMessage={...}>`, `<ConversationList renderItem={...}>`, `<MemberList renderItem={...}>`, `<ThreadView renderMessage={...}>`.
312
- 4. **Component composition.** Drop `<ConversationView>` and assemble `<MessageRow>` (or `<MessageBubble>` if you want to skip the row's wiring) + `<MessageComposer>` + `<TypingIndicator>` + `<ThreadView>` yourself.
313
- 5. **Drop down to `@poolse/react`.** Build your own components on the same hooks that this package uses internally.
314
-
315
- You can mix and match — there's no all-or-nothing boundary.
316
-
317
- ## Re-exports
318
-
319
- The package also re-exports a few helpers that are useful when you're composing your own UI:
320
-
321
- - `userColor(userId)` — deterministic per-user color for sender labels and avatars (8-hue palette, hashed from the id).
322
- - `computeGroupPosition(msg, prev, next, windowMs)` / `sameDay(a, b)` / `formatDayLabel(iso)` — the same grouping primitives `<ConversationView>` uses to cluster messages.
323
- - `useAutogrow(ref, value)` — textarea auto-grow hook used by the composers.
324
- - `handleListEnter(value, caret)` — the smart-list-continuation primitive (handles `- item` / `1. item` continuation on Enter).
73
+ Override the `--poolse-*` CSS variables (`--poolse-brand`,
74
+ `--poolse-brand-soft`, `--poolse-ink`, `--poolse-surface`,
75
+ `--poolse-radius-md`, `--poolse-font-body`, …). Dark mode follows
76
+ `prefers-color-scheme`; force it with `data-theme="dark"` or
77
+ `data-theme="light"` on any ancestor. The full list is in the docs.
325
78
 
326
79
  ## Links
327
80
 
328
- - Full docs — <https://poolse.dev/docs/react-ui>
329
- - Hooks reference — [`@poolse/react`](https://www.npmjs.com/package/@poolse/react)
330
- - SDK reference — [`@poolse/sdk`](https://www.npmjs.com/package/@poolse/sdk)
331
- - Source — <https://github.com/poolse-hq/js-sdk>
81
+ - Docs: <https://poolse.dev/docs/sdk/react-ui>
82
+ - Source: <https://github.com/poolse-hq/js-sdk>
332
83
 
333
84
  ## License
334
85
 
335
- Licensed under the [poolse SDK License](./LICENSE) from 3.0.0 (source-available, for use with the poolse Services only); versions before 3.0.0 remain MIT.
86
+ Licensed under the [poolse SDK License](./LICENSE) from 3.0.0; versions
87
+ before 3.0.0 remain MIT.
package/dist/index.cjs CHANGED
@@ -2404,7 +2404,16 @@ function ConversationView({
2404
2404
  delete: deleteMsg,
2405
2405
  markReadUpTo
2406
2406
  } = react$1.useMessages(conversationId);
2407
- const { typing, signalTyping } = react$1.useTyping(conversationId);
2407
+ const { typing: typingPeople, signalTyping } = react$1.useTyping(conversationId);
2408
+ const streams = react$1.useMessageStreams(conversationId);
2409
+ const typing = react.useMemo(() => {
2410
+ const thinking = streams.filter((s) => s.status === "streaming" && !s.text);
2411
+ if (thinking.length === 0) return typingPeople;
2412
+ const next = new Set(typingPeople);
2413
+ for (const s of thinking) if (s.sender_external_id) next.add(s.sender_external_id);
2414
+ return next;
2415
+ }, [typingPeople, streams]);
2416
+ const visibleStreams = streams.filter((s) => s.text || s.status === "failed");
2408
2417
  const status = react$1.useRealtimeStatus();
2409
2418
  const wantsMemberCount = senderLabels === "auto" || avatars === "auto";
2410
2419
  const membersOn = mentions || readReceipts || wantsMemberCount;
@@ -2472,6 +2481,12 @@ function ConversationView({
2472
2481
  setNewCountWhileAway((n) => n + 1);
2473
2482
  }
2474
2483
  }, [messages, atBottom, me]);
2484
+ const streamedChars = visibleStreams.reduce((n, s) => n + s.text.length, 0);
2485
+ react.useEffect(() => {
2486
+ if (!atBottom || streamedChars === 0) return;
2487
+ const el = listRef.current;
2488
+ if (el) el.scrollTop = el.scrollHeight;
2489
+ }, [streamedChars, atBottom]);
2475
2490
  const lastMarkedReadRef = react.useRef(null);
2476
2491
  react.useEffect(() => {
2477
2492
  if (!atBottom) return;
@@ -2710,6 +2725,23 @@ function ConversationView({
2710
2725
  )
2711
2726
  ] }, msg.id);
2712
2727
  }),
2728
+ visibleStreams.map(
2729
+ (stream) => stream.status === "failed" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-stream-failed", role: "status", children: stream.error ? `The agent couldn't reply: ${stream.error}` : "The agent couldn't reply." }, stream.id) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-stream", "aria-busy": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
2730
+ MessageRow,
2731
+ {
2732
+ msg: streamingMessage(stream),
2733
+ meId: me?.id ?? null,
2734
+ reactions: false,
2735
+ actions: false,
2736
+ threads: false,
2737
+ quotations: false,
2738
+ markdown,
2739
+ showSenderName: showSenderLabelsResolved,
2740
+ showAvatar: showAvatarsResolved,
2741
+ ...labelFor ? { labelFor } : {}
2742
+ }
2743
+ ) }, stream.id)
2744
+ ),
2713
2745
  error && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation__empty", children: [
2714
2746
  "Failed to load: ",
2715
2747
  error.message
@@ -2763,6 +2795,27 @@ function JoinBanner({
2763
2795
  if (meId !== null && participantIds.includes(meId)) return null;
2764
2796
  return /* @__PURE__ */ jsxRuntime.jsx(LiveCallBanner, { call, inCall: participantIds.length, onJoin });
2765
2797
  }
2798
+ function streamingMessage(stream) {
2799
+ const now = (/* @__PURE__ */ new Date()).toISOString();
2800
+ return {
2801
+ id: stream.id,
2802
+ tenant_id: "",
2803
+ conversation_id: stream.conversation_id,
2804
+ sender_id: stream.sender_id,
2805
+ sender_external_id: stream.sender_external_id,
2806
+ type: "text",
2807
+ body: stream.text,
2808
+ reply_to_id: null,
2809
+ thread_root_id: null,
2810
+ mentions: [],
2811
+ reactions: {},
2812
+ edited_at: null,
2813
+ deleted_at: null,
2814
+ sequence: Number.MAX_SAFE_INTEGER,
2815
+ inserted_at: now,
2816
+ updated_at: now
2817
+ };
2818
+ }
2766
2819
  function ChatHeader({
2767
2820
  conversationId,
2768
2821
  labelFor,