UNPKG

@react-querybuilder/dnd

Version:

Drag-and-drop-enabled version of react-querybuilder (DnD-library-agnostic)

44 lines (43 loc) 1.35 kB
import { i as DndAdapter } from "./adapter-yV-BV3RZ.js"; import { DndContext, KeyboardSensor, PointerSensor, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core"; //#region src/adapters/dnd-kit.d.ts /** * The `@dnd-kit/core` exports needed by the adapter. * * @group DnD */ type DndKitExports = { DndContext: typeof DndContext; useDraggable: typeof useDraggable; useDroppable: typeof useDroppable; PointerSensor: typeof PointerSensor; KeyboardSensor: typeof KeyboardSensor; useSensor: typeof useSensor; useSensors: typeof useSensors; }; /** * Creates a {@link DndAdapter} backed by `@dnd-kit/core`. * * The adapter uses `setActivatorNodeRef` for drag handles, so sensor listeners * are automatically attached to the correct element without imperative DOM * manipulation. * * @example * ```tsx * import { QueryBuilderDnD } from '@react-querybuilder/dnd'; * import { createDndKitAdapter } from '@react-querybuilder/dnd/dnd-kit'; * import * as DndKit from '@dnd-kit/core'; * * const adapter = createDndKitAdapter(DndKit); * * <QueryBuilderDnD dnd={adapter}> * <QueryBuilder /> * </QueryBuilderDnD> * ``` * * @group DnD */ declare const createDndKitAdapter: (dndKitExports: DndKitExports) => DndAdapter; //#endregion export { createDndKitAdapter as n, DndKitExports as t }; //# sourceMappingURL=dnd-kit-B9zlr1ox.d.ts.map