export interface UseSwipeDismissOptions { /** Called once the swipe commits (past the threshold) — after the exit transition finishes, * not the instant the pointer is released, unless `animateExit` is `false`. */ onDismiss: () => void; /** Which axis the drag tracks (default `'x'`, the natural direction for a toast/notification). */ axis?: 'x' | 'y'; /** Distance in px past which releasing counts as a commit, regardless of speed (default `80`). */ distanceThreshold?: number; /** Speed in px/ms past which releasing counts as a commit, regardless of distance (default `0.5`) — * lets a fast flick dismiss even if the pointer didn't travel very far. */ velocityThreshold?: number; /** Disables the gesture entirely — no listeners are attached. */ disabled?: boolean; /** The offset in px as it changes: on every move, then `0` as it springs back or the exit offset * once it commits. For something else that follows the drag, such as a fading backdrop. */ onDrag?: (offset: number) => void; /** Restricts the gesture to coarse (touch) pointers, auto-detected via `matchMedia`. On a * mouse/trackpad device a drag is more likely to be a text selection than an intentional * dismiss, and other affordances (a close button, auto-dismiss) typically already cover that * case. Default `true`; set `false` to allow the gesture on any pointer type. */ mobileOnly?: boolean; /** Fades the element out as it is dragged (default `true`). */ fade?: boolean; /** Slides the element off before calling `onDismiss` (default `true`). `false` calls it the moment * the swipe commits and leaves the element where it was let go, for a caller that animates the * exit itself. */ animateExit?: boolean; } export interface UseSwipeDismissResult { /** Attach to the element that should become draggable. The hook wires up its own pointer * listeners on this node directly (no handlers to spread), so this is the only thing to attach. * * A callback ref rather than an object one, because the hook has to know when the node changes: * an element that is unmounted and rendered again is a *different* node, and a ref object cannot * say so. To keep a ref of your own on the element, call both from one callback. */ ref: React.RefCallback; /** True for the duration of an active drag — e.g. use it to pause an auto-dismiss timer. */ isDragging: boolean; } /** * Drag-to-dismiss on any pointer type (touch, mouse, pen) via the Pointer Events API. Applies the * drag offset and a fading opacity directly to the DOM node (bypassing React state) so the visual * tracks the pointer at native speed, then either springs back or animates fully off-screen and * calls `onDismiss` once that exit transition completes. */ export declare function useSwipeDismiss({ onDismiss, axis, distanceThreshold, velocityThreshold, disabled, mobileOnly, fade, animateExit, onDrag, }: UseSwipeDismissOptions): UseSwipeDismissResult;