import { FC, PropsWithChildren, Ref } from 'react'; import { SnapScrollerProps } from '../SnapScroller'; import { IndexedSnapScrollerApiRef } from './types'; export interface IndexedSnapScrollerProps extends SnapScrollerProps { /** * Starting index used to generate the initial sequence of pages. * Acts as the logical origin for the sliding index window. * * @default -2 */ start?: number; /** * Direction in which the initial index sequence expands. * - `1` — indexes increase to the right (0, 1, 2…) * - `-1` — indexes decrease to the right (0, -1, -2…) * * Controls the growth pattern of the initial index array. * * @default 1 */ startDir?: -1 | 1; /** * Number of index segments rendered at once. * Defines the size of the virtual “window” that the scroller * slides over when navigating left or right. * * @default 5 */ size?: number; /** * Number of index units to shift when reaching scroll boundaries. * - When `onOffset` yields `-1`, the window shifts backward. * - When `onOffset` yields `1`, the window shifts forward. * * Used to dynamically prepend or append pages based on scroll. * * @default 2 */ shift?: number; /** * Controls the currently active logical index. * * When provided, the scroller keeps the given index in view, * scrolling to it if possible or rebuilding the window if needed. */ index?: number; /** * Preserve the currently snapped item after content changes * (e.g., when pages are prepended/appended). If `true`, the scroller will * restore the same snapped index using an immediate `scrollIntoView`. * * @default true */ preserveScroll?: boolean; /** * Exposes the imperative API of the scroller. * * Allows programmatic control such as scrolling to an index * or resetting the virtual window. */ apiRef?: Ref; /** * Fires when the scroll position reaches the start or the end of the content. * - `-1` — reached the start (left/top edge) * - `+1` — reached the end (right/bottom edge) * * Useful for infinite loading: append/prepend pages based on the direction. */ onOffset?(value: number): void; } /** * IndexedSnapScroller extends `SnapScroller` with virtualized, * index-based paging. It maintains a sliding window of page indexes * and automatically shifts the window when the user scrolls to the * start or end of the snap area. Each rendered child is wrapped in an * `IndexedSnapScrollerContext` with its corresponding index, allowing * dynamic page generation based on the current virtual index. */ export declare const IndexedSnapScroller: FC>;