import { default as React } from 'react'; type IndicatorType = 'icon' | 'shadow'; type IndicatorProps = { show?: boolean; className?: string; type?: IndicatorType; behavior?: 'scroll-on-click' | 'scroll-on-hover' | 'none'; hoverDelay?: number; }; export interface IndicatorsProps { top?: IndicatorProps; bottom?: IndicatorProps; left?: IndicatorProps; right?: IndicatorProps; } type scrollableAxis = "x" | "y" | "both"; type ScrollbarProps = { hide?: boolean; size?: "small" | 'medium'; }; export interface ScrollTargetData { percentage: number; direction: 'up' | 'down' | 'left' | 'right'; scrollTop: number; scrollLeft: number; scrollHeight: number; scrollWidth: number; clientHeight: number; clientWidth: number; metadata?: Record; } export interface ScrollTargetConfig { target: number; direction?: 'x' | 'y' | 'both'; trip?: 'forth' | 'back' | 'round-trip'; cooldown?: number; } export interface HyperextensionConfig { threshold?: number; direction?: 'up' | 'down' | 'both'; trip?: 'forth' | 'back' | 'round-trip'; cooldown?: number; } /** Latest `scrollMetadata` from Scrollable props is passed on each hyperextension callback invocation. */ export type HyperextensionListenerCallback = (direction: 'up' | 'down', amount?: number, scrollMetadata?: Record) => void; export interface ScrollableControlsHandler { subscribeToScrollTarget: (callback: (data: ScrollTargetData) => void, config?: ScrollTargetConfig) => () => void; subscribeToHyperextension: (callback: HyperextensionListenerCallback, config?: HyperextensionConfig) => () => void; /** Scrolls the base snap container out of overscroll (e.g. after a successful pull-to-load). */ releaseHyperextensionOverscroll?: (options?: { behavior?: ScrollBehavior; }) => void; } type ScrollTopButtonTarget = string; type ScrollTopButtonProps = { target?: ScrollTopButtonTarget; icon?: React.ComponentType<{ size?: number; className?: string; }>; className?: string; tabIndex?: number; }; export interface ScrollableProps { debugMode?: boolean; className?: string; contentClassName?: string; indicators?: IndicatorsProps; axis?: scrollableAxis; children?: React.ReactNode; scrollbarProps?: ScrollbarProps; disableMouseScroll?: boolean; defaultBehavior?: 'scroll-on-click' | 'scroll-on-hover' | 'none'; persistScroll?: boolean | string; controls?: React.RefObject; scrollTopButton?: ScrollTopButtonProps; scrollMetadata?: Record; speed?: number; } export interface ScrollableState { scrollableElement: HTMLDivElement | null; scrollableBaseElement: HTMLDivElement | null; indicatorRefs: Record; scrollTopButtonVisible: boolean; activePosition: keyof IndicatorsProps | null; continuousScrollStarted: boolean; clickToEndEnabled: Record; hoverScrollInterval: ReturnType | null; hoverDebounceTimeout: ReturnType | null; clickToEndTimeout: ReturnType | null; saveScrollTimeout: ReturnType | null; scrollKey: string | null; hasRestoredScroll: boolean; hasRendered: boolean; finalIndicators: IndicatorsProps; finalScrollbarProps: ScrollbarProps; /** True while scroll base is past overscroll threshold (listeners' min threshold); updates only on edges. */ hyperextensionActive: { up: boolean; down: boolean; }; } export interface ScrollableHandlers { subscribeToScrollTarget: (callback: (data: ScrollTargetData) => void, config?: ScrollTargetConfig) => () => void; subscribeToHyperextension: (callback: HyperextensionListenerCallback, config?: HyperextensionConfig) => () => void; scrollByAmount: (direction: 'top' | 'bottom' | 'left' | 'right', amount?: number, smooth?: boolean) => void; scrollToEnd: (direction: 'top' | 'bottom' | 'left' | 'right') => void; scrollToTop: () => void; /** Returns the scroll snap area toward its rest position so hyperextension listeners reset (e.g. trip forth). */ releaseHyperextensionOverscroll: (options?: { behavior?: ScrollBehavior; }) => void; handleIndicatorClick: (position: keyof IndicatorsProps, behavior?: IndicatorProps['behavior'], type?: IndicatorType) => void; handleIndicatorMouseEnter: (position: keyof IndicatorsProps, behavior?: IndicatorProps['behavior'], type?: IndicatorType) => void; handleIndicatorMouseLeave: (position: keyof IndicatorsProps, behavior?: IndicatorProps['behavior'], type?: IndicatorType) => void; handleIndicatorMouseDown: (position: keyof IndicatorsProps, behavior?: IndicatorProps['behavior'], type?: IndicatorType) => void; handleIndicatorMouseUp: (position: keyof IndicatorsProps, behavior?: IndicatorProps['behavior'], type?: IndicatorType) => void; handleIndicatorWheel: (e: React.WheelEvent) => void; setScrollableRef: (element: HTMLDivElement | null) => void; setScrollableBaseRef: (element: HTMLDivElement | null) => void; updateIndicatorsVisibility: () => void; } export interface UseScrollableReturn { state: ScrollableState; handlers: ScrollableHandlers; } export declare function useScrollable(props: ScrollableProps): UseScrollableReturn; export {};