@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 CHANGED
@@ -4,6 +4,110 @@ 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
+ ## [2.0.0] — 2026-06-03
8
+
9
+ Lockstep release with `@poolse/sdk@2.0.0` and `@poolse/react@2.0.0`.
10
+
11
+ ### Breaking
12
+
13
+ - **`UserNameProps.externalId`** — was `userId`. Same applies to
14
+ `useDisplayName(externalId, …)`.
15
+ - **`MemberListProps.labelFor: (externalId) => string`** — was keyed
16
+ by uuid. Same change to `avatarFor`.
17
+ - **`MemberListProps.onlineExternalIds`** — was `onlineUserIds`.
18
+ - **`TypingIndicatorProps.labelFor: (externalId) => string`**.
19
+ - **`MessageBubbleProps.labelFor: (externalId) => string`** — both
20
+ the main `labelFor` and the QuotedCard's. The bubble reads
21
+ `message.sender_external_id` to drive `useUser`.
22
+ - **`MessageComposerProps.labelFor: (externalId) => string`**.
23
+ - **`MentionInputProps.labelFor: (externalId) => string`**. The
24
+ dropdown filters and inserts by external_id; the wire `mentions`
25
+ array stays uuid-keyed (backend storage hasn't changed there).
26
+ - **`ConversationViewProps.labelFor: (externalId) => string`** —
27
+ passes through to every consuming child.
28
+
29
+ ### Migration
30
+
31
+ See `MIGRATING.md` at the repo root.
32
+
33
+ ## [1.1.0] — 2026-06-02
34
+
35
+ Lockstep release with `@poolse/sdk@1.1.0` and `@poolse/react@1.1.0`.
36
+ `@poolse/react-ui` carries the actual feature work this version; the
37
+ other two packages bumped to keep the three in sync, so customers can
38
+ pin one version across the whole client surface.
39
+
40
+ ### Added — attachments inside the bubble (WhatsApp-style)
41
+
42
+ - `<MessageBubble>` now renders attachments INSIDE the bubble rather
43
+ than as a separate block underneath. Images compose a mosaic at the
44
+ top of the bubble, file cards stack below the mosaic, and the
45
+ message body (if any) sits beneath them all. Layout chooses a grid
46
+ template by image count: n1 → single full-bleed tile (natural
47
+ aspect, capped at 360px), n2 → two equal squares, n3 → one 16:9
48
+ hero + two squares beneath, n4+ → 2×2 grid with the 4th tile
49
+ showing a `+N more` overlay. The bubble has `overflow: hidden` so
50
+ the mosaic is clipped to the bubble's rounded corners and the
51
+ asymmetric tail.
52
+ - `<MessageBubble showAttachments?: boolean>` — new prop, defaults
53
+ to `true`. Pass `false` if you want the bubble to skip the
54
+ in-bubble attachments (so you can render them yourself).
55
+ `<MessageRow>` forwards its existing `attachments` flag to this
56
+ prop, and `<ConversationView>`'s `attachments` flag forwards to
57
+ `<MessageRow>`. Existing callers don't need to do anything to get
58
+ the new layout.
59
+ - New CSS classes: `.poolse-message__media`,
60
+ `.poolse-message__media--n1` / `--n2` / `--n3` / `--n4`,
61
+ `.poolse-message__media-tile`, `.poolse-message__media-overflow`,
62
+ `.poolse-message__files`, `.poolse-message__meta--overlay`, plus
63
+ the parent-state modifiers `.poolse-message--has-media` and
64
+ `.poolse-message--media-only`.
65
+ - When a message has only images (no body text and no file cards),
66
+ the meta (time + read tick) renders as a small dark pill overlaid
67
+ on the bottom-right of the mosaic, matching the WhatsApp
68
+ convention.
69
+ - File-card attachments on self bubbles get a tinted white-on-coral
70
+ variant so they read against the brand colour.
71
+
72
+ ### Changed
73
+
74
+ - `<MessageRow>` no longer renders the standalone attachments block
75
+ below the bubble — attachments now live inside the bubble via the
76
+ new `showAttachments` plumbing.
77
+ - README rewritten as a full component reference with the in-bubble
78
+ attachment layout documented, the migration note for the removed
79
+ CSS class, the full design-token list, the customization layers,
80
+ and the accessibility surface.
81
+
82
+ ### Removed
83
+
84
+ - CSS class `.poolse-message-row__attachments` and its `--self`
85
+ modifier are no longer rendered or defined. Any customer rule that
86
+ selected on them will silently no-op. Re-target the new classes
87
+ above to restore custom styling.
88
+
89
+ ### Migration notes
90
+
91
+ - If you never touched the `.poolse-message-row__attachments`
92
+ selector and you don't pass `attachments={false}` to
93
+ `<ConversationView>` / `<MessageRow>`, nothing changes for you —
94
+ attachments still appear, just inside the bubble.
95
+ - If you styled the old class, switch your selectors to
96
+ `.poolse-message__media` / `.poolse-message__files`. The new
97
+ classes carry the same semantic content (images and file cards
98
+ respectively), and the design-token-driven defaults already match
99
+ the surrounding bubble styling.
100
+ - If you previously rendered your own attachments outside the bubble
101
+ while passing a `<MessageBubble>` directly, pass
102
+ `showAttachments={false}` to keep that arrangement.
103
+
104
+ ### Internal
105
+
106
+ - Test harness: `XMLHttpRequest` is undefined'd in `test/setup.ts`
107
+ so the bundled Phoenix LongPoll fallback can't schedule a
108
+ setTimeout that fires after happy-dom teardown. Resolves the
109
+ unhandled-error exits previously seen on `pnpm test`.
110
+
7
111
  ## [1.0.0-beta.0] — 2026-06-01
8
112
 
9
113
  First beta of the stable component surface. Promotes the full 0.2.x
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # `@poolse/react-ui`
2
2
 
3
- Plug-and-play React components for **[poolse](https://poolse.dev)** — realtime chat infrastructure.
3
+ React components for [poolse](https://poolse.dev). A composed `<ConversationView>` for the common case, plus the parts it's built from (`<MessageBubble>`, `<MessageComposer>`, `<ConversationList>`, `<MemberList>`, `<ThreadView>`, `<MentionInput>`, …) for when you want to assemble your own surface. Brand-themed via CSS variables — no rebuild needed to re-skin.
4
4
 
5
- Brand-aligned default UI built on top of **[`@poolse/react`](https://www.npmjs.com/package/@poolse/react)** hooks. Drop a `<ConversationView>` in once and you've got chat. Or compose `<MessageBubble>`, `<MessageComposer>`, `<ConversationList>`, `<MemberList>`, `<AttachmentPreview>`, `<ReactionStrip>`, `<MentionInput>` à la carte. Themed via CSS variables — no rebuild needed to re-skin.
5
+ 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).
6
+
7
+ > **⚠️ 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`.
6
8
 
7
9
  ## Install
8
10
 
@@ -10,6 +12,12 @@ Brand-aligned default UI built on top of **[`@poolse/react`](https://www.npmjs.c
10
12
  npm install @poolse/react-ui @poolse/react @poolse/sdk
11
13
  ```
12
14
 
15
+ ```tsx
16
+ import '@poolse/react-ui/styles.css';
17
+ ```
18
+
19
+ Import the stylesheet **once** at your app root. It defines the `--poolse-*` design tokens and the component styles.
20
+
13
21
  ## Quick start
14
22
 
15
23
  ```tsx
@@ -17,11 +25,10 @@ import { PoolseProvider } from '@poolse/react';
17
25
  import { ConversationView } from '@poolse/react-ui';
18
26
  import '@poolse/react-ui/styles.css';
19
27
 
20
- function App() {
28
+ export function App() {
21
29
  return (
22
30
  <PoolseProvider
23
31
  config={{
24
- apiUrl: 'https://chat.example.com',
25
32
  getToken: async () => {
26
33
  const res = await fetch('/api/chat-token', { method: 'POST' });
27
34
  const { token } = await res.json();
@@ -29,77 +36,288 @@ function App() {
29
36
  },
30
37
  }}
31
38
  >
32
- <ConversationView conversationId="<conversation-id>" />
39
+ <ConversationView conversationId="00000000-0000-0000-0000-000000000000" />
33
40
  </PoolseProvider>
34
41
  );
35
42
  }
36
43
  ```
37
44
 
38
- That's it. Auto-loads the brand fonts (Bricolage Grotesque / Hanken Grotesk / JetBrains Mono) on mount unless you pass `loadFonts={false}`.
45
+ 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.
46
+
47
+ ## `<ConversationView>`
48
+
49
+ The default composed surface. Every feature is on a flag you can turn off.
50
+
51
+ ```tsx
52
+ <ConversationView
53
+ conversationId={id}
54
+
55
+ // Feature toggles (all default true unless noted)
56
+ reactions
57
+ mentions
58
+ attachments
59
+ actions
60
+ threads
61
+ quotations
62
+ readReceipts
63
+ markdown
64
+ grouping
65
+ daySeparators
66
+
67
+ // Behavioral knobs
68
+ maxBodyLength={200} // 0 disables the "Read more" trim
69
+ groupingWindowMs={300000} // 5 min — same-sender messages within this window cluster
70
+ senderLabels="auto" // 'auto' (on for 3+ members) | 'always' | 'never'
71
+ avatars="auto" // same
72
+
73
+ // Customer wiring
74
+ labelFor={(userId) => /* … */}
75
+ onMarkedRead={(convId) => /* clear sidebar badge */}
76
+ renderMessage={(msg, currentUserId) => /* fully custom row */}
77
+ emptyState={<div>Say hi.</div>}
78
+ loadFonts // default true
79
+ />
80
+ ```
81
+
82
+ ### What it gives you
83
+
84
+ - **Message list with infinite-scroll-up.** Top-sentinel `IntersectionObserver` fires `loadMore()` when the user gets within ~400px of the top.
85
+ - **Smart auto-scroll.** Stays pinned to the bottom while the user is at the bottom; otherwise increments a "N new messages" badge.
86
+ - **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.
87
+ - **Drag-and-drop attachments.** The whole conversation pane accepts a file drop and forwards it to the composer's upload queue.
88
+ - **Quote-reply chip** above the composer when `quotations` is on. The chip carries the quoted sender + a snippet, and Esc dismisses it.
89
+ - **Realtime status banner.** Renders "Connecting…" / "Reconnecting…" / "Disconnected" pills when the socket isn't connected.
90
+ - **Thread side-pane** opens on the right when the user clicks "Reply in thread"; below 760px it goes full-screen.
91
+ - **Day separators.** "Today" / "Yesterday" / weekday name / `26 May 2024` between calendar days.
92
+ - **Message clustering.** Same sender, same day, within `groupingWindowMs` (default 5 min) — clustered with a single asymmetric tail on the last bubble (iMessage / WhatsApp convention).
93
+ - **Markdown bodies.** GitHub-flavored, sanitized: bold/italic/lists/code/blockquotes/strikethrough/autolinks. URLs render with `target="_blank" rel="noopener noreferrer nofollow"`.
94
+ - **Long-message trim.** Bodies past `maxBodyLength` collapse to a `Read more` toggle.
95
+
96
+ ### `renderMessage` escape hatch
97
+
98
+ `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.
99
+
100
+ ```tsx
101
+ <ConversationView
102
+ conversationId={id}
103
+ renderMessage={(msg, currentUserId) => (
104
+ <MyCustomBubble message={msg} isSelf={msg.sender_id === currentUserId} />
105
+ )}
106
+ />
107
+ ```
108
+
109
+ If you want to keep most of the default behavior, render `<MessageRow>` yourself with the props you'd like to flip.
39
110
 
40
111
  ## Components
41
112
 
42
- | Component | Use |
43
- | -------------------------------------- | --------------------------------------------------------------------------------------------------------- |
44
- | `<ConversationView>` | Full chat surface: messages, typing, composer, reactions, threads, attachments — drag-drop + lightbox |
45
- | `<ConversationList>` | Sidebar of conversations the user belongs to |
46
- | `<MemberList>` | Roster for a conversation, with role badges + optional remove |
47
- | `<MessageBubble>` | One message — coral for self, surface for others; markdown body; read-receipt glyph |
48
- | `<MessageComposer>` | Pill input + circular brand send button |
49
- | `<MentionInput>` | Composer with `@` autocomplete (combobox ARIA) |
50
- | `<TypingIndicator>` | Three bouncing dots + names label; live region for screen readers |
51
- | `<AttachmentPreview>` | Inline image (lazy thumbnail) + lightbox on click, OR file card with download |
52
- | `<UploadQueueStrip>` | Chips with progress bar + cancel/dismiss for in-flight uploads |
53
- | `<ReactionStrip>` + `<ReactionPicker>` | Pills with counts + emoji picker (keyboard-navigable) |
54
- | `<Avatar>` | Initials gradient + presence dot + image fallback |
55
- | `<UserName>` / `useDisplayName` | Resolve a user_id to its display name via `userResolver` (3-tier fallback chain) |
56
- | `<ThreadView>` | Right-pane reply thread with focus management + ESC close |
57
- | `<PoolseIcon name="…" />` | Any icon from the 41-icon brand set |
58
- | `<PoolseLogo>` | Brand mark / lockup / wordmark, theme-aware |
59
- | `<PoolseFonts />` | Inject the brand fonts (idempotent; `ConversationView` does this for you) |
60
-
61
- ## What you get for free
62
-
63
- - **Multi-file uploads** — composer picker accepts multiple files; drag-and-drop a batch onto the conversation pane and they ship as one message
64
- - **Progress + cancel** — every upload shows a chip above the composer with live progress bar (XHR-driven) and per-item cancel
65
- - **Image lightbox** — click any image attachment to view full-size; ESC closes, click-outside closes, body scroll locks
66
- - **Markdown messages** — GFM-flavored (bold/italic/lists/code/blockquotes/strikethrough/autolinks); long messages auto-trim with a "Read more" toggle
67
- - **Group-chat avatars + sender labels** — auto-on when a conversation has 3+ members; resolved via your `userResolver`
68
- - **WhatsApp-style grouping** — same-sender messages within 5 min cluster visually; day separators between calendar days
69
- - **Quote replies + threads** — quote stays in the main feed; "Reply in thread" opens the side pane
70
- - **A11y baseline** — `role="log"` messages list, live regions for typing + status, focus management on overlays, scoped `prefers-reduced-motion`, keyboard-only emoji picker
71
- - **Mobile baseline** — 44px touch targets, 16px composer font (no iOS auto-zoom), `safe-area-inset` on lightbox + composer, tap-reveal for message actions, full-screen thread pane below 760px
113
+ ### Composed surfaces
114
+
115
+ | Component | What |
116
+ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
117
+ | `<ConversationView>` | Full chat (above) — `useMessages` + `useMembers` + `useTyping` + composer + thread pane wired together. |
118
+ | `<ThreadView>` | The right-side reply pane. `useThread`-driven; close button + Esc + drag-drop. Used internally by `<ConversationView>`; export it for custom layouts. |
119
+
120
+ ### Message surface
121
+
122
+ | Component | What |
123
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
124
+ | `<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. |
125
+ | `<MessageBubble>` | Just the bubble — sender label, quoted card, attachments, body, meta. Pure presentational; takes `Message` + `currentUserId`. |
126
+ | `<EditableMessageBubble>` | `<MessageBubble>` plus an in-place edit mode (textarea, Enter to save, Esc to cancel). Controlled via the `editing` prop. |
127
+ | `<MessageActions>` | Hover popover with the react / reply / quote / copy / edit / delete affordances. |
128
+ | `<TypingIndicator>` | Three bouncing dots + a `role="status"` live region announcing "Alice is typing" / "Alice and Bob are typing" / "3 people are typing". |
129
+
130
+ ### Composer
131
+
132
+ | Component | What |
133
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
134
+ | `<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. |
135
+ | `<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. |
136
+ | `<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. |
137
+
138
+ ### Attachments
139
+
140
+ | Component | What |
141
+ | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
142
+ | `<AttachmentPreview>` | Inline image (lazy thumbnail → fullscreen lightbox on click) or a file card with download. Resolves the presigned URL via `useAttachmentUrl`. |
143
+
144
+ ### Conversation roster
145
+
146
+ | Component | What |
147
+ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
148
+ | `<ConversationList>` | Sidebar list of the user's conversations. Avatar + name + last-message time + unread pill. Controlled mode: pass `conversations`/`loading`/`error` to render from external state instead of `useConversations()`. |
149
+ | `<MemberList>` | Roster for one conversation. Role badges, online dot, optional remove button gated by a `canRemove(membership)` predicate. |
150
+
151
+ ### Reactions
152
+
153
+ | Component | What |
154
+ | ------------------ | ------------------------------------------------------------------------------------------------ |
155
+ | `<ReactionStrip>` | Inline emoji pills with counts + "your reaction" highlight; optional picker button on the right. |
156
+ | `<ReactionPicker>` | Standalone emoji popover. Six common emojis, arrow-key navigation, Esc closes. |
157
+
158
+ ### Identity
159
+
160
+ | Component | What |
161
+ | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
162
+ | `<Avatar>` | Circular image with initials fallback + green presence dot. `size: 'sm' \| 'md' \| 'lg'`. |
163
+ | `<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. |
164
+
165
+ ### Brand chrome
166
+
167
+ | Component | What |
168
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
169
+ | `<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. |
170
+ | `<PoolseLogo>` | Brand mark / lockup / wordmark / mono (single-color) variants. |
171
+ | `<PoolseFonts />` / `usePoolseFonts()` | Inject the Google Fonts link into `<head>` (idempotent). `<ConversationView>` calls this automatically unless you pass `loadFonts={false}`. |
172
+
173
+ ## Attachments inside the bubble (1.1.0+)
174
+
175
+ As of 1.1.0, `<MessageBubble>` renders attachments **inside** the bubble (WhatsApp / iMessage convention) rather than as a separate block under it.
176
+
177
+ The layout chooses a grid template by image count:
178
+
179
+ | Count | Layout |
180
+ | --------- | ----------------------------------------------------------------------------- |
181
+ | 1 image | Single full-bleed tile, natural aspect, capped at 360px tall. |
182
+ | 2 images | Two equal squares, side-by-side. |
183
+ | 3 images | One 16:9 hero on top + two squares beneath. |
184
+ | 4+ images | 2×2 grid. The 4th tile shows a `+N more` overlay when the total exceeds four. |
185
+
186
+ 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.
187
+
188
+ 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.
189
+
190
+ The bubble has `overflow: hidden` so the mosaic is clipped to the bubble's rounded corners and the asymmetric tail.
191
+
192
+ ### Opting out
193
+
194
+ ```tsx
195
+ <MessageBubble message={msg} currentUserId={meId} showAttachments={false} />
196
+ ```
197
+
198
+ 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>`.
199
+
200
+ ### Migration from 1.0.x
201
+
202
+ Anything customizing `.poolse-message-row__attachments` in your stylesheet won't match anymore — that class is no longer rendered. The new class names are:
203
+
204
+ - `.poolse-message__media` — image mosaic container
205
+ - `.poolse-message__media--n1` / `--n2` / `--n3` / `--n4` — count-specific grid templates
206
+ - `.poolse-message__media-tile` — one image cell
207
+ - `.poolse-message__media-overflow` — the `+N more` overlay
208
+ - `.poolse-message__files` — file-card stack
209
+ - `.poolse-message__meta--overlay` — modifier applied to `.poolse-message__meta` in image-only mode
210
+ - `.poolse-message--has-media` / `--media-only` — parent state modifiers
211
+
212
+ If you weren't styling the old class, you don't need to do anything — the new layout is on by default.
72
213
 
73
214
  ## Theming
74
215
 
75
- Every color, radius, shadow, and font is a `--poolse-*` CSS variable. Override in your own stylesheet — no component ejection:
216
+ Every color, radius, shadow, and font in the kit is a CSS variable. Override them in your own stylesheet — no JS, no rebuild:
76
217
 
77
218
  ```css
78
219
  :root {
79
- --poolse-brand: #0070f3; /* swap coral for your brand */
80
- --poolse-brand-soft: #e0eaff;
81
- --poolse-brand-strong: #0050b3;
220
+ --poolse-brand: #0070f3; /* primary action */
221
+ --poolse-brand-soft: #e0eaff; /* tinted fills, hover, badges */
222
+ --poolse-brand-strong: #0050b3; /* AA text on light surfaces */
223
+ --poolse-on-brand: #ffffff; /* foreground on brand */
82
224
  }
83
225
  ```
84
226
 
85
- Dark mode: set `[data-theme="dark"]` on any ancestor (or rely on the user's `prefers-color-scheme`).
227
+ The full token set:
86
228
 
87
- ## Customization
229
+ ```css
230
+ /* Brand & surfaces */
231
+ --poolse-brand /* primary action (default Pulse Coral #ff5436) */
232
+ --poolse-brand-strong /* AA text on light */
233
+ --poolse-brand-soft /* tinted fills, badges, hover */
234
+ --poolse-on-brand /* foreground on brand */
235
+ --poolse-paper /* page background */
236
+ --poolse-surface /* cards, panels */
237
+ --poolse-surface-2 /* insets, fields */
238
+ --poolse-ink /* primary text */
239
+ --poolse-ink-2 /* secondary text */
240
+ --poolse-ink-3 /* tertiary, hints */
241
+ --poolse-border /* hairline borders */
88
242
 
89
- Every component has a render-prop escape hatch — replace any row, message, or item without giving up the rest of the UI:
243
+ /* Semantic */
244
+ --poolse-presence /* online dot */
245
+ --poolse-success
246
+ --poolse-warning
247
+ --poolse-error /* distinct from coral */
248
+ --poolse-info
90
249
 
91
- ```tsx
92
- <ConversationList renderItem={(conv, selected) => <MyCustomRow {...} />} />
93
- <ConversationView renderMessage={(msg, currentUserId) => <MyMessageBubble {...} />} />
250
+ /* Typography */
251
+ --poolse-font-display /* Bricolage Grotesque */
252
+ --poolse-font-body /* Hanken Grotesk */
253
+ --poolse-font-mono /* JetBrains Mono */
254
+ --poolse-font-size /* default 15px */
255
+ --poolse-line-height /* default 1.5 */
256
+
257
+ /* Radii */
258
+ --poolse-radius-sm /* 8px */
259
+ --poolse-radius-md /* 12px */
260
+ --poolse-radius-lg /* 16px */
261
+ --poolse-radius-xl /* 24px */
262
+ --poolse-radius-pill /* 999px */
263
+
264
+ /* Shadows (warm-tinted) */
265
+ --poolse-shadow-sm
266
+ --poolse-shadow-md
267
+ --poolse-shadow-lg
94
268
  ```
95
269
 
96
- Or skip `@poolse/react-ui` entirely and build everything on the raw hooks from `@poolse/react`.
270
+ ### Dark mode
271
+
272
+ 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:
273
+
274
+ ```html
275
+ <div data-theme="dark">
276
+ <ConversationView ... />
277
+ </div>
278
+ ```
279
+
280
+ ## Accessibility
281
+
282
+ - `<div role="log" aria-live="polite" aria-relevant="additions">` on the message list — screen readers announce new messages but not the initial load.
283
+ - `<aside role="complementary" aria-label="Message thread">` on the thread pane. Esc closes; close button auto-focuses on mount.
284
+ - `<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.
285
+ - `<ReactionPicker>` is `role="menu"` / `role="menuitem"` with arrow-key navigation and Esc to close.
286
+ - `<TypingIndicator>` is `role="status" aria-live="polite" aria-atomic="true"`; the dots themselves are `aria-hidden`.
287
+ - `<Avatar>` is `role="img" aria-label="{name}"` even when rendering initials.
288
+ - 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.
289
+ - 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).
290
+ - The whole kit honors `prefers-reduced-motion` for the typing indicator, the message-row hover transitions, and the thread pane slide-in.
291
+
292
+ 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.
293
+
294
+ ## Customization layers
295
+
296
+ In order of escalating control:
297
+
298
+ 1. **CSS variables.** Re-skin without touching JS.
299
+ 2. **Feature flags on `<ConversationView>`.** Turn whole features off (`reactions={false}`, `threads={false}`, etc.).
300
+ 3. **Render-prop slots.** Replace individual rows: `<ConversationView renderMessage={...}>`, `<ConversationList renderItem={...}>`, `<MemberList renderItem={...}>`, `<ThreadView renderMessage={...}>`.
301
+ 4. **Component composition.** Drop `<ConversationView>` and assemble `<MessageRow>` (or `<MessageBubble>` if you want to skip the row's wiring) + `<MessageComposer>` + `<TypingIndicator>` + `<ThreadView>` yourself.
302
+ 5. **Drop down to `@poolse/react`.** Build your own components on the same hooks that this package uses internally.
303
+
304
+ You can mix and match — there's no all-or-nothing boundary.
305
+
306
+ ## Re-exports
307
+
308
+ The package also re-exports a few helpers that are useful when you're composing your own UI:
309
+
310
+ - `userColor(userId)` — deterministic per-user color for sender labels and avatars (8-hue palette, hashed from the id).
311
+ - `computeGroupPosition(msg, prev, next, windowMs)` / `sameDay(a, b)` / `formatDayLabel(iso)` — the same grouping primitives `<ConversationView>` uses to cluster messages.
312
+ - `useAutogrow(ref, value)` — textarea auto-grow hook used by the composers.
313
+ - `handleListEnter(value, caret)` — the smart-list-continuation primitive (handles `- item` / `1. item` continuation on Enter).
97
314
 
98
- ## Documentation
315
+ ## Links
99
316
 
100
- - Full component reference + theming — <https://poolse.dev/docs/react-ui>
317
+ - Full docs — <https://poolse.dev/docs/react-ui>
318
+ - Hooks reference — [`@poolse/react`](https://www.npmjs.com/package/@poolse/react)
319
+ - SDK reference — [`@poolse/sdk`](https://www.npmjs.com/package/@poolse/sdk)
101
320
  - Source — <https://github.com/poolse-hq/js-sdk>
102
- - Issues — <https://github.com/poolse-hq/js-sdk/issues>
103
321
 
104
322
  ## License
105
323