@ui-schema/kit-dnd
Version:
Drag and Drop Tools for (not only) UI-Schema
11 lines (10 loc) • 918 B
TypeScript
import React from 'react';
import { ItemSpec, OnMovedEvent } from '@ui-schema/kit-dnd/KitDnd';
export type onMovedType<C extends HTMLElement = HTMLElement, S extends ItemSpec = ItemSpec, E extends OnMovedEvent<C, S> = OnMovedEvent<C, S>> = (details: E) => void;
export interface KitDndProviderContextType<C extends HTMLElement = HTMLElement, S extends ItemSpec = ItemSpec> {
onMove: onMovedType<C, S>;
scope?: string;
}
export declare const KitDndProviderContext: React.Context<KitDndProviderContextType<HTMLElement, ItemSpec>>;
export declare const useKitDnd: <C extends HTMLElement = HTMLElement>() => KitDndProviderContextType<C, ItemSpec>;
export declare const KitDndProvider: <C extends HTMLElement = HTMLElement, S extends ItemSpec = ItemSpec, CX extends KitDndProviderContextType<C, S> = KitDndProviderContextType<C, S>>({ children, onMove, scope, }: React.PropsWithChildren<CX>) => React.ReactElement;