@candidstartup/react-virtual-scroll 0.6.2 → 0.7.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 CHANGED
@@ -3,6 +3,8 @@
3
3
  [![NPM bundle size](https://img.shields.io/bundlephobia/minzip/@candidstartup/react-virtual-scroll)](https://www.npmjs.com/package/@candidstartup/react-virtual-scroll)
4
4
  [![Build Status](https://github.com/TheCandidStartup/infinisheet/actions/workflows/build.yml/badge.svg?event=push)](https://github.com/TheCandidStartup/infinisheet/actions/workflows/build.yml)
5
5
 
6
+ [GitHub](https://github.com/TheCandidStartup/infinisheet/tree/main/packages/react-virtual-scroll) | [NPM](https://www.npmjs.com/package/@candidstartup/react-virtual-scroll) | [Storybook](https://www.thecandidstartup.org/infinisheet/storybook/?path=/docs/react-virtual-scroll--docs) | [API](https://www.thecandidstartup.org/infinisheet/modules/_candidstartup_react-virtual-scroll.html)
7
+
6
8
  # @candidstartup/react-virtual-scroll
7
9
 
8
10
  React virtual scrolling components for lists and grids inspired by [react-window](https://github.com/bvaughn/react-window). Written in TypeScript using modern React. Scalable to trillions of rows and columns.
@@ -49,12 +51,12 @@ const list = React.useRef(null);
49
51
  </VirtualList>
50
52
  ```
51
53
 
52
- Check out the [full sample](https://github.com/TheCandidStartup/infinisheet/tree/main/packages/react-virtual-scroll/sandboxes/trillion-row-list) or [try it out on CodeSandbox](https://codesandbox.io/p/sandbox/github/TheCandidStartup/infinisheet/main/packages/react-virtual-scroll/sandboxes/trillion-row-list?file=%2Findex.js)
54
+ Check out the [full sample](https://github.com/TheCandidStartup/infinisheet/tree/main/packages/react-virtual-scroll/sandboxes/trillion-row-list) or [try it out on Storybook](https://www.thecandidstartup.org/infinisheet/storybook/?path=/docs/react-virtual-scroll-virtuallist--docs)
53
55
 
54
56
  ## VirtualGrid Example
55
57
 
56
58
  ```jsx
57
- import { VirtualList, useVariableSizeItemOffsetMapping, useFixedSizeItemOffsetMapping } from '@candidstartup/react-virtual-scroll';
59
+ import { VirtualGrid, useVariableSizeItemOffsetMapping, useFixedSizeItemOffsetMapping } from '@candidstartup/react-virtual-scroll';
58
60
 
59
61
  const rowMapping = useVariableSizeItemOffsetMapping(30, [50]);
60
62
  const columnMapping = useFixedSizeItemOffsetMapping(280);
@@ -74,7 +76,7 @@ const grid = React.useRef(null);
74
76
  </VirtualGrid>
75
77
  ```
76
78
 
77
- Check out the [full sample](https://github.com/TheCandidStartup/infinisheet/tree/main/packages/react-virtual-scroll/sandboxes/trillion-square-grid) or [try it out on CodeSandbox](https://codesandbox.io/p/sandbox/github/TheCandidStartup/infinisheet/main/packages/react-virtual-scroll/sandboxes/trillion-square-grid?file=%2Findex.js)
79
+ Check out the [full sample](https://github.com/TheCandidStartup/infinisheet/tree/main/packages/react-virtual-scroll/sandboxes/trillion-square-grid) or [try it out on Storybook](https://www.thecandidstartup.org/infinisheet/storybook/?path=/docs/react-virtual-scroll-virtualgrid--docs)
78
80
 
79
81
  # More
80
82
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import React$1 from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ItemOffsetMapping } from '@candidstartup/infinisheet-types';
4
+ export { ItemOffsetMapping } from '@candidstartup/infinisheet-types';
3
5
 
4
6
  /**
5
7
  * Props that an implementation of {@link VirtualContainerRender} must accept.
@@ -168,23 +170,6 @@ interface VirtualBaseProps extends VirtualScrollableProps {
168
170
  /** Passed as {@link DisplayBaseItemProps.data} to each child item */
169
171
  itemData?: unknown;
170
172
  }
171
- /**
172
- * Interface that {@link VirtualList} and {@link VirtualGrid} use to determine size and
173
- * positioning offset for items in a single dimension.
174
- */
175
- interface ItemOffsetMapping {
176
- /** Size of item with given index */
177
- itemSize(itemIndex: number): number;
178
- /** Offset from start of container to specified item
179
- *
180
- * `itemOffset(n)` should be equal to `Sum{i:0->n-1}(itemSize(i))`
181
- *
182
- * To efficiently support large containers, cost should be `O(logn)` or better.
183
- */
184
- itemOffset(itemIndex: number): number;
185
- /** Given an offset, return the index of the item that intersects that offset, together with the start offset of that item */
186
- offsetToItem(offset: number): [itemIndex: number, startOffset: number];
187
- }
188
173
  /** Alias for type of event that React passes to a `div` element's `OnScroll` handler. */
189
174
  type ScrollEvent = React$1.SyntheticEvent<HTMLDivElement>;
190
175
  /**
@@ -271,16 +256,19 @@ interface VirtualContentProps {
271
256
  horizontalOffset: number;
272
257
  }
273
258
  /**
274
- * Render prop for content container in {@link VirtualScroll}
259
+ * Render prop for content in {@link VirtualScroll}
275
260
  *
276
- * Pass to {@link VirtualScroll} to render content into the viewport
277
- * implementation. Function must render a div and forward {@link VirtualContentProps}
278
- * and any `ref` to it.
261
+ * Pass as child to {@link VirtualScroll} to render content and forward {@link VirtualContentProps}
262
+ * to whatever needs them.
279
263
  *
280
- * @example Minimal compliant implementation
264
+ * @example Simple implementation
281
265
  * ```
282
- * const contentRender: VirtualContentRender = ({isScrolling, ...rest}, ref) => (
283
- * <div ref={ref} {...rest} />
266
+ * const contentRender: VirtualContentRender = ({isScrolling, verticalOffset, horizontalOffset}) => (
267
+ * <DisplayGrid
268
+ * isScrolling={isScrolling}
269
+ * rowOffset={verticalOffset}
270
+ * columnOffset={horizontalOffset}
271
+ * {...rest}/>
284
272
  * )
285
273
  * ```
286
274
  */
@@ -329,7 +317,7 @@ interface VirtualScrollProps extends VirtualScrollableProps {
329
317
  * Customizable Virtual Scrolling Component
330
318
  *
331
319
  * Allows user to scroll over a virtual area `scrollHeight` x `scrollWidth` pixels.
332
- * Use `onScroll` to track scroll state and `innerRender` to render scroll state specific content into the viewport
320
+ * Use `onScroll` to track scroll state and {@link VirtualContentRender} to render scroll state specific content into the viewport
333
321
  *
334
322
  * Accepts props defined by {@link VirtualScrollProps}.
335
323
  * Refs are forwarded to {@link VirtualScrollProxy}.
@@ -454,10 +442,7 @@ interface DisplayGridProps extends DisplayBaseProps {
454
442
  columnOffset: number;
455
443
  /**
456
444
  * Function that defines the key to use for each item given row and column index and value of {@link DisplayBaseProps.itemData}.
457
- * @defaultValue
458
- * ```ts
459
- * (rowIndex, columnIndex, _data) => `${rowIndex}:${columnIndex}`
460
- * ```
445
+ * @defaultValue `(rowIndex, columnIndex, _data) => '${rowIndex}:${columnIndex}'`
461
446
  */
462
447
  itemKey?: (rowIndex: number, columnIndex: number, data: unknown) => React$1.Key;
463
448
  }
@@ -539,10 +524,7 @@ interface VirtualGridProps extends VirtualBaseProps {
539
524
  columnOffsetMapping: ItemOffsetMapping;
540
525
  /**
541
526
  * Function that defines the key to use for each item given row and column index and value of {@link VirtualBaseProps.itemData}.
542
- * @defaultValue
543
- * ```ts
544
- * (rowIndex, columnIndex, _data) => `${rowIndex}:${columnIndex}`
545
- * ```
527
+ * @defaultValue `(rowIndex, columnIndex, _data) => '${rowIndex}:${columnIndex}'`
546
528
  */
547
529
  itemKey?: (rowIndex: number, columnIndex: number, data: unknown) => React$1.Key;
548
530
  /**
@@ -650,11 +632,12 @@ declare const VirtualList: React$1.ForwardRefExoticComponent<VirtualListProps &
650
632
  declare function useFixedSizeItemOffsetMapping(itemSize: number): ItemOffsetMapping;
651
633
 
652
634
  /**
653
- * Returns an instance of {@link ItemOffsetMapping} suitable for use when initial items have variable sizes.
635
+ * Returns an instance of {@link ItemOffsetMapping}
636
+ * suitable for use when initial items have variable sizes.
654
637
  *
655
638
  * @param defaultItemSize - Size to use for all other items
656
639
  * @param sizes - Array of sizes to use for the initial items, one size per item
657
640
  */
658
641
  declare function useVariableSizeItemOffsetMapping(defaultItemSize: number, sizes?: number[]): ItemOffsetMapping;
659
642
 
660
- export { AutoSizer, type AutoSizerProps, type AutoSizerRender, type AutoSizerRenderProps, type ComponentProps, type DisplayBaseItemProps, type DisplayBaseProps, DisplayGrid, type DisplayGridItem, type DisplayGridItemProps, type DisplayGridProps, DisplayList, type DisplayListItem, type DisplayListItemProps, type DisplayListProps, type ItemOffsetMapping, type ScrollDirection, type ScrollEvent, type ScrollLayout, type ScrollRange, type ScrollState, type ScrollToOption, type VirtualBaseProps, VirtualContainer, type VirtualContainerComponentProps, type VirtualContainerRender, type VirtualContainerRenderProps, type VirtualContentProps, type VirtualContentRender, VirtualGrid, type VirtualGridProps, type VirtualGridProxy, VirtualList, type VirtualListProps, type VirtualListProxy, VirtualScroll, type VirtualScrollProps, type VirtualScrollProxy, type VirtualScrollableProps, getOffsetToScrollRange, getRangeToScroll, useFixedSizeItemOffsetMapping, useVariableSizeItemOffsetMapping, virtualGridScrollToItem, virtualListScrollToItem };
643
+ export { AutoSizer, type AutoSizerProps, type AutoSizerRender, type AutoSizerRenderProps, type ComponentProps, type DisplayBaseItemProps, type DisplayBaseProps, DisplayGrid, type DisplayGridItem, type DisplayGridItemProps, type DisplayGridProps, DisplayList, type DisplayListItem, type DisplayListItemProps, type DisplayListProps, type ScrollDirection, type ScrollEvent, type ScrollLayout, type ScrollRange, type ScrollState, type ScrollToOption, type VirtualBaseProps, VirtualContainer, type VirtualContainerComponentProps, type VirtualContainerRender, type VirtualContainerRenderProps, type VirtualContentProps, type VirtualContentRender, VirtualGrid, type VirtualGridProps, type VirtualGridProxy, VirtualList, type VirtualListProps, type VirtualListProxy, VirtualScroll, type VirtualScrollProps, type VirtualScrollProxy, type VirtualScrollableProps, getOffsetToScrollRange, getRangeToScroll, useFixedSizeItemOffsetMapping, useVariableSizeItemOffsetMapping, virtualGridScrollToItem, virtualListScrollToItem };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import React, { useState, useRef, createRef, useEffect, Fragment } from 'react';
3
+ import { FixedSizeItemOffsetMapping, VariableSizeItemOffsetMapping } from '@candidstartup/infinisheet-types';
3
4
 
4
5
  const defaultContainerRender = ({ ...rest }, ref) => (jsx("div", { ref: ref, ...rest }));
5
6
  /**
@@ -289,7 +290,7 @@ function getOffsetToScrollRange(offset, size, clientExtent, scrollOffset, option
289
290
  * Customizable Virtual Scrolling Component
290
291
  *
291
292
  * Allows user to scroll over a virtual area `scrollHeight` x `scrollWidth` pixels.
292
- * Use `onScroll` to track scroll state and `innerRender` to render scroll state specific content into the viewport
293
+ * Use `onScroll` to track scroll state and {@link VirtualContentRender} to render scroll state specific content into the viewport
293
294
  *
294
295
  * Accepts props defined by {@link VirtualScrollProps}.
295
296
  * Refs are forwarded to {@link VirtualScrollProxy}.
@@ -614,28 +615,6 @@ const VirtualList = React.forwardRef(function VirtualList(props, ref) {
614
615
  }, children: ({ isScrolling, verticalOffset, horizontalOffset }) => (jsx(AutoSizer, { style: { height: '100%', width: '100%' }, children: ({ height, width }) => (jsx(DisplayList, { innerClassName: innerClassName, innerRender: innerRender, layout: layout, offset: isVertical ? verticalOffset : horizontalOffset, height: height, itemCount: itemCount, itemData: itemData, itemKey: itemKey, isScrolling: isScrolling, itemOffsetMapping: itemOffsetMapping, width: width, children: ChildVar })) })) }));
615
616
  });
616
617
 
617
- class FixedSizeItemOffsetMapping {
618
- constructor(itemSize) {
619
- Object.defineProperty(this, "fixedItemSize", {
620
- enumerable: true,
621
- configurable: true,
622
- writable: true,
623
- value: void 0
624
- });
625
- this.fixedItemSize = itemSize;
626
- }
627
- itemSize(_itemIndex) {
628
- return this.fixedItemSize;
629
- }
630
- itemOffset(itemIndex) {
631
- return itemIndex * this.fixedItemSize;
632
- }
633
- offsetToItem(offset) {
634
- const itemIndex = Math.floor(offset / this.fixedItemSize);
635
- const startOffset = itemIndex * this.fixedItemSize;
636
- return [itemIndex, startOffset];
637
- }
638
- }
639
618
  /**
640
619
  * Returns an instance of {@link ItemOffsetMapping} suitable for use when all items have a fixed size.
641
620
  *
@@ -645,58 +624,9 @@ function useFixedSizeItemOffsetMapping(itemSize) {
645
624
  return new FixedSizeItemOffsetMapping(itemSize);
646
625
  }
647
626
 
648
- class VariableSizeItemOffsetMapping {
649
- constructor(defaultItemSize, sizes) {
650
- Object.defineProperty(this, "defaultItemSize", {
651
- enumerable: true,
652
- configurable: true,
653
- writable: true,
654
- value: void 0
655
- });
656
- Object.defineProperty(this, "sizes", {
657
- enumerable: true,
658
- configurable: true,
659
- writable: true,
660
- value: void 0
661
- });
662
- this.defaultItemSize = defaultItemSize;
663
- this.sizes = sizes;
664
- }
665
- itemSize(itemIndex) {
666
- return (itemIndex < this.sizes.length) ? this.sizes[itemIndex] : this.defaultItemSize;
667
- }
668
- itemOffset(itemIndex) {
669
- let offset = 0;
670
- let length = this.sizes.length;
671
- if (itemIndex > length) {
672
- const numDefaultSize = itemIndex - length;
673
- offset = numDefaultSize * this.defaultItemSize;
674
- }
675
- else {
676
- length = itemIndex;
677
- }
678
- for (let i = 0; i < length; i++) {
679
- offset += this.sizes[i];
680
- }
681
- return offset;
682
- }
683
- offsetToItem(offset) {
684
- let startOffset = 0;
685
- const length = this.sizes.length;
686
- for (let i = 0; i < length; i++) {
687
- const size = this.sizes[i];
688
- if (startOffset + size > offset) {
689
- return [i, startOffset];
690
- }
691
- startOffset += size;
692
- }
693
- const itemIndex = Math.floor((offset - startOffset) / this.defaultItemSize);
694
- startOffset += itemIndex * this.defaultItemSize;
695
- return [itemIndex + length, startOffset];
696
- }
697
- }
698
627
  /**
699
- * Returns an instance of {@link ItemOffsetMapping} suitable for use when initial items have variable sizes.
628
+ * Returns an instance of {@link ItemOffsetMapping}
629
+ * suitable for use when initial items have variable sizes.
700
630
  *
701
631
  * @param defaultItemSize - Size to use for all other items
702
632
  * @param sizes - Array of sizes to use for the initial items, one size per item
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/VirtualContainer.tsx","../src/AutoSizer.tsx","../src/useVirtualScroll.ts","../src/useEventListener.ts","../src/useAnimationTimeout.ts","../src/useIsScrolling.ts","../src/VirtualScrollProxy.ts","../src/VirtualScroll.tsx","../src/VirtualCommon.ts","../src/DisplayList.tsx","../src/DisplayGrid.tsx","../src/VirtualGridProxy.ts","../src/VirtualGrid.tsx","../src/VirtualListProxy.ts","../src/VirtualList.tsx","../src/useFixedSizeItemOffsetMapping.ts","../src/useVariableSizeItemOffsetMapping.ts"],"sourcesContent":["import React from \"react\";\n\n/**\n * Props that an implementation of {@link VirtualContainerRender} must accept.\n * \n * Includes all the props that a {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElement | HTMLDivElement} would accept.\n */\nexport type VirtualContainerRenderProps = React.ComponentPropsWithoutRef<'div'>;\n\n/**\n * Render prop for a {@link VirtualContainer}\n *\n * Can be passed to {@link VirtualContainer} to replace default implementation. \n * Function must render a div and forward {@link VirtualContainerRenderProps}\n * and any `ref` to it. \n * \n * @example Minimal compliant implementation\n * ```\n * const containerRender: VirtualContainerRender = ({...rest}, ref) => (\n * <div ref={ref} {...rest} />\n * )\n * ```\n */\nexport type VirtualContainerRender = (props: VirtualContainerRenderProps, ref?: React.ForwardedRef<HTMLDivElement>) => JSX.Element;\n\n/**\n * Props that {@link VirtualContainer} accepts.\n */\nexport interface VirtualContainerComponentProps extends VirtualContainerRenderProps {\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualContainer}. */\n render?: VirtualContainerRender;\n}\n\nconst defaultContainerRender: VirtualContainerRender = ({...rest}, ref) => (\n <div ref={ref} {...rest} />\n)\n\n/**\n * Wrapper around a div used by other components in {@link @candidstartup/react-virtual-scroll!}. Most props are passed through to the div. Use the\n * {@link VirtualContainerComponentProps.render} prop to override the default behavior. \n * \n * @group Components\n */\nexport const VirtualContainer = React.forwardRef<HTMLDivElement, VirtualContainerComponentProps >(\n function VirtualContainer({render = defaultContainerRender, ...rest}, ref) {\n return render(rest, ref)\n})\n","import React from \"react\";\n\n/**\n * Props that an implementation of {@link AutoSizerRender} must accept.\n */\nexport interface AutoSizerRenderProps {\n /** Computed height */\n height: number,\n\n /** Computed width */\n width: number,\n}\n\n/**\n * Render prop for content in an {@link AutoSizer}\n *\n * Function renders content and forwards `width` and `height`\n * to whatever needs it.\n * \n * @example Simple implementation\n * ```\n * const autoSizeRender: AutoSizeRender = ({width, height}) => (\n * <VirtualList width={width} height={height} {...props} />\n * )\n * ```\n */\nexport type AutoSizerRender = (props: AutoSizerRenderProps) => JSX.Element;\n\n/**\n * Props accepted by {@link AutoSizer}\n */\nexport interface AutoSizerProps {\n /** Function implementing {@link AutoSizerRender} that renders the content that needs explicit sizing */\n children: AutoSizerRender\n\n /** The `className` applied to the container element */\n className?: string,\n\n /** Inline style to apply to the container element */\n style?: React.CSSProperties;\n}\n\n/**\n * HOC that calculates the size available to it and makes the computed size available to children.\n * The size available depends on DOM layout and style applied wherever the AutoSizer finds itself.\n * You will probably want to pass something appropriate via the `className` or `style` props.\n * \n * Accepts props defined by {@link AutoSizerProps}. \n * You must pass a single instance of {@link AutoSizerRender} as a child.\n * @group Components\n */\nexport function AutoSizer(props: AutoSizerProps) {\n const { children, className, style } = props;\n\n // Using separate primitive states rather than one composite so that React\n // can detect duplicates values and bail out of redundant renders.\n const [width, setWidth] = React.useState<number>(0);\n const [height, setHeight] = React.useState<number>(0);\n const ref = React.useRef<HTMLDivElement>(null);\n\n // Make sure resize callback is a stable value so we're not constantly\n // creating and disconnecting resize observers.\n const resizeCallback: ResizeObserverCallback = React.useCallback((entries) => {\n entries.forEach(entry => {\n // Context box sizes can contain fractional values while clientWidth\n // and clientHeight properties are always rounded to nearest integer.\n // Always use integer values to avoid confusion.\n const newWidth = Math.round(entry.contentBoxSize[0].inlineSize);\n setWidth(newWidth);\n const newHeight = Math.round(entry.borderBoxSize[0].blockSize);\n setHeight(newHeight);\n })\n }, []);\n\n // Expect effect to run only on initial mount\n React.useLayoutEffect(() => {\n const div = ref.current;\n /* istanbul ignore if*/\n if (!div)\n return;\n\n // Size on initial mount\n setHeight(div.clientHeight);\n setWidth(div.clientWidth);\n\n // Updates size on any subsequent resize. Only available in browser\n // environment so avoid crashing out when server side rendering, or\n // running unit test without ResizeObserver being mocked. \n if (typeof ResizeObserver !== 'undefined') {\n const resizeObserver = new ResizeObserver(resizeCallback);\n resizeObserver.observe(div);\n return () => { resizeObserver.disconnect() }\n }\n }, [resizeCallback])\n\n // No point rendering children until we've measured size and found a usable area\n const renderChildren = height > 0 && width > 0;\n\n // Ensure that size is driven only by parent. Wrapping child in a zero sized inner div\n // which it can overflow stops child's size having any impact on size of outer div. \n // Otherwise can end up in infinite loop if child makes itself bigger than the \n // actual width and height we pass to it. That could be because child has \n // padding/borders/margins or because child renders itself bigger than size it's given.\n return (\n <div ref={ref} className={className} style={style}>\n <div style={{ overflow: 'visible', width: 0, height: 0 }}>\n {renderChildren && children({height, width})}\n </div>\n </div>\n );\n}\n\nexport default AutoSizer;\n","import { useState, useRef, RefObject } from \"react\";\n\n/** Direction of scrolling */\nexport type ScrollDirection = \"forward\" | \"backward\";\n\n/**\n * Overall scroll state for a single dimension.\n */\nexport interface ScrollState { \n /** Scroll bar offset. Equal to outer container's `scrollTop` or `scrollLeft` depending on dimension. */\n scrollOffset: number, \n\n /** Offset used to position current page of items in virtual space. Total offset is `scrollOffset+renderOffset`. */\n renderOffset: number,\n\n /** Index of current page. */\n page: number, \n\n /** Current scrolling direction. Calculated by comparing current overall offset to that when last rendered. */\n scrollDirection: ScrollDirection, \n}\n\nexport interface VirtualScrollState {\n /** Snapshot of overall offset at last render */\n totalOffset: number;\n\n /** Physical size of scrollable area */\n renderSize: number;\n\n // Returns updated scrollOffset. Caller should update scroll bar position if different from value passed in. \n onScroll(clientExtent: number, scrollExtent: number, scrollOffset: number): [number, ScrollState];\n\n // Scroll to offset in logical space returning offset to update scroll bar position to\n doScrollTo(offset: number, clientExtent: number): number;\n\n // Returns current overall offset (NOT a snapshot)\n getCurrentOffset(): number;\n\n // Internal scroll state. Most scenarios will never need to access this. Mainly here for unit test.\n scrollState: RefObject<ScrollState>;\n}\n\n// Max size that is safe across all browsers (Firefox is the limiting factor)\n// SlickGrid tries to dynamically determine limit on other browsers (Chrome will do 30M) but\n// I prefer simplicity of same behavior across all browsers.\nconst MAX_SUPPORTED_CSS_SIZE = 6000000;\nconst MIN_NUMBER_PAGES = 100;\n\n/** Custom hook that implements logic for paged virtual scrolling in a single dimension */\nexport function useVirtualScroll(totalSize: number, maxCssSize = MAX_SUPPORTED_CSS_SIZE, minNumberPages = MIN_NUMBER_PAGES, \n useTotalOffset = true): VirtualScrollState {\n let renderSize=0, pageSize=0, numPages=0;\n if (totalSize < maxCssSize) {\n // No paging needed\n renderSize = pageSize = totalSize;\n numPages = 1;\n } else {\n // Break into pages\n renderSize = maxCssSize;\n pageSize = renderSize / minNumberPages;\n numPages = Math.floor(totalSize / pageSize);\n }\n\n function pageToRenderOffset(page: number): number {\n if (page <= 0)\n return 0;\n\n if (page >= numPages-1)\n return totalSize - renderSize;\n\n return Math.round((page-1) * (totalSize - renderSize) / (numPages - 3));\n }\n\n const initValue: ScrollState = { \n scrollOffset: 0, \n renderOffset: 0,\n page: 0,\n scrollDirection: \"forward\",\n };\n const [totalOffset, setTotalOffset] = useState<number>(0);\n const scrollState = useRef(initValue);\n\n function onScroll(clientExtent: number, scrollExtent: number, scrollOffset: number): [number, ScrollState] {\n const currState = scrollState.current;\n if (currState.scrollOffset == scrollOffset) {\n // No need to change state if scroll position unchanged\n return [scrollOffset, currState];\n }\n\n // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.\n let newOffset = Math.max(0, Math.min(scrollOffset, scrollExtent - clientExtent));\n const newScrollDirection = currState.scrollOffset <= newOffset ? 'forward' : 'backward';\n\n // Switch pages if needed\n let newPage, newRenderOffset;\n let retScrollOffset = scrollOffset;\n const scrollDist = Math.abs(newOffset - currState.scrollOffset);\n if (scrollDist < clientExtent) {\n // Scrolling part of visible window, don't want to skip items, so can't scale up movement\n // If we cross page boundary we need to reset scroll bar position back to where it should be at start of page\n newPage = Math.min(numPages - 1, Math.floor((scrollOffset + currState.renderOffset) / pageSize));\n newRenderOffset = pageToRenderOffset(newPage);\n if (newPage != currState.page) {\n // Be very intentional about when we ask caller to reset scroll bar\n // Don't want to trigger event loops\n newOffset = scrollOffset + currState.renderOffset - newRenderOffset;\n retScrollOffset = newOffset;\n }\n } else {\n // Large scale scrolling, choosing page from a rolodex\n // First and last page are mapped 1:1 between grid and container\n if (newOffset < pageSize) {\n newPage = 0;\n } else if (newOffset >= renderSize - pageSize) {\n newPage = numPages - 1;\n } else {\n const scaleFactor = (totalSize - pageSize*2) / (renderSize - pageSize*2);\n newPage = Math.min(numPages - 3, Math.floor((newOffset - pageSize) * scaleFactor / pageSize)) + 1;\n }\n newRenderOffset = pageToRenderOffset(newPage);\n }\n\n const newScrollState: ScrollState = \n { scrollOffset: newOffset, renderOffset: newRenderOffset, page: newPage, scrollDirection: newScrollDirection };\n scrollState.current = newScrollState;\n if (useTotalOffset)\n setTotalOffset(newOffset + newRenderOffset);\n return [retScrollOffset, newScrollState];\n }\n\n function doScrollTo(offset: number, clientExtent: number) {\n const currState = scrollState.current;\n const safeOffset = Math.min(totalSize - clientExtent, Math.max(offset, 0));\n const scrollDirection = (currState.scrollOffset + currState.renderOffset) <= safeOffset ? 'forward' : 'backward';\n const page = Math.min(numPages - 1, Math.floor(safeOffset / pageSize));\n const renderOffset = pageToRenderOffset(page);\n const scrollOffset = safeOffset - renderOffset;\n\n scrollState.current = { scrollOffset, renderOffset, page, scrollDirection };\n if (useTotalOffset)\n setTotalOffset(scrollOffset + renderOffset);\n return scrollOffset;\n }\n\n function getCurrentOffset() {\n const currState = scrollState.current;\n return currState.scrollOffset + currState.renderOffset;\n }\n\n return {totalOffset, renderSize, onScroll, doScrollTo, getCurrentOffset, scrollState} as const;\n}\n\nexport default useVirtualScroll;\n","// Based on https://github.com/realwugang/use-event-listener\n// and https://github.com/donavon/use-event-listener/blob/develop/src/index.js\n\nimport { useRef, useEffect, RefObject, createRef } from 'react';\n\ninterface Options {\n capture?: boolean\n once?: boolean\n passive?: boolean\n}\n\ntype Listener = Window | Document | HTMLElement;\n\nfunction isListener(element: Listener | RefObject<HTMLElement>): element is Listener {\n return (element as Listener).addEventListener !== undefined;\n}\n\ntype EventHandler = (event: Event) => void;\n\nexport function useEventListener (eventName: string, \n handler: EventHandler, \n element: Listener | RefObject<HTMLElement> | null = window, \n options: Options = {}) {\n const savedHandler = useRef<EventHandler>();\n const { capture, passive, once } = options;\n\n useEffect(() => {\n savedHandler.current = handler\n }, [handler])\n\n useEffect(() => {\n if (!element)\n return;\n\n const el = isListener(element) ? element : element.current;\n if (!el)\n return;\n\n const eventListener = (event: Event) => savedHandler.current?.(event);\n const opts = { capture, passive, once };\n el.addEventListener(eventName, eventListener, opts);\n return () => {\n el.removeEventListener(eventName, eventListener, opts);\n };\n }, [eventName, element, capture, passive, once]);\n}\n\nexport default useEventListener;\n\n// In-source testing for private helper functions\nif (import.meta.vitest) {\n const { it, expect } = import.meta.vitest\n it('isListener', () => {\n expect(isListener(window)).toBe(true)\n expect(isListener(document)).toBe(true)\n expect(isListener(document.createElement(\"div\"))).toBe(true)\n expect(isListener(createRef())).toBe(false)\n })\n}","// Based on https://overreacted.io/making-setinterval-declarative-with-react-hooks/\n// and https://www.joshwcomeau.com/snippets/react-hooks/use-timeout/\n// and https://github.com/bvaughn/react-window/blob/master/src/timer.js\n//\n// Equivalent functionality to a useTimeout hook but based on requestAnimationFrame instead of setTimeout. Use\n// when making frequent requests for short duration timeouts where browser may throttle setTimeout.\nimport { useEffect, useRef } from 'react';\n\ntype Callback = () => void;\n\nexport function useAnimationTimeout(callback: Callback, delay: number | null, key?: unknown) {\n const requestRef = useRef<number>();\n const savedCallback = useRef<Callback>(callback);\n\n // Remember the latest callback\n useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n \n const start = performance.now();\n \n useEffect(() => {\n function tick() {\n requestRef.current = undefined;\n if (delay === null)\n return;\n\n if (performance.now() - start >= delay) {\n savedCallback.current();\n } else {\n requestRef.current = requestAnimationFrame(tick);\n }\n }\n\n tick();\n\n return () => {\n if (typeof requestRef.current === 'number') {\n cancelAnimationFrame(requestRef.current);\n requestRef.current = undefined;\n }\n }\n }, [start, delay, key]);\n}\n\nexport default useAnimationTimeout;","import { useState, RefObject } from \"react\";\nimport { useEventListener } from './useEventListener';\nimport { useAnimationTimeout } from './useAnimationTimeout';\n\nconst DEBOUNCE_INTERVAL = 150;\nconst FALLBACK_INTERVAL = 500;\n\nexport function useIsScrolling(element: Window | HTMLElement | RefObject<HTMLElement> | null = window): boolean {\n const [scrollCount, setScrollCount] = useState(0);\n\n // scrollend implementations in both Chrome and Firefox are buggy with missing scrollend events\n // in some circumstances (using keyboard to scroll past end in Chrome, intermittently when using mouse wheel in Firefox)\n // Use a timeout even when scrollend is supported to handle missing events. In this case we use a longer interval as\n // don't want it to be over sensitive. \n const supportsScrollEnd = ('onscrollend' in window);\n const delay = supportsScrollEnd ? FALLBACK_INTERVAL : DEBOUNCE_INTERVAL;\n\n useEventListener(\"scroll\", () => setScrollCount(c => c + 1), element);\n useEventListener(\"scrollend\", () => setScrollCount(0), supportsScrollEnd ? element : null);\n useAnimationTimeout(() => setScrollCount(0), (scrollCount == 0) ? null : delay, scrollCount);\n\n return scrollCount > 0;\n}\n\nexport default useIsScrolling;","import { ScrollToOption } from './VirtualBase';\n\n/**\n * Custom ref handle returned by {@link VirtualScroll} that exposes imperative methods\n * \n * Use `React.useRef<VirtualScrollProxy>(null)` to create a ref.\n */\nexport interface VirtualScrollProxy {\n /**\n * Scrolls to the specified vertical and horizontal offset in pixels\n * Either offset can be left undefined to scroll in one dimension only\n * @param verticalOffset - Offset to scroll to vertically\n * @param horizontalOffset - Offset to scroll to horizontally\n */\n scrollTo(verticalOffset?: number, horizontalOffset?: number): void;\n\n /**\n * Scrolls to the specified area\n * Either offset/size pair can be left undefined to scroll in one dimension only\n * @param verticalOffset - Offset to scroll to vertically\n * @param verticalSize - Size of target area vertically\n * @param horizontalOffset - Offset to scroll to horizontally\n * @param horizontalSize - Size of target area horizontally\n * @param option - Where to {@link ScrollToOption | position} the area within the viewport\n */\n scrollToArea(verticalOffset?: number, verticalSize?: number, horizontalOffset?: number, horizontalSize?: number, option?: ScrollToOption): void;\n\n /** Exposes DOM clientWidth property */\n get clientWidth(): number;\n\n /** Exposes DOM clientHeight property */\n get clientHeight(): number;\n\n /** Current vertical position of scroll bar */\n get verticalOffset(): number;\n\n /** Current horizontal position of scroll bar */\n get horizontalOffset(): number;\n}\n\n/**\n * Returns the offset needed to scroll in one dimension for a specified range\n * \n * Used internally to implement {@link VirtualScrollProxy.scrollToArea}. Can be used directly for \n * advanced customization scenarios.\n */\nexport function getOffsetToScrollRange(offset: number | undefined, size: number | undefined, \n clientExtent: number, scrollOffset: number, option?: ScrollToOption): number | undefined\n{\n if (offset === undefined)\n return undefined;\n\n if (option != 'visible')\n return offset;\n\n // Start of item offscreen before start of viewport?\n if (offset < scrollOffset)\n return offset;\n\n size = size || 0;\n\n // Already completely visible?\n const endOffset = offset + size;\n const endViewport = scrollOffset + clientExtent;\n if (endOffset <= endViewport)\n return undefined;\n\n // Item offscreen past end of viewport\n\n // Item bigger than viewport? Make sure start is in view\n if (size > clientExtent)\n return offset;\n\n // Scroll so end of item aligns with end of viewport\n return offset - clientExtent + size;\n }\n","import React from \"react\";\nimport { VirtualContainer, VirtualContainerRender } from './VirtualContainer';\nimport { VirtualScrollableProps, ScrollEvent, ScrollToOption } from './VirtualBase';\nimport { useVirtualScroll, ScrollState } from './useVirtualScroll';\nimport { useIsScrolling as useIsScrollingHook} from './useIsScrolling';\nimport { getOffsetToScrollRange, VirtualScrollProxy } from './VirtualScrollProxy';\n\n/**\n * Props that an implementation of {@link VirtualContentRender} must accept.\n */\nexport interface VirtualContentProps {\n /** \n * Is the owning component being actively scrolled? Used to change how the content is rendered depending on scroll state.\n * \n * Only defined if {@link VirtualScrollableProps.useIsScrolling} is true. \n * */\n isScrolling?: boolean,\n\n /** Current scroll position vertical offset */\n verticalOffset: number,\n\n /** Current scroll position horizontal offset */\n horizontalOffset: number\n}\n\n/**\n * Render prop for content container in {@link VirtualScroll}\n *\n * Pass to {@link VirtualScroll} to render content into the viewport\n * implementation. Function must render a div and forward {@link VirtualContentProps}\n * and any `ref` to it. \n * \n * @example Minimal compliant implementation\n * ```\n * const contentRender: VirtualContentRender = ({isScrolling, ...rest}, ref) => (\n * <div ref={ref} {...rest} />\n * )\n * ```\n */\nexport type VirtualContentRender = (props: VirtualContentProps, ref?: React.ForwardedRef<HTMLDivElement>) => JSX.Element;\n\n/**\n * Props accepted by {@link VirtualScroll}\n */\nexport interface VirtualScrollProps extends VirtualScrollableProps {\n /** Function implementing {@link VirtualContentRender} that renders the content that needs to respond to scrolling */\n children: VirtualContentRender\n\n /** \n * Height of area to scroll over \n * \n * @defaultValue 0\n */\n scrollHeight?: number,\n\n /** \n * Width of area to scroll over \n * \n * @defaultValue 0\n */\n scrollWidth?: number,\n\n /** \n * Determines whether the component should pass {@link VirtualContentProps.verticalOffset|verticalOffset} and \n * {@link VirtualContentProps.horizontalOffset|horizontalOffset} to children when rendering.\n * \n * Can reduce the number of renders needed if these props aren't used\n * \n * @defaultValue true\n * */\n useOffsets?: boolean,\n\n /**\n * Callback after a scroll event has been processed and state updated but before rendering\n * @param verticalOffset - Resulting overall vertical offset. \n * @param horizontalOffset - Resulting overall horizontal offset.\n * @param newVerticalScrollState - New vertical {@link ScrollState} that will be used for rendering.\n * @param newHorizontalScrollState - New horizontal {@link ScrollState} that will be used for rendering.\n */\n onScroll?: (verticalOffset: number, horizontalOffset: number, newVerticalScrollState: ScrollState, newHorizontalScrollState: ScrollState) => void;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualScroll} outer container. */\n outerRender?: VirtualContainerRender;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualScroll} inner container. */\n innerRender?: VirtualContainerRender;\n}\n\n// Using a named function rather than => so that the name shows up in React Developer Tools\n/**\n * Customizable Virtual Scrolling Component\n * \n * Allows user to scroll over a virtual area `scrollHeight` x `scrollWidth` pixels. \n * Use `onScroll` to track scroll state and `innerRender` to render scroll state specific content into the viewport\n * \n * Accepts props defined by {@link VirtualScrollProps}. \n * Refs are forwarded to {@link VirtualScrollProxy}. \n * @group Components\n */\nexport const VirtualScroll = React.forwardRef<VirtualScrollProxy, VirtualScrollProps>(function VirtualScroll(props, ref) {\n const { width, height, scrollWidth = 0, scrollHeight = 0, className, innerClassName, children,\n onScroll: onScrollCallback, useIsScrolling = false, useOffsets = true, innerRender, outerRender } = props;\n\n const outerRef = React.useRef<HTMLDivElement>(null);\n const { totalOffset: currentVerticalOffset, renderSize: renderRowSize, onScroll: onScrollRow,\n doScrollTo: doScrollToRow, getCurrentOffset: getVerticalOffset } = useVirtualScroll(scrollHeight, props.maxCssSize, props.minNumPages, useOffsets);\n const { totalOffset: currentHorizontalOffset, renderSize: renderColumnSize, onScroll: onScrollColumn,\n doScrollTo: doScrollToColumn, getCurrentOffset: getHorizontalOffset} = useVirtualScroll(scrollWidth, props.maxCssSize, props.minNumPages, useOffsets);\n const isActuallyScrolling = useIsScrollingHook(outerRef);\n\n React.useImperativeHandle(ref, () => {\n return {\n scrollTo(rowOffset?: number, columnOffset?: number): void {\n if (rowOffset === undefined && columnOffset === undefined)\n return;\n\n const outer = outerRef.current;\n /* istanbul ignore else */\n if (outer) {\n const options: ScrollToOptions = {};\n if (rowOffset != undefined)\n options.top = doScrollToRow(rowOffset, outer.clientHeight);\n if (columnOffset != undefined)\n options.left = doScrollToColumn(columnOffset, outer.clientWidth);\n outer.scrollTo(options);\n }\n },\n\n scrollToArea(verticalOffset?: number, verticalSize?: number, horizontalOffset?: number, horizontalSize?: number, option?: ScrollToOption) {\n const outer = outerRef.current;\n /* istanbul ignore if*/\n if (!outer)\n return;\n\n const rowOffset = getOffsetToScrollRange(verticalOffset, verticalSize, outer.clientHeight, currentVerticalOffset, option);\n const colOffset = getOffsetToScrollRange(horizontalOffset, horizontalSize, outer.clientWidth, currentHorizontalOffset, option);\n this.scrollTo(rowOffset, colOffset);\n },\n\n get clientWidth(): number {\n return outerRef.current ? outerRef.current.clientWidth : /* istanbul ignore next */ 0;\n },\n\n get clientHeight(): number {\n return outerRef.current ? outerRef.current.clientHeight : /* istanbul ignore next */ 0;\n },\n\n get verticalOffset(): number { return getVerticalOffset(); },\n\n get horizontalOffset(): number { return getHorizontalOffset(); }\n }\n }, [ doScrollToRow, doScrollToColumn, currentVerticalOffset, currentHorizontalOffset, getVerticalOffset, getHorizontalOffset ]);\n\n function onScroll(event: ScrollEvent) {\n const { clientWidth, clientHeight, scrollWidth, scrollHeight, scrollLeft, scrollTop } = event.currentTarget;\n const [newScrollTop, newRowScrollState] = onScrollRow(clientHeight, scrollHeight, scrollTop);\n const [newScrollLeft, newColumnScrollState] = onScrollColumn(clientWidth, scrollWidth, scrollLeft);\n if (outerRef.current && (newScrollTop != scrollTop || newScrollLeft != scrollLeft ))\n outerRef.current.scrollTo(newScrollLeft, newScrollTop);\n onScrollCallback?.(newRowScrollState.scrollOffset+newRowScrollState.renderOffset, \n newColumnScrollState.scrollOffset+newColumnScrollState.renderOffset, newRowScrollState, newColumnScrollState);\n }\n\n const isScrolling = useIsScrolling ? isActuallyScrolling : undefined;\n const verticalOffset = currentVerticalOffset;\n const horizontalOffset = currentHorizontalOffset;\n\n return (\n <VirtualContainer className={className} render={outerRender} onScroll={onScroll} ref={outerRef} \n style={{ position: \"relative\", height, width, overflow: \"auto\", willChange: \"transform\" }}>\n <VirtualContainer className={innerClassName} render={innerRender} \n style={{ zIndex: 1, position: 'sticky', top: 0, left: 0, width: '100%', height: '100%' }}>\n {children({isScrolling, verticalOffset, horizontalOffset})}\n </VirtualContainer>\n <div style={{ position: 'absolute', top: 0, left: 0, \n height: scrollHeight ? renderRowSize : '100%', \n width: scrollWidth ? renderColumnSize : '100%'}}/>\n </VirtualContainer>\n );\n});\n\nexport default VirtualScroll;\n","import type { ItemOffsetMapping } from \"./VirtualBase\";\n\ntype RangeToRender = [\n startIndex: number,\n startOffset: number,\n totalSize: number,\n sizes: number[]\n];\n\nexport function getRangeToRender(itemCount: number, itemOffsetMapping: ItemOffsetMapping, clientExtent: number, scrollOffset: number): RangeToRender {\n if (itemCount == 0) {\n return [0, 0, 0, []];\n }\n\n // Negative offset equivalent to reducing the size of the window (possibly down to nothing)\n if (scrollOffset < 0) {\n clientExtent += scrollOffset;\n scrollOffset = 0;\n }\n\n if (clientExtent <= 0) {\n return [0, 0, 0, []];\n }\n\n const [baseIndex, startOffset] = itemOffsetMapping.offsetToItem(scrollOffset);\n if (baseIndex >= itemCount) {\n return [0, 0, 0, []];\n }\n\n let itemIndex = Math.max(0, Math.min(itemCount - 1, baseIndex));\n const endOffset = scrollOffset + clientExtent;\n\n const startIndex = itemIndex;\n let offset = startOffset;\n const sizes: number[] = [];\n let totalSize = 0;\n\n while (offset < endOffset && itemIndex < itemCount) {\n const size = itemOffsetMapping.itemSize(itemIndex);\n sizes.push(size);\n totalSize += size;\n offset += size;\n itemIndex ++;\n }\n\n return [startIndex, startOffset, totalSize, sizes];\n}\n\nfunction formatRepeat(repeat: number, size: number): string {\n return (repeat == 1) ? `${size}px` : `repeat(${repeat},${size}px)`;\n}\n\nfunction join(a: string|undefined, s: string) {\n return a ? a + ' ' + s : s;\n}\n\nexport function getGridTemplate(sizes: number[]): string | undefined {\n const count = sizes.length;\n if (count == 0)\n return undefined;\n\n let ret = undefined;\n let lastSize = sizes[0];\n let repeat = 1;\n\n for (let i = 1; i < count; i ++) {\n const size = sizes[i];\n if (size == lastSize) {\n repeat ++;\n } else {\n const s = formatRepeat(repeat, lastSize);\n ret = join(ret,s);\n lastSize = size;\n repeat = 1;\n }\n }\n\n const s = formatRepeat(repeat, lastSize);\n return join(ret,s);\n}\n\n\n","import React from \"react\";\nimport { ItemOffsetMapping, ScrollLayout, DisplayBaseItemProps, DisplayBaseProps } from './VirtualBase';\nimport { getRangeToRender, getGridTemplate } from './VirtualCommon';\nimport { VirtualContainer } from './VirtualContainer';\n\n/**\n * Props accepted by {@link DisplayListItem}\n */\nexport interface DisplayListItemProps extends DisplayBaseItemProps {\n /** Index of item in the list being rendered */\n index: number,\n}\n\n/**\n * Type of item in a {@link DisplayList}\n *\n * Must be passed as a child to {@link DisplayList}. \n * Accepts props defined by {@link DisplayListItemProps}.\n * Component must pass {@link DisplayBaseItemProps.style} to whatever it renders. \n * \n * @example Basic implementation\n * ```\n * const Row = ({ index, style }: { index: number, style: React.CSSProperties }) => (\n * <div className=\"row\" style={style}>\n * { index }\n * </div>\n * );\n * ```\n */\nexport type DisplayListItem = React.ComponentType<DisplayListItemProps>;\n\n/**\n * Props accepted by {@link DisplayList}\n */\nexport interface DisplayListProps extends DisplayBaseProps {\n /** Component used as a template to render items in the list. Must implement {@link DisplayListItem} interface. */\n children: DisplayListItem,\n\n /** Number of items in the list */\n itemCount: number,\n\n /** Offset to start of displayed content */\n offset: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each item in the list\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n itemOffsetMapping: ItemOffsetMapping,\n\n /**\n * Function that defines the key to use for each item given item index and value of {@link DisplayBaseProps.itemData}.\n * @defaultValue `(index, _data) => index`\n */\n itemKey?: (index: number, data: unknown) => React.Key,\n\n /**\n * Choice of 'vertical' or 'horizontal' layouts\n * @defaultValue 'vertical'\n */\n layout?: ScrollLayout,\n}\n\nconst defaultItemKey = (index: number, _data: unknown) => index;\n\nconst boxStyle: React.CSSProperties = { boxSizing: 'border-box' };\n\n/**\n * Displays a window onto the contents of a virtualized list starting from `offset`.\n * \n * Accepts props defined by {@link DisplayListProps}. \n * You must pass a single instance of {@link DisplayListItem} as a child.\n * @group Components\n */\nexport function DisplayList(props: DisplayListProps) {\n const { width, height, itemCount, itemOffsetMapping, className, innerClassName, offset: renderOffset, children,\n itemData, itemKey = defaultItemKey, layout = 'vertical', outerRender, innerRender, isScrolling } = props;\n\n const isVertical = layout === 'vertical';\n\n const [startIndex, startOffset, renderSize, sizes] = getRangeToRender(itemCount, itemOffsetMapping, \n isVertical ? height : width, renderOffset);\n const template = getGridTemplate(sizes);\n const offset = startOffset - renderOffset;\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do.\n const ChildVar = children;\n\n return (\n <VirtualContainer className={className} render={outerRender}\n style={{ position: \"relative\", height, width, overflow: \"hidden\", willChange: \"transform\" }}>\n <VirtualContainer className={innerClassName} render={innerRender}\n style={{ position: 'absolute',\n display: 'grid',\n gridTemplateColumns: isVertical ? undefined : template,\n gridTemplateRows: isVertical ? template : undefined,\n top: isVertical ? offset : 0, \n left: isVertical ? 0 : offset, \n height: isVertical ? renderSize : \"100%\", \n width: isVertical ? \"100%\" : renderSize }}>\n {sizes.map((_size, arrayIndex) => (\n <ChildVar data={itemData} isScrolling={isScrolling} \n key={itemKey(startIndex + arrayIndex, itemData)} index={startIndex + arrayIndex} style={boxStyle}/>\n ))}\n </VirtualContainer>\n </VirtualContainer>\n );\n}\n\nexport default DisplayList;\n","import React, { Fragment } from \"react\";\nimport { ItemOffsetMapping, DisplayBaseItemProps, DisplayBaseProps } from './VirtualBase';\nimport { getRangeToRender, getGridTemplate } from './VirtualCommon';\nimport { VirtualContainer } from './VirtualContainer';\n\n/**\n * Props accepted by {@link DisplayGridItem}\n */\nexport interface DisplayGridItemProps extends DisplayBaseItemProps {\n /** Row index of item in the grid being rendered */\n rowIndex: number,\n\n /** Column index of item in the grid being rendered */\n columnIndex: number,\n}\n\n/**\n * Type of item in a {@link DisplayGrid}\n *\n * Must be passed as a child to {@link DisplayGrid}. \n * Accepts props defined by {@link DisplayGridItemProps}.\n * Component must pass {@link DisplayBaseItemProps.style} to whatever it renders. \n * \n * @example Basic implementation\n * ```\n * const Row = ({ index, style }: { index: number, style: React.CSSProperties }) => (\n * <div className=\"row\" style={style}>\n * { index }\n * </div>\n * );\n * ```\n */\nexport type DisplayGridItem = React.ComponentType<DisplayGridItemProps>;\n\n/**\n * Props accepted by {@link DisplayGrid}\n */\nexport interface DisplayGridProps extends DisplayBaseProps {\n /** Component used as a template to render items in the list. Must implement {@link DisplayGridItem} interface. */\n children: DisplayGridItem,\n\n /** Number of rows in the grid */\n rowCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each row in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n rowOffsetMapping: ItemOffsetMapping,\n\n /** Number of columns in the grid */\n columnCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each column in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n columnOffsetMapping: ItemOffsetMapping,\n\n /** Vertical offset to start of displayed content */\n rowOffset: number,\n\n /** Horizontal offset to start of displayed content */\n columnOffset: number,\n\n /**\n * Function that defines the key to use for each item given row and column index and value of {@link DisplayBaseProps.itemData}.\n * @defaultValue\n * ```ts\n * (rowIndex, columnIndex, _data) => `${rowIndex}:${columnIndex}`\n * ```\n */\n itemKey?: (rowIndex: number, columnIndex: number, data: unknown) => React.Key,\n}\n\nconst defaultItemKey = (rowIndex: number, columnIndex: number, _data: unknown) => `${rowIndex}:${columnIndex}`;\n\nconst boxStyle: React.CSSProperties = { boxSizing: 'border-box' };\n\n/**\n * Displays a window onto the contents of a virtualized grid starting from `rowOffset`, `columnOffset`.\n * \n * Accepts props defined by {@link DisplayGridProps}. \n * You must pass a single instance of {@link DisplayGridItem} as a child.\n * @group Components\n */\nexport function DisplayGrid(props: DisplayGridProps) {\n const { width, height, rowCount, rowOffsetMapping, columnCount, columnOffsetMapping, className, innerClassName, \n rowOffset: rowRenderOffset, columnOffset: colRenderOffset, children,\n itemData, itemKey = defaultItemKey, outerRender, innerRender, isScrolling } = props;\n\n const [rowStartIndex, rowStartOffset, rowRenderSize, rowSizes] = getRangeToRender(rowCount, rowOffsetMapping, height, rowRenderOffset);\n const rowTemplate = getGridTemplate(rowSizes);\n\n const [colStartIndex, colStartOffset, colRenderSize, colSizes] = getRangeToRender(columnCount, columnOffsetMapping, width, colRenderOffset);\n const colTemplate = getGridTemplate(colSizes);\n\n const rowOffset = rowStartOffset - rowRenderOffset;\n const colOffset = colStartOffset - colRenderOffset;\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do.\n const ChildVar = children;\n\n return (\n <VirtualContainer className={className} render={outerRender}\n style={{ position: \"relative\", height, width, overflow: \"hidden\", willChange: \"transform\" }}>\n <VirtualContainer className={innerClassName} render={innerRender}\n style={{ position: 'absolute',\n display: 'grid',\n gridTemplateColumns: colTemplate,\n gridTemplateRows: rowTemplate,\n top: rowOffset, \n left: colOffset, \n height: rowRenderSize, \n width: colRenderSize }}>\n {rowSizes.map((_rowSize, rowIndex) => (\n <Fragment key={itemKey(rowStartIndex + rowIndex, 0, itemData)}>\n {colSizes.map((_size, colIndex) => (\n <ChildVar data={itemData} isScrolling={isScrolling} \n key={itemKey(rowStartIndex + rowIndex, colStartIndex + colIndex, itemData)} \n rowIndex={rowStartIndex + rowIndex} columnIndex={colStartIndex + colIndex} style={boxStyle}/>\n ))}\n </Fragment>\n ))}\n </VirtualContainer>\n </VirtualContainer>\n );\n}\n\nexport default DisplayGrid;\n","import { ItemOffsetMapping, ScrollToOption } from './VirtualBase';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\n\n/**\n * Custom ref handle returned by {@link VirtualGrid} that exposes imperative methods\n * \n * Use `React.useRef<VirtualGridProxy>(null)` to create a ref.\n */\nexport interface VirtualGridProxy {\n /**\n * Scrolls the list to the specified row and column in pixels\n */\n scrollTo(rowOffset?: number, columnOffset?: number): void;\n\n /**\n * Scrolls the list so that the specified item is visible\n * @param rowIndex - Row of item to scroll to\n * @param columnIndex - Column of item to scroll to\n * @param option - Where to {@link ScrollToOption | position} the item within the viewport\n */\n scrollToItem(rowIndex?: number, columnIndex?: number, option?: ScrollToOption): void;\n\n /** Exposes DOM clientWidth property */\n get clientWidth(): number;\n\n /** Exposes DOM clientHeight property */\n get clientHeight(): number;\n\n /** Current vertical position of scroll bar */\n get verticalOffset(): number;\n\n /** Current horizontal position of scroll bar */\n get horizontalOffset(): number;\n}\n\n/** Range to scroll to in one dimension specified as (offset,size). May be undefined if no need to scroll. */\nexport type ScrollRange = [ offset: number|undefined, size: number|undefined ];\n\n/**\n * Returns the {@link ScrollRange} corresponding to a specified item.\n * \n * Used internally to implement {@link VirtualGridProxy.scrollToItem}. Can be used directly for \n * advanced customization scenarios.\n */\nexport function getRangeToScroll(index: number | undefined, mapping: ItemOffsetMapping): ScrollRange {\n if (index === undefined)\n return [undefined, undefined];\n\n return [mapping.itemOffset(index), mapping.itemSize(index)];\n}\n\n/**\n * Same logic as {@link VirtualGridProxy.scrollToItem} usable with your own {@link VirtualScroll}\n * \n * You're encouraged to put together your own combination of {@link VirtualScroll} and {@link DisplayGrid} for\n * advanced customization scenarios. This function provides `ScrollToItem` functionality for use with your own {@link VirtualScroll}.\n */\nexport function virtualGridScrollToItem(scrollRef: React.RefObject<VirtualScrollProxy>, rowOffsetMapping: ItemOffsetMapping, \n columnOffsetMapping: ItemOffsetMapping, rowIndex?: number, columnIndex?: number, option?: ScrollToOption) {\n\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return;\n\n const [rowOffset, rowSize] = getRangeToScroll(rowIndex, rowOffsetMapping);\n const [colOffset, colSize] = getRangeToScroll(columnIndex, columnOffsetMapping);\n\n scroll.scrollToArea(rowOffset, rowSize, colOffset, colSize, option);\n}\n","import React from \"react\";\nimport { ItemOffsetMapping, VirtualBaseProps, ScrollToOption } from './VirtualBase';\nimport { DisplayGrid, DisplayGridItem } from './DisplayGrid';\nimport { VirtualContainerRender } from './VirtualContainer';\nimport { VirtualScroll } from './VirtualScroll';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\nimport { virtualGridScrollToItem, VirtualGridProxy } from './VirtualGridProxy';\nimport { AutoSizer } from './AutoSizer';\nimport { ScrollState } from './useVirtualScroll';\n\n/**\n * Props accepted by {@link VirtualGrid}\n */\nexport interface VirtualGridProps extends VirtualBaseProps {\n /** Component used as a template to render items in the grid. Must implement {@link DisplayGridItem} interface. */\n children: DisplayGridItem,\n\n /** Number of rows in the grid */\n rowCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each row in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n rowOffsetMapping: ItemOffsetMapping,\n\n /** Number of columns in the grid */\n columnCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each column in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n columnOffsetMapping: ItemOffsetMapping,\n\n /**\n * Function that defines the key to use for each item given row and column index and value of {@link VirtualBaseProps.itemData}.\n * @defaultValue\n * ```ts\n * (rowIndex, columnIndex, _data) => `${rowIndex}:${columnIndex}`\n * ```\n */\n itemKey?: (rowIndex: number, columnIndex: number, data: unknown) => React.Key,\n\n /**\n * Callback after a scroll event has been processed and state updated but before rendering\n * @param rowOffset - Resulting overall row offset. Can be passed to {@link ItemOffsetMapping} to determine first row.\n * @param columnOffset - Resulting overall column offset. Can be passed to {@link ItemOffsetMapping} to determine first column.\n * @param newRowScrollState - New {@link ScrollState} for rows that will be used for rendering.\n * @param newColumnScrollState - New {@link ScrollState} for columns that will be used for rendering.\n */\n onScroll?: (rowOffset: number, columnOffset: number, newRowScrollState: ScrollState, newColumnScrollState: ScrollState) => void;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualGrid} outer container. */\n outerRender?: VirtualContainerRender;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link DisplayGrid} within {@link VirtualGrid} inner container. */\n innerRender?: VirtualContainerRender;\n}\n\n// Using a named function rather than => so that the name shows up in React Developer Tools\n/**\n * Virtual Scrolling Grid\n * \n * Accepts props defined by {@link VirtualGridProps}. \n * Refs are forwarded to {@link VirtualGridProxy}. \n * You must pass a single instance of {@link DisplayGridItem} as a child.\n * @group Components\n */\nexport const VirtualGrid = React.forwardRef<VirtualGridProxy, VirtualGridProps>(function VirtualGrid(props, ref) {\n const { rowCount, rowOffsetMapping, columnCount, columnOffsetMapping, children, \n innerClassName, innerRender, itemData, itemKey, onScroll: onScrollCallback, ...scrollProps } = props;\n\n // Total size is same as offset to item one off the end\n const totalRowSize = rowOffsetMapping.itemOffset(rowCount);\n const totalColumnSize = columnOffsetMapping.itemOffset(columnCount);\n\n const scrollRef = React.useRef<VirtualScrollProxy>(null);\n\n\n React.useImperativeHandle(ref, () => {\n return {\n scrollTo(rowOffset?: number, columnOffset?: number): void {\n const scroll = scrollRef.current;\n /* istanbul ignore else */\n if (scroll)\n scroll.scrollTo(rowOffset, columnOffset);\n },\n\n scrollToItem(rowIndex?: number, columnIndex?: number, option?: ScrollToOption): void {\n virtualGridScrollToItem(scrollRef, rowOffsetMapping, columnOffsetMapping, rowIndex, columnIndex, option);\n },\n\n get clientWidth(): number {\n return scrollRef.current ? scrollRef.current.clientWidth : /* istanbul ignore next */ 0;\n },\n\n get clientHeight(): number {\n return scrollRef.current ? scrollRef.current.clientHeight : /* istanbul ignore next */ 0;\n },\n\n get verticalOffset(): number {\n return scrollRef.current ? scrollRef.current.verticalOffset : /* istanbul ignore next */ 0;\n },\n\n get horizontalOffset(): number {\n return scrollRef.current ? scrollRef.current.horizontalOffset : /* istanbul ignore next */ 0;\n }\n }\n }, [ rowOffsetMapping, columnOffsetMapping ]);\n\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do. \n const ChildVar = children;\n\n return (\n <VirtualScroll\n ref={scrollRef}\n {...scrollProps}\n scrollHeight={totalRowSize}\n scrollWidth={totalColumnSize}\n onScroll={(verticalOffset, horizontalOffset, verticalScrollState, horizontalScrollState) => {\n if (onScrollCallback)\n onScrollCallback(verticalOffset, horizontalOffset, verticalScrollState, horizontalScrollState);\n }}>\n {({ isScrolling, verticalOffset, horizontalOffset }) => (\n <AutoSizer style={{ height: '100%', width: '100%' }}>\n {({height,width}) => (\n <DisplayGrid\n innerClassName={innerClassName}\n innerRender={innerRender}\n rowOffset={verticalOffset}\n columnOffset={horizontalOffset}\n height={height}\n rowCount={rowCount}\n columnCount={columnCount}\n itemData={itemData}\n itemKey={itemKey}\n isScrolling={isScrolling}\n rowOffsetMapping={rowOffsetMapping}\n columnOffsetMapping={columnOffsetMapping}\n width={width}>\n {ChildVar}\n </DisplayGrid>\n )}\n </AutoSizer>\n )}\n </VirtualScroll>\n );\n});\n\nexport default VirtualGrid;\n","import { ItemOffsetMapping, ScrollToOption } from './VirtualBase';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\n\n/**\n * Custom ref handle returned by {@link VirtualList} that exposes imperative methods\n * \n * Use `React.useRef<VirtualListProxy>(null)` to create a ref.\n */\nexport interface VirtualListProxy {\n /**\n * Scrolls the list to the specified offset in pixels\n * @param offset - Offset to scroll to\n */\n scrollTo(offset: number): void;\n\n /**\n * Scrolls the list so that the specified item is visible\n * @param index - Index of item to scroll to\n * @param option - Where to {@link ScrollToOption | position} the item within the viewport\n */\n scrollToItem(index: number, option?: ScrollToOption): void;\n\n /** Current scroll position */\n get offset(): number;\n}\n\n/**\n * Same logic as {@link VirtualListProxy.scrollToItem} usable with your own {@link VirtualScroll}\n * \n * You're encouraged to put together your own combination of {@link VirtualScroll} and {@link DisplayList} for\n * advanced customization scenarios. This function provides `ScrollToItem` functionality for use with your own {@link VirtualScroll}.\n */\nexport function virtualListScrollToItem(scrollRef: React.RefObject<VirtualScrollProxy>, itemOffsetMapping: ItemOffsetMapping, isVertical: boolean,\n index: number, option?: ScrollToOption) {\n\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return;\n\n const itemOffset = itemOffsetMapping.itemOffset(index);\n const itemSize = itemOffsetMapping.itemSize(index);\n\n if (isVertical)\n scroll.scrollToArea(itemOffset, itemSize, undefined, undefined, option);\n else\n scroll.scrollToArea(undefined, undefined, itemOffset, itemSize, option);\n}","import React from \"react\";\nimport { ItemOffsetMapping, VirtualBaseProps, ScrollToOption, ScrollLayout } from './VirtualBase';\nimport { DisplayList, DisplayListItem } from './DisplayList';\nimport { VirtualContainerRender } from './VirtualContainer';\nimport { VirtualScroll } from './VirtualScroll';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\nimport { virtualListScrollToItem, VirtualListProxy } from './VirtualListProxy';\nimport { AutoSizer } from './AutoSizer';\nimport { ScrollState } from './useVirtualScroll';\n\n/**\n * Props accepted by {@link VirtualList}\n */\nexport interface VirtualListProps extends VirtualBaseProps {\n /** Component used as a template to render items in the list. Must implement {@link DisplayListItem} interface. */\n children: DisplayListItem,\n\n /** Number of items in the list */\n itemCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each item in the list\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n itemOffsetMapping: ItemOffsetMapping,\n\n /**\n * Function that defines the key to use for each item given item index and value of {@link VirtualBaseProps.itemData}.\n * @defaultValue `(index, _data) => index`\n */\n itemKey?: (index: number, data: unknown) => React.Key,\n\n /**\n * Choice of 'vertical' or 'horizontal' layouts\n * @defaultValue 'vertical'\n */\n layout?: ScrollLayout,\n\n /**\n * Callback after a scroll event has been processed and state updated but before rendering\n * @param offset - Resulting overall offset. Can be passed to {@link ItemOffsetMapping} to determine top item.\n * @param newScrollState - New {@link ScrollState} that will be used for rendering.\n */\n onScroll?: (offset: number, newScrollState: ScrollState) => void;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualList} outer container. */\n outerRender?: VirtualContainerRender;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link DisplayList} within {@link VirtualList} inner container. */\n innerRender?: VirtualContainerRender;\n}\n\n\n\n// Using a named function rather than => so that the name shows up in React Developer Tools\n/**\n * Virtual Scrolling List\n * \n * Accepts props defined by {@link VirtualListProps}. \n * Refs are forwarded to {@link VirtualListProxy}. \n * You must pass a single instance of {@link DisplayListItem} as a child.\n * @group Components\n */\nexport const VirtualList = React.forwardRef<VirtualListProxy, VirtualListProps>(function VirtualList(props, ref) {\n const { itemCount, itemOffsetMapping, children, layout = 'vertical', onScroll: onScrollCallback,\n innerClassName, innerRender, itemData, itemKey, ...scrollProps } = props;\n\n // Total size is same as offset to item one off the end\n const renderSize = itemOffsetMapping.itemOffset(itemCount);\n\n const scrollRef = React.useRef<VirtualScrollProxy>(null);\n const isVertical = layout === 'vertical';\n\n React.useImperativeHandle(ref, () => {\n return {\n scrollTo(offset: number): void {\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return;\n\n if (isVertical)\n scroll.scrollTo(offset, undefined);\n else\n scroll.scrollTo(undefined, offset);\n },\n\n scrollToItem(index: number, option?: ScrollToOption): void {\n virtualListScrollToItem(scrollRef, itemOffsetMapping, isVertical, index, option);\n },\n\n get offset(): number {\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return 0;\n\n return isVertical ? scroll.verticalOffset : scroll.horizontalOffset;\n }\n }\n }, [ itemOffsetMapping, isVertical ]);\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do.\n const ChildVar = children;\n\n return (\n <VirtualScroll\n ref={scrollRef}\n {...scrollProps}\n scrollHeight={isVertical ? renderSize : undefined}\n scrollWidth={isVertical ? undefined : renderSize}\n onScroll={(verticalOffset, horizontalOffset, verticalScrollState, horizontalScrollState) => {\n const newOffset = isVertical ? verticalOffset : horizontalOffset;\n if (onScrollCallback)\n onScrollCallback(newOffset, isVertical ? verticalScrollState : horizontalScrollState);\n }}>\n {({ isScrolling, verticalOffset, horizontalOffset }) => (\n <AutoSizer style={{ height: '100%', width: '100%' }}>\n {({height,width}) => (\n <DisplayList\n innerClassName={innerClassName}\n innerRender={innerRender}\n layout={layout}\n offset={isVertical ? verticalOffset : horizontalOffset}\n height={height}\n itemCount={itemCount}\n itemData={itemData}\n itemKey={itemKey}\n isScrolling={isScrolling}\n itemOffsetMapping={itemOffsetMapping}\n width={width}>\n {ChildVar}\n </DisplayList>\n )}\n </AutoSizer>\n )}\n </VirtualScroll>\n );\n});\n\nexport default VirtualList;\n","import { ItemOffsetMapping } from './VirtualBase';\n\nclass FixedSizeItemOffsetMapping implements ItemOffsetMapping {\n constructor (itemSize: number) {\n this.fixedItemSize = itemSize;\n }\n\n itemSize(_itemIndex: number): number {\n return this.fixedItemSize;\n }\n\n itemOffset(itemIndex: number): number {\n return itemIndex * this.fixedItemSize;\n }\n\n offsetToItem(offset: number): [itemIndex: number, startOffset: number] {\n const itemIndex = Math.floor(offset / this.fixedItemSize);\n const startOffset = itemIndex * this.fixedItemSize;\n\n return [itemIndex, startOffset];\n }\n\n fixedItemSize: number;\n}\n\n/**\n * Returns an instance of {@link ItemOffsetMapping} suitable for use when all items have a fixed size.\n * \n * @param itemSize - Size to use for all items\n */\nexport function useFixedSizeItemOffsetMapping(itemSize: number): ItemOffsetMapping {\n return new FixedSizeItemOffsetMapping(itemSize);\n}\n\nexport default useFixedSizeItemOffsetMapping;\n","import { ItemOffsetMapping } from './VirtualBase';\n\nclass VariableSizeItemOffsetMapping implements ItemOffsetMapping {\n constructor (defaultItemSize: number, sizes: number[]) {\n this.defaultItemSize = defaultItemSize;\n this.sizes = sizes;\n }\n\n itemSize(itemIndex: number): number {\n return (itemIndex < this.sizes.length) ? this.sizes[itemIndex] : this.defaultItemSize;\n }\n\n itemOffset(itemIndex: number): number {\n let offset = 0;\n let length = this.sizes.length;\n if (itemIndex > length) {\n const numDefaultSize = itemIndex - length;\n offset = numDefaultSize * this.defaultItemSize;\n } else {\n length = itemIndex;\n }\n \n for (let i = 0; i < length; i ++)\n {\n offset += this.sizes[i];\n }\n\n return offset;\n }\n\n offsetToItem(offset: number): [itemIndex: number, startOffset: number] {\n let startOffset = 0;\n const length = this.sizes.length;\n for (let i = 0; i < length; i ++) {\n const size = this.sizes[i];\n if (startOffset + size > offset) {\n return [i, startOffset];\n }\n startOffset += size;\n }\n\n const itemIndex = Math.floor((offset - startOffset) / this.defaultItemSize);\n startOffset += itemIndex * this.defaultItemSize;\n\n return [itemIndex+length, startOffset];\n }\n\n defaultItemSize: number;\n sizes: number[];\n}\n\n/**\n * Returns an instance of {@link ItemOffsetMapping} suitable for use when initial items have variable sizes.\n * \n * @param defaultItemSize - Size to use for all other items\n * @param sizes - Array of sizes to use for the initial items, one size per item\n */\nexport function useVariableSizeItemOffsetMapping(defaultItemSize: number, sizes?: number[]): ItemOffsetMapping {\n return new VariableSizeItemOffsetMapping(defaultItemSize, sizes || []);\n}\n\nexport default useVariableSizeItemOffsetMapping;"],"names":["_jsx","useIsScrolling","useIsScrollingHook","_jsxs","defaultItemKey","boxStyle"],"mappings":";;;AAiCA,MAAM,sBAAsB,GAA2B,CAAC,EAAC,GAAG,IAAI,EAAC,EAAE,GAAG,MACpEA,aAAK,GAAG,EAAE,GAAG,EAAM,GAAA,IAAI,EAAI,CAAA,CAC5B;AAED;;;;;AAKG;MACU,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAC9C,SAAS,gBAAgB,CAAC,EAAC,MAAM,GAAG,sBAAsB,EAAE,GAAG,IAAI,EAAC,EAAE,GAAG,EAAA;AACvE,IAAA,OAAO,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;AAC5B,CAAC;;ACJD;;;;;;;;AAQG;AACG,SAAU,SAAS,CAAC,KAAqB,EAAA;IAC7C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK;;;AAI5C,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,CAAC,CAAC;AACnD,IAAA,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAiB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js","sources":["../src/VirtualContainer.tsx","../src/AutoSizer.tsx","../src/useVirtualScroll.ts","../src/useEventListener.ts","../src/useAnimationTimeout.ts","../src/useIsScrolling.ts","../src/VirtualScrollProxy.ts","../src/VirtualScroll.tsx","../src/VirtualCommon.ts","../src/DisplayList.tsx","../src/DisplayGrid.tsx","../src/VirtualGridProxy.ts","../src/VirtualGrid.tsx","../src/VirtualListProxy.ts","../src/VirtualList.tsx","../src/useFixedSizeItemOffsetMapping.ts","../src/useVariableSizeItemOffsetMapping.ts"],"sourcesContent":["import React from \"react\";\n\n/**\n * Props that an implementation of {@link VirtualContainerRender} must accept.\n * \n * Includes all the props that a {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElement | HTMLDivElement} would accept.\n */\nexport type VirtualContainerRenderProps = React.ComponentPropsWithoutRef<'div'>;\n\n/**\n * Render prop for a {@link VirtualContainer}\n *\n * Can be passed to {@link VirtualContainer} to replace default implementation. \n * Function must render a div and forward {@link VirtualContainerRenderProps}\n * and any `ref` to it. \n * \n * @example Minimal compliant implementation\n * ```\n * const containerRender: VirtualContainerRender = ({...rest}, ref) => (\n * <div ref={ref} {...rest} />\n * )\n * ```\n */\nexport type VirtualContainerRender = (props: VirtualContainerRenderProps, ref?: React.ForwardedRef<HTMLDivElement>) => JSX.Element;\n\n/**\n * Props that {@link VirtualContainer} accepts.\n */\nexport interface VirtualContainerComponentProps extends VirtualContainerRenderProps {\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualContainer}. */\n render?: VirtualContainerRender;\n}\n\nconst defaultContainerRender: VirtualContainerRender = ({...rest}, ref) => (\n <div ref={ref} {...rest} />\n)\n\n/**\n * Wrapper around a div used by other components in {@link @candidstartup/react-virtual-scroll!}. Most props are passed through to the div. Use the\n * {@link VirtualContainerComponentProps.render} prop to override the default behavior. \n * \n * @group Components\n */\nexport const VirtualContainer = React.forwardRef<HTMLDivElement, VirtualContainerComponentProps >(\n function VirtualContainer({render = defaultContainerRender, ...rest}, ref) {\n return render(rest, ref)\n})\n","import React from \"react\";\n\n/**\n * Props that an implementation of {@link AutoSizerRender} must accept.\n */\nexport interface AutoSizerRenderProps {\n /** Computed height */\n height: number,\n\n /** Computed width */\n width: number,\n}\n\n/**\n * Render prop for content in an {@link AutoSizer}\n *\n * Function renders content and forwards `width` and `height`\n * to whatever needs it.\n * \n * @example Simple implementation\n * ```\n * const autoSizeRender: AutoSizeRender = ({width, height}) => (\n * <VirtualList width={width} height={height} {...props} />\n * )\n * ```\n */\nexport type AutoSizerRender = (props: AutoSizerRenderProps) => JSX.Element;\n\n/**\n * Props accepted by {@link AutoSizer}\n */\nexport interface AutoSizerProps {\n /** Function implementing {@link AutoSizerRender} that renders the content that needs explicit sizing */\n children: AutoSizerRender\n\n /** The `className` applied to the container element */\n className?: string,\n\n /** Inline style to apply to the container element */\n style?: React.CSSProperties;\n}\n\n/**\n * HOC that calculates the size available to it and makes the computed size available to children.\n * The size available depends on DOM layout and style applied wherever the AutoSizer finds itself.\n * You will probably want to pass something appropriate via the `className` or `style` props.\n * \n * Accepts props defined by {@link AutoSizerProps}. \n * You must pass a single instance of {@link AutoSizerRender} as a child.\n * @group Components\n */\nexport function AutoSizer(props: AutoSizerProps) {\n const { children, className, style } = props;\n\n // Using separate primitive states rather than one composite so that React\n // can detect duplicates values and bail out of redundant renders.\n const [width, setWidth] = React.useState<number>(0);\n const [height, setHeight] = React.useState<number>(0);\n const ref = React.useRef<HTMLDivElement>(null);\n\n // Make sure resize callback is a stable value so we're not constantly\n // creating and disconnecting resize observers.\n const resizeCallback: ResizeObserverCallback = React.useCallback((entries) => {\n entries.forEach(entry => {\n // Context box sizes can contain fractional values while clientWidth\n // and clientHeight properties are always rounded to nearest integer.\n // Always use integer values to avoid confusion.\n const newWidth = Math.round(entry.contentBoxSize[0].inlineSize);\n setWidth(newWidth);\n const newHeight = Math.round(entry.borderBoxSize[0].blockSize);\n setHeight(newHeight);\n })\n }, []);\n\n // Expect effect to run only on initial mount\n React.useLayoutEffect(() => {\n const div = ref.current;\n /* istanbul ignore if*/\n if (!div)\n return;\n\n // Size on initial mount\n setHeight(div.clientHeight);\n setWidth(div.clientWidth);\n\n // Updates size on any subsequent resize. Only available in browser\n // environment so avoid crashing out when server side rendering, or\n // running unit test without ResizeObserver being mocked. \n if (typeof ResizeObserver !== 'undefined') {\n const resizeObserver = new ResizeObserver(resizeCallback);\n resizeObserver.observe(div);\n return () => { resizeObserver.disconnect() }\n }\n }, [resizeCallback])\n\n // No point rendering children until we've measured size and found a usable area\n const renderChildren = height > 0 && width > 0;\n\n // Ensure that size is driven only by parent. Wrapping child in a zero sized inner div\n // which it can overflow stops child's size having any impact on size of outer div. \n // Otherwise can end up in infinite loop if child makes itself bigger than the \n // actual width and height we pass to it. That could be because child has \n // padding/borders/margins or because child renders itself bigger than size it's given.\n return (\n <div ref={ref} className={className} style={style}>\n <div style={{ overflow: 'visible', width: 0, height: 0 }}>\n {renderChildren && children({height, width})}\n </div>\n </div>\n );\n}\n\nexport default AutoSizer;\n","import { useState, useRef, RefObject } from \"react\";\n\n/** Direction of scrolling */\nexport type ScrollDirection = \"forward\" | \"backward\";\n\n/**\n * Overall scroll state for a single dimension.\n */\nexport interface ScrollState { \n /** Scroll bar offset. Equal to outer container's `scrollTop` or `scrollLeft` depending on dimension. */\n scrollOffset: number, \n\n /** Offset used to position current page of items in virtual space. Total offset is `scrollOffset+renderOffset`. */\n renderOffset: number,\n\n /** Index of current page. */\n page: number, \n\n /** Current scrolling direction. Calculated by comparing current overall offset to that when last rendered. */\n scrollDirection: ScrollDirection, \n}\n\nexport interface VirtualScrollState {\n /** Snapshot of overall offset at last render */\n totalOffset: number;\n\n /** Physical size of scrollable area */\n renderSize: number;\n\n // Returns updated scrollOffset. Caller should update scroll bar position if different from value passed in. \n onScroll(this: void, clientExtent: number, scrollExtent: number, scrollOffset: number): [number, ScrollState];\n\n // Scroll to offset in logical space returning offset to update scroll bar position to\n doScrollTo(this: void, offset: number, clientExtent: number): number;\n\n // Returns current overall offset (NOT a snapshot)\n getCurrentOffset(this: void): number;\n\n // Internal scroll state. Most scenarios will never need to access this. Mainly here for unit test.\n scrollState: RefObject<ScrollState>;\n}\n\n// Max size that is safe across all browsers (Firefox is the limiting factor)\n// SlickGrid tries to dynamically determine limit on other browsers (Chrome will do 30M) but\n// I prefer simplicity of same behavior across all browsers.\nconst MAX_SUPPORTED_CSS_SIZE = 6000000;\nconst MIN_NUMBER_PAGES = 100;\n\n/** Custom hook that implements logic for paged virtual scrolling in a single dimension */\nexport function useVirtualScroll(totalSize: number, maxCssSize = MAX_SUPPORTED_CSS_SIZE, minNumberPages = MIN_NUMBER_PAGES, \n useTotalOffset = true): VirtualScrollState {\n let renderSize=0, pageSize=0, numPages=0;\n if (totalSize < maxCssSize) {\n // No paging needed\n renderSize = pageSize = totalSize;\n numPages = 1;\n } else {\n // Break into pages\n renderSize = maxCssSize;\n pageSize = renderSize / minNumberPages;\n numPages = Math.floor(totalSize / pageSize);\n }\n\n function pageToRenderOffset(page: number): number {\n if (page <= 0)\n return 0;\n\n if (page >= numPages-1)\n return totalSize - renderSize;\n\n return Math.round((page-1) * (totalSize - renderSize) / (numPages - 3));\n }\n\n const initValue: ScrollState = { \n scrollOffset: 0, \n renderOffset: 0,\n page: 0,\n scrollDirection: \"forward\",\n };\n const [totalOffset, setTotalOffset] = useState<number>(0);\n const scrollState = useRef(initValue);\n\n function onScroll(clientExtent: number, scrollExtent: number, scrollOffset: number): [number, ScrollState] {\n const currState = scrollState.current;\n if (currState.scrollOffset == scrollOffset) {\n // No need to change state if scroll position unchanged\n return [scrollOffset, currState];\n }\n\n // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.\n let newOffset = Math.max(0, Math.min(scrollOffset, scrollExtent - clientExtent));\n const newScrollDirection = currState.scrollOffset <= newOffset ? 'forward' : 'backward';\n\n // Switch pages if needed\n let newPage, newRenderOffset;\n let retScrollOffset = scrollOffset;\n const scrollDist = Math.abs(newOffset - currState.scrollOffset);\n if (scrollDist < clientExtent) {\n // Scrolling part of visible window, don't want to skip items, so can't scale up movement\n // If we cross page boundary we need to reset scroll bar position back to where it should be at start of page\n newPage = Math.min(numPages - 1, Math.floor((scrollOffset + currState.renderOffset) / pageSize));\n newRenderOffset = pageToRenderOffset(newPage);\n if (newPage != currState.page) {\n // Be very intentional about when we ask caller to reset scroll bar\n // Don't want to trigger event loops\n newOffset = scrollOffset + currState.renderOffset - newRenderOffset;\n retScrollOffset = newOffset;\n }\n } else {\n // Large scale scrolling, choosing page from a rolodex\n // First and last page are mapped 1:1 between grid and container\n if (newOffset < pageSize) {\n newPage = 0;\n } else if (newOffset >= renderSize - pageSize) {\n newPage = numPages - 1;\n } else {\n const scaleFactor = (totalSize - pageSize*2) / (renderSize - pageSize*2);\n newPage = Math.min(numPages - 3, Math.floor((newOffset - pageSize) * scaleFactor / pageSize)) + 1;\n }\n newRenderOffset = pageToRenderOffset(newPage);\n }\n\n const newScrollState: ScrollState = \n { scrollOffset: newOffset, renderOffset: newRenderOffset, page: newPage, scrollDirection: newScrollDirection };\n scrollState.current = newScrollState;\n if (useTotalOffset)\n setTotalOffset(newOffset + newRenderOffset);\n return [retScrollOffset, newScrollState];\n }\n\n function doScrollTo(offset: number, clientExtent: number) {\n const currState = scrollState.current;\n const safeOffset = Math.min(totalSize - clientExtent, Math.max(offset, 0));\n const scrollDirection = (currState.scrollOffset + currState.renderOffset) <= safeOffset ? 'forward' : 'backward';\n const page = Math.min(numPages - 1, Math.floor(safeOffset / pageSize));\n const renderOffset = pageToRenderOffset(page);\n const scrollOffset = safeOffset - renderOffset;\n\n scrollState.current = { scrollOffset, renderOffset, page, scrollDirection };\n if (useTotalOffset)\n setTotalOffset(scrollOffset + renderOffset);\n return scrollOffset;\n }\n\n function getCurrentOffset() {\n const currState = scrollState.current;\n return currState.scrollOffset + currState.renderOffset;\n }\n\n return {totalOffset, renderSize, onScroll, doScrollTo, getCurrentOffset, scrollState} as const;\n}\n\nexport default useVirtualScroll;\n","// Based on https://github.com/realwugang/use-event-listener\n// and https://github.com/donavon/use-event-listener/blob/develop/src/index.js\n\nimport { useRef, useEffect, RefObject, createRef } from 'react';\n\ninterface Options {\n capture?: boolean\n once?: boolean\n passive?: boolean\n}\n\ntype Listener = Window | Document | HTMLElement;\n\nfunction isListener(element: Listener | RefObject<HTMLElement>): element is Listener {\n return (element as Listener).addEventListener !== undefined;\n}\n\ntype EventHandler = (event: Event) => void;\n\nexport function useEventListener (eventName: string, \n handler: EventHandler, \n element: Listener | RefObject<HTMLElement> | null = window, \n options: Options = {}) {\n const savedHandler = useRef<EventHandler>();\n const { capture, passive, once } = options;\n\n useEffect(() => {\n savedHandler.current = handler\n }, [handler])\n\n useEffect(() => {\n if (!element)\n return;\n\n const el = isListener(element) ? element : element.current;\n if (!el)\n return;\n\n const eventListener = (event: Event) => savedHandler.current?.(event);\n const opts = { capture, passive, once };\n el.addEventListener(eventName, eventListener, opts);\n return () => {\n el.removeEventListener(eventName, eventListener, opts);\n };\n }, [eventName, element, capture, passive, once]);\n}\n\nexport default useEventListener;\n\n// In-source testing for private helper functions\nif (import.meta.vitest) {\n const { it, expect } = import.meta.vitest\n it('isListener', () => {\n expect(isListener(window)).toBe(true)\n expect(isListener(document)).toBe(true)\n expect(isListener(document.createElement(\"div\"))).toBe(true)\n expect(isListener(createRef())).toBe(false)\n })\n}","// Based on https://overreacted.io/making-setinterval-declarative-with-react-hooks/\n// and https://www.joshwcomeau.com/snippets/react-hooks/use-timeout/\n// and https://github.com/bvaughn/react-window/blob/master/src/timer.js\n//\n// Equivalent functionality to a useTimeout hook but based on requestAnimationFrame instead of setTimeout. Use\n// when making frequent requests for short duration timeouts where browser may throttle setTimeout.\nimport { useEffect, useRef } from 'react';\n\ntype Callback = () => void;\n\nexport function useAnimationTimeout(callback: Callback, delay: number | null, key?: unknown) {\n const requestRef = useRef<number>();\n const savedCallback = useRef<Callback>(callback);\n\n // Remember the latest callback\n useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n \n const start = performance.now();\n \n useEffect(() => {\n function tick() {\n requestRef.current = undefined;\n if (delay === null)\n return;\n\n if (performance.now() - start >= delay) {\n savedCallback.current();\n } else {\n requestRef.current = requestAnimationFrame(tick);\n }\n }\n\n tick();\n\n return () => {\n if (typeof requestRef.current === 'number') {\n cancelAnimationFrame(requestRef.current);\n requestRef.current = undefined;\n }\n }\n }, [start, delay, key]);\n}\n\nexport default useAnimationTimeout;","import { useState, RefObject } from \"react\";\nimport { useEventListener } from './useEventListener';\nimport { useAnimationTimeout } from './useAnimationTimeout';\n\nconst DEBOUNCE_INTERVAL = 150;\nconst FALLBACK_INTERVAL = 500;\n\nexport function useIsScrolling(element: Window | HTMLElement | RefObject<HTMLElement> | null = window): boolean {\n const [scrollCount, setScrollCount] = useState(0);\n\n // scrollend implementations in both Chrome and Firefox are buggy with missing scrollend events\n // in some circumstances (using keyboard to scroll past end in Chrome, intermittently when using mouse wheel in Firefox)\n // Use a timeout even when scrollend is supported to handle missing events. In this case we use a longer interval as\n // don't want it to be over sensitive. \n const supportsScrollEnd = ('onscrollend' in window);\n const delay = supportsScrollEnd ? FALLBACK_INTERVAL : DEBOUNCE_INTERVAL;\n\n useEventListener(\"scroll\", () => setScrollCount(c => c + 1), element);\n useEventListener(\"scrollend\", () => setScrollCount(0), supportsScrollEnd ? element : null);\n useAnimationTimeout(() => setScrollCount(0), (scrollCount == 0) ? null : delay, scrollCount);\n\n return scrollCount > 0;\n}\n\nexport default useIsScrolling;","import { ScrollToOption } from './VirtualBase';\n\n/**\n * Custom ref handle returned by {@link VirtualScroll} that exposes imperative methods\n * \n * Use `React.useRef<VirtualScrollProxy>(null)` to create a ref.\n */\nexport interface VirtualScrollProxy {\n /**\n * Scrolls to the specified vertical and horizontal offset in pixels\n * Either offset can be left undefined to scroll in one dimension only\n * @param verticalOffset - Offset to scroll to vertically\n * @param horizontalOffset - Offset to scroll to horizontally\n */\n scrollTo(verticalOffset?: number, horizontalOffset?: number): void;\n\n /**\n * Scrolls to the specified area\n * Either offset/size pair can be left undefined to scroll in one dimension only\n * @param verticalOffset - Offset to scroll to vertically\n * @param verticalSize - Size of target area vertically\n * @param horizontalOffset - Offset to scroll to horizontally\n * @param horizontalSize - Size of target area horizontally\n * @param option - Where to {@link ScrollToOption | position} the area within the viewport\n */\n scrollToArea(verticalOffset?: number, verticalSize?: number, horizontalOffset?: number, horizontalSize?: number, option?: ScrollToOption): void;\n\n /** Exposes DOM clientWidth property */\n get clientWidth(): number;\n\n /** Exposes DOM clientHeight property */\n get clientHeight(): number;\n\n /** Current vertical position of scroll bar */\n get verticalOffset(): number;\n\n /** Current horizontal position of scroll bar */\n get horizontalOffset(): number;\n}\n\n/**\n * Returns the offset needed to scroll in one dimension for a specified range\n * \n * Used internally to implement {@link VirtualScrollProxy.scrollToArea}. Can be used directly for \n * advanced customization scenarios.\n */\nexport function getOffsetToScrollRange(offset: number | undefined, size: number | undefined, \n clientExtent: number, scrollOffset: number, option?: ScrollToOption): number | undefined\n{\n if (offset === undefined)\n return undefined;\n\n if (option != 'visible')\n return offset;\n\n // Start of item offscreen before start of viewport?\n if (offset < scrollOffset)\n return offset;\n\n size = size || 0;\n\n // Already completely visible?\n const endOffset = offset + size;\n const endViewport = scrollOffset + clientExtent;\n if (endOffset <= endViewport)\n return undefined;\n\n // Item offscreen past end of viewport\n\n // Item bigger than viewport? Make sure start is in view\n if (size > clientExtent)\n return offset;\n\n // Scroll so end of item aligns with end of viewport\n return offset - clientExtent + size;\n }\n","import React from \"react\";\nimport { VirtualContainer, VirtualContainerRender } from './VirtualContainer';\nimport { VirtualScrollableProps, ScrollEvent, ScrollToOption } from './VirtualBase';\nimport { useVirtualScroll, ScrollState } from './useVirtualScroll';\nimport { useIsScrolling as useIsScrollingHook} from './useIsScrolling';\nimport { getOffsetToScrollRange, VirtualScrollProxy } from './VirtualScrollProxy';\n\n/**\n * Props that an implementation of {@link VirtualContentRender} must accept.\n */\nexport interface VirtualContentProps {\n /** \n * Is the owning component being actively scrolled? Used to change how the content is rendered depending on scroll state.\n * \n * Only defined if {@link VirtualScrollableProps.useIsScrolling} is true. \n * */\n isScrolling?: boolean,\n\n /** Current scroll position vertical offset */\n verticalOffset: number,\n\n /** Current scroll position horizontal offset */\n horizontalOffset: number\n}\n\n/**\n * Render prop for content in {@link VirtualScroll}\n *\n * Pass as child to {@link VirtualScroll} to render content and forward {@link VirtualContentProps}\n * to whatever needs them. \n * \n * @example Simple implementation\n * ```\n * const contentRender: VirtualContentRender = ({isScrolling, verticalOffset, horizontalOffset}) => (\n * <DisplayGrid\n * isScrolling={isScrolling}\n * rowOffset={verticalOffset}\n * columnOffset={horizontalOffset}\n * {...rest}/>\n * )\n * ```\n */\nexport type VirtualContentRender = (props: VirtualContentProps, ref?: React.ForwardedRef<HTMLDivElement>) => JSX.Element;\n\n/**\n * Props accepted by {@link VirtualScroll}\n */\nexport interface VirtualScrollProps extends VirtualScrollableProps {\n /** Function implementing {@link VirtualContentRender} that renders the content that needs to respond to scrolling */\n children: VirtualContentRender\n\n /** \n * Height of area to scroll over \n * \n * @defaultValue 0\n */\n scrollHeight?: number,\n\n /** \n * Width of area to scroll over \n * \n * @defaultValue 0\n */\n scrollWidth?: number,\n\n /** \n * Determines whether the component should pass {@link VirtualContentProps.verticalOffset|verticalOffset} and \n * {@link VirtualContentProps.horizontalOffset|horizontalOffset} to children when rendering.\n * \n * Can reduce the number of renders needed if these props aren't used\n * \n * @defaultValue true\n * */\n useOffsets?: boolean,\n\n /**\n * Callback after a scroll event has been processed and state updated but before rendering\n * @param verticalOffset - Resulting overall vertical offset. \n * @param horizontalOffset - Resulting overall horizontal offset.\n * @param newVerticalScrollState - New vertical {@link ScrollState} that will be used for rendering.\n * @param newHorizontalScrollState - New horizontal {@link ScrollState} that will be used for rendering.\n */\n onScroll?: (verticalOffset: number, horizontalOffset: number, newVerticalScrollState: ScrollState, newHorizontalScrollState: ScrollState) => void;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualScroll} outer container. */\n outerRender?: VirtualContainerRender;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualScroll} inner container. */\n innerRender?: VirtualContainerRender;\n}\n\n// Using a named function rather than => so that the name shows up in React Developer Tools\n/**\n * Customizable Virtual Scrolling Component\n * \n * Allows user to scroll over a virtual area `scrollHeight` x `scrollWidth` pixels. \n * Use `onScroll` to track scroll state and {@link VirtualContentRender} to render scroll state specific content into the viewport\n * \n * Accepts props defined by {@link VirtualScrollProps}. \n * Refs are forwarded to {@link VirtualScrollProxy}. \n * @group Components\n */\nexport const VirtualScroll = React.forwardRef<VirtualScrollProxy, VirtualScrollProps>(function VirtualScroll(props, ref) {\n const { width, height, scrollWidth = 0, scrollHeight = 0, className, innerClassName, children,\n onScroll: onScrollCallback, useIsScrolling = false, useOffsets = true, innerRender, outerRender } = props;\n\n const outerRef = React.useRef<HTMLDivElement>(null);\n const { totalOffset: currentVerticalOffset, renderSize: renderRowSize, onScroll: onScrollRow,\n doScrollTo: doScrollToRow, getCurrentOffset: getVerticalOffset } = useVirtualScroll(scrollHeight, props.maxCssSize, props.minNumPages, useOffsets);\n const { totalOffset: currentHorizontalOffset, renderSize: renderColumnSize, onScroll: onScrollColumn,\n doScrollTo: doScrollToColumn, getCurrentOffset: getHorizontalOffset} = useVirtualScroll(scrollWidth, props.maxCssSize, props.minNumPages, useOffsets);\n const isActuallyScrolling = useIsScrollingHook(outerRef);\n\n React.useImperativeHandle(ref, () => {\n return {\n scrollTo(rowOffset?: number, columnOffset?: number): void {\n if (rowOffset === undefined && columnOffset === undefined)\n return;\n\n const outer = outerRef.current;\n /* istanbul ignore else */\n if (outer) {\n const options: ScrollToOptions = {};\n if (rowOffset != undefined)\n options.top = doScrollToRow(rowOffset, outer.clientHeight);\n if (columnOffset != undefined)\n options.left = doScrollToColumn(columnOffset, outer.clientWidth);\n outer.scrollTo(options);\n }\n },\n\n scrollToArea(verticalOffset?: number, verticalSize?: number, horizontalOffset?: number, horizontalSize?: number, option?: ScrollToOption) {\n const outer = outerRef.current;\n /* istanbul ignore if*/\n if (!outer)\n return;\n\n const rowOffset = getOffsetToScrollRange(verticalOffset, verticalSize, outer.clientHeight, currentVerticalOffset, option);\n const colOffset = getOffsetToScrollRange(horizontalOffset, horizontalSize, outer.clientWidth, currentHorizontalOffset, option);\n this.scrollTo(rowOffset, colOffset);\n },\n\n get clientWidth(): number {\n return outerRef.current ? outerRef.current.clientWidth : /* istanbul ignore next */ 0;\n },\n\n get clientHeight(): number {\n return outerRef.current ? outerRef.current.clientHeight : /* istanbul ignore next */ 0;\n },\n\n get verticalOffset(): number { return getVerticalOffset(); },\n\n get horizontalOffset(): number { return getHorizontalOffset(); }\n }\n }, [ doScrollToRow, doScrollToColumn, currentVerticalOffset, currentHorizontalOffset, getVerticalOffset, getHorizontalOffset ]);\n\n function onScroll(event: ScrollEvent) {\n const { clientWidth, clientHeight, scrollWidth, scrollHeight, scrollLeft, scrollTop } = event.currentTarget;\n const [newScrollTop, newRowScrollState] = onScrollRow(clientHeight, scrollHeight, scrollTop);\n const [newScrollLeft, newColumnScrollState] = onScrollColumn(clientWidth, scrollWidth, scrollLeft);\n if (outerRef.current && (newScrollTop != scrollTop || newScrollLeft != scrollLeft ))\n outerRef.current.scrollTo(newScrollLeft, newScrollTop);\n onScrollCallback?.(newRowScrollState.scrollOffset+newRowScrollState.renderOffset, \n newColumnScrollState.scrollOffset+newColumnScrollState.renderOffset, newRowScrollState, newColumnScrollState);\n }\n\n const isScrolling = useIsScrolling ? isActuallyScrolling : undefined;\n const verticalOffset = currentVerticalOffset;\n const horizontalOffset = currentHorizontalOffset;\n\n return (\n <VirtualContainer className={className} render={outerRender} onScroll={onScroll} ref={outerRef} \n style={{ position: \"relative\", height, width, overflow: \"auto\", willChange: \"transform\" }}>\n <VirtualContainer className={innerClassName} render={innerRender} \n style={{ zIndex: 1, position: 'sticky', top: 0, left: 0, width: '100%', height: '100%' }}>\n {children({isScrolling, verticalOffset, horizontalOffset})}\n </VirtualContainer>\n <div style={{ position: 'absolute', top: 0, left: 0, \n height: scrollHeight ? renderRowSize : '100%', \n width: scrollWidth ? renderColumnSize : '100%'}}/>\n </VirtualContainer>\n );\n});\n\nexport default VirtualScroll;\n","import type { ItemOffsetMapping } from \"@candidstartup/infinisheet-types\";\n\ntype RangeToRender = [\n startIndex: number,\n startOffset: number,\n totalSize: number,\n sizes: number[]\n];\n\nexport function getRangeToRender(itemCount: number, itemOffsetMapping: ItemOffsetMapping, clientExtent: number, scrollOffset: number): RangeToRender {\n if (itemCount == 0) {\n return [0, 0, 0, []];\n }\n\n // Negative offset equivalent to reducing the size of the window (possibly down to nothing)\n if (scrollOffset < 0) {\n clientExtent += scrollOffset;\n scrollOffset = 0;\n }\n\n if (clientExtent <= 0) {\n return [0, 0, 0, []];\n }\n\n const [baseIndex, startOffset] = itemOffsetMapping.offsetToItem(scrollOffset);\n if (baseIndex >= itemCount) {\n return [0, 0, 0, []];\n }\n\n let itemIndex = Math.max(0, Math.min(itemCount - 1, baseIndex));\n const endOffset = scrollOffset + clientExtent;\n\n const startIndex = itemIndex;\n let offset = startOffset;\n const sizes: number[] = [];\n let totalSize = 0;\n\n while (offset < endOffset && itemIndex < itemCount) {\n const size = itemOffsetMapping.itemSize(itemIndex);\n sizes.push(size);\n totalSize += size;\n offset += size;\n itemIndex ++;\n }\n\n return [startIndex, startOffset, totalSize, sizes];\n}\n\nfunction formatRepeat(repeat: number, size: number): string {\n return (repeat == 1) ? `${size}px` : `repeat(${repeat},${size}px)`;\n}\n\nfunction join(a: string|undefined, s: string) {\n return a ? a + ' ' + s : s;\n}\n\nexport function getGridTemplate(sizes: number[]): string | undefined {\n const count = sizes.length;\n if (count == 0)\n return undefined;\n\n let ret = undefined;\n let lastSize = sizes[0];\n let repeat = 1;\n\n for (let i = 1; i < count; i ++) {\n const size = sizes[i];\n if (size == lastSize) {\n repeat ++;\n } else {\n const s = formatRepeat(repeat, lastSize);\n ret = join(ret,s);\n lastSize = size;\n repeat = 1;\n }\n }\n\n const s = formatRepeat(repeat, lastSize);\n return join(ret,s);\n}\n\n\n","import React from \"react\";\nimport type { ItemOffsetMapping } from \"@candidstartup/infinisheet-types\";\nimport { ScrollLayout, DisplayBaseItemProps, DisplayBaseProps } from './VirtualBase';\nimport { getRangeToRender, getGridTemplate } from './VirtualCommon';\nimport { VirtualContainer } from './VirtualContainer';\n\n/**\n * Props accepted by {@link DisplayListItem}\n */\nexport interface DisplayListItemProps extends DisplayBaseItemProps {\n /** Index of item in the list being rendered */\n index: number,\n}\n\n/**\n * Type of item in a {@link DisplayList}\n *\n * Must be passed as a child to {@link DisplayList}. \n * Accepts props defined by {@link DisplayListItemProps}.\n * Component must pass {@link DisplayBaseItemProps.style} to whatever it renders. \n * \n * @example Basic implementation\n * ```\n * const Row = ({ index, style }: { index: number, style: React.CSSProperties }) => (\n * <div className=\"row\" style={style}>\n * { index }\n * </div>\n * );\n * ```\n */\nexport type DisplayListItem = React.ComponentType<DisplayListItemProps>;\n\n/**\n * Props accepted by {@link DisplayList}\n */\nexport interface DisplayListProps extends DisplayBaseProps {\n /** Component used as a template to render items in the list. Must implement {@link DisplayListItem} interface. */\n children: DisplayListItem,\n\n /** Number of items in the list */\n itemCount: number,\n\n /** Offset to start of displayed content */\n offset: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each item in the list\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n itemOffsetMapping: ItemOffsetMapping,\n\n /**\n * Function that defines the key to use for each item given item index and value of {@link DisplayBaseProps.itemData}.\n * @defaultValue `(index, _data) => index`\n */\n itemKey?: (index: number, data: unknown) => React.Key,\n\n /**\n * Choice of 'vertical' or 'horizontal' layouts\n * @defaultValue 'vertical'\n */\n layout?: ScrollLayout,\n}\n\nconst defaultItemKey = (index: number, _data: unknown) => index;\n\nconst boxStyle: React.CSSProperties = { boxSizing: 'border-box' };\n\n/**\n * Displays a window onto the contents of a virtualized list starting from `offset`.\n * \n * Accepts props defined by {@link DisplayListProps}. \n * You must pass a single instance of {@link DisplayListItem} as a child.\n * @group Components\n */\nexport function DisplayList(props: DisplayListProps) {\n const { width, height, itemCount, itemOffsetMapping, className, innerClassName, offset: renderOffset, children,\n itemData, itemKey = defaultItemKey, layout = 'vertical', outerRender, innerRender, isScrolling } = props;\n\n const isVertical = layout === 'vertical';\n\n const [startIndex, startOffset, renderSize, sizes] = getRangeToRender(itemCount, itemOffsetMapping, \n isVertical ? height : width, renderOffset);\n const template = getGridTemplate(sizes);\n const offset = startOffset - renderOffset;\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do.\n const ChildVar = children;\n\n return (\n <VirtualContainer className={className} render={outerRender}\n style={{ position: \"relative\", height, width, overflow: \"hidden\", willChange: \"transform\" }}>\n <VirtualContainer className={innerClassName} render={innerRender}\n style={{ position: 'absolute',\n display: 'grid',\n gridTemplateColumns: isVertical ? undefined : template,\n gridTemplateRows: isVertical ? template : undefined,\n top: isVertical ? offset : 0, \n left: isVertical ? 0 : offset, \n height: isVertical ? renderSize : \"100%\", \n width: isVertical ? \"100%\" : renderSize }}>\n {sizes.map((_size, arrayIndex) => (\n <ChildVar data={itemData} isScrolling={isScrolling} \n key={itemKey(startIndex + arrayIndex, itemData)} index={startIndex + arrayIndex} style={boxStyle}/>\n ))}\n </VirtualContainer>\n </VirtualContainer>\n );\n}\n\nexport default DisplayList;\n","import React, { Fragment } from \"react\";\nimport type { ItemOffsetMapping } from \"@candidstartup/infinisheet-types\";\nimport { DisplayBaseItemProps, DisplayBaseProps } from './VirtualBase';\nimport { getRangeToRender, getGridTemplate } from './VirtualCommon';\nimport { VirtualContainer } from './VirtualContainer';\n\n/**\n * Props accepted by {@link DisplayGridItem}\n */\nexport interface DisplayGridItemProps extends DisplayBaseItemProps {\n /** Row index of item in the grid being rendered */\n rowIndex: number,\n\n /** Column index of item in the grid being rendered */\n columnIndex: number,\n}\n\n/**\n * Type of item in a {@link DisplayGrid}\n *\n * Must be passed as a child to {@link DisplayGrid}. \n * Accepts props defined by {@link DisplayGridItemProps}.\n * Component must pass {@link DisplayBaseItemProps.style} to whatever it renders. \n * \n * @example Basic implementation\n * ```\n * const Row = ({ index, style }: { index: number, style: React.CSSProperties }) => (\n * <div className=\"row\" style={style}>\n * { index }\n * </div>\n * );\n * ```\n */\nexport type DisplayGridItem = React.ComponentType<DisplayGridItemProps>;\n\n/**\n * Props accepted by {@link DisplayGrid}\n */\nexport interface DisplayGridProps extends DisplayBaseProps {\n /** Component used as a template to render items in the list. Must implement {@link DisplayGridItem} interface. */\n children: DisplayGridItem,\n\n /** Number of rows in the grid */\n rowCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each row in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n rowOffsetMapping: ItemOffsetMapping,\n\n /** Number of columns in the grid */\n columnCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each column in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n columnOffsetMapping: ItemOffsetMapping,\n\n /** Vertical offset to start of displayed content */\n rowOffset: number,\n\n /** Horizontal offset to start of displayed content */\n columnOffset: number,\n\n /**\n * Function that defines the key to use for each item given row and column index and value of {@link DisplayBaseProps.itemData}.\n * @defaultValue `(rowIndex, columnIndex, _data) => '${rowIndex}:${columnIndex}'`\n */\n itemKey?: (rowIndex: number, columnIndex: number, data: unknown) => React.Key,\n}\n\nconst defaultItemKey = (rowIndex: number, columnIndex: number, _data: unknown) => `${rowIndex}:${columnIndex}`;\n\nconst boxStyle: React.CSSProperties = { boxSizing: 'border-box' };\n\n/**\n * Displays a window onto the contents of a virtualized grid starting from `rowOffset`, `columnOffset`.\n * \n * Accepts props defined by {@link DisplayGridProps}. \n * You must pass a single instance of {@link DisplayGridItem} as a child.\n * @group Components\n */\nexport function DisplayGrid(props: DisplayGridProps) {\n const { width, height, rowCount, rowOffsetMapping, columnCount, columnOffsetMapping, className, innerClassName, \n rowOffset: rowRenderOffset, columnOffset: colRenderOffset, children,\n itemData, itemKey = defaultItemKey, outerRender, innerRender, isScrolling } = props;\n\n const [rowStartIndex, rowStartOffset, rowRenderSize, rowSizes] = getRangeToRender(rowCount, rowOffsetMapping, height, rowRenderOffset);\n const rowTemplate = getGridTemplate(rowSizes);\n\n const [colStartIndex, colStartOffset, colRenderSize, colSizes] = getRangeToRender(columnCount, columnOffsetMapping, width, colRenderOffset);\n const colTemplate = getGridTemplate(colSizes);\n\n const rowOffset = rowStartOffset - rowRenderOffset;\n const colOffset = colStartOffset - colRenderOffset;\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do.\n const ChildVar = children;\n\n return (\n <VirtualContainer className={className} render={outerRender}\n style={{ position: \"relative\", height, width, overflow: \"hidden\", willChange: \"transform\" }}>\n <VirtualContainer className={innerClassName} render={innerRender}\n style={{ position: 'absolute',\n display: 'grid',\n gridTemplateColumns: colTemplate,\n gridTemplateRows: rowTemplate,\n top: rowOffset, \n left: colOffset, \n height: rowRenderSize, \n width: colRenderSize }}>\n {rowSizes.map((_rowSize, rowIndex) => (\n <Fragment key={itemKey(rowStartIndex + rowIndex, 0, itemData)}>\n {colSizes.map((_size, colIndex) => (\n <ChildVar data={itemData} isScrolling={isScrolling} \n key={itemKey(rowStartIndex + rowIndex, colStartIndex + colIndex, itemData)} \n rowIndex={rowStartIndex + rowIndex} columnIndex={colStartIndex + colIndex} style={boxStyle}/>\n ))}\n </Fragment>\n ))}\n </VirtualContainer>\n </VirtualContainer>\n );\n}\n\nexport default DisplayGrid;\n","import type { ItemOffsetMapping } from \"@candidstartup/infinisheet-types\";\nimport { ScrollToOption } from './VirtualBase';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\n\n/**\n * Custom ref handle returned by {@link VirtualGrid} that exposes imperative methods\n * \n * Use `React.useRef<VirtualGridProxy>(null)` to create a ref.\n */\nexport interface VirtualGridProxy {\n /**\n * Scrolls the list to the specified row and column in pixels\n */\n scrollTo(rowOffset?: number, columnOffset?: number): void;\n\n /**\n * Scrolls the list so that the specified item is visible\n * @param rowIndex - Row of item to scroll to\n * @param columnIndex - Column of item to scroll to\n * @param option - Where to {@link ScrollToOption | position} the item within the viewport\n */\n scrollToItem(rowIndex?: number, columnIndex?: number, option?: ScrollToOption): void;\n\n /** Exposes DOM clientWidth property */\n get clientWidth(): number;\n\n /** Exposes DOM clientHeight property */\n get clientHeight(): number;\n\n /** Current vertical position of scroll bar */\n get verticalOffset(): number;\n\n /** Current horizontal position of scroll bar */\n get horizontalOffset(): number;\n}\n\n/** Range to scroll to in one dimension specified as (offset,size). May be undefined if no need to scroll. */\nexport type ScrollRange = [ offset: number|undefined, size: number|undefined ];\n\n/**\n * Returns the {@link ScrollRange} corresponding to a specified item.\n * \n * Used internally to implement {@link VirtualGridProxy.scrollToItem}. Can be used directly for \n * advanced customization scenarios.\n */\nexport function getRangeToScroll(index: number | undefined, mapping: ItemOffsetMapping): ScrollRange {\n if (index === undefined)\n return [undefined, undefined];\n\n return [mapping.itemOffset(index), mapping.itemSize(index)];\n}\n\n/**\n * Same logic as {@link VirtualGridProxy.scrollToItem} usable with your own {@link VirtualScroll}\n * \n * You're encouraged to put together your own combination of {@link VirtualScroll} and {@link DisplayGrid} for\n * advanced customization scenarios. This function provides `ScrollToItem` functionality for use with your own {@link VirtualScroll}.\n */\nexport function virtualGridScrollToItem(scrollRef: React.RefObject<VirtualScrollProxy>, rowOffsetMapping: ItemOffsetMapping, \n columnOffsetMapping: ItemOffsetMapping, rowIndex?: number, columnIndex?: number, option?: ScrollToOption) {\n\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return;\n\n const [rowOffset, rowSize] = getRangeToScroll(rowIndex, rowOffsetMapping);\n const [colOffset, colSize] = getRangeToScroll(columnIndex, columnOffsetMapping);\n\n scroll.scrollToArea(rowOffset, rowSize, colOffset, colSize, option);\n}\n","import React from \"react\";\nimport type { ItemOffsetMapping } from \"@candidstartup/infinisheet-types\";\nimport { VirtualBaseProps, ScrollToOption } from './VirtualBase';\nimport { DisplayGrid, DisplayGridItem } from './DisplayGrid';\nimport { VirtualContainerRender } from './VirtualContainer';\nimport { VirtualScroll } from './VirtualScroll';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\nimport { virtualGridScrollToItem, VirtualGridProxy } from './VirtualGridProxy';\nimport { AutoSizer } from './AutoSizer';\nimport { ScrollState } from './useVirtualScroll';\n\n/**\n * Props accepted by {@link VirtualGrid}\n */\nexport interface VirtualGridProps extends VirtualBaseProps {\n /** Component used as a template to render items in the grid. Must implement {@link DisplayGridItem} interface. */\n children: DisplayGridItem,\n\n /** Number of rows in the grid */\n rowCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each row in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n rowOffsetMapping: ItemOffsetMapping,\n\n /** Number of columns in the grid */\n columnCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each column in the grid\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n columnOffsetMapping: ItemOffsetMapping,\n\n /**\n * Function that defines the key to use for each item given row and column index and value of {@link VirtualBaseProps.itemData}.\n * @defaultValue `(rowIndex, columnIndex, _data) => '${rowIndex}:${columnIndex}'`\n */\n itemKey?: (rowIndex: number, columnIndex: number, data: unknown) => React.Key,\n\n /**\n * Callback after a scroll event has been processed and state updated but before rendering\n * @param rowOffset - Resulting overall row offset. Can be passed to {@link ItemOffsetMapping} to determine first row.\n * @param columnOffset - Resulting overall column offset. Can be passed to {@link ItemOffsetMapping} to determine first column.\n * @param newRowScrollState - New {@link ScrollState} for rows that will be used for rendering.\n * @param newColumnScrollState - New {@link ScrollState} for columns that will be used for rendering.\n */\n onScroll?: (rowOffset: number, columnOffset: number, newRowScrollState: ScrollState, newColumnScrollState: ScrollState) => void;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualGrid} outer container. */\n outerRender?: VirtualContainerRender;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link DisplayGrid} within {@link VirtualGrid} inner container. */\n innerRender?: VirtualContainerRender;\n}\n\n// Using a named function rather than => so that the name shows up in React Developer Tools\n/**\n * Virtual Scrolling Grid\n * \n * Accepts props defined by {@link VirtualGridProps}. \n * Refs are forwarded to {@link VirtualGridProxy}. \n * You must pass a single instance of {@link DisplayGridItem} as a child.\n * @group Components\n */\nexport const VirtualGrid = React.forwardRef<VirtualGridProxy, VirtualGridProps>(function VirtualGrid(props, ref) {\n const { rowCount, rowOffsetMapping, columnCount, columnOffsetMapping, children, \n innerClassName, innerRender, itemData, itemKey, onScroll: onScrollCallback, ...scrollProps } = props;\n\n // Total size is same as offset to item one off the end\n const totalRowSize = rowOffsetMapping.itemOffset(rowCount);\n const totalColumnSize = columnOffsetMapping.itemOffset(columnCount);\n\n const scrollRef = React.useRef<VirtualScrollProxy>(null);\n\n\n React.useImperativeHandle(ref, () => {\n return {\n scrollTo(rowOffset?: number, columnOffset?: number): void {\n const scroll = scrollRef.current;\n /* istanbul ignore else */\n if (scroll)\n scroll.scrollTo(rowOffset, columnOffset);\n },\n\n scrollToItem(rowIndex?: number, columnIndex?: number, option?: ScrollToOption): void {\n virtualGridScrollToItem(scrollRef, rowOffsetMapping, columnOffsetMapping, rowIndex, columnIndex, option);\n },\n\n get clientWidth(): number {\n return scrollRef.current ? scrollRef.current.clientWidth : /* istanbul ignore next */ 0;\n },\n\n get clientHeight(): number {\n return scrollRef.current ? scrollRef.current.clientHeight : /* istanbul ignore next */ 0;\n },\n\n get verticalOffset(): number {\n return scrollRef.current ? scrollRef.current.verticalOffset : /* istanbul ignore next */ 0;\n },\n\n get horizontalOffset(): number {\n return scrollRef.current ? scrollRef.current.horizontalOffset : /* istanbul ignore next */ 0;\n }\n }\n }, [ rowOffsetMapping, columnOffsetMapping ]);\n\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do. \n const ChildVar = children;\n\n return (\n <VirtualScroll\n ref={scrollRef}\n {...scrollProps}\n scrollHeight={totalRowSize}\n scrollWidth={totalColumnSize}\n onScroll={(verticalOffset, horizontalOffset, verticalScrollState, horizontalScrollState) => {\n if (onScrollCallback)\n onScrollCallback(verticalOffset, horizontalOffset, verticalScrollState, horizontalScrollState);\n }}>\n {({ isScrolling, verticalOffset, horizontalOffset }) => (\n <AutoSizer style={{ height: '100%', width: '100%' }}>\n {({height,width}) => (\n <DisplayGrid\n innerClassName={innerClassName}\n innerRender={innerRender}\n rowOffset={verticalOffset}\n columnOffset={horizontalOffset}\n height={height}\n rowCount={rowCount}\n columnCount={columnCount}\n itemData={itemData}\n itemKey={itemKey}\n isScrolling={isScrolling}\n rowOffsetMapping={rowOffsetMapping}\n columnOffsetMapping={columnOffsetMapping}\n width={width}>\n {ChildVar}\n </DisplayGrid>\n )}\n </AutoSizer>\n )}\n </VirtualScroll>\n );\n});\n\nexport default VirtualGrid;\n","import type { ItemOffsetMapping } from \"@candidstartup/infinisheet-types\";\nimport { ScrollToOption } from './VirtualBase';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\n\n/**\n * Custom ref handle returned by {@link VirtualList} that exposes imperative methods\n * \n * Use `React.useRef<VirtualListProxy>(null)` to create a ref.\n */\nexport interface VirtualListProxy {\n /**\n * Scrolls the list to the specified offset in pixels\n * @param offset - Offset to scroll to\n */\n scrollTo(offset: number): void;\n\n /**\n * Scrolls the list so that the specified item is visible\n * @param index - Index of item to scroll to\n * @param option - Where to {@link ScrollToOption | position} the item within the viewport\n */\n scrollToItem(index: number, option?: ScrollToOption): void;\n\n /** Current scroll position */\n get offset(): number;\n}\n\n/**\n * Same logic as {@link VirtualListProxy.scrollToItem} usable with your own {@link VirtualScroll}\n * \n * You're encouraged to put together your own combination of {@link VirtualScroll} and {@link DisplayList} for\n * advanced customization scenarios. This function provides `ScrollToItem` functionality for use with your own {@link VirtualScroll}.\n */\nexport function virtualListScrollToItem(scrollRef: React.RefObject<VirtualScrollProxy>, itemOffsetMapping: ItemOffsetMapping, isVertical: boolean,\n index: number, option?: ScrollToOption) {\n\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return;\n\n const itemOffset = itemOffsetMapping.itemOffset(index);\n const itemSize = itemOffsetMapping.itemSize(index);\n\n if (isVertical)\n scroll.scrollToArea(itemOffset, itemSize, undefined, undefined, option);\n else\n scroll.scrollToArea(undefined, undefined, itemOffset, itemSize, option);\n}","import React from \"react\";\nimport type { ItemOffsetMapping } from \"@candidstartup/infinisheet-types\";\nimport { VirtualBaseProps, ScrollToOption, ScrollLayout } from './VirtualBase';\nimport { DisplayList, DisplayListItem } from './DisplayList';\nimport { VirtualContainerRender } from './VirtualContainer';\nimport { VirtualScroll } from './VirtualScroll';\nimport { VirtualScrollProxy } from './VirtualScrollProxy';\nimport { virtualListScrollToItem, VirtualListProxy } from './VirtualListProxy';\nimport { AutoSizer } from './AutoSizer';\nimport { ScrollState } from './useVirtualScroll';\n\n/**\n * Props accepted by {@link VirtualList}\n */\nexport interface VirtualListProps extends VirtualBaseProps {\n /** Component used as a template to render items in the list. Must implement {@link DisplayListItem} interface. */\n children: DisplayListItem,\n\n /** Number of items in the list */\n itemCount: number,\n\n /** \n * Implementation of {@link ItemOffsetMapping} interface that defines size and offset to each item in the list\n * \n * Use {@link useFixedSizeItemOffsetMapping} or {@link useVariableSizeItemOffsetMapping} to create implementations\n * for common cases.\n */\n itemOffsetMapping: ItemOffsetMapping,\n\n /**\n * Function that defines the key to use for each item given item index and value of {@link VirtualBaseProps.itemData}.\n * @defaultValue `(index, _data) => index`\n */\n itemKey?: (index: number, data: unknown) => React.Key,\n\n /**\n * Choice of 'vertical' or 'horizontal' layouts\n * @defaultValue 'vertical'\n */\n layout?: ScrollLayout,\n\n /**\n * Callback after a scroll event has been processed and state updated but before rendering\n * @param offset - Resulting overall offset. Can be passed to {@link ItemOffsetMapping} to determine top item.\n * @param newScrollState - New {@link ScrollState} that will be used for rendering.\n */\n onScroll?: (offset: number, newScrollState: ScrollState) => void;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link VirtualList} outer container. */\n outerRender?: VirtualContainerRender;\n\n /** Render prop implementing {@link VirtualContainerRender}. Used to customize {@link DisplayList} within {@link VirtualList} inner container. */\n innerRender?: VirtualContainerRender;\n}\n\n\n\n// Using a named function rather than => so that the name shows up in React Developer Tools\n/**\n * Virtual Scrolling List\n * \n * Accepts props defined by {@link VirtualListProps}. \n * Refs are forwarded to {@link VirtualListProxy}. \n * You must pass a single instance of {@link DisplayListItem} as a child.\n * @group Components\n */\nexport const VirtualList = React.forwardRef<VirtualListProxy, VirtualListProps>(function VirtualList(props, ref) {\n const { itemCount, itemOffsetMapping, children, layout = 'vertical', onScroll: onScrollCallback,\n innerClassName, innerRender, itemData, itemKey, ...scrollProps } = props;\n\n // Total size is same as offset to item one off the end\n const renderSize = itemOffsetMapping.itemOffset(itemCount);\n\n const scrollRef = React.useRef<VirtualScrollProxy>(null);\n const isVertical = layout === 'vertical';\n\n React.useImperativeHandle(ref, () => {\n return {\n scrollTo(offset: number): void {\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return;\n\n if (isVertical)\n scroll.scrollTo(offset, undefined);\n else\n scroll.scrollTo(undefined, offset);\n },\n\n scrollToItem(index: number, option?: ScrollToOption): void {\n virtualListScrollToItem(scrollRef, itemOffsetMapping, isVertical, index, option);\n },\n\n get offset(): number {\n const scroll = scrollRef.current;\n /* istanbul ignore if */\n if (!scroll)\n return 0;\n\n return isVertical ? scroll.verticalOffset : scroll.horizontalOffset;\n }\n }\n }, [ itemOffsetMapping, isVertical ]);\n\n // We can decide the JSX child type at runtime as long as we use a variable that uses the same capitalized\n // naming convention as components do.\n const ChildVar = children;\n\n return (\n <VirtualScroll\n ref={scrollRef}\n {...scrollProps}\n scrollHeight={isVertical ? renderSize : undefined}\n scrollWidth={isVertical ? undefined : renderSize}\n onScroll={(verticalOffset, horizontalOffset, verticalScrollState, horizontalScrollState) => {\n const newOffset = isVertical ? verticalOffset : horizontalOffset;\n if (onScrollCallback)\n onScrollCallback(newOffset, isVertical ? verticalScrollState : horizontalScrollState);\n }}>\n {({ isScrolling, verticalOffset, horizontalOffset }) => (\n <AutoSizer style={{ height: '100%', width: '100%' }}>\n {({height,width}) => (\n <DisplayList\n innerClassName={innerClassName}\n innerRender={innerRender}\n layout={layout}\n offset={isVertical ? verticalOffset : horizontalOffset}\n height={height}\n itemCount={itemCount}\n itemData={itemData}\n itemKey={itemKey}\n isScrolling={isScrolling}\n itemOffsetMapping={itemOffsetMapping}\n width={width}>\n {ChildVar}\n </DisplayList>\n )}\n </AutoSizer>\n )}\n </VirtualScroll>\n );\n});\n\nexport default VirtualList;\n","import { ItemOffsetMapping, FixedSizeItemOffsetMapping } from '@candidstartup/infinisheet-types';\nexport type { ItemOffsetMapping } from '@candidstartup/infinisheet-types';\n\n/**\n * Returns an instance of {@link ItemOffsetMapping} suitable for use when all items have a fixed size.\n * \n * @param itemSize - Size to use for all items\n */\nexport function useFixedSizeItemOffsetMapping(itemSize: number): ItemOffsetMapping {\n return new FixedSizeItemOffsetMapping(itemSize);\n}\n\nexport default useFixedSizeItemOffsetMapping;\n","import { ItemOffsetMapping, VariableSizeItemOffsetMapping } from '@candidstartup/infinisheet-types';\nexport type { ItemOffsetMapping } from '@candidstartup/infinisheet-types';\n\n/**\n * Returns an instance of {@link ItemOffsetMapping}\n * suitable for use when initial items have variable sizes.\n * \n * @param defaultItemSize - Size to use for all other items\n * @param sizes - Array of sizes to use for the initial items, one size per item\n */\nexport function useVariableSizeItemOffsetMapping(defaultItemSize: number, sizes?: number[]): ItemOffsetMapping {\n return new VariableSizeItemOffsetMapping(defaultItemSize, sizes || []);\n}\n\nexport default useVariableSizeItemOffsetMapping;\n"],"names":["_jsx","useIsScrolling","useIsScrollingHook","_jsxs","defaultItemKey","boxStyle"],"mappings":";;;;AAiCA,MAAM,sBAAsB,GAA2B,CAAC,EAAC,GAAG,IAAI,EAAC,EAAE,GAAG,MACpEA,aAAK,GAAG,EAAE,GAAG,EAAM,GAAA,IAAI,EAAI,CAAA,CAC5B;AAED;;;;;AAKG;MACU,gBAAgB,GAAG,KAAK,CAAC,UAAU,CAC9C,SAAS,gBAAgB,CAAC,EAAC,MAAM,GAAG,sBAAsB,EAAE,GAAG,IAAI,EAAC,EAAE,GAAG,EAAA;AACvE,IAAA,OAAO,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;AAC5B,CAAC;;ACJD;;;;;;;;AAQG;AACG,SAAU,SAAS,CAAC,KAAqB,EAAA;IAC7C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK;;;AAI5C,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,CAAC,CAAC;AACnD,IAAA,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC;;;IAI9C,MAAM,cAAc,GAA2B,KAAK,CAAC,WAAW,CAAC,CAAC,OAAO,KAAI;AAC3E,QAAA,OAAO,CAAC,OAAO,CAAC,KAAK,IAAG;;;;AAItB,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;YAC/D,QAAQ,CAAC,QAAQ,CAAC;AAClB,YAAA,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC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5
  "description": "Modern React components for lists and grids that scale to trillions of rows and columns",
6
6
  "author": "Tim Wiegand <tim.wiegand@thecandidstartup.org>",
7
7
  "license": "BSD-3-Clause",
@@ -26,7 +26,8 @@
26
26
  "table",
27
27
  "grid",
28
28
  "modern",
29
- "scalable"
29
+ "scalable",
30
+ "infinisheet"
30
31
  ],
31
32
  "publishConfig": {
32
33
  "access": "public"
@@ -47,6 +48,7 @@
47
48
  "dev": "vite",
48
49
  "clean": "rimraf {dist,temp}",
49
50
  "prebuild": "npm run clean",
51
+ "typecheck": "tsc -p tsconfig.json",
50
52
  "build-tsc": "tsc -p tsconfig.build.json",
51
53
  "build-rollup": "rollup -c ../rollup.config.mjs",
52
54
  "build": "npm run build-rollup",
@@ -59,5 +61,8 @@
59
61
  "peerDependencies": {
60
62
  "react": "^18.2.0"
61
63
  },
62
- "gitHead": "027eed267de01935b29d1ac378e54840b045d7a5"
64
+ "dependencies": {
65
+ "@candidstartup/infinisheet-types": "^0.7.1"
66
+ },
67
+ "gitHead": "4562f19bca50106d58aba0c76abe7d09267e0c5d"
63
68
  }