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