@poolse/react-ui 0.2.0-alpha.4 → 0.2.0-alpha.7

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
@@ -33,6 +33,13 @@ interface ConversationViewProps {
33
33
  actions?: boolean;
34
34
  /** "Reply in thread" opens a right-side ThreadView. */
35
35
  threads?: boolean;
36
+ /**
37
+ * WhatsApp-style quote-reply. Adds a "Reply" action to the hover
38
+ * menu — the new message stays in the main feed with a quoted card
39
+ * above its body, distinct from `threads` (which opens the
40
+ * side-pane). Defaults ON.
41
+ */
42
+ quotations?: boolean;
36
43
  /** Check-double glyph on own messages once another member's read cursor advances past them. */
37
44
  readReceipts?: boolean;
38
45
  /**
@@ -43,7 +50,7 @@ interface ConversationViewProps {
43
50
  */
44
51
  onMarkedRead?: (conversationId: string) => void;
45
52
  }
46
- declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, readReceipts, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
53
+ declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
47
54
 
48
55
  interface MessageBubbleProps {
49
56
  message: Message;
@@ -56,6 +63,18 @@ interface MessageBubbleProps {
56
63
  * map to "sent" and "read" respectively per brand conventions.
57
64
  */
58
65
  readState?: 'sent' | 'read';
66
+ /**
67
+ * Optional friendly label for a quoted message's sender. Same shape
68
+ * as `<MemberList labelFor>` — usually a `(userId) => string` that
69
+ * looks up a display name from the local member roster.
70
+ */
71
+ labelFor?: (userId: Uuid) => string;
72
+ /**
73
+ * Called when the user clicks the quoted card. Typically used to
74
+ * scroll the chat to the original message + flash a highlight.
75
+ * No-op when omitted.
76
+ */
77
+ onQuotedClick?: (quotedMessageId: Uuid) => void;
59
78
  }
60
79
  /**
61
80
  * One message bubble. The default renderer for `<ConversationView>` —
@@ -66,7 +85,7 @@ interface MessageBubbleProps {
66
85
  * (coral for self, surface-with-border for others), matching the
67
86
  * brand-kit chat showcase.
68
87
  */
69
- declare function MessageBubble({ message, currentUserId, readState }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
88
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
70
89
 
71
90
  interface EditableMessageBubbleProps {
72
91
  message: Message;
@@ -82,25 +101,50 @@ interface EditableMessageBubbleProps {
82
101
  declare function EditableMessageBubble({ message, currentUserId, readState, editing, onSave, onCancel, }: EditableMessageBubbleProps): react_jsx_runtime.JSX.Element;
83
102
 
84
103
  interface MessageComposerProps {
85
- /** Called when the user submits a message. Return value awaited so the input can disable until send completes. */
86
- onSend: (body: string) => Promise<unknown> | void;
104
+ /**
105
+ * Called when the user submits a message. Second arg carries
106
+ * optional metadata (currently just `quoted_message_id` when the
107
+ * caller has wired a `replyingTo`). Return value is awaited so the
108
+ * input can disable until send completes.
109
+ */
110
+ onSend: (body: string, opts?: {
111
+ quoted_message_id?: Uuid;
112
+ }) => Promise<unknown> | void;
87
113
  /** Called on every keystroke. Hook this to `useTyping().signalTyping`. */
88
114
  onTyping?: () => void;
89
115
  placeholder?: string;
90
116
  disabled?: boolean;
117
+ /**
118
+ * When set, renders a small quote chip above the input — the
119
+ * caller-owned "I'm about to quote-reply to this message" state.
120
+ * On submit, the message's id is forwarded as `quoted_message_id`.
121
+ * The composer does NOT clear this prop itself; the caller should
122
+ * clear `replyingTo` inside `onSend` after a successful send.
123
+ */
124
+ replyingTo?: Message | null;
125
+ /** User clicked the (x) on the reply chip. Caller clears `replyingTo`. */
126
+ onCancelReply?: () => void;
127
+ /** Friendly display label for the quoted sender. Defaults to user id slice. */
128
+ labelFor?: (userId: Uuid) => string;
91
129
  }
92
130
  /**
93
131
  * Single-line composer with Enter-to-send (Shift+Enter = newline).
94
132
  * Disables while the send is in flight so duplicate submits are
95
133
  * impossible from the UI side (the SDK also dedupes via Idempotency-Key).
96
134
  */
97
- declare function MessageComposer({ onSend, onTyping, placeholder, disabled, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
135
+ declare function MessageComposer({ onSend, onTyping, placeholder, disabled, replyingTo, onCancelReply, labelFor, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
98
136
 
99
137
  interface MessageActionsProps {
100
138
  /** Triggered when the user picks an emoji. */
101
139
  onReact?: (emoji: string) => void;
102
- /** Triggered when the user wants to reply in thread. */
140
+ /** Triggered when the user wants to reply in thread (opens side-pane). */
103
141
  onReply?: () => void;
142
+ /**
143
+ * Triggered when the user wants to quote-reply (WhatsApp-style).
144
+ * Distinct from `onReply`: quote replies stay in the main feed,
145
+ * threads open a side-pane.
146
+ */
147
+ onQuote?: () => void;
104
148
  /** Triggered when the user wants to copy the message body to the clipboard. */
105
149
  onCopy?: () => void;
106
150
  /** Triggered when the user wants to edit. Only show on own messages. */
@@ -110,7 +154,7 @@ interface MessageActionsProps {
110
154
  /** Render any extra trailing action buttons (e.g. "Pin"). */
111
155
  children?: ReactNode;
112
156
  }
113
- declare function MessageActions({ onReact, onReply, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
157
+ declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
114
158
 
115
159
  interface TypingIndicatorProps {
116
160
  /** Set of user_ids currently typing. */
@@ -177,8 +221,14 @@ interface ConversationListProps {
177
221
  conversations?: Conversation[];
178
222
  loading?: boolean;
179
223
  error?: Error | null;
224
+ /**
225
+ * Per-conversation unread message count. Rendered as a small Pulse
226
+ * Coral pill on each row when > 0. Typically wired from
227
+ * `useConversations().unreadCounts`; omit to disable badges.
228
+ */
229
+ unreadCounts?: Record<Uuid, number>;
180
230
  }
181
- declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, }: ConversationListProps): react_jsx_runtime.JSX.Element;
231
+ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, unreadCounts, }: ConversationListProps): react_jsx_runtime.JSX.Element;
182
232
 
183
233
  interface MemberListProps {
184
234
  conversationId: Uuid;
@@ -274,8 +324,16 @@ interface MentionInputProps {
274
324
  * Defaults to the first 8 chars of the id.
275
325
  */
276
326
  labelFor?: (userId: Uuid) => string;
327
+ /**
328
+ * Caller-owned "I'm replying to this message" state. Mirrors
329
+ * `<MessageComposer replyingTo>` — renders a quote chip above the
330
+ * input and includes `quoted_message_id` on send.
331
+ */
332
+ replyingTo?: Message | null;
333
+ /** User clicked the (x) on the reply chip. Caller clears state. */
334
+ onCancelReply?: () => void;
277
335
  }
278
- declare function MentionInput({ conversationId, onSend, onTyping, placeholder, disabled, labelFor, }: MentionInputProps): react_jsx_runtime.JSX.Element;
336
+ declare function MentionInput({ conversationId, onSend, onTyping, placeholder, disabled, labelFor, replyingTo, onCancelReply, }: MentionInputProps): react_jsx_runtime.JSX.Element;
279
337
 
280
338
  declare const ICONS: {
281
339
  readonly attachment: {
package/dist/index.d.ts CHANGED
@@ -33,6 +33,13 @@ interface ConversationViewProps {
33
33
  actions?: boolean;
34
34
  /** "Reply in thread" opens a right-side ThreadView. */
35
35
  threads?: boolean;
36
+ /**
37
+ * WhatsApp-style quote-reply. Adds a "Reply" action to the hover
38
+ * menu — the new message stays in the main feed with a quoted card
39
+ * above its body, distinct from `threads` (which opens the
40
+ * side-pane). Defaults ON.
41
+ */
42
+ quotations?: boolean;
36
43
  /** Check-double glyph on own messages once another member's read cursor advances past them. */
37
44
  readReceipts?: boolean;
38
45
  /**
@@ -43,7 +50,7 @@ interface ConversationViewProps {
43
50
  */
44
51
  onMarkedRead?: (conversationId: string) => void;
45
52
  }
46
- declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, readReceipts, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
53
+ declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
47
54
 
48
55
  interface MessageBubbleProps {
49
56
  message: Message;
@@ -56,6 +63,18 @@ interface MessageBubbleProps {
56
63
  * map to "sent" and "read" respectively per brand conventions.
57
64
  */
58
65
  readState?: 'sent' | 'read';
66
+ /**
67
+ * Optional friendly label for a quoted message's sender. Same shape
68
+ * as `<MemberList labelFor>` — usually a `(userId) => string` that
69
+ * looks up a display name from the local member roster.
70
+ */
71
+ labelFor?: (userId: Uuid) => string;
72
+ /**
73
+ * Called when the user clicks the quoted card. Typically used to
74
+ * scroll the chat to the original message + flash a highlight.
75
+ * No-op when omitted.
76
+ */
77
+ onQuotedClick?: (quotedMessageId: Uuid) => void;
59
78
  }
60
79
  /**
61
80
  * One message bubble. The default renderer for `<ConversationView>` —
@@ -66,7 +85,7 @@ interface MessageBubbleProps {
66
85
  * (coral for self, surface-with-border for others), matching the
67
86
  * brand-kit chat showcase.
68
87
  */
69
- declare function MessageBubble({ message, currentUserId, readState }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
88
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
70
89
 
71
90
  interface EditableMessageBubbleProps {
72
91
  message: Message;
@@ -82,25 +101,50 @@ interface EditableMessageBubbleProps {
82
101
  declare function EditableMessageBubble({ message, currentUserId, readState, editing, onSave, onCancel, }: EditableMessageBubbleProps): react_jsx_runtime.JSX.Element;
83
102
 
84
103
  interface MessageComposerProps {
85
- /** Called when the user submits a message. Return value awaited so the input can disable until send completes. */
86
- onSend: (body: string) => Promise<unknown> | void;
104
+ /**
105
+ * Called when the user submits a message. Second arg carries
106
+ * optional metadata (currently just `quoted_message_id` when the
107
+ * caller has wired a `replyingTo`). Return value is awaited so the
108
+ * input can disable until send completes.
109
+ */
110
+ onSend: (body: string, opts?: {
111
+ quoted_message_id?: Uuid;
112
+ }) => Promise<unknown> | void;
87
113
  /** Called on every keystroke. Hook this to `useTyping().signalTyping`. */
88
114
  onTyping?: () => void;
89
115
  placeholder?: string;
90
116
  disabled?: boolean;
117
+ /**
118
+ * When set, renders a small quote chip above the input — the
119
+ * caller-owned "I'm about to quote-reply to this message" state.
120
+ * On submit, the message's id is forwarded as `quoted_message_id`.
121
+ * The composer does NOT clear this prop itself; the caller should
122
+ * clear `replyingTo` inside `onSend` after a successful send.
123
+ */
124
+ replyingTo?: Message | null;
125
+ /** User clicked the (x) on the reply chip. Caller clears `replyingTo`. */
126
+ onCancelReply?: () => void;
127
+ /** Friendly display label for the quoted sender. Defaults to user id slice. */
128
+ labelFor?: (userId: Uuid) => string;
91
129
  }
92
130
  /**
93
131
  * Single-line composer with Enter-to-send (Shift+Enter = newline).
94
132
  * Disables while the send is in flight so duplicate submits are
95
133
  * impossible from the UI side (the SDK also dedupes via Idempotency-Key).
96
134
  */
97
- declare function MessageComposer({ onSend, onTyping, placeholder, disabled, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
135
+ declare function MessageComposer({ onSend, onTyping, placeholder, disabled, replyingTo, onCancelReply, labelFor, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
98
136
 
99
137
  interface MessageActionsProps {
100
138
  /** Triggered when the user picks an emoji. */
101
139
  onReact?: (emoji: string) => void;
102
- /** Triggered when the user wants to reply in thread. */
140
+ /** Triggered when the user wants to reply in thread (opens side-pane). */
103
141
  onReply?: () => void;
142
+ /**
143
+ * Triggered when the user wants to quote-reply (WhatsApp-style).
144
+ * Distinct from `onReply`: quote replies stay in the main feed,
145
+ * threads open a side-pane.
146
+ */
147
+ onQuote?: () => void;
104
148
  /** Triggered when the user wants to copy the message body to the clipboard. */
105
149
  onCopy?: () => void;
106
150
  /** Triggered when the user wants to edit. Only show on own messages. */
@@ -110,7 +154,7 @@ interface MessageActionsProps {
110
154
  /** Render any extra trailing action buttons (e.g. "Pin"). */
111
155
  children?: ReactNode;
112
156
  }
113
- declare function MessageActions({ onReact, onReply, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
157
+ declare function MessageActions({ onReact, onReply, onQuote, onCopy, onEdit, onDelete, children, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
114
158
 
115
159
  interface TypingIndicatorProps {
116
160
  /** Set of user_ids currently typing. */
@@ -177,8 +221,14 @@ interface ConversationListProps {
177
221
  conversations?: Conversation[];
178
222
  loading?: boolean;
179
223
  error?: Error | null;
224
+ /**
225
+ * Per-conversation unread message count. Rendered as a small Pulse
226
+ * Coral pill on each row when > 0. Typically wired from
227
+ * `useConversations().unreadCounts`; omit to disable badges.
228
+ */
229
+ unreadCounts?: Record<Uuid, number>;
180
230
  }
181
- declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, }: ConversationListProps): react_jsx_runtime.JSX.Element;
231
+ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlledConversations, loading: controlledLoading, error: controlledError, unreadCounts, }: ConversationListProps): react_jsx_runtime.JSX.Element;
182
232
 
183
233
  interface MemberListProps {
184
234
  conversationId: Uuid;
@@ -274,8 +324,16 @@ interface MentionInputProps {
274
324
  * Defaults to the first 8 chars of the id.
275
325
  */
276
326
  labelFor?: (userId: Uuid) => string;
327
+ /**
328
+ * Caller-owned "I'm replying to this message" state. Mirrors
329
+ * `<MessageComposer replyingTo>` — renders a quote chip above the
330
+ * input and includes `quoted_message_id` on send.
331
+ */
332
+ replyingTo?: Message | null;
333
+ /** User clicked the (x) on the reply chip. Caller clears state. */
334
+ onCancelReply?: () => void;
277
335
  }
278
- declare function MentionInput({ conversationId, onSend, onTyping, placeholder, disabled, labelFor, }: MentionInputProps): react_jsx_runtime.JSX.Element;
336
+ declare function MentionInput({ conversationId, onSend, onTyping, placeholder, disabled, labelFor, replyingTo, onCancelReply, }: MentionInputProps): react_jsx_runtime.JSX.Element;
279
337
 
280
338
  declare const ICONS: {
281
339
  readonly attachment: {