@poolse/react-ui 1.0.4 → 1.0.5

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
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Uuid, Message, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
3
+ import * as react from 'react';
3
4
  import { ReactNode, SVGProps, ReactElement } from 'react';
4
5
  import { UploadItem, ReactionMap } from '@poolse/react';
5
6
 
@@ -185,12 +186,14 @@ declare function EditableMessageBubble({ message, currentUserId, readState, edit
185
186
  interface MessageComposerProps {
186
187
  /**
187
188
  * Called when the user submits a message. Second arg carries
188
- * optional metadata (currently just `quoted_message_id` when the
189
- * caller has wired a `replyingTo`). Return value is awaited so the
190
- * input can disable until send completes.
189
+ * optional metadata: `quoted_message_id` when replying, and
190
+ * `attachment_ids` (resolved from the composer's upload queue) when
191
+ * files were attached. Return value is awaited so the composer can
192
+ * stay disabled until send completes.
191
193
  */
192
194
  onSend: (body: string, opts?: {
193
195
  quoted_message_id?: Uuid;
196
+ attachment_ids?: Uuid[];
194
197
  }) => Promise<unknown> | void;
195
198
  /** Called on every keystroke. Hook this to `useTyping().signalTyping`. */
196
199
  onTyping?: () => void;
@@ -208,13 +211,33 @@ interface MessageComposerProps {
208
211
  onCancelReply?: () => void;
209
212
  /** Friendly display label for the quoted sender. Defaults to user id slice. */
210
213
  labelFor?: (userId: Uuid) => string;
214
+ /**
215
+ * Show the paperclip + queue strip + accept dropped files via
216
+ * `ref.current.addFiles(files)`. Default `true`. Set `false` to
217
+ * disable attachments entirely (text-only composer).
218
+ */
219
+ attachments?: boolean;
220
+ }
221
+ /**
222
+ * Imperative handle exposed via `ref` for parents that want to forward
223
+ * dropped files (drag-and-drop on the conversation pane, paste from
224
+ * clipboard, etc.) into the composer's upload queue.
225
+ */
226
+ interface MessageComposerHandle {
227
+ /** Enqueue files to upload + attach to the next send. No-op when `attachments={false}`. */
228
+ addFiles: (files: File[]) => void;
211
229
  }
212
230
  /**
213
- * Single-line composer with Enter-to-send (Shift+Enter = newline).
214
- * Disables while the send is in flight so duplicate submits are
215
- * impossible from the UI side (the SDK also dedupes via Idempotency-Key).
231
+ * Composer with Enter-to-send (Shift+Enter = newline), smart list
232
+ * continuation, optional reply chip, and built-in attachment support:
233
+ * a paperclip picker, a queue strip of in-flight uploads with progress
234
+ * and cancel, and "send body + attachments together" semantics.
235
+ *
236
+ * Disables submit while sends are in flight OR while any attachment is
237
+ * still uploading — the server-side `Idempotency-Key` handles the rare
238
+ * race the UI doesn't catch.
216
239
  */
217
- declare function MessageComposer({ onSend, onTyping, placeholder, disabled, replyingTo, onCancelReply, labelFor, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
240
+ declare const MessageComposer: react.ForwardRefExoticComponent<MessageComposerProps & react.RefAttributes<MessageComposerHandle>>;
218
241
 
219
242
  interface MessageActionsProps {
220
243
  /** Triggered when the user picks an emoji. */
@@ -445,8 +468,14 @@ interface MentionInputProps {
445
468
  replyingTo?: Message | null;
446
469
  /** User clicked the (x) on the reply chip. Caller clears state. */
447
470
  onCancelReply?: () => void;
471
+ /**
472
+ * Same as `<MessageComposer attachments>`: enables the paperclip
473
+ * button + queue strip + ref-exposed `addFiles` for drag-drop.
474
+ * Defaults to `true`.
475
+ */
476
+ attachments?: boolean;
448
477
  }
449
- declare function MentionInput({ conversationId, onSend, onTyping, placeholder, disabled, labelFor, replyingTo, onCancelReply, }: MentionInputProps): react_jsx_runtime.JSX.Element;
478
+ declare const MentionInput: react.ForwardRefExoticComponent<MentionInputProps & react.RefAttributes<MessageComposerHandle>>;
450
479
 
451
480
  declare const ICONS: {
452
481
  readonly attachment: {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Uuid, Message, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
3
+ import * as react from 'react';
3
4
  import { ReactNode, SVGProps, ReactElement } from 'react';
4
5
  import { UploadItem, ReactionMap } from '@poolse/react';
5
6
 
@@ -185,12 +186,14 @@ declare function EditableMessageBubble({ message, currentUserId, readState, edit
185
186
  interface MessageComposerProps {
186
187
  /**
187
188
  * Called when the user submits a message. Second arg carries
188
- * optional metadata (currently just `quoted_message_id` when the
189
- * caller has wired a `replyingTo`). Return value is awaited so the
190
- * input can disable until send completes.
189
+ * optional metadata: `quoted_message_id` when replying, and
190
+ * `attachment_ids` (resolved from the composer's upload queue) when
191
+ * files were attached. Return value is awaited so the composer can
192
+ * stay disabled until send completes.
191
193
  */
192
194
  onSend: (body: string, opts?: {
193
195
  quoted_message_id?: Uuid;
196
+ attachment_ids?: Uuid[];
194
197
  }) => Promise<unknown> | void;
195
198
  /** Called on every keystroke. Hook this to `useTyping().signalTyping`. */
196
199
  onTyping?: () => void;
@@ -208,13 +211,33 @@ interface MessageComposerProps {
208
211
  onCancelReply?: () => void;
209
212
  /** Friendly display label for the quoted sender. Defaults to user id slice. */
210
213
  labelFor?: (userId: Uuid) => string;
214
+ /**
215
+ * Show the paperclip + queue strip + accept dropped files via
216
+ * `ref.current.addFiles(files)`. Default `true`. Set `false` to
217
+ * disable attachments entirely (text-only composer).
218
+ */
219
+ attachments?: boolean;
220
+ }
221
+ /**
222
+ * Imperative handle exposed via `ref` for parents that want to forward
223
+ * dropped files (drag-and-drop on the conversation pane, paste from
224
+ * clipboard, etc.) into the composer's upload queue.
225
+ */
226
+ interface MessageComposerHandle {
227
+ /** Enqueue files to upload + attach to the next send. No-op when `attachments={false}`. */
228
+ addFiles: (files: File[]) => void;
211
229
  }
212
230
  /**
213
- * Single-line composer with Enter-to-send (Shift+Enter = newline).
214
- * Disables while the send is in flight so duplicate submits are
215
- * impossible from the UI side (the SDK also dedupes via Idempotency-Key).
231
+ * Composer with Enter-to-send (Shift+Enter = newline), smart list
232
+ * continuation, optional reply chip, and built-in attachment support:
233
+ * a paperclip picker, a queue strip of in-flight uploads with progress
234
+ * and cancel, and "send body + attachments together" semantics.
235
+ *
236
+ * Disables submit while sends are in flight OR while any attachment is
237
+ * still uploading — the server-side `Idempotency-Key` handles the rare
238
+ * race the UI doesn't catch.
216
239
  */
217
- declare function MessageComposer({ onSend, onTyping, placeholder, disabled, replyingTo, onCancelReply, labelFor, }: MessageComposerProps): react_jsx_runtime.JSX.Element;
240
+ declare const MessageComposer: react.ForwardRefExoticComponent<MessageComposerProps & react.RefAttributes<MessageComposerHandle>>;
218
241
 
219
242
  interface MessageActionsProps {
220
243
  /** Triggered when the user picks an emoji. */
@@ -445,8 +468,14 @@ interface MentionInputProps {
445
468
  replyingTo?: Message | null;
446
469
  /** User clicked the (x) on the reply chip. Caller clears state. */
447
470
  onCancelReply?: () => void;
471
+ /**
472
+ * Same as `<MessageComposer attachments>`: enables the paperclip
473
+ * button + queue strip + ref-exposed `addFiles` for drag-drop.
474
+ * Defaults to `true`.
475
+ */
476
+ attachments?: boolean;
448
477
  }
449
- declare function MentionInput({ conversationId, onSend, onTyping, placeholder, disabled, labelFor, replyingTo, onCancelReply, }: MentionInputProps): react_jsx_runtime.JSX.Element;
478
+ declare const MentionInput: react.ForwardRefExoticComponent<MentionInputProps & react.RefAttributes<MessageComposerHandle>>;
450
479
 
451
480
  declare const ICONS: {
452
481
  readonly attachment: {