import { useCallback, useMemo, useState } from "react";
export function useDrag(props) {
    const { node } = props;
    const [isDragging, setIsDragging] = useState(false);
    const onDragStart = useCallback((event) => {
        event.dataTransfer.setData("UI_NODE", JSON.stringify(node));
    }, [node]);
    const onDragEnd = useCallback(() => {
        setIsDragging(false);
    }, []);
    return useMemo(() => {
        return {
            isDragging,
            dragProps: {
                draggable: true,
                onDragStart,
                onDragEnd,
            },
        };
    }, [isDragging, onDragEnd, onDragStart]);
}
//# sourceMappingURL=use-drag.js.map