@poolse/react-native 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2,6 +2,8 @@ import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
3
  import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, Attachment } from '@poolse/sdk';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { GroupPosition } from '@poolse/react';
6
+ import { ThemeInput, ColorSchemePreference, NativeThemeOptions, NativeTheme } from '@poolse/theme';
5
7
 
6
8
  interface InboxUser {
7
9
  /** The user's external_id (the same id you mint JWTs with). */
@@ -76,12 +78,68 @@ interface PoolseInboxHandle {
76
78
  */
77
79
  declare const PoolseInbox: react.ForwardRefExoticComponent<PoolseInboxProps & react.RefAttributes<PoolseInboxHandle>>;
78
80
 
81
+ /**
82
+ * - `bubbles` — chat bubbles, own messages on the right (the default).
83
+ * - `list` — Slack-style full-width rows: avatar, name and time once
84
+ * per run of messages.
85
+ * - `compact` — Discord/IRC-style dense lines: time, coloured name and
86
+ * text on one line.
87
+ */
88
+ type ChatLayout = 'bubbles' | 'list' | 'compact';
89
+ type ChatDensity = 'comfortable' | 'compact';
90
+ /** `'12h'`, `'24h'`, or your own formatter. Omitted: the locale's default. */
91
+ type TimeFormat = '12h' | '24h' | ((date: Date) => string);
92
+ /** What each slot function receives. */
93
+ interface MessageSlotProps {
94
+ message: Message;
95
+ /** The viewer sent it. */
96
+ isSelf: boolean;
97
+ sender: MessageUser;
98
+ layout: ChatLayout;
99
+ /** First message of a same-sender run (always true in `compact`). */
100
+ isRunStart: boolean;
101
+ /**
102
+ * What the slot renders by default (may be `null` — e.g. no header on
103
+ * a continuation message). Return it to keep the default, wrap it,
104
+ * or return something else.
105
+ */
106
+ children: ReactNode;
107
+ }
108
+ type MessageSlot = (props: MessageSlotProps) => ReactNode;
109
+ /**
110
+ * Replace or wrap one part of every message, in any layout:
111
+ *
112
+ * - `header` — sender name and time (the name label in `bubbles`)
113
+ * - `body` — the text (or "Message deleted")
114
+ * - `attachments` — images and files
115
+ * - `reactions` — the reaction pills
116
+ * - `thread` — the "N replies" link
117
+ * - `actions` — the long-press actions sheet
118
+ */
119
+ interface MessageSlots {
120
+ header?: MessageSlot;
121
+ body?: MessageSlot;
122
+ attachments?: MessageSlot;
123
+ reactions?: MessageSlot;
124
+ thread?: MessageSlot;
125
+ actions?: MessageSlot;
126
+ }
127
+ type MessageSlotContext = Omit<MessageSlotProps, 'children'>;
128
+ /** Third argument to `renderMessage`. */
129
+ interface RenderMessageContext {
130
+ layout: ChatLayout;
131
+ groupPosition: GroupPosition;
132
+ isRunStart: boolean;
133
+ /** The row ConversationView would have rendered for this message. */
134
+ renderDefault: () => ReactElement;
135
+ }
136
+
79
137
  type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';
80
138
  interface MessageBubbleProps {
81
139
  message: Message;
82
140
  /** Used to decide left/right alignment, color, and read-receipt visibility. */
83
141
  currentUserId: string | null;
84
- /** `'sent'` → single tick, `'read'` → double tick (theme.colors.brand). */
142
+ /** `'sent'` → single tick, `'read'` → double tick (theme.colors.accent). */
85
143
  readState?: 'sent' | 'read';
86
144
  /** Label resolver keyed by `external_id` — falls back to the externalId itself. */
87
145
  labelFor?: (externalId: string) => string;
@@ -112,6 +170,19 @@ interface MessageBubbleProps {
112
170
  * without it we fall back to plain text. Defaults to true.
113
171
  */
114
172
  markdown?: boolean;
173
+ /**
174
+ * `'12h'` / `'24h'` for the time of day, or a formatter that returns
175
+ * the whole label. Defaults to the locale's.
176
+ */
177
+ timeFormat?: TimeFormat;
178
+ /** `'compact'` tightens the text padding. Defaults to `'comfortable'`. */
179
+ density?: ChatDensity;
180
+ /**
181
+ * Replace or wrap the `header` (sender label), `attachments` and
182
+ * `body` parts. Needs `slotContext` (MessageRow passes both).
183
+ */
184
+ slots?: MessageSlots;
185
+ slotContext?: MessageSlotContext;
115
186
  }
116
187
  /**
117
188
  * One message bubble, structured as stacked sections rather than one
@@ -120,7 +191,7 @@ interface MessageBubbleProps {
120
191
  * room allows — which is what makes "ok" a one-line bubble instead of
121
192
  * a squat rectangle.
122
193
  */
123
- declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, onSenderPress, actionsTrigger, showAttachments, markdown, onLongPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
194
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, onSenderPress, actionsTrigger, showAttachments, markdown, onLongPress, timeFormat, density, slots, slotContext, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
124
195
 
125
196
  /** Who sent a message — what `onSenderPress` / `onAvatarPress` receive. */
126
197
  interface MessageUser {
@@ -178,6 +249,19 @@ interface MessageRowProps {
178
249
  onAvatarPress?: (user: MessageUser) => void;
179
250
  /** Call-log rows: offer "Call back" (see `<CallLogRow onCallBack>`). */
180
251
  onCallBack?: (media: 'audio' | 'video') => void;
252
+ /** `'bubbles'` (default), `'list'` or `'compact'` — see `ChatLayout`. */
253
+ layout?: ChatLayout;
254
+ /** `'comfortable'` (default) or `'compact'` spacing. */
255
+ density?: ChatDensity;
256
+ /** `'12h'`, `'24h'` or a formatter for timestamps. Defaults to the locale's. */
257
+ timeFormat?: TimeFormat;
258
+ /** Replace or wrap parts of the row — see `MessageSlots`. */
259
+ slots?: MessageSlots;
260
+ /**
261
+ * The message @-mentions the viewer: `list` and `compact` mark it
262
+ * with an accent bar.
263
+ */
264
+ mentionsMe?: boolean;
181
265
  }
182
266
  declare function MessageRow(props: MessageRowProps): react_jsx_runtime.JSX.Element | null;
183
267
 
@@ -187,9 +271,44 @@ interface ConversationViewProps {
187
271
  /**
188
272
  * Custom row renderer. Return `null` / `undefined` to fall back to
189
273
  * the default row for that message (so you can override just the
190
- * message kinds you care about).
274
+ * message kinds you care about). The third argument carries the
275
+ * layout and `renderDefault()`, the row this view would have drawn.
191
276
  */
192
- renderMessage?: (msg: Message, currentUserId: string | null) => ReactElement | null | undefined;
277
+ renderMessage?: (msg: Message, currentUserId: string | null, context: RenderMessageContext) => ReactElement | null | undefined;
278
+ /**
279
+ * How messages are drawn:
280
+ * * `'bubbles'` (default) — chat bubbles, yours on the right.
281
+ * * `'list'` — Slack-style full-width rows; avatar, name and time
282
+ * once per run, later messages' time dimmed in the gutter,
283
+ * "N replies" under threads. Long-press for actions.
284
+ * * `'compact'` — Discord/IRC-style dense lines: time, the name in
285
+ * the sender's colour, the text; an accent bar on messages that
286
+ * mention you.
287
+ */
288
+ layout?: ChatLayout;
289
+ /** `'comfortable'` (default) or `'compact'` spacing, in any layout. */
290
+ density?: ChatDensity;
291
+ /**
292
+ * Show avatars. Defaults: `list` on, `compact` off, `bubbles` per
293
+ * `avatars` (others' messages in group chats). Overrides `avatars`.
294
+ */
295
+ showAvatars?: boolean;
296
+ /** `'12h'`, `'24h'` or a formatter. Defaults to the locale's. */
297
+ timeFormat?: TimeFormat;
298
+ /**
299
+ * Same-sender messages less than this many minutes apart form one
300
+ * run (one bubble cluster, one `list` header). Default 5.
301
+ */
302
+ groupWindowMinutes?: number;
303
+ /** Day dividers between messages on different days. Defaults to `true`. */
304
+ daySeparators?: boolean;
305
+ /**
306
+ * Replace or wrap one part of every message — `header`, `body`,
307
+ * `attachments`, `reactions`, `thread`, `actions` — in any layout.
308
+ * Each receives the message, sender, layout and its default
309
+ * rendering as `children`.
310
+ */
311
+ slots?: MessageSlots;
193
312
  labelFor?: (externalId: string) => string;
194
313
  avatarFor?: (externalId: string) => string | null;
195
314
  /**
@@ -283,7 +402,7 @@ interface ConversationViewProps {
283
402
  */
284
403
  currentCallId?: string | null;
285
404
  }
286
- declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, keyboardOffset, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
405
+ declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, keyboardOffset, onCallBack, onJoinCall, currentCallId, layout, density, showAvatars: showAvatarsProp, timeFormat, groupWindowMinutes, daySeparators, slots, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
287
406
 
288
407
  interface ChatHeaderProps {
289
408
  conversationId: Uuid;
@@ -533,6 +652,12 @@ declare function MessageList({ messages, items, loading, hasMore, onLoadMore, re
533
652
 
534
653
  interface DaySeparatorProps {
535
654
  label: string;
655
+ /**
656
+ * `'pill'` (default) — a centred chip, for bubbles. `'rule'` — a
657
+ * hairline across the row with the chip on it, for the `list` and
658
+ * `compact` layouts.
659
+ */
660
+ variant?: 'pill' | 'rule';
536
661
  }
537
662
  /**
538
663
  * Centered date pill rendered between messages whose `inserted_at`
@@ -540,7 +665,7 @@ interface DaySeparatorProps {
540
665
  * with `formatDayLabel` from `@poolse/react` to compute the label
541
666
  * ("Today" / "Yesterday" / weekday / "26 May 2024").
542
667
  */
543
- declare function DaySeparator({ label }: DaySeparatorProps): react_jsx_runtime.JSX.Element;
668
+ declare function DaySeparator({ label, variant }: DaySeparatorProps): react_jsx_runtime.JSX.Element;
544
669
 
545
670
  interface TypingIndicatorProps {
546
671
  /** Set of `external_id`s currently typing — what `useTyping` returns. */
@@ -565,6 +690,9 @@ interface ThreadViewProps {
565
690
  rootMessage: Message;
566
691
  labelFor?: (externalId: string) => string;
567
692
  avatarFor?: (externalId: string) => string | null;
693
+ /** Row layout for the root and replies — see `ChatLayout`. Defaults to `'bubbles'`. */
694
+ layout?: ChatLayout;
695
+ timeFormat?: TimeFormat;
568
696
  }
569
697
  /**
570
698
  * Bottom-sheet modal for thread replies. Pull the drag handle / header
@@ -581,7 +709,7 @@ interface ThreadViewProps {
581
709
  * sheet top (the gutter), since KAV measures its frame relative to
582
710
  * its parent (the sheet), not the screen.
583
711
  */
584
- declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
712
+ declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, layout, timeFormat, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
585
713
 
586
714
  interface UserNameProps {
587
715
  /** The user's external_id. Pass null to render the fallback. */
@@ -1073,8 +1201,8 @@ interface AvatarProps {
1073
1201
  seed?: string | null;
1074
1202
  /** Show a green presence dot in the bottom-right corner. */
1075
1203
  online?: boolean;
1076
- /** Size variant. `md` → 40px, `sm` → 28px, `lg` → 56px. */
1077
- size?: 'sm' | 'md' | 'lg';
1204
+ /** Size variant. `md` → 40px, `sm` → 28px, `xs` → 20px, `lg` → 56px. */
1205
+ size?: 'xs' | 'sm' | 'md' | 'lg';
1078
1206
  }
1079
1207
  declare function Avatar({ src, name, seed, online, size }: AvatarProps): react_jsx_runtime.JSX.Element;
1080
1208
 
@@ -1169,26 +1297,42 @@ type PoolseRNThemeOverrides = {
1169
1297
 
1170
1298
  interface PoolseThemeProps {
1171
1299
  /**
1172
- * Light or dark base palette. Overrides are merged on top of the
1173
- * chosen base. Defaults to `light` if omitted.
1300
+ * A built-in theme's id (`'coral'`, `'ocean'`, `'forest'`, `'grape'`,
1301
+ * `'slate'`, `'sunset'`, `'rose'`, `'mono'`) or a whole `Theme` from
1302
+ * `@poolse/theme` (`createTheme`, `decodeTheme`).
1303
+ *
1304
+ * Still accepted, deprecated: a partial legacy override such as
1305
+ * `{ colors: { brand: '#000' } }`, deep-merged over the default
1306
+ * palette as before.
1307
+ */
1308
+ theme?: ThemeInput | PoolseRNThemeOverrides;
1309
+ /**
1310
+ * `'light'`, `'dark'`, or `'system'` to follow the OS (live). Defaults
1311
+ * to `'system'` when `theme` is a built-in id or a `Theme`; otherwise
1312
+ * to `mode`, then `'light'`, as before.
1174
1313
  */
1314
+ colorScheme?: ColorSchemePreference;
1315
+ /** @deprecated Use `colorScheme`. */
1175
1316
  mode?: ThemeMode;
1176
1317
  /**
1177
- * Partial overrides — only the fields you set replace the defaults.
1178
- * Nested groups (`colors`, `type`, `radii`, `spacing`, `shadows`)
1179
- * deep-merge, so `{ colors: { brand: '#000' } }` keeps every other
1180
- * color from the base theme.
1318
+ * Font families for a `theme` (React Native can't use the web font
1319
+ * stacks). Defaults to the platform fonts; pass the names you loaded
1320
+ * with expo-font.
1181
1321
  */
1182
- theme?: PoolseRNThemeOverrides;
1322
+ fonts?: NativeThemeOptions['fonts'];
1183
1323
  children: ReactNode;
1184
1324
  }
1185
- declare function PoolseTheme({ mode, theme, children }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
1186
1325
  /**
1187
- * Read the active poolse theme. Falls back to `defaultLightTheme`
1188
- * if no `<PoolseTheme>` ancestor is mounted, so components render
1189
- * sensibly even without explicit wiring.
1326
+ * Themes everything inside it. Switching `theme` or `colorScheme`
1327
+ * re-renders with the new tokens; nothing remounts.
1328
+ */
1329
+ declare function PoolseTheme({ theme, colorScheme, mode, fonts, children }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
1330
+ /**
1331
+ * The active theme's tokens (`@poolse/theme` names: `colors.accent`,
1332
+ * `fonts.body`, `radii.bubble`, …) for the active scheme. Without a
1333
+ * `<PoolseTheme>` ancestor: the default light palette.
1190
1334
  */
1191
- declare function usePoolseTheme(): PoolseRNTheme;
1335
+ declare function useTheme(): NativeTheme;
1192
1336
 
1193
1337
  declare const defaultLightTheme: PoolseRNTheme;
1194
1338
  declare const defaultDarkTheme: PoolseRNTheme;
@@ -1358,4 +1502,4 @@ declare const callColors: {
1358
1502
  */
1359
1503
  declare function useCallDuration(connected: boolean): string | null;
1360
1504
 
1361
- export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type MessageUser, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName, usePoolseTheme };
1505
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type RenderMessageContext, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, type TimeFormat, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName, useTheme };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
3
  import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, Attachment } from '@poolse/sdk';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { GroupPosition } from '@poolse/react';
6
+ import { ThemeInput, ColorSchemePreference, NativeThemeOptions, NativeTheme } from '@poolse/theme';
5
7
 
6
8
  interface InboxUser {
7
9
  /** The user's external_id (the same id you mint JWTs with). */
@@ -76,12 +78,68 @@ interface PoolseInboxHandle {
76
78
  */
77
79
  declare const PoolseInbox: react.ForwardRefExoticComponent<PoolseInboxProps & react.RefAttributes<PoolseInboxHandle>>;
78
80
 
81
+ /**
82
+ * - `bubbles` — chat bubbles, own messages on the right (the default).
83
+ * - `list` — Slack-style full-width rows: avatar, name and time once
84
+ * per run of messages.
85
+ * - `compact` — Discord/IRC-style dense lines: time, coloured name and
86
+ * text on one line.
87
+ */
88
+ type ChatLayout = 'bubbles' | 'list' | 'compact';
89
+ type ChatDensity = 'comfortable' | 'compact';
90
+ /** `'12h'`, `'24h'`, or your own formatter. Omitted: the locale's default. */
91
+ type TimeFormat = '12h' | '24h' | ((date: Date) => string);
92
+ /** What each slot function receives. */
93
+ interface MessageSlotProps {
94
+ message: Message;
95
+ /** The viewer sent it. */
96
+ isSelf: boolean;
97
+ sender: MessageUser;
98
+ layout: ChatLayout;
99
+ /** First message of a same-sender run (always true in `compact`). */
100
+ isRunStart: boolean;
101
+ /**
102
+ * What the slot renders by default (may be `null` — e.g. no header on
103
+ * a continuation message). Return it to keep the default, wrap it,
104
+ * or return something else.
105
+ */
106
+ children: ReactNode;
107
+ }
108
+ type MessageSlot = (props: MessageSlotProps) => ReactNode;
109
+ /**
110
+ * Replace or wrap one part of every message, in any layout:
111
+ *
112
+ * - `header` — sender name and time (the name label in `bubbles`)
113
+ * - `body` — the text (or "Message deleted")
114
+ * - `attachments` — images and files
115
+ * - `reactions` — the reaction pills
116
+ * - `thread` — the "N replies" link
117
+ * - `actions` — the long-press actions sheet
118
+ */
119
+ interface MessageSlots {
120
+ header?: MessageSlot;
121
+ body?: MessageSlot;
122
+ attachments?: MessageSlot;
123
+ reactions?: MessageSlot;
124
+ thread?: MessageSlot;
125
+ actions?: MessageSlot;
126
+ }
127
+ type MessageSlotContext = Omit<MessageSlotProps, 'children'>;
128
+ /** Third argument to `renderMessage`. */
129
+ interface RenderMessageContext {
130
+ layout: ChatLayout;
131
+ groupPosition: GroupPosition;
132
+ isRunStart: boolean;
133
+ /** The row ConversationView would have rendered for this message. */
134
+ renderDefault: () => ReactElement;
135
+ }
136
+
79
137
  type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';
80
138
  interface MessageBubbleProps {
81
139
  message: Message;
82
140
  /** Used to decide left/right alignment, color, and read-receipt visibility. */
83
141
  currentUserId: string | null;
84
- /** `'sent'` → single tick, `'read'` → double tick (theme.colors.brand). */
142
+ /** `'sent'` → single tick, `'read'` → double tick (theme.colors.accent). */
85
143
  readState?: 'sent' | 'read';
86
144
  /** Label resolver keyed by `external_id` — falls back to the externalId itself. */
87
145
  labelFor?: (externalId: string) => string;
@@ -112,6 +170,19 @@ interface MessageBubbleProps {
112
170
  * without it we fall back to plain text. Defaults to true.
113
171
  */
114
172
  markdown?: boolean;
173
+ /**
174
+ * `'12h'` / `'24h'` for the time of day, or a formatter that returns
175
+ * the whole label. Defaults to the locale's.
176
+ */
177
+ timeFormat?: TimeFormat;
178
+ /** `'compact'` tightens the text padding. Defaults to `'comfortable'`. */
179
+ density?: ChatDensity;
180
+ /**
181
+ * Replace or wrap the `header` (sender label), `attachments` and
182
+ * `body` parts. Needs `slotContext` (MessageRow passes both).
183
+ */
184
+ slots?: MessageSlots;
185
+ slotContext?: MessageSlotContext;
115
186
  }
116
187
  /**
117
188
  * One message bubble, structured as stacked sections rather than one
@@ -120,7 +191,7 @@ interface MessageBubbleProps {
120
191
  * room allows — which is what makes "ok" a one-line bubble instead of
121
192
  * a squat rectangle.
122
193
  */
123
- declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, onSenderPress, actionsTrigger, showAttachments, markdown, onLongPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
194
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, onSenderPress, actionsTrigger, showAttachments, markdown, onLongPress, timeFormat, density, slots, slotContext, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
124
195
 
125
196
  /** Who sent a message — what `onSenderPress` / `onAvatarPress` receive. */
126
197
  interface MessageUser {
@@ -178,6 +249,19 @@ interface MessageRowProps {
178
249
  onAvatarPress?: (user: MessageUser) => void;
179
250
  /** Call-log rows: offer "Call back" (see `<CallLogRow onCallBack>`). */
180
251
  onCallBack?: (media: 'audio' | 'video') => void;
252
+ /** `'bubbles'` (default), `'list'` or `'compact'` — see `ChatLayout`. */
253
+ layout?: ChatLayout;
254
+ /** `'comfortable'` (default) or `'compact'` spacing. */
255
+ density?: ChatDensity;
256
+ /** `'12h'`, `'24h'` or a formatter for timestamps. Defaults to the locale's. */
257
+ timeFormat?: TimeFormat;
258
+ /** Replace or wrap parts of the row — see `MessageSlots`. */
259
+ slots?: MessageSlots;
260
+ /**
261
+ * The message @-mentions the viewer: `list` and `compact` mark it
262
+ * with an accent bar.
263
+ */
264
+ mentionsMe?: boolean;
181
265
  }
182
266
  declare function MessageRow(props: MessageRowProps): react_jsx_runtime.JSX.Element | null;
183
267
 
@@ -187,9 +271,44 @@ interface ConversationViewProps {
187
271
  /**
188
272
  * Custom row renderer. Return `null` / `undefined` to fall back to
189
273
  * the default row for that message (so you can override just the
190
- * message kinds you care about).
274
+ * message kinds you care about). The third argument carries the
275
+ * layout and `renderDefault()`, the row this view would have drawn.
191
276
  */
192
- renderMessage?: (msg: Message, currentUserId: string | null) => ReactElement | null | undefined;
277
+ renderMessage?: (msg: Message, currentUserId: string | null, context: RenderMessageContext) => ReactElement | null | undefined;
278
+ /**
279
+ * How messages are drawn:
280
+ * * `'bubbles'` (default) — chat bubbles, yours on the right.
281
+ * * `'list'` — Slack-style full-width rows; avatar, name and time
282
+ * once per run, later messages' time dimmed in the gutter,
283
+ * "N replies" under threads. Long-press for actions.
284
+ * * `'compact'` — Discord/IRC-style dense lines: time, the name in
285
+ * the sender's colour, the text; an accent bar on messages that
286
+ * mention you.
287
+ */
288
+ layout?: ChatLayout;
289
+ /** `'comfortable'` (default) or `'compact'` spacing, in any layout. */
290
+ density?: ChatDensity;
291
+ /**
292
+ * Show avatars. Defaults: `list` on, `compact` off, `bubbles` per
293
+ * `avatars` (others' messages in group chats). Overrides `avatars`.
294
+ */
295
+ showAvatars?: boolean;
296
+ /** `'12h'`, `'24h'` or a formatter. Defaults to the locale's. */
297
+ timeFormat?: TimeFormat;
298
+ /**
299
+ * Same-sender messages less than this many minutes apart form one
300
+ * run (one bubble cluster, one `list` header). Default 5.
301
+ */
302
+ groupWindowMinutes?: number;
303
+ /** Day dividers between messages on different days. Defaults to `true`. */
304
+ daySeparators?: boolean;
305
+ /**
306
+ * Replace or wrap one part of every message — `header`, `body`,
307
+ * `attachments`, `reactions`, `thread`, `actions` — in any layout.
308
+ * Each receives the message, sender, layout and its default
309
+ * rendering as `children`.
310
+ */
311
+ slots?: MessageSlots;
193
312
  labelFor?: (externalId: string) => string;
194
313
  avatarFor?: (externalId: string) => string | null;
195
314
  /**
@@ -283,7 +402,7 @@ interface ConversationViewProps {
283
402
  */
284
403
  currentCallId?: string | null;
285
404
  }
286
- declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, keyboardOffset, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
405
+ declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, keyboardOffset, onCallBack, onJoinCall, currentCallId, layout, density, showAvatars: showAvatarsProp, timeFormat, groupWindowMinutes, daySeparators, slots, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
287
406
 
288
407
  interface ChatHeaderProps {
289
408
  conversationId: Uuid;
@@ -533,6 +652,12 @@ declare function MessageList({ messages, items, loading, hasMore, onLoadMore, re
533
652
 
534
653
  interface DaySeparatorProps {
535
654
  label: string;
655
+ /**
656
+ * `'pill'` (default) — a centred chip, for bubbles. `'rule'` — a
657
+ * hairline across the row with the chip on it, for the `list` and
658
+ * `compact` layouts.
659
+ */
660
+ variant?: 'pill' | 'rule';
536
661
  }
537
662
  /**
538
663
  * Centered date pill rendered between messages whose `inserted_at`
@@ -540,7 +665,7 @@ interface DaySeparatorProps {
540
665
  * with `formatDayLabel` from `@poolse/react` to compute the label
541
666
  * ("Today" / "Yesterday" / weekday / "26 May 2024").
542
667
  */
543
- declare function DaySeparator({ label }: DaySeparatorProps): react_jsx_runtime.JSX.Element;
668
+ declare function DaySeparator({ label, variant }: DaySeparatorProps): react_jsx_runtime.JSX.Element;
544
669
 
545
670
  interface TypingIndicatorProps {
546
671
  /** Set of `external_id`s currently typing — what `useTyping` returns. */
@@ -565,6 +690,9 @@ interface ThreadViewProps {
565
690
  rootMessage: Message;
566
691
  labelFor?: (externalId: string) => string;
567
692
  avatarFor?: (externalId: string) => string | null;
693
+ /** Row layout for the root and replies — see `ChatLayout`. Defaults to `'bubbles'`. */
694
+ layout?: ChatLayout;
695
+ timeFormat?: TimeFormat;
568
696
  }
569
697
  /**
570
698
  * Bottom-sheet modal for thread replies. Pull the drag handle / header
@@ -581,7 +709,7 @@ interface ThreadViewProps {
581
709
  * sheet top (the gutter), since KAV measures its frame relative to
582
710
  * its parent (the sheet), not the screen.
583
711
  */
584
- declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
712
+ declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, layout, timeFormat, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
585
713
 
586
714
  interface UserNameProps {
587
715
  /** The user's external_id. Pass null to render the fallback. */
@@ -1073,8 +1201,8 @@ interface AvatarProps {
1073
1201
  seed?: string | null;
1074
1202
  /** Show a green presence dot in the bottom-right corner. */
1075
1203
  online?: boolean;
1076
- /** Size variant. `md` → 40px, `sm` → 28px, `lg` → 56px. */
1077
- size?: 'sm' | 'md' | 'lg';
1204
+ /** Size variant. `md` → 40px, `sm` → 28px, `xs` → 20px, `lg` → 56px. */
1205
+ size?: 'xs' | 'sm' | 'md' | 'lg';
1078
1206
  }
1079
1207
  declare function Avatar({ src, name, seed, online, size }: AvatarProps): react_jsx_runtime.JSX.Element;
1080
1208
 
@@ -1169,26 +1297,42 @@ type PoolseRNThemeOverrides = {
1169
1297
 
1170
1298
  interface PoolseThemeProps {
1171
1299
  /**
1172
- * Light or dark base palette. Overrides are merged on top of the
1173
- * chosen base. Defaults to `light` if omitted.
1300
+ * A built-in theme's id (`'coral'`, `'ocean'`, `'forest'`, `'grape'`,
1301
+ * `'slate'`, `'sunset'`, `'rose'`, `'mono'`) or a whole `Theme` from
1302
+ * `@poolse/theme` (`createTheme`, `decodeTheme`).
1303
+ *
1304
+ * Still accepted, deprecated: a partial legacy override such as
1305
+ * `{ colors: { brand: '#000' } }`, deep-merged over the default
1306
+ * palette as before.
1307
+ */
1308
+ theme?: ThemeInput | PoolseRNThemeOverrides;
1309
+ /**
1310
+ * `'light'`, `'dark'`, or `'system'` to follow the OS (live). Defaults
1311
+ * to `'system'` when `theme` is a built-in id or a `Theme`; otherwise
1312
+ * to `mode`, then `'light'`, as before.
1174
1313
  */
1314
+ colorScheme?: ColorSchemePreference;
1315
+ /** @deprecated Use `colorScheme`. */
1175
1316
  mode?: ThemeMode;
1176
1317
  /**
1177
- * Partial overrides — only the fields you set replace the defaults.
1178
- * Nested groups (`colors`, `type`, `radii`, `spacing`, `shadows`)
1179
- * deep-merge, so `{ colors: { brand: '#000' } }` keeps every other
1180
- * color from the base theme.
1318
+ * Font families for a `theme` (React Native can't use the web font
1319
+ * stacks). Defaults to the platform fonts; pass the names you loaded
1320
+ * with expo-font.
1181
1321
  */
1182
- theme?: PoolseRNThemeOverrides;
1322
+ fonts?: NativeThemeOptions['fonts'];
1183
1323
  children: ReactNode;
1184
1324
  }
1185
- declare function PoolseTheme({ mode, theme, children }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
1186
1325
  /**
1187
- * Read the active poolse theme. Falls back to `defaultLightTheme`
1188
- * if no `<PoolseTheme>` ancestor is mounted, so components render
1189
- * sensibly even without explicit wiring.
1326
+ * Themes everything inside it. Switching `theme` or `colorScheme`
1327
+ * re-renders with the new tokens; nothing remounts.
1328
+ */
1329
+ declare function PoolseTheme({ theme, colorScheme, mode, fonts, children }: PoolseThemeProps): react_jsx_runtime.JSX.Element;
1330
+ /**
1331
+ * The active theme's tokens (`@poolse/theme` names: `colors.accent`,
1332
+ * `fonts.body`, `radii.bubble`, …) for the active scheme. Without a
1333
+ * `<PoolseTheme>` ancestor: the default light palette.
1190
1334
  */
1191
- declare function usePoolseTheme(): PoolseRNTheme;
1335
+ declare function useTheme(): NativeTheme;
1192
1336
 
1193
1337
  declare const defaultLightTheme: PoolseRNTheme;
1194
1338
  declare const defaultDarkTheme: PoolseRNTheme;
@@ -1358,4 +1502,4 @@ declare const callColors: {
1358
1502
  */
1359
1503
  declare function useCallDuration(connected: boolean): string | null;
1360
1504
 
1361
- export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type MessageUser, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName, usePoolseTheme };
1505
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type RenderMessageContext, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, type TimeFormat, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName, useTheme };