import React, { type CSSProperties, type ReactElement } from "react"; import { type ScrollDirection } from "react-window"; import { type VibeComponentProps } from "../../types"; import { type VirtualizedGridItemType as ItemType } from "./VirtualizedGrid.types"; export interface VirtualizedGridProps extends VibeComponentProps { /** * The list of items to be rendered in the grid. */ items: ItemType[]; /** * Function that renders each item in the grid. */ itemRenderer: (item: ItemType, index: number, style: CSSProperties) => ReactElement; /** * Function that returns the row height. */ getRowHeight: () => number; /** * Function that returns the column width. */ getColumnWidth: () => number; /** * Function that returns the unique ID of an item. */ getItemId?: (item: ItemType, index: number) => string; /** * The index of the item to scroll to. */ scrollToId?: number; /** * Callback fired when the grid is scrolled. */ onScroll?: (horizontalScrollDirection: ScrollDirection, scrollTop: number, scrollUpdateWasRequested: boolean) => void; /** * Callback fired when scrolling has finished. */ onScrollToFinished?: () => void; /** * Callback fired when items are rendered in the grid. */ onItemsRendered?: ({ firstItemId, secondItemId, lastItemId, centerItemId, firstItemOffsetEnd, currentOffsetTop }: { firstItemId: string; secondItemId: string; lastItemId: string; centerItemId: string; firstItemOffsetEnd: number; currentOffsetTop: number; }) => void; /** * The delay (in ms) for throttling the `onItemsRendered` callback. */ onItemsRenderedThrottleMs?: number; /** * Callback fired when the grid size is updated. */ onSizeUpdate?: (width: number, height: number) => void; /** * Callback fired when the vertical scrollbar visibility changes. */ onVerticalScrollbarVisiblityChange?: (value: boolean) => void; /** * Class name applied to the scrollable container. */ scrollableClassName?: string; } declare const VirtualizedGrid: React.ForwardRefExoticComponent>; export default VirtualizedGrid;