import * as React from 'react'; import { DynamicVirtualizerContextProps } from '../Utilities'; export type VirtualizerMeasureProps = { defaultItemSize: number; direction?: 'vertical' | 'horizontal'; /** * Override recommended number of buffer items */ bufferItems?: number; /** * Override recommended buffer size (px) */ bufferSize?: number; }; export type VirtualizerMeasureDynamicProps = { defaultItemSize: number; virtualizerContext: DynamicVirtualizerContextProps; numItems: number; getItemSize: (index: number) => number; direction?: 'vertical' | 'horizontal'; gap?: number; /** * Override recommended number of buffer items */ bufferItems?: number; /** * Override recommended buffer size (px) */ bufferSize?: number; }; export type VirtualizerStaticPaginationProps = { itemSize: number; axis?: 'vertical' | 'horizontal'; }; /** * Props to be passed into dynamic virtualization hooks * All props can be acquired from useVirtualizer hooks themselves and passed in */ export type VirtualizerDynamicPaginationProps = { /** * An array that tracks the sizing of each item in virtualizer cumulatively */ progressiveItemSizes: React.RefObject | undefined; /** * An array that tracks the current size of each item * Should be up to date with any post-render changes via resizeObserver */ actualNodeSizes: React.RefObject; /** * The current starting index of the virtualizer's DOM elements */ currentIndex: number; /** * The axis we should paginate on (should match virtualizer's axis) */ axis?: 'vertical' | 'horizontal'; /** * The current length of Virtualizer's actual DOM elements */ virtualizerLength: number; }; /** * Additional direct Ref prevents reading old resize entry data * Backwards compatible with ResizeObserverCallback if preferred */ export interface ResizeCallbackWithRef { (entries: ResizeObserverEntry[], observer: ResizeObserver, scrollRef?: React.MutableRefObject): void; }