import type { Pausable } from "../use-pausable/index.cjs"; import type { ElementTarget } from "../use-target-element/index.cjs"; export type Directions = { left: boolean; right: boolean; top: boolean; bottom: boolean; }; export type ArrivedState = Directions; export type Insets = { [K in keyof Directions]?: number; }; export type UseScrollOptionsOffset = Insets; export interface UseScrollOptions { /** * The throttle time (ms) to update the scroll position */ throttle?: number; /** * The idle time (ms) to determine the scroll is stopped */ idle?: number; /** * The offset to determine the scroll has arrived at the edge */ offset?: UseScrollOptionsOffset; /** * The scroll event handler */ onScroll?: (event: Event) => void; /** * The scroll stop event handler */ onStop?: (event: Event) => void; /** * The event listener options */ eventListenerOptions?: boolean | AddEventListenerOptions; /** * The scroll behavior */ behavior?: ScrollBehavior; /** * Whether to trigger the first load immediately */ immediate?: boolean; } export interface UseScrollReturns extends Pausable { /** * scroll x position */ x: number; /** * scroll y position */ y: number; /** * The scroll position */ position: { x: number; y: number; }; /** * The scroll directions */ directions: Directions; /** * Whether the scroll is scrolling */ isScrolling: boolean; /** * The arrived state */ arrivedState: ArrivedState; /** * Scroll to the specified position */ scrollTo: (x: number, y: number) => void; /** * Scroll to the end of the specified direction */ scrollToEnd: (direction: 'x' | 'y') => void; /** * Measure the scroll position */ measure(): void; } /** * A React Hook that track the scroll state of target element. */ export declare function useScroll(target: ElementTarget, options?: UseScrollOptions): UseScrollReturns;