import * as React from 'react'; import { type HandlerManager, type ConnectDragSource, type ConnectDropTarget, type ConnectDragPreview } from 'react-dnd'; import { type UseKeyboardDragAndDropCallbacks } from './useKeyboardDragAndDrop'; import type { Data } from '@strapi/types'; declare const DIRECTIONS: { readonly UPWARD: "upward"; readonly DOWNWARD: "downward"; }; declare const DROP_SENSITIVITY: { readonly REGULAR: "regular"; readonly IMMEDIATE: "immediate"; }; interface UseDragAndDropOptions = number, TItem extends { index: TIndex; } = { index: TIndex; }> extends UseKeyboardDragAndDropCallbacks { type?: string; index: TIndex; item?: TItem; onStart?: () => void; onEnd?: () => void; dropSensitivity?: (typeof DROP_SENSITIVITY)[keyof typeof DROP_SENSITIVITY]; } type Identifier = ReturnType; type UseDragAndDropReturn = [ props: { handlerId: Identifier; isDragging: boolean; handleKeyDown: (event: React.KeyboardEvent) => void; isOverDropTarget: boolean; direction: (typeof DIRECTIONS)[keyof typeof DIRECTIONS] | null; }, objectRef: React.RefObject, dropRef: ConnectDropTarget, dragRef: ConnectDragSource, dragPreviewRef: ConnectDragPreview ]; /** * A utility hook abstracting the general drag and drop hooks from react-dnd. * Centralising the same behaviours and by default offering keyboard support. */ declare const useDragAndDrop: (active: boolean, { type, index, item, onStart, onEnd, onGrabItem, onDropItem, onCancel, onMoveItem, dropSensitivity, }: UseDragAndDropOptions) => UseDragAndDropReturn; export { useDragAndDrop, UseDragAndDropReturn, UseDragAndDropOptions, DIRECTIONS, DROP_SENSITIVITY, };