react-window 2.0.0 → 2.0.1
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 +29 -2
- package/dist/react-window.cjs +1 -1
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.js +0 -2
- package/dist/react-window.js.map +1 -1
- package/docs/assets/CellComponent.example-e4JJmmZM.js +2 -0
- package/docs/assets/CellComponent.example-e4JJmmZM.js.map +1 -0
- package/docs/assets/ComponentProps-DMkeake1.js +2 -0
- package/docs/assets/ComponentProps-DMkeake1.js.map +1 -0
- package/docs/assets/ContinueLink-CbPhCk1k.js +2 -0
- package/docs/assets/ContinueLink-CbPhCk1k.js.map +1 -0
- package/docs/assets/FixedRowHeightsRoute-D8GuxxOL.js +2 -0
- package/docs/assets/FixedRowHeightsRoute-D8GuxxOL.js.map +1 -0
- package/docs/assets/FormattedCode-CAmuOSRw.js +2 -0
- package/docs/assets/FormattedCode-CAmuOSRw.js.map +1 -0
- package/docs/assets/FormattedCode-nwWF-WcI.css +1 -0
- package/docs/assets/GettingStartedRoute-zN9jVy3e.js +2 -0
- package/docs/assets/GettingStartedRoute-zN9jVy3e.js.map +1 -0
- package/docs/assets/Grid-DH-j7ODh.js +2 -0
- package/docs/assets/Grid-DH-j7ODh.js.map +1 -0
- package/docs/assets/Header-BYp8JKXz.js +2 -0
- package/docs/assets/Header-BYp8JKXz.js.map +1 -0
- package/docs/assets/HorizontalListsRoute-rNcKbQ1k.js +2 -0
- package/docs/assets/HorizontalListsRoute-rNcKbQ1k.js.map +1 -0
- package/docs/assets/ImperativeApiRoute-DD9Z7HWg.js +2 -0
- package/docs/assets/ImperativeApiRoute-DD9Z7HWg.js.map +1 -0
- package/docs/assets/ImperativeApiRoute-DntU9ReR.js +2 -0
- package/docs/assets/ImperativeApiRoute-DntU9ReR.js.map +1 -0
- package/docs/assets/List-C4KHYcVU.js +2 -0
- package/docs/assets/List-C4KHYcVU.js.map +1 -0
- package/docs/assets/LoadingSpinner-Z5HQViRD.js +2 -0
- package/docs/assets/LoadingSpinner-Z5HQViRD.js.map +1 -0
- package/docs/assets/PageNotFound-B0nx-Cz_.js +2 -0
- package/docs/assets/PageNotFound-B0nx-Cz_.js.map +1 -0
- package/docs/assets/PlatformRequirementsRoute-C00ZSzCF.js +2 -0
- package/docs/assets/PlatformRequirementsRoute-C00ZSzCF.js.map +1 -0
- package/docs/assets/PropsRoute-D77WXdPD.js +2 -0
- package/docs/assets/PropsRoute-D77WXdPD.js.map +1 -0
- package/docs/assets/PropsRoute-D9jETWHk.js +2 -0
- package/docs/assets/PropsRoute-D9jETWHk.js.map +1 -0
- package/docs/assets/RTLGridsRoute-C49T7mLs.js +2 -0
- package/docs/assets/RTLGridsRoute-C49T7mLs.js.map +1 -0
- package/docs/assets/RenderingGridRoute-pTuxJ89O.js +2 -0
- package/docs/assets/RenderingGridRoute-pTuxJ89O.js.map +1 -0
- package/docs/assets/ScratchpadRoute-AXfI00Be.js +2 -0
- package/docs/assets/ScratchpadRoute-AXfI00Be.js.map +1 -0
- package/docs/assets/Select-C5ovWBbK.js +2 -0
- package/docs/assets/Select-C5ovWBbK.js.map +1 -0
- package/docs/assets/SupportRoute-C1V_AF9b.js +2 -0
- package/docs/assets/SupportRoute-C1V_AF9b.js.map +1 -0
- package/docs/assets/TabularDataRoute-B79B4UDS.js +2 -0
- package/docs/assets/TabularDataRoute-B79B4UDS.js.map +1 -0
- package/docs/assets/VariableRowHeightsRoute-Bf7uZQG0.js +2 -0
- package/docs/assets/VariableRowHeightsRoute-Bf7uZQG0.js.map +1 -0
- package/docs/assets/arePropsEqual-D3jAKwxp.js +2 -0
- package/docs/assets/arePropsEqual-D3jAKwxp.js.map +1 -0
- package/docs/assets/index-B_YQ7rlN.js +3 -0
- package/docs/assets/index-B_YQ7rlN.js.map +1 -0
- package/docs/assets/index-CQLn-JKf.css +1 -0
- package/docs/assets/useCitiesByState-azL1M3ue.js +2 -0
- package/docs/assets/useCitiesByState-azL1M3ue.js.map +1 -0
- package/docs/assets/useContacts-BItVOkyi.js +2 -0
- package/docs/assets/useContacts-BItVOkyi.js.map +1 -0
- package/docs/index.html +9 -3
- package/docs/robots.txt +2 -0
- package/docs/stats.html +1 -1
- package/package.json +4 -1
- package/docs/assets/index-AW1og9rz.css +0 -1
- package/docs/assets/index-LE94V_KA.js +0 -68
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/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/shallowCompare.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/components/list/List.tsx","../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;\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 an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((args: Args) => ref.current?.(args), [ref]) as (\n args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = document.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (getRTLOffsetType()) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, 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 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 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}): [number, number] {\n const maxIndex = itemCount - 1;\n\n let startIndex = 0;\n let stopIndex = -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 startIndex = currentIndex;\n startIndex = Math.max(0, startIndex - 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 stopIndex = Math.min(maxIndex, currentIndex);\n stopIndex = Math.min(itemCount - 1, stopIndex + overscanCount);\n\n return startIndex < 0 ? [0, -1] : [startIndex, stopIndex];\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 { 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([0, -1]);\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 [startIndex, stopIndex] = [\n Math.min(itemCount - 1, indices[0]),\n Math.min(itemCount - 1, indices[1])\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 (next[0] === prev[0] && next[1] === prev[1]) {\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 behavior = \"auto\",\n containerScrollOffset,\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\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 if (direction === \"horizontal\") {\n containerElement.scrollTo({\n left: scrollOffset,\n behavior: behavior || undefined\n });\n } else {\n containerElement.scrollTo({\n behavior: behavior || undefined,\n top: scrollOffset\n });\n }\n } else {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (next[0] !== startIndex || next[1] !== stopIndex) {\n setIndices(next);\n }\n }\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\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 { 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 { 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: { style: CSSProperties },\n nextProps: { style: CSSProperties }\n): boolean {\n const { style: prevStyle, ...prevRest } = prevProps;\n const { style: nextStyle, ...nextRest } = nextProps;\n\n return (\n shallowCompare(prevStyle, nextStyle) && shallowCompare(prevRest, nextRest)\n );\n}\n","import {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\nexport function Grid<CellProps extends object>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\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 ...rest\n}: GridProps<CellProps>) {\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 startIndex: columnStartIndex,\n scrollToIndex: scrollToColumnIndex,\n stopIndex: columnStopIndex\n } = useVirtualizer({\n containerElement: element,\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 startIndex: rowStartIndex,\n scrollToIndex: scrollToRowIndex,\n stopIndex: rowStopIndex\n } = useVirtualizer({\n containerElement: element,\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 scrollToRowIndex({\n align: rowAlign,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index: rowIndex\n });\n scrollToColumnIndex({\n align: columnAlign,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index: columnIndex\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 scrollToColumnIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index\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 scrollToRowIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n }\n }),\n [element, scrollToColumnIndex, scrollToRowIndex]\n );\n\n useEffect(() => {\n if (\n columnStartIndex >= 0 &&\n columnStopIndex >= 0 &&\n rowStartIndex >= 0 &&\n rowStopIndex >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered({\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n });\n }\n }, [\n onCellsRendered,\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {\n const rowBounds = getRowBounds(rowIndex);\n for (\n let columnIndex = columnStartIndex;\n columnIndex <= columnStopIndex;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n children.push(\n <CellComponent\n {...(cellProps as CellProps)}\n columnIndex={columnIndex}\n key={`${rowIndex}-${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: rowCount > 1 ? rowBounds.size : \"100%\",\n width: columnBounds.size\n }}\n />\n );\n }\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndex,\n columnStopIndex,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowStartIndex,\n rowStopIndex\n ]);\n\n return (\n <div\n role=\"grid\"\n {...rest}\n className={className}\n dir={dir}\n ref={setElement}\n style={{\n width: \"100%\",\n height: \"100%\",\n ...style,\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n position: \"relative\",\n height: getEstimatedHeight(),\n width: getEstimatedWidth()\n }}\n >\n {cells}\n </div>\n </div>\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 {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { ListProps } from \"./types\";\n\nexport function List<RowProps extends object>({\n className,\n defaultHeight = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight,\n rowProps: rowPropsUnstable,\n style,\n ...rest\n}: ListProps<RowProps>) {\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 {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\n } = useVirtualizer({\n containerElement: element,\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 scrollToIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n }\n }),\n [element, scrollToIndex]\n );\n\n useEffect(() => {\n if (startIndex >= 0 && stopIndex >= 0 && onRowsRendered) {\n onRowsRendered({\n startIndex,\n stopIndex\n });\n }\n }, [onRowsRendered, startIndex, stopIndex]);\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (let index = startIndex; index <= stopIndex; index++) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n key={index}\n index={index}\n style={{\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n height: bounds.size,\n width: \"100%\"\n }}\n />\n );\n }\n }\n return children;\n }, [RowComponent, getCellBounds, rowCount, rowProps, startIndex, stopIndex]);\n\n return (\n <div\n role=\"list\"\n {...rest}\n className={className}\n ref={setElement}\n style={{\n ...style,\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n height: getEstimatedSize(),\n position: \"relative\",\n width: \"100%\"\n }}\n >\n {rows}\n </div>\n </div>\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","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndex","stopIndex","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","behavior","useMemoizedObject","unstableObject","shallowCompare","a","b","key","arePropsEqual","prevProps","nextProps","prevStyle","prevRest","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndex","scrollToColumnIndex","columnStopIndex","getRowBounds","getEstimatedHeight","rowStartIndex","scrollToRowIndex","rowStopIndex","useImperativeHandle","columnAlign","columnIndex","rowAlign","rowIndex","cells","children","rowBounds","columnBounds","createElement","jsx","useGridCallbackRef","useGridRef","List","listRef","onRowsRendered","RowComponentProp","rowPropsUnstable","rowProps","RowComponent","rows","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":";;AAAO,SAASA,GAAMC,GAAsB;AAC1C,MAAIC,IAAqCD;AACzC,SAAOC,KAAgB;AACrB,QAAIA,EAAe;AACjB,aAAOA,EAAe,QAAQ;AAGhC,IAAAA,IAAiBA,EAAe;AAAA,EAClC;AAEA,SAAO;AACT;ACRO,SAASC,GACdF,GACAG,GACA;AACA,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAASH,MAAQ,KAAK;AAEhD,SAAAI,EAAgB,MAAM;AACpB,IAAIP,MACGG,KACHE,EAASN,GAAMC,CAAO,CAAC;AAAA,EAG7B,GAAG,CAACG,GAAKH,CAAO,CAAC,GAEVI;AACT;AChBO,MAAMI,IACX,OAAO,SAAW,MAAcD,IAAkBE;ACD7C,SAASC,EACdN,GACoB;AACpB,MAAIA,MAAU;AACZ,YAAQ,OAAOA,GAAA;AAAA,MACb,KAAK;AACH,eAAOA;AAAA,MAET,KAAK,UAAU;AACb,YAAIA,EAAM,SAAS,IAAI;AACrB,iBAAO,WAAWA,CAAK;AAEzB;AAAA,MACF;AAAA,IAAA;AAGN;ACdO,SAASO,GAAkB;AAAA,EAChC,KAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAUC;AAAA,EACV,SAAAf;AAAA,EACA,MAAAgB;AAAA,EACA,OAAAC;AACF,GAQG;AACD,QAAM,EAAE,aAAAC,GAAa,YAAAC,EAAA,IAAeC;AAAA,IAClC,OAAO;AAAA,MACL,aAAaV,EAAuBO,GAAO,MAAM;AAAA,MACjD,YAAYP,EAAuBO,GAAO,KAAK;AAAA,IAAA;AAAA,IAEjD,CAACA,GAAO,QAAQA,GAAO,KAAK;AAAA,EAAA,GAGxB,CAACI,GAAOC,CAAQ,IAAIhB,EAGvB;AAAA,IACD,QAAQO;AAAA,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MtC,GAAa;AAC9B,UAAM4H,IAAM,SAAS,cAAc,KAAK,GAClCjJ,IAAQiJ,EAAI;AAClB,IAAAjJ,EAAM,QAAQ,QACdA,EAAM,SAAS,QACfA,EAAM,WAAW,UAEjB,SAAS,KAAK,YAAYiJ,CAAG,GAE7BtF,IAAOsF,EAAI,cAAcA,EAAI,aAE7B,SAAS,KAAK,YAAYA,CAAG;AAAA,EAC/B;AAEA,SAAOtF;AACT;"}
|
|
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/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/shallowCompare.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/components/list/List.tsx","../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;\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 an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((args: Args) => ref.current?.(args), [ref]) as (\n args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = document.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (getRTLOffsetType()) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, 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 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 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}): [number, number] {\n const maxIndex = itemCount - 1;\n\n let startIndex = 0;\n let stopIndex = -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 startIndex = currentIndex;\n startIndex = Math.max(0, startIndex - 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 stopIndex = Math.min(maxIndex, currentIndex);\n stopIndex = Math.min(itemCount - 1, stopIndex + overscanCount);\n\n return startIndex < 0 ? [0, -1] : [startIndex, stopIndex];\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 { 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([0, -1]);\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 [startIndex, stopIndex] = [\n Math.min(itemCount - 1, indices[0]),\n Math.min(itemCount - 1, indices[1])\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 (next[0] === prev[0] && next[1] === prev[1]) {\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 behavior = \"auto\",\n containerScrollOffset,\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\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 if (direction === \"horizontal\") {\n containerElement.scrollTo({\n left: scrollOffset,\n behavior: behavior || undefined\n });\n } else {\n containerElement.scrollTo({\n behavior: behavior || undefined,\n top: scrollOffset\n });\n }\n } else {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (next[0] !== startIndex || next[1] !== stopIndex) {\n setIndices(next);\n }\n }\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\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 { 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 { 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: { style: CSSProperties },\n nextProps: { style: CSSProperties }\n): boolean {\n const { style: prevStyle, ...prevRest } = prevProps;\n const { style: nextStyle, ...nextRest } = nextProps;\n\n return (\n shallowCompare(prevStyle, nextStyle) && shallowCompare(prevRest, nextRest)\n );\n}\n","import {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\nexport function Grid<CellProps extends object>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\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 ...rest\n}: GridProps<CellProps>) {\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 startIndex: columnStartIndex,\n scrollToIndex: scrollToColumnIndex,\n stopIndex: columnStopIndex\n } = useVirtualizer({\n containerElement: element,\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 startIndex: rowStartIndex,\n scrollToIndex: scrollToRowIndex,\n stopIndex: rowStopIndex\n } = useVirtualizer({\n containerElement: element,\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 scrollToRowIndex({\n align: rowAlign,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index: rowIndex\n });\n scrollToColumnIndex({\n align: columnAlign,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index: columnIndex\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 scrollToColumnIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index\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 scrollToRowIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n }\n }),\n [element, scrollToColumnIndex, scrollToRowIndex]\n );\n\n useEffect(() => {\n if (\n columnStartIndex >= 0 &&\n columnStopIndex >= 0 &&\n rowStartIndex >= 0 &&\n rowStopIndex >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered({\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n });\n }\n }, [\n onCellsRendered,\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {\n const rowBounds = getRowBounds(rowIndex);\n for (\n let columnIndex = columnStartIndex;\n columnIndex <= columnStopIndex;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n children.push(\n <CellComponent\n {...(cellProps as CellProps)}\n columnIndex={columnIndex}\n key={`${rowIndex}-${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: rowCount > 1 ? rowBounds.size : \"100%\",\n width: columnBounds.size\n }}\n />\n );\n }\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndex,\n columnStopIndex,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowStartIndex,\n rowStopIndex\n ]);\n\n return (\n <div\n {...rest}\n className={className}\n dir={dir}\n ref={setElement}\n style={{\n width: \"100%\",\n height: \"100%\",\n ...style,\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n position: \"relative\",\n height: getEstimatedHeight(),\n width: getEstimatedWidth()\n }}\n >\n {cells}\n </div>\n </div>\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 {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { ListProps } from \"./types\";\n\nexport function List<RowProps extends object>({\n className,\n defaultHeight = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight,\n rowProps: rowPropsUnstable,\n style,\n ...rest\n}: ListProps<RowProps>) {\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 {\n getCellBounds,\n getEstimatedSize,\n scrollToIndex,\n startIndex,\n stopIndex\n } = useVirtualizer({\n containerElement: element,\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 scrollToIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n }\n }),\n [element, scrollToIndex]\n );\n\n useEffect(() => {\n if (startIndex >= 0 && stopIndex >= 0 && onRowsRendered) {\n onRowsRendered({\n startIndex,\n stopIndex\n });\n }\n }, [onRowsRendered, startIndex, stopIndex]);\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (let index = startIndex; index <= stopIndex; index++) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n key={index}\n index={index}\n style={{\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n height: bounds.size,\n width: \"100%\"\n }}\n />\n );\n }\n }\n return children;\n }, [RowComponent, getCellBounds, rowCount, rowProps, startIndex, stopIndex]);\n\n return (\n <div\n {...rest}\n className={className}\n ref={setElement}\n style={{\n ...style,\n maxHeight: \"100%\",\n flexGrow: 1,\n overflowY: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n height: getEstimatedSize(),\n position: \"relative\",\n width: \"100%\"\n }}\n >\n {rows}\n </div>\n </div>\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","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","index","containerScrollOffset","containerSize","estimatedTotalSize","maxOffset","minOffset","getStartStopIndices","overscanCount","maxIndex","startIndex","stopIndex","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","behavior","useMemoizedObject","unstableObject","shallowCompare","a","b","key","arePropsEqual","prevProps","nextProps","prevStyle","prevRest","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","className","columnCount","columnWidth","gridRef","onCellsRendered","rowCount","rowHeight","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndex","scrollToColumnIndex","columnStopIndex","getRowBounds","getEstimatedHeight","rowStartIndex","scrollToRowIndex","rowStopIndex","useImperativeHandle","columnAlign","columnIndex","rowAlign","rowIndex","cells","children","rowBounds","columnBounds","createElement","jsx","useGridCallbackRef","useGridRef","List","listRef","onRowsRendered","RowComponentProp","rowPropsUnstable","rowProps","RowComponent","rows","useListCallbackRef","useListRef","getScrollbarSize","div"],"mappings":";;AAAO,SAASA,GAAMC,GAAsB;AAC1C,MAAIC,IAAqCD;AACzC,SAAOC,KAAgB;AACrB,QAAIA,EAAe;AACjB,aAAOA,EAAe,QAAQ;AAGhC,IAAAA,IAAiBA,EAAe;AAAA,EAClC;AAEA,SAAO;AACT;ACRO,SAASC,GACdF,GACAG,GACA;AACA,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAASH,MAAQ,KAAK;AAEhD,SAAAI,EAAgB,MAAM;AACpB,IAAIP,MACGG,KACHE,EAASN,GAAMC,CAAO,CAAC;AAAA,EAG7B,GAAG,CAACG,GAAKH,CAAO,CAAC,GAEVI;AACT;AChBO,MAAMI,IACX,OAAO,SAAW,MAAcD,IAAkBE;ACD7C,SAASC,EACdN,GACoB;AACpB,MAAIA,MAAU;AACZ,YAAQ,OAAOA,GAAA;AAAA,MACb,KAAK;AACH,eAAOA;AAAA,MAET,KAAK,UAAU;AACb,YAAIA,EAAM,SAAS,IAAI;AACrB,iBAAO,WAAWA,CAAK;AAEzB;AAAA,MACF;AAAA,IAAA;AAGN;ACdO,SAASO,GAAkB;AAAA,EAChC,KAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAUC;AAAA,EACV,SAAAf;AAAA,EACA,MAAAgB;AAAA,EACA,OAAAC;AACF,GAQG;AACD,QAAM,EAAE,aAAAC,GAAa,YAAAC,EAAA,IAAeC;AAAA,IAClC,OAAO;AAAA,MACL,aAAaV,EAAuBO,GAAO,MAAM;AAAA,MACjD,YAAYP,EAAuBO,GAAO,KAAK;AAAA,IAAA;AAAA,IAEjD,CAACA,GAAO,QAAQA,GAAO,KAAK;AAAA,EAAA,GAGxB,CAACI,GAAOC,CAAQ,IAAIhB,EAGvB;AAAA,IACD,QAAQO;AAAA,IACR,OAAO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AK,GAClCjJ,IAAQiJ,EAAI;AAClB,IAAAjJ,EAAM,QAAQ,QACdA,EAAM,SAAS,QACfA,EAAM,WAAW,UAEjB,SAAS,KAAK,YAAYiJ,CAAG,GAE7BtF,IAAOsF,EAAI,cAAcA,EAAI,aAE7B,SAAS,KAAK,YAAYA,CAAG;AAAA,EAC/B;AAEA,SAAOtF;AACT;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as s}from"./index-B_YQ7rlN.js";import{i as t}from"./useContacts-BItVOkyi.js";function n({contacts:n,columnIndex:e,rowIndex:o,style:r}){const c=n[o][t(e)];return s.jsx("div",{className:"truncate",style:r,children:c})}export{n as C};
|
|
2
|
+
//# sourceMappingURL=CellComponent.example-e4JJmmZM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellComponent.example-e4JJmmZM.js","sources":["../../src/routes/grid/examples/CellComponent.example.tsx"],"sourcesContent":["import type { Contact } from \"./Grid.example\";\nimport { indexToColumn } from \"./shared\";\n\n// <begin>\n\nimport { type CellComponentProps } from \"react-window\";\n\nfunction CellComponent({\n contacts,\n columnIndex,\n rowIndex,\n style\n}: CellComponentProps<{\n contacts: Contact[];\n}>) {\n const address = contacts[rowIndex];\n const content = address[indexToColumn(columnIndex)];\n\n return (\n <div className=\"truncate\" style={style}>\n {content}\n </div>\n );\n}\n\n// <end>\n\nexport { CellComponent };\n"],"names":["CellComponent","contacts","columnIndex","rowIndex","style","content","indexToColumn","jsx","className","children"],"mappings":"sFAOA,SAASA,GAAcC,SACrBA,EAAAC,YACAA,EAAAC,SACAA,EAAAC,MACAA,IAIA,MACMC,EADUJ,EAASE,GACDG,EAAcJ,IAEtC,OACEK,EAAAA,IAAC,MAAA,CAAIC,UAAU,WAAWJ,QACvBK,SAAAJ,GAGP"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,j as r,b as t,B as s,E as n}from"./index-B_YQ7rlN.js";import{u as l,L as a}from"./LoadingSpinner-Z5HQViRD.js";import{H as o}from"./Header-BYp8JKXz.js";function i({title:r,titleId:t,...s},n){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},s),r?e.createElement("title",{id:t},r):null,e.createElement("path",{fillRule:"evenodd",d:"M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z",clipRule:"evenodd"}),e.createElement("path",{fillRule:"evenodd",d:"M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z",clipRule:"evenodd"}))}const c=e.forwardRef(i),d={url:"https://github.com/bvaughn/react-window.git"};function p({json:t}){const{optionalProps:s,requiredProps:n}=e.useMemo(()=>function(e){const r=[],t=[];return Object.values(e.props).forEach(e=>{e.required?t.push(e):r.push(e)}),r.sort((e,r)=>e.name.localeCompare(r.name)),t.sort((e,r)=>e.name.localeCompare(r.name)),{optionalProps:r,requiredProps:t}}(t),[t]);return r.jsxs(r.Fragment,{children:[r.jsx(m,{header:"Required props",props:n}),r.jsx(m,{header:"Optional props",props:s})]})}function m({header:e,props:t}){return 0===t.length?null:r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold mt-2",children:e}),r.jsx("dl",{children:t.map(e=>r.jsxs("div",{children:[r.jsx("dt",{className:"mt-2 pl-4 indent-[-1rem]",children:r.jsxs("code",{className:"tok-operator",children:[r.jsx("span",{className:"tok-propertyName",children:e.name}),e.required||"?",":"," ","raw"in e.type?e.type.raw:e.type.name,e.defaultValue&&r.jsxs(r.Fragment,{children:[" = ",r.jsx("span",{className:"text-white",children:e.defaultValue.value})]})]})}),r.jsx("dd",{className:"ml-4 [&_code]:text-sky-300",dangerouslySetInnerHTML:{__html:e.description.replaceAll("\n- ","<br/>• ").replaceAll("\n\n","<br/><br/>").replaceAll(/`([^`]+)`/g,"<code>$1</code>")}})]},e.name))})]})}function u({section:e,url:s}){return r.jsx(t,{children:r.jsx(h,{section:e,url:s})})}function h({section:e,url:t}){const i=l(t);return i?r.jsxs(r.Fragment,{children:[r.jsxs(s,{align:"center",direction:"row",gap:2,wrap:!0,children:[r.jsx(o,{section:e,title:"Component props"}),r.jsx(n,{className:"text-sm text-emerald-300 hover:text-white",href:`${d.url.replace(".git","")}/blob/master/${i.filePath}`,children:r.jsx(c,{className:"inline-block size-4 fill-current"})})]}),r.jsx(p,{json:i})]}):r.jsxs(r.Fragment,{children:[r.jsx(o,{section:e,title:"Component props"}),r.jsx(a,{})]})}export{u as C};
|
|
2
|
+
//# sourceMappingURL=ComponentProps-DMkeake1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentProps-DMkeake1.js","sources":["../../node_modules/.pnpm/@heroicons+react@2.2.0_react@19.1.0/node_modules/@heroicons/react/20/solid/esm/ArrowTopRightOnSquareIcon.js","../../src/components/props/PropsBlocks.tsx","../../src/utils/processPropsJSON.ts","../../src/components/props/ComponentProps.tsx"],"sourcesContent":["import * as React from \"react\";\nfunction ArrowTopRightOnSquareIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 20 20\",\n fill: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z\",\n clipRule: \"evenodd\"\n }), /*#__PURE__*/React.createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z\",\n clipRule: \"evenodd\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ArrowTopRightOnSquareIcon);\nexport default ForwardRef;","import { useMemo } from \"react\";\nimport type { ComponentDoc, PropItem } from \"react-docgen-typescript\";\nimport { processPropsJSON } from \"../../utils/processPropsJSON\";\n\nexport function PropsBlocks({ json }: { json: ComponentDoc }) {\n const { optionalProps, requiredProps } = useMemo(\n () => processPropsJSON(json),\n [json]\n );\n\n return (\n <>\n <PropsBlock header=\"Required props\" props={requiredProps} />\n <PropsBlock header=\"Optional props\" props={optionalProps} />\n </>\n );\n}\n\nexport function PropsBlock({\n header,\n props\n}: {\n header: string;\n props: PropItem[];\n}) {\n if (props.length === 0) {\n return null;\n }\n\n return (\n <div>\n <div className=\"text-lg font-bold mt-2\">{header}</div>\n <dl>\n {props.map((prop) => (\n <div key={prop.name}>\n <dt className=\"mt-2 pl-4 indent-[-1rem]\">\n <code className=\"tok-operator\">\n <span className=\"tok-propertyName\">{prop.name}</span>\n {prop.required || \"?\"}:{\" \"}\n {\"raw\" in prop.type ? prop.type.raw : prop.type.name}\n {prop.defaultValue && (\n <>\n {\" = \"}\n <span className=\"text-white\">\n {prop.defaultValue.value}\n </span>\n </>\n )}\n </code>\n </dt>\n <dd\n className=\"ml-4 [&_code]:text-sky-300\"\n dangerouslySetInnerHTML={{\n __html: prop.description\n .replaceAll(\"\\n- \", \"<br/>• \")\n .replaceAll(\"\\n\\n\", \"<br/><br/>\")\n .replaceAll(/`([^`]+)`/g, \"<code>$1</code>\")\n }}\n ></dd>\n </div>\n ))}\n </dl>\n </div>\n );\n}\n","import type { ComponentDoc, PropItem } from \"react-docgen-typescript\";\n\nexport function processPropsJSON(json: ComponentDoc) {\n const optionalProps: PropItem[] = [];\n const requiredProps: PropItem[] = [];\n\n Object.values(json.props).forEach((prop) => {\n if (prop.required) {\n requiredProps.push(prop);\n } else {\n optionalProps.push(prop);\n }\n });\n\n optionalProps.sort((a, b) => a.name.localeCompare(b.name));\n requiredProps.sort((a, b) => a.name.localeCompare(b.name));\n\n return { optionalProps, requiredProps };\n}\n","import { ArrowTopRightOnSquareIcon } from \"@heroicons/react/20/solid\";\nimport type { ComponentDoc } from \"react-docgen-typescript\";\nimport { repository } from \"../../../package.json\";\nimport { useJSONData } from \"../../hooks/useJSONData\";\nimport { Box } from \"../Box\";\nimport { ErrorBoundary } from \"../ErrorBoundary\";\nimport { ExternalLink } from \"../ExternalLink\";\nimport { Header } from \"../Header\";\nimport { LoadingSpinner } from \"../LoadingSpinner\";\nimport { PropsBlocks } from \"./PropsBlocks\";\n\nexport function ComponentProps({\n section,\n url\n}: {\n section: string;\n url: string;\n}) {\n return (\n <ErrorBoundary>\n <ComponentPropsLoader section={section} url={url} />\n </ErrorBoundary>\n );\n}\n\nfunction ComponentPropsLoader({\n section,\n url\n}: {\n section: string;\n url: string;\n}) {\n const json = useJSONData<ComponentDoc>(url);\n\n return json ? (\n <>\n <Box align=\"center\" direction=\"row\" gap={2} wrap>\n <Header section={section} title=\"Component props\" />\n <ExternalLink\n className=\"text-sm text-emerald-300 hover:text-white\"\n href={`${repository.url.replace(\".git\", \"\")}/blob/master/${json.filePath}`}\n >\n <ArrowTopRightOnSquareIcon className=\"inline-block size-4 fill-current\" />\n </ExternalLink>\n </Box>\n <PropsBlocks json={json} />\n </>\n ) : (\n <>\n <Header section={section} title=\"Component props\" />\n <LoadingSpinner />\n </>\n );\n}\n"],"names":["ArrowTopRightOnSquareIcon","title","titleId","props","svgRef","React.createElement","Object","assign","xmlns","viewBox","fill","ref","id","fillRule","d","clipRule","ForwardRef","React.forwardRef","PropsBlocks","json","optionalProps","requiredProps","useMemo","values","forEach","prop","required","push","sort","a","b","name","localeCompare","processPropsJSON","jsxs","Fragment","children","jsx","PropsBlock","header","length","className","map","type","raw","defaultValue","value","dangerouslySetInnerHTML","__html","description","replaceAll","ComponentProps","section","url","ErrorBoundary","ComponentPropsLoader","useJSONData","Box","align","direction","gap","wrap","Header","ExternalLink","href","repository","replace","filePath","LoadingSpinner"],"mappings":"qKACA,SAASA,GAA0BC,MACjCA,EAAAC,QACAA,KACGC,GACFC,GACD,OAAoBC,gBAAoB,MAAOC,OAAOC,OAAO,CAC3DC,MAAO,6BACPC,QAAS,YACTC,KAAM,eACN,cAAe,OACf,YAAa,OACbC,IAAKP,EACL,kBAAmBF,GAClBC,GAAQF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3DO,GAAIV,GACHD,GAAS,KAAmBI,EAAAA,cAAoB,OAAQ,CACzDQ,SAAU,UACVC,EAAG,oNACHC,SAAU,YACKV,EAAAA,cAAoB,OAAQ,CAC3CQ,SAAU,UACVC,EAAG,qKACHC,SAAU,YAEd,CACA,MAAMC,EAA2BC,EAAAA,WAAiBjB,yDCtB3C,SAASkB,GAAYC,KAAEA,IAC5B,MAAMC,cAAEA,EAAAC,cAAeA,GAAkBC,EAAAA,QACvC,ICJG,SAA0BH,GAC/B,MAAMC,EAA4B,GAC5BC,EAA4B,GAalC,OAXAf,OAAOiB,OAAOJ,EAAKhB,OAAOqB,QAASC,IAC7BA,EAAKC,SACPL,EAAcM,KAAKF,GAEnBL,EAAcO,KAAKF,KAIvBL,EAAcQ,KAAK,CAACC,E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AEA,SAASE,GAAqBH,QAC5BA,EAAAC,IACAA,IAKA,MAAMlC,EAAOqC,EAA0BH,GAEvC,OAAOlC,EACLe,EAAAA,KAAAC,EAAAA,SAAA,CACEC,SAAA,CAAAF,EAAAA,KAACuB,EAAA,CAAIC,MAAM,SAASC,UAAU,MAAMC,IAAK,EAAGC,MAAI,EAC9CzB,SAAA,GAAAC,IAACyB,EAAA,CAAOV,UAAkBnD,MAAM,oBAChCoC,EAAAA,IAAC0B,EAAA,CACCtB,UAAU,4CACVuB,KAAM,GAAGC,EAAWZ,IAAIa,QAAQ,OAAQ,mBAAmB/C,EAAKgD,WAEhE/B,SAAAC,EAAAA,IAACrC,EAAA,CAA0ByC,UAAU,0CAGzCJ,MAACnB,GAAYC,YAGfe,EAAAA,KAAAC,EAAAA,SAAA,CACEC,SAAA,GAAAC,IAACyB,EAAA,CAAOV,UAAkBnD,MAAM,0BAC/BmE,EAAA,CAAA,KAGP","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContinueLink-CbPhCk1k.js","sources":["../../src/components/ContinueLink.tsx"],"sourcesContent":["import type { routeMap } from \"../routes\";\nimport { Link } from \"./Link\";\n\nexport function ContinueLink({\n title,\n to\n}: {\n title: string;\n to: keyof typeof routeMap;\n}) {\n return (\n <div>\n Continue to <Link to={to}>{title}</Link>…\n </div>\n );\n}\n"],"names":["ContinueLink","title","to","children","jsx","Link"],"mappings":"+CAGO,SAASA,GAAaC,MAC3BA,EAAAC,GACAA,IAKA,cACG,MAAA,CAAIC,SAAA,CAAA,iBACSC,IAACC,EAAA,CAAKH,KAASC,SAAAF,IAAa,MAG9C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,B as s,C as i,E as o}from"./index-B_YQ7rlN.js";import{B as t}from"./arePropsEqual-D3jAKwxp.js";import{F as r}from"./FormattedCode-CAmuOSRw.js";import{C as n}from"./ContinueLink-CbPhCk1k.js";import{H as d}from"./Header-BYp8JKXz.js";import{u as a,L as l}from"./LoadingSpinner-Z5HQViRD.js";import{L as h}from"./List-C4KHYcVU.js";function c({index:s,names:i,style:o}){return e.jsxs("div",{className:"flex items-center justify-between",style:o,children:[i[s],e.jsx("div",{className:"text-slate-500 text-xs",children:`${s+1} of ${i.length}`})]})}function p({names:s}){return e.jsx(h,{rowComponent:c,rowCount:s.length,rowHeight:25,rowProps:{names:s}})}const j=[];function m(){const h=a("/data/names.json")??j;return e.jsxs(s,{direction:"column",gap:4,children:[e.jsx(d,{section:"Lists",title:"Fixed row heights"}),e.jsx("div",{children:"The simplest type of list to render is one with fixed row heights."}),e.jsxs(t,{className:"h-50","data-focus-within":"bold",children:[!h.length&&e.jsx(l,{}),e.jsx(p,{names:h})]}),e.jsxs("div",{children:["To render this type of list, you need to specify how many rows it contains (",e.jsx("code",{children:"rowCount"}),"), which component should render rows (",e.jsx("code",{children:"rowComponent"}),"), and the height of each row (",e.jsx("code",{children:"rowHeight"}),"):"]}),e.jsx(r,{url:"/generated/code-snippets/FixedHeightList.json"}),e.jsxs("div",{children:["The ",e.jsx("code",{children:"rowProps"})," object can also be used to share between components. Values passed in ",e.jsx("code",{children:"rowProps"})," will also be passed as props to the row component:"]}),e.jsx(r,{url:"/generated/code-snippets/FixedHeightRowComponent.json"}),e.jsx(i,{intent:"warning",children:e.jsxs(s,{direction:"column",gap:4,children:[e.jsxs("div",{children:["Lists require vertical space to render rows. Typically the"," ",e.jsx(o,{href:"https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver",children:"ResizeObserver"})," ","API is used to determine how much space there is available within the parent DOM element."]}),e.jsxs("div",{children:["If an explicit height is specified (in pixels) using the"," ",e.jsx("code",{children:"style"})," prop, ",e.jsx("code",{children:"ResizeObserver"})," will not be used."]})]})}),e.jsx(n,{to:"/list/variable-row-height",title:"variable row heights"})]})}export{m as default};
|
|
2
|
+
//# sourceMappingURL=FixedRowHeightsRoute-D8GuxxOL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedRowHeightsRoute-D8GuxxOL.js","sources":["../../src/routes/list/examples/FixedHeightRowComponent.example.tsx","../../src/routes/list/examples/FixedHeightList.example.tsx","../../src/constants.ts","../../src/routes/list/FixedRowHeightsRoute.tsx","../../src/routes/list/hooks/useNames.ts"],"sourcesContent":["import { type RowComponentProps } from \"react-window\";\n\nfunction RowComponent({\n index,\n names,\n style\n}: RowComponentProps<{\n names: string[];\n}>) {\n return (\n <div className=\"flex items-center justify-between\" style={style}>\n {names[index]}\n <div className=\"text-slate-500 text-xs\">{`${index + 1} of ${names.length}`}</div>\n </div>\n );\n}\n\n// <end>\n\nexport { RowComponent };\n","import { RowComponent } from \"./FixedHeightRowComponent.example\";\n\n// <begin>\n\nimport { List } from \"react-window\";\n\nfunction Example({ names }: { names: string[] }) {\n return (\n <List\n rowComponent={RowComponent}\n rowCount={names.length}\n rowHeight={25}\n rowProps={{ names }}\n />\n );\n}\n\n// <end>\n\nexport { Example };\n","export const EMPTY_ARRAY: unknown[] = [];\nexport const EMPTY_OBJECT = {};\nexport const NOOP_FUNCTION = () => {};\n","import { Block } from \"../../components/Block\";\nimport { Box } from \"../../components/Box\";\nimport { Callout } from \"../../components/Callout\";\nimport { FormattedCode } from \"../../components/code/FormattedCode\";\nimport { ContinueLink } from \"../../components/ContinueLink\";\nimport { ExternalLink } from \"../../components/ExternalLink\";\nimport { Header } from \"../../components/Header\";\nimport { LoadingSpinner } from \"../../components/LoadingSpinner\";\nimport { Example } from \"./examples/FixedHeightList.example\";\nimport { useNames } from \"./hooks/useNames\";\n\nexport default function FixedRowHeightsRoute() {\n const names = useNames();\n\n return (\n <Box direction=\"column\" gap={4}>\n <Header section=\"Lists\" title=\"Fixed row heights\" />\n <div>\n The simplest type of list to render is one with fixed row heights.\n </div>\n <Block className=\"h-50\" data-focus-within=\"bold\">\n {!names.length && <LoadingSpinner />}\n <Example names={names} />\n </Block>\n <div>\n To render this type of list, you need to specify how many rows it\n contains (<code>rowCount</code>), which component should render rows (\n <code>rowComponent</code>), and the height of each row (\n <code>rowHeight</code>):\n </div>\n <FormattedCode url=\"/generated/code-snippets/FixedHeightList.json\" />\n <div>\n The <code>rowProps</code> object can also be used to share between\n components. Values passed in <code>rowProps</code> will also be passed\n as props to the row component:\n </div>\n <FormattedCode url=\"/generated/code-snippets/FixedHeightRowComponent.json\" />\n <Callout intent=\"warning\">\n <Box direction=\"column\" gap={4}>\n <div>\n Lists require vertical space to render rows. Typically the{\" \"}\n <ExternalLink href=\"https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver\">\n ResizeObserver\n </ExternalLink>{\" \"}\n API is used to determine how much space there is available within\n the parent DOM element.\n </div>\n <div>\n If an explicit height is specified (in pixels) using the{\" \"}\n <code>style</code> prop, <code>ResizeObserver</code> will not be\n used.\n </div>\n </Box>\n </Callout>\n <ContinueLink\n to=\"/list/variable-row-height\"\n title=\"variable row heights\"\n />\n </Box>\n );\n}\n","import { useJSONData } from \"../../../hooks/useJSONData\";\nimport type json from \"../../../../public/data/names.json\";\nimport { EMPTY_ARRAY } from \"../../../constants\";\n\ntype Name = (typeof json)[0];\n\nexport function useNames(): Name[] {\n return useJSONData<Name[]>(\"/data/names.json\") ?? (EMPTY_ARRAY as Name[]);\n}\n"],"names":["RowComponent","index","names","style","jsxs","className","children","jsx","length","Example","List","rowComponent","rowCount","rowHeight","rowProps","EMPTY_ARRAY","FixedRowHeightsRoute","useJSONData","Box","direction","gap","Header","section","title","Block","LoadingSpinner","FormattedCode","url","Callout","intent","ExternalLink","href","ContinueLink","to"],"mappings":"oVAEA,SAASA,GAAaC,MACpBA,EAAAC,MACAA,EAAAC,MACAA,IAIA,SACEC,KAAC,MAAA,CAAIC,UAAU,oCAAoCF,QAChDG,SAAA,CAAAJ,EAAMD,GACPM,EAAAA,IAAC,MAAA,CAAIF,UAAU,yBAA0BC,SAAA,GAAGL,EAAQ,QAAQC,EAAMM,aAGxE,CCTA,SAASC,GAAQP,MAAEA,IACjB,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{u as n,L as a}from"./LoadingSpinner-Z5HQViRD.js";function u({className:e="",html:s}){return t.jsx("code",{className:r("text-xs md:text-sm block text-left whitespace-pre-wrap text-white! rounded-md p-3 bg-black","flex flex-col",e),dangerouslySetInnerHTML:{__html:s}})}function o({url:e}){return t.jsx(s,{children:t.jsx(l,{url:e})})}function l({url:s}){const[o,l]=function(t,r){const[s,n]=e.useState(()=>{const e=localStorage.getItem(t);return null!=e?JSON.parse(e):r}),a=e.useRef({prevValue:null,value:JSON.stringify(s)});return e.useLayoutEffect(()=>{a.current.prevValue=a.current.value,a.current.value=JSON.stringify(s)}),e.useLayoutEffect(()=>{const e=e=>{t===e.key&&e.newValue&&e.newValue!==JSON.stringify(s)&&n(JSON.parse(e.newValue))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}},[t,s]),e.useLayoutEffect(()=>{window.dispatchEvent(new StorageEvent("storage",{key:t,newValue:a.current.value||"",oldValue:a.current.prevValue||""})),localStorage.setItem(t,a.current.value)},[t,s]),[s,n]}("CodeTabs::tab",!0),c=n(s);if(void 0===c)return t.jsx(a,{});const i=t.jsx(u,{html:o?c.typeScript??c.javaScript:c.javaScript});return c.typeScript?t.jsxs("div",{className:"relative",children:[i,t.jsxs("button",{className:r("absolute top-2 right-2 p-1 rounded-sm bg-white/10 cursor-pointer hover:text-sky-300 hover:bg-sky-950 text-xs flex flex-row items-center gap-1",{"text-white/50":!o,"text-sky-300 bg-sky-950/50":o}),onClick:()=>l(!o),children:[o?"TS":"JS",t.jsx("div",{className:r("w-2 h-2 rounded",{"bg-green-400":o,"bg-orange-400":!o})})]})]}):i}export{o as F};
|
|
2
|
+
//# sourceMappingURL=FormattedCode-CAmuOSRw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormattedCode-CAmuOSRw.js","sources":["../../src/components/code/Code.tsx","../../src/components/code/FormattedCode.tsx","../../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { cn } from \"../../utils/cn\";\nimport \"./code-mirror.css\";\n\nexport function Code({\n className = \"\",\n html\n}: {\n className?: string;\n html: string;\n}) {\n return (\n <code\n className={cn(\n \"text-xs md:text-sm block text-left whitespace-pre-wrap text-white! rounded-md p-3 bg-black\",\n \"flex flex-col\",\n className\n )}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n );\n}\n","import { useJSONData } from \"../../hooks/useJSONData\";\nimport useLocalStorage from \"../../hooks/useLocalStorage\";\nimport { cn } from \"../../utils/cn\";\nimport { ErrorBoundary } from \"../ErrorBoundary\";\nimport { LoadingSpinner } from \"../LoadingSpinner\";\nimport { Code } from \"./Code\";\n\ntype Markdown = {\n javaScript: string;\n typeScript?: string;\n};\n\nexport function FormattedCode({ url }: { url: string }) {\n return (\n <ErrorBoundary>\n <FormattedCodeLoader url={url} />\n </ErrorBoundary>\n );\n}\n\nexport function FormattedCodeLoader({ url }: { url: string }) {\n const [ts, setTS] = useLocalStorage(\"CodeTabs::tab\", true);\n\n const json = useJSONData<Markdown>(url);\n\n if (json === undefined) {\n return <LoadingSpinner />;\n }\n\n const code = (\n <Code html={ts ? (json.typeScript ?? json.javaScript) : json.javaScript} />\n );\n\n if (!json.typeScript) {\n return code;\n }\n\n return (\n <div className=\"relative\">\n {code}\n <button\n className={cn(\n \"absolute top-2 right-2 p-1 rounded-sm bg-white/10 cursor-pointer hover:text-sky-300 hover:bg-sky-950 text-xs flex flex-row items-center gap-1\",\n {\n \"text-white/50\": !ts,\n \"text-sky-300 bg-sky-950/50\": ts\n }\n )}\n onClick={() => setTS(!ts)}\n >\n {ts ? \"TS\" : \"JS\"}\n <div\n className={cn(\"w-2 h-2 rounded\", {\n \"bg-green-400\": ts,\n \"bg-orange-400\": !ts\n })}\n />\n </button>\n </div>\n );\n}\n","import { useLayoutEffect, useRef, useState } from \"react\";\n\nexport default function useLocalStorage<Type>(\n key: string,\n defaultValue: Type\n): [value: Type, setValue: (newValue: Type) => void] {\n const [value, setValue] = useState<Type>(() => {\n const storedValue = localStorage.getItem(key);\n if (storedValue != null) {\n return JSON.parse(storedValue) as Type;\n } else {\n return defaultValue;\n }\n });\n\n const committedValuesRef = useRef<{\n prevValue: string | null;\n value: string;\n }>({\n prevValue: null,\n value: JSON.stringify(value)\n });\n useLayoutEffect(() => {\n committedValuesRef.current.prevValue = committedValuesRef.current.value;\n committedValuesRef.current.value = JSON.stringify(value);\n });\n\n // Sync changes from local storage\n useLayoutEffect(() => {\n const onStorage = (event: StorageEvent) => {\n if (\n key === event.key &&\n event.newValue &&\n event.newValue !== JSON.stringify(value)\n ) {\n setValue(JSON.parse(event.newValue));\n }\n };\n\n window.addEventListener(\"storage\", onStorage);\n\n return () => {\n window.removeEventListener(\"storage\", onStorage);\n };\n }, [key, value]);\n\n // Sync changes to local storage\n useLayoutEffect(() => {\n window.dispatchEvent(\n new StorageEvent(\"storage\", {\n key,\n newValue: committedValuesRef.current.value || \"\",\n oldValue: committedValuesRef.current.prevValue || \"\"\n })\n );\n\n localStorage.setItem(key, committedValuesRef.current.value);\n }, [key, value]);\n\n return [value, setValue];\n}\n"],"names":["Code","className","html","jsx","cn","dangerouslySetInnerHTML","__html","FormattedCode","url","ErrorBoundary","children","FormattedCodeLoader","ts","setTS","key","defaultValue","value","setValue","useState","storedValue","localStorage","getItem","JSON","parse","committedValuesRef","useRef","prevValue","stringify","useLayoutEffect","current","onStorage","event","newValue","window","addEventListener","removeEventListener","dispatchEvent","StorageEvent","oldValue","setItem","useLocalStorage","json","useJSONData","LoadingSpinner","code","typeScript","javaScript","jsxs","onClick"],"mappings":"qHAGO,SAASA,GAAKC,UACnBA,EAAY,GAAAC,KACZA,IAKA,OACEC,EAAAA,IAAC,OAAA,CACCF,UAAWG,EACT,6FACA,gBACAH,GAEFI,wBAAyB,CAAEC,OAAQJ,IAGzC,CCRO,SAASK,GAAcC,IAAEA,IAC9B,OACEL,EAAAA,IAACM,EAAA,CACCC,SAAAP,EAAAA,IAACQ,EAAA,CAAoBH,SAG3B,CAEO,SAASG,GAAoBH,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,SAAA,CAAAE,EAAK,KAAO,KACbT,EAAAA,IAAC,MAAA,CACCF,UAAWG,EAAG,kBAAmB,CAC/B,eAAgBQ,EAChB,iBAAkBA,YApBnBgC,CA0BX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tok-comment{color:var(--color-slate-500)}.tok-keyword{color:var(--color-pink-400)}.tok-operator{color:var(--color-slate-400)}.tok-propertyName{color:var(--color-sky-300)}.tok-punctuation{color:var(--color-slate-400)}.tok-string{color:var(--color-teal-300)}.tok-string2{color:var(--color-sky-300)}.tok-typeName{color:var(--color-pink-400)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,B as s,E as i,C as t,L as l}from"./index-B_YQ7rlN.js";import{H as o}from"./Header-BYp8JKXz.js";function r(){return e.jsxs(s,{direction:"column",gap:4,children:[e.jsx(o,{title:"Getting started"}),e.jsxs("div",{children:[e.jsx("strong",{children:"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"," ",e.jsx(i,{href:"https://chromewebstore.google.com/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en",children:"React DevTools"})," ","to the"," ",e.jsx(i,{href:"https://github.com/replayio/devtools",children:"Replay browser"}),"."]}),e.jsx("div",{className:"text-xl",children:"Installation"}),e.jsx("div",{children:"Begin by installing the library from NPM:"}),e.jsxs("code",{className:"grow text-xs md:text-sm block text-left whitespace-pre-wrap rounded-md p-3 bg-black text-white!",children:["npm install ",e.jsx("span",{className:"tok-keyword",children:"react-window"})]}),e.jsxs(t,{intent:"primary",children:["TypeScript definitions are included within the published"," ",e.jsx("code",{children:"dist"})," folder and documentation is included within the"," ",e.jsx("code",{children:"docs"})," folder."]}),e.jsx("div",{children:"This library provides two basic types of components; choose one below to learn more:"}),e.jsxs("ul",{className:"pl-8",children:[e.jsxs("li",{className:"list-disc",children:[e.jsx(l,{to:"/list/fixed-row-height",children:"Lists"})," (vertical scrolling)"]}),e.jsxs("li",{className:"list-disc",children:[e.jsx(l,{to:"/grid/grid",children:"Grids"})," (horizontal and vertical scrolling)"]})]}),e.jsxs("div",{children:["Check out the ",e.jsx(l,{to:"/support",children:"support page"})," if you need help."]})]})}export{r as default};
|
|
2
|
+
//# sourceMappingURL=GettingStartedRoute-zN9jVy3e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GettingStartedRoute-zN9jVy3e.js","sources":["../../src/routes/GettingStartedRoute.tsx"],"sourcesContent":["import { Box } from \"../components/Box\";\nimport { Callout } from \"../components/Callout\";\nimport { ExternalLink } from \"../components/ExternalLink\";\nimport { Header } from \"../components/Header\";\nimport { Link } from \"../components/Link\";\n\nexport default function GettingStartedRoute() {\n return (\n <Box direction=\"column\" gap={4}>\n <Header title=\"Getting started\" />\n <div>\n <strong>react-window</strong> is a component library that helps render\n large lists of data quickly and without the performance problems that\n often go along with rendering a lot of data. It's used in a lot of\n places, from{\" \"}\n <ExternalLink href=\"https://chromewebstore.google.com/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en\">\n React DevTools\n </ExternalLink>{\" \"}\n to the{\" \"}\n <ExternalLink href=\"https://github.com/replayio/devtools\">\n Replay browser\n </ExternalLink>\n .\n </div>\n <div className=\"text-xl\">Installation</div>\n <div>Begin by installing the library from NPM:</div>\n <code className=\"grow text-xs md:text-sm block text-left whitespace-pre-wrap rounded-md p-3 bg-black text-white!\">\n npm install <span className=\"tok-keyword\">react-window</span>\n </code>\n <Callout intent=\"primary\">\n TypeScript definitions are included within the published{\" \"}\n <code>dist</code> folder and documentation is included within the{\" \"}\n <code>docs</code> folder.\n </Callout>\n <div>\n This library provides two basic types of components; choose one below to\n learn more:\n </div>\n <ul className=\"pl-8\">\n <li className=\"list-disc\">\n <Link to=\"/list/fixed-row-height\">Lists</Link> (vertical scrolling)\n </li>\n <li className=\"list-disc\">\n <Link to=\"/grid/grid\">Grids</Link> (horizontal and vertical scrolling)\n </li>\n </ul>\n <div>\n Check out the <Link to=\"/support\">support page</Link> if you need help.\n </div>\n </Box>\n );\n}\n"],"names":["GettingStartedRoute","jsxs","Box","direction","gap","children","jsx","Header","title","ExternalLink","href","className","Callout","intent","Link","to"],"mappings":"6GAMA,SAAwBA,IACtB,OACEC,EAAAA,KAACC,EAAA,CAAIC,UAAU,SAASC,IAAK,EAC3BC,SAAA,GAAAC,IAACC,EAAA,CAAOC,MAAM,2BACb,MAAA,CACCH,SAAA,GAAAC,IAAC,UAAOD,SAAA,iBAAqB,kMAGhB,IACbC,EAAAA,IAACG,EAAA,CAAaC,KAAK,wGAAwGL,SAAA,mBAE3G,IAAI,SACb,IACPC,EAAAA,IAACG,EAAA,CAAaC,KAAK,uCAAuCL,SAAA,mBAE3C,OAGjBC,EAAAA,IAAC,MAAA,CAAIK,UAAU,UAAUN,SAAA,mBACzBC,IAAC,OAAID,SAAA,gDACLJ,KAAC,OAAA,CAAKU,UAAU,kGAAkGN,SAAA,CAAA,eACpGC,EAAAA,IAAC,OAAA,CAAKK,UAAU,cAAcN,SAAA,sBAE5CJ,KAACW,EAAA,CAAQC,OAAO,UAAUR,SAAA,CAAA,2DACiC,MACzDC,IAAC,QAAKD,SAAA,SAAW,mDAAiD,MAClEC,IAAC,QAAKD,SAAA,SAAW,gBAEnBC,IAAC,OAAID,SAAA,2FAILJ,KAAC,KAAA,CAAGU,UAAU,OACZN,SAAA,GAAAJ,KAAC,KAAA,CAAGU,UAAU,YACZN,SAAA,CAAAC,EAAAA,IAACQ,EAAA,CAAKC,GAAG,yBAAyBV,SAAA,UAAY,6BAEhDJ,KAAC,KAAA,CAAGU,UAAU,YACZN,SAAA,CAAAC,EAAAA,IAACQ,EAAA,CAAKC,GAAG,aAAaV,SAAA,UAAY,oDAGrC,MAAA,CAAIA,SAAA,CAAA,iBACWC,EAAAA,IAACQ,EAAA,CAAKC,GAAG,WAAWV,SAAA,iBAAmB,0BAI7D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,j as t}from"./index-B_YQ7rlN.js";import{u as o,a as n,b as l}from"./arePropsEqual-D3jAKwxp.js";function r({cellComponent:r,cellProps:i,className:s,columnCount:a,columnWidth:c,defaultHeight:d=0,defaultWidth:u=0,dir:f,gridRef:m,onCellsRendered:x,onResize:h,overscanCount:g=3,rowCount:p,rowHeight:v,style:S,...C}){const I=o(i),w=e.useMemo(()=>e.memo(r,n),[r]),[z,b]=e.useState(null),E=function(t,o){const[n,l]=e.useState("rtl"===o);return e.useLayoutEffect(()=>{t&&(o||l(function(e){let t=e;for(;t;){if(t.dir)return"rtl"===t.dir;t=t.parentElement}return!1}(t)))},[o,t]),n}(z,f),{getCellBounds:O,getEstimatedSize:R,startIndex:T,scrollToIndex:y,stopIndex:j}=l({containerElement:z,defaultContainerSize:u,direction:"horizontal",isRtl:E,itemCount:a,itemProps:I,itemSize:c,onResize:h,overscanCount:g}),{getCellBounds:H,getEstimatedSize:P,startIndex:$,scrollToIndex:L,stopIndex:N}=l({containerElement:z,defaultContainerSize:d,direction:"vertical",itemCount:p,itemProps:I,itemSize:v,onResize:h,overscanCount:g});e.useImperativeHandle(m,()=>({get element(){return z},scrollToCell({behavior:e="auto",columnAlign:t="auto",columnIndex:o,rowAlign:n="auto",rowIndex:l}){L({align:n,behavior:e,containerScrollOffset:z?.scrollTop??0,index:l}),y({align:t,behavior:e,containerScrollOffset:z?.scrollLeft??0,index:o})},scrollToColumn({align:e="auto",behavior:t="auto",index:o}){y({align:e,behavior:t,containerScrollOffset:z?.scrollLeft??0,index:o})},scrollToRow({align:e="auto",behavior:t="auto",index:o}){L({align:e,behavior:t,containerScrollOffset:z?.scrollTop??0,index:o})}}),[z,y,L]),e.useEffect(()=>{T>=0&&j>=0&&$>=0&&N>=0&&x&&x({columnStartIndex:T,columnStopIndex:j,rowStartIndex:$,rowStopIndex:N})},[x,T,j,$,N]);const W=e.useMemo(()=>{const t=[];if(a>0&&p>0)for(let o=$;o<=N;o++){const n=H(o);for(let l=T;l<=j;l++){const r=O(l);t.push(e.createElement(w,{...I,columnIndex:l,key:`${o}-${l}`,rowIndex:o,style:{position:"absolute",left:E?void 0:0,right:E?0:void 0,transform:`translate(${E?-r.scrollOffset:r.scrollOffset}px, ${n.scrollOffset}px)`,height:p>1?n.size:"100%",width:r.size}}))}}return t},[w,I,a,T,j,O,H,E,p,$,N]);return t.jsx("div",{...C,className:s,dir:f,ref:b,style:{width:"100%",height:"100%",...S,maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto"},children:t.jsx("div",{className:s,style:{position:"relative",height:P(),width:R()},children:W})})}export{r as G};
|
|
2
|
+
//# sourceMappingURL=Grid-DH-j7ODh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid-DH-j7ODh.js","sources":["../../lib/components/grid/Grid.tsx","../../lib/core/useIsRtl.ts","../../lib/utils/isRtl.ts"],"sourcesContent":["import {\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport type { GridProps } from \"./types\";\n\nexport function Grid<CellProps extends object>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\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 ...rest\n}: GridProps<CellProps>) {\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 startIndex: columnStartIndex,\n scrollToIndex: scrollToColumnIndex,\n stopIndex: columnStopIndex\n } = useVirtualizer({\n containerElement: element,\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 startIndex: rowStartIndex,\n scrollToIndex: scrollToRowIndex,\n stopIndex: rowStopIndex\n } = useVirtualizer({\n containerElement: element,\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 scrollToRowIndex({\n align: rowAlign,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index: rowIndex\n });\n scrollToColumnIndex({\n align: columnAlign,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index: columnIndex\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 scrollToColumnIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollLeft ?? 0,\n index\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 scrollToRowIndex({\n align,\n behavior,\n containerScrollOffset: element?.scrollTop ?? 0,\n index\n });\n }\n }),\n [element, scrollToColumnIndex, scrollToRowIndex]\n );\n\n useEffect(() => {\n if (\n columnStartIndex >= 0 &&\n columnStopIndex >= 0 &&\n rowStartIndex >= 0 &&\n rowStopIndex >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered({\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n });\n }\n }, [\n onCellsRendered,\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {\n const rowBounds = getRowBounds(rowIndex);\n for (\n let columnIndex = columnStartIndex;\n columnIndex <= columnStopIndex;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n children.push(\n <CellComponent\n {...(cellProps as CellProps)}\n columnIndex={columnIndex}\n key={`${rowIndex}-${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: rowCount > 1 ? rowBounds.size : \"100%\",\n width: columnBounds.size\n }}\n />\n );\n }\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnStartIndex,\n columnStopIndex,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowStartIndex,\n rowStopIndex\n ]);\n\n return (\n <div\n {...rest}\n className={className}\n dir={dir}\n ref={setElement}\n style={{\n width: \"100%\",\n height: \"100%\",\n ...style,\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n flexGrow: 1,\n overflow: \"auto\"\n }}\n >\n <div\n className={className}\n style={{\n position: \"relative\",\n height: getEstimatedHeight(),\n width: getEstimatedWidth()\n }}\n >\n {cells}\n </div>\n </div>\n );\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","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"],"names":["Grid","cellComponent","CellComponentProp","cellProps","cellPropsUnstable","className","columnCount","columnWidth","defaultHeight","defaultWidth","dir","gridRef","onCellsRendered","onResize","overscanCount","rowCount","rowHeight","style","rest","useMemoizedObject","CellComponent","useMemo","memo","arePropsEqual","element","setElement","useState","isRtl","value","setValue","useLayoutEffect","currentElement","parentElement","useIsRtl","getCellBounds","getColumnBounds","getEstimatedSize","getEstimatedWidth","startIndex","columnStartIndex","scrollToIndex","scrollToColumnIndex","stopIndex","columnStopIndex","useVirtualizer","containerElement","defaultContainerSize","direction","itemCount","itemProps","itemSize","getRowBounds","getEstimatedHeight","rowStartIndex","scrollToRowIndex","rowStopIndex","useImperativeHandle","scrollToCell","behavior","columnAlign","columnIndex","rowAlign","rowIndex","align","containerScrollOffset","scrollTop","index","scrollLeft","scrollToColumn","scrollToRow","useEffect","cells","children","rowBounds","columnBounds","push","createElement","key","position","left","right","transform","scrollOffset","height","size","width","jsx","ref","maxHeight","maxWidth","flexGrow","overflow"],"mappings":"6GAeO,SAASA,GACdC,cAAeC,EACfC,UAAWC,EAAAC,UACXA,EAAAC,YACAA,EAAAC,YACAA,EAAAC,cACAA,EAAgB,EAAAC,aAChBA,EAAe,EAAAC,IACfA,EAAAC,QACAA,EAAAC,gBACAA,EAAAC,SACAA,EAAAC,cACAA,EAAgB,EAAAC,SAChBA,EAAAC,UACAA,EAAAC,MACAA,KACGC,IAEH,MAAMf,EAAYgB,EAAkBf,GAC9BgB,EAAgBC,EAAAA,QACpB,IAAMC,EAAAA,KAAKpB,EA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U,EACVC,SAAU,QAGZnB,SAAAc,EAAAA,IAAC,MAAA,CACCjF,YACAY,MAAO,CACL6D,SAAU,WACVK,OAAQ/B,IACRiC,MAAOhD,KAGRmC,SAAAD,KAIT"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,j as t,B as s,F as i}from"./index-B_YQ7rlN.js";function n({section:n,title:c}){return e.useEffect(()=>{const e=document.title;return document.title=`react-window: ${n?`${n}: ${c}`:c}`,()=>{document.title=e}}),t.jsxs(s,{align:"center",direction:"row",gap:2,children:[n&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-xl",children:n}),t.jsx(i,{className:"size-4 text-slate-400"})]}),t.jsx("div",{className:"text-xl",children:c})]})}export{n as H};
|
|
2
|
+
//# sourceMappingURL=Header-BYp8JKXz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header-BYp8JKXz.js","sources":["../../src/components/Header.tsx"],"sourcesContent":["import { ChevronRightIcon } from \"@heroicons/react/20/solid\";\nimport { Box } from \"./Box\";\nimport { useEffect } from \"react\";\n\nexport function Header({\n section,\n title\n}: {\n section?: string;\n title: string;\n}) {\n useEffect(() => {\n const originalTitle = document.title;\n\n document.title = `react-window: ${section ? `${section}: ${title}` : title}`;\n\n return () => {\n document.title = originalTitle;\n };\n });\n\n return (\n <Box align=\"center\" direction=\"row\" gap={2}>\n {section && (\n <>\n <div className=\"text-xl\">{section}</div>\n <ChevronRightIcon className=\"size-4 text-slate-400\" />\n </>\n )}\n <div className=\"text-xl\">{title}</div>\n </Box>\n );\n}\n"],"names":["Header","section","title","useEffect","originalTitle","document","Box","align","direction","gap","children","jsxs","Fragment","jsx","className","ChevronRightIcon"],"mappings":"6DAIO,SAASA,GAAOC,QACrBA,EAAAC,MACAA,IAeA,OAVAC,EAAAA,UAAU,KACR,MAAMC,EAAgBC,SAASH,MAI/B,OAFAG,SAASH,MAAQ,iBAAiBD,EAAU,GAAGA,MAAYC,IAAUA,IAE9D,KACLG,SAASH,MAAQE,YAKlBE,EAAA,CAAIC,MAAM,SAASC,UAAU,MAAMC,IAAK,EACtCC,SAAA,CAAAT,GACCU,EAAAA,KAAAC,WAAA,CACEF,SAAA,CAAAG,EAAAA,IAAC,MAAA,CAAIC,UAAU,UAAWJ,SAAAT,MAC1BY,IAACE,EAAA,CAAiBD,UAAU,6BAGhCD,EAAAA,IAAC,MAAA,CAAIC,UAAU,UAAWJ,SAAAR,MAGhC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,c as s,r as o,B as r}from"./index-B_YQ7rlN.js";import{B as n}from"./arePropsEqual-D3jAKwxp.js";import{F as t}from"./FormattedCode-CAmuOSRw.js";import{u as i,L as l}from"./LoadingSpinner-Z5HQViRD.js";import{G as a}from"./Grid-DH-j7ODh.js";function d({columnIndex:o,emails:r,style:n}){return e.jsx("div",{className:s("px-2 truncate text-center leading-[2.5]",{"bg-white/10 rounded":o%2==0}),style:n,children:r[o]})}function c({emails:s}){return e.jsx(a,{cellComponent:d,cellProps:{emails:s},columnCount:s.length,columnWidth:150,rowCount:1,rowHeight:"100%"})}function m(){const s=function(){const e=i("/data/contacts.json");return o.useMemo(()=>e?e.map(e=>e.email).sort((e,s)=>e.localeCompare(s)):[],[e])}();return e.jsxs(r,{direction:"column",gap:4,children:[e.jsx("div",{children:"A horizontal list is just a grid with only one row."}),e.jsx("div",{children:"Here's an example horizontal list (grid) of emails:"}),e.jsxs(n,{className:"h-20","data-focus-within":"bold",children:[!s.length&&e.jsx(l,{}),e.jsx(c,{emails:s})]}),e.jsx("div",{children:"Here's what the configuration for the grid above looks like:"}),e.jsx(t,{url:"/generated/code-snippets/HorizontalList.json"}),e.jsx("div",{children:"And here's the cell renderer:"}),e.jsx(t,{url:"/generated/code-snippets/HorizontalListCellRenderer.json"})]})}export{m as default};
|
|
2
|
+
//# sourceMappingURL=HorizontalListsRoute-rNcKbQ1k.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalListsRoute-rNcKbQ1k.js","sources":["../../src/routes/grid/examples/HorizontalListCellRenderer.example.tsx","../../src/routes/grid/examples/HorizontalList.example.tsx","../../src/routes/grid/HorizontalListsRoute.tsx","../../src/routes/grid/hooks/useEmails.ts"],"sourcesContent":["import { cn } from \"../../../utils/cn\";\n\n// <begin>\n\nimport { type CellComponentProps } from \"react-window\";\n\nfunction CellComponent({\n columnIndex,\n emails,\n style\n}: CellComponentProps<{ emails: string[] }>) {\n return (\n <div\n className={cn(\"px-2 truncate text-center leading-[2.5]\", {\n \"bg-white/10 rounded\": columnIndex % 2 === 0\n })}\n style={style}\n >\n {emails[columnIndex]}\n </div>\n );\n}\n\n// <end>\n\nexport { CellComponent };\n","import { CellComponent } from \"./HorizontalListCellRenderer.example\";\n\n// <begin>\n\nimport { Grid } from \"react-window\";\n\nfunction HorizontalList({ emails }: { emails: string[] }) {\n return (\n <Grid\n cellComponent={CellComponent}\n cellProps={{ emails }}\n columnCount={emails.length}\n columnWidth={150}\n rowCount={1}\n rowHeight=\"100%\"\n />\n );\n}\n\n// <end>\n\nexport { HorizontalList };\n","import { Block } from \"../../components/Block\";\nimport { Box } from \"../../components/Box\";\nimport { FormattedCode } from \"../../components/code/FormattedCode\";\nimport { LoadingSpinner } from \"../../components/LoadingSpinner\";\nimport { HorizontalList } from \"./examples/HorizontalList.example\";\nimport { useEmails } from \"./hooks/useEmails\";\n\nexport default function HorizontalListsRoute() {\n const emails = useEmails();\n\n return (\n <Box direction=\"column\" gap={4}>\n <div>A horizontal list is just a grid with only one row.</div>\n <div>Here's an example horizontal list (grid) of emails:</div>\n <Block className=\"h-20\" data-focus-within=\"bold\">\n {!emails.length && <LoadingSpinner />}\n <HorizontalList emails={emails} />\n </Block>\n <div>Here's what the configuration for the grid above looks like:</div>\n <FormattedCode url=\"/generated/code-snippets/HorizontalList.json\" />\n <div>And here's the cell renderer:</div>\n <FormattedCode url=\"/generated/code-snippets/HorizontalListCellRenderer.json\" />\n </Box>\n );\n}\n","import { useMemo } from \"react\";\nimport type json from \"../../../../public/data/contacts.json\";\nimport { useJSONData } from \"../../../hooks/useJSONData\";\n\ntype Contact = (typeof json)[0];\n\nexport function useEmails(): string[] {\n const json = useJSONData<Contact[]>(\"/data/contacts.json\");\n\n return useMemo(() => {\n if (json) {\n return json\n .map((contact) => contact.email)\n .sort((a, b) => a.localeCompare(b));\n }\n\n return [];\n }, [json]);\n}\n"],"names":["CellComponent","columnIndex","emails","style","jsx","className","cn","children","HorizontalList","Grid","cellComponent","cellProps","columnCount","length","columnWidth","rowCount","rowHeight","HorizontalListsRoute","json","useJSONData","useMemo","map","contact","email","sort","a","b","localeCompare","useEmails","jsxs","Box","direction","gap","Block","LoadingSpinner","FormattedCode","url"],"mappings":"4PAMA,SAASA,GAAcC,YACrBA,EAAAC,OACAA,EAAAC,MACAA,IAEA,OACEC,EAAAA,IAAC,MAAA,CACCC,UAAWC,EAAG,0CAA2C,CACvD,sBAAuBL,EAAc,GAAM,IAE7CE,QAECI,WAAON,IAGd,CCfA,SAASO,GAAeN,OAAEA,IACxB,OACEE,EAAAA,IAACK,EAAA,CACCC,cAAeV,EACfW,UAAW,CAAET,UACbU,YAAaV,EAAOW,OACpBC,YAAa,IACbC,SAAU,EACVC,UAAU,QAGhB,CCVA,SAAwBC,IACtB,MAAMf,ECFD,WACL,MAAMgB,EAAOC,EAAuB,uBAEpC,OAAOC,EAAAA,QAAQ,IACTF,EACKA,EACJG,IAAKC,GAAYA,EAAQC,OACzBC,KAAK,CAACC,EAAGC,IAAMD,EAAEE,cAAcD,IAG7B,GACN,CAACR,GACN,CDViBU,GAEf,OACEC,EAAAA,KAACC,EAAA,CAAIC,UAAU,SAASC,IAAK,EAC3BzB,SAAA,GAAAH,IAAC,OAAIG,SAAA,0DACLH,IAAC,OAAIG,SAAA,wDACLsB,EAAAA,KAACI,EAAA,CAAM5B,UAAU,OAAO,oBAAkB,OACvCE,SAAA,EAACL,EAAOW,cAAWqB,EAAA,CAAA,GACpB9B,MAACI,GAAeN,gBAElBE,IAAC,OAAIG,SAAA,mEACLH,IAAC+B,EAAA,CAAcC,IAAI,mDACnBhC,IAAC,OAAIG,SAAA,oCACLH,IAAC+B,EAAA,CAAcC,IAAI,+DAGzB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,j as o,B as s,a as l,C as a}from"./index-B_YQ7rlN.js";import{G as n}from"./Grid-DH-j7ODh.js";import{B as r}from"./arePropsEqual-D3jAKwxp.js";import{F as t}from"./FormattedCode-CAmuOSRw.js";import{H as i}from"./Header-BYp8JKXz.js";import{S as d}from"./Select-C5ovWBbK.js";import{C as c}from"./CellComponent.example-e4JJmmZM.js";import{u,C as h,c as m}from"./useContacts-BItVOkyi.js";import{L as p}from"./LoadingSpinner-Z5HQViRD.js";const v=e.useRef,x={label:"",value:""},j=["auto","center","end","smart","start"].map(e=>({label:`align: ${e}`,value:e}));j.unshift(x);const f=["auto","instant","smooth"].map(e=>({label:`behavior: ${e}`,value:e}));f.unshift(x);const g=h.map(e=>({label:e,value:e})).sort((e,o)=>e.label.localeCompare(o.label));function C(){const C=u(),b=e.useMemo(()=>{const e=[];return C&&(C.reduce((e,o)=>(e.includes(o.title)||e.push(o.title),e),new Array).sort().forEach(o=>{e.push({label:o,value:o})}),e.unshift(x)),e},[C]),[w,A]=e.useState(),[I,S]=e.useState(),[k,G]=e.useState(x),[N,P]=e.useState(x),R=v(null);return o.jsxs(s,{direction:"column",gap:4,children:[o.jsx(i,{section:"Grids",title:"Imperative API"}),o.jsx("div",{children:"Grid provides an imperative API for responding to events. The recommended way to access this API is to use the exported ref hook:"}),o.jsx(t,{url:"/generated/code-snippets/useGridRefImport.json"}),o.jsx("div",{children:"Attach the ref during render:"}),o.jsx(t,{url:"/generated/code-snippets/useGridRef.json"}),o.jsx("div",{children:"And call API methods in an event handler:"}),o.jsx(t,{url:"/generated/code-snippets/gridRefClickEventHandler.json"}),o.jsx("div",{children:"The form below uses the imperative API to scroll the list:"}),o.jsxs(s,{direction:"row",gap:4,children:[o.jsx(d,{className:"flex-1",onChange:A,options:j,placeholder:"Align",value:w}),o.jsx(d,{className:"flex-1",onChange:S,options:f,placeholder:"Scroll behavior",value:I})]}),o.jsxs(s,{direction:"row",gap:4,children:[o.jsx(d,{className:"flex-1",onChange:P,options:b,placeholder:"Job title",value:N}),o.jsx(d,{className:"flex-1",onChange:G,options:g,placeholder:"Column",value:k}),o.jsx(l,{className:"shrink-0",disabled:!k.value&&!N.value,onClick:()=>{const e=R.current;if(e){const o=k?.value?h.indexOf(k.value):void 0,s=N?.value?C.findIndex(e=>e.title===N.value):void 0;void 0!==o&&void 0!==s?e.scrollToCell({behavior:I?.value,columnAlign:w?.value,columnIndex:o,rowAlign:w?.value,rowIndex:s}):void 0!==o?e.scrollToColumn({align:w?.value,behavior:I?.value,index:o}):void 0!==s&&e.scrollToRow({align:w?.value,behavior:I?.value,index:s})}},children:"Scroll"})]}),o.jsxs(r,{className:"h-50","data-focus-within":"bold",children:[!C.length&&o.jsx(p,{}),o.jsx(n,{cellComponent:c,cellProps:{contacts:C},columnCount:g.length,columnWidth:m,gridRef:R,rowCount:C.length,rowHeight:25})]}),o.jsxs("div",{children:["The Grid API also provides ",o.jsx("code",{children:"scrollToColumn"})," and"," ",o.jsx("code",{children:"scrollToRow"})," methods for single-axis scrolling."]}),o.jsxs(a,{intent:"primary",children:[o.jsx("strong",{className:"text-sky-300",children:"Note"})," If you are passing the ref to another component or hook, use the ref callback function instead."]}),o.jsx(t,{url:"/generated/code-snippets/useGridCallbackRef.json"})]})}export{C as default};
|
|
2
|
+
//# sourceMappingURL=ImperativeApiRoute-DD9Z7HWg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImperativeApiRoute-DD9Z7HWg.js","sources":["../../lib/components/grid/useGridRef.ts","../../src/routes/grid/ImperativeApiRoute.tsx"],"sourcesContent":["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 { useMemo, useState } from \"react\";\nimport { Grid, useGridRef, type Align } from \"react-window\";\nimport { Block } from \"../../components/Block\";\nimport { Box } from \"../../components/Box\";\nimport { Button } from \"../../components/Button\";\nimport { Callout } from \"../../components/Callout\";\nimport { FormattedCode } from \"../../components/code/FormattedCode\";\nimport { Header } from \"../../components/Header\";\nimport { Select, type Option } from \"../../components/Select\";\nimport { CellComponent } from \"./examples/CellComponent.example\";\nimport { columnWidth } from \"./examples/columnWidth.example\";\nimport type { Contact } from \"./examples/Grid.example\";\nimport { COLUMN_KEYS } from \"./examples/shared\";\nimport { useContacts } from \"./hooks/useContacts\";\nimport { LoadingSpinner } from \"../../components/LoadingSpinner\";\n\nconst EMPTY_OPTION: Option<string> = {\n label: \"\",\n value: \"\"\n};\n\nconst ALIGNMENTS: Option<Align>[] = (\n [\"auto\", \"center\", \"end\", \"smart\", \"start\"] satisfies Align[]\n).map((value) => ({\n label: `align: ${value}`,\n value\n}));\nALIGNMENTS.unshift(EMPTY_OPTION as Option<Align>);\n\nconst BEHAVIORS: Option<ScrollBehavior>[] = (\n [\"auto\", \"instant\", \"smooth\"] satisfies ScrollBehavior[]\n).map((value) => ({\n label: `behavior: ${value}`,\n value\n}));\nBEHAVIORS.unshift(EMPTY_OPTION as Option<ScrollBehavior>);\n\nconst COLUMNS: Option<string>[] = COLUMN_KEYS.map((key) => ({\n label: key,\n value: key\n})).sort((a, b) => a.label.localeCompare(b.label));\n\nexport default function GridImperativeApiRoute() {\n const contacts = useContacts();\n\n const titleOptions = useMemo<Option<string>[]>(() => {\n const options: Option<string>[] = [];\n if (contacts) {\n contacts\n .reduce((array, contact) => {\n if (!array.includes(contact.title)) {\n array.push(contact.title);\n }\n return array;\n }, new Array<string>())\n .sort()\n .forEach((title) => {\n options.push({\n label: title,\n value: title\n });\n });\n\n options.unshift(EMPTY_OPTION);\n }\n\n return options;\n }, [contacts]);\n\n const [align, setAlign] = useState<Option<Align> | undefined>();\n const [behavior, setBehavior] = useState<\n Option<ScrollBehavior> | undefined\n >();\n const [column, setColumn] = useState<Option<string>>(EMPTY_OPTION);\n const [title, setTitle] = useState<Option<string>>(EMPTY_OPTION);\n\n const gridRef = useGridRef(null);\n\n const scrollToRow = () => {\n const grid = gridRef.current;\n if (grid) {\n const columnIndex = column?.value\n ? COLUMN_KEYS.indexOf(column.value as keyof Contact)\n : undefined;\n\n const rowIndex = title?.value\n ? contacts.findIndex((row) => row.title === title.value)\n : undefined;\n\n if (columnIndex !== undefined && rowIndex !== undefined) {\n grid.scrollToCell({\n behavior: behavior?.value,\n columnAlign: align?.value,\n columnIndex,\n rowAlign: align?.value,\n rowIndex\n });\n } else if (columnIndex !== undefined) {\n grid.scrollToColumn({\n align: align?.value,\n behavior: behavior?.value,\n index: columnIndex\n });\n } else if (rowIndex !== undefined) {\n grid.scrollToRow({\n align: align?.value,\n behavior: behavior?.value,\n index: rowIndex\n });\n }\n }\n };\n\n return (\n <Box direction=\"column\" gap={4}>\n <Header section=\"Grids\" title=\"Imperative API\" />\n <div>\n Grid provides an imperative API for responding to events. The\n recommended way to access this API is to use the exported ref hook:\n </div>\n <FormattedCode url=\"/generated/code-snippets/useGridRefImport.json\" />\n <div>Attach the ref during render:</div>\n <FormattedCode url=\"/generated/code-snippets/useGridRef.json\" />\n <div>And call API methods in an event handler:</div>\n <FormattedCode url=\"/generated/code-snippets/gridRefClickEventHandler.json\" />\n <div>The form below uses the imperative API to scroll the list:</div>\n <Box direction=\"row\" gap={4}>\n <Select\n className=\"flex-1\"\n onChange={setAlign}\n options={ALIGNMENTS}\n placeholder=\"Align\"\n value={align}\n />\n <Select\n className=\"flex-1\"\n onChange={setBehavior}\n options={BEHAVIORS}\n placeholder=\"Scroll behavior\"\n value={behavior}\n />\n </Box>\n <Box direction=\"row\" gap={4}>\n <Select\n className=\"flex-1\"\n onChange={setTitle}\n options={titleOptions}\n placeholder=\"Job title\"\n value={title}\n />\n <Select\n className=\"flex-1\"\n onChange={setColumn}\n options={COLUMNS}\n placeholder=\"Column\"\n value={column}\n />\n <Button\n className=\"shrink-0\"\n disabled={!column.value && !title.value}\n onClick={scrollToRow}\n >\n Scroll\n </Button>\n </Box>\n <Block className=\"h-50\" data-focus-within=\"bold\">\n {!contacts.length && <LoadingSpinner />}\n <Grid\n cellComponent={CellComponent}\n cellProps={{ contacts }}\n columnCount={COLUMNS.length}\n columnWidth={columnWidth}\n gridRef={gridRef}\n rowCount={contacts.length}\n rowHeight={25}\n />\n </Block>\n <div>\n The Grid API also provides <code>scrollToColumn</code> and{\" \"}\n <code>scrollToRow</code> methods for single-axis scrolling.\n </div>\n <Callout intent=\"primary\">\n <strong className=\"text-sky-300\">Note</strong> If you are passing the\n ref to another component or hook, use the ref callback function instead.\n </Callout>\n <FormattedCode url=\"/generated/code-snippets/useGridCallbackRef.json\" />\n </Box>\n );\n}\n"],"names":["useGridRef","useRef","EMPTY_OPTION","label","value","ALIGNMENTS","map","unshift","BEHAVIORS","COLUMNS","COLUMN_KEYS","key","sort","a","b","localeCompare","GridImperativeApiRoute","contacts","useContacts","titleOptions","useMemo","options","reduce","array","contact","includes","title","push","Array","forEach","align","setAlign","useState","behavior","setBehavior","column","setColumn","setTitle","gridRef","jsxs","Box","direction","gap","children","jsx","Header","section","FormattedCode","url","Select","className","onChange","placeholder","Button","disabled","onClick","grid","current","columnIndex","indexOf","rowIndex","findIndex","row","scrollToCell","columnAlign","rowAlign","scrollToColumn","index","scrollToRow","Block","length","LoadingSpinner","Grid","cellComponent","CellComponent","cellProps","columnCount","columnWidth","rowCount","rowHeight","Callout","intent"],"mappings":"6bAMO,MAAMA,EAAaC,EAAAA,OCUpBC,EAA+B,CACnCC,MAAO,GACPC,MAAO,IAGHC,EACJ,CAAC,OAAQ,SAAU,MAAO,QAAS,SACnCC,IAAKF,IAAA,CACLD,MAAO,UAAUC,IACjBA,WAEFC,EAAWE,QAAQL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Gd,MAAA,CAAIpC,SAAA,CAAA,gCACwBC,IAAC,QAAKD,SAAA,mBAAqB,OAAK,MAC3DC,IAAC,QAAKD,SAAA,gBAAkB,2CAE1BJ,KAACyC,EAAA,CAAQC,OAAO,UACdtC,SAAA,CAAAC,EAAAA,IAAC,SAAA,CAAOM,UAAU,eAAeP,SAAA,SAAa,wGAGhDC,IAACG,EAAA,CAAcC,IAAI,uDAGzB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,j as s,B as t,a,C as o}from"./index-B_YQ7rlN.js";import{L as n}from"./List-C4KHYcVU.js";import{B as r}from"./arePropsEqual-D3jAKwxp.js";import{F as i}from"./FormattedCode-CAmuOSRw.js";import{H as l}from"./Header-BYp8JKXz.js";import{L as c}from"./LoadingSpinner-Z5HQViRD.js";import{S as d}from"./Select-C5ovWBbK.js";import{u,R as h}from"./useCitiesByState-azL1M3ue.js";const p=e.useRef;function m(e,{items:s}){return"state"===s[e].type?30:25}const j={label:"",value:""},f=["auto","center","end","smart","start"].map(e=>({label:`align: ${e}`,value:e}));f.unshift(j);const x=["auto","instant","smooth"].map(e=>({label:`behavior: ${e}`,value:e}));function v(){const[v,g]=e.useState(),[b,C]=e.useState(),[w,S]=e.useState(j),I=u(),L=e.useMemo(()=>{const e=I.filter(e=>"state"===e.type).map(e=>({label:e.state,value:e.state}));return e.unshift(j),e},[I]),k=p(null);return s.jsxs(t,{direction:"column",gap:4,children:[s.jsx(l,{section:"Lists",title:"Imperative API"}),s.jsx("div",{children:"List provides an imperative API for responding to events. The recommended way to access this API is to use the exported ref hook:"}),s.jsx(i,{url:"/generated/code-snippets/useListRefImport.json"}),s.jsx("div",{children:"Attach the ref during render:"}),s.jsx(i,{url:"/generated/code-snippets/useListRef.json"}),s.jsx("div",{children:"And call API methods in an event handler:"}),s.jsx(i,{url:"/generated/code-snippets/listRefClickEventHandler.json"}),s.jsx("div",{children:"The form below uses the imperative API to scroll the list:"}),s.jsxs(t,{direction:"row",gap:4,children:[s.jsx(d,{className:"flex-1",onChange:g,options:f,placeholder:"Align",value:v}),s.jsx(d,{className:"flex-1",onChange:C,options:x,placeholder:"Scroll behavior",value:b})]}),s.jsxs(t,{direction:"row",gap:4,children:[s.jsx(d,{className:"flex-1",onChange:S,options:L,placeholder:"State",value:w}),s.jsx(a,{className:"shrink-0",disabled:!w.value,onClick:()=>{const e=I.findIndex(e=>"state"===e.type&&e.state===w.value);k.current?.scrollToRow({align:v?.value,behavior:b?.value,index:e})},children:"Scroll"})]}),s.jsxs(r,{className:"h-50","data-focus-within":"bold",children:[!I.length&&s.jsx(c,{}),s.jsx(n,{listRef:k,rowComponent:h,rowCount:I.length,rowHeight:m,rowProps:{items:I}})]}),s.jsxs(o,{intent:"primary",children:[s.jsx("strong",{className:"text-sky-300",children:"Note"})," If you are passing the ref to another component or hook, use the ref callback function instead."]}),s.jsx(i,{url:"/generated/code-snippets/useListCallbackRef.json"})]})}x.unshift(j);export{v as default};
|
|
2
|
+
//# sourceMappingURL=ImperativeApiRoute-DntU9ReR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImperativeApiRoute-DntU9ReR.js","sources":["../../lib/components/list/useListRef.ts","../../src/routes/list/examples/rowHeight.example.ts","../../src/routes/list/ImperativeApiRoute.tsx"],"sourcesContent":["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","import type { RowProps } from \"./ListVariableRowHeights.example\";\n\n// <begin>\n\nfunction rowHeight(index: number, { items }: RowProps) {\n return items[index].type === \"state\" ? 30 : 25;\n}\n\n// <end>\n\nexport { rowHeight };\n","import { useMemo, useState } from \"react\";\nimport { List, useListRef, type Align } from \"react-window\";\nimport { Block } from \"../../components/Block\";\nimport { Box } from \"../../components/Box\";\nimport { Button } from \"../../components/Button\";\nimport { Callout } from \"../../components/Callout\";\nimport { FormattedCode } from \"../../components/code/FormattedCode\";\nimport { Header } from \"../../components/Header\";\nimport { LoadingSpinner } from \"../../components/LoadingSpinner\";\nimport { Select, type Option } from \"../../components/Select\";\nimport { RowComponent } from \"./examples/ListVariableRowHeights.example\";\nimport { rowHeight } from \"./examples/rowHeight.example\";\nimport { useCitiesByState } from \"./hooks/useCitiesByState\";\n\nconst EMPTY_OPTION: Option<string> = {\n label: \"\",\n value: \"\"\n};\n\nconst ALIGNMENTS: Option<Align>[] = (\n [\"auto\", \"center\", \"end\", \"smart\", \"start\"] satisfies Align[]\n).map((value) => ({\n label: `align: ${value}`,\n value\n}));\nALIGNMENTS.unshift(EMPTY_OPTION as Option<Align>);\n\nconst BEHAVIORS: Option<ScrollBehavior>[] = (\n [\"auto\", \"instant\", \"smooth\"] satisfies ScrollBehavior[]\n).map((value) => ({\n label: `behavior: ${value}`,\n value\n}));\nBEHAVIORS.unshift(EMPTY_OPTION as Option<ScrollBehavior>);\n\nexport default function ListImperativeApiRoute() {\n const [align, setAlign] = useState<Option<Align> | undefined>();\n const [behavior, setBehavior] = useState<\n Option<ScrollBehavior> | undefined\n >();\n const [state, setState] = useState<Option<string>>(EMPTY_OPTION);\n\n const citiesByState = useCitiesByState();\n\n const stateOptions = useMemo<Option<string>[]>(() => {\n const options: Option<string>[] = citiesByState\n .filter((item) => item.type === \"state\")\n .map((item) => ({\n label: item.state,\n value: item.state\n }));\n options.unshift(EMPTY_OPTION);\n\n return options;\n }, [citiesByState]);\n\n const listRef = useListRef(null);\n\n const scrollToRow = () => {\n const index = citiesByState.findIndex(\n (item) => item.type === \"state\" && item.state === state.value\n );\n listRef.current?.scrollToRow({\n align: align?.value,\n behavior: behavior?.value,\n index\n });\n };\n\n return (\n <Box direction=\"column\" gap={4}>\n <Header section=\"Lists\" title=\"Imperative API\" />\n <div>\n List provides an imperative API for responding to events. The\n recommended way to access this API is to use the exported ref hook:\n </div>\n <FormattedCode url=\"/generated/code-snippets/useListRefImport.json\" />\n <div>Attach the ref during render:</div>\n <FormattedCode url=\"/generated/code-snippets/useListRef.json\" />\n <div>And call API methods in an event handler:</div>\n <FormattedCode url=\"/generated/code-snippets/listRefClickEventHandler.json\" />\n <div>The form below uses the imperative API to scroll the list:</div>\n <Box direction=\"row\" gap={4}>\n <Select\n className=\"flex-1\"\n onChange={setAlign}\n options={ALIGNMENTS}\n placeholder=\"Align\"\n value={align}\n />\n <Select\n className=\"flex-1\"\n onChange={setBehavior}\n options={BEHAVIORS}\n placeholder=\"Scroll behavior\"\n value={behavior}\n />\n </Box>\n <Box direction=\"row\" gap={4}>\n <Select\n className=\"flex-1\"\n onChange={setState}\n options={stateOptions}\n placeholder=\"State\"\n value={state}\n />\n <Button\n className=\"shrink-0\"\n disabled={!state.value}\n onClick={scrollToRow}\n >\n Scroll\n </Button>\n </Box>\n <Block className=\"h-50\" data-focus-within=\"bold\">\n {!citiesByState.length && <LoadingSpinner />}\n <List\n listRef={listRef}\n rowComponent={RowComponent}\n rowCount={citiesByState.length}\n rowHeight={rowHeight}\n rowProps={{ items: citiesByState }}\n />\n </Block>\n <Callout intent=\"primary\">\n <strong className=\"text-sky-300\">Note</strong> If you are passing the\n ref to another component or hook, use the ref callback function instead.\n </Callout>\n <FormattedCode url=\"/generated/code-snippets/useListCallbackRef.json\" />\n </Box>\n );\n}\n"],"names":["useListRef","useRef","rowHeight","index","items","type","EMPTY_OPTION","label","value","ALIGNMENTS","map","unshift","BEHAVIORS","ListImperativeApiRoute","align","setAlign","useState","behavior","setBehavior","state","setState","citiesByState","useCitiesByState","stateOptions","useMemo","options","filter","item","listRef","jsxs","Box","direction","gap","children","jsx","Header","section","title","FormattedCode","url","Select","className","onChange","placeholder","Button","disabled","onClick","findIndex","current","scrollToRow","Block","length","LoadingSpinner","List","rowComponent","RowComponent","rowCount","rowProps","Callout","intent"],"mappings":"8XAMO,MAAMA,EAAaC,EAAAA,OCF1B,SAASC,EAAUC,GAAeC,MAAEA,IAClC,MAA6B,UAAtBA,EAAMD,GAAOE,KA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C,UAAU,MAAMC,IAAK,EACxBC,SAAA,CAAAC,EAAAA,IAACM,EAAA,CACCC,UAAU,SACVC,SAAUtB,EACVK,QAASF,EACToB,YAAY,QACZnC,MAAOW,IAETe,EAAAA,IAACU,EAAA,CACCH,UAAU,WACVI,UAAW1B,EAAMX,MACjBsC,QAnDY,KAClB,MAAM3C,EAAQkB,EAAc0B,UACzBpB,GAAuB,UAAdA,EAAKtB,MAAoBsB,EAAKR,QAAUA,EAAMX,OAE1DoB,EAAQoB,SAASC,YAAY,CAC3BnC,MAAOA,GAAON,MACdS,SAAUA,GAAUT,MACpBL,WA6CG8B,SAAA,cAIHJ,EAAAA,KAACqB,EAAA,CAAMT,UAAU,OAAO,oBAAkB,OACvCR,SAAA,EAACZ,EAAc8B,cAAWC,EAAA,CAAA,GAC3BlB,EAAAA,IAACmB,EAAA,CACCzB,UACA0B,aAAcC,EACdC,SAAUnC,EAAc8B,OACxBjD,YACAuD,SAAU,CAAErD,MAAOiB,UAGvBQ,KAAC6B,EAAA,CAAQC,OAAO,UACd1B,SAAA,CAAAC,EAAAA,IAAC,SAAA,CAAOO,UAAU,eAAeR,SAAA,SAAa,wGAGhDC,IAACI,EAAA,CAAcC,IAAI,uDAGzB,CAlGA3B,EAAUD,QAAQL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,j as t}from"./index-B_YQ7rlN.js";import{u as o,a as s,b as n}from"./arePropsEqual-D3jAKwxp.js";function r({className:r,defaultHeight:i=0,listRef:a,onResize:l,onRowsRendered:u,overscanCount:c=3,rowComponent:d,rowCount:m,rowHeight:f,rowProps:p,style:x,...h}){const g=o(p),v=e.useMemo(()=>e.memo(d,s),[d]),[w,C]=e.useState(null),{getCellBounds:z,getEstimatedSize:I,scrollToIndex:R,startIndex:j,stopIndex:y}=n({containerElement:w,defaultContainerSize:i,direction:"vertical",itemCount:m,itemProps:g,itemSize:f,onResize:l,overscanCount:c});e.useImperativeHandle(a,()=>({get element(){return w},scrollToRow({align:e="auto",behavior:t="auto",index:o}){R({align:e,behavior:t,containerScrollOffset:w?.scrollTop??0,index:o})}}),[w,R]),e.useEffect(()=>{j>=0&&y>=0&&u&&u({startIndex:j,stopIndex:y})},[u,j,y]);const E=e.useMemo(()=>{const t=[];if(m>0)for(let o=j;o<=y;o++){const s=z(o);t.push(e.createElement(v,{...g,key:o,index:o,style:{position:"absolute",left:0,transform:`translateY(${s.scrollOffset}px)`,height:s.size,width:"100%"}}))}return t},[v,z,m,g,j,y]);return t.jsx("div",{...h,className:r,ref:C,style:{...x,maxHeight:"100%",flexGrow:1,overflowY:"auto"},children:t.jsx("div",{className:r,style:{height:I(),position:"relative",width:"100%"},children:E})})}export{r as L};
|
|
2
|
+
//# sourceMappingURL=List-C4KHYcVU.js.map
|