/** * SPDX-FileCopyrightText: (c) 2026 Liferay, Inc. https://liferay.com * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 */ import React from 'react'; import { MoveItemIndex } from './context'; import { Layout } from './useLayout'; export declare type DragAndDropMessages = { dragDescriptionKeyboard: string; dragItem: string; dragLayerPluralLabel: string; dragStartedKeyboard: string; dropCanceled: string; dropComplete: string; dropDescriptionKeyboard: string; dropIndicator: string; dropOn: string; endDragKeyboard: string; insertAfter: string; insertBefore: string; }; export declare type Value = { cursor: Array; indexes: Array; itemRef: React.RefObject; key: React.Key; nextKey?: React.Key; parentItemRef: React.RefObject; prevKey?: React.Key; [propName: string]: any; }; declare type ContextProps = { /** * Key of the item from which the drag interaction was initiated. * This is the item the user clicked to start dragging, even when * multiple items are selected. */ currentDrag: React.Key | null; /** * Set of keys representing all selected items being dragged together. * Includes the drag origin item and any other selected items. */ currentDragKeys: Set; currentTarget: React.Key | null; dragCancelDescribedBy: string; dragDescribedBy: string; dragDropDescribedBy: string; messages: DragAndDropMessages; onCancel: () => void; onClearPosition: () => void; onDragStart: (source: 'keyboard' | 'mouse', target: React.Key) => void; onDrop: () => void; onEnd: (status?: 'complete' | 'canceled' | null) => void; onPositionChange: (key: React.Key, position: Position) => void; position: Position | null; source: 'keyboard' | 'mouse' | null; }; declare type State = Pick & { lastItem: React.Key | null; status: 'complete' | 'canceled' | null; }; declare type Props = { children: React.ReactNode; messages?: DragAndDropMessages; mode: 'single' | 'multiple'; nestedKey: string; onItemHover?: (items: T | Set, parentItem: T, index: MoveItemIndex, position: Position) => boolean; onItemMove?: (items: T | Set, parentItem: T, index: MoveItemIndex) => boolean; rootRef: React.RefObject; }; export declare function removeDescendants(currentDragKeys: Set, layout: Layout): Set; export declare function isDescendantOfDraggedItems({ dragKeys, element, rootRef, }: { dragKeys: State['currentDragKeys']; element: Element; rootRef: React.RefObject; }): boolean; export declare function DragAndDropProvider({ children, messages, mode, nestedKey, onItemMove, onItemHover, rootRef, }: Props): React.JSX.Element; export declare const TARGET_POSITION: { readonly BOTTOM: "bottom"; readonly MIDDLE: "middle"; readonly TOP: "top"; }; declare type ValueOf = T[keyof T]; export declare type Position = ValueOf; export declare function getNewItemPath(path: Array, overPosition: Position): number[]; export declare function useDnD(): ContextProps; export {};