react-window 2.2.3 → 2.2.4
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 +24 -13
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.d.ts +23 -20
- package/dist/react-window.js.map +1 -1
- package/package.json +17 -15
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="https://react-window.vercel.app/og.svg" alt="react-window logo" width="400" height="210" />
|
|
2
2
|
|
|
3
3
|
`react-window` is a component library that helps render large lists of data quickly and without the performance problems that often go along with rendering a lot of data. It's used in a lot of places, from React DevTools to the Replay browser.
|
|
4
4
|
|
|
@@ -28,15 +28,23 @@ npm install react-window
|
|
|
28
28
|
|
|
29
29
|
TypeScript definitions are included within the published `dist` folder
|
|
30
30
|
|
|
31
|
+
## FAQs
|
|
32
|
+
|
|
33
|
+
Frequently asked questions can be found [here](https://react-window.vercel.app/common-questions).
|
|
34
|
+
|
|
31
35
|
## Documentation
|
|
32
36
|
|
|
33
37
|
Documentation for this project is available at [react-window.vercel.app](https://react-window.vercel.app/); version 1.x documentation can be found at [react-window-v1.vercel.app](https://react-window-v1.vercel.app/).
|
|
34
38
|
|
|
35
39
|
### List
|
|
36
40
|
|
|
41
|
+
<!-- List:description:begin -->
|
|
42
|
+
Renders data with many rows.
|
|
43
|
+
<!-- List:description:end -->
|
|
44
|
+
|
|
37
45
|
#### Required props
|
|
38
46
|
|
|
39
|
-
<!-- List:required:begin -->
|
|
47
|
+
<!-- List:required-props:begin -->
|
|
40
48
|
|
|
41
49
|
<table>
|
|
42
50
|
<thead>
|
|
@@ -82,11 +90,11 @@ List will automatically re-render rows when values in this object change.</p>
|
|
|
82
90
|
</tbody>
|
|
83
91
|
</table>
|
|
84
92
|
|
|
85
|
-
<!-- List:required:end -->
|
|
93
|
+
<!-- List:required-props:end -->
|
|
86
94
|
|
|
87
95
|
#### Optional props
|
|
88
96
|
|
|
89
|
-
<!-- List:optional:begin -->
|
|
97
|
+
<!-- List:optional-props:begin -->
|
|
90
98
|
|
|
91
99
|
<table>
|
|
92
100
|
<thead>
|
|
@@ -153,13 +161,17 @@ The default value is "div", meaning that List renders an HTMLDivElemen
|
|
|
153
161
|
</tbody>
|
|
154
162
|
</table>
|
|
155
163
|
|
|
156
|
-
<!-- List:optional:end -->
|
|
164
|
+
<!-- List:optional-props:end -->
|
|
157
165
|
|
|
158
166
|
### Grid
|
|
159
167
|
|
|
168
|
+
<!-- Grid:description:begin -->
|
|
169
|
+
Renders data with many rows and columns.
|
|
170
|
+
<!-- Grid:description:end -->
|
|
171
|
+
|
|
160
172
|
#### Required props
|
|
161
173
|
|
|
162
|
-
<!-- Grid:required:begin -->
|
|
174
|
+
<!-- Grid:required-props:begin -->
|
|
163
175
|
|
|
164
176
|
<table>
|
|
165
177
|
<thead>
|
|
@@ -217,11 +229,11 @@ Grid will automatically re-render cells when values in this object change.</p>
|
|
|
217
229
|
</tbody>
|
|
218
230
|
</table>
|
|
219
231
|
|
|
220
|
-
<!-- Grid:required:end -->
|
|
232
|
+
<!-- Grid:required-props:end -->
|
|
221
233
|
|
|
222
234
|
#### Optional props
|
|
223
235
|
|
|
224
|
-
<!-- Grid:optional:begin -->
|
|
236
|
+
<!-- Grid:optional-props:begin -->
|
|
225
237
|
|
|
226
238
|
<table>
|
|
227
239
|
<thead>
|
|
@@ -238,8 +250,8 @@ Grid will automatically re-render cells when values in this object change.</p>
|
|
|
238
250
|
</tr>
|
|
239
251
|
<tr>
|
|
240
252
|
<td>dir</td>
|
|
241
|
-
<td><p>
|
|
242
|
-
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir">
|
|
253
|
+
<td><p>Indicates the directionality of grid cells.</p>
|
|
254
|
+
<p>ℹ️ See HTML <code>dir</code> <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir">global attribute</a> for more information.</p>
|
|
243
255
|
</td>
|
|
244
256
|
</tr>
|
|
245
257
|
<tr>
|
|
@@ -268,8 +280,7 @@ This value is important for server rendering.</p>
|
|
|
268
280
|
</tr>
|
|
269
281
|
<tr>
|
|
270
282
|
<td>gridRef</td>
|
|
271
|
-
<td><p>
|
|
272
|
-
<p>This API has imperative methods for scrolling and a getter for the outermost DOM element.</p>
|
|
283
|
+
<td><p>Imperative Grid API.</p>
|
|
273
284
|
<p>ℹ️ The <code>useGridRef</code> and <code>useGridCallbackRef</code> hooks are exported for convenience use in TypeScript projects.</p>
|
|
274
285
|
</td>
|
|
275
286
|
</tr>
|
|
@@ -300,4 +311,4 @@ The default value is "div", meaning that List renders an HTMLDivElemen
|
|
|
300
311
|
</tbody>
|
|
301
312
|
</table>
|
|
302
313
|
|
|
303
|
-
<!-- Grid:optional:end -->
|
|
314
|
+
<!-- Grid:optional-props:end -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-window.cjs","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/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 (element) {\n if (!dir) {\n setValue(isRtl(element));\n }\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, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return {\n const ref = useRef<typeof fn>(() => {\n throw new Error(\"Cannot call during render.\");\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, scrollLeft, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollLeft;\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.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 const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const bounds = cachedBounds.get(index);\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 if (align === \"smart\") {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n align = \"auto\";\n } else {\n align = \"center\";\n }\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n if (bounds.scrollOffset <= containerSize / 2) {\n // Too near the beginning to center-align\n return 0;\n } else if (\n bounds.scrollOffset + bounds.size / 2 >=\n estimatedTotalSize - containerSize / 2\n ) {\n // Too near the end to center-align\n return estimatedTotalSize - containerSize;\n } else {\n return bounds.scrollOffset + bounds.size / 2 - containerSize / 2;\n }\n }\n case \"auto\":\n default: {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\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 let startIndexVisible = 0;\n let stopIndexVisible = -1;\n let startIndexOverscan = 0;\n let stopIndexOverscan = -1;\n let currentIndex = 0;\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n break;\n }\n\n currentIndex++;\n }\n\n startIndexVisible = currentIndex;\n startIndexOverscan = Math.max(0, startIndexVisible - overscanCount);\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n ) {\n break;\n }\n\n currentIndex++;\n }\n\n stopIndexVisible = Math.min(maxIndex, currentIndex);\n stopIndexOverscan = Math.min(itemCount - 1, stopIndexVisible + overscanCount);\n\n if (startIndexVisible < 0) {\n startIndexVisible = 0;\n stopIndexVisible = -1;\n startIndexOverscan = 0;\n stopIndexOverscan = -1;\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan,\n stopIndexOverscan\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 get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n let size: number;\n switch (typeof itemSize) {\n case \"function\": {\n size = itemSize(currentIndex, itemProps);\n break;\n }\n case \"number\": {\n size = itemSize;\n break;\n }\n }\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 * parseInt(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 [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>({\n startIndexVisible: 0,\n startIndexOverscan: 0,\n stopIndexVisible: -1,\n stopIndexOverscan: -1\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 { 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 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 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,\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 { useMemo } from \"react\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n return useMemo(() => {\n return unstableObject;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, Object.values(unstableObject));\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","import {\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\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 columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\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={columnIndex}\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 key={rowIndex} role=\"row\" aria-rowindex={rowIndex + 1}>\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\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 width: \"100%\",\n height: \"100%\",\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 {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\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 { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\n\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\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 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 useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\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 = scrollToIndex({\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, scrollToIndex]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n const rows = Array.from(element.children).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 if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n element,\n isDynamicRowHeight,\n rowHeightProp,\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={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 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 // Temporarily store default height in the cache map to avoid scroll jumps if rowProps change\n // Else rowProps changes can impact the average height, and cause rows to shift up or down within the list\n // see github.com/bvaughn/react-window/issues/863\n map.set(index, defaultRowHeight);\n\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 () => new ResizeObserver(resizeObserverCallback)\n );\n\n useEffect(() => {\n return () => {\n resizeObserver.disconnect();\n };\n }, [resizeObserver]);\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n elements.forEach((element) => resizeObserver.observe(element));\n return () => {\n elements.forEach((element) => resizeObserver.unobserve(element));\n };\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","scrollLeft","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","startIndexOverscan","stopIndexOverscan","currentIndex","createCachedBounds","itemProps","cache","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","indices","setIndices","height","width","prevSizeRef","prevSize","getCellBounds","getEstimatedSizeUtil","getStartStopIndicesUtil","onScroll","prev","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","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","DATA_ATTRIBUTE_LIST_INDEX","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","rows","item","attribute","useDynamicRowHeight","defaultRowHeight","map","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","observeRowElements","elements","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"wIAAO,SAASA,GAAMC,EAAsB,CAC1C,IAAIC,EAAqCD,EACzC,KAAOC,GAAgB,CACrB,GAAIA,EAAe,IACjB,OAAOA,EAAe,MAAQ,MAGhCA,EAAiBA,EAAe,aAClC,CAEA,MAAO,EACT,CCRO,SAASC,GACdF,EACAG,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAASH,IAAQ,KAAK,EAEhDI,OAAAA,EAAAA,gBAAgB,IAAM,CAChBP,IACGG,GACHE,EAASN,GAAMC,CAAO,CAAC,EAG7B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CChBO,MAAMI,EACX,OAAO,OAAW,IAAcD,EAAAA,gBAAkBE,EAAAA,UCD7C,SAASC,EACdN,EACoB,CACpB,GAAIA,IAAU,OACZ,OAAQ,OAAOA,EAAA,CACb,IAAK,SACH,OAAOA,EAET,IAAK,SAAU,CACb,GAAIA,EAAM,SAAS,IAAI,EACrB,OAAO,WAAWA,CAAK,EAEzB,KACF,CAAA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SAEjB,SAAS,KAAK,YAAYiL,CAAG,EAE7BhH,EAAOgH,EAAI,YAAcA,EAAI,YAE7B,SAAS,KAAK,YAAYA,CAAG,CAC/B,CAEA,OAAOhH,CACT"}
|
|
1
|
+
{"version":3,"file":"react-window.cjs","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/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 (element) {\n if (!dir) {\n setValue(isRtl(element));\n }\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, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return {\n const ref = useRef<typeof fn>(() => {\n throw new Error(\"Cannot call during render.\");\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, scrollLeft, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollLeft;\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.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 const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const bounds = cachedBounds.get(index);\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 if (align === \"smart\") {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n align = \"auto\";\n } else {\n align = \"center\";\n }\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n if (bounds.scrollOffset <= containerSize / 2) {\n // Too near the beginning to center-align\n return 0;\n } else if (\n bounds.scrollOffset + bounds.size / 2 >=\n estimatedTotalSize - containerSize / 2\n ) {\n // Too near the end to center-align\n return estimatedTotalSize - containerSize;\n } else {\n return bounds.scrollOffset + bounds.size / 2 - containerSize / 2;\n }\n }\n case \"auto\":\n default: {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\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 let startIndexVisible = 0;\n let stopIndexVisible = -1;\n let startIndexOverscan = 0;\n let stopIndexOverscan = -1;\n let currentIndex = 0;\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n break;\n }\n\n currentIndex++;\n }\n\n startIndexVisible = currentIndex;\n startIndexOverscan = Math.max(0, startIndexVisible - overscanCount);\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n ) {\n break;\n }\n\n currentIndex++;\n }\n\n stopIndexVisible = Math.min(maxIndex, currentIndex);\n stopIndexOverscan = Math.min(itemCount - 1, stopIndexVisible + overscanCount);\n\n if (startIndexVisible < 0) {\n startIndexVisible = 0;\n stopIndexVisible = -1;\n startIndexOverscan = 0;\n stopIndexOverscan = -1;\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan,\n stopIndexOverscan\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 get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n let size: number;\n switch (typeof itemSize) {\n case \"function\": {\n size = itemSize(currentIndex, itemProps);\n break;\n }\n case \"number\": {\n size = itemSize;\n break;\n }\n }\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 * parseInt(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 [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>({\n startIndexVisible: 0,\n startIndexOverscan: 0,\n stopIndexVisible: -1,\n stopIndexOverscan: -1\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 { 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 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 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,\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 { useMemo } from \"react\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n return useMemo(() => {\n return unstableObject;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, Object.values(unstableObject));\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","import {\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 */\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 columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\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={columnIndex}\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 key={rowIndex} role=\"row\" aria-rowindex={rowIndex + 1}>\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\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 width: \"100%\",\n height: \"100%\",\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 {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\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 { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\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 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 useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\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 = scrollToIndex({\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, scrollToIndex]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n const rows = Array.from(element.children).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 if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n element,\n isDynamicRowHeight,\n rowHeightProp,\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={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 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 // Temporarily store default height in the cache map to avoid scroll jumps if rowProps change\n // Else rowProps changes can impact the average height, and cause rows to shift up or down within the list\n // see github.com/bvaughn/react-window/issues/863\n map.set(index, defaultRowHeight);\n\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 () => new ResizeObserver(resizeObserverCallback)\n );\n\n useEffect(() => {\n return () => {\n resizeObserver.disconnect();\n };\n }, [resizeObserver]);\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n elements.forEach((element) => resizeObserver.observe(element));\n return () => {\n elements.forEach((element) => resizeObserver.unobserve(element));\n };\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","scrollLeft","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","startIndexOverscan","stopIndexOverscan","currentIndex","createCachedBounds","itemProps","cache","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","indices","setIndices","height","width","prevSizeRef","prevSize","getCellBounds","getEstimatedSizeUtil","getStartStopIndicesUtil","onScroll","prev","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","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","DATA_ATTRIBUTE_LIST_INDEX","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","rows","item","attribute","useDynamicRowHeight","defaultRowHeight","map","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","observeRowElements","elements","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":"wIAAO,SAASA,GAAMC,EAAsB,CAC1C,IAAIC,EAAqCD,EACzC,KAAOC,GAAgB,CACrB,GAAIA,EAAe,IACjB,OAAOA,EAAe,MAAQ,MAGhCA,EAAiBA,EAAe,aAClC,CAEA,MAAO,EACT,CCRO,SAASC,GACdF,EACAG,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAASH,IAAQ,KAAK,EAEhDI,OAAAA,EAAAA,gBAAgB,IAAM,CAChBP,IACGG,GACHE,EAASN,GAAMC,CAAO,CAAC,EAG7B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CChBO,MAAMI,EACX,OAAO,OAAW,IAAcD,EAAAA,gBAAkBE,EAAAA,UCD7C,SAASC,EACdN,EACoB,CACpB,GAAIA,IAAU,OACZ,OAAQ,OAAOA,EAAA,CACb,IAAK,SACH,OAAOA,EAET,IAAK,SAAU,CACb,GAAIA,EAAM,SAAS,IAAI,EACrB,OAAO,WAAWA,CAAK,EAEzB,KACF,CAAA,CAGN,CCdO,SAASO,GAAkB,CAChC,IAAAC,EACA,cAAAC,EACA,aAAAC,EACA,SAAUC,EACV,QAAAf,EACA,KAAAgB,EACA,MAAAC,CACF,EAQG,CACD,KAAM,CAAE,YAAAC,EAAa,WAAAC,CAAA,EAAeC,EAAAA,QAClC,KAAO,CACL,YAAaV,EAAuBO,GAAO,MAAM,EACjD,WAAYP,EAAuBO,GAAO,KAAK,CAAA,GAEjD,CAACA,GAAO,OAAQA,GAAO,KAAK,CAAA,EAGxB,CAACI,EAAOC,CAAQ,EAAIhB,WAGvB,CACD,OAAQO,E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E1B,CAAE,UAAWpF,GAAW+F,EAAc,CAAC,EACxC/F,GAKL4F,EAAaxH,EAAO4B,CAAM,CAC5B,CAAC,CACH,CAAA,EAGI,CAACrE,CAAc,EAAIlB,EAAAA,SACvB,IAAM,IAAI,eAAeqL,CAAsB,CAAA,EAGjDlL,EAAAA,UAAU,IACD,IAAM,CACXe,EAAe,WAAA,CACjB,EACC,CAACA,CAAc,CAAC,EAEnB,MAAMqK,EAAqB3J,EAAAA,YACxB4J,IACCA,EAAS,QAAS9L,GAAYwB,EAAe,QAAQxB,CAAO,CAAC,EACtD,IAAM,CACX8L,EAAS,QAAS9L,GAAYwB,EAAe,UAAUxB,CAAO,CAAC,CACjE,GAEF,CAACwB,CAAc,CAAA,EAGjB,OAAOJ,EAAAA,QACL,KAAO,CACL,oBAAAiK,EACA,aAAAE,EACA,aAAAE,EACA,mBAAAI,CAAA,GAEF,CAACR,EAAqBE,EAAcE,EAAcI,CAAkB,CAAA,CAExE,CC9HO,MAAME,GACXzL,EAAAA,SCHW0L,GAAa/J,EAAAA,OCN1B,IAAIiD,EAAe,GAEZ,SAAS+G,GAAiB3J,EAAuB,GAAe,CACrE,GAAI4C,IAAS,IAAM5C,EAAa,CAC9B,MAAM4J,EAAM,SAAS,cAAc,KAAK,EAClCjL,EAAQiL,EAAI,MAClBjL,EAAM,MAAQ,OACdA,EAAM,OAAS,OACfA,EAAM,SAAW,SAEjB,SAAS,KAAK,YAAYiL,CAAG,EAE7BhH,EAAOgH,EAAI,YAAcA,EAAI,YAE7B,SAAS,KAAK,YAAYA,CAAG,CAC/B,CAEA,OAAOhH,CACT"}
|
package/dist/react-window.d.ts
CHANGED
|
@@ -35,6 +35,9 @@ declare type ForbiddenKeys_2 = "ariaAttributes" | "index" | "style";
|
|
|
35
35
|
|
|
36
36
|
export declare function getScrollbarSize(recalculate?: boolean): number;
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Renders data with many rows and columns.
|
|
40
|
+
*/
|
|
38
41
|
export declare function Grid<CellProps extends object, TagName extends TagNames = "div">({ cellComponent: CellComponentProp, cellProps: cellPropsUnstable, children, className, columnCount, columnWidth, defaultHeight, defaultWidth, dir, gridRef, onCellsRendered, onResize, overscanCount, rowCount, rowHeight, style, tagName, ...rest }: GridProps<CellProps, TagName>): ReactElement;
|
|
39
42
|
|
|
40
43
|
/**
|
|
@@ -44,7 +47,7 @@ export declare function Grid<CellProps extends object, TagName extends TagNames
|
|
|
44
47
|
*
|
|
45
48
|
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience use in TypeScript projects.
|
|
46
49
|
*/
|
|
47
|
-
export declare
|
|
50
|
+
export declare interface GridImperativeAPI {
|
|
48
51
|
/**
|
|
49
52
|
* Outermost HTML element for the grid if mounted and null (if not mounted.
|
|
50
53
|
*/
|
|
@@ -60,13 +63,13 @@ export declare type GridImperativeAPI = {
|
|
|
60
63
|
*
|
|
61
64
|
* @throws RangeError if an invalid row or column index is provided
|
|
62
65
|
*/
|
|
63
|
-
scrollToCell({ behavior, columnAlign, columnIndex, rowAlign, rowIndex }: {
|
|
66
|
+
scrollToCell: ({ behavior, columnAlign, columnIndex, rowAlign, rowIndex }: {
|
|
64
67
|
behavior?: "auto" | "instant" | "smooth";
|
|
65
68
|
columnAlign?: "auto" | "center" | "end" | "smart" | "start";
|
|
66
69
|
columnIndex: number;
|
|
67
70
|
rowAlign?: "auto" | "center" | "end" | "smart" | "start";
|
|
68
71
|
rowIndex: number;
|
|
69
|
-
})
|
|
72
|
+
}) => void;
|
|
70
73
|
/**
|
|
71
74
|
* Scrolls the grid so that the specified column is visible.
|
|
72
75
|
*
|
|
@@ -76,11 +79,11 @@ export declare type GridImperativeAPI = {
|
|
|
76
79
|
*
|
|
77
80
|
* @throws RangeError if an invalid column index is provided
|
|
78
81
|
*/
|
|
79
|
-
scrollToColumn({ align, behavior, index }: {
|
|
82
|
+
scrollToColumn: ({ align, behavior, index }: {
|
|
80
83
|
align?: "auto" | "center" | "end" | "smart" | "start";
|
|
81
84
|
behavior?: "auto" | "instant" | "smooth";
|
|
82
85
|
index: number;
|
|
83
|
-
})
|
|
86
|
+
}) => void;
|
|
84
87
|
/**
|
|
85
88
|
* Scrolls the grid so that the specified row is visible.
|
|
86
89
|
*
|
|
@@ -90,12 +93,12 @@ export declare type GridImperativeAPI = {
|
|
|
90
93
|
*
|
|
91
94
|
* @throws RangeError if an invalid row index is provided
|
|
92
95
|
*/
|
|
93
|
-
scrollToRow({ align, behavior, index }: {
|
|
96
|
+
scrollToRow: ({ align, behavior, index }: {
|
|
94
97
|
align?: "auto" | "center" | "end" | "smart" | "start";
|
|
95
98
|
behavior?: "auto" | "instant" | "smooth";
|
|
96
99
|
index: number;
|
|
97
|
-
})
|
|
98
|
-
}
|
|
100
|
+
}) => void;
|
|
101
|
+
}
|
|
99
102
|
|
|
100
103
|
export declare type GridProps<CellProps extends object, TagName extends TagNames = "div"> = Omit<HTMLAttributes<HTMLDivElement>, "onResize"> & {
|
|
101
104
|
/**
|
|
@@ -153,14 +156,13 @@ export declare type GridProps<CellProps extends object, TagName extends TagNames
|
|
|
153
156
|
*/
|
|
154
157
|
defaultWidth?: number;
|
|
155
158
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
159
|
+
* Indicates the directionality of grid cells.
|
|
160
|
+
*
|
|
161
|
+
* ℹ️ See HTML `dir` [global attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir) for more information.
|
|
158
162
|
*/
|
|
159
163
|
dir?: "ltr" | "rtl";
|
|
160
164
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* This API has imperative methods for scrolling and a getter for the outermost DOM element.
|
|
165
|
+
* Imperative Grid API.
|
|
164
166
|
*
|
|
165
167
|
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience use in TypeScript projects.
|
|
166
168
|
*/
|
|
@@ -271,16 +273,17 @@ export declare type GridProps<CellProps extends object, TagName extends TagNames
|
|
|
271
273
|
tagName?: TagName;
|
|
272
274
|
};
|
|
273
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Renders data with many rows.
|
|
278
|
+
*/
|
|
274
279
|
export declare function List<RowProps extends object, TagName extends TagNames = "div">({ children, className, defaultHeight, listRef, onResize, onRowsRendered, overscanCount, rowComponent: RowComponentProp, rowCount, rowHeight: rowHeightProp, rowProps: rowPropsUnstable, tagName, style, ...rest }: ListProps<RowProps, TagName>): ReactElement;
|
|
275
280
|
|
|
276
281
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
* This API has imperative methods for scrolling and a getter for the outermost DOM element.
|
|
282
|
+
* Imperative List API.
|
|
280
283
|
*
|
|
281
284
|
* ℹ️ The `useListRef` and `useListCallbackRef` hooks are exported for convenience use in TypeScript projects.
|
|
282
285
|
*/
|
|
283
|
-
export declare
|
|
286
|
+
export declare interface ListImperativeAPI {
|
|
284
287
|
/**
|
|
285
288
|
* Outermost HTML element for the list if mounted and null (if not mounted.
|
|
286
289
|
*/
|
|
@@ -294,12 +297,12 @@ export declare type ListImperativeAPI = {
|
|
|
294
297
|
*
|
|
295
298
|
* @throws RangeError if an invalid row index is provided
|
|
296
299
|
*/
|
|
297
|
-
scrollToRow({ align, behavior, index }: {
|
|
300
|
+
scrollToRow: ({ align, behavior, index }: {
|
|
298
301
|
align?: "auto" | "center" | "end" | "smart" | "start";
|
|
299
302
|
behavior?: "auto" | "instant" | "smooth";
|
|
300
303
|
index: number;
|
|
301
|
-
})
|
|
302
|
-
}
|
|
304
|
+
}) => void;
|
|
305
|
+
}
|
|
303
306
|
|
|
304
307
|
export declare type ListProps<RowProps extends object, TagName extends TagNames = "div"> = Omit<HTMLAttributes<HTMLDivElement>, "onResize"> & {
|
|
305
308
|
/**
|
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/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 (element) {\n if (!dir) {\n setValue(isRtl(element));\n }\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, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return {\n const ref = useRef<typeof fn>(() => {\n throw new Error(\"Cannot call during render.\");\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, scrollLeft, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollLeft;\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.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 const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const bounds = cachedBounds.get(index);\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 if (align === \"smart\") {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n align = \"auto\";\n } else {\n align = \"center\";\n }\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n if (bounds.scrollOffset <= containerSize / 2) {\n // Too near the beginning to center-align\n return 0;\n } else if (\n bounds.scrollOffset + bounds.size / 2 >=\n estimatedTotalSize - containerSize / 2\n ) {\n // Too near the end to center-align\n return estimatedTotalSize - containerSize;\n } else {\n return bounds.scrollOffset + bounds.size / 2 - containerSize / 2;\n }\n }\n case \"auto\":\n default: {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\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 let startIndexVisible = 0;\n let stopIndexVisible = -1;\n let startIndexOverscan = 0;\n let stopIndexOverscan = -1;\n let currentIndex = 0;\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n break;\n }\n\n currentIndex++;\n }\n\n startIndexVisible = currentIndex;\n startIndexOverscan = Math.max(0, startIndexVisible - overscanCount);\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n ) {\n break;\n }\n\n currentIndex++;\n }\n\n stopIndexVisible = Math.min(maxIndex, currentIndex);\n stopIndexOverscan = Math.min(itemCount - 1, stopIndexVisible + overscanCount);\n\n if (startIndexVisible < 0) {\n startIndexVisible = 0;\n stopIndexVisible = -1;\n startIndexOverscan = 0;\n stopIndexOverscan = -1;\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan,\n stopIndexOverscan\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 get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n let size: number;\n switch (typeof itemSize) {\n case \"function\": {\n size = itemSize(currentIndex, itemProps);\n break;\n }\n case \"number\": {\n size = itemSize;\n break;\n }\n }\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 * parseInt(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 [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>({\n startIndexVisible: 0,\n startIndexOverscan: 0,\n stopIndexVisible: -1,\n stopIndexOverscan: -1\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 { 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 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 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,\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 { useMemo } from \"react\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n return useMemo(() => {\n return unstableObject;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, Object.values(unstableObject));\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","import {\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\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 columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\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={columnIndex}\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 key={rowIndex} role=\"row\" aria-rowindex={rowIndex + 1}>\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\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 width: \"100%\",\n height: \"100%\",\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 {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\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 { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\n\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\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 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 useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\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 = scrollToIndex({\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, scrollToIndex]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n const rows = Array.from(element.children).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 if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n element,\n isDynamicRowHeight,\n rowHeightProp,\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={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 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 // Temporarily store default height in the cache map to avoid scroll jumps if rowProps change\n // Else rowProps changes can impact the average height, and cause rows to shift up or down within the list\n // see github.com/bvaughn/react-window/issues/863\n map.set(index, defaultRowHeight);\n\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 () => new ResizeObserver(resizeObserverCallback)\n );\n\n useEffect(() => {\n return () => {\n resizeObserver.disconnect();\n };\n }, [resizeObserver]);\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n elements.forEach((element) => resizeObserver.observe(element));\n return () => {\n elements.forEach((element) => resizeObserver.unobserve(element));\n };\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","scrollLeft","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","startIndexOverscan","stopIndexOverscan","currentIndex","createCachedBounds","itemProps","cache","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","indices","setIndices","height","width","prevSizeRef","prevSize","getCellBounds","getEstimatedSizeUtil","getStartStopIndicesUtil","onScroll","prev","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","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","DATA_ATTRIBUTE_LIST_INDEX","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","rows","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,IAAqC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../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/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 (element) {\n if (!dir) {\n setValue(isRtl(element));\n }\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, Return>(\n fn: (args: Args) => Return\n): (args: Args) => Return {\n const ref = useRef<typeof fn>(() => {\n throw new Error(\"Cannot call during render.\");\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, scrollLeft, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollLeft;\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.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 const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const bounds = cachedBounds.get(index);\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 if (align === \"smart\") {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\n align = \"auto\";\n } else {\n align = \"center\";\n }\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n if (bounds.scrollOffset <= containerSize / 2) {\n // Too near the beginning to center-align\n return 0;\n } else if (\n bounds.scrollOffset + bounds.size / 2 >=\n estimatedTotalSize - containerSize / 2\n ) {\n // Too near the end to center-align\n return estimatedTotalSize - containerSize;\n } else {\n return bounds.scrollOffset + bounds.size / 2 - containerSize / 2;\n }\n }\n case \"auto\":\n default: {\n if (\n containerScrollOffset >= minOffset &&\n containerScrollOffset <= maxOffset\n ) {\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 let startIndexVisible = 0;\n let stopIndexVisible = -1;\n let startIndexOverscan = 0;\n let stopIndexOverscan = -1;\n let currentIndex = 0;\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n break;\n }\n\n currentIndex++;\n }\n\n startIndexVisible = currentIndex;\n startIndexOverscan = Math.max(0, startIndexVisible - overscanCount);\n\n while (currentIndex < maxIndex) {\n const bounds = cachedBounds.get(currentIndex);\n\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n ) {\n break;\n }\n\n currentIndex++;\n }\n\n stopIndexVisible = Math.min(maxIndex, currentIndex);\n stopIndexOverscan = Math.min(itemCount - 1, stopIndexVisible + overscanCount);\n\n if (startIndexVisible < 0) {\n startIndexVisible = 0;\n stopIndexVisible = -1;\n startIndexOverscan = 0;\n stopIndexOverscan = -1;\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan,\n stopIndexOverscan\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 get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n let size: number;\n switch (typeof itemSize) {\n case \"function\": {\n size = itemSize(currentIndex, itemProps);\n break;\n }\n case \"number\": {\n size = itemSize;\n break;\n }\n }\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 * parseInt(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 [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>({\n startIndexVisible: 0,\n startIndexOverscan: 0,\n stopIndexVisible: -1,\n stopIndexOverscan: -1\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 { 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 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 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,\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 { useMemo } from \"react\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n return useMemo(() => {\n return unstableObject;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, Object.values(unstableObject));\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","import {\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 */\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 columnWidth,\n defaultHeight = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\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={columnIndex}\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 key={rowIndex} role=\"row\" aria-rowindex={rowIndex + 1}>\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\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 width: \"100%\",\n height: \"100%\",\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 {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\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 { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\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 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 useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\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 = scrollToIndex({\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, scrollToIndex]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n const rows = Array.from(element.children).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 if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n element,\n isDynamicRowHeight,\n rowHeightProp,\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={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 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 // Temporarily store default height in the cache map to avoid scroll jumps if rowProps change\n // Else rowProps changes can impact the average height, and cause rows to shift up or down within the list\n // see github.com/bvaughn/react-window/issues/863\n map.set(index, defaultRowHeight);\n\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 () => new ResizeObserver(resizeObserverCallback)\n );\n\n useEffect(() => {\n return () => {\n resizeObserver.disconnect();\n };\n }, [resizeObserver]);\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n elements.forEach((element) => resizeObserver.observe(element));\n return () => {\n elements.forEach((element) => resizeObserver.unobserve(element));\n };\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","scrollLeft","scrollWidth","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","startIndexOverscan","stopIndexOverscan","currentIndex","createCachedBounds","itemProps","cache","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","onResize","indices","setIndices","height","width","prevSizeRef","prevSize","getCellBounds","getEstimatedSizeUtil","getStartStopIndicesUtil","onScroll","prev","scrollTop","next","scrollToIndex","useMemoizedObject","unstableObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","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","DATA_ATTRIBUTE_LIST_INDEX","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","rows","item","attribute","useDynamicRowHeight","defaultRowHeight","map","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","observeRowElements","elements","useListCallbackRef","useListR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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-window",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
|
|
6
6
|
"contributors": [
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
"build": "pnpm run build:lib && pnpm run build:docs",
|
|
24
24
|
"build:docs": "TARGET=docs vite build",
|
|
25
25
|
"build:lib": "TARGET=lib vite build",
|
|
26
|
-
"compile": "pnpm run compile:
|
|
27
|
-
"compile:
|
|
28
|
-
"compile:
|
|
26
|
+
"compile": "pnpm run compile:docs && pnpm run compile:examples",
|
|
27
|
+
"compile:docs": "tsx ./scripts/compile-docs",
|
|
28
|
+
"compile:examples": "tsx ./scripts/compile-examples",
|
|
29
|
+
"compress:og-image": "tsx ./scripts/compress-og-image",
|
|
29
30
|
"lint": "eslint .",
|
|
30
31
|
"prerelease": "rm -rf dist && pnpm run build:lib",
|
|
31
32
|
"prettier": "prettier --write \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
|
|
@@ -44,27 +45,24 @@
|
|
|
44
45
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@codemirror/lang-css": "latest",
|
|
48
|
-
"@codemirror/lang-html": "latest",
|
|
49
|
-
"@codemirror/lang-javascript": "latest",
|
|
50
|
-
"@codemirror/lang-markdown": "latest",
|
|
51
|
-
"@codemirror/language": "latest",
|
|
52
|
-
"@codemirror/state": "latest",
|
|
53
48
|
"@csstools/postcss-oklab-function": "^4.0.11",
|
|
54
49
|
"@eslint/js": "^9.30.1",
|
|
55
50
|
"@headlessui/react": "^2.2.4",
|
|
56
51
|
"@headlessui/tailwindcss": "^0.2.2",
|
|
57
52
|
"@heroicons/react": "^2.2.0",
|
|
58
|
-
"@lezer/highlight": "latest",
|
|
59
53
|
"@tailwindcss/vite": "^4.1.11",
|
|
60
54
|
"@tailwindplus/elements": "^1.0.5",
|
|
61
55
|
"@testing-library/jest-dom": "^6.6.4",
|
|
62
56
|
"@testing-library/react": "^16.3.0",
|
|
63
57
|
"@testing-library/user-event": "^14.6.1",
|
|
58
|
+
"@types/bytes": "^3.1.5",
|
|
59
|
+
"@types/markdown-it": "^14.1.2",
|
|
64
60
|
"@types/node": "^24.2.0",
|
|
65
|
-
"@types/react": "^19.
|
|
66
|
-
"@types/react-dom": "^19.
|
|
61
|
+
"@types/react": "^19.2.3",
|
|
62
|
+
"@types/react-dom": "^19.2.3",
|
|
63
|
+
"@types/sharp": "^0.32.0",
|
|
67
64
|
"@vitejs/plugin-react-swc": "^3.10.2",
|
|
65
|
+
"bytes": "^3.1.2",
|
|
68
66
|
"clsx": "^2.1.1",
|
|
69
67
|
"csstype": "^3.1.3",
|
|
70
68
|
"eslint": "^9.30.1",
|
|
@@ -74,21 +72,25 @@
|
|
|
74
72
|
"husky": "^9.1.7",
|
|
75
73
|
"jsdom": "^26.1.0",
|
|
76
74
|
"lint-staged": "^16.1.4",
|
|
75
|
+
"markdown-it": "^14.1.0",
|
|
77
76
|
"marked": "^16.4.1",
|
|
78
77
|
"postcss": "^8.5.6",
|
|
79
78
|
"prettier": "3.6.2",
|
|
80
79
|
"prettier-plugin-tailwindcss": "^0.7.1",
|
|
81
|
-
"react": "^19.
|
|
80
|
+
"react": "^19.2.3",
|
|
82
81
|
"react-docgen-typescript": "^2.4.0",
|
|
83
|
-
"react-dom": "^19.
|
|
82
|
+
"react-dom": "^19.2.3",
|
|
84
83
|
"react-error-boundary": "^6.0.0",
|
|
84
|
+
"react-lib-tools": "^0.0.30",
|
|
85
85
|
"react-router-dom": "^7.6.3",
|
|
86
86
|
"rollup-plugin-terser": "^7.0.2",
|
|
87
87
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
88
|
+
"sharp": "^0.34.5",
|
|
88
89
|
"tailwind-merge": "^3.3.1",
|
|
89
90
|
"tailwindcss": "^4.1.11",
|
|
90
91
|
"ts-blank-space": "^0.6.2",
|
|
91
92
|
"ts-node": "^10.9.2",
|
|
93
|
+
"tsx": "^4.21.0",
|
|
92
94
|
"typescript": "~5.8.3",
|
|
93
95
|
"typescript-eslint": "^8.35.1",
|
|
94
96
|
"typescript-json-schema": "^0.65.1",
|