import * as React from 'react'; export type UnderlayParams = { /** How many items the content should cover. */ itemCount: number; /** The height of each item. */ itemHeight: number; }; export type UnderlayContent = { /** * Elements that scroll sideways with the items, laid out from the top of the first item and * the left edge of the scrolled content. They can span only part of the width, such as the * rendered items: a sideways scroll that moves the area past them rebuilds them. */ content: Node[]; /** * Elements that stay in place sideways, such as pinned columns, laid out from the top of * the first item and the left edge of the underlay element. */ pinned?: Node[]; }; export type UseScrollUnderlayParameters = { /** The element that scrolls. */ scrollerRef: React.RefObject; /** * The underlay element. Render it behind the scroller, over the area the items scroll in, * with `position: absolute` and `overflow: hidden`. */ underlayRef: React.RefObject; /** The height every item has. */ itemHeight: number; /** The number of items. The underlay is rebuilt when it changes. */ itemCount: number; /** * Whether the content is laid out right to left. * @default false */ isRtl?: boolean; /** * Returns the underlay's content: new elements, not in the page yet, that look like the * items, such as copies of rendered items. Called once a vertical scroll stops, and when a * sideways scroll moves the area past the content. * @param {UnderlayParams} params How many items the content should cover, and their height. * @returns {UnderlayContent | null} The underlay content, or `null` for none, for example while the items don't all have `itemHeight`. */ getUnderlayContent: (params: UnderlayParams) => UnderlayContent | null; }; export type UseScrollUnderlayReturnValue = { /** Rebuilds the underlay once any vertical scroll has stopped, for when the items changed. */ rebuild: () => void; }; /** * Keeps an underlay behind a list or grid: content that looks like the items, which shows * through the blank gaps a fast scroll can leave. * * During a fast scroll, the browser can show items before it has drawn them. This hook keeps * look-alike items behind the items, across the area they scroll in, and moves them with the * scroll, so those gaps show the underlay instead of blank space. * * To use it, render the element for `underlayRef` behind the scroller, and give the items an * opaque background: the underlay is behind them at all times. Browsers without scroll-driven * animations get no underlay. */ export declare function useScrollUnderlay(parameters: UseScrollUnderlayParameters): UseScrollUnderlayReturnValue;