import { ScrollContainer, ScrollDirection, UseScrollContextReturn } from '../types'; /** * Hook to access scroll container context and utilities. * * @remarks * This hook provides information about the nearest scroll container * and utilities for programmatic scrolling. * * @returns Scroll container state and control functions * * @example * ```tsx * function ScrollableContent() { * const { * scrollContainer, * isInScrollContainer, * scrollTo, * scrollBy, * scrollDirection, * scrollProgress, * } = useScrollContext(); * * return ( *
* {isInScrollContainer && ( * <> *

Scroll progress: {(scrollProgress.y * 100).toFixed(0)}%

* * * )} *
* ); * } * ``` */ export declare function useScrollContext(): UseScrollContextReturn; /** * Hook to find and track a specific scroll container. * * @param containerRef - Ref to the scroll container element * @returns Scroll container state * * @example * ```tsx * function CustomScrollContainer() { * const containerRef = useRef(null); * const scrollState = useScrollContainer(containerRef); * * return ( *
*

Position: {scrollState?.scrollPosition.y}px

* {children} *
* ); * } * ``` */ export declare function useScrollContainer(containerRef: { readonly current: HTMLElement | null; }): ScrollContainer | null; /** * Hook to get scroll direction. * * @returns Current scroll direction * * @example * ```tsx * function DirectionalHeader() { * const direction = useScrollDirection(); * * return ( *
* Header content *
* ); * } * ``` */ export declare function useScrollDirection(): ScrollDirection; /** * Hook to get scroll progress (0-1). * * @returns Scroll progress for x and y axes * * @example * ```tsx * function ProgressIndicator() { * const progress = useScrollProgress(); * * return ( *
* ); * } * ``` */ export declare function useScrollProgress(): { x: number; y: number; }; /** * Hook to detect if scrolling is currently happening. * * @returns Whether currently scrolling * * @example * ```tsx * function ScrollingIndicator() { * const isScrolling = useIsScrolling(); * * return ( *
* Content *
* ); * } * ``` */ export declare function useIsScrolling(): boolean; /** * Hook to detect if scroll has reached edges. * * @returns Edge states * * @example * ```tsx * function InfiniteScroll() { * const { atBottom } = useScrollEdges(); * * useEffect(() => { * if (atBottom) { * loadMoreItems(); * } * }, [atBottom]); * * return ; * } * ``` */ export declare function useScrollEdges(): { atTop: boolean; atBottom: boolean; atLeft: boolean; atRight: boolean; }; /** * Hook to get scroll position. * * @returns Scroll x and y positions * * @example * ```tsx * function ScrollDisplay() { * const { x, y } = useScrollPosition(); * * return Scroll: {x}, {y}; * } * ``` */ export declare function useScrollPosition(): { x: number; y: number; }; /** * Hook to get scroll velocity (for momentum detection). * * @returns Velocity in px/s for x and y axes * * @example * ```tsx * function MomentumIndicator() { * const velocity = useScrollVelocity(); * const isFastScroll = Math.abs(velocity.y) > 1000; * * return ( *
* Content *
* ); * } * ``` */ export declare function useScrollVelocity(): { x: number; y: number; }; /** * Hook to get scroll-to-top functionality. * * @returns Scroll to top function and whether at top * * @example * ```tsx * function BackToTop() { * const { scrollToTop, isAtTop } = useScrollToTop(); * * if (isAtTop) return null; * * return ; * } * ``` */ export declare function useScrollToTop(): { scrollToTop: (behavior?: 'auto' | 'smooth') => void; isAtTop: boolean; }; /** * Hook to get scroll-to-bottom functionality. * * @returns Scroll to bottom function and whether at bottom * * @example * ```tsx * function ChatContainer() { * const { scrollToBottom, isAtBottom } = useScrollToBottom(); * * // Auto-scroll on new messages if already at bottom * useEffect(() => { * if (isAtBottom) { * scrollToBottom(); * } * }, [messages]); * * return ; * } * ``` */ export declare function useScrollToBottom(): { scrollToBottom: (behavior?: 'auto' | 'smooth') => void; isAtBottom: boolean; }; /** * Hook to scroll a specific element into view within the container. * * @returns Function to scroll element into view * * @example * ```tsx * function ListWithFocus() { * const scrollIntoView = useScrollIntoView(); * const [activeId, setActiveId] = useState(null); * * const handleSelect = (id) => { * setActiveId(id); * const element = document.getElementById(id); * if (element) { * scrollIntoView(element); * } * }; * * return ; * } * ``` */ export declare function useScrollIntoView(): (element: Element, options?: ScrollIntoViewOptions) => void;