import { DraggableCollectionOptions, DraggableItemProps, DraggableItemResult, DragPreview } from 'react-aria/useDraggableCollection'; import { DraggableCollectionProps, DragItem, DroppableCollectionProps, Key, RefObject } from '@react-types/shared'; import { DraggableCollectionState, DraggableCollectionStateOptions } from 'react-stately/useDraggableCollectionState'; import { DropIndicatorAria, DropIndicatorProps, DroppableCollectionOptions, DroppableCollectionResult, DroppableItemOptions, DroppableItemResult } from 'react-aria/useDroppableCollection'; import { DroppableCollectionState, DroppableCollectionStateOptions } from 'react-stately/useDroppableCollectionState'; import { JSX } from 'react'; interface DraggableCollectionStateOpts extends Omit, 'getItems'> { } interface DragHooks { useDraggableCollectionState?: (props: DraggableCollectionStateOpts) => DraggableCollectionState; useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject) => void; useDraggableItem?: (props: DraggableItemProps, state: DraggableCollectionState) => DraggableItemResult; DragPreview?: typeof DragPreview; } interface DropHooks { useDroppableCollectionState?: (props: DroppableCollectionStateOptions) => DroppableCollectionState; useDroppableCollection?: (props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject) => DroppableCollectionResult; useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject) => DroppableItemResult; useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject) => DropIndicatorAria; } export interface DragAndDropHooks { /** Drag and drop hooks for the collection element. */ dragAndDropHooks: DragHooks & DropHooks & { isVirtualDragging?: () => boolean; renderPreview?: (keys: Set, draggedKey: Key) => JSX.Element; }; } export interface DragAndDropOptions extends Omit, Omit { /** * A function that returns the items being dragged. If not specified, we assume that the * collection is not draggable. * * @default () => [] */ getItems?: (keys: Set, items: T[]) => DragItem[]; /** * Provide a custom drag preview. `draggedKey` represents the key of the item the user actually * dragged. */ renderPreview?: (keys: Set, draggedKey: Key) => JSX.Element; } /** * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible React * Spectrum component. */ export declare function useDragAndDrop(options: DragAndDropOptions): DragAndDropHooks; export {};