UNPKG

react-dragster

Version:

useDragster is a React hook designed to simplify drag and drop event handling by providing easy-to-use abstractions for drag enter, drag leave, and drop events. It also addresses common browser bugs related to these events, ensuring a smooth and reliable

46 lines (45 loc) 1.24 kB
/// <reference types="react" /> export interface DragsterOptions { /** * Should the hook prevent the default behavior of the events? * @alias preventDefault() * @default true */ preventDefault?: boolean; /** * Should the hook stop the propagation of the events? * @default true */ stopPropagation?: boolean; } interface DragsterProps { /** * The event that fires when a 'dragenter' event fires. * @param e React.DragEvent<any> * @returns any */ dragsterEnter?: (e: React.DragEvent<any>) => any; /** * The event that fires when a 'dragleave' event fires. * @param e React.DragEvent<any> * @returns any */ dragsterLeave?: (e: React.DragEvent<any>) => any; /** * The event that fires when a 'drop' event fires. * @param e React.DragEvent<any> * @returns any */ dragsterDrop?: (e: React.DragEvent<any>) => any; /** * Options to modify hook default behavior. */ options?: DragsterOptions; } /** * * @param props DragsterProps * @returns React.MutableRefObject<any> */ declare const useDragster: (props: DragsterProps) => import("react").MutableRefObject<any>; export default useDragster;