@poolse/react-ui 2.0.2 → 2.0.6

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
@@ -99,6 +99,107 @@ interface ConversationViewProps {
99
99
  }
100
100
  declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
101
101
 
102
+ interface ChatHeaderProps {
103
+ /** Conversation id — used to fetch the row + members for the title / presence dot. */
104
+ conversationId: string;
105
+ /**
106
+ * Resolve a member's external_id into a display name. Used for
107
+ * the direct-chat title and the group "X, Y, Z" subtitle.
108
+ */
109
+ labelFor?: (externalId: string) => string;
110
+ /** Avatar URL resolver for direct-chat avatars (mirrors ConversationList). */
111
+ avatarFor?: (externalId: string) => string | null;
112
+ /** When provided, renders a left-side back arrow that calls this on click. */
113
+ onBack?: () => void;
114
+ /** Tapping the title region — typical use is to open a profile / group sheet. */
115
+ onPress?: () => void;
116
+ /** Tap on the members icon on the right — typical use is to open `<GroupDetailsSheet>`. */
117
+ onMembersPress?: () => void;
118
+ /** Custom right-side slot rendered after the members button. */
119
+ rightSlot?: ReactNode;
120
+ }
121
+ declare function ChatHeader({ conversationId, labelFor, avatarFor, onBack, onPress, onMembersPress, rightSlot, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
122
+
123
+ /** Minimal user shape the picker renders. Matches the RN InboxUser. */
124
+ interface InboxUser {
125
+ externalId: string;
126
+ name: string;
127
+ subtitle?: string;
128
+ avatarUrl?: string | null;
129
+ }
130
+ interface UserPickerSheetProps {
131
+ visible: boolean;
132
+ onClose: () => void;
133
+ users: InboxUser[];
134
+ /** External_ids to hide from the list (typically `[me.external_id]`). */
135
+ excludeIds?: string[];
136
+ /** `single` → 1-tap to start a direct chat. `group` → multi-select + name input. */
137
+ mode: 'single' | 'group';
138
+ /** Fired in `single` mode once a user is tapped. */
139
+ onPickDirect?: (externalId: string) => void;
140
+ /** Fired in `group` mode once the user submits the form. */
141
+ onCreateGroup?: (name: string, memberExternalIds: string[]) => void;
142
+ }
143
+ declare function UserPickerSheet({ visible, onClose, users, excludeIds, mode, onPickDirect, onCreateGroup, }: UserPickerSheetProps): react_jsx_runtime.JSX.Element | null;
144
+
145
+ interface PoolseInboxProps {
146
+ /** Header title above the conversation list. Defaults to "Chats". */
147
+ title?: string;
148
+ /**
149
+ * The tenant's user directory. When provided, the inbox shows
150
+ * "New chat" + "New group" buttons in the header. Omit if you
151
+ * don't want the built-in picker UI (e.g. you start chats from
152
+ * elsewhere via the imperative `openDirect()` API).
153
+ */
154
+ users?: InboxUser[];
155
+ /** Display-name resolver for sender labels, chat header titles, conversation rows. */
156
+ labelFor?: (externalId: string) => string;
157
+ /** Avatar URL resolver — same role. */
158
+ avatarFor?: (externalId: string) => string | null;
159
+ /** Right-side slot in the list header (typical use: logout / settings). */
160
+ renderRightAction?: () => ReactNode;
161
+ /** Custom row renderer — receives conv + caller external_id + selected. */
162
+ renderConversationRow?: (conv: Conversation, callerExternalId: string | null, selected: boolean) => ReactNode;
163
+ /** Custom empty state when the list is empty. */
164
+ emptyState?: ReactNode | string;
165
+ }
166
+ interface PoolseInboxHandle {
167
+ /** Open a known conversation (e.g. from a deep link / push tap). */
168
+ open: (conversationId: Uuid) => void;
169
+ /**
170
+ * Open (or create) a direct conversation with the given external_id.
171
+ * The backend dedupes per pair — returns the existing conversation
172
+ * if one already exists.
173
+ */
174
+ openDirect: (externalId: string) => Promise<void>;
175
+ /** Open (or create) a group conversation. */
176
+ openGroup: (name: string, memberExternalIds: string[]) => Promise<void>;
177
+ /** Open the built-in "new chat" picker programmatically. */
178
+ promptNewChat: () => void;
179
+ /** Open the built-in "new group" picker programmatically. */
180
+ promptNewGroup: () => void;
181
+ /** Pop back to the conversation list. */
182
+ close: () => void;
183
+ }
184
+ /**
185
+ * Drop-in inbox screen. Two-column on wide viewports, push-pane on
186
+ * mobile-web. Picker sheets for "New chat" / "New group" appear when
187
+ * `users` is provided; otherwise the dev wires those flows themselves
188
+ * via `openDirect` / `openGroup` on the ref.
189
+ */
190
+ declare const PoolseInbox: react.ForwardRefExoticComponent<PoolseInboxProps & react.RefAttributes<PoolseInboxHandle>>;
191
+
192
+ interface GroupDetailsSheetProps {
193
+ visible: boolean;
194
+ onClose: () => void;
195
+ conversationId: string;
196
+ labelFor?: (externalId: string) => string;
197
+ avatarFor?: (externalId: string) => string | null;
198
+ /** Slot below the member list — typically a "Leave group" or "Invite" button. */
199
+ footer?: ReactNode;
200
+ }
201
+ declare function GroupDetailsSheet({ visible, onClose, conversationId, labelFor, avatarFor, footer, }: GroupDetailsSheetProps): react_jsx_runtime.JSX.Element | null;
202
+
102
203
  /**
103
204
  * Position of this bubble within a same-sender, same-day, ≤5-min
104
205
  * cluster. Drives the tail-corner rendering: only `last` and
@@ -365,8 +466,17 @@ interface ConversationListProps {
365
466
  * `useConversations().unreadCounts`; omit to disable badges.
366
467
  */
367
468
  unreadCounts?: Record<Uuid, number>;
469
+ /**
470
+ * Resolve a user's display name from their `external_id`. Used to
471
+ * render direct-conversation rows (the conversation row picks the
472
+ * OTHER member's external_id and labels the row with their name).
473
+ * Falls back to the external_id itself when omitted.
474
+ */
475
+ labelFor?: (externalId: string) => string;
476
+ /** Avatar URL resolver — same role as `labelFor`, for the direct-chat avatar. */
477
+ avatarFor?: (externalId: string) => string | null;
368
478
  }
369
- declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, unreadCounts, }: ConversationListProps): react_jsx_runtime.JSX.Element;
479
+ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, unreadCounts, labelFor, avatarFor, }: ConversationListProps): react_jsx_runtime.JSX.Element;
370
480
 
371
481
  interface MemberListProps {
372
482
  conversationId: Uuid;
@@ -698,4 +808,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
698
808
  */
699
809
  declare function PoolseFonts(): null;
700
810
 
701
- export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, type IconName, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, useDisplayName, usePoolseFonts };
811
+ export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts };
package/dist/index.d.ts CHANGED
@@ -99,6 +99,107 @@ interface ConversationViewProps {
99
99
  }
100
100
  declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
101
101
 
102
+ interface ChatHeaderProps {
103
+ /** Conversation id — used to fetch the row + members for the title / presence dot. */
104
+ conversationId: string;
105
+ /**
106
+ * Resolve a member's external_id into a display name. Used for
107
+ * the direct-chat title and the group "X, Y, Z" subtitle.
108
+ */
109
+ labelFor?: (externalId: string) => string;
110
+ /** Avatar URL resolver for direct-chat avatars (mirrors ConversationList). */
111
+ avatarFor?: (externalId: string) => string | null;
112
+ /** When provided, renders a left-side back arrow that calls this on click. */
113
+ onBack?: () => void;
114
+ /** Tapping the title region — typical use is to open a profile / group sheet. */
115
+ onPress?: () => void;
116
+ /** Tap on the members icon on the right — typical use is to open `<GroupDetailsSheet>`. */
117
+ onMembersPress?: () => void;
118
+ /** Custom right-side slot rendered after the members button. */
119
+ rightSlot?: ReactNode;
120
+ }
121
+ declare function ChatHeader({ conversationId, labelFor, avatarFor, onBack, onPress, onMembersPress, rightSlot, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
122
+
123
+ /** Minimal user shape the picker renders. Matches the RN InboxUser. */
124
+ interface InboxUser {
125
+ externalId: string;
126
+ name: string;
127
+ subtitle?: string;
128
+ avatarUrl?: string | null;
129
+ }
130
+ interface UserPickerSheetProps {
131
+ visible: boolean;
132
+ onClose: () => void;
133
+ users: InboxUser[];
134
+ /** External_ids to hide from the list (typically `[me.external_id]`). */
135
+ excludeIds?: string[];
136
+ /** `single` → 1-tap to start a direct chat. `group` → multi-select + name input. */
137
+ mode: 'single' | 'group';
138
+ /** Fired in `single` mode once a user is tapped. */
139
+ onPickDirect?: (externalId: string) => void;
140
+ /** Fired in `group` mode once the user submits the form. */
141
+ onCreateGroup?: (name: string, memberExternalIds: string[]) => void;
142
+ }
143
+ declare function UserPickerSheet({ visible, onClose, users, excludeIds, mode, onPickDirect, onCreateGroup, }: UserPickerSheetProps): react_jsx_runtime.JSX.Element | null;
144
+
145
+ interface PoolseInboxProps {
146
+ /** Header title above the conversation list. Defaults to "Chats". */
147
+ title?: string;
148
+ /**
149
+ * The tenant's user directory. When provided, the inbox shows
150
+ * "New chat" + "New group" buttons in the header. Omit if you
151
+ * don't want the built-in picker UI (e.g. you start chats from
152
+ * elsewhere via the imperative `openDirect()` API).
153
+ */
154
+ users?: InboxUser[];
155
+ /** Display-name resolver for sender labels, chat header titles, conversation rows. */
156
+ labelFor?: (externalId: string) => string;
157
+ /** Avatar URL resolver — same role. */
158
+ avatarFor?: (externalId: string) => string | null;
159
+ /** Right-side slot in the list header (typical use: logout / settings). */
160
+ renderRightAction?: () => ReactNode;
161
+ /** Custom row renderer — receives conv + caller external_id + selected. */
162
+ renderConversationRow?: (conv: Conversation, callerExternalId: string | null, selected: boolean) => ReactNode;
163
+ /** Custom empty state when the list is empty. */
164
+ emptyState?: ReactNode | string;
165
+ }
166
+ interface PoolseInboxHandle {
167
+ /** Open a known conversation (e.g. from a deep link / push tap). */
168
+ open: (conversationId: Uuid) => void;
169
+ /**
170
+ * Open (or create) a direct conversation with the given external_id.
171
+ * The backend dedupes per pair — returns the existing conversation
172
+ * if one already exists.
173
+ */
174
+ openDirect: (externalId: string) => Promise<void>;
175
+ /** Open (or create) a group conversation. */
176
+ openGroup: (name: string, memberExternalIds: string[]) => Promise<void>;
177
+ /** Open the built-in "new chat" picker programmatically. */
178
+ promptNewChat: () => void;
179
+ /** Open the built-in "new group" picker programmatically. */
180
+ promptNewGroup: () => void;
181
+ /** Pop back to the conversation list. */
182
+ close: () => void;
183
+ }
184
+ /**
185
+ * Drop-in inbox screen. Two-column on wide viewports, push-pane on
186
+ * mobile-web. Picker sheets for "New chat" / "New group" appear when
187
+ * `users` is provided; otherwise the dev wires those flows themselves
188
+ * via `openDirect` / `openGroup` on the ref.
189
+ */
190
+ declare const PoolseInbox: react.ForwardRefExoticComponent<PoolseInboxProps & react.RefAttributes<PoolseInboxHandle>>;
191
+
192
+ interface GroupDetailsSheetProps {
193
+ visible: boolean;
194
+ onClose: () => void;
195
+ conversationId: string;
196
+ labelFor?: (externalId: string) => string;
197
+ avatarFor?: (externalId: string) => string | null;
198
+ /** Slot below the member list — typically a "Leave group" or "Invite" button. */
199
+ footer?: ReactNode;
200
+ }
201
+ declare function GroupDetailsSheet({ visible, onClose, conversationId, labelFor, avatarFor, footer, }: GroupDetailsSheetProps): react_jsx_runtime.JSX.Element | null;
202
+
102
203
  /**
103
204
  * Position of this bubble within a same-sender, same-day, ≤5-min
104
205
  * cluster. Drives the tail-corner rendering: only `last` and
@@ -365,8 +466,17 @@ interface ConversationListProps {
365
466
  * `useConversations().unreadCounts`; omit to disable badges.
366
467
  */
367
468
  unreadCounts?: Record<Uuid, number>;
469
+ /**
470
+ * Resolve a user's display name from their `external_id`. Used to
471
+ * render direct-conversation rows (the conversation row picks the
472
+ * OTHER member's external_id and labels the row with their name).
473
+ * Falls back to the external_id itself when omitted.
474
+ */
475
+ labelFor?: (externalId: string) => string;
476
+ /** Avatar URL resolver — same role as `labelFor`, for the direct-chat avatar. */
477
+ avatarFor?: (externalId: string) => string | null;
368
478
  }
369
- declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, unreadCounts, }: ConversationListProps): react_jsx_runtime.JSX.Element;
479
+ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, unreadCounts, labelFor, avatarFor, }: ConversationListProps): react_jsx_runtime.JSX.Element;
370
480
 
371
481
  interface MemberListProps {
372
482
  conversationId: Uuid;
@@ -698,4 +808,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
698
808
  */
699
809
  declare function PoolseFonts(): null;
700
810
 
701
- export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, type IconName, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, useDisplayName, usePoolseFonts };
811
+ export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useDisplayName, usePoolseFonts };