drizzle-cube
Version:
Drizzle ORM-first semantic layer with Cube.js compatibility. Type-safe analytics and dashboards with SQL injection protection.
28 lines (27 loc) • 948 B
TypeScript
import { RefObject } from 'react';
interface UseScrollDetectionOptions {
/** Scroll threshold in pixels (default: 20) */
threshold?: number;
/** Debounce delay in milliseconds (default: 150) */
debounceMs?: number;
}
/**
* Hook to detect scroll position in a container
*
* @param containerRef - Ref to the scrollable container element
* @param options - Configuration options for threshold and debounce
* @returns Boolean indicating if scrolled past threshold
*
* @example
* const scrollContainerRef = useRef<HTMLDivElement>(null)
* const isScrolled = useScrollDetection(scrollContainerRef, {
* threshold: 20,
* debounceMs: 150
* })
*
* <div ref={scrollContainerRef} className="overflow-y-auto">
* {isScrolled && <div>Shadow visible</div>}
* </div>
*/
export declare function useScrollDetection(containerRef: RefObject<HTMLElement>, { threshold, debounceMs }?: UseScrollDetectionOptions): boolean;
export {};