react-window 2.3.3 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -15
- package/dist/react-window.cjs +1 -1
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.d.ts +100 -32
- package/dist/react-window.js +777 -641
- package/dist/react-window.js.map +1 -1
- package/package.json +6 -3
package/dist/react-window.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-window.js","sources":["../lib/utils/isRtl.ts","../lib/core/useIsRtl.ts","../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/utils/parseNumericStyleValue.ts","../lib/hooks/useResizeObserver.ts","../lib/hooks/useStableCallback.ts","../lib/utils/getRTLOffsetType.ts","../lib/utils/adjustScrollOffsetForRtl.ts","../lib/utils/assert.ts","../lib/utils/shallowCompare.ts","../lib/core/getEstimatedSize.ts","../lib/core/getOffsetForIndex.ts","../lib/core/getStartStopIndices.ts","../lib/core/createCachedBounds.ts","../lib/core/useCachedBounds.ts","../lib/core/useItemSize.ts","../lib/core/useVirtualizer.ts","../lib/hooks/useMemoizedObject.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/components/list/isDynamicRowHeight.ts","../lib/components/list/useScrollToRow.ts","../lib/components/list/List.tsx","../lib/components/list/useDynamicRowHeight.ts","../lib/components/list/useListCallbackRef.ts","../lib/components/list/useListRef.ts","../lib/utils/getScrollbarSize.ts"],"sourcesContent":["export function isRtl(element: HTMLElement) {\n let currentElement: HTMLElement | null = element;\n while (currentElement) {\n if (currentElement.dir) {\n return currentElement.dir === \"rtl\";\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return false;\n}\n","import { useLayoutEffect, useState, type HTMLAttributes } from \"react\";\nimport { isRtl } from \"../utils/isRtl\";\n\nexport function useIsRtl(\n element: HTMLElement | null,\n dir: HTMLAttributes<HTMLElement>[\"dir\"]\n) {\n const [value, setValue] = useState(dir === \"rtl\");\n\n useLayoutEffect(() => {\n if (dir) {\n setValue(dir === \"rtl\");\n } else if (element) {\n setValue(isRtl(element));\n }\n }, [dir, element]);\n\n return value;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","import type { CSSProperties } from \"react\";\n\nexport function parseNumericStyleValue(\n value: CSSProperties[\"height\"]\n): number | undefined {\n if (value !== undefined) {\n switch (typeof value) {\n case \"number\": {\n return value;\n }\n case \"string\": {\n if (value.endsWith(\"px\")) {\n return parseFloat(value);\n }\n break;\n }\n }\n }\n}\n","import { useMemo, useState, type CSSProperties } from \"react\";\nimport { parseNumericStyleValue } from \"../utils/parseNumericStyleValue\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\nexport function useResizeObserver({\n box,\n defaultHeight,\n defaultWidth,\n disabled: disabledProp,\n element,\n mode,\n style\n}: {\n box?: ResizeObserverBoxOptions;\n defaultHeight?: number;\n defaultWidth?: number;\n disabled?: boolean;\n element: HTMLElement | null;\n mode?: \"only-height\" | \"only-width\";\n style: CSSProperties | undefined;\n}) {\n const { styleHeight, styleWidth } = useMemo(\n () => ({\n styleHeight: parseNumericStyleValue(style?.height),\n styleWidth: parseNumericStyleValue(style?.width)\n }),\n [style?.height, style?.width]\n );\n\n const [state, setState] = useState<{\n height: number | undefined;\n width: number | undefined;\n }>({\n height: defaultHeight,\n width: defaultWidth\n });\n\n const disabled =\n disabledProp ||\n (mode === \"only-height\" && styleHeight !== undefined) ||\n (mode === \"only-width\" && styleWidth !== undefined) ||\n (styleHeight !== undefined && styleWidth !== undefined);\n\n useIsomorphicLayoutEffect(() => {\n if (element === null || disabled) {\n return;\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { contentRect, target } = entry;\n if (element === target) {\n setState((prevState) => {\n if (\n prevState.height === contentRect.height &&\n prevState.width === contentRect.width\n ) {\n return prevState;\n }\n\n return {\n height: contentRect.height,\n width: contentRect.width\n };\n });\n }\n }\n });\n resizeObserver.observe(element, { box });\n\n return () => {\n resizeObserver?.unobserve(element);\n };\n }, [box, disabled, element, styleHeight, styleWidth]);\n\n return useMemo(\n () => ({\n height: styleHeight ?? state.height,\n width: styleWidth ?? state.width\n }),\n [state, styleHeight, styleWidth]\n );\n}\n","import { useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n// Forked from useEventCallback (usehooks-ts)\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: (...args: Args) => Return\n): (...args: Args) => Return;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined {\n const ref = useRef<typeof fn>(() => {\n // This error ensures components don't render with previous/stale function\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((...args: Args) => ref.current?.(...args), [ref]) as (\n ...args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = document.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (getRTLOffsetType()) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollOffset;\n }\n break;\n }\n }\n }\n }\n return scrollOffset;\n}\n","export function assert(\n expectedCondition: unknown,\n message: string = \"Assertion error\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","import { assert } from \"./assert\";\n\nexport function shallowCompare<Type extends object>(\n a: Type | undefined,\n b: Type | undefined\n) {\n if (a === b) {\n return true;\n }\n\n if (!!a !== !!b) {\n return false;\n }\n\n assert(a !== undefined);\n assert(b !== undefined);\n\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const key in a) {\n if (!Object.hasOwn(b, key) || !Object.is(b[key], a[key])) {\n return false;\n }\n }\n\n return true;\n}\n","import type { CachedBounds, SizeFunction } from \"./types\";\nimport { assert } from \"../utils/assert\";\n\nexport function getEstimatedSize<Props extends object>({\n cachedBounds,\n itemCount,\n itemSize\n}: {\n cachedBounds: CachedBounds;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n}) {\n if (itemCount === 0) {\n return 0;\n } else if (typeof itemSize === \"number\") {\n return itemCount * itemSize;\n } else {\n const bounds = cachedBounds.get(\n cachedBounds.size === 0 ? 0 : cachedBounds.size - 1\n );\n assert(bounds !== undefined, \"Unexpected bounds cache miss\");\n\n const averageItemSize =\n (bounds.scrollOffset + bounds.size) / cachedBounds.size;\n\n return itemCount * averageItemSize;\n }\n}\n","import type { Align } from \"../types\";\nimport { getEstimatedSize } from \"./getEstimatedSize\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function getOffsetForIndex<Props extends object>({\n align,\n cachedBounds,\n index,\n itemCount,\n itemSize,\n containerScrollOffset,\n containerSize\n}: {\n align: Align;\n cachedBounds: CachedBounds;\n index: number;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n containerScrollOffset: number;\n containerSize: number;\n}) {\n if (index < 0 || index >= itemCount) {\n throw RangeError(`Invalid index specified: ${index}`, {\n cause: `Index ${index} is not within the range of 0 - ${itemCount - 1}`\n });\n }\n\n // Populate the target bounds before estimating the total from cached sizes.\n const bounds = cachedBounds.get(index);\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const maxOffset = Math.max(\n 0,\n Math.min(estimatedTotalSize - containerSize, bounds.scrollOffset)\n );\n const minOffset = Math.max(\n 0,\n bounds.scrollOffset - containerSize + bounds.size\n );\n\n // Visibility depends on the row itself, not the estimated scroll extent.\n // For oversized rows, leave the offset alone when the row fills the viewport.\n const isVisible =\n bounds.size > containerSize\n ? containerScrollOffset >= bounds.scrollOffset &&\n containerScrollOffset <= minOffset\n : containerScrollOffset >= minOffset &&\n containerScrollOffset <= bounds.scrollOffset;\n\n if (align === \"smart\") {\n align = isVisible ? \"auto\" : \"center\";\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n return Math.max(\n 0,\n Math.min(\n estimatedTotalSize - containerSize,\n bounds.scrollOffset + bounds.size / 2 - containerSize / 2\n )\n );\n }\n case \"auto\":\n default: {\n if (isVisible) {\n return containerScrollOffset;\n } else if (containerScrollOffset < minOffset) {\n return minOffset;\n } else {\n return maxOffset;\n }\n }\n }\n}\n","import type { CachedBounds } from \"./types\";\n\nexport function getStartStopIndices({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n}: {\n cachedBounds: CachedBounds;\n containerScrollOffset: number;\n containerSize: number;\n itemCount: number;\n overscanCount: number;\n}): {\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n} {\n const maxIndex = itemCount - 1;\n\n if (itemCount === 0) {\n return {\n startIndexVisible: 0,\n stopIndexVisible: -1,\n startIndexOverscan: 0,\n stopIndexOverscan: -1\n };\n }\n\n let startIndexVisible: number;\n let stopIndexVisible: number;\n const { itemSize } = cachedBounds;\n\n if (itemSize !== undefined && itemSize > 0) {\n startIndexVisible = Math.max(\n 0,\n Math.min(maxIndex, Math.floor(containerScrollOffset / itemSize))\n );\n stopIndexVisible = Math.max(\n startIndexVisible,\n Math.min(\n maxIndex,\n Math.ceil((containerScrollOffset + containerSize) / itemSize) - 1\n )\n );\n } else {\n // Binary search the measured prefix\n let low = 0;\n let high = Math.min(maxIndex, Math.max(0, cachedBounds.size - 1));\n\n while (low < high) {\n const middle = Math.floor((low + high) / 2);\n const bounds = cachedBounds.get(middle);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n high = middle;\n } else {\n low = middle + 1;\n }\n }\n\n // Extend sequentially beyond the measured prefix to avoid evaluating item sizes past the viewport\n while (low < maxIndex) {\n const bounds = cachedBounds.get(low);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) break;\n low++;\n }\n\n startIndexVisible = low;\n stopIndexVisible = low;\n while (stopIndexVisible < maxIndex) {\n const bounds = cachedBounds.get(stopIndexVisible);\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n )\n break;\n stopIndexVisible++;\n }\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan: Math.max(0, startIndexVisible - overscanCount),\n stopIndexOverscan: Math.min(maxIndex, stopIndexVisible + overscanCount)\n };\n}\n","import { assert } from \"../utils/assert\";\nimport type { Bounds, CachedBounds, SizeFunction } from \"./types\";\n\nexport function createCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n const cache = new Map<number, Bounds>();\n\n return {\n itemSize: typeof itemSize === \"number\" ? itemSize : undefined,\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n if (typeof itemSize === \"number\") {\n assert(index >= 0, `Invalid index ${index}`);\n let bounds = cache.get(index);\n if (bounds === undefined) {\n bounds = { size: itemSize, scrollOffset: index * itemSize };\n cache.set(index, bounds);\n }\n return bounds;\n }\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n const size = itemSize(currentIndex, itemProps);\n\n if (currentIndex === 0) {\n cache.set(currentIndex, {\n size,\n scrollOffset: 0\n });\n } else {\n const previousRowBounds = cache.get(currentIndex - 1);\n assert(\n previousRowBounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n cache.set(currentIndex, {\n scrollOffset:\n previousRowBounds.scrollOffset + previousRowBounds.size,\n size\n });\n }\n }\n\n const bounds = cache.get(index);\n assert(\n bounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n return bounds;\n },\n set(index: number, bounds: Bounds) {\n cache.set(index, bounds);\n },\n get size() {\n return cache.size;\n }\n };\n}\n","import { useMemo } from \"react\";\nimport { createCachedBounds } from \"./createCachedBounds\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function useCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n return useMemo(\n () =>\n createCachedBounds({\n itemCount,\n itemProps,\n itemSize\n }),\n [itemCount, itemProps, itemSize]\n );\n}\n","import { assert } from \"../utils/assert\";\nimport type { SizeFunction } from \"./types\";\n\nexport function useItemSize<Props extends object>({\n containerSize,\n itemSize: itemSizeProp\n}: {\n containerSize: number;\n itemSize: number | string | SizeFunction<Props>;\n}) {\n let itemSize: number | SizeFunction<Props>;\n switch (typeof itemSizeProp) {\n case \"string\": {\n assert(\n itemSizeProp.endsWith(\"%\"),\n `Invalid item size: \"${itemSizeProp}\"; string values must be percentages (e.g. \"100%\")`\n );\n assert(\n containerSize !== undefined,\n \"Container size must be defined if a percentage item size is specified\"\n );\n\n itemSize = (containerSize * parseFloat(itemSizeProp)) / 100;\n break;\n }\n default: {\n itemSize = itemSizeProp;\n break;\n }\n }\n\n return itemSize;\n}\n","import {\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties\n} from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { adjustScrollOffsetForRtl } from \"../utils/adjustScrollOffsetForRtl\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\nimport { getEstimatedSize as getEstimatedSizeUtil } from \"./getEstimatedSize\";\nimport { getOffsetForIndex } from \"./getOffsetForIndex\";\nimport { getStartStopIndices as getStartStopIndicesUtil } from \"./getStartStopIndices\";\nimport type { Direction, SizeFunction } from \"./types\";\nimport { useCachedBounds } from \"./useCachedBounds\";\nimport { useItemSize } from \"./useItemSize\";\n\nexport function useVirtualizer<Props extends object>({\n containerElement,\n containerStyle,\n defaultContainerSize = 0,\n direction,\n isRtl = false,\n itemCount,\n itemProps,\n itemSize: itemSizeProp,\n onResize,\n overscanCount\n}: {\n containerElement: HTMLElement | null;\n containerStyle?: CSSProperties;\n defaultContainerSize?: number;\n direction: Direction;\n isRtl?: boolean;\n itemCount: number;\n itemProps: Props;\n itemSize: number | string | SizeFunction<Props>;\n onResize:\n | ((\n size: { height: number; width: number },\n prevSize: { height: number; width: number }\n ) => void)\n | undefined;\n overscanCount: number;\n}) {\n const { height = defaultContainerSize, width = defaultContainerSize } =\n useResizeObserver({\n defaultHeight:\n direction === \"vertical\" ? defaultContainerSize : undefined,\n defaultWidth:\n direction === \"horizontal\" ? defaultContainerSize : undefined,\n element: containerElement,\n mode: direction === \"vertical\" ? \"only-height\" : \"only-width\",\n style: containerStyle\n });\n\n const prevSizeRef = useRef<{ height: number; width: number }>({\n height: 0,\n width: 0\n });\n\n const containerSize = direction === \"vertical\" ? height : width;\n\n const itemSize = useItemSize({ containerSize, itemSize: itemSizeProp });\n\n useLayoutEffect(() => {\n if (typeof onResize === \"function\") {\n const prevSize = prevSizeRef.current;\n\n if (prevSize.height !== height || prevSize.width !== width) {\n onResize({ height, width }, { ...prevSize });\n\n prevSize.height = height;\n prevSize.width = width;\n }\n }\n }, [height, onResize, width]);\n\n const cachedBounds = useCachedBounds({\n itemCount,\n itemProps,\n itemSize\n });\n\n const getCellBounds = useCallback(\n (index: number) => cachedBounds.get(index),\n [cachedBounds]\n );\n\n const [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>(() =>\n getStartStopIndicesUtil({\n cachedBounds,\n // TODO Potentially support a defaultScrollOffset prop?\n containerScrollOffset: 0,\n containerSize,\n itemCount,\n overscanCount\n })\n );\n\n // Guard against temporarily invalid indices that may occur when item count decreases\n // Cached bounds object will be re-created and a second render will restore things\n const {\n startIndexVisible,\n startIndexOverscan,\n stopIndexVisible,\n stopIndexOverscan\n } = {\n startIndexVisible: Math.min(itemCount - 1, indices.startIndexVisible),\n startIndexOverscan: Math.min(itemCount - 1, indices.startIndexOverscan),\n stopIndexVisible: Math.min(itemCount - 1, indices.stopIndexVisible),\n stopIndexOverscan: Math.min(itemCount - 1, indices.stopIndexOverscan)\n };\n\n const getEstimatedSize = useCallback(\n () =>\n getEstimatedSizeUtil({\n cachedBounds,\n itemCount,\n itemSize\n }),\n [cachedBounds, itemCount, itemSize]\n );\n\n const getStartStopIndices = useCallback(\n (scrollOffset: number) => {\n const containerScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n return getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n },\n [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]\n );\n\n useIsomorphicLayoutEffect(() => {\n const scrollOffset =\n (direction === \"vertical\"\n ? containerElement?.scrollTop\n : containerElement?.scrollLeft) ?? 0;\n\n setIndices(getStartStopIndices(scrollOffset));\n }, [containerElement, direction, getStartStopIndices]);\n\n useIsomorphicLayoutEffect(() => {\n if (!containerElement) {\n return;\n }\n\n const onScroll = () => {\n setIndices((prev) => {\n const { scrollLeft, scrollTop } = containerElement;\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: direction === \"vertical\" ? scrollTop : scrollLeft\n });\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: scrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n if (shallowCompare(next, prev)) {\n return prev;\n }\n\n return next;\n });\n };\n\n containerElement.addEventListener(\"scroll\", onScroll);\n\n return () => {\n containerElement.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]);\n\n const scrollToIndex = useStableCallback(\n ({\n align = \"auto\",\n containerScrollOffset,\n index\n }: {\n align?: Align;\n containerScrollOffset: number;\n index: number;\n }) => {\n let scrollOffset = getOffsetForIndex({\n align,\n cachedBounds,\n containerScrollOffset: adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: containerScrollOffset\n }),\n containerSize,\n index,\n itemCount,\n itemSize\n });\n\n if (containerElement) {\n scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n if (typeof containerElement.scrollTo !== \"function\") {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (!shallowCompare(indices, next)) {\n setIndices(next);\n }\n }\n\n return scrollOffset;\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n };\n}\n","import { useState } from \"react\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n const [memoizedObject, setMemoizedObject] = useState(unstableObject);\n\n if (!shallowCompare(memoizedObject, unstableObject)) {\n setMemoizedObject(unstableObject);\n\n return unstableObject;\n }\n\n return memoizedObject;\n}\n","import type { CSSProperties } from \"react\";\nimport { shallowCompare } from \"./shallowCompare\";\n\n// Custom comparison function for React.memo()\n// It knows to compare individual style props and ignore the wrapper object.\n// See https://react.dev/reference/react/memo#memo\nexport function arePropsEqual(\n prevProps: { ariaAttributes: object; style: CSSProperties },\n nextProps: { ariaAttributes: object; style: CSSProperties }\n): boolean {\n const {\n ariaAttributes: prevAriaAttributes,\n style: prevStyle,\n ...prevRest\n } = prevProps;\n const {\n ariaAttributes: nextAriaAttributes,\n style: nextStyle,\n ...nextRest\n } = nextProps;\n\n return (\n shallowCompare(prevAriaAttributes, nextAriaAttributes) &&\n shallowCompare(prevStyle, nextStyle) &&\n shallowCompare(prevRest, nextRest)\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\n/**\n * Renders data with many rows and columns.\n *\n * ℹ️ Unlike `List` rows, `Grid` cell sizes must be known ahead of time.\n * Either static sizes or something that can be derived (from the data in `CellProps`) without rendering.\n */\nexport function Grid<\n CellProps extends object,\n TagName extends TagNames = \"div\"\n>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n children,\n className,\n columnCount,\n columnKey,\n columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n rowKey,\n style,\n tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>): ReactElement {\n const cellProps = useMemoizedObject(cellPropsUnstable);\n const CellComponent = useMemo(\n () => memo(CellComponentProp, arePropsEqual),\n [CellComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isRtl = useIsRtl(element, dir);\n\n const {\n getCellBounds: getColumnBounds,\n getEstimatedSize: getEstimatedWidth,\n startIndexOverscan: columnStartIndexOverscan,\n startIndexVisible: columnStartIndexVisible,\n scrollToIndex: scrollToColumnIndex,\n stopIndexOverscan: columnStopIndexOverscan,\n stopIndexVisible: columnStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultWidth,\n direction: \"horizontal\",\n isRtl,\n itemCount: columnCount,\n itemProps: cellProps,\n itemSize: columnWidth,\n onResize,\n overscanCount\n });\n\n const {\n getCellBounds: getRowBounds,\n getEstimatedSize: getEstimatedHeight,\n startIndexOverscan: rowStartIndexOverscan,\n startIndexVisible: rowStartIndexVisible,\n scrollToIndex: scrollToRowIndex,\n stopIndexOverscan: rowStopIndexOverscan,\n stopIndexVisible: rowStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: cellProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n useImperativeHandle(\n gridRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToCell({\n behavior = \"auto\",\n columnAlign = \"auto\",\n columnIndex,\n rowAlign = \"auto\",\n rowIndex\n }: {\n behavior?: ScrollBehavior;\n columnAlign?: Align;\n columnIndex: number;\n rowAlign?: Align;\n rowIndex: number;\n }) {\n const left = scrollToColumnIndex({\n align: columnAlign,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index: columnIndex\n });\n const top = scrollToRowIndex({\n align: rowAlign,\n containerScrollOffset: element?.scrollTop ?? 0,\n index: rowIndex\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n left,\n top\n });\n }\n },\n\n scrollToColumn({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const left = scrollToColumnIndex({\n align,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n left\n });\n }\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const top = scrollToRowIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n top\n });\n }\n }\n }),\n [element, scrollToColumnIndex, scrollToRowIndex]\n );\n\n useEffect(() => {\n if (\n columnStartIndexOverscan >= 0 &&\n columnStopIndexOverscan >= 0 &&\n rowStartIndexOverscan >= 0 &&\n rowStopIndexOverscan >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered(\n {\n columnStartIndex: columnStartIndexVisible,\n columnStopIndex: columnStopIndexVisible,\n rowStartIndex: rowStartIndexVisible,\n rowStopIndex: rowStopIndexVisible\n },\n {\n columnStartIndex: columnStartIndexOverscan,\n columnStopIndex: columnStopIndexOverscan,\n rowStartIndex: rowStartIndexOverscan,\n rowStopIndex: rowStopIndexOverscan\n }\n );\n }\n }, [\n onCellsRendered,\n columnStartIndexOverscan,\n columnStartIndexVisible,\n columnStopIndexOverscan,\n columnStopIndexVisible,\n rowStartIndexOverscan,\n rowStartIndexVisible,\n rowStopIndexOverscan,\n rowStopIndexVisible\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (\n let rowIndex = rowStartIndexOverscan;\n rowIndex <= rowStopIndexOverscan;\n rowIndex++\n ) {\n const rowBounds = getRowBounds(rowIndex);\n\n const columns: ReactNode[] = [];\n\n for (\n let columnIndex = columnStartIndexOverscan;\n columnIndex <= columnStopIndexOverscan;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n columns.push(\n <CellComponent\n {...(cellProps as CellProps)}\n ariaAttributes={{\n \"aria-colindex\": columnIndex + 1,\n role: \"gridcell\"\n }}\n columnIndex={columnIndex}\n key={\n columnKey\n ? columnKey({\n columnIndex,\n data: cellProps,\n rowIndex\n })\n : columnIndex\n }\n rowIndex={rowIndex}\n style={{\n position: \"absolute\",\n left: isRtl ? undefined : 0,\n right: isRtl ? 0 : undefined,\n transform: `translate(${isRtl ? -columnBounds.scrollOffset : columnBounds.scrollOffset}px, ${rowBounds.scrollOffset}px)`,\n height: rowBounds.size,\n width: columnBounds.size\n }}\n />\n );\n }\n\n children.push(\n <div\n key={\n rowKey\n ? rowKey({\n data: cellProps,\n rowIndex\n })\n : rowIndex\n }\n role=\"row\"\n aria-rowindex={rowIndex + 1}\n >\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnKey,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowKey,\n rowStartIndexOverscan,\n rowStopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedHeight(),\n width: getEstimatedWidth(),\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n \"aria-colcount\": columnCount,\n \"aria-rowcount\": rowCount,\n role: \"grid\",\n ...rest,\n className,\n dir,\n ref: setElement,\n style: {\n position: \"relative\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\",\n ...style\n }\n },\n cells,\n children,\n sizingElement\n );\n}\n","import { useState } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Grid component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useGridCallbackRef =\n useState as typeof useState<GridImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Grid component.\n */\nexport const useGridRef = useRef as typeof useRef<GridImperativeAPI>;\n","import type { DynamicRowHeight } from \"./types\";\n\nexport function isDynamicRowHeight(value: unknown): value is DynamicRowHeight {\n return (\n value != null &&\n typeof value === \"object\" &&\n \"getAverageRowHeight\" in value &&\n typeof value.getAverageRowHeight === \"function\"\n );\n}\n","import { useCallback, useRef, type RefObject } from \"react\";\nimport type { Bounds } from \"../../core/types\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport type { Align } from \"../../types\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { ListImperativeAPI } from \"./types\";\n\nexport function useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n}: {\n element: HTMLDivElement | null;\n getCellBounds: (index: number) => Bounds;\n isDynamicRowHeight: boolean;\n rowCount: number;\n rowElements: RefObject<Element[]>;\n scrollToIndex: (options: {\n align?: Align;\n containerScrollOffset: number;\n index: number;\n }) => number | undefined;\n}): ListImperativeAPI[\"scrollToRow\"] {\n const pendingScroll = useRef<{\n align: Align;\n index: number;\n deadline: number;\n stableFrames: number;\n } | null>(null);\n\n const scrollFrame = useRef<number | undefined>(undefined);\n\n const cancelScroll = useStableCallback(() => {\n pendingScroll.current = null;\n if (scrollFrame.current !== undefined) {\n cancelAnimationFrame(scrollFrame.current);\n scrollFrame.current = undefined;\n }\n });\n\n const correctScroll = useStableCallback(() => {\n scrollFrame.current = undefined;\n const request = pendingScroll.current;\n if (!request) return;\n\n if (\n !element ||\n !isDynamicRowHeight ||\n request.index >= rowCount ||\n performance.now() >= request.deadline\n ) {\n cancelScroll();\n return;\n }\n\n const offset = scrollToIndex({\n align: request.align,\n containerScrollOffset: element.scrollTop,\n index: request.index\n });\n if (offset !== undefined) {\n // Use the committed DOM extent: the browser clamps offsets near the end.\n const top = Math.max(\n 0,\n Math.min(offset, element.scrollHeight - element.clientHeight)\n );\n if (Math.abs(top - element.scrollTop) > 1) {\n request.stableFrames = 0;\n element.scrollTo({ behavior: \"instant\", top });\n } else {\n // An unchanged estimated offset is not enough:\n // React may not have committed the destination rows or their ResizeObserver updates yet.\n const rows = rowElements.current;\n const targetIsRendered = rows.some(\n (row) =>\n row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX) === `${request.index}`\n );\n const measurementsCommitted =\n targetIsRendered &&\n rows.every((row) => {\n const index = Number(row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX));\n // ResizeObserver reports untransformed border-box sizes.\n // offsetHeight uses the same coordinate space; allow for its integer rounding.\n return (\n Math.abs(\n getCellBounds(index).size - (row as HTMLElement).offsetHeight\n ) <= 1\n );\n });\n if (!measurementsCommitted) {\n request.stableFrames = 0;\n } else if (++request.stableFrames >= 2) {\n cancelScroll();\n return;\n }\n }\n }\n scrollFrame.current = requestAnimationFrame(correctScroll);\n });\n\n useIsomorphicLayoutEffect(() => {\n if (!element) return;\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n case \" \": {\n cancelScroll();\n }\n }\n };\n\n element.addEventListener(\"wheel\", cancelScroll, { passive: true });\n element.addEventListener(\"touchstart\", cancelScroll, { passive: true });\n element.addEventListener(\"pointerdown\", cancelScroll);\n element.addEventListener(\"keydown\", onKeyDown);\n\n return () => {\n cancelScroll();\n\n element.removeEventListener(\"wheel\", cancelScroll);\n element.removeEventListener(\"touchstart\", cancelScroll);\n element.removeEventListener(\"pointerdown\", cancelScroll);\n element.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [cancelScroll, element]);\n\n return useCallback(\n ({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: Parameters<ListImperativeAPI[\"scrollToRow\"]>[0]) => {\n // Resolve smart alignment once, before measurements move the target.\n if (isDynamicRowHeight && align === \"smart\") {\n const autoOffset = scrollToIndex({\n align: \"auto\",\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n align = autoOffset === (element?.scrollTop ?? 0) ? \"auto\" : \"center\";\n }\n\n const top = scrollToIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n cancelScroll();\n\n if (typeof element?.scrollTo === \"function\") {\n if (isDynamicRowHeight) {\n pendingScroll.current = {\n align,\n index,\n deadline: performance.now() + 1000,\n stableFrames: 0\n };\n scrollFrame.current = requestAnimationFrame(correctScroll);\n }\n element.scrollTo({\n behavior: isDynamicRowHeight ? \"instant\" : behavior,\n top\n });\n }\n },\n [cancelScroll, correctScroll, element, isDynamicRowHeight, scrollToIndex]\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\nimport { useScrollToRow } from \"./useScrollToRow\";\n\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\n\n/**\n * Renders data with many rows.\n */\nexport function List<\n RowProps extends object,\n TagName extends TagNames = \"div\"\n>({\n children,\n className,\n defaultHeight = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight: rowHeightProp,\n rowKey,\n rowProps: rowPropsUnstable,\n tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>): ReactElement {\n const rowProps = useMemoizedObject(rowPropsUnstable);\n const RowComponent = useMemo(\n () => memo(RowComponentProp, arePropsEqual),\n [RowComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isDynamicRowHeight = isDynamicRowHeightUtil(rowHeightProp);\n\n const rowHeight = useMemo(() => {\n if (isDynamicRowHeight) {\n return (index: number) => {\n return (\n rowHeightProp.getRowHeight(index) ??\n rowHeightProp.getAverageRowHeight()\n );\n };\n }\n\n return rowHeightProp;\n }, [isDynamicRowHeight, rowHeightProp]);\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n const rowElements = useRef<Element[]>([]);\n const scrollToRow = useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n scrollToRow\n }),\n [element, scrollToRow]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n // Additional children (e.g. overlays) are not rows and must not be measured.\n const rows = Array.from(element.children)\n .slice(\n 0,\n startIndexOverscan < 0 ? 0 : stopIndexOverscan - startIndexOverscan + 1\n )\n .filter((item, index) => {\n if (item.hasAttribute(\"aria-hidden\")) {\n // Ignore sizing element\n return false;\n }\n\n const attribute = `${startIndexOverscan + index}`;\n item.setAttribute(DATA_ATTRIBUTE_LIST_INDEX, attribute);\n\n return true;\n });\n\n rowElements.current = rows;\n\n if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n RowComponent,\n element,\n isDynamicRowHeight,\n rowCount,\n rowHeightProp,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n useEffect(() => {\n if (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onRowsRendered) {\n onRowsRendered(\n {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n },\n {\n startIndex: startIndexOverscan,\n stopIndex: stopIndexOverscan\n }\n );\n }\n }, [\n onRowsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n ariaAttributes={{\n \"aria-posinset\": index + 1,\n \"aria-setsize\": rowCount,\n role: \"listitem\"\n }}\n key={rowKey ? rowKey(index, rowProps) : index}\n index={index}\n style={{\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n // In case of dynamic row heights, don't specify a height style\n // otherwise a default/estimated height would mask the actual height\n height: isDynamicRowHeight ? undefined : bounds.size,\n width: \"100%\"\n }}\n />\n );\n }\n }\n return children;\n }, [\n RowComponent,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedSize(),\n width: \"100%\",\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n role: \"list\",\n ...rest,\n className,\n ref: setElement,\n style: {\n position: \"relative\",\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\",\n ...style\n }\n },\n rows,\n children,\n sizingElement\n );\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { assert } from \"../../utils/assert\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { DynamicRowHeight } from \"./types\";\n\nexport function useDynamicRowHeight({\n defaultRowHeight,\n key\n}: {\n defaultRowHeight: number;\n key?: string | number;\n}) {\n const [state, setState] = useState<{\n key: string | number | undefined;\n map: Map<number, number>;\n }>({\n key,\n map: new Map()\n });\n\n if (state.key !== key) {\n setState({\n key,\n map: new Map()\n });\n }\n\n const { map } = state;\n\n const getAverageRowHeight = useCallback(() => {\n let totalHeight = 0;\n\n map.forEach((height) => {\n totalHeight += height;\n });\n\n if (totalHeight === 0) {\n return defaultRowHeight;\n }\n\n return totalHeight / map.size;\n }, [defaultRowHeight, map]);\n\n const getRowHeight = useCallback(\n (index: number) => {\n const measuredHeight = map.get(index);\n if (measuredHeight !== undefined) {\n return measuredHeight;\n }\n\n // Keep estimates stable when rowProps change (see issue #863), but do not\n // store them as measurements or include them in the measured average.\n return defaultRowHeight;\n },\n [defaultRowHeight, map]\n );\n\n const setRowHeight = useCallback((index: number, size: number) => {\n setState((prevState) => {\n if (prevState.map.get(index) === size) {\n return prevState;\n }\n\n const clonedMap = new Map(prevState.map);\n clonedMap.set(index, size);\n\n return {\n ...prevState,\n map: clonedMap\n };\n });\n }, []);\n\n const resizeObserverCallback = useStableCallback(\n (entries: ResizeObserverEntry[]) => {\n if (entries.length === 0) {\n return;\n }\n\n entries.forEach((entry) => {\n const { borderBoxSize, target } = entry;\n\n const attribute = target.getAttribute(DATA_ATTRIBUTE_LIST_INDEX);\n assert(\n attribute !== null,\n `Invalid ${DATA_ATTRIBUTE_LIST_INDEX} attribute value`\n );\n\n const index = parseInt(attribute);\n\n const { blockSize: height } = borderBoxSize[0];\n if (!height) {\n // Ignore heights that have not yet been measured (e.g. <img> elements that have not yet loaded)\n return;\n }\n\n setRowHeight(index, height);\n });\n }\n );\n\n const [resizeObserver] = useState(() => {\n if (typeof ResizeObserver !== \"undefined\") {\n return new ResizeObserver(resizeObserverCallback);\n }\n });\n\n useEffect(() => {\n if (resizeObserver) {\n return () => {\n resizeObserver.disconnect();\n };\n }\n }, [resizeObserver]);\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n if (resizeObserver) {\n elements.forEach((element) => resizeObserver.observe(element));\n return () => {\n elements.forEach((element) => resizeObserver.unobserve(element));\n };\n }\n return () => {};\n },\n [resizeObserver]\n );\n\n return useMemo<DynamicRowHeight>(\n () => ({\n getAverageRowHeight,\n getRowHeight,\n setRowHeight,\n observeRowElements\n }),\n [getAverageRowHeight, getRowHeight, setRowHeight, observeRowElements]\n );\n}\n","import { useState } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the List component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useListCallbackRef =\n useState as typeof useState<ListImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the List component.\n */\nexport const useListRef = useRef as typeof useRef<ListImperativeAPI>;\n","let size: number = -1;\n\nexport function getScrollbarSize(recalculate: boolean = false): number {\n if (size === -1 || recalculate) {\n const div = document.createElement(\"div\");\n const style = div.style;\n style.width = \"50px\";\n style.height = \"50px\";\n style.overflow = \"scroll\";\n\n document.body.appendChild(div);\n\n size = div.offsetWidth - div.clientWidth;\n\n document.body.removeChild(div);\n }\n\n return size;\n}\n\nexport function setScrollbarSizeForTests(value: number) {\n size = value;\n}\n"],"names":["isRtl","element","currentElement","useIsRtl","dir","value","setValue","useState","useLayoutEffect","useIsomorphicLayoutEffect","useEffect","parseNumericStyleValue","useResizeObserver","box","defaultHeight","defaultWidth","disabledProp","mode","style","styleHeight","styleWidth","useMemo","state","setState","disabled","resizeObserver","entries","entry","contentRect","target","prevState","useStableCallback","fn","ref","useRef","useCallback","args","cachedRTLResult","getRTLOffsetType","recalculate","outerDiv","outerStyle","innerDiv","innerStyle","adjustScrollOffsetForRtl","containerElement","direction","scrollOffset","clientWidth","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","isVisible","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","low","high","middle","createCachedBounds","itemProps","cache","currentIndex","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","height","width","prevSizeRef","prevSize","getCellBounds","indices","setIndices","getStartStopIndicesUtil","startIndexOverscan","stopIndexOverscan","getEstimatedSizeUtil","onScroll","prev","scrollLeft","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","memoizedObject","setMemoizedObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnKey","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","rowKey","tagName","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndexOverscan","columnStartIndexVisible","scrollToColumnIndex","columnStopIndexOverscan","columnStopIndexVisible","getRowBounds","getEstimatedHeight","rowStartIndexOverscan","rowStartIndexVisible","scrollToRowIndex","rowStopIndexOverscan","rowStopIndexVisible","useImperativeHandle","behavior","columnAlign","columnIndex","rowAlign","rowIndex","left","top","cells","rowBounds","columns","columnBounds","createElement","jsx","sizingElement","useGridCallbackRef","useGridRef","isDynamicRowHeight","useScrollToRow","rowElements","pendingScroll","scrollFrame","cancelScroll","correctScroll","request","offset","rows","row","DATA_ATTRIBUTE_LIST_INDEX","onKeyDown","event","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","scrollToRow","item","attribute","useDynamicRowHeight","defaultRowHeight","map","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","observeRowElements","elements","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":";;;AAAO,SAASA,GAAMC,GAAsB;AAC1C,MAAIC,IAAqCD;AACzC,SAAOC,KAAgB;AACrB,QAAIA,EAAe;AACjB,aAAOA,EAAe,QAAQ;AAGhC,IAAAA,IAAiBA,EAAe;AAAA,EAClC;AAEA,SAAO;AACT;ACRO,SAASC,GACdF,GACAG,GACA;AACA,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAASH,MAAQ,KAAK;AAEhD,SAAAI,GAAgB,MAAM;AACpB,IAAIJ,IACFE,EAASF,MAAQ,KAAK,IACbH,KACTK,EAASN,GAAMC,CAAO,CAAC;AAAA,EAE3B,GAAG,CAACG,GAAKH,CAAO,CAAC,GAEVI;AACT;AChBO,MAAM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7M,GCHW8M,KAAanL;ACN1B,IAAIkD,KAAe;AAEZ,SAASkI,GAAiB/K,IAAuB,IAAe;AACrE,MAAI6C,OAAS,MAAM7C,GAAa;AAC9B,UAAMgL,IAAM,SAAS,cAAc,KAAK,GAClCrM,IAAQqM,EAAI;AAClB,IAAArM,EAAM,QAAQ,QACdA,EAAM,SAAS,QACfA,EAAM,WAAW,UAEjB,SAAS,KAAK,YAAYqM,CAAG,GAE7BnI,KAAOmI,EAAI,cAAcA,EAAI,aAE7B,SAAS,KAAK,YAAYA,CAAG;AAAA,EAC/B;AAEA,SAAOnI;AACT;"}
|
|
1
|
+
{"version":3,"file":"react-window.js","sources":["../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/utils/isRtl.ts","../lib/core/useIsRtl.ts","../lib/hooks/useIsHydrating.ts","../lib/utils/getOwnerWindow.ts","../lib/utils/getResizeObserverClass.ts","../lib/utils/parseNumericStyleValue.ts","../lib/hooks/useResizeObserver.ts","../lib/hooks/useStableCallback.ts","../lib/utils/getRTLOffsetType.ts","../lib/utils/adjustScrollOffsetForRtl.ts","../lib/utils/assert.ts","../lib/utils/shallowCompare.ts","../lib/core/getEstimatedSize.ts","../lib/core/getOffsetForIndex.ts","../lib/core/getStartStopIndices.ts","../lib/core/createCachedBounds.ts","../lib/core/useCachedBounds.ts","../lib/core/useItemSize.ts","../lib/core/useVirtualizer.ts","../lib/hooks/useMemoizedObject.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/hooks/useAfterResizeObserverNotifications.ts","../lib/components/list/isDynamicRowHeight.ts","../lib/components/list/useScrollToRow.ts","../lib/components/list/List.tsx","../lib/components/list/useDynamicRowHeight.ts","../lib/components/list/useListCallbackRef.ts","../lib/components/list/useListRef.ts","../lib/utils/getScrollbarSize.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","export function isRtl(element: HTMLElement) {\n let currentElement: HTMLElement | null = element;\n while (currentElement) {\n if (currentElement.dir) {\n return currentElement.dir === \"rtl\";\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return false;\n}\n","import { useState, type HTMLAttributes } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { isRtl } from \"../utils/isRtl\";\n\nexport function useIsRtl(\n element: HTMLElement | null,\n dir: HTMLAttributes<HTMLElement>[\"dir\"]\n) {\n const [value, setValue] = useState(dir === \"rtl\");\n\n useIsomorphicLayoutEffect(() => {\n if (dir) {\n setValue(dir === \"rtl\");\n } else if (element) {\n setValue(isRtl(element));\n }\n }, [dir, element]);\n\n return value;\n}\n","import { useSyncExternalStore } from \"react\";\n\nfunction subscribe() {\n return () => {};\n}\n\n/**\n * Returns true when rendering on the server or while hydrating server-rendered HTML.\n * Returns false for client-only renders and for any render after hydration has completed.\n */\nexport function useIsHydrating(): boolean {\n return useSyncExternalStore(\n subscribe,\n () => false,\n () => true\n );\n}\n","export function getOwnerWindow(\n element: Element | null | undefined\n): Window & typeof globalThis {\n return element?.ownerDocument.defaultView ?? window;\n}\n","import { getOwnerWindow } from \"./getOwnerWindow\";\n\nexport function getResizeObserverClass(\n element: Element\n): typeof ResizeObserver | undefined {\n return (\n getOwnerWindow(element).ResizeObserver ??\n (typeof ResizeObserver !== \"undefined\" ? ResizeObserver : undefined)\n );\n}\n","import type { CSSProperties } from \"react\";\n\nexport function parseNumericStyleValue(\n value: CSSProperties[\"height\"]\n): number | undefined {\n if (value !== undefined) {\n switch (typeof value) {\n case \"number\": {\n return value;\n }\n case \"string\": {\n if (value.endsWith(\"px\")) {\n return parseFloat(value);\n }\n break;\n }\n }\n }\n}\n","import { useMemo, useState, type CSSProperties } from \"react\";\nimport { getResizeObserverClass } from \"../utils/getResizeObserverClass\";\nimport { parseNumericStyleValue } from \"../utils/parseNumericStyleValue\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\nexport function useResizeObserver({\n box,\n defaultHeight,\n defaultWidth,\n disabled: disabledProp,\n element,\n mode,\n style\n}: {\n box?: ResizeObserverBoxOptions;\n defaultHeight?: number;\n defaultWidth?: number;\n disabled?: boolean;\n element: HTMLElement | null;\n mode?: \"only-height\" | \"only-width\";\n style: CSSProperties | undefined;\n}) {\n const { styleHeight, styleWidth } = useMemo(\n () => ({\n styleHeight: parseNumericStyleValue(style?.height),\n styleWidth: parseNumericStyleValue(style?.width)\n }),\n [style?.height, style?.width]\n );\n\n const [state, setState] = useState<{\n height: number | undefined;\n width: number | undefined;\n }>({\n height: defaultHeight,\n width: defaultWidth\n });\n\n const disabled =\n disabledProp ||\n (mode === \"only-height\" && styleHeight !== undefined) ||\n (mode === \"only-width\" && styleWidth !== undefined) ||\n (styleHeight !== undefined && styleWidth !== undefined);\n\n useIsomorphicLayoutEffect(() => {\n if (element === null || disabled) {\n return;\n }\n\n const ResizeObserverClass = getResizeObserverClass(element);\n if (!ResizeObserverClass) {\n return;\n }\n\n const resizeObserver = new ResizeObserverClass((entries) => {\n for (const entry of entries) {\n const { contentRect, target } = entry;\n if (element === target) {\n setState((prevState) => {\n if (\n prevState.height === contentRect.height &&\n prevState.width === contentRect.width\n ) {\n return prevState;\n }\n\n return {\n height: contentRect.height,\n width: contentRect.width\n };\n });\n }\n }\n });\n resizeObserver.observe(element, { box });\n\n return () => {\n resizeObserver?.unobserve(element);\n };\n }, [box, disabled, element, styleHeight, styleWidth]);\n\n return useMemo(\n () => ({\n height: styleHeight ?? state.height,\n width: styleWidth ?? state.width\n }),\n [state, styleHeight, styleWidth]\n );\n}\n","import { useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n// Forked from useEventCallback (usehooks-ts)\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: (...args: Args) => Return\n): (...args: Args) => Return;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined {\n const ref = useRef<typeof fn>(() => {\n // This error ensures components don't render with previous/stale function\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((...args: Args) => ref.current?.(...args), [ref]) as (\n ...args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\n// Cache per document, since each window is probed separately\nconst cache = new WeakMap<Document, RTLOffsetType>();\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(\n recalculate: boolean = false,\n ownerDocument: Document = document\n): RTLOffsetType {\n let cachedRTLResult = cache.get(ownerDocument);\n if (cachedRTLResult === undefined || recalculate) {\n const outerDiv = ownerDocument.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = ownerDocument.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n ownerDocument.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n ownerDocument.body.removeChild(outerDiv);\n\n cache.set(ownerDocument, cachedRTLResult);\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (\n getRTLOffsetType(false, containerElement?.ownerDocument ?? document)\n ) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollOffset;\n }\n break;\n }\n }\n }\n }\n return scrollOffset;\n}\n","export function assert(\n expectedCondition: unknown,\n message: string = \"Assertion error\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","import { assert } from \"./assert\";\n\nexport function shallowCompare<Type extends object>(\n a: Type | undefined,\n b: Type | undefined\n) {\n if (a === b) {\n return true;\n }\n\n if (!!a !== !!b) {\n return false;\n }\n\n assert(a !== undefined);\n assert(b !== undefined);\n\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const key in a) {\n if (!Object.hasOwn(b, key) || !Object.is(b[key], a[key])) {\n return false;\n }\n }\n\n return true;\n}\n","import type { CachedBounds, SizeFunction } from \"./types\";\nimport { assert } from \"../utils/assert\";\n\nexport function getEstimatedSize<Props extends object>({\n cachedBounds,\n itemCount,\n itemSize\n}: {\n cachedBounds: CachedBounds;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n}) {\n if (itemCount === 0) {\n return 0;\n } else if (typeof itemSize === \"number\") {\n return itemCount * itemSize;\n } else {\n const bounds = cachedBounds.get(\n cachedBounds.size === 0 ? 0 : cachedBounds.size - 1\n );\n assert(bounds !== undefined, \"Unexpected bounds cache miss\");\n\n const averageItemSize =\n (bounds.scrollOffset + bounds.size) / cachedBounds.size;\n\n return itemCount * averageItemSize;\n }\n}\n","import type { Align } from \"../types\";\nimport { getEstimatedSize } from \"./getEstimatedSize\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function getOffsetForIndex<Props extends object>({\n align,\n cachedBounds,\n index,\n itemCount,\n itemSize,\n containerScrollOffset,\n containerSize\n}: {\n align: Align;\n cachedBounds: CachedBounds;\n index: number;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n containerScrollOffset: number;\n containerSize: number;\n}) {\n if (index < 0 || index >= itemCount) {\n throw RangeError(`Invalid index specified: ${index}`, {\n cause: `Index ${index} is not within the range of 0 - ${itemCount - 1}`\n });\n }\n\n // Populate the target bounds before estimating the total from cached sizes.\n const bounds = cachedBounds.get(index);\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const maxOffset = Math.max(\n 0,\n Math.min(estimatedTotalSize - containerSize, bounds.scrollOffset)\n );\n const minOffset = Math.max(\n 0,\n bounds.scrollOffset - containerSize + bounds.size\n );\n\n // Visibility depends on the row itself, not the estimated scroll extent.\n // For oversized rows, leave the offset alone when the row fills the viewport.\n const isVisible =\n bounds.size > containerSize\n ? containerScrollOffset >= bounds.scrollOffset &&\n containerScrollOffset <= minOffset\n : containerScrollOffset >= minOffset &&\n containerScrollOffset <= bounds.scrollOffset;\n\n if (align === \"smart\") {\n align = isVisible ? \"auto\" : \"center\";\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n return Math.max(\n 0,\n Math.min(\n estimatedTotalSize - containerSize,\n bounds.scrollOffset + bounds.size / 2 - containerSize / 2\n )\n );\n }\n case \"auto\":\n default: {\n if (isVisible) {\n return containerScrollOffset;\n } else if (containerScrollOffset < minOffset) {\n return minOffset;\n } else {\n return maxOffset;\n }\n }\n }\n}\n","import type { CachedBounds } from \"./types\";\n\nexport function getStartStopIndices({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n}: {\n cachedBounds: CachedBounds;\n containerScrollOffset: number;\n containerSize: number;\n itemCount: number;\n overscanCount: number;\n}): {\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n} {\n const maxIndex = itemCount - 1;\n\n if (itemCount === 0) {\n return {\n startIndexVisible: 0,\n stopIndexVisible: -1,\n startIndexOverscan: 0,\n stopIndexOverscan: -1\n };\n }\n\n let startIndexVisible: number;\n let stopIndexVisible: number;\n const { itemSize } = cachedBounds;\n\n if (itemSize !== undefined && itemSize > 0) {\n startIndexVisible = Math.max(\n 0,\n Math.min(maxIndex, Math.floor(containerScrollOffset / itemSize))\n );\n stopIndexVisible = Math.max(\n startIndexVisible,\n Math.min(\n maxIndex,\n Math.ceil((containerScrollOffset + containerSize) / itemSize) - 1\n )\n );\n } else {\n // Binary search the measured prefix\n let low = 0;\n let high = Math.min(maxIndex, Math.max(0, cachedBounds.size - 1));\n\n while (low < high) {\n const middle = Math.floor((low + high) / 2);\n const bounds = cachedBounds.get(middle);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n high = middle;\n } else {\n low = middle + 1;\n }\n }\n\n // Extend sequentially beyond the measured prefix to avoid evaluating item sizes past the viewport\n while (low < maxIndex) {\n const bounds = cachedBounds.get(low);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) break;\n low++;\n }\n\n startIndexVisible = low;\n stopIndexVisible = low;\n while (stopIndexVisible < maxIndex) {\n const bounds = cachedBounds.get(stopIndexVisible);\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n )\n break;\n stopIndexVisible++;\n }\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan: Math.max(0, startIndexVisible - overscanCount),\n stopIndexOverscan: Math.min(maxIndex, stopIndexVisible + overscanCount)\n };\n}\n","import { assert } from \"../utils/assert\";\nimport type { Bounds, CachedBounds, SizeFunction } from \"./types\";\n\nexport function createCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n const cache = new Map<number, Bounds>();\n\n return {\n itemSize: typeof itemSize === \"number\" ? itemSize : undefined,\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n if (typeof itemSize === \"number\") {\n assert(index >= 0, `Invalid index ${index}`);\n let bounds = cache.get(index);\n if (bounds === undefined) {\n bounds = { size: itemSize, scrollOffset: index * itemSize };\n cache.set(index, bounds);\n }\n return bounds;\n }\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n const size = itemSize(currentIndex, itemProps);\n\n if (currentIndex === 0) {\n cache.set(currentIndex, {\n size,\n scrollOffset: 0\n });\n } else {\n const previousRowBounds = cache.get(currentIndex - 1);\n assert(\n previousRowBounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n cache.set(currentIndex, {\n scrollOffset:\n previousRowBounds.scrollOffset + previousRowBounds.size,\n size\n });\n }\n }\n\n const bounds = cache.get(index);\n assert(\n bounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n return bounds;\n },\n set(index: number, bounds: Bounds) {\n cache.set(index, bounds);\n },\n get size() {\n return cache.size;\n }\n };\n}\n","import { useMemo } from \"react\";\nimport { createCachedBounds } from \"./createCachedBounds\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function useCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n return useMemo(\n () =>\n createCachedBounds({\n itemCount,\n itemProps,\n itemSize\n }),\n [itemCount, itemProps, itemSize]\n );\n}\n","import { assert } from \"../utils/assert\";\nimport type { SizeFunction } from \"./types\";\n\nexport function useItemSize<Props extends object>({\n containerSize,\n itemSize: itemSizeProp\n}: {\n containerSize: number;\n itemSize: number | string | SizeFunction<Props>;\n}) {\n let itemSize: number | SizeFunction<Props>;\n switch (typeof itemSizeProp) {\n case \"string\": {\n assert(\n itemSizeProp.endsWith(\"%\"),\n `Invalid item size: \"${itemSizeProp}\"; string values must be percentages (e.g. \"100%\")`\n );\n assert(\n containerSize !== undefined,\n \"Container size must be defined if a percentage item size is specified\"\n );\n\n itemSize = (containerSize * parseFloat(itemSizeProp)) / 100;\n break;\n }\n default: {\n itemSize = itemSizeProp;\n break;\n }\n }\n\n return itemSize;\n}\n","import { useCallback, useRef, useState, type CSSProperties } from \"react\";\nimport { useIsHydrating } from \"../hooks/useIsHydrating\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { adjustScrollOffsetForRtl } from \"../utils/adjustScrollOffsetForRtl\";\nimport { isRtl as isRtlUtil } from \"../utils/isRtl\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\nimport { getEstimatedSize as getEstimatedSizeUtil } from \"./getEstimatedSize\";\nimport { getOffsetForIndex } from \"./getOffsetForIndex\";\nimport { getStartStopIndices as getStartStopIndicesUtil } from \"./getStartStopIndices\";\nimport type { Direction, SizeFunction } from \"./types\";\nimport { useCachedBounds } from \"./useCachedBounds\";\nimport { useItemSize } from \"./useItemSize\";\n\nexport function useVirtualizer<Props extends object>({\n containerElement,\n containerStyle,\n defaultContainerSize = 0,\n defaultScrollOffset = 0,\n direction,\n isRtl = false,\n itemCount,\n itemProps,\n itemSize: itemSizeProp,\n onResize,\n overscanCount\n}: {\n containerElement: HTMLElement | null;\n containerStyle?: CSSProperties;\n defaultContainerSize?: number;\n defaultScrollOffset?: number;\n direction: Direction;\n isRtl?: boolean;\n itemCount: number;\n itemProps: Props;\n itemSize: number | string | SizeFunction<Props>;\n onResize:\n | ((\n size: { height: number; width: number },\n prevSize: { height: number; width: number }\n ) => void)\n | undefined;\n overscanCount: number;\n}) {\n const { height = defaultContainerSize, width = defaultContainerSize } =\n useResizeObserver({\n defaultHeight:\n direction === \"vertical\" ? defaultContainerSize : undefined,\n defaultWidth:\n direction === \"horizontal\" ? defaultContainerSize : undefined,\n element: containerElement,\n mode: direction === \"vertical\" ? \"only-height\" : \"only-width\",\n style: containerStyle\n });\n\n const prevSizeRef = useRef<{ height: number; width: number }>({\n height: 0,\n width: 0\n });\n\n const containerSize = direction === \"vertical\" ? height : width;\n\n const itemSize = useItemSize({ containerSize, itemSize: itemSizeProp });\n\n useIsomorphicLayoutEffect(() => {\n if (typeof onResize === \"function\") {\n const prevSize = prevSizeRef.current;\n\n if (prevSize.height !== height || prevSize.width !== width) {\n onResize({ height, width }, { ...prevSize });\n\n prevSize.height = height;\n prevSize.width = width;\n }\n }\n }, [height, onResize, width]);\n\n const cachedBounds = useCachedBounds({\n itemCount,\n itemProps,\n itemSize\n });\n\n // Server-rendered HTML can't be scrolled, so the server (and hydration) render always starts at offset 0;\n // the default scroll offset is applied after mount (see below)\n const isHydrating = useIsHydrating();\n const [initialScrollOffset] = useState(() =>\n isHydrating ? 0 : defaultScrollOffset\n );\n\n const getCellBounds = useCallback(\n (index: number) => cachedBounds.get(index),\n [cachedBounds]\n );\n\n const [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>(() =>\n getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: initialScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n })\n );\n\n // Guard against temporarily invalid indices that may occur when item count decreases\n // Cached bounds object will be re-created and a second render will restore things\n const {\n startIndexVisible,\n startIndexOverscan,\n stopIndexVisible,\n stopIndexOverscan\n } = {\n startIndexVisible: Math.min(itemCount - 1, indices.startIndexVisible),\n startIndexOverscan: Math.min(itemCount - 1, indices.startIndexOverscan),\n stopIndexVisible: Math.min(itemCount - 1, indices.stopIndexVisible),\n stopIndexOverscan: Math.min(itemCount - 1, indices.stopIndexOverscan)\n };\n\n const getEstimatedSize = useCallback(\n () =>\n getEstimatedSizeUtil({\n cachedBounds,\n itemCount,\n itemSize\n }),\n [cachedBounds, itemCount, itemSize]\n );\n\n const getStartStopIndices = useCallback(\n (scrollOffset: number) => {\n const containerScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n return getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n },\n [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]\n );\n\n // Apply the default scroll offset once, when the container first mounts with items to scroll to\n // (content can't be scrolled before then, e.g. while data is loading).\n // This effect must run before the one below that syncs indices with the current scroll offset.\n const hasAppliedDefaultScrollOffsetRef = useRef(false);\n useIsomorphicLayoutEffect(() => {\n if (\n !containerElement ||\n itemCount === 0 ||\n hasAppliedDefaultScrollOffsetRef.current\n ) {\n return;\n }\n\n hasAppliedDefaultScrollOffsetRef.current = true;\n\n if (defaultScrollOffset <= 0) {\n return;\n }\n\n // The isRtl prop may not have been updated yet if the direction is inherited from an ancestor\n const isRtlContainer =\n direction === \"horizontal\" && isRtlUtil(containerElement);\n\n const currentScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl: isRtlContainer,\n scrollOffset:\n direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n });\n if (currentScrollOffset !== 0) {\n // Don't override a scroll position restored by the browser (or by the user before hydration)\n return;\n }\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl: isRtlContainer,\n scrollOffset: defaultScrollOffset\n });\n\n if (typeof containerElement.scrollTo === \"function\") {\n containerElement.scrollTo({\n behavior: \"instant\",\n [direction === \"vertical\" ? \"top\" : \"left\"]: scrollOffset\n });\n } else if (direction === \"vertical\") {\n containerElement.scrollTop = scrollOffset;\n } else {\n containerElement.scrollLeft = scrollOffset;\n }\n // Intentionally only run when the container element mounts or items first become available\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [containerElement, itemCount]);\n\n useIsomorphicLayoutEffect(() => {\n const next = containerElement\n ? getStartStopIndices(\n direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n )\n : getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: initialScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n setIndices((prev) => (shallowCompare(next, prev) ? prev : next));\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n getStartStopIndices,\n initialScrollOffset,\n itemCount,\n overscanCount\n ]);\n\n useIsomorphicLayoutEffect(() => {\n if (!containerElement) {\n return;\n }\n\n const onScroll = () => {\n setIndices((prev) => {\n const { scrollLeft, scrollTop } = containerElement;\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: direction === \"vertical\" ? scrollTop : scrollLeft\n });\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: scrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n if (shallowCompare(next, prev)) {\n return prev;\n }\n\n return next;\n });\n };\n\n containerElement.addEventListener(\"scroll\", onScroll);\n\n return () => {\n containerElement.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]);\n\n const scrollToIndex = useStableCallback(\n ({\n align = \"auto\",\n containerScrollOffset,\n index\n }: {\n align?: Align;\n containerScrollOffset: number;\n index: number;\n }) => {\n let scrollOffset = getOffsetForIndex({\n align,\n cachedBounds,\n containerScrollOffset: adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: containerScrollOffset\n }),\n containerSize,\n index,\n itemCount,\n itemSize\n });\n\n if (containerElement) {\n scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n if (typeof containerElement.scrollTo !== \"function\") {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (!shallowCompare(indices, next)) {\n setIndices(next);\n }\n }\n\n return scrollOffset;\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n };\n}\n","import { useState } from \"react\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n const [memoizedObject, setMemoizedObject] = useState(unstableObject);\n\n if (!shallowCompare(memoizedObject, unstableObject)) {\n setMemoizedObject(unstableObject);\n\n return unstableObject;\n }\n\n return memoizedObject;\n}\n","import type { CSSProperties } from \"react\";\nimport { shallowCompare } from \"./shallowCompare\";\n\n// Custom comparison function for React.memo()\n// It knows to compare individual style props and ignore the wrapper object.\n// See https://react.dev/reference/react/memo#memo\nexport function arePropsEqual(\n prevProps: { ariaAttributes: object; style: CSSProperties },\n nextProps: { ariaAttributes: object; style: CSSProperties }\n): boolean {\n const {\n ariaAttributes: prevAriaAttributes,\n style: prevStyle,\n ...prevRest\n } = prevProps;\n const {\n ariaAttributes: nextAriaAttributes,\n style: nextStyle,\n ...nextRest\n } = nextProps;\n\n return (\n shallowCompare(prevAriaAttributes, nextAriaAttributes) &&\n shallowCompare(prevStyle, nextStyle) &&\n shallowCompare(prevRest, nextRest)\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\n/**\n * Renders data with many rows and columns.\n *\n * ℹ️ Unlike `List` rows, `Grid` cell sizes must be known ahead of time.\n * Either static sizes or something that can be derived (from the data in `CellProps`) without rendering.\n */\nexport function Grid<\n CellProps extends object,\n TagName extends TagNames = \"div\"\n>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n children,\n className,\n columnCount,\n columnKey,\n columnWidth,\n defaultHeight = 0,\n defaultScrollLeft = 0,\n defaultScrollTop = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n rowKey,\n style,\n tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>): ReactElement {\n const cellProps = useMemoizedObject(cellPropsUnstable);\n const CellComponent = useMemo(\n () => memo(CellComponentProp, arePropsEqual),\n [CellComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isRtl = useIsRtl(element, dir);\n\n const {\n getCellBounds: getColumnBounds,\n getEstimatedSize: getEstimatedWidth,\n startIndexOverscan: columnStartIndexOverscan,\n startIndexVisible: columnStartIndexVisible,\n scrollToIndex: scrollToColumnIndex,\n stopIndexOverscan: columnStopIndexOverscan,\n stopIndexVisible: columnStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultWidth,\n defaultScrollOffset: defaultScrollLeft,\n direction: \"horizontal\",\n isRtl,\n itemCount: columnCount,\n itemProps: cellProps,\n itemSize: columnWidth,\n onResize,\n overscanCount\n });\n\n const {\n getCellBounds: getRowBounds,\n getEstimatedSize: getEstimatedHeight,\n startIndexOverscan: rowStartIndexOverscan,\n startIndexVisible: rowStartIndexVisible,\n scrollToIndex: scrollToRowIndex,\n stopIndexOverscan: rowStopIndexOverscan,\n stopIndexVisible: rowStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n defaultScrollOffset: defaultScrollTop,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: cellProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n useImperativeHandle(\n gridRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToCell({\n behavior = \"auto\",\n columnAlign = \"auto\",\n columnIndex,\n rowAlign = \"auto\",\n rowIndex\n }: {\n behavior?: ScrollBehavior;\n columnAlign?: Align;\n columnIndex: number;\n rowAlign?: Align;\n rowIndex: number;\n }) {\n const left = scrollToColumnIndex({\n align: columnAlign,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index: columnIndex\n });\n const top = scrollToRowIndex({\n align: rowAlign,\n containerScrollOffset: element?.scrollTop ?? 0,\n index: rowIndex\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n left,\n top\n });\n }\n },\n\n scrollToColumn({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const left = scrollToColumnIndex({\n align,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n left\n });\n }\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const top = scrollToRowIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n if (typeof element?.scrollTo === \"function\") {\n element.scrollTo({\n behavior,\n top\n });\n }\n }\n }),\n [element, scrollToColumnIndex, scrollToRowIndex]\n );\n\n useEffect(() => {\n if (\n columnStartIndexOverscan >= 0 &&\n columnStopIndexOverscan >= 0 &&\n rowStartIndexOverscan >= 0 &&\n rowStopIndexOverscan >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered(\n {\n columnStartIndex: columnStartIndexVisible,\n columnStopIndex: columnStopIndexVisible,\n rowStartIndex: rowStartIndexVisible,\n rowStopIndex: rowStopIndexVisible\n },\n {\n columnStartIndex: columnStartIndexOverscan,\n columnStopIndex: columnStopIndexOverscan,\n rowStartIndex: rowStartIndexOverscan,\n rowStopIndex: rowStopIndexOverscan\n }\n );\n }\n }, [\n onCellsRendered,\n columnStartIndexOverscan,\n columnStartIndexVisible,\n columnStopIndexOverscan,\n columnStopIndexVisible,\n rowStartIndexOverscan,\n rowStartIndexVisible,\n rowStopIndexOverscan,\n rowStopIndexVisible\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (\n let rowIndex = rowStartIndexOverscan;\n rowIndex <= rowStopIndexOverscan;\n rowIndex++\n ) {\n const rowBounds = getRowBounds(rowIndex);\n\n const columns: ReactNode[] = [];\n\n for (\n let columnIndex = columnStartIndexOverscan;\n columnIndex <= columnStopIndexOverscan;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n columns.push(\n <CellComponent\n {...(cellProps as CellProps)}\n ariaAttributes={{\n \"aria-colindex\": columnIndex + 1,\n role: \"gridcell\"\n }}\n columnIndex={columnIndex}\n key={\n columnKey\n ? columnKey({\n columnIndex,\n data: cellProps,\n rowIndex\n })\n : columnIndex\n }\n rowIndex={rowIndex}\n style={{\n position: \"absolute\",\n left: isRtl ? undefined : 0,\n right: isRtl ? 0 : undefined,\n transform: `translate(${isRtl ? -columnBounds.scrollOffset : columnBounds.scrollOffset}px, ${rowBounds.scrollOffset}px)`,\n height: rowBounds.size,\n width: columnBounds.size\n }}\n />\n );\n }\n\n children.push(\n <div\n key={\n rowKey\n ? rowKey({\n data: cellProps,\n rowIndex\n })\n : rowIndex\n }\n role=\"row\"\n aria-rowindex={rowIndex + 1}\n >\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnKey,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowKey,\n rowStartIndexOverscan,\n rowStopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedHeight(),\n width: getEstimatedWidth(),\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n \"aria-colcount\": columnCount,\n \"aria-rowcount\": rowCount,\n role: \"grid\",\n ...rest,\n className,\n dir,\n ref: setElement,\n style: {\n position: \"relative\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\",\n ...style\n }\n },\n cells,\n children,\n sizingElement\n );\n}\n","import { useState } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Grid component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useGridCallbackRef =\n useState as typeof useState<GridImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Grid component.\n */\nexport const useGridRef = useRef as typeof useRef<GridImperativeAPI>;\n","import { useEffect } from \"react\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport { useStableCallback } from \"./useStableCallback\";\n\n/**\n * Calls the callback once the initial ResizeObserver notifications for elements rendered within the specified element\n * have been delivered (or would have been, if ResizeObserver is unsupported).\n *\n * ResizeObserver notifications are delivered between layout and paint, so waiting two animation frames ensures\n * that a frame has been rendered since the elements were first observed.\n */\nexport function useAfterResizeObserverNotifications({\n callback,\n element,\n enabled = true\n}: {\n callback: () => void;\n element: HTMLElement | null;\n enabled?: boolean;\n}) {\n const stableCallback = useStableCallback(callback);\n\n useEffect(() => {\n if (!enabled || !element) {\n return;\n }\n\n const ownerWindow = getOwnerWindow(element);\n let id = ownerWindow.requestAnimationFrame(() => {\n id = ownerWindow.requestAnimationFrame(stableCallback);\n });\n\n return () => {\n ownerWindow.cancelAnimationFrame(id);\n };\n }, [element, enabled, stableCallback]);\n}\n","import type { DynamicRowHeight } from \"./types\";\n\nexport function isDynamicRowHeight(value: unknown): value is DynamicRowHeight {\n return (\n value != null &&\n typeof value === \"object\" &&\n \"getAverageRowHeight\" in value &&\n typeof value.getAverageRowHeight === \"function\"\n );\n}\n","import { useCallback, useRef, type RefObject } from \"react\";\nimport type { Bounds } from \"../../core/types\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { getOwnerWindow } from \"../../utils/getOwnerWindow\";\nimport type { Align } from \"../../types\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { ListImperativeAPI } from \"./types\";\n\nexport function useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n}: {\n element: HTMLDivElement | null;\n getCellBounds: (index: number) => Bounds;\n isDynamicRowHeight: boolean;\n rowCount: number;\n rowElements: RefObject<Element[]>;\n scrollToIndex: (options: {\n align?: Align;\n containerScrollOffset: number;\n index: number;\n }) => number | undefined;\n}): ListImperativeAPI[\"scrollToRow\"] {\n const pendingScroll = useRef<{\n align: Align;\n index: number;\n deadline: number;\n stableFrames: number;\n } | null>(null);\n\n // Track the window that scheduled the frame so it can be cancelled there.\n const scrollFrame = useRef<{ id: number; view: Window } | undefined>(\n undefined\n );\n\n const cancelScroll = useStableCallback(() => {\n pendingScroll.current = null;\n if (scrollFrame.current !== undefined) {\n scrollFrame.current.view.cancelAnimationFrame(scrollFrame.current.id);\n scrollFrame.current = undefined;\n }\n });\n\n // Use the list's own window (e.g. a popup rendered into via a portal),\n // since another window's frames may be throttled while it's in the background.\n const scheduleCorrectScroll = useStableCallback(() => {\n const view = getOwnerWindow(element);\n scrollFrame.current = {\n id: view.requestAnimationFrame(correctScroll),\n view\n };\n });\n\n const correctScroll = useStableCallback(() => {\n scrollFrame.current = undefined;\n const request = pendingScroll.current;\n if (!request) return;\n\n if (\n !element ||\n !isDynamicRowHeight ||\n request.index >= rowCount ||\n performance.now() >= request.deadline\n ) {\n cancelScroll();\n return;\n }\n\n const offset = scrollToIndex({\n align: request.align,\n containerScrollOffset: element.scrollTop,\n index: request.index\n });\n if (offset !== undefined) {\n // Use the committed DOM extent: the browser clamps offsets near the end.\n const top = Math.max(\n 0,\n Math.min(offset, element.scrollHeight - element.clientHeight)\n );\n if (Math.abs(top - element.scrollTop) > 1) {\n request.stableFrames = 0;\n element.scrollTo({ behavior: \"instant\", top });\n } else {\n // An unchanged estimated offset is not enough:\n // React may not have committed the destination rows or their ResizeObserver updates yet.\n const rows = rowElements.current;\n const targetIsRendered = rows.some(\n (row) =>\n row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX) === `${request.index}`\n );\n const measurementsCommitted =\n targetIsRendered &&\n rows.every((row) => {\n const index = Number(row.getAttribute(DATA_ATTRIBUTE_LIST_INDEX));\n // ResizeObserver reports untransformed border-box sizes.\n // offsetHeight uses the same coordinate space; allow for its integer rounding.\n return (\n Math.abs(\n getCellBounds(index).size - (row as HTMLElement).offsetHeight\n ) <= 1\n );\n });\n if (!measurementsCommitted) {\n request.stableFrames = 0;\n } else if (++request.stableFrames >= 2) {\n cancelScroll();\n return;\n }\n }\n }\n scheduleCorrectScroll();\n });\n\n useIsomorphicLayoutEffect(() => {\n if (!element) return;\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n case \" \": {\n cancelScroll();\n }\n }\n };\n\n element.addEventListener(\"wheel\", cancelScroll, { passive: true });\n element.addEventListener(\"touchstart\", cancelScroll, { passive: true });\n element.addEventListener(\"pointerdown\", cancelScroll);\n element.addEventListener(\"keydown\", onKeyDown);\n\n return () => {\n cancelScroll();\n\n element.removeEventListener(\"wheel\", cancelScroll);\n element.removeEventListener(\"touchstart\", cancelScroll);\n element.removeEventListener(\"pointerdown\", cancelScroll);\n element.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [cancelScroll, element]);\n\n return useCallback(\n ({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: Parameters<ListImperativeAPI[\"scrollToRow\"]>[0]) => {\n // Resolve smart alignment once, before measurements move the target.\n if (isDynamicRowHeight && align === \"smart\") {\n const autoOffset = scrollToIndex({\n align: \"auto\",\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n align = autoOffset === (element?.scrollTop ?? 0) ? \"auto\" : \"center\";\n }\n\n const top = scrollToIndex({\n align,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n\n cancelScroll();\n\n if (typeof element?.scrollTo === \"function\") {\n if (isDynamicRowHeight) {\n pendingScroll.current = {\n align,\n index,\n deadline: performance.now() + 1000,\n stableFrames: 0\n };\n scheduleCorrectScroll();\n }\n element.scrollTo({\n behavior: isDynamicRowHeight ? \"instant\" : behavior,\n top\n });\n }\n },\n [\n cancelScroll,\n element,\n isDynamicRowHeight,\n scheduleCorrectScroll,\n scrollToIndex\n ]\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n Fragment,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useAfterResizeObserverNotifications } from \"../../hooks/useAfterResizeObserverNotifications\";\nimport { useIsHydrating } from \"../../hooks/useIsHydrating\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\nimport { useScrollToRow } from \"./useScrollToRow\";\n\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\nexport const DATA_ATTRIBUTE_SIZER = \"data-react-window-sizer\";\n\n/**\n * Renders data with many rows.\n */\nexport function List<\n RowProps extends object,\n TagName extends TagNames = \"div\"\n>({\n children,\n className,\n defaultHeight = 0,\n defaultScrollOffset = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight: rowHeightProp,\n rowKey,\n rowProps: rowPropsUnstable,\n tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>): ReactElement {\n const rowProps = useMemoizedObject(rowPropsUnstable);\n const RowComponent = useMemo(\n () => memo(RowComponentProp, arePropsEqual),\n [RowComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isDynamicRowHeight = isDynamicRowHeightUtil(rowHeightProp);\n\n const rowHeight = useMemo(() => {\n if (isDynamicRowHeight) {\n return (index: number) => {\n return (\n rowHeightProp.getRowHeight(index) ??\n rowHeightProp.getAverageRowHeight()\n );\n };\n }\n\n return rowHeightProp;\n }, [isDynamicRowHeight, rowHeightProp]);\n\n // Server-rendered rows with dynamic heights haven't been measured yet, so absolutely positioning them\n // (based on estimated heights) would cause them to overlap or leave gaps until after hydration.\n // Instead, render them in normal document flow until the first measurements are available.\n const isHydrating = useIsHydrating();\n const [isFlowLayout, setIsFlowLayout] = useState(\n () => isHydrating && isDynamicRowHeight\n );\n const flowLayoutRowHeightRef = useRef(rowHeightProp);\n useIsomorphicLayoutEffect(() => {\n if (isFlowLayout && flowLayoutRowHeightRef.current !== rowHeightProp) {\n setIsFlowLayout(false);\n }\n }, [isFlowLayout, rowHeightProp]);\n // Measurements may never arrive (e.g. if ResizeObserver is unsupported or rows have no height yet),\n // or may exactly match initialRowHeights (in which case rowHeightProp's identity doesn't change)\n useAfterResizeObserverNotifications({\n callback: () => setIsFlowLayout(false),\n element,\n enabled: isFlowLayout\n });\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n defaultScrollOffset,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount\n });\n\n const rowElements = useRef<Element[]>([]);\n const scrollToRow = useScrollToRow({\n element,\n getCellBounds,\n isDynamicRowHeight,\n rowCount,\n rowElements,\n scrollToIndex\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n scrollToRow\n }),\n [element, scrollToRow]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n // Additional children (e.g. overlays) are not rows and must not be measured.\n const rows = Array.from(element.children)\n .slice(\n 0,\n startIndexOverscan < 0 ? 0 : stopIndexOverscan - startIndexOverscan + 1\n )\n .filter((item, index) => {\n if (item.hasAttribute(DATA_ATTRIBUTE_SIZER)) {\n // Ignore sizing element\n return false;\n }\n\n const attribute = `${startIndexOverscan + index}`;\n item.setAttribute(DATA_ATTRIBUTE_LIST_INDEX, attribute);\n\n return true;\n });\n\n rowElements.current = rows;\n\n if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n RowComponent,\n element,\n isDynamicRowHeight,\n rowCount,\n rowHeightProp,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n useEffect(() => {\n if (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onRowsRendered) {\n onRowsRendered(\n {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n },\n {\n startIndex: startIndexOverscan,\n stopIndex: stopIndexOverscan\n }\n );\n }\n }, [\n onRowsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n // Flow layout only matches the absolute layout if rendering starts at the first row\n const isFlowLayoutActive =\n isFlowLayout && isDynamicRowHeight && startIndexOverscan === 0;\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n ariaAttributes={{\n \"aria-posinset\": index + 1,\n \"aria-setsize\": rowCount,\n role: \"listitem\"\n }}\n key={rowKey ? rowKey(index, rowProps) : index}\n index={index}\n style={\n isFlowLayoutActive\n ? { width: \"100%\" }\n : {\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n // In case of dynamic row heights, don't specify a height style\n // otherwise a default/estimated height would mask the actual height\n height: isDynamicRowHeight ? undefined : bounds.size,\n width: \"100%\"\n }\n }\n />\n );\n }\n }\n return children;\n }, [\n RowComponent,\n getCellBounds,\n isDynamicRowHeight,\n isFlowLayoutActive,\n rowCount,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n key=\"sizer\"\n {...{ [DATA_ATTRIBUTE_SIZER]: \"\" }}\n style={{\n // Rows rendered in flow layout already take up space\n position: isFlowLayoutActive ? \"absolute\" : undefined,\n top: isFlowLayoutActive ? 0 : undefined,\n height: getEstimatedSize(),\n width: \"100%\",\n zIndex: -1\n }}\n ></div>\n );\n\n const childrenElement = <Fragment key=\"children\">{children}</Fragment>;\n const rowsElement = <Fragment key=\"rows\">{rows}</Fragment>;\n\n return createElement(\n tagName,\n {\n role: \"list\",\n ...rest,\n className,\n ref: setElement,\n style: {\n position: \"relative\",\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\",\n ...style\n }\n },\n // Rows rendered in flow layout would push children (e.g. sticky rows) below them, so render children first.\n // Keys let React move children (rather than remounting them) once rows switch to absolute layout.\n ...(isFlowLayoutActive\n ? [childrenElement, rowsElement]\n : [rowsElement, childrenElement]),\n sizingElement\n );\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { assert } from \"../../utils/assert\";\nimport { getOwnerWindow } from \"../../utils/getOwnerWindow\";\nimport { getResizeObserverClass } from \"../../utils/getResizeObserverClass\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"./List\";\nimport type { DynamicRowHeight } from \"./types\";\n\nfunction createInitialMap(\n initialRowHeights: ReadonlyMap<number, number> | readonly number[] | undefined\n): Map<number, number> {\n const map = new Map<number, number>();\n if (initialRowHeights !== undefined) {\n // Invalid heights would corrupt cached row positions; treat them as unmeasured\n initialRowHeights.forEach((height: number, index: number) => {\n if (Number.isFinite(height) && height > 0) {\n map.set(index, height);\n }\n });\n }\n return map;\n}\n\nexport function useDynamicRowHeight({\n defaultRowHeight,\n initialRowHeights,\n key\n}: {\n /**\n * Estimated height (in pixels) of rows that have not yet been measured.\n */\n defaultRowHeight: number;\n\n /**\n * Row heights (in pixels) that are known or can be estimated ahead of time, e.g. estimated from each row's content.\n * This can be either an array (where each item is the height of the row at that index) or a Map of row index to height.\n *\n * These values are used in place of `defaultRowHeight` until rows are rendered and measured,\n * so providing them can make server-rendered lists and initial scroll positions more accurate.\n *\n * ℹ️ This value is only read when the hook first mounts and when the `key` changes.\n */\n initialRowHeights?: ReadonlyMap<number, number> | readonly number[];\n\n /**\n * Changing this value clears all measured row heights,\n * e.g. when the list renders a different set of data.\n */\n key?: string | number;\n}) {\n const [state, setState] = useState<{\n key: string | number | undefined;\n map: Map<number, number>;\n }>(() => ({\n key,\n map: createInitialMap(initialRowHeights)\n }));\n\n if (state.key !== key) {\n setState({\n key,\n map: createInitialMap(initialRowHeights)\n });\n }\n\n const { map } = state;\n\n const getAverageRowHeight = useCallback(() => {\n let totalHeight = 0;\n\n map.forEach((height) => {\n totalHeight += height;\n });\n\n if (totalHeight === 0) {\n return defaultRowHeight;\n }\n\n return totalHeight / map.size;\n }, [defaultRowHeight, map]);\n\n const getRowHeight = useCallback(\n (index: number) => {\n const measuredHeight = map.get(index);\n if (measuredHeight !== undefined) {\n return measuredHeight;\n }\n\n // Keep estimates stable when rowProps change (see issue #863), but do not\n // store them as measurements or include them in the measured average.\n return defaultRowHeight;\n },\n [defaultRowHeight, map]\n );\n\n const setRowHeight = useCallback((index: number, size: number) => {\n setState((prevState) => {\n if (prevState.map.get(index) === size) {\n return prevState;\n }\n\n const clonedMap = new Map(prevState.map);\n clonedMap.set(index, size);\n\n return {\n ...prevState,\n map: clonedMap\n };\n });\n }, []);\n\n const resizeObserverCallback = useStableCallback(\n (entries: ResizeObserverEntry[]) => {\n if (entries.length === 0) {\n return;\n }\n\n entries.forEach((entry) => {\n const { borderBoxSize, target } = entry;\n\n const attribute = target.getAttribute(DATA_ATTRIBUTE_LIST_INDEX);\n assert(\n attribute !== null,\n `Invalid ${DATA_ATTRIBUTE_LIST_INDEX} attribute value`\n );\n\n const index = parseInt(attribute);\n\n const { blockSize: height } = borderBoxSize[0];\n if (!height) {\n // Ignore heights that have not yet been measured (e.g. <img> elements that have not yet loaded)\n return;\n }\n\n setRowHeight(index, height);\n });\n }\n );\n\n // Rows may be rendered into another window (e.g. a popup rendered into via a portal),\n // and observers only report on elements in documents they belong to\n const resizeObserverRef = useRef<{\n resizeObserver: ResizeObserver;\n view: Window;\n } | null>(null);\n\n useEffect(\n () => () => {\n resizeObserverRef.current?.resizeObserver.disconnect();\n resizeObserverRef.current = null;\n },\n []\n );\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n const observed: [Element, ResizeObserver][] = [];\n\n elements.forEach((element) => {\n const view = getOwnerWindow(element);\n\n // Rows from one list share a window, so this only happens if the list moves to another window\n if (resizeObserverRef.current?.view !== view) {\n resizeObserverRef.current?.resizeObserver.disconnect();\n\n const ResizeObserverClass = getResizeObserverClass(element);\n resizeObserverRef.current = ResizeObserverClass\n ? {\n resizeObserver: new ResizeObserverClass(resizeObserverCallback),\n view\n }\n : null;\n }\n\n const resizeObserver = resizeObserverRef.current?.resizeObserver;\n if (resizeObserver) {\n resizeObserver.observe(element);\n observed.push([element, resizeObserver]);\n }\n });\n\n return () => {\n observed.forEach(([element, resizeObserver]) =>\n resizeObserver.unobserve(element)\n );\n };\n },\n [resizeObserverCallback]\n );\n\n return useMemo<DynamicRowHeight>(\n () => ({\n getAverageRowHeight,\n getRowHeight,\n setRowHeight,\n observeRowElements\n }),\n [getAverageRowHeight, getRowHeight, setRowHeight, observeRowElements]\n );\n}\n","import { useState } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the List component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useListCallbackRef =\n useState as typeof useState<ListImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the List component.\n */\nexport const useListRef = useRef as typeof useRef<ListImperativeAPI>;\n","// Cache per document, since windows may differ (e.g. custom scrollbar styles in a popup)\nconst cache = new WeakMap<Document, number>();\n\nexport function getScrollbarSize(\n recalculate: boolean = false,\n ownerDocument: Document | undefined = typeof document !== \"undefined\"\n ? document\n : undefined\n): number {\n if (ownerDocument === undefined) {\n // Scrollbar size can't be measured during server rendering\n return 0;\n }\n\n let size = cache.get(ownerDocument);\n if (size === undefined || recalculate) {\n const div = ownerDocument.createElement(\"div\");\n const style = div.style;\n style.width = \"50px\";\n style.height = \"50px\";\n style.overflow = \"scroll\";\n\n ownerDocument.body.appendChild(div);\n\n size = div.offsetWidth - div.clientWidth;\n\n ownerDocument.body.removeChild(div);\n\n cache.set(ownerDocument, size);\n }\n\n return size;\n}\n\nexport function setScrollbarSizeForTests(\n value: number,\n ownerDocument: Document = document\n) {\n cache.set(ownerDocument, value);\n}\n"],"names":["useIsomorphicLayoutEffect","useLayoutEffect","useEffect","isRtl","element","currentElement","useIsRtl","dir","value","setValue","useState","subscribe","useIsHydrating","useSyncExternalStore","getOwnerWindow","getResizeObserverClass","parseNumericStyleValue","useResizeObserver","box","defaultHeight","defaultWidth","disabledProp","mode","style","styleHeight","styleWidth","useMemo","state","setState","disabled","ResizeObserverClass","resizeObserver","entries","entry","contentRect","target","prevState","useStableCallback","fn","ref","useRef","useCallback","args","cache","getRTLOffsetType","recalculate","ownerDocument","cachedRTLResult","outerDiv","outerStyle","innerDiv","innerStyle","adjustScrollOffsetForRtl","containerElement","direction","scrollOffset","clientWidth","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","isVisible","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","low","high","middle","createCachedBounds","itemProps","currentIndex","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","defaultScrollOffset","onResize","height","width","prevSizeRef","prevSize","isHydrating","initialScrollOffset","getCellBounds","indices","setIndices","getStartStopIndicesUtil","startIndexOverscan","stopIndexOverscan","getEstimatedSizeUtil","hasAppliedDefaultScrollOffsetRef","isRtlContainer","isRtlUtil","next","prev","onScroll","scrollLeft","scrollTop","scrollToIndex","useMemoizedObject","unstableObject","memoizedObject","setMemoizedObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnKey","columnWidth","defaultScrollLeft","defaultScrollTop","gridRef","onCellsRendered","rowCount","rowHeight","rowKey","tagName","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndexOverscan","columnStartIndexVisible","scrollToColumnIndex","columnStopIndexOverscan","columnStopIndexVisible","getRowBounds","getEstimatedHeight","rowStartIndexOverscan","rowStartIndexVisible","scrollToRowIndex","rowStopIndexOverscan","rowStopIndexVisible","useImperativeHandle","behavior","columnAlign","columnIndex","rowAlign","rowIndex","left","top","cells","rowBounds","columns","columnBounds","createElement","jsx","sizingElement","useGridCallbackRef","useGridRef","useAfterResizeObserverNotifications","callback","enabled","stableCallback","ownerWindow","id","isDynamicRowHeight","useScrollToRow","rowElements","pendingScroll","scrollFrame","cancelScroll","scheduleCorrectScroll","view","correctScroll","request","offset","rows","row","DATA_ATTRIBUTE_LIST_INDEX","onKeyDown","event","DATA_ATTRIBUTE_SIZER","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","isFlowLayout","setIsFlowLayout","flowLayoutRowHeightRef","scrollToRow","item","attribute","isFlowLayoutActive","childrenElement","Fragment","rowsElement","createInitialMap","initialRowHeights","map","useDynamicRowHeight","defaultRowHeight","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","resizeObserverRef","observeRowElements","elements","observed","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":";;;AAEO,MAAMA,IACX,OAAO,SAAW,MAAcC,KAAkBC;ACH7C,SAASC,GAAMC,GAAsB;AAC1C,MAAIC,IAAqCD;AACzC,SAAOC,KAAgB;AACrB,QAAIA,EAAe;AACjB,aAAOA,EAAe,QAAQ;AAGhC,IAAAA,IAAiBA,EAAe;AAAA,EAClC;AAEA,SAAO;AACT;ACPO,SAASC,GACdF,GACAG,GACA;AACA,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAASH,MAAQ,KAAK;AAEhD,SAAAP,EAA0B,MAAM;AAC9B,IAAIO,IACFE,EAASF,MAAQ,KAAK,IACbH,KACTK,EAASN,GAAMC,CAAO,CAAC;AAAA,EAE3B,GAAG,CAACG,GAAKH,CAAO,CAAC,GAEVI;AACT;ACjBA,SAASG,KAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;AAMO,SAASC,KAA0B;AACxC,SAAOC;AAAA,IACLF;AAAA,IACA,MAAM;AAAA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;AAAA,IAAA;AAAA,IAEF,CAACT,GAAqBE,GAAcE,GAAcK,CAAkB;AAAA,EAAA;AAExE;AC/LO,MAAMG,KACX7O,GCHW8O,KAAahN,GCLpBG,yBAAY,QAAA;AAEX,SAAS8M,GACd5M,IAAuB,IACvBC,IAAsC,OAAO,WAAa,MACtD,WACA,QACI;AACR,MAAIA,MAAkB;AAEpB,WAAO;AAGT,MAAI6C,IAAOhD,GAAM,IAAIG,CAAa;AAClC,MAAI6C,MAAS,UAAa9C,GAAa;AACrC,UAAM6M,IAAM5M,EAAc,cAAc,KAAK,GACvCvB,IAAQmO,EAAI;AAClB,IAAAnO,EAAM,QAAQ,QACdA,EAAM,SAAS,QACfA,EAAM,WAAW,UAEjBuB,EAAc,KAAK,YAAY4M,CAAG,GAElC/J,IAAO+J,EAAI,cAAcA,EAAI,aAE7B5M,EAAc,KAAK,YAAY4M,CAAG,GAElC/M,GAAM,IAAIG,GAAe6C,CAAI;AAAA,EAC/B;AAEA,SAAOA;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-window",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
|
|
6
6
|
"contributors": [
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
|
+
"react-lib-tools": {
|
|
22
|
+
"devServerPort": 3100
|
|
23
|
+
},
|
|
21
24
|
"scripts": {
|
|
22
25
|
"dev": "vite",
|
|
23
26
|
"dev:integrations": "pnpm run /^dev:integrations:.*/",
|
|
@@ -32,7 +35,7 @@
|
|
|
32
35
|
"compile:examples": "tsx ./scripts/compile-examples",
|
|
33
36
|
"compile:search-index": "tsx ./scripts/compile-search-index",
|
|
34
37
|
"compress:og-image": "tsx ./scripts/compress-og-image",
|
|
35
|
-
"e2e:install": "pnpm -C integrations/tests exec playwright install --with-deps",
|
|
38
|
+
"e2e:install": "pnpm -C integrations/tests exec playwright install --with-deps chromium",
|
|
36
39
|
"e2e:test": "pnpm -C integrations/tests run test",
|
|
37
40
|
"lint": "eslint .",
|
|
38
41
|
"prerelease": "rm -rf dist && pnpm run build:lib",
|
|
@@ -89,7 +92,7 @@
|
|
|
89
92
|
"react-docgen-typescript": "^2.4.0",
|
|
90
93
|
"react-dom": "^19.2.3",
|
|
91
94
|
"react-error-boundary": "^6.0.0",
|
|
92
|
-
"react-lib-tools": "0.0.
|
|
95
|
+
"react-lib-tools": "^0.0.66",
|
|
93
96
|
"react-router-dom": "^7.6.3",
|
|
94
97
|
"rollup-plugin-terser": "^7.0.2",
|
|
95
98
|
"rollup-plugin-visualizer": "^6.0.3",
|