@fluentui/react-virtualizer 9.0.0-alpha.112 → 9.0.0-alpha.113

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +14 -4
  2. package/lib/components/Virtualizer/useVirtualizer.js +10 -2
  3. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  4. package/lib/components/Virtualizer/useVirtualizerStyles.styles.js +8 -0
  5. package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -1
  6. package/lib/components/Virtualizer/useVirtualizerStyles.styles.raw.js +8 -0
  7. package/lib/components/Virtualizer/useVirtualizerStyles.styles.raw.js.map +1 -1
  8. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +2 -0
  9. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
  10. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +1 -0
  11. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -1
  12. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js +1 -0
  13. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js.map +1 -1
  14. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +7 -1
  15. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
  16. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +1 -0
  17. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -1
  18. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js +1 -0
  19. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js.map +1 -1
  20. package/lib/hooks/useDynamicPagination.js +3 -1
  21. package/lib/hooks/useDynamicPagination.js.map +1 -1
  22. package/lib/hooks/useIntersectionObserver.js +2 -0
  23. package/lib/hooks/useIntersectionObserver.js.map +1 -1
  24. package/lib/hooks/useMeasureList.js +1 -0
  25. package/lib/hooks/useMeasureList.js.map +1 -1
  26. package/lib/hooks/useMutationObserver.js +1 -0
  27. package/lib/hooks/useMutationObserver.js.map +1 -1
  28. package/lib/hooks/useResizeObserverRef.js +2 -0
  29. package/lib/hooks/useResizeObserverRef.js.map +1 -1
  30. package/lib/hooks/useStaticPagination.js +3 -1
  31. package/lib/hooks/useStaticPagination.js.map +1 -1
  32. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +10 -2
  33. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
  34. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js +8 -0
  35. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -1
  36. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.raw.js +8 -0
  37. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.raw.js.map +1 -1
  38. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +2 -0
  39. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
  40. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +1 -0
  41. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -1
  42. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js +1 -0
  43. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js.map +1 -1
  44. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +5 -0
  45. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
  46. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +1 -0
  47. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -1
  48. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js +1 -0
  49. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js.map +1 -1
  50. package/lib-commonjs/hooks/useDynamicPagination.js +3 -1
  51. package/lib-commonjs/hooks/useDynamicPagination.js.map +1 -1
  52. package/lib-commonjs/hooks/useIntersectionObserver.js +2 -0
  53. package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
  54. package/lib-commonjs/hooks/useMeasureList.js +1 -0
  55. package/lib-commonjs/hooks/useMeasureList.js.map +1 -1
  56. package/lib-commonjs/hooks/useMutationObserver.js +1 -0
  57. package/lib-commonjs/hooks/useMutationObserver.js.map +1 -1
  58. package/lib-commonjs/hooks/useResizeObserverRef.js +2 -0
  59. package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -1
  60. package/lib-commonjs/hooks/useStaticPagination.js +3 -1
  61. package/lib-commonjs/hooks/useStaticPagination.js.map +1 -1
  62. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\n updateScrollPosition,\n gap = 0,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n // We use this ref as a constant source to access the virtualizer's state imperatively\n const actualIndexRef = React.useRef<number>(_virtualizerContext.contextIndex);\n\n const flaggedIndex = React.useRef<number | null>(null);\n const actualIndex = _virtualizerContext.contextIndex;\n\n // Just in case our ref gets out of date vs the context during a re-render\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = React.useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\n\n // Store ref to before padding element\n const beforeElementRef = React.useRef<HTMLElement | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = React.useRef<HTMLElement | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = React.useRef<React.ReactNode[]>(new Array(virtualizerLength));\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n if (virtualizerContext?.childProgressiveSizes) {\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n }\n\n for (let index = 0; index < numItems; index++) {\n const _gap = index < numItems - 1 ? gap : 0;\n childSizes.current[index] = getItemSize(index) + _gap;\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const [isScrolling, setIsScrolling] = React.useState<boolean>(false);\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = React.useRef<number>(0);\n\n const initializeScrollingTimer = React.useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n setIsScrolling(false);\n clearScrollTimer();\n return;\n }\n /*\n * This can be considered the 'velocity' required to start 'isScrolling'\n * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling\n * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset\n * - Maybe we should let users customize these in the future.\n */\n const INIT_SCROLL_FLAG_REQ = 10;\n const INIT_SCROLL_FLAG_DELAY = 100;\n\n scrollCounter.current++;\n if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {\n setIsScrolling(true);\n }\n clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n React.useEffect(() => {\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\n\n const updateChildRows = React.useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n return;\n }\n\n /*\n We reset the array every time to ensure children are re-rendered\n This function should only be called when update is nessecary\n */\n childArray.current = new Array(virtualizerLength);\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = React.useCallback(\n (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const _gap = i < numItems - 1 ? gap : 0;\n const newSize = getItemSize(i) + _gap;\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n },\n [getItemSize, numItems, virtualizerLength, gap],\n );\n\n const batchUpdateNewIndex = React.useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = React.useCallback(\n (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n },\n [actualIndex],\n );\n\n const getIndexFromSizeArray = React.useCallback(\n (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n },\n [findIndexRecursive],\n );\n const getIndexFromScrollPosition = React.useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / (itemSize + gap));\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize, gap],\n );\n\n const calculateTotalSize = React.useCallback(() => {\n if (!getItemSize) {\n return (itemSize + gap) * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n }, [getItemSize, itemSize, numItems, gap]);\n\n const calculateBefore = React.useCallback(() => {\n const currentIndex = Math.min(actualIndex, numItems - 1);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * (itemSize + gap);\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, gap]);\n\n const calculateAfter = React.useCallback(() => {\n if (numItems === 0 || actualIndex + virtualizerLength >= numItems) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex;\n return remainingItems * (itemSize + gap) - gap;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, virtualizerLength, gap]);\n\n // We store the number of items since last render, we will allow an update if the number of items changes\n const previousNumItems = React.useRef<number>(numItems);\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n React.useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n if (entries.length === 0) {\n // No entries found, return.\n return;\n }\n // Find the latest entry that is intersecting\n const sortedEntries = entries.sort((entry1, entry2) => entry2.time - entry1.time);\n const latestEntry = sortedEntries.find(entry => {\n return entry.isIntersecting;\n });\n\n if (!latestEntry) {\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n flushSync(() => {\n // Callback to allow measure functions to check virtualizer length\n if (\n previousNumItems.current === numItems &&\n newStartIndex + virtualizerLength >= numItems &&\n actualIndex + virtualizerLength >= numItems\n ) {\n // We've already hit the end, no need to update state.\n return;\n }\n // We should ensure we update virtualizer calculations if the length changes\n previousNumItems.current = virtualizerLength;\n updateScrollPosition?.(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n actualIndex,\n virtualizerLength,\n axis,\n reversed,\n numItems,\n bufferSize,\n bufferItems,\n containerSizeRef,\n updateScrollPosition,\n batchUpdateNewIndex,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n getIndexFromScrollPosition,\n updateCurrentItemSizes,\n ],\n ),\n {\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const setBeforeRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n // Initialize the size array before first render.\n const hasInitialized = React.useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n React.useImperativeHandle(\n imperativeVirtualizerRef,\n () => {\n return {\n progressiveSizes: childProgressiveSizes,\n nodeSizes: childSizes,\n setFlaggedIndex: (index: number | null) => (flaggedIndex.current = index),\n currentIndex: actualIndexRef,\n };\n },\n [childProgressiveSizes, childSizes],\n );\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n React.useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /*\n * forceUpdate:\n * We only want to trigger this when child render or scroll loading changes,\n * it will force re-render all children elements\n */\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n React.useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\n\n React.useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize, gap]);\n\n // Effect to check flag index on updates\n React.useEffect(() => {\n if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {\n return;\n }\n if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {\n onRenderedFlaggedIndex(flaggedIndex.current);\n flaggedIndex.current = null;\n }\n }, [actualIndex, onRenderedFlaggedIndex, virtualizerLength]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n childSizes,\n childProgressiveSizes,\n };\n}\n"],"names":["React","useIntersectionObserver","useVirtualizerContextState_unstable","slot","useTimeout","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","updateScrollPosition","gap","_virtualizerContext","actualIndexRef","useRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","useCallback","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","_gap","isScrolling","setIsScrolling","useState","setScrollTimer","clearScrollTimer","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","useEffect","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","previousNumItems","setObserverList","entries","observer","sortedEntries","sort","entry1","entry2","time","latestEntry","find","entry","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","useImperativeHandle","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","useReducer","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"mappings":"AAAA;;;;;+BAagBM;;;;;;;iEAXO,QAAQ;yCAGS,sCAAsC;2BAC1B,kBAAkB;gCACrC,4BAA4B;0BACnC,YAAY;AAK/B,iCAAiCC,KAAuB;IAC7D;IAEA,MAAM,EACJC,QAAQ,EACRC,QAAQ,EACRC,iBAAiB,EACjBC,UAAUC,WAAW,EACrBC,WAAW,EACXC,cAAcC,KAAKC,KAAK,CAACN,oBAAoB,IAAI,EACjDO,aAAaF,KAAKG,KAAK,CAACJ,cAAc,OAAON,QAAQ,EACrDW,OAAO,UAAU,EACjBC,WAAW,KAAK,EAChBC,kBAAkB,EAClBC,sBAAsB,EACtBC,wBAAwB,EACxBC,gBAAgB,EAChBC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,MAAM,CAAC,EACR,GAAGrB;IAEJ,iHAAiH,GACjH,MAAMsB,0BAAsB3B,8CAAAA,EAAoCmB;IAEhE,sFAAsF;IACtF,MAAMS,iBAAiB9B,OAAM+B,MAAM,CAASF,oBAAoBG,YAAY;IAE5E,MAAMC,eAAejC,OAAM+B,MAAM,CAAgB;IACjD,MAAMG,cAAcL,oBAAoBG,YAAY;IAEpD,0EAA0E;IAC1E,IAAIH,oBAAoBG,YAAY,KAAKF,eAAeK,OAAO,EAAE;QAC/DL,eAAeK,OAAO,GAAGN,oBAAoBG,YAAY;IAC3D;IACA,MAAMI,iBAAiBpC,OAAMqC,WAAW,CACtC,CAACC;QACCR,eAAeK,OAAO,GAAGG;QACzBT,oBAAoBU,eAAe,CAACD;IACtC,GACA;QAACT;KAAoB;IAGvB,sCAAsC;IACtC,MAAMW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CAAC9I,MAAM4I,cAAc,EAAE;YAChDG,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAC,oBAAoBZ,qBAAqBxD,oBAAoB;QAC7DqE,mBAAmBb,qBAAqBtD,mBAAmB;QAC3DoE,wBAAwBd,qBAAqBzD,uBAAuB3E,oBAAoBF;QACxFqJ,uBAAuB3H;QACvBf;QACAF;QACAG;QACAsB;QACAE;IACF;AACF"}
1
+ {"version":3,"sources":["../src/components/Virtualizer/useVirtualizer.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { VirtualizerProps, VirtualizerState } from './Virtualizer.types';\n\nimport { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { slot, useTimeout } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState {\n 'use no memo';\n\n const {\n itemSize,\n numItems,\n virtualizerLength,\n children: renderChild,\n getItemSize,\n bufferItems = Math.round(virtualizerLength / 4.0),\n bufferSize = Math.floor(bufferItems / 2.0) * itemSize,\n axis = 'vertical',\n reversed = false,\n virtualizerContext,\n onRenderedFlaggedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n scrollViewRef,\n enableScrollLoad,\n updateScrollPosition,\n gap = 0,\n } = props;\n\n /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/\n const _virtualizerContext = useVirtualizerContextState_unstable(virtualizerContext);\n\n // We use this ref as a constant source to access the virtualizer's state imperatively\n const actualIndexRef = React.useRef<number>(_virtualizerContext.contextIndex);\n\n const flaggedIndex = React.useRef<number | null>(null);\n const actualIndex = _virtualizerContext.contextIndex;\n\n // Just in case our ref gets out of date vs the context during a re-render\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n if (_virtualizerContext.contextIndex !== actualIndexRef.current) {\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n actualIndexRef.current = _virtualizerContext.contextIndex;\n }\n const setActualIndex = React.useCallback(\n (index: number) => {\n actualIndexRef.current = index;\n _virtualizerContext.setContextIndex(index);\n },\n [_virtualizerContext],\n );\n\n // Store ref to before padding element\n const beforeElementRef = React.useRef<HTMLElement | null>(null);\n\n // Store ref to before padding element\n const afterElementRef = React.useRef<HTMLElement | null>(null);\n\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n\n /* We keep track of the progressive sizing/placement down the list,\n this helps us skip re-calculations unless children/size changes */\n const childProgressiveSizes = React.useRef<number[]>(new Array<number>(getItemSize ? numItems : 0));\n if (virtualizerContext?.childProgressiveSizes) {\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs -- deprecated package, not worth refactoring\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n\n // The internal tracking REF for child array (updates often).\n const childArray = React.useRef<React.ReactNode[]>(new Array(virtualizerLength));\n\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array<number>(numItems);\n }\n\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array<number>(numItems);\n if (virtualizerContext?.childProgressiveSizes) {\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n virtualizerContext.childProgressiveSizes.current = childProgressiveSizes.current;\n }\n }\n\n for (let index = 0; index < numItems; index++) {\n const _gap = index < numItems - 1 ? gap : 0;\n childSizes.current[index] = getItemSize(index) + _gap;\n if (index === 0) {\n childProgressiveSizes.current[index] = childSizes.current[index];\n } else {\n childProgressiveSizes.current[index] = childProgressiveSizes.current[index - 1] + childSizes.current[index];\n }\n }\n };\n\n const [isScrolling, setIsScrolling] = React.useState<boolean>(false);\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const scrollCounter = React.useRef<number>(0);\n\n const initializeScrollingTimer = React.useCallback(() => {\n if (!enableScrollLoad) {\n // Disabled by default for reduction of render callbacks\n setIsScrolling(false);\n clearScrollTimer();\n return;\n }\n /*\n * This can be considered the 'velocity' required to start 'isScrolling'\n * INIT_SCROLL_FLAG_REQ: Number of renders required to activate isScrolling\n * INIT_SCROLL_FLAG_DELAY: Amount of time (ms) before current number of renders is reset\n * - Maybe we should let users customize these in the future.\n */\n const INIT_SCROLL_FLAG_REQ = 10;\n const INIT_SCROLL_FLAG_DELAY = 100;\n\n scrollCounter.current++;\n if (scrollCounter.current >= INIT_SCROLL_FLAG_REQ) {\n setIsScrolling(true);\n }\n clearScrollTimer();\n setScrollTimer(() => {\n setIsScrolling(false);\n scrollCounter.current = 0;\n }, INIT_SCROLL_FLAG_DELAY);\n }, [clearScrollTimer, setScrollTimer, enableScrollLoad]);\n\n React.useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- deprecated package, not worth refactoring\n initializeScrollingTimer();\n }, [actualIndex, initializeScrollingTimer]);\n\n const updateChildRows = React.useCallback(\n (newIndex: number) => {\n if (numItems === 0) {\n /* Nothing to virtualize */\n return;\n }\n\n /*\n We reset the array every time to ensure children are re-rendered\n This function should only be called when update is nessecary\n */\n childArray.current = new Array(virtualizerLength);\n const _actualIndex = Math.max(newIndex, 0);\n const end = Math.min(_actualIndex + virtualizerLength, numItems);\n for (let i = _actualIndex; i < end; i++) {\n childArray.current[i - _actualIndex] = renderChild(i, isScrolling);\n }\n },\n [isScrolling, numItems, renderChild, virtualizerLength],\n );\n\n const updateCurrentItemSizes = React.useCallback(\n (newIndex: number) => {\n if (!getItemSize) {\n // Static sizes, not required.\n return;\n }\n // We should always call our size function on index change (only for the items that will be rendered)\n // This ensures we request the latest data for incoming items in case sizing has changed.\n const endIndex = Math.min(newIndex + virtualizerLength, numItems);\n const startIndex = Math.max(newIndex, 0);\n\n let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const _gap = i < numItems - 1 ? gap : 0;\n const newSize = getItemSize(i) + _gap;\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\n }\n }\n\n if (didUpdate) {\n // Update our progressive size array\n for (let i = startIndex; i < numItems; i++) {\n const prevSize = i > 0 ? childProgressiveSizes.current[i - 1] : 0;\n childProgressiveSizes.current[i] = prevSize + childSizes.current[i];\n }\n }\n },\n [getItemSize, numItems, virtualizerLength, gap],\n );\n\n const batchUpdateNewIndex = React.useCallback(\n (index: number) => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n\n // State setters\n setActualIndex(index);\n },\n [setActualIndex, updateChildRows, updateCurrentItemSizes],\n );\n\n const findIndexRecursive = React.useCallback(\n (scrollPos: number, lowIndex: number, highIndex: number): number => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return actualIndex;\n }\n const midpoint = Math.floor((lowIndex + highIndex) / 2);\n const iBefore = Math.max(midpoint - 1, 0);\n const iAfter = Math.min(midpoint + 1, childProgressiveSizes.current.length - 1);\n const indexValue = childProgressiveSizes.current[midpoint];\n const afterIndexValue = childProgressiveSizes.current[iAfter];\n const beforeIndexValue = childProgressiveSizes.current[iBefore];\n if (scrollPos <= afterIndexValue && scrollPos >= beforeIndexValue) {\n /* We've found our index - if we are exactly matching before/after index that's ok,\n better to reduce checks if it's right on the boundary. */\n return midpoint;\n }\n\n if (indexValue > scrollPos) {\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n },\n [actualIndex],\n );\n\n const getIndexFromSizeArray = React.useCallback(\n (scrollPos: number): number => {\n /* Quick searches our progressive height array */\n if (\n scrollPos === 0 ||\n childProgressiveSizes.current.length === 0 ||\n scrollPos <= childProgressiveSizes.current[0]\n ) {\n // Check start\n return 0;\n }\n\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n },\n [findIndexRecursive],\n );\n const getIndexFromScrollPosition = React.useCallback(\n (scrollPos: number) => {\n if (!getItemSize) {\n return Math.round(scrollPos / (itemSize + gap));\n }\n\n return getIndexFromSizeArray(scrollPos);\n },\n [getIndexFromSizeArray, getItemSize, itemSize, gap],\n );\n\n const calculateTotalSize = React.useCallback(() => {\n if (!getItemSize) {\n return (itemSize + gap) * numItems;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n }, [getItemSize, itemSize, numItems, gap]);\n\n const calculateBefore = React.useCallback(() => {\n const currentIndex = Math.min(actualIndex, numItems - 1);\n\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * (itemSize + gap);\n }\n\n if (currentIndex <= 0) {\n return 0;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, gap]);\n\n const calculateAfter = React.useCallback(() => {\n if (numItems === 0 || actualIndex + virtualizerLength >= numItems) {\n return 0;\n }\n\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex;\n return remainingItems * (itemSize + gap) - gap;\n }\n\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex - 1];\n }, [actualIndex, getItemSize, itemSize, numItems, virtualizerLength, gap]);\n\n // We store the number of items since last render, we will allow an update if the number of items changes\n const previousNumItems = React.useRef<number>(numItems);\n // Observe intersections of virtualized components\n const { setObserverList } = useIntersectionObserver(\n React.useCallback(\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n /* Sanity check - do we even need virtualization? */\n if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n\n if (entries.length === 0) {\n // No entries found, return.\n return;\n }\n // Find the latest entry that is intersecting\n const sortedEntries = entries.sort((entry1, entry2) => entry2.time - entry1.time);\n const latestEntry = sortedEntries.find(entry => {\n return entry.isIntersecting;\n });\n\n if (!latestEntry) {\n return;\n }\n\n // We have to be sure our item sizes are up to date with current indexed ref before calculation\n // Check if we still need\n updateCurrentItemSizes(actualIndexRef.current);\n\n const calculateOverBuffer = (): number => {\n /**\n * We avoid using the scroll ref scrollTop, it may be incorrect\n * as virtualization may exist within a scroll view with other elements\n * The benefit of using IO is that we can detect relative scrolls,\n * so any items can be placed around the virtualizer in the scroll view\n */\n let measurementPos = 0;\n if (latestEntry.target === afterElementRef.current) {\n // Get after buffers position\n measurementPos = calculateTotalSize() - calculateAfter();\n\n // Get exact intersection position based on overflow size (how far into IO did we scroll?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n // Add to original after position\n measurementPos += overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos -= bufferSize;\n // we hit the after buffer and detected the end of view, we need to find the start index.\n measurementPos -= containerSizeRef.current ?? 0;\n\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const hOverflowReversed = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const wOverflow = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const wOverflowReversed = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n // Get before buffers position\n measurementPos = calculateBefore();\n\n // Get exact intersection position based on overflow size (how far into window did we scroll IO?)\n const overflowAmount =\n axis === 'vertical' ? latestEntry.intersectionRect.height : latestEntry.intersectionRect.width;\n\n // Minus from original before position\n measurementPos -= overflowAmount;\n // Ignore buffer size (IO offset)\n measurementPos += bufferSize;\n // Calculate how far past the window bounds we are (this will be zero if IO is within window)\n const hOverflow = latestEntry.boundingClientRect.bottom - latestEntry.intersectionRect.bottom;\n const hOverflowReversed = latestEntry.boundingClientRect.top - latestEntry.intersectionRect.top;\n const wOverflow = latestEntry.boundingClientRect.right - latestEntry.intersectionRect.right;\n const wOverflowReversed = latestEntry.boundingClientRect.left - latestEntry.intersectionRect.left;\n const widthOverflow = reversed ? wOverflowReversed : wOverflow;\n const heightOverflow = reversed ? hOverflowReversed : hOverflow;\n const additionalOverflow = axis === 'vertical' ? heightOverflow : widthOverflow;\n\n if (reversed) {\n measurementPos += additionalOverflow;\n } else {\n measurementPos -= additionalOverflow;\n }\n }\n\n return measurementPos;\n };\n\n // Get exact relative 'scrollTop' via IO values\n const measurementPos = calculateOverBuffer();\n\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n\n const startIndex = getIndexFromScrollPosition(measurementPos) - bufferItems;\n\n // Safety limits\n const newStartIndex = Math.min(Math.max(startIndex, 0), maxIndex);\n flushSync(() => {\n // Callback to allow measure functions to check virtualizer length\n if (\n previousNumItems.current === numItems &&\n newStartIndex + virtualizerLength >= numItems &&\n actualIndex + virtualizerLength >= numItems\n ) {\n // We've already hit the end, no need to update state.\n return;\n }\n // We should ensure we update virtualizer calculations if the length changes\n previousNumItems.current = virtualizerLength;\n updateScrollPosition?.(measurementPos);\n if (actualIndex !== newStartIndex) {\n batchUpdateNewIndex(newStartIndex);\n }\n });\n },\n [\n actualIndex,\n virtualizerLength,\n axis,\n reversed,\n numItems,\n bufferSize,\n bufferItems,\n containerSizeRef,\n updateScrollPosition,\n batchUpdateNewIndex,\n calculateAfter,\n calculateBefore,\n calculateTotalSize,\n getIndexFromScrollPosition,\n updateCurrentItemSizes,\n ],\n ),\n {\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n root: scrollViewRef ? scrollViewRef?.current : null,\n rootMargin: '0px',\n threshold: 0,\n },\n );\n\n const setBeforeRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n\n newList.push(beforeElementRef.current);\n\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n\n // Ensure we update array if before element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n const setAfterRef = React.useCallback(\n (element: HTMLDivElement) => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n\n newList.push(afterElementRef.current);\n\n // Ensure we update array if after element changed\n setObserverList(newList);\n },\n [setObserverList],\n );\n\n // Initialize the size array before first render.\n const hasInitialized = React.useRef<boolean>(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n\n React.useImperativeHandle(\n imperativeVirtualizerRef,\n () => {\n return {\n progressiveSizes: childProgressiveSizes,\n nodeSizes: childSizes,\n setFlaggedIndex: (index: number | null) => (flaggedIndex.current = index),\n currentIndex: actualIndexRef,\n };\n },\n [childProgressiveSizes, childSizes],\n );\n\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n React.useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /*\n * forceUpdate:\n * We only want to trigger this when child render or scroll loading changes,\n * it will force re-render all children elements\n */\n const forceUpdate = React.useReducer(() => ({}), {})[1];\n // If the user passes in an updated renderChild function - update current children\n React.useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, isScrolling]);\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n React.useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize, gap]);\n\n // Effect to check flag index on updates\n React.useEffect(() => {\n if (!onRenderedFlaggedIndex || flaggedIndex.current === null) {\n return;\n }\n if (actualIndex <= flaggedIndex.current && actualIndex + virtualizerLength >= flaggedIndex.current) {\n onRenderedFlaggedIndex(flaggedIndex.current);\n flaggedIndex.current = null;\n }\n }, [actualIndex, onRenderedFlaggedIndex, virtualizerLength]);\n\n // Ensure we have run through and updated the whole size list array at least once.\n /* eslint-disable react-hooks/refs -- deprecated package, not worth refactoring */\n initializeSizeArray();\n\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {\n updateChildRows(actualIndex);\n }\n\n const isFullyInitialized = hasInitialized.current && actualIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div',\n },\n virtualizedChildren: childArray.current,\n before: slot.always(props.before, {\n defaultProps: {\n ref: setBeforeRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n after: slot.always(props.after, {\n defaultProps: {\n ref: setAfterRef,\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeContainer: slot.always(props.beforeContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n afterContainer: slot.always(props.afterContainer, {\n defaultProps: {\n role: 'none',\n },\n elementType: 'div',\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex: actualIndex,\n axis,\n bufferSize,\n reversed,\n childSizes,\n childProgressiveSizes,\n };\n /* eslint-enable react-hooks/refs */\n}\n"],"names":["React","useIntersectionObserver","useVirtualizerContextState_unstable","slot","useTimeout","flushSync","useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","axis","reversed","virtualizerContext","onRenderedFlaggedIndex","imperativeVirtualizerRef","containerSizeRef","scrollViewRef","enableScrollLoad","updateScrollPosition","gap","_virtualizerContext","actualIndexRef","useRef","contextIndex","flaggedIndex","actualIndex","current","setActualIndex","useCallback","index","setContextIndex","beforeElementRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","populateSizeArrays","length","_gap","isScrolling","setIsScrolling","useState","setScrollTimer","clearScrollTimer","scrollCounter","initializeScrollingTimer","INIT_SCROLL_FLAG_REQ","INIT_SCROLL_FLAG_DELAY","useEffect","updateChildRows","newIndex","_actualIndex","max","end","min","i","updateCurrentItemSizes","endIndex","startIndex","didUpdate","newSize","prevSize","batchUpdateNewIndex","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","getIndexFromScrollPosition","calculateTotalSize","calculateBefore","currentIndex","calculateAfter","lastItemIndex","remainingItems","previousNumItems","setObserverList","entries","observer","sortedEntries","sort","entry1","entry2","time","latestEntry","find","entry","isIntersecting","calculateOverBuffer","measurementPos","target","overflowAmount","intersectionRect","height","width","hOverflow","boundingClientRect","top","hOverflowReversed","bottom","wOverflow","left","wOverflowReversed","right","widthOverflow","heightOverflow","additionalOverflow","maxIndex","newStartIndex","root","rootMargin","threshold","setBeforeRef","element","newList","push","setAfterRef","hasInitialized","initializeSizeArray","useImperativeHandle","progressiveSizes","nodeSizes","setFlaggedIndex","forceUpdate","useReducer","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","always","defaultProps","ref","role","elementType","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"mappings":"AAAA;;;;;+BAagBM;;;;;;;iEAXO,QAAQ;yCAGS,sCAAsC;2BAC1B,kBAAkB;gCACrC,4BAA4B;0BACnC,YAAY;AAK/B,iCAAiCC,KAAuB;IAC7D;IAEA,MAAM,EACJC,QAAQ,EACRC,QAAQ,EACRC,iBAAiB,EACjBC,UAAUC,WAAW,EACrBC,WAAW,EACXC,cAAcC,KAAKC,KAAK,CAACN,oBAAoB,IAAI,EACjDO,aAAaF,KAAKG,KAAK,CAACJ,cAAc,OAAON,QAAQ,EACrDW,OAAO,UAAU,EACjBC,WAAW,KAAK,EAChBC,kBAAkB,EAClBC,sBAAsB,EACtBC,wBAAwB,EACxBC,gBAAgB,EAChBC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,MAAM,CAAC,EACR,GAAGrB;IAEJ,iHAAiH,GACjH,MAAMsB,0BAAsB3B,8CAAAA,EAAoCmB;IAEhE,sFAAsF;IACtF,MAAMS,iBAAiB9B,OAAM+B,MAAM,CAASF,oBAAoBG,YAAY;IAE5E,MAAMC,eAAejC,OAAM+B,MAAM,CAAgB;IACjD,MAAMG,cAAcL,oBAAoBG,YAAY;IAEpD,0EAA0E;IAC1E,yFAAyF;IACzF,IAAIH,oBAAoBG,YAAY,KAAKF,eAAeK,OAAO,EAAE;QAC/D,yFAAyF;QACzFL,eAAeK,OAAO,GAAGN,oBAAoBG,YAAY;IAC3D;IACA,MAAMI,iBAAiBpC,OAAMqC,WAAW,CACtC,CAACC;QACCR,eAAeK,OAAO,GAAGG;QACzBT,oBAAoBU,eAAe,CAACD;IACtC,GACA;QAACT;KAAoB;IAGvB,sCAAsC;IACtC,MAAMW,mBAAmBxC,OAAM+B,MAAM,CAAqB;IAE1D,sCA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Aa;QACf;QACAN,gBAAgBhJ,oBAAAA,CAAKkJ,MAAM,CAAC9I,MAAM4I,cAAc,EAAE;YAChDG,cAAc;gBACZE,MAAM;YACR;YACAC,aAAa;QACf;QACAC,oBAAoBZ,qBAAqBxD,oBAAoB;QAC7DqE,mBAAmBb,qBAAqBtD,mBAAmB;QAC3DoE,wBAAwBd,qBAAqBzD,uBAAuB3E,oBAAoBF;QACxFqJ,uBAAuB3H;QACvBf;QACAF;QACAG;QACAsB;QACAE;IACF;AACA,kCAAkC,GACpC"}
@@ -53,9 +53,13 @@ const useVirtualizerStyles_unstable = (state)=>{
53
53
  const styles = useStyles();
54
54
  const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;
55
55
  const horizontal = axis === 'horizontal';
56
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
56
57
  state.before.className = (0, _react.mergeClasses)(virtualizerClassNames.before, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.before.className);
58
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
57
59
  state.after.className = (0, _react.mergeClasses)(virtualizerClassNames.after, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.after.className);
60
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
58
61
  state.beforeContainer.className = (0, _react.mergeClasses)(virtualizerClassNames.beforeContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.beforeContainer.className);
62
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
59
63
  state.afterContainer.className = (0, _react.mergeClasses)(virtualizerClassNames.afterContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.afterContainer.className);
60
64
  const beforeHeightPx = beforeBufferHeight + 'px';
61
65
  const afterHeightPx = afterBufferHeight + 'px';
@@ -98,23 +102,27 @@ const useVirtualizerStyles_unstable = (state)=>{
98
102
  marginRight: `-${bufferPx}`
99
103
  }
100
104
  };
105
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
101
106
  state.before.style = {
102
107
  height: horizontal ? '100%' : beforeBufferHeightPx,
103
108
  width: horizontal ? beforeBufferHeightPx : '100%',
104
109
  ...beforeBuffer,
105
110
  ...state.before.style
106
111
  };
112
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
107
113
  state.beforeContainer.style = {
108
114
  height: horizontal ? 'auto' : beforeHeightPx,
109
115
  width: horizontal ? beforeHeightPx : 'auto',
110
116
  ...state.beforeContainer.style
111
117
  };
118
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
112
119
  state.after.style = {
113
120
  height: horizontal ? '100%' : afterBufferHeightPx,
114
121
  width: horizontal ? afterBufferHeightPx : '100%',
115
122
  ...afterBuffer,
116
123
  ...state.after.style
117
124
  };
125
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
118
126
  state.afterContainer.style = {
119
127
  height: horizontal ? 'auto' : afterHeightPx,
120
128
  width: horizontal ? afterHeightPx : 'auto',
@@ -1 +1 @@
1
- {"version":3,"sources":["useVirtualizerStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerClassName = 'fui-Virtualizer';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const virtualizerClassNames = {\n before: `${virtualizerClassName}__before`,\n beforeContainer: `${virtualizerClassName}__beforeContainer`,\n after: `${virtualizerClassName}__after`,\n afterContainer: `${virtualizerClassName}__afterContainer`\n};\nconst useStyles = makeStyles({\n base: {\n display: 'block',\n pointerEvents: 'none'\n },\n relative: {\n position: 'relative'\n },\n horizontal: {\n minHeight: '100%'\n },\n vertical: {\n minWidth: '100%'\n }\n});\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const useVirtualizerStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;\n const horizontal = axis === 'horizontal';\n state.before.className = mergeClasses(virtualizerClassNames.before, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.before.className);\n state.after.className = mergeClasses(virtualizerClassNames.after, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.after.className);\n state.beforeContainer.className = mergeClasses(virtualizerClassNames.beforeContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.beforeContainer.className);\n state.afterContainer.className = mergeClasses(virtualizerClassNames.afterContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.afterContainer.className);\n const beforeHeightPx = beforeBufferHeight + 'px';\n const afterHeightPx = afterBufferHeight + 'px';\n const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';\n const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';\n const bufferPx = bufferSize + 'px';\n const beforeBuffer = {\n // Column\n ...!reversed && !horizontal && {\n marginBottom: `-${bufferPx}`\n },\n // Column-Reverse\n ...reversed && !horizontal && {\n marginTop: `-${bufferPx}`\n },\n // Row\n ...!reversed && horizontal && {\n marginRight: `-${bufferPx}`\n },\n // Row-Reverse\n ...reversed && horizontal && {\n marginLeft: `-${bufferPx}`\n }\n };\n const afterBuffer = {\n // Column\n ...!reversed && !horizontal && {\n marginTop: `-${bufferPx}`\n },\n // Column-Reverse\n ...reversed && !horizontal && {\n marginBottom: `-${bufferPx}`\n },\n // Row\n ...!reversed && horizontal && {\n marginLeft: `-${bufferPx}`\n },\n // Row-Reverse\n ...reversed && horizontal && {\n marginRight: `-${bufferPx}`\n }\n };\n state.before.style = {\n height: horizontal ? '100%' : beforeBufferHeightPx,\n width: horizontal ? beforeBufferHeightPx : '100%',\n ...beforeBuffer,\n ...state.before.style\n };\n state.beforeContainer.style = {\n height: horizontal ? 'auto' : beforeHeightPx,\n width: horizontal ? beforeHeightPx : 'auto',\n ...state.beforeContainer.style\n };\n state.after.style = {\n height: horizontal ? '100%' : afterBufferHeightPx,\n width: horizontal ? afterBufferHeightPx : '100%',\n ...afterBuffer,\n ...state.after.style\n };\n state.afterContainer.style = {\n height: horizontal ? 'auto' : afterHeightPx,\n width: horizontal ? afterHeightPx : 'auto',\n ...state.afterContainer.style\n };\n return state;\n};\n"],"names":["__styles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","mc9l5x","Bkecrkj","relative","qhf8xq","horizontal","sshi5w","vertical","Bf4jedk","d","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginRight","marginLeft","afterBuffer","style","height","width"],"mappings":"AAAA,YAAY;;;;;;;;;;;;iCA6BkC;eAA7BmB;;IAxBAhB,qBAAqB;;;;uBAJG,gBAAgB;AACzD,MAAMD,oBAAoB,GAAG,iBAAiB;AAGnC,8BAA8B;IACrCE,MAAM,EAAE,GAAGF,oBAAoB,CAAA,QAAA,CAAU;IACzCG,eAAe,EAAE,GAAGH,oBAAoB,CAAA,iBAAA,CAAmB;IAC3DI,KAAK,EAAE,GAAGJ,oBAAoB,CAAA,OAAA,CAAS;IACvCK,cAAc,EAAE,GAAGL,oBAAoB,CAAA,gBAAA,CAAA;AAC3C,CAAC;AACD,MAAMM,SAAS,GAAA,WAAA,OAAGR,eAAA,EAAA;IAAAS,IAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,QAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAC,UAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAC,QAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAcjB,CAAC;AAIS,uCAAuCE,KAAK,IAAG;IACtD,aAAa;IACb,MAAMC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,GAAG;QACjBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGgB,oBAAoB;QAClDW,KAAK,EAAE3B,UAAU,GAAGgB,oBAAoB,GAAG,MAAM;QACjD,GAAGG,YAAY;QACf,GAAGb,KAAK,CAAChB,MAAM,CAACmC,KAAAA;IACpB,CAAC;IACDnB,KAAK,CAACf,eAAe,CAACkC,KAAK,GAAG;QAC1BC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGc,cAAc;QAC5Ca,KAAK,EAAE3B,UAAU,GAAGc,cAAc,GAAG,MAAM;QAC3C,GAAGR,KAAK,CAACf,eAAe,CAACkC,KAAAA;IAC7B,CAAC;IACDnB,KAAK,CAACd,KAAK,CAACiC,KAAK,GAAG;QAChBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGiB,mBAAmB;QACjDU,KAAK,EAAE3B,UAAU,GAAGiB,mBAAmB,GAAG,MAAM;QAChD,GAAGO,WAAW;QACd,GAAGlB,KAAK,CAACd,KAAK,CAACiC,KAAAA;IACnB,CAAC;IACDnB,KAAK,CAACb,cAAc,CAACgC,KAAK,GAAG;QACzBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGe,aAAa;QAC3CY,KAAK,EAAE3B,UAAU,GAAGe,aAAa,GAAG,MAAM;QAC1C,GAAGT,KAAK,CAACb,cAAc,CAACgC,KAAAA;IAC5B,CAAC;IACD,OAAOnB,KAAK;AAChB,CAAC"}
1
+ {"version":3,"sources":["useVirtualizerStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerClassName = 'fui-Virtualizer';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const virtualizerClassNames = {\n before: `${virtualizerClassName}__before`,\n beforeContainer: `${virtualizerClassName}__beforeContainer`,\n after: `${virtualizerClassName}__after`,\n afterContainer: `${virtualizerClassName}__afterContainer`\n};\nconst useStyles = makeStyles({\n base: {\n display: 'block',\n pointerEvents: 'none'\n },\n relative: {\n position: 'relative'\n },\n horizontal: {\n minHeight: '100%'\n },\n vertical: {\n minWidth: '100%'\n }\n});\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const useVirtualizerStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;\n const horizontal = axis === 'horizontal';\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.before.className = mergeClasses(virtualizerClassNames.before, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.before.className);\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.after.className = mergeClasses(virtualizerClassNames.after, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.after.className);\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.beforeContainer.className = mergeClasses(virtualizerClassNames.beforeContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.beforeContainer.className);\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.afterContainer.className = mergeClasses(virtualizerClassNames.afterContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.afterContainer.className);\n const beforeHeightPx = beforeBufferHeight + 'px';\n const afterHeightPx = afterBufferHeight + 'px';\n const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';\n const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';\n const bufferPx = bufferSize + 'px';\n const beforeBuffer = {\n // Column\n ...!reversed && !horizontal && {\n marginBottom: `-${bufferPx}`\n },\n // Column-Reverse\n ...reversed && !horizontal && {\n marginTop: `-${bufferPx}`\n },\n // Row\n ...!reversed && horizontal && {\n marginRight: `-${bufferPx}`\n },\n // Row-Reverse\n ...reversed && horizontal && {\n marginLeft: `-${bufferPx}`\n }\n };\n const afterBuffer = {\n // Column\n ...!reversed && !horizontal && {\n marginTop: `-${bufferPx}`\n },\n // Column-Reverse\n ...reversed && !horizontal && {\n marginBottom: `-${bufferPx}`\n },\n // Row\n ...!reversed && horizontal && {\n marginLeft: `-${bufferPx}`\n },\n // Row-Reverse\n ...reversed && horizontal && {\n marginRight: `-${bufferPx}`\n }\n };\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.before.style = {\n height: horizontal ? '100%' : beforeBufferHeightPx,\n width: horizontal ? beforeBufferHeightPx : '100%',\n ...beforeBuffer,\n ...state.before.style\n };\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.beforeContainer.style = {\n height: horizontal ? 'auto' : beforeHeightPx,\n width: horizontal ? beforeHeightPx : 'auto',\n ...state.beforeContainer.style\n };\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.after.style = {\n height: horizontal ? '100%' : afterBufferHeightPx,\n width: horizontal ? afterBufferHeightPx : '100%',\n ...afterBuffer,\n ...state.after.style\n };\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.afterContainer.style = {\n height: horizontal ? 'auto' : afterHeightPx,\n width: horizontal ? afterHeightPx : 'auto',\n ...state.afterContainer.style\n };\n return state;\n};\n"],"names":["__styles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","mc9l5x","Bkecrkj","relative","qhf8xq","horizontal","sshi5w","vertical","Bf4jedk","d","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginRight","marginLeft","afterBuffer","style","height","width"],"mappings":"AAAA,YAAY;;;;;;;;;;;;iCA6BkC;eAA7BmB;;IAxBAhB,qBAAqB;;;;uBAJG,gBAAgB;AACzD,MAAMD,oBAAoB,GAAG,iBAAiB;AAGnC,8BAA8B;IACrCE,MAAM,EAAE,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AmB,GAAG,MAAM;QAChD,GAAGO,WAAW;QACd,GAAGlB,KAAK,CAACd,KAAK,CAACiC,KAAAA;IACnB,CAAC;IACD,iGAAA;IACAnB,KAAK,CAACb,cAAc,CAACgC,KAAK,GAAG;QACzBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGe,aAAa;QAC3CY,KAAK,EAAE3B,UAAU,GAAGe,aAAa,GAAG,MAAM;QAC1C,GAAGT,KAAK,CAACb,cAAc,CAACgC,KAAAA;IAC5B,CAAC;IACD,OAAOnB,KAAK;AAChB,CAAC"}
@@ -45,9 +45,13 @@ const useVirtualizerStyles_unstable = (state)=>{
45
45
  const styles = useStyles();
46
46
  const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;
47
47
  const horizontal = axis === 'horizontal';
48
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
48
49
  state.before.className = (0, _react.mergeClasses)(virtualizerClassNames.before, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.before.className);
50
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
49
51
  state.after.className = (0, _react.mergeClasses)(virtualizerClassNames.after, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.after.className);
52
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
50
53
  state.beforeContainer.className = (0, _react.mergeClasses)(virtualizerClassNames.beforeContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.beforeContainer.className);
54
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
51
55
  state.afterContainer.className = (0, _react.mergeClasses)(virtualizerClassNames.afterContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.afterContainer.className);
52
56
  const beforeHeightPx = beforeBufferHeight + 'px';
53
57
  const afterHeightPx = afterBufferHeight + 'px';
@@ -90,23 +94,27 @@ const useVirtualizerStyles_unstable = (state)=>{
90
94
  marginRight: `-${bufferPx}`
91
95
  }
92
96
  };
97
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
93
98
  state.before.style = {
94
99
  height: horizontal ? '100%' : beforeBufferHeightPx,
95
100
  width: horizontal ? beforeBufferHeightPx : '100%',
96
101
  ...beforeBuffer,
97
102
  ...state.before.style
98
103
  };
104
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
99
105
  state.beforeContainer.style = {
100
106
  height: horizontal ? 'auto' : beforeHeightPx,
101
107
  width: horizontal ? beforeHeightPx : 'auto',
102
108
  ...state.beforeContainer.style
103
109
  };
110
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
104
111
  state.after.style = {
105
112
  height: horizontal ? '100%' : afterBufferHeightPx,
106
113
  width: horizontal ? afterBufferHeightPx : '100%',
107
114
  ...afterBuffer,
108
115
  ...state.after.style
109
116
  };
117
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
110
118
  state.afterContainer.style = {
111
119
  height: horizontal ? 'auto' : afterHeightPx,
112
120
  width: horizontal ? afterHeightPx : 'auto',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Virtualizer/useVirtualizerStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nconst virtualizerClassName = 'fui-Virtualizer';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const virtualizerClassNames: SlotClassNames<VirtualizerSlots> = {\n before: `${virtualizerClassName}__before`,\n beforeContainer: `${virtualizerClassName}__beforeContainer`,\n after: `${virtualizerClassName}__after`,\n afterContainer: `${virtualizerClassName}__afterContainer`,\n};\n\nconst useStyles = makeStyles({\n base: {\n display: 'block',\n pointerEvents: 'none',\n },\n relative: {\n position: 'relative',\n },\n horizontal: {\n minHeight: '100%',\n },\n vertical: {\n minWidth: '100%',\n },\n});\n\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useVirtualizerStyles_unstable = (state: VirtualizerState): VirtualizerState => {\n 'use no memo';\n\n const styles = useStyles();\n const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;\n const horizontal = axis === 'horizontal';\n\n state.before.className = mergeClasses(\n virtualizerClassNames.before,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.before.className,\n );\n\n state.after.className = mergeClasses(\n virtualizerClassNames.after,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.after.className,\n );\n\n state.beforeContainer.className = mergeClasses(\n virtualizerClassNames.beforeContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.beforeContainer.className,\n );\n\n state.afterContainer.className = mergeClasses(\n virtualizerClassNames.afterContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.afterContainer.className,\n );\n\n const beforeHeightPx = beforeBufferHeight + 'px';\n const afterHeightPx = afterBufferHeight + 'px';\n const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';\n const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';\n const bufferPx = bufferSize + 'px';\n\n const beforeBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginRight: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n };\n\n const afterBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginRight: `-${bufferPx}` }),\n };\n\n state.before.style = {\n height: horizontal ? '100%' : beforeBufferHeightPx,\n width: horizontal ? beforeBufferHeightPx : '100%',\n ...beforeBuffer,\n ...state.before.style,\n };\n\n state.beforeContainer.style = {\n height: horizontal ? 'auto' : beforeHeightPx,\n width: horizontal ? beforeHeightPx : 'auto',\n ...state.beforeContainer.style,\n };\n\n state.after.style = {\n height: horizontal ? '100%' : afterBufferHeightPx,\n width: horizontal ? afterBufferHeightPx : '100%',\n ...afterBuffer,\n ...state.after.style,\n };\n\n state.afterContainer.style = {\n height: horizontal ? 'auto' : afterHeightPx,\n width: horizontal ? afterHeightPx : 'auto',\n ...state.afterContainer.style,\n };\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","display","pointerEvents","relative","position","horizontal","minHeight","vertical","minWidth","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginRight","marginLeft","afterBuffer","style","height","width"],"mappings":"AAAA;;;;;;;;;;;;iCAqCakB;eAAAA;;IA3BAf,qBAAAA;;;;uBAR4B,iBAAiB;AAI1D,MAAMD,uBAAuB;AAItB,8BAAgE;IACrEE,QAAQ,GAAGF,qBAAqB,QAAQ,CAAC;IACzCG,iBAAiB,GAAGH,qBAAqB,iBAAiB,CAAC;IAC3DI,OAAO,GAAGJ,qBAAqB,OAAO,CAAC;IACvCK,gBAAgB,GAAGL,qBAAqB,gBAAgB,CAAC;AAC3D,EAAE;AAEF,MAAMM,gBAAYR,iBAAAA,EAAW;IAC3BS,MAAM;QACJC,SAAS;QACTC,eAAe;IACjB;IACAC,UAAU;QACRC,UAAU;IACZ;IACAC,YAAY;QACVC,WAAW;IACb;IACAC,UAAU;QACRC,UAAU;IACZ;AACF;AAMO,sCAAsC,CAACE;IAC5C;IAEA,MAAMC,SAASZ;I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pC,GAAGT,MAAMZ,cAAc,CAAC+B,KAAK;IAC/B;IAEA,OAAOnB;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/Virtualizer/useVirtualizerStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nconst virtualizerClassName = 'fui-Virtualizer';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const virtualizerClassNames: SlotClassNames<VirtualizerSlots> = {\n before: `${virtualizerClassName}__before`,\n beforeContainer: `${virtualizerClassName}__beforeContainer`,\n after: `${virtualizerClassName}__after`,\n afterContainer: `${virtualizerClassName}__afterContainer`,\n};\n\nconst useStyles = makeStyles({\n base: {\n display: 'block',\n pointerEvents: 'none',\n },\n relative: {\n position: 'relative',\n },\n horizontal: {\n minHeight: '100%',\n },\n vertical: {\n minWidth: '100%',\n },\n});\n\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useVirtualizerStyles_unstable = (state: VirtualizerState): VirtualizerState => {\n 'use no memo';\n\n const styles = useStyles();\n const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;\n const horizontal = axis === 'horizontal';\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.before.className = mergeClasses(\n virtualizerClassNames.before,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.before.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.after.className = mergeClasses(\n virtualizerClassNames.after,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.after.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.beforeContainer.className = mergeClasses(\n virtualizerClassNames.beforeContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.beforeContainer.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.afterContainer.className = mergeClasses(\n virtualizerClassNames.afterContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.afterContainer.className,\n );\n\n const beforeHeightPx = beforeBufferHeight + 'px';\n const afterHeightPx = afterBufferHeight + 'px';\n const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';\n const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';\n const bufferPx = bufferSize + 'px';\n\n const beforeBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginRight: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n };\n\n const afterBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginRight: `-${bufferPx}` }),\n };\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.before.style = {\n height: horizontal ? '100%' : beforeBufferHeightPx,\n width: horizontal ? beforeBufferHeightPx : '100%',\n ...beforeBuffer,\n ...state.before.style,\n };\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.beforeContainer.style = {\n height: horizontal ? 'auto' : beforeHeightPx,\n width: horizontal ? beforeHeightPx : 'auto',\n ...state.beforeContainer.style,\n };\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.after.style = {\n height: horizontal ? '100%' : afterBufferHeightPx,\n width: horizontal ? afterBufferHeightPx : '100%',\n ...afterBuffer,\n ...state.after.style,\n };\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.afterContainer.style = {\n height: horizontal ? 'auto' : afterHeightPx,\n width: horizontal ? afterHeightPx : 'auto',\n ...state.afterContainer.style,\n };\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","display","pointerEvents","relative","position","horizontal","minHeight","vertical","minWidth","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginRight","marginLeft","afterBuffer","style","height","width"],"mappings":"AAAA;;;;;;;;;;;;iCAqCakB;eAAAA;;IA3BAf,qBAAAA;;;;uBAR4B,iBAAiB;AAI1D,MAAMD,uBAAuB;AAItB,8BAAgE;IACrEE,QAAQ,GAAGF,qBAAqB,QAAQ,CAAC;IACzCG,iBAAiB,GAAGH,qBAAqB,iBAAiB,CAAC;IAC3DI,OAAO,GAAGJ,qBAAqB,OAAO,CAAC;IACvCK,gBAAgB,GAAGL,qBAAqB,gBAAgB,CAAC;AAC3D,EAAE;AAEF,MAAMM,gBAAYR,iBAAAA,EAAW;IAC3BS,MAAM;QACJC,SAAS;QACTC,eAAe;IACjB;IACAC,UAAU;QACRC,UAAU;IACZ;IACAC,YAAY;QACVC,WAAW;IACb;IACAC,UAAU;QACRC,UAAU;IACZ;AACF;AAMO,sCAAsC,CAACE;IAC5C;IAEA,MAAMC,SAASZ;IACf,MAAM,EAAEa,QAAQ,EAAEC,IAAI,EAAEC,kBAAkB,EAAEC,iBAAiB,EAAEC,UAAU,EAAE,GAAGN;IAC9E,MAAML,aAAaQ,SAAS;IAE5B,iGAAiG;IACjGH,MAAMf,MAAM,CAACsB,SAAS,OAAGzB,mBAAAA,EACvBE,sBAAsBC,MAAM,EAC5BgB,OAAOX,IAAI,EACXW,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});
26
26
  // Store the virtualizer length as a ref for imperative ref access
27
27
  const virtualizerLengthRef = _react.useRef(virtualizerLength);
28
+ // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
28
29
  if (virtualizerLengthRef.current !== virtualizerLength) {
30
+ // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
29
31
  virtualizerLengthRef.current = virtualizerLength;
30
32
  }
31
33
  const paginationRef = (0, _useStaticPagination.useStaticVirtualizerPagination)({
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/VirtualizerScrollView/useVirtualizerScrollView.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport type { VirtualizerScrollViewProps, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { useStaticVirtualizerMeasure } from '../../Hooks';\nimport { scrollToItemStatic } from '../../Utilities';\nimport type { VirtualizerDataRef } from '../Virtualizer/Virtualizer.types';\nimport { useStaticVirtualizerPagination } from '../../hooks/useStaticPagination';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { imperativeRef, itemSize, numItems, axis = 'vertical', reversed, enablePagination = false } = props;\n const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef } = useStaticVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n });\n\n // Store the virtualizer length as a ref for imperative ref access\n const virtualizerLengthRef = React.useRef<number>(virtualizerLength);\n if (virtualizerLengthRef.current !== virtualizerLength) {\n virtualizerLengthRef.current = virtualizerLength;\n }\n\n const paginationRef = useStaticVirtualizerPagination({ axis, itemSize }, enablePagination);\n const scrollViewRef = useMergedRefs(props.scrollViewRef, scrollRef, paginationRef) as React.RefObject<HTMLDivElement>;\n const imperativeVirtualizerRef = React.useRef<VirtualizerDataRef | null>(null);\n const scrollCallbackRef = React.useRef<null | ((index: number) => void)>(null);\n\n React.useImperativeHandle(\n imperativeRef,\n () => {\n return {\n scrollTo(index: number, behavior = 'auto', callback: ((index: number) => void) | undefined) {\n scrollCallbackRef.current = callback ?? null;\n imperativeVirtualizerRef.current?.setFlaggedIndex(index);\n scrollToItemStatic({\n index,\n itemSize,\n totalItems: numItems,\n scrollViewRef,\n axis,\n reversed,\n behavior,\n });\n },\n currentIndex: imperativeVirtualizerRef.current?.currentIndex,\n virtualizerLength: virtualizerLengthRef,\n };\n },\n [axis, scrollViewRef, itemSize, numItems, reversed],\n );\n\n const handleRenderedIndex = (index: number) => {\n if (scrollCallbackRef.current) {\n scrollCallbackRef.current(index);\n }\n };\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n virtualizerLength,\n bufferItems,\n bufferSize,\n onRenderedFlaggedIndex: handleRenderedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: slot.always(props.container, {\n defaultProps: {\n ref: scrollViewRef as React.RefObject<HTMLDivElement>,\n },\n elementType: 'div',\n }),\n };\n}\n"],"names":["React","slot","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","scrollToItemStatic","useStaticVirtualizerPagination","useVirtualizerScrollView_unstable","props","imperativeRef","itemSize","numItems","axis","reversed","enablePagination","virtualizerLength","bufferItems","bufferSize","scrollRef","containerSizeRef","defaultItemSize","direction","virtualizerLengthRef","useRef","current","paginationRef","scrollViewRef","imperativeVirtualizerRef","scrollCallbackRef","useImperativeHandle","scrollTo","index","behavior","callback","setFlaggedIndex","totalItems","currentIndex","handleRenderedIndex","virtualizerState","onRenderedFlaggedIndex","components","container","always","defaultProps","ref","elementType"],"mappings":"AAAA;;;;;+BAcgBO;;;;;;;iEAZO,QAAQ;gCACK,4BAA4B;gCACxB,gCAAgC;uBAE5B,cAAc;2BAC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A,yBAAyBH,OAAAA,AAAO,MAAA,QAAhCG,sCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kCAAkCS,YAAY;YAC5DrB,mBAAmBO;QACrB;IACF,GACA;QAACV;QAAMc;QAAehB;QAAUC;QAAUE;KAAS;IAGrD,MAAMwB,sBAAsB,CAACN;QAC3B,IAAIH,kBAAkBJ,OAAO,EAAE;YAC7BI,kBAAkBJ,OAAO,CAACO;QAC5B;IACF;IAEA,MAAMO,uBAAmBnC,uCAAAA,EAAwB;QAC/C,GAAGK,KAAK;QACRO;QACAC;QACAC;QACAsB,wBAAwBF;QACxBV;QACAR;IACF;IAEA,OAAO;QACL,GAAGmB,gBAAgB;QACnBE,YAAY;YACV,GAAGF,iBAAiBE,UAAU;YAC9BC,WAAW;QACb;QACAA,WAAWxC,oBAAAA,CAAKyC,MAAM,CAAClC,MAAMiC,SAAS,EAAE;YACtCE,cAAc;gBACZC,KAAKlB;YACP;YACAmB,aAAa;QACf;IACF;AACF"}
1
+ {"version":3,"sources":["../src/components/VirtualizerScrollView/useVirtualizerScrollView.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport type { VirtualizerScrollViewProps, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { useStaticVirtualizerMeasure } from '../../Hooks';\nimport { scrollToItemStatic } from '../../Utilities';\nimport type { VirtualizerDataRef } from '../Virtualizer/Virtualizer.types';\nimport { useStaticVirtualizerPagination } from '../../hooks/useStaticPagination';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { imperativeRef, itemSize, numItems, axis = 'vertical', reversed, enablePagination = false } = props;\n const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef } = useStaticVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n });\n\n // Store the virtualizer length as a ref for imperative ref access\n const virtualizerLengthRef = React.useRef<number>(virtualizerLength);\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n if (virtualizerLengthRef.current !== virtualizerLength) {\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n virtualizerLengthRef.current = virtualizerLength;\n }\n\n const paginationRef = useStaticVirtualizerPagination({ axis, itemSize }, enablePagination);\n const scrollViewRef = useMergedRefs(props.scrollViewRef, scrollRef, paginationRef) as React.RefObject<HTMLDivElement>;\n const imperativeVirtualizerRef = React.useRef<VirtualizerDataRef | null>(null);\n const scrollCallbackRef = React.useRef<null | ((index: number) => void)>(null);\n\n React.useImperativeHandle(\n imperativeRef,\n () => {\n return {\n scrollTo(index: number, behavior = 'auto', callback: ((index: number) => void) | undefined) {\n scrollCallbackRef.current = callback ?? null;\n imperativeVirtualizerRef.current?.setFlaggedIndex(index);\n scrollToItemStatic({\n index,\n itemSize,\n totalItems: numItems,\n scrollViewRef,\n axis,\n reversed,\n behavior,\n });\n },\n currentIndex: imperativeVirtualizerRef.current?.currentIndex,\n virtualizerLength: virtualizerLengthRef,\n };\n },\n [axis, scrollViewRef, itemSize, numItems, reversed],\n );\n\n const handleRenderedIndex = (index: number) => {\n if (scrollCallbackRef.current) {\n scrollCallbackRef.current(index);\n }\n };\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n virtualizerLength,\n bufferItems,\n bufferSize,\n onRenderedFlaggedIndex: handleRenderedIndex,\n imperativeVirtualizerRef,\n containerSizeRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: slot.always(props.container, {\n defaultProps: {\n ref: scrollViewRef as React.RefObject<HTMLDivElement>,\n },\n elementType: 'div',\n }),\n };\n}\n"],"names":["React","slot","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","scrollToItemStatic","useStaticVirtualizerPagination","useVirtualizerScrollView_unstable","props","imperativeRef","itemSize","numItems","axis","reversed","enablePagination","virtualizerLength","bufferItems","bufferSize","scrollRef","containerSizeRef","defaultItemSize","direction","virtualizerLengthRef","useRef","current","paginationRef","scrollViewRef","imperativeVirtualizerRef","scrollCallbackRef","useImperativeHandle","scrollTo","index","behavior","callback","setFlaggedIndex","totalItems","currentIndex","handleRenderedIndex","virtualizerState","onRenderedFlaggedIndex","components","container","always","defaultProps","ref","elementType"],"mappings":"AAAA;;;;;+BAcgBO;;;;;;;iEAZO,QAAQ;gCACK,4BAA4B;gCACxB,gCAAgC;uBAE5B,cAAc;2BACvB,kBAAkB;qCAEN,kCAAkC;AAK1E,2CAA2CC,KAAiC;IACjF,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,UAAU,EAAEC,QAAQ,EAAEC,mBAAmB,KAAK,EAAE,GAAGN;QAGxFA;IAFb,MAAM,EAAEO,iBAAiB,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,gBAAgB,EAAE,OAAGf,kCAAAA,EAA4B;QAC9GgB,iBAAiBZ,MAAME,QAAQ;QAC/BW,WAAWb,CAAAA,cAAAA,MAAMI,IAAAA,AAAI,MAAA,QAAVJ,gBAAAA,KAAAA,IAAAA,cAAc;IAC3B;IAEA,kEAAkE;IAClE,MAAMc,uBAAuBtB,OAAMuB,MAAM,CAASR;IAClD,yFAAyF;IACzF,IAAIO,qBAAqBE,OAAO,KAAKT,mBAAmB;QACtD,yFAAyF;QACzFO,qBAAqBE,OAAO,GAAGT;IACjC;IAEA,MAAMU,oBAAgBnB,mDAAAA,EAA+B;QAAEM;QAAMF;IAAS,GAAGI;IACzE,MAAMY,oBAAgBxB,6BAAAA,EAAcM,MAAMkB,aAAa,EAAER,WAAWO;IACpE,MAAME,2BAA2B3B,OAAMuB,MAAM,CAA4B;IACzE,MAAMK,oBAAoB5B,OAAMuB,MAAM,CAAmC;IAEzEvB,OAAM6B,mBAAmB,CACvBpB,eACA;YAekBkB;QAdhB,OAAO;YACLG,UAASC,KAAa,EAAEC,WAAW,MAAM,EAAEC,QAA+C;oBAExFN;gBADAC,kBAAkBJ,OAAO,GAAGS,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,WAAY;gBACxCN,qCAAAA,yBAAyBH,OAAAA,AAAO,MAAA,QAAhCG,sCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kCAAkCO,eAAe,CAACH;oBAClD1B,6BAAAA,EAAmB;oBACjB0B;oBACArB;oBACAyB,YAAYxB;oBACZe;oBACAd;oBACAC;oBACAmB;gBACF;YACF;YACAI,YAAY,EAAA,CAAET,oCAAAA,yBAAyBH,OAAAA,AAAO,MAAA,QAAhCG,sCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kCAAkCS,YAAY;YAC5DrB,mBAAmBO;QACrB;IACF,GACA;QAACV;QAAMc;QAAehB;QAAUC;QAAUE;KAAS;IAGrD,MAAMwB,sBAAsB,CAACN;QAC3B,IAAIH,kBAAkBJ,OAAO,EAAE;YAC7BI,kBAAkBJ,OAAO,CAACO;QAC5B;IACF;IAEA,MAAMO,uBAAmBnC,uCAAAA,EAAwB;QAC/C,GAAGK,KAAK;QACRO;QACAC;QACAC;QACAsB,wBAAwBF;QACxBV;QACAR;IACF;IAEA,OAAO;QACL,GAAGmB,gBAAgB;QACnBE,YAAY;YACV,GAAGF,iBAAiBE,UAAU;YAC9BC,WAAW;QACb;QACAA,WAAWxC,oBAAAA,CAAKyC,MAAM,CAAClC,MAAMiC,SAAS,EAAE;YACtCE,cAAc;gBACZC,KAAKlB;YACP;YACAmB,aAAa;QACf;IACF;AACF"}
@@ -66,6 +66,7 @@ const useVirtualizerScrollViewStyles_unstable = (state)=>{
66
66
  (0, _useVirtualizerStylesstyles.useVirtualizerStyles_unstable)(state);
67
67
  const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
68
68
  // Add container styles
69
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
69
70
  state.container.className = (0, _react.mergeClasses)(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
70
71
  return state;
71
72
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useVirtualizerScrollViewStyles.styles.js"],"sourcesContent":["'use client';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const virtualizerScrollViewClassNames = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`\n};\nconst useStyles = makeStyles({\n base: {\n display: 'flex',\n width: '100%',\n height: '100%'\n },\n vertical: {\n flexDirection: 'column',\n overflowY: 'auto'\n },\n horizontal: {\n flexDirection: 'row',\n overflowX: 'auto'\n },\n verticalReversed: {\n flexDirection: 'column-reverse',\n overflowY: 'auto'\n },\n horizontalReversed: {\n flexDirection: 'row-reverse',\n overflowX: 'auto'\n }\n});\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const useVirtualizerScrollViewStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n // Default virtualizer styles base\n useVirtualizerStyles_unstable(state);\n const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;\n // Add container styles\n state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);\n return state;\n};\n"],"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","useVirtualizerScrollViewStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAoCKoB,uCAAuC;;;IA9BvCf,+BAA+B;;;;4CALqB,4CAA4C;uBACxE,gBAAgB;AACzD,MAAMD,8BAA8B,GAAG,6BAA6B;AAGzD,wCAAwC;IAC/C,GAAGH,iDAAqB;IACxBK,SAAS,EAAE,GAAGF,8BAA8B,CAAA,WAAA,CAAA;AAChD,CAAC;AACD,MAAMG,SAAS,GAAA,WAAA,OAAGL,eAAA,EAAA;IAAAM,IAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,QAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,UAAA,EAAA;QAAAF,OAAA,EAAA;QAAAG,OAAA,EAAA;IAAA;IAAAC,gBAAA,EAAA;QAAAJ,OAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAI,kBAAA,EAAA;QAAAL,OAAA,EAAA;QAAAG,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAG,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAsBjB,CAAC;AAIS,iDAAiDE,KAAK,IAAG;IAChE,aAAa;IACb,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;IAC1B,kCAAA;QACAP,yDAA6B,EAACqB,KAAK,CAAC;IACpC,MAAME,cAAc,GAAGF,KAAK,CAACG,IAAI,KAAK,YAAY,GAAGH,KAAK,CAACI,QAAQ,GAAGH,MAAM,CAACJ,kBAAkB,GAAGI,MAAM,CAACP,UAAU,GAAGM,KAAK,CAACI,QAAQ,GAAGH,MAAM,CAACL,gBAAgB,GAAGK,MAAM,CAACV,QAAQ;IAChL,uBAAA;IACAS,KAAK,CAACf,SAAS,CAACoB,SAAS,GAAGvB,uBAAY,EAACE,+BAA+B,CAACC,SAAS,EAAEgB,MAAM,CAACd,IAAI,EAAEe,cAAc,EAAEF,KAAK,CAACf,SAAS,CAACoB,SAAS,CAAC;IAC3I,OAAOL,KAAK;AAChB,CAAC"}
1
+ {"version":3,"sources":["useVirtualizerScrollViewStyles.styles.js"],"sourcesContent":["'use client';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const virtualizerScrollViewClassNames = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`\n};\nconst useStyles = makeStyles({\n base: {\n display: 'flex',\n width: '100%',\n height: '100%'\n },\n vertical: {\n flexDirection: 'column',\n overflowY: 'auto'\n },\n horizontal: {\n flexDirection: 'row',\n overflowX: 'auto'\n },\n verticalReversed: {\n flexDirection: 'column-reverse',\n overflowY: 'auto'\n },\n horizontalReversed: {\n flexDirection: 'row-reverse',\n overflowX: 'auto'\n }\n});\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const useVirtualizerScrollViewStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n // Default virtualizer styles base\n useVirtualizerStyles_unstable(state);\n const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;\n // Add container styles\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);\n return state;\n};\n"],"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","useVirtualizerScrollViewStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAoCKoB,uCAAuC;;;IA9BvCf,+BAA+B;;;;4CALqB,4CAA4C;uBACxE,gBAAgB;AACzD,MAAMD,8BAA8B,GAAG,6BAA6B;AAGzD,wCAAwC;IAC/C,GAAGH,iDAAqB;IACxBK,SAAS,EAAE,GAAGF,8BAA8B,CAAA,WAAA,CAAA;AAChD,CAAC;AACD,MAAMG,SAAS,GAAA,WAAA,OAAGL,eAAA,EAAA;IAAAM,IAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,QAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,UAAA,EAAA;QAAAF,OAAA,EAAA;QAAAG,OAAA,EAAA;IAAA;IAAAC,gBAAA,EAAA;QAAAJ,OAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAI,kBAAA,EAAA;QAAAL,OAAA,EAAA;QAAAG,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAG,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAsBjB,CAAC;AAIS,iDAAiDE,KAAK,IAAG;IAChE,aAAa;IACb,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;IAC1B,kCAAA;QACAP,yDAA6B,EAACqB,KAAK,CAAC;IACpC,MAAME,cAAc,GAAGF,KAAK,CAACG,IAAI,KAAK,YAAY,GAAGH,KAAK,CAACI,QAAQ,GAAGH,MAAM,CAACJ,kBAAkB,GAAGI,MAAM,CAACP,UAAU,GAAGM,KAAK,CAACI,QAAQ,GAAGH,MAAM,CAACL,gBAAgB,GAAGK,MAAM,CAACV,QAAQ;IAChL,uBAAA;IACA,iGAAA;IACAS,KAAK,CAACf,SAAS,CAACoB,SAAS,OAAGvB,mBAAY,EAACE,+BAA+B,CAACC,SAAS,EAAEgB,MAAM,CAACd,IAAI,EAAEe,cAAc,EAAEF,KAAK,CAACf,SAAS,CAACoB,SAAS,CAAC;IAC3I,OAAOL,KAAK;AAChB,CAAC"}
@@ -54,6 +54,7 @@ const useVirtualizerScrollViewStyles_unstable = (state)=>{
54
54
  (0, _useVirtualizerStylesstyles.useVirtualizerStyles_unstable)(state);
55
55
  const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
56
56
  // Add container styles
57
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
57
58
  state.container.className = (0, _react.mergeClasses)(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
58
59
  return state;
59
60
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport type { VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { VirtualizerScrollViewSlots } from './VirtualizerScrollView.types';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const virtualizerScrollViewClassNames: SlotClassNames<VirtualizerScrollViewSlots> = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`,\n};\n\nconst useStyles = makeStyles({\n base: {\n display: 'flex',\n width: '100%',\n height: '100%',\n },\n vertical: {\n flexDirection: 'column',\n overflowY: 'auto',\n },\n horizontal: {\n flexDirection: 'row',\n overflowX: 'auto',\n },\n verticalReversed: {\n flexDirection: 'column-reverse',\n overflowY: 'auto',\n },\n horizontalReversed: {\n flexDirection: 'row-reverse',\n overflowX: 'auto',\n },\n});\n\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useVirtualizerScrollViewStyles_unstable = (\n state: VirtualizerScrollViewState,\n): VirtualizerScrollViewState => {\n 'use no memo';\n\n const styles = useStyles();\n\n // Default virtualizer styles base\n useVirtualizerStyles_unstable(state);\n\n const containerStyle =\n state.axis === 'horizontal'\n ? state.reversed\n ? styles.horizontalReversed\n : styles.horizontal\n : state.reversed\n ? styles.verticalReversed\n : styles.vertical;\n\n // Add container styles\n state.container.className = mergeClasses(\n virtualizerScrollViewClassNames.container,\n styles.base,\n containerStyle,\n state.container.className,\n );\n\n return state;\n};\n"],"names":["useVirtualizerStyles_unstable","virtualizerClassNames","makeStyles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","display","width","height","vertical","flexDirection","overflowY","horizontal","overflowX","verticalReversed","horizontalReversed","useVirtualizerScrollViewStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"mappings":"AAAA;;;;;;;;;;;;2CA8CamB;eAAAA;;mCAjCAd;;;;4CARwD,6CAA6C;uBACzE,iBAAiB;AAE1D,MAAMD,iCAAiC;AAKhC,MAAMC,kCAA8E;IACzF,GAAGJ,iDAAqB;IACxBK,WAAW,GAAGF,+BAA+B,WAAW,CAAC;AAC3D,EAAE;AAEF,MAAMG,gBAAYL,iBAAAA,EAAW;IAC3BM,MAAM;QACJC,SAAS;QACTC,OAAO;QACPC,QAAQ;IACV;IACAC,UAAU;QACRC,eAAe;QACfC,WAAW;IACb;IACAC,YAAY;QACVF,eAAe;QACfG,WAAW;IACb;IACAC,kBAAkB;QAChBJ,eAAe;QACfC,WAAW;IACb;IACAI,oBAAoB;QAClBL,eAAe;QACfG,WAAW;IACb;AACF;AAMO,gDAAgD,CACrDI;IAEA;IAEA,MAAMC,SAASd;IAEf,kCAAkC;QAClCP,yDAAAA,EAA8BoB;IAE9B,MAAME,iBACJF,MAAMG,IAAI,KAAK,eACXH,MAAMI,QAAQ,GACZH,OAAOH,kBAAkB,GACzBG,OAAON,UAAU,GACnBK,MAAMI,QAAQ,GACdH,OAAOJ,gBAAgB,GACvBI,OAAOT,QAAQ;IAErB,uBAAuB;IACvBQ,MAAMd,SAAS,CAACmB,SAAS,OAAGtB,mBAAAA,EAC1BE,gCAAgCC,SAAS,EACzCe,OAAOb,IAAI,EACXc,gBACAF,MAAMd,SAAS,CAACmB,SAAS;IAG3B,OAAOL;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport type { VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { VirtualizerScrollViewSlots } from './VirtualizerScrollView.types';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const virtualizerScrollViewClassNames: SlotClassNames<VirtualizerScrollViewSlots> = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`,\n};\n\nconst useStyles = makeStyles({\n base: {\n display: 'flex',\n width: '100%',\n height: '100%',\n },\n vertical: {\n flexDirection: 'column',\n overflowY: 'auto',\n },\n horizontal: {\n flexDirection: 'row',\n overflowX: 'auto',\n },\n verticalReversed: {\n flexDirection: 'column-reverse',\n overflowY: 'auto',\n },\n horizontalReversed: {\n flexDirection: 'row-reverse',\n overflowX: 'auto',\n },\n});\n\n/**\n * Apply styling to the Virtualizer states\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useVirtualizerScrollViewStyles_unstable = (\n state: VirtualizerScrollViewState,\n): VirtualizerScrollViewState => {\n 'use no memo';\n\n const styles = useStyles();\n\n // Default virtualizer styles base\n useVirtualizerStyles_unstable(state);\n\n const containerStyle =\n state.axis === 'horizontal'\n ? state.reversed\n ? styles.horizontalReversed\n : styles.horizontal\n : state.reversed\n ? styles.verticalReversed\n : styles.vertical;\n\n // Add container styles\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n state.container.className = mergeClasses(\n virtualizerScrollViewClassNames.container,\n styles.base,\n containerStyle,\n state.container.className,\n );\n\n return state;\n};\n"],"names":["useVirtualizerStyles_unstable","virtualizerClassNames","makeStyles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","display","width","height","vertical","flexDirection","overflowY","horizontal","overflowX","verticalReversed","horizontalReversed","useVirtualizerScrollViewStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"mappings":"AAAA;;;;;;;;;;;;2CA8CamB;eAAAA;;mCAjCAd;;;;4CARwD,6CAA6C;uBACzE,iBAAiB;AAE1D,MAAMD,iCAAiC;AAKhC,MAAMC,kCAA8E;IACzF,GAAGJ,iDAAqB;IACxBK,WAAW,GAAGF,+BAA+B,WAAW,CAAC;AAC3D,EAAE;AAEF,MAAMG,gBAAYL,iBAAAA,EAAW;IAC3BM,MAAM;QACJC,SAAS;QACTC,OAAO;QACPC,QAAQ;IACV;IACAC,UAAU;QACRC,eAAe;QACfC,WAAW;IACb;IACAC,YAAY;QACVF,eAAe;QACfG,WAAW;IACb;IACAC,kBAAkB;QAChBJ,eAAe;QACfC,WAAW;IACb;IACAI,oBAAoB;QAClBL,eAAe;QACfG,WAAW;IACb;AACF;AAMO,gDAAgD,CACrDI;IAEA;IAEA,MAAMC,SAASd;IAEf,kCAAkC;QAClCP,yDAAAA,EAA8BoB;IAE9B,MAAME,iBACJF,MAAMG,IAAI,KAAK,eACXH,MAAMI,QAAQ,GACZH,OAAOH,kBAAkB,GACzBG,OAAON,UAAU,GACnBK,MAAMI,QAAQ,GACdH,OAAOJ,gBAAgB,GACvBI,OAAOT,QAAQ;IAErB,uBAAuB;IACvB,iGAAiG;IACjGQ,MAAMd,SAAS,CAACmB,SAAS,OAAGtB,mBAAAA,EAC1BE,gCAAgCC,SAAS,EACzCe,OAAOb,IAAI,EACXc,gBACAF,MAAMd,SAAS,CAACmB,SAAS;IAG3B,OAAOL;AACT,EAAE"}
@@ -52,13 +52,16 @@ function useVirtualizerScrollViewDynamic_unstable(props) {
52
52
  var _contextState_contextIndex;
53
53
  const paginationRef = (0, _useDynamicPagination.useDynamicVirtualizerPagination)({
54
54
  axis,
55
+ // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
55
56
  progressiveItemSizes: (_imperativeVirtualizerRef_current = _imperativeVirtualizerRef.current) === null || _imperativeVirtualizerRef_current === void 0 ? void 0 : _imperativeVirtualizerRef_current.progressiveSizes,
56
57
  virtualizerLength,
57
58
  currentIndex: (_contextState_contextIndex = contextState === null || contextState === void 0 ? void 0 : contextState.contextIndex) !== null && _contextState_contextIndex !== void 0 ? _contextState_contextIndex : 0
58
59
  }, enablePagination);
59
60
  // Store the virtualizer length as a ref for imperative ref access
60
61
  const virtualizerLengthRef = _react.useRef(virtualizerLength);
62
+ // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
61
63
  if (virtualizerLengthRef.current !== virtualizerLength) {
64
+ // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
62
65
  virtualizerLengthRef.current = virtualizerLength;
63
66
  }
64
67
  const scrollViewRef = (0, _reactutilities.useMergedRefs)(props.scrollViewRef, scrollRef, paginationRef);
@@ -118,6 +121,7 @@ function useVirtualizerScrollViewDynamic_unstable(props) {
118
121
  triggers a re-render but is only required on pagination (else index change handles) */ setSizeUpdateCount(measureObject.sizeUpdateCount);
119
122
  }
120
123
  if (axis === 'horizontal') {
124
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
121
125
  sizeTrackingArray = measureObject.widthArray;
122
126
  } else {
123
127
  sizeTrackingArray = measureObject.heightArray;
@@ -126,6 +130,7 @@ function useVirtualizerScrollViewDynamic_unstable(props) {
126
130
  // Auto-measuring is required
127
131
  _react.Children.map(virtualizerState.virtualizedChildren, (child, index)=>{
128
132
  if (/*#__PURE__*/ _react.isValidElement(child)) {
133
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
129
134
  virtualizerState.virtualizedChildren[index] = /*#__PURE__*/ _react.createElement(child.type, {
130
135
  ...child.props,
131
136
  key: child.key,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport type {\n VirtualizerScrollViewDynamicProps,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { useDynamicVirtualizerMeasure } from '../../Hooks';\nimport { useVirtualizerContextState_unstable, scrollToItemDynamic } from '../../Utilities';\nimport type { VirtualizerDataRef } from '../Virtualizer/Virtualizer.types';\nimport { useMeasureList } from '../../hooks/useMeasureList';\nimport type { IndexedResizeCallbackElement } from '../../hooks/useMeasureList';\nimport { useDynamicVirtualizerPagination } from '../../hooks/useDynamicPagination';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport function useVirtualizerScrollViewDynamic_unstable(\n props: VirtualizerScrollViewDynamicProps,\n): VirtualizerScrollViewDynamicState {\n 'use no memo';\n\n const contextState = useVirtualizerContextState_unstable(props.virtualizerContext);\n const {\n imperativeRef,\n axis = 'vertical',\n reversed,\n imperativeVirtualizerRef,\n enablePagination = false,\n bufferItems: _bufferItems,\n bufferSize: _bufferSize,\n } = props;\n\n let sizeTrackingArray = React.useRef<number[]>(new Array(props.numItems).fill(props.itemSize));\n\n // This lets us trigger updates when a size change occurs.\n const [sizeUpdateCount, setSizeUpdateCount] = React.useState(0);\n\n const getChildSizeAuto = React.useCallback(\n (index: number) => {\n if (sizeTrackingArray.current.length <= index || sizeTrackingArray.current[index] <= 0) {\n // Default size for initial state or untracked\n return props.itemSize;\n }\n /* Required to be defined prior to our measure function\n * we use a sizing array ref that we will update post-render\n */\n return sizeTrackingArray.current[index];\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [sizeTrackingArray, props.itemSize, sizeUpdateCount],\n );\n\n const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef, updateScrollPosition } =\n useDynamicVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n getItemSize: props.getItemSize ?? getChildSizeAuto,\n virtualizerContext: contextState,\n numItems: props.numItems,\n bufferItems: _bufferItems,\n bufferSize: _bufferSize,\n });\n\n const _imperativeVirtualizerRef = useMergedRefs(React.useRef<VirtualizerDataRef>(null), imperativeVirtualizerRef);\n\n const paginationRef = useDynamicVirtualizerPagination(\n {\n axis,\n progressiveItemSizes: _imperativeVirtualizerRef.current?.progressiveSizes,\n virtualizerLength,\n currentIndex: contextState?.contextIndex ?? 0,\n },\n enablePagination,\n );\n\n // Store the virtualizer length as a ref for imperative ref access\n const virtualizerLengthRef = React.useRef<number>(virtualizerLength);\n if (virtualizerLengthRef.current !== virtualizerLength) {\n virtualizerLengthRef.current = virtualizerLength;\n }\n const scrollViewRef = useMergedRefs(props.scrollViewRef, scrollRef, paginationRef);\n const scrollCallbackRef = React.useRef<null | ((index: number) => void)>(null);\n\n React.useImperativeHandle(\n imperativeRef,\n () => {\n return {\n scrollTo(index: number, behavior = 'auto', callback: undefined | ((index: number) => void)) {\n scrollCallbackRef.current = callback ?? null;\n if (_imperativeVirtualizerRef.current) {\n const progressiveSizes = _imperativeVirtualizerRef.current.progressiveSizes.current;\n const totalSize =\n progressiveSizes && progressiveSizes?.length > 0\n ? progressiveSizes[Math.max(progressiveSizes.length - 1, 0)]\n : 0;\n\n _imperativeVirtualizerRef.current.setFlaggedIndex(index);\n scrollToItemDynamic({\n index,\n itemSizes: _imperativeVirtualizerRef.current?.nodeSizes,\n totalSize,\n scrollViewRef: scrollViewRef as React.RefObject<HTMLDivElement>,\n axis,\n reversed,\n behavior,\n });\n }\n },\n currentIndex: _imperativeVirtualizerRef.current?.currentIndex,\n virtualizerLength: virtualizerLengthRef,\n };\n },\n [axis, scrollViewRef, reversed, _imperativeVirtualizerRef],\n );\n\n const handleRenderedIndex = (index: number) => {\n if (scrollCallbackRef.current) {\n scrollCallbackRef.current(index);\n }\n };\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n getItemSize: props.getItemSize ?? getChildSizeAuto,\n virtualizerLength,\n bufferItems,\n bufferSize,\n virtualizerContext: contextState,\n imperativeVirtualizerRef: _imperativeVirtualizerRef,\n onRenderedFlaggedIndex: handleRenderedIndex,\n containerSizeRef,\n scrollViewRef,\n updateScrollPosition,\n });\n\n const measureObject = useMeasureList(\n virtualizerState.virtualizerStartIndex,\n virtualizerLength,\n props.numItems,\n props.itemSize,\n );\n\n if (enablePagination && measureObject.sizeUpdateCount !== sizeUpdateCount) {\n /* This enables us to let callback know that the sizes have been updated\n triggers a re-render but is only required on pagination (else index change handles) */\n setSizeUpdateCount(measureObject.sizeUpdateCount);\n }\n\n if (axis === 'horizontal') {\n sizeTrackingArray = measureObject.widthArray;\n } else {\n sizeTrackingArray = measureObject.heightArray;\n }\n\n if (!props.getItemSize) {\n // Auto-measuring is required\n React.Children.map(virtualizerState.virtualizedChildren, (child, index) => {\n if (React.isValidElement(child)) {\n virtualizerState.virtualizedChildren[index] = (\n <child.type\n {...(child.props as Record<string, unknown>)}\n key={child.key}\n ref={(element: HTMLElement & IndexedResizeCallbackElement) => {\n if (child.hasOwnProperty('ref')) {\n // We must access this from the child directly, not props (forward ref).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const localRef = (child as any)?.ref;\n\n if (typeof localRef === 'function') {\n localRef(element);\n } else if (localRef) {\n localRef.current = element;\n }\n }\n\n // Call the auto-measure ref attachment.\n measureObject.createIndexedRef(index)(element);\n }}\n />\n );\n }\n });\n }\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: slot.always(props.container, {\n defaultProps: {\n ref: scrollViewRef,\n },\n elementType: 'div',\n }),\n };\n}\n"],"names":["React","slot","useMergedRefs","useVirtualizer_unstable","useDynamicVirtualizerMeasure","useVirtualizerContextState_unstable","scrollToItemDynamic","useMeasureList","useDynamicVirtualizerPagination","useVirtualizerScrollViewDynamic_unstable","props","_imperativeVirtualizerRef","contextState","virtualizerContext","imperativeRef","axis","reversed","imperativeVirtualizerRef","enablePagination","bufferItems","_bufferItems","bufferSize","_bufferSize","sizeTrackingArray","useRef","Array","numItems","fill","itemSize","sizeUpdateCount","setSizeUpdateCount","useState","getChildSizeAuto","useCallback","index","current","length","virtualizerLength","scrollRef","containerSizeRef","updateScrollPosition","defaultItemSize","direction","getItemSize","paginationRef","progressiveItemSizes","progressiveSizes","currentIndex","contextIndex","virtualizerLengthRef","scrollViewRef","scrollCallbackRef","useImperativeHandle","scrollTo","behavior","callback","totalSize","Math","max","setFlaggedIndex","itemSizes","nodeSizes","handleRenderedIndex","virtualizerState","onRenderedFlaggedIndex","measureObject","virtualizerStartIndex","widthArray","heightArray","Children","map","virtualizedChildren","child","isValidElement","type","key","ref","element","hasOwnProperty","localRef","createIndexedRef","components","container","always","defaultProps","elementType"],"mappings":"AAAA;;;;;+BAmBgBS;;;;;;;iEAjBO,QAAQ;gCACK,4BAA4B;gCACxB,gCAAgC;uBAK3B,cAAc;2BACc,kBAAkB;gCAE5D,6BAA6B;sCAEZ,mCAAmC;AAK5E,kDACLC,KAAwC;IAExC;QAiD0BC;IA/C1B,MAAMC,mBAAeP,8CAAAA,EAAoCK,MAAMG,kBAAkB;IACjF,MAAM,EACJC,aAAa,EACbC,OAA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AAmB,CAACrC,MAAM,GAAA,WAAA,GACzC,OAAA,aAAA,CAACsC,MAAME,IAAI,EAAA;oBACR,GAAIF,MAAM9D,KAAK;oBAChBiE,KAAKH,MAAMG,GAAG;oBACdC,KAAK,CAACC;wBACJ,IAAIL,MAAMM,cAAc,CAAC,QAAQ;4BAC/B,wEAAwE;4BACxE,+DAA+D;4BAC/D,MAAMC,WAAYP,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAeI,GAAG;4BAEpC,IAAI,OAAOG,aAAa,YAAY;gCAClCA,SAASF;4BACX,OAAO,IAAIE,UAAU;gCACnBA,SAAS5C,OAAO,GAAG0C;4BACrB;wBACF;wBAEA,wCAAwC;wBACxCZ,cAAce,gBAAgB,CAAC9C,OAAO2C;oBACxC;;YAGN;QACF;IACF;IAEA,OAAO;QACL,GAAGd,gBAAgB;QACnBkB,YAAY;YACV,GAAGlB,iBAAiBkB,UAAU;YAC9BC,WAAW;QACb;QACAA,WAAWjF,oBAAAA,CAAKkF,MAAM,CAACzE,MAAMwE,SAAS,EAAE;YACtCE,cAAc;gBACZR,KAAK1B;YACP;YACAmC,aAAa;QACf;IACF;AACF"}
1
+ {"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport type {\n VirtualizerScrollViewDynamicProps,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { useDynamicVirtualizerMeasure } from '../../Hooks';\nimport { useVirtualizerContextState_unstable, scrollToItemDynamic } from '../../Utilities';\nimport type { VirtualizerDataRef } from '../Virtualizer/Virtualizer.types';\nimport { useMeasureList } from '../../hooks/useMeasureList';\nimport type { IndexedResizeCallbackElement } from '../../hooks/useMeasureList';\nimport { useDynamicVirtualizerPagination } from '../../hooks/useDynamicPagination';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport function useVirtualizerScrollViewDynamic_unstable(\n props: VirtualizerScrollViewDynamicProps,\n): VirtualizerScrollViewDynamicState {\n 'use no memo';\n\n const contextState = useVirtualizerContextState_unstable(props.virtualizerContext);\n const {\n imperativeRef,\n axis = 'vertical',\n reversed,\n imperativeVirtualizerRef,\n enablePagination = false,\n bufferItems: _bufferItems,\n bufferSize: _bufferSize,\n } = props;\n\n let sizeTrackingArray = React.useRef<number[]>(new Array(props.numItems).fill(props.itemSize));\n\n // This lets us trigger updates when a size change occurs.\n const [sizeUpdateCount, setSizeUpdateCount] = React.useState(0);\n\n const getChildSizeAuto = React.useCallback(\n (index: number) => {\n if (sizeTrackingArray.current.length <= index || sizeTrackingArray.current[index] <= 0) {\n // Default size for initial state or untracked\n return props.itemSize;\n }\n /* Required to be defined prior to our measure function\n * we use a sizing array ref that we will update post-render\n */\n return sizeTrackingArray.current[index];\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [sizeTrackingArray, props.itemSize, sizeUpdateCount],\n );\n\n const { virtualizerLength, bufferItems, bufferSize, scrollRef, containerSizeRef, updateScrollPosition } =\n useDynamicVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n getItemSize: props.getItemSize ?? getChildSizeAuto,\n virtualizerContext: contextState,\n numItems: props.numItems,\n bufferItems: _bufferItems,\n bufferSize: _bufferSize,\n });\n\n const _imperativeVirtualizerRef = useMergedRefs(React.useRef<VirtualizerDataRef>(null), imperativeVirtualizerRef);\n\n const paginationRef = useDynamicVirtualizerPagination(\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n {\n axis,\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n progressiveItemSizes: _imperativeVirtualizerRef.current?.progressiveSizes,\n virtualizerLength,\n currentIndex: contextState?.contextIndex ?? 0,\n },\n enablePagination,\n );\n\n // Store the virtualizer length as a ref for imperative ref access\n const virtualizerLengthRef = React.useRef<number>(virtualizerLength);\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n if (virtualizerLengthRef.current !== virtualizerLength) {\n // eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring\n virtualizerLengthRef.current = virtualizerLength;\n }\n const scrollViewRef = useMergedRefs(props.scrollViewRef, scrollRef, paginationRef);\n const scrollCallbackRef = React.useRef<null | ((index: number) => void)>(null);\n\n React.useImperativeHandle(\n imperativeRef,\n () => {\n return {\n scrollTo(index: number, behavior = 'auto', callback: undefined | ((index: number) => void)) {\n scrollCallbackRef.current = callback ?? null;\n if (_imperativeVirtualizerRef.current) {\n const progressiveSizes = _imperativeVirtualizerRef.current.progressiveSizes.current;\n const totalSize =\n progressiveSizes && progressiveSizes?.length > 0\n ? progressiveSizes[Math.max(progressiveSizes.length - 1, 0)]\n : 0;\n\n _imperativeVirtualizerRef.current.setFlaggedIndex(index);\n scrollToItemDynamic({\n index,\n itemSizes: _imperativeVirtualizerRef.current?.nodeSizes,\n totalSize,\n scrollViewRef: scrollViewRef as React.RefObject<HTMLDivElement>,\n axis,\n reversed,\n behavior,\n });\n }\n },\n currentIndex: _imperativeVirtualizerRef.current?.currentIndex,\n virtualizerLength: virtualizerLengthRef,\n };\n },\n [axis, scrollViewRef, reversed, _imperativeVirtualizerRef],\n );\n\n const handleRenderedIndex = (index: number) => {\n if (scrollCallbackRef.current) {\n scrollCallbackRef.current(index);\n }\n };\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n getItemSize: props.getItemSize ?? getChildSizeAuto,\n virtualizerLength,\n bufferItems,\n bufferSize,\n virtualizerContext: contextState,\n imperativeVirtualizerRef: _imperativeVirtualizerRef,\n onRenderedFlaggedIndex: handleRenderedIndex,\n containerSizeRef,\n scrollViewRef,\n updateScrollPosition,\n });\n\n const measureObject = useMeasureList(\n virtualizerState.virtualizerStartIndex,\n virtualizerLength,\n props.numItems,\n props.itemSize,\n );\n\n if (enablePagination && measureObject.sizeUpdateCount !== sizeUpdateCount) {\n /* This enables us to let callback know that the sizes have been updated\n triggers a re-render but is only required on pagination (else index change handles) */\n setSizeUpdateCount(measureObject.sizeUpdateCount);\n }\n\n if (axis === 'horizontal') {\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n sizeTrackingArray = measureObject.widthArray;\n } else {\n sizeTrackingArray = measureObject.heightArray;\n }\n\n if (!props.getItemSize) {\n // Auto-measuring is required\n React.Children.map(virtualizerState.virtualizedChildren, (child, index) => {\n if (React.isValidElement(child)) {\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n virtualizerState.virtualizedChildren[index] = (\n <child.type\n {...(child.props as Record<string, unknown>)}\n key={child.key}\n ref={(element: HTMLElement & IndexedResizeCallbackElement) => {\n if (child.hasOwnProperty('ref')) {\n // We must access this from the child directly, not props (forward ref).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const localRef = (child as any)?.ref;\n\n if (typeof localRef === 'function') {\n localRef(element);\n } else if (localRef) {\n localRef.current = element;\n }\n }\n\n // Call the auto-measure ref attachment.\n measureObject.createIndexedRef(index)(element);\n }}\n />\n );\n }\n });\n }\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: slot.always(props.container, {\n defaultProps: {\n ref: scrollViewRef,\n },\n elementType: 'div',\n }),\n };\n}\n"],"names":["React","slot","useMergedRefs","useVirtualizer_unstable","useDynamicVirtualizerMeasure","useVirtualizerContextState_unstable","scrollToItemDynamic","useMeasureList","useDynamicVirtualizerPagination","useVirtualizerScrollViewDynamic_unstable","props","_imperativeVirtualizerRef","contextState","virtualizerContext","imperativeRef","axis","reversed","imperativeVirtualizerRef","enablePagination","bufferItems","_bufferItems","bufferSize","_bufferSize","sizeTrackingArray","useRef","Array","numItems","fill","itemSize","sizeUpdateCount","setSizeUpdateCount","useState","getChildSizeAuto","useCallback","index","current","length","virtualizerLength","scrollRef","containerSizeRef","updateScrollPosition","defaultItemSize","direction","getItemSize","paginationRef","progressiveItemSizes","progressiveSizes","currentIndex","contextIndex","virtualizerLengthRef","scrollViewRef","scrollCallbackRef","useImperativeHandle","scrollTo","behavior","callback","totalSize","Math","max","setFlaggedIndex","itemSizes","nodeSizes","handleRenderedIndex","virtualizerState","onRenderedFlaggedIndex","measureObject","virtualizerStartIndex","widthArray","heightArray","Children","map","virtualizedChildren","child","isValidElement","type","key","ref","element","hasOwnProperty","localRef","createIndexedRef","components","container","always","defaultProps","elementType"],"mappings":"AAAA;;;;;+BAmBgBS;;;;;;;iEAjBO,QAAQ;gCACK,4BAA4B;gCACxB,gCAAgC;uBAK3B,cAAc;2BACc,kBAAkB;gCAE5D,6BAA6B;sCAEZ,mCAAmC;AAK5E,kDACLC,KAAwC;IAExC;QAmD0BC;IAjD1B,MAAMC,mBAAeP,8CAAAA,EAAoCK,MAAMG,kBAAkB;IACjF,MAAM,EACJC,aAAa,EACbC,OAAO,UAAU,EACjBC,QAAQ,EACRC,wBAAwB,EACxBC,mBAAmB,KAAK,EACxBC,aAAaC,YAAY,EACzBC,YAAYC,WAAW,EACxB,GAAGZ;IAEJ,IAAIa,oBAAoBvB,OAAMwB,MAAM,CAAW,IAAIC,MAAMf,MAAMgB,QAAQ,EAAEC,IAAI,CAACjB,MAAMkB,QAAQ;IAE5F,0DAA0D;IAC1D,MAAM,CAACC,iBAAiBC,mBAAmB,GAAG9B,OAAM+B,QAAQ,CAAC;IAE7D,MAAMC,mBAAmBhC,OAAMiC,WAAW,CACxC,CAACC;QACC,IAAIX,kBAAkBY,OAAO,CAACC,MAAM,IAAIF,SAASX,kBAAkBY,OAAO,CAACD,MAAM,IAAI,GAAG;YACtF,8CAA8C;YAC9C,OAAOxB,MAAMkB,QAAQ;QACvB;QACA;;OAEC,GACD,OAAOL,kBAAkBY,OAAO,CAACD,MAAM;IACzC,GACA,AACA,uDADuD;QACtDX;QAAmBb,MAAMkB,QAAQ;QAAEC;K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;QACnBkB,YAAY;YACV,GAAGlB,iBAAiBkB,UAAU;YAC9BC,WAAW;QACb;QACAA,WAAWjF,oBAAAA,CAAKkF,MAAM,CAACzE,MAAMwE,SAAS,EAAE;YACtCE,cAAc;gBACZR,KAAK1B;YACP;YACAmC,aAAa;QACf;IACF;AACF"}
@@ -66,6 +66,7 @@ const useVirtualizerScrollViewDynamicStyles_unstable = (state)=>{
66
66
  (0, _useVirtualizerStylesstyles.useVirtualizerStyles_unstable)(state);
67
67
  const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
68
68
  // Add container styles
69
+ // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
69
70
  state.container.className = (0, _react.mergeClasses)(virtualizerScrollViewDynamicClassNames.container, styles.base, containerStyle, state.container.className);
70
71
  return state;
71
72
  };