@syncfusion/react-base
Version:
A common package of core React base, methods and class definitions
64 lines (63 loc) • 2.12 kB
TypeScript
import { ReactNode, RefObject } from 'react';
import { IDroppable } from './droppable';
/**
* Interface defining the methods available in the DragDropContext.
*
* @private
*/
export interface DragDropContextProps {
/**
* Registers a droppable instance with a unique identifier.
*
* @param {string} id - The unique identifier for the droppable instance
* @param {DragDropContext} instance - The droppable instance to register
* @returns {void}
*/
registerDroppable: (id: string, instance: DroppableContext) => void;
/**
* Unregisters a droppable instance by its identifier.
*
* @param {string} id - The unique identifier of the droppable instance to unregister
* @returns {void}
*/
unregisterDroppable: (id: string) => void;
/**
* Retrieves all registered droppable instances.
*
* @returns {Record<string, DragDropContext>} A record of all droppable instances indexed by their identifiers
*/
getAllDroppables: () => Record<string, DroppableContext>;
}
/**
* Interface defining the Droppable instance reference with element.
*
* @private
*/
export interface DroppableContext extends IDroppable {
element?: RefObject<HTMLElement>;
}
/**
* Custom hook that provides access to the droppable context functionality.
*
* @private
* @returns {DragDropContextProps} The droppable context methods and state
*/
export declare const useDragDropContext: () => DragDropContextProps | undefined;
/**
* Props for the DragDrop component.
*/
interface DragDropProps {
/**
* The child components that will have access to the droppable context.
*/
children: ReactNode;
}
/**
* Provider component that manages droppable instances throughout the application, provides registration and retrieval methods for droppable elements.
*
* @param {DragDropProps} props - The component props
* @param {ReactNode} props.children - The child elements to render within the provider
* @returns {Element} The rendered DragDrop provider component
*/
export declare const DragDrop: React.FC<DragDropProps>;
export {};