@@ -32,21 +32,16 @@ export const useDragAndDropUploadContext = () => useContext(DragAndDropUploadCon
3232/**
3333 * @private To maintain top -> bottom data flow, the drag-and-drop functionality allows dragging any files to the queue - the closest
3434 * `MessageInputProvider` will be notified through `DragAndDropUploadContext.fileQueue` and starts the upload with `uploadNewAttachments`,
35- * forwarded files are immediately after removed from the queue.
35+ * forwarded files are removed from the queue immediately after .
3636 */
3737export const useHandleDragAndDropQueuedFiles = ( {
3838 uploadNewFiles,
3939} : MessageInputContextValue ) => {
4040 const { fileQueue, removeFilesFromQueue } = useDragAndDropUploadContext ( ) ;
4141
42- // const uploadNewFilesReference = useRef<((f: File[]) => void) | undefined>(undefined);
43-
44- // uploadNewFilesReference.current = (f) => messageInputContextValue.uploadNewFiles(f);
45-
4642 useEffect ( ( ) => {
4743 if ( ! removeFilesFromQueue ) return ;
4844
49- // uploadNewFilesReference.current?.(fileQueue);
5045 uploadNewFiles ( fileQueue ) ;
5146
5247 removeFilesFromQueue ( fileQueue ) ;
@@ -59,7 +54,7 @@ export const useHandleDragAndDropQueuedFiles = ({
5954 * @example
6055 * ```tsx
6156 * <Channel>
62- * <WithDragAndDropUpload as ="section" className="message-list-dnd-wrapper">
57+ * <WithDragAndDropUpload component ="section" className="message-list-dnd-wrapper">
6358 * <Window>
6459 * <MessageList />
6560 * <MessageInput />
@@ -70,12 +65,16 @@ export const useHandleDragAndDropQueuedFiles = ({
7065 * ```
7166 */
7267export const WithDragAndDropUpload = ( {
73- as : Component = 'div' ,
7468 children,
7569 className,
70+ component : Component = 'div' ,
7671 style,
7772} : PropsWithChildren < {
78- as ?: ElementType ;
73+ /**
74+ * @description An element to render as a wrapper onto which drag & drop functionality will be applied.
75+ * @default 'div'
76+ */
77+ component ?: ElementType ;
7978 className ?: string ;
8079 style ?: CSSProperties ;
8180} > ) => {
@@ -110,6 +109,8 @@ export const WithDragAndDropUpload = ({
110109
111110 const { getRootProps, isDragActive, isDragReject } = useDropzone ( {
112111 accept,
112+ // apply `disabled` rules if available, otherwise allow anything and
113+ // let the `uploadNewFiles` handle the limitations internally
113114 disabled : isWithinMessageInputContext
114115 ? ! messageInputContext . isUploadEnabled || messageInputContext . maxFilesLeft === 0
115116 : false ,
0 commit comments