@fluentui/react-virtualizer 9.0.0-alpha.18 → 9.0.0-alpha.19

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 (94) hide show
  1. package/CHANGELOG.json +49 -2
  2. package/CHANGELOG.md +16 -3
  3. package/dist/index.d.ts +93 -10
  4. package/lib/Utilities.js +2 -0
  5. package/lib/Utilities.js.map +1 -0
  6. package/lib/VirtualizerScrollViewDynamic.js +2 -0
  7. package/lib/VirtualizerScrollViewDynamic.js.map +1 -0
  8. package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
  9. package/lib/components/Virtualizer/renderVirtualizer.js +6 -0
  10. package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
  11. package/lib/components/Virtualizer/useVirtualizer.js +35 -32
  12. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  13. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +2 -1
  14. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -1
  15. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +14 -0
  16. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
  17. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +2 -0
  18. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
  19. package/lib/components/VirtualizerScrollViewDynamic/index.js +6 -0
  20. package/lib/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
  21. package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +11 -0
  22. package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
  23. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +44 -0
  24. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
  25. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.js +46 -0
  26. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.js.map +1 -0
  27. package/lib/hooks/hooks.types.js +2 -0
  28. package/lib/hooks/hooks.types.js.map +1 -0
  29. package/lib/hooks/index.js +3 -0
  30. package/lib/hooks/index.js.map +1 -1
  31. package/lib/hooks/useDynamicVirtualizerMeasure.js +99 -0
  32. package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
  33. package/lib/hooks/useResizeObserverRef.js +40 -0
  34. package/lib/hooks/useResizeObserverRef.js.map +1 -0
  35. package/lib/hooks/useVirtualizerMeasure.js +6 -29
  36. package/lib/hooks/useVirtualizerMeasure.js.map +1 -1
  37. package/lib/index.js +3 -1
  38. package/lib/index.js.map +1 -1
  39. package/lib/utilities/VirtualizerContext/VirtualizerContext.js +27 -0
  40. package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
  41. package/lib/utilities/VirtualizerContext/index.js +3 -0
  42. package/lib/utilities/VirtualizerContext/index.js.map +1 -0
  43. package/lib/utilities/VirtualizerContext/types.js +4 -0
  44. package/lib/utilities/VirtualizerContext/types.js.map +1 -0
  45. package/lib/utilities/index.js +2 -0
  46. package/lib/utilities/index.js.map +1 -0
  47. package/lib-commonjs/Utilities.js +9 -0
  48. package/lib-commonjs/Utilities.js.map +1 -0
  49. package/lib-commonjs/VirtualizerScrollViewDynamic.js +9 -0
  50. package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -0
  51. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +15 -3
  52. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
  53. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +35 -30
  54. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
  55. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +2 -1
  56. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -1
  57. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +21 -0
  58. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
  59. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +7 -0
  60. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
  61. package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js +13 -0
  62. package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
  63. package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +17 -0
  64. package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
  65. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +49 -0
  66. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
  67. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.js +69 -0
  68. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.js.map +1 -0
  69. package/lib-commonjs/hooks/hooks.types.js +7 -0
  70. package/lib-commonjs/hooks/hooks.types.js.map +1 -0
  71. package/lib-commonjs/hooks/index.js +3 -0
  72. package/lib-commonjs/hooks/index.js.map +1 -1
  73. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +107 -0
  74. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
  75. package/lib-commonjs/hooks/useResizeObserverRef.js +51 -0
  76. package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -0
  77. package/lib-commonjs/hooks/useVirtualizerMeasure.js +7 -29
  78. package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -1
  79. package/lib-commonjs/index.js +12 -1
  80. package/lib-commonjs/index.js.map +1 -1
  81. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +48 -0
  82. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
  83. package/lib-commonjs/utilities/VirtualizerContext/index.js +10 -0
  84. package/lib-commonjs/utilities/VirtualizerContext/index.js.map +1 -0
  85. package/lib-commonjs/utilities/VirtualizerContext/types.js +9 -0
  86. package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -0
  87. package/lib-commonjs/utilities/index.js +9 -0
  88. package/lib-commonjs/utilities/index.js.map +1 -0
  89. package/package.json +4 -4
  90. package/.swcrc +0 -30
  91. package/lib/hooks/useVirtualizerMeasure.types.js +0 -2
  92. package/lib/hooks/useVirtualizerMeasure.types.js.map +0 -1
  93. package/lib-commonjs/hooks/useVirtualizerMeasure.types.js +0 -7
  94. package/lib-commonjs/hooks/useVirtualizerMeasure.types.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["React","canUseDOM","debounce","useStaticVirtualizerMeasure","virtualizerProps","defaultItemSize","direction","state","setState","useState","virtualizerLength","bufferSize","bufferItems","container","useRef","resizeCallback","current","containerSize","getBoundingClientRect","height","width","length","Math","ceil","newBufferItems","max","floor","newBufferSize","totalLength","handleResize","resizeObserver","ResizeObserver","undefined","useEffect","disconnect","scrollRef","useCallback","el","unobserve","observe"],"sources":["../../src/hooks/useVirtualizerMeasure.ts"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { VirtualizerMeasureProps } from './useVirtualizerMeasure.types';\nimport { debounce } from '../utilities/debounce';\n\n/**\n * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.\n */\nexport const useStaticVirtualizerMeasure = (\n virtualizerProps: VirtualizerMeasureProps,\n): {\n virtualizerLength: number;\n bufferItems: number;\n bufferSize: number;\n scrollRef: (instance: HTMLElement | HTMLDivElement | null) => void;\n} => {\n const { defaultItemSize, direction = 'vertical' } = virtualizerProps;\n\n const [state, setState] = React.useState({\n virtualizerLength: 0,\n bufferSize: 0,\n bufferItems: 0,\n });\n\n const { virtualizerLength, bufferItems, bufferSize } = state;\n\n // The ref the user sets on their scrollView - Defaults to document.body to ensure no null on init\n const container = React.useRef<HTMLElement | null>(null);\n\n const resizeCallback = () => {\n if (!container.current) {\n return;\n }\n\n const containerSize =\n direction === 'vertical'\n ? container.current.getBoundingClientRect().height\n : container.current.getBoundingClientRect().width;\n\n /*\n * Number of items required to cover viewport.\n */\n const length = Math.ceil(containerSize / defaultItemSize + 1);\n\n /*\n * Number of items to append at each end, i.e. 'preload' each side before entering view.\n */\n const newBufferItems = Math.max(Math.floor(length / 4), 2);\n\n /*\n * This is how far we deviate into the bufferItems to detect a redraw.\n */\n const newBufferSize = Math.max(Math.floor((length / 8) * defaultItemSize), 1);\n\n const totalLength = length + newBufferItems * 2 + 1;\n\n setState({\n virtualizerLength: totalLength,\n bufferItems: newBufferItems,\n bufferSize: newBufferSize,\n });\n };\n\n // the handler for resize observer\n const handleResize = debounce(resizeCallback);\n\n // Keep the reference of ResizeObserver in the state, as it should live through renders\n const [resizeObserver] = React.useState(canUseDOM() ? new ResizeObserver(handleResize) : undefined);\n\n React.useEffect(() => {\n return () => {\n resizeObserver?.disconnect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const scrollRef = React.useCallback(\n (el: HTMLElement | null) => {\n if (container.current !== el) {\n if (container.current) {\n resizeObserver?.unobserve(container.current);\n }\n\n container.current = el;\n if (container.current) {\n resizeObserver?.observe(container.current);\n }\n }\n },\n [resizeObserver],\n );\n\n return {\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollRef,\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,QAAQ;AAE1B,SAASC,QAAQ,QAAQ;AAEzB;;;AAGA,OAAO,MAAMC,2BAAA,GACXC,gBAAA,IAMG;EACH,MA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gBG,SAAS;EAElGhC,KAAA,CAAMiC,SAAS,CAAC,MAAM;IACpB,OAAO,MAAM;MACXH,cAAA,aAAAA,cAAA,uBAAAA,cAAA,CAAgBI,UAAU;IAC5B;IACA;EACF,GAAG,EAAE;EAEL,MAAMC,SAAA,GAAYnC,KAAA,CAAMoC,WAAW,CAChCC,EAAA,IAA2B;IAC1B,IAAIxB,SAAA,CAAUG,OAAO,KAAKqB,EAAA,EAAI;MAC5B,IAAIxB,SAAA,CAAUG,OAAO,EAAE;QACrBc,cAAA,aAAAA,cAAA,uBAAAA,cAAA,CAAgBQ,SAAS,CAACzB,SAAA,CAAUG,OAAO;MAC7C;MAEAH,SAAA,CAAUG,OAAO,GAAGqB,EAAA;MACpB,IAAIxB,SAAA,CAAUG,OAAO,EAAE;QACrBc,cAAA,aAAAA,cAAA,uBAAAA,cAAA,CAAgBS,OAAO,CAAC1B,SAAA,CAAUG,OAAO;MAC3C;IACF;EACF,GACA,CAACc,cAAA,CAAe;EAGlB,OAAO;IACLpB,iBAAA;IACAE,WAAA;IACAD,UAAA;IACAwB;EACF;AACF"}
1
+ {"version":3,"names":["React","useResizeObserverRef_unstable","useStaticVirtualizerMeasure","virtualizerProps","defaultItemSize","direction","state","setState","useState","virtualizerLength","bufferSize","bufferItems","resizeCallback","useCallback","_entries","_observer","scrollRef","current","containerSize","getBoundingClientRect","height","width","length","Math","ceil","newBufferItems","max","floor","newBufferSize","totalLength"],"sources":["../../src/hooks/useVirtualizerMeasure.ts"],"sourcesContent":["import * as React from 'react';\nimport { VirtualizerMeasureProps } from './hooks.types';\nimport { useResizeObserverRef_unstable } from './useResizeObserverRef';\n\n/**\n * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.\n */\nexport const useStaticVirtualizerMeasure = <TElement extends HTMLElement>(\n virtualizerProps: VirtualizerMeasureProps,\n): {\n virtualizerLength: number;\n bufferItems: number;\n bufferSize: number;\n scrollRef: (instance: TElement | null) => void;\n} => {\n const { defaultItemSize, direction = 'vertical' } = virtualizerProps;\n\n const [state, setState] = React.useState({\n virtualizerLength: 0,\n bufferSize: 0,\n bufferItems: 0,\n });\n\n const { virtualizerLength, bufferItems, bufferSize } = state;\n\n const resizeCallback = React.useCallback(\n (\n _entries: ResizeObserverEntry[],\n _observer: ResizeObserver,\n scrollRef?: React.MutableRefObject<HTMLElement | null>,\n ) => {\n if (!scrollRef?.current) {\n return;\n }\n\n const containerSize =\n direction === 'vertical'\n ? scrollRef?.current.getBoundingClientRect().height\n : scrollRef?.current.getBoundingClientRect().width;\n\n /*\n * Number of items required to cover viewport.\n */\n const length = Math.ceil(containerSize / defaultItemSize + 1);\n\n /*\n * Number of items to append at each end, i.e. 'preload' each side before entering view.\n */\n const newBufferItems = Math.max(Math.floor(length / 4), 2);\n\n /*\n * This is how far we deviate into the bufferItems to detect a redraw.\n */\n const newBufferSize = Math.max(Math.floor((length / 8) * defaultItemSize), 1);\n\n const totalLength = length + newBufferItems * 2 + 1;\n\n setState({\n virtualizerLength: totalLength,\n bufferItems: newBufferItems,\n bufferSize: newBufferSize,\n });\n },\n [defaultItemSize, direction],\n );\n\n const scrollRef = useResizeObserverRef_unstable(resizeCallback);\n\n return {\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollRef,\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAEvB,SAASC,6BAA6B,QAAQ;AAE9C;;;AAGA,OAAO,MAAMC,2BAAA,GACXC,gBAAA,IAMG;EACH,MAAM;IAAEC,eAAA;IAAiBC,SAAA,GAAY;EAAU,CAAE,GAAGF,gBAAA;EAEpD,MAAM,CAACG,KAAA,EAAOC,QAAA,CAAS,GAAGP,KAAA,CAAMQ,QAAQ,CAAC;IACvCC,iBAAA,EAAmB;IACnBC,UAAA,EAAY;IACZC,WAAA,EAAa;EACf;EAEA,MAAM;IAAEF,iBAAA;IAAmBE,WAAA;IAAaD;EAAU,CAAE,GAAGJ,KAAA;EAEvD,MAAMM,cAAA,GAAiBZ,KAAA,CAAMa,WAAW,CACtC,CACEC,QAAA,EACAC,SAAA,EACAC,SAAA,KACG;IACH,IAAI,EAACA,SAAA,aAAAA,SAAA,uBAAAA,SAAA,CAAWC,OAAO,CAAD,EAAG;MACvB;IACF;IAEA,MAAMC,aAAA,GACJb,SAAA,KAAc,aACVW,SAAA,aAAAA,SAAA,uBAAAA,SAAA,CAAWC,OAAO,CAACE,qBAAqB,GAAGC,MAAM,GACjDJ,SAAA,aAAAA,SAAA,uBAAAA,SAAA,CAAWC,OAAO,CAACE,qBAAqB,GAAGE,KAAK;IAEtD;;;IAGA,MAAMC,MAAA,GAASC,IAAA,CAAKC,IAAI,CAACN,aAAA,GAAgBd,eAAA,GAAkB;IAE3D;;;IAGA,MAAMqB,cAAA,GAAiBF,IAAA,CAAKG,GAAG,CAACH,IAAA,CAAKI,KAAK,CAACL,MAAA,GAAS,IAAI;IAExD;;;IAGA,MAAMM,aAAA,GAAgBL,IAAA,CAAKG,GAAG,CAACH,IAAA,CAAKI,KAAK,CAACL,MAAC,GAAS,IAAKlB,eAAA,GAAkB;IAE3E,MAAMyB,WAAA,GAAcP,MAAA,GAASG,cAAA,GAAiB,IAAI;IAElDlB,QAAA,CAAS;MACPE,iBAAA,EAAmBoB,WAAA;MACnBlB,WAAA,EAAac,cAAA;MACbf,UAAA,EAAYkB;IACd;EACF,GACA,CAACxB,eAAA,EAAiBC,SAAA,CAAU;EAG9B,MAAMW,SAAA,GAAYf,6BAAA,CAA8BW,cAAA;EAEhD,OAAO;IACLH,iBAAA;IACAE,WAAA;IACAD,UAAA;IACAM;EACF;AACF"}
package/lib/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export { Virtualizer, virtualizerClassNames, useVirtualizer_unstable, renderVirtualizer_unstable, useVirtualizerStyles_unstable } from './Virtualizer';
2
- export { useIntersectionObserver, useStaticVirtualizerMeasure } from './Hooks';
2
+ export { useIntersectionObserver, useStaticVirtualizerMeasure, useDynamicVirtualizerMeasure, useResizeObserverRef_unstable } from './Hooks';
3
+ export { VirtualizerContextProvider, useVirtualizerContext_unstable } from './Utilities';
3
4
  export { VirtualizerScrollView, virtualizerScrollViewClassNames, useVirtualizerScrollView_unstable, renderVirtualizerScrollView_unstable, useVirtualizerScrollViewStyles_unstable } from './VirtualizerScrollView';
5
+ export { VirtualizerScrollViewDynamic, virtualizerScrollViewDynamicClassNames, useVirtualizerScrollViewDynamic_unstable, renderVirtualizerScrollViewDynamic_unstable, useVirtualizerScrollViewDynamicStyles_unstable } from './VirtualizerScrollViewDynamic';
4
6
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Virtualizer","virtualizerClassNames","useVirtualizer_unstable","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useIntersectionObserver","useStaticVirtualizerMeasure","VirtualizerScrollView","virtualizerScrollViewClassNames","useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable"],"sources":["../src/index.ts"],"sourcesContent":["export {\n Virtualizer,\n virtualizerClassNames,\n useVirtualizer_unstable,\n renderVirtualizer_unstable,\n useVirtualizerStyles_unstable,\n} from './Virtualizer';\nexport type {\n VirtualizerProps,\n VirtualizerState,\n VirtualizerSlots,\n VirtualizerChildRenderFunction,\n} from './Virtualizer';\nexport { useIntersectionObserver, useStaticVirtualizerMeasure } from './Hooks';\n\nexport {\n VirtualizerScrollView,\n virtualizerScrollViewClassNames,\n useVirtualizerScrollView_unstable,\n renderVirtualizerScrollView_unstable,\n useVirtualizerScrollViewStyles_unstable,\n} from './VirtualizerScrollView';\n\nexport type {\n VirtualizerScrollViewProps,\n VirtualizerScrollViewState,\n VirtualizerScrollViewSlots,\n} from './VirtualizerScrollView';\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,6BAA6B,QACxB;AAOP,SAASC,uBAAuB,EAAEC,2BAA2B,QAAQ;AAErE,SACEC,qBAAqB,EACrBC,+BAA+B,EAC/BC,iCAAiC,EACjCC,oCAAoC,EACpCC,uCAAuC,QAClC"}
1
+ {"version":3,"names":["Virtualizer","virtualizerClassNames","useVirtualizer_unstable","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useIntersectionObserver","useStaticVirtualizerMeasure","useDynamicVirtualizerMeasure","useResizeObserverRef_unstable","VirtualizerContextProvider","useVirtualizerContext_unstable","VirtualizerScrollView","virtualizerScrollViewClassNames","useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable","VirtualizerScrollViewDynamic","virtualizerScrollViewDynamicClassNames","useVirtualizerScrollViewDynamic_unstable","renderVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable"],"sources":["../src/index.ts"],"sourcesContent":["export {\n Virtualizer,\n virtualizerClassNames,\n useVirtualizer_unstable,\n renderVirtualizer_unstable,\n useVirtualizerStyles_unstable,\n} from './Virtualizer';\nexport type {\n VirtualizerProps,\n VirtualizerState,\n VirtualizerSlots,\n VirtualizerChildRenderFunction,\n} from './Virtualizer';\n\nexport {\n useIntersectionObserver,\n useStaticVirtualizerMeasure,\n useDynamicVirtualizerMeasure,\n useResizeObserverRef_unstable,\n} from './Hooks';\n\nexport type { ResizeCallbackWithRef, VirtualizerMeasureDynamicProps, VirtualizerMeasureProps } from './Hooks';\n\nexport { VirtualizerContextProvider, useVirtualizerContext_unstable } from './Utilities';\n\nexport type { VirtualizerContextProps } from './Utilities';\n\nexport {\n VirtualizerScrollView,\n virtualizerScrollViewClassNames,\n useVirtualizerScrollView_unstable,\n renderVirtualizerScrollView_unstable,\n useVirtualizerScrollViewStyles_unstable,\n} from './VirtualizerScrollView';\n\nexport type {\n VirtualizerScrollViewProps,\n VirtualizerScrollViewState,\n VirtualizerScrollViewSlots,\n} from './VirtualizerScrollView';\n\nexport {\n VirtualizerScrollViewDynamic,\n virtualizerScrollViewDynamicClassNames,\n useVirtualizerScrollViewDynamic_unstable,\n renderVirtualizerScrollViewDynamic_unstable,\n useVirtualizerScrollViewDynamicStyles_unstable,\n} from './VirtualizerScrollViewDynamic';\n\nexport type {\n VirtualizerScrollViewDynamicProps,\n VirtualizerScrollViewDynamicState,\n VirtualizerScrollViewDynamicSlots,\n} from './VirtualizerScrollViewDynamic';\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,6BAA6B,QACxB;AAQP,SACEC,uBAAuB,EACvBC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,6BAA6B,QACxB;AAIP,SAASC,0BAA0B,EAAEC,8BAA8B,QAAQ;AAI3E,SACEC,qBAAqB,EACrBC,+BAA+B,EAC/BC,iCAAiC,EACjCC,oCAAoC,EACpCC,uCAAuC,QAClC;AAQP,SACEC,4BAA4B,EAC5BC,sCAAsC,EACtCC,wCAAwC,EACxCC,2CAA2C,EAC3CC,8CAA8C,QACzC"}
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import { useMemo, useState } from 'react';
3
+ const VirtualizerContext = /*#__PURE__*/React.createContext(undefined);
4
+ export const VirtualizerContextProvider = VirtualizerContext.Provider;
5
+ export const useVirtualizerContext_unstable = () => {
6
+ return React.useContext(VirtualizerContext);
7
+ };
8
+ export const useVirtualizerContextState_unstable = passedContext => {
9
+ const virtualizerContext = useVirtualizerContext_unstable();
10
+ const [_contextIndex, _setContextIndex] = useState(-1);
11
+ var _ref;
12
+ /* We respect any wrapped providers while also ensuring defaults or passed through
13
+ * Order of usage -> Passed Prop -> Provider Context -> Internal State default
14
+ */
15
+ const _context = useMemo(() => (_ref = passedContext !== null && passedContext !== void 0 ? passedContext : virtualizerContext) !== null && _ref !== void 0 ? _ref : {
16
+ contextIndex: _contextIndex,
17
+ setContextIndex: _setContextIndex
18
+ }, [_contextIndex, passedContext, virtualizerContext]);
19
+ const context = useMemo(() => {
20
+ return {
21
+ contextIndex: _context.contextIndex,
22
+ setContextIndex: _context.setContextIndex
23
+ };
24
+ }, [_context]);
25
+ return context;
26
+ };
27
+ //# sourceMappingURL=VirtualizerContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useMemo","useState","VirtualizerContext","createContext","undefined","VirtualizerContextProvider","Provider","useVirtualizerContext_unstable","useContext","useVirtualizerContextState_unstable","passedContext","virtualizerContext","_contextIndex","_setContextIndex","_ref","_context","contextIndex","setContextIndex","context"],"sources":["../../../src/utilities/VirtualizerContext/VirtualizerContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { VirtualizerContextProps } from './types';\nimport { useMemo, useState } from 'react';\n\nconst VirtualizerContext = React.createContext<VirtualizerContextProps | undefined>(\n undefined,\n) as React.Context<VirtualizerContextProps>;\n\nexport const VirtualizerContextProvider = VirtualizerContext.Provider;\n\nexport const useVirtualizerContext_unstable = () => {\n return React.useContext(VirtualizerContext);\n};\n\nexport const useVirtualizerContextState_unstable = (\n passedContext?: VirtualizerContextProps,\n): VirtualizerContextProps => {\n const virtualizerContext = useVirtualizerContext_unstable();\n const [_contextIndex, _setContextIndex] = useState<number>(-1);\n\n /* We respect any wrapped providers while also ensuring defaults or passed through\n * Order of usage -> Passed Prop -> Provider Context -> Internal State default\n */\n const _context = useMemo(\n () => passedContext ?? virtualizerContext ?? { contextIndex: _contextIndex, setContextIndex: _setContextIndex },\n [_contextIndex, passedContext, virtualizerContext],\n );\n const context = useMemo(() => {\n return { contextIndex: _context.contextIndex, setContextIndex: _context.setContextIndex };\n }, [_context]);\n\n return context;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAEvB,SAASC,OAAO,EAAEC,QAAQ,QAAQ;AAElC,MAAMC,kBAAA,gBAAqBH,KAAA,CAAMI,aAAa,CAC5CC,SAAA;AAGF,OAAO,MAAMC,0BAAA,GAA6BH,kBAAA,CAAmBI,QAAQ;AAErE,OAAO,MAAMC,8BAAA,GAAiCA,CAAA,KAAM;EAClD,OAAOR,KAAA,CAAMS,UAAU,CAACN,kBAAA;AAC1B;AAEA,OAAO,MAAMO,mCAAA,GACXC,aAAA,IAC4B;EAC5B,MAAMC,kBAAA,GAAqBJ,8BAAA;EAC3B,MAAM,CAACK,aAAA,EAAeC,gBAAA,CAAiB,GAAGZ,QAAA,CAAiB,CAAC;MAMpDa,IAAA;EAJR;;;EAGA,MAAMC,QAAA,GAAWf,OAAA,CACf,MAAM,CAAAc,IAAA,GAAAJ,aAAA,aAAAA,aAAA,cAAAA,aAAA,GAAiBC,kBAAkB,cAAnCG,IAAA,cAAAA,IAAA,GAAuC;IAAEE,YAAA,EAAcJ,aAAA;IAAeK,eAAA,EAAiBJ;EAAiB,CAAC,EAC/G,CAACD,aAAA,EAAeF,aAAA,EAAeC,kBAAA,CAAmB;EAEpD,MAAMO,OAAA,GAAUlB,OAAA,CAAQ,MAAM;IAC5B,OAAO;MAAEgB,YAAA,EAAcD,QAAA,CAASC,YAAY;MAAEC,eAAA,EAAiBF,QAAA,CAASE;IAAgB;EAC1F,GAAG,CAACF,QAAA,CAAS;EAEb,OAAOG,OAAA;AACT"}
@@ -0,0 +1,3 @@
1
+ export * from './VirtualizerContext';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/utilities/VirtualizerContext/index.ts"],"sourcesContent":["export * from './VirtualizerContext';\nexport * from './types';\n"],"mappings":"AAAA,cAAc;AACd,cAAc"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * {@docCategory Virtualizer}
3
+ */export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/utilities/VirtualizerContext/types.ts"],"sourcesContent":["/**\n * {@docCategory Virtualizer}\n */\nexport type VirtualizerContextProps = {\n contextIndex: number;\n setContextIndex: (index: number) => void;\n};\n"],"mappings":"AAAA;;GAGA"}
@@ -0,0 +1,2 @@
1
+ export * from './VirtualizerContext';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/utilities/index.ts"],"sourcesContent":["export * from './VirtualizerContext';\n"],"mappings":"AAAA,cAAc"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./utilities/index"), exports);
7
+ //# sourceMappingURL=Utilities.js.map
8
+
9
+ //# sourceMappingURL=Utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../lib/Utilities.js"],"sourcesContent":["export * from './utilities/index';\n//# sourceMappingURL=Utilities.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,qCAAqC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./components/VirtualizerScrollViewDynamic/index"), exports);
7
+ //# sourceMappingURL=VirtualizerScrollViewDynamic.js.map
8
+
9
+ //# sourceMappingURL=VirtualizerScrollViewDynamic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../lib/VirtualizerScrollViewDynamic.js"],"sourcesContent":["export * from './components/VirtualizerScrollViewDynamic/index';\n//# sourceMappingURL=VirtualizerScrollViewDynamic.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,wDAAwD"}
@@ -2,9 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "renderVirtualizer_unstable", {
6
- enumerable: true,
7
- get: ()=>renderVirtualizer_unstable
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ renderVirtualizer_unstable: ()=>renderVirtualizer_unstable,
13
+ renderVirtualizerChildPlaceholder: ()=>renderVirtualizerChildPlaceholder
8
14
  });
9
15
  const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
16
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
@@ -13,6 +19,12 @@ const _reactUtilities = require("@fluentui/react-utilities");
13
19
  const renderVirtualizer_unstable = (state)=>{
14
20
  const { slots , slotProps } = (0, _reactUtilities.getSlotsNext)(state);
15
21
  return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_react.Fragment, null, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.beforeContainer, slotProps.beforeContainer, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.before, slotProps.before)), state.virtualizedChildren, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.afterContainer, slotProps.afterContainer, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.after, slotProps.after)));
22
+ };
23
+ const renderVirtualizerChildPlaceholder = (child, index)=>{
24
+ return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_react.Suspense, {
25
+ key: `fui-virtualizer-placeholder-${index}`,
26
+ fallback: null
27
+ }, child);
16
28
  }; //# sourceMappingURL=renderVirtualizer.js.map
17
29
 
18
30
  //# sourceMappingURL=renderVirtualizer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Virtualizer/renderVirtualizer.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */import * as React from 'react';\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nexport const renderVirtualizer_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlotsNext(state);\n return /*#__PURE__*/createElement(React.Fragment, null, /*#__PURE__*/createElement(slots.beforeContainer, slotProps.beforeContainer, /*#__PURE__*/createElement(slots.before, slotProps.before)), state.virtualizedChildren, /*#__PURE__*/createElement(slots.afterContainer, slotProps.afterContainer, /*#__PURE__*/createElement(slots.after, slotProps.after)));\n};\n//# sourceMappingURL=renderVirtualizer.js.map"],"names":["renderVirtualizer_unstable","state","slots","slotProps","getSlotsNext","createElement","React","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;+BAGrCA;;aAAAA;;;6DAH8D;iCAC7C;gCACD;AACtB,MAAMA,6BAA6BC,CAAAA,QAAS;IACjD,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,4BAAY,EAACH;IACjB,OAAO,WAAW,GAAEI,IAAAA,8BAAa,EAACC,OAAMC,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAEF,IAAAA,8BAAa,EAACH,MAAMM,eAAe,EAAEL,UAAUK,eAAe,EAAE,WAAW,GAAEH,IAAAA,8BAAa,EAACH,MAAMO,MAAM,EAAEN,UAAUM,MAAM,IAAIR,MAAMS,mBAAmB,EAAE,WAAW,GAAEL,IAAAA,8BAAa,EAACH,MAAMS,cAAc,EAAER,UAAUQ,cAAc,EAAE,WAAW,GAAEN,IAAAA,8BAAa,EAACH,MAAMU,KAAK,EAAET,UAAUS,KAAK;AACjW,GACA,6CAA6C"}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/renderVirtualizer.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsx createElement */import * as React from 'react';\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nexport const renderVirtualizer_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlotsNext(state);\n return /*#__PURE__*/createElement(React.Fragment, null, /*#__PURE__*/createElement(slots.beforeContainer, slotProps.beforeContainer, /*#__PURE__*/createElement(slots.before, slotProps.before)), state.virtualizedChildren, /*#__PURE__*/createElement(slots.afterContainer, slotProps.afterContainer, /*#__PURE__*/createElement(slots.after, slotProps.after)));\n};\nexport const renderVirtualizerChildPlaceholder = (child, index) => {\n return /*#__PURE__*/createElement(React.Suspense, {\n key: `fui-virtualizer-placeholder-${index}`,\n fallback: null\n }, child);\n};\n//# sourceMappingURL=renderVirtualizer.js.map"],"names":["renderVirtualizer_unstable","renderVirtualizerChildPlaceholder","state","slots","slotProps","getSlotsNext","createElement","React","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","child","index","Suspense","key","fallback"],"mappings":"AAAA,wBAAwB,GAAG,uBAAuB;;;;;;;;;;;IAGrCA,0BAA0B,MAA1BA;IAOAC,iCAAiC,MAAjCA;;;6DAV8D;iCAC7C;gCACD;AACtB,MAAMD,6BAA6BE,CAAAA,QAAS;IACjD,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,4BAAY,EAACH;IACjB,OAAO,WAAW,GAAEI,IAAAA,8BAAa,EAACC,OAAMC,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAEF,IAAAA,8BAAa,EAACH,MAAMM,eAAe,EAAEL,UAAUK,eAAe,EAAE,WAAW,GAAEH,IAAAA,8BAAa,EAACH,MAAMO,MAAM,EAAEN,UAAUM,MAAM,IAAIR,MAAMS,mBAAmB,EAAE,WAAW,GAAEL,IAAAA,8BAAa,EAACH,MAAMS,cAAc,EAAER,UAAUQ,cAAc,EAAE,WAAW,GAAEN,IAAAA,8BAAa,EAACH,MAAMU,KAAK,EAAET,UAAUS,KAAK;AACjW;AACO,MAAMZ,oCAAoC,CAACa,OAAOC,QAAU;IACjE,OAAO,WAAW,GAAET,IAAAA,8BAAa,EAACC,OAAMS,QAAQ,EAAE;QAChDC,KAAK,CAAC,4BAA4B,EAAEF,MAAM,CAAC;QAC3CG,UAAU,IAAI;IAChB,GAAGJ;AACL,GACA,6CAA6C"}
@@ -10,10 +10,13 @@ const _useIntersectionObserver = require("../../hooks/useIntersectionObserver");
10
10
  const _react = require("react");
11
11
  const _reactUtilities = require("@fluentui/react-utilities");
12
12
  const _reactDom = require("react-dom");
13
+ const _utilities = require("../../Utilities");
14
+ const _renderVirtualizer = require("./renderVirtualizer");
13
15
  function useVirtualizer_unstable(props) {
14
- const { itemSize , numItems , virtualizerLength , children: renderChild , getItemSize , bufferItems =Math.round(virtualizerLength / 4.0) , bufferSize =Math.floor(bufferItems / 2.0) * itemSize , scrollViewRef , axis ='vertical' , reversed =false , onUpdateIndex , onCalculateIndex } = props;
15
- // Tracks the initial item to start virtualizer at, -1 implies first render cycle
16
- const [virtualizerStartIndex, setVirtualizerStartIndex] = (0, _react.useState)(-1);
16
+ const { itemSize , numItems , virtualizerLength , children: renderChild , getItemSize , bufferItems =Math.round(virtualizerLength / 4.0) , bufferSize =Math.floor(bufferItems / 2.0) * itemSize , scrollViewRef , axis ='vertical' , reversed =false , virtualizerContext } = props;
17
+ /* The context is optional, it's useful for injecting additional index logic, or performing uniform state updates*/ const _virtualizerContext = (0, _utilities.useVirtualizerContextState_unstable)(virtualizerContext);
18
+ const actualIndex = _virtualizerContext.contextIndex;
19
+ const setActualIndex = _virtualizerContext.setContextIndex;
17
20
  // Store ref to before padding element
18
21
  const beforeElementRef = (0, _react.useRef)(null);
19
22
  // Store ref to before padding element
@@ -49,16 +52,15 @@ function useVirtualizer_unstable(props) {
49
52
  };
50
53
  const batchUpdateNewIndex = (index)=>{
51
54
  // Local updates
52
- onUpdateIndex === null || onUpdateIndex === void 0 ? void 0 : onUpdateIndex(index, virtualizerStartIndex);
53
55
  updateChildRows(index);
54
56
  updateCurrentItemSizes(index);
55
57
  // State setters
56
- setVirtualizerStartIndex(index);
58
+ setActualIndex(index);
57
59
  };
58
60
  // Observe intersections of virtualized components
59
61
  const { setObserverList } = (0, _useIntersectionObserver.useIntersectionObserver)((entries, observer)=>{
60
62
  /* Sanity check - do we even need virtualization? */ if (virtualizerLength > numItems) {
61
- if (virtualizerStartIndex !== 0) {
63
+ if (actualIndex !== 0) {
62
64
  batchUpdateNewIndex(0);
63
65
  }
64
66
  // No-op
@@ -119,18 +121,12 @@ function useVirtualizer_unstable(props) {
119
121
  }
120
122
  // For now lets use hardcoded size to assess current element to paginate on
121
123
  const startIndex = getIndexFromScrollPosition(measurementPos);
122
- let bufferedIndex = Math.max(startIndex - bufferCount, 0);
123
- if (onCalculateIndex) {
124
- // User has chance to intervene/customize prior to render
125
- // They may want to normalize this value.
126
- bufferedIndex = onCalculateIndex(bufferedIndex);
127
- }
124
+ const bufferedIndex = Math.max(startIndex - bufferCount, 0);
128
125
  // Safety limits
129
126
  const maxIndex = Math.max(numItems - virtualizerLength, 0);
130
127
  const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);
131
- if (virtualizerStartIndex !== newStartIndex) {
128
+ if (actualIndex !== newStartIndex) {
132
129
  // We flush sync this and perform an immediate state update
133
- // due to virtualizerStartIndex invalidation.
134
130
  (0, _reactDom.flushSync)(()=>{
135
131
  batchUpdateNewIndex(newStartIndex);
136
132
  });
@@ -143,7 +139,7 @@ function useVirtualizer_unstable(props) {
143
139
  const findIndexRecursive = (scrollPos, lowIndex, highIndex)=>{
144
140
  if (lowIndex > highIndex) {
145
141
  // We shouldn't get here - but no-op the index if we do.
146
- return virtualizerStartIndex;
142
+ return actualIndex;
147
143
  }
148
144
  const midpoint = Math.floor((lowIndex + highIndex) / 2);
149
145
  const iBefore = Math.max(midpoint - 1, 0);
@@ -186,21 +182,22 @@ function useVirtualizer_unstable(props) {
186
182
  return childProgressiveSizes.current[numItems - 1];
187
183
  };
188
184
  const calculateBefore = ()=>{
185
+ const currentIndex = Math.min(actualIndex, numItems);
189
186
  if (!getItemSize) {
190
187
  // The missing items from before virtualization starts height
191
- return virtualizerStartIndex * itemSize;
188
+ return currentIndex * itemSize;
192
189
  }
193
- if (virtualizerStartIndex <= 0) {
190
+ if (currentIndex <= 0) {
194
191
  return 0;
195
192
  }
196
193
  // Time for custom size calcs
197
- return childProgressiveSizes.current[virtualizerStartIndex - 1];
194
+ return childProgressiveSizes.current[currentIndex - 1];
198
195
  };
199
196
  const calculateAfter = ()=>{
200
197
  if (numItems === 0) {
201
198
  return 0;
202
199
  }
203
- const lastItemIndex = Math.min(virtualizerStartIndex + virtualizerLength, numItems - 1);
200
+ const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems - 1);
204
201
  if (!getItemSize) {
205
202
  // The missing items from after virtualization ends height
206
203
  const remainingItems = numItems - lastItemIndex - 1;
@@ -216,10 +213,10 @@ function useVirtualizer_unstable(props) {
216
213
  if (childArray.current.length !== numItems) {
217
214
  childArray.current = new Array(virtualizerLength);
218
215
  }
219
- const actualIndex = Math.max(newIndex, 0);
220
- const end = Math.min(actualIndex + virtualizerLength, numItems);
221
- for(let i = actualIndex; i < end; i++){
222
- childArray.current[i - actualIndex] = renderChild(i);
216
+ const _actualIndex = Math.max(newIndex, 0);
217
+ const end = Math.min(_actualIndex + virtualizerLength, numItems);
218
+ for(let i = _actualIndex; i < end; i++){
219
+ childArray.current[i - _actualIndex] = (0, _renderVirtualizer.renderVirtualizerChildPlaceholder)(renderChild(i), i);
223
220
  }
224
221
  }, [
225
222
  numItems,
@@ -292,15 +289,15 @@ function useVirtualizer_unstable(props) {
292
289
  // Initialization on mount - update array index to 0 (ready state).
293
290
  // Only fire on mount (no deps).
294
291
  (0, _react.useEffect)(()=>{
295
- if (virtualizerStartIndex < 0) {
292
+ if (actualIndex < 0) {
296
293
  batchUpdateNewIndex(0);
297
294
  }
298
295
  // eslint-disable-next-line react-hooks/exhaustive-deps
299
296
  }, []);
300
297
  // If the user passes in an updated renderChild function - update current children
301
298
  (0, _react.useEffect)(()=>{
302
- if (virtualizerStartIndex >= 0) {
303
- updateChildRows(virtualizerStartIndex);
299
+ if (actualIndex >= 0) {
300
+ updateChildRows(actualIndex);
304
301
  forceUpdate();
305
302
  }
306
303
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -308,6 +305,14 @@ function useVirtualizer_unstable(props) {
308
305
  renderChild,
309
306
  updateChildRows
310
307
  ]);
308
+ (0, _react.useEffect)(()=>{
309
+ // Ensure we repopulate if getItemSize callback changes
310
+ populateSizeArrays();
311
+ // We only run this effect on getItemSize change (recalc dynamic sizes)
312
+ // eslint-disable-next-line react-hooks/exhaustive-deps
313
+ }, [
314
+ getItemSize
315
+ ]);
311
316
  // Ensure we have run through and updated the whole size list array at least once.
312
317
  initializeSizeArray();
313
318
  if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {
@@ -316,10 +321,10 @@ function useVirtualizer_unstable(props) {
316
321
  }
317
322
  // Ensure we recalc if virtualizer length changes
318
323
  const maxCompare = Math.min(virtualizerLength, numItems);
319
- if (childArray.current.length !== maxCompare && virtualizerStartIndex + childArray.current.length < numItems) {
320
- updateChildRows(virtualizerStartIndex);
324
+ if (childArray.current.length !== maxCompare && actualIndex + childArray.current.length < numItems) {
325
+ updateChildRows(actualIndex);
321
326
  }
322
- const isFullyInitialized = hasInitialized.current && virtualizerStartIndex >= 0;
327
+ const isFullyInitialized = hasInitialized.current && actualIndex >= 0;
323
328
  return {
324
329
  components: {
325
330
  before: 'div',
@@ -357,7 +362,7 @@ function useVirtualizer_unstable(props) {
357
362
  beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,
358
363
  afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,
359
364
  totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,
360
- virtualizerStartIndex,
365
+ virtualizerStartIndex: actualIndex,
361
366
  axis,
362
367
  bufferSize,
363
368
  reversed
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/Virtualizer/useVirtualizer.js"],"sourcesContent":["import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useEffect, useRef, useState, useCallback, useReducer } from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\nexport function useVirtualizer_unstable(props) {\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 scrollViewRef,\n axis = 'vertical',\n reversed = false,\n onUpdateIndex,\n onCalculateIndex\n } = props;\n // Tracks the initial item to start virtualizer at, -1 implies first render cycle\n const [virtualizerStartIndex, setVirtualizerStartIndex] = useState(-1);\n // Store ref to before padding element\n const beforeElementRef = useRef(null);\n // Store ref to before padding element\n const afterElementRef = useRef(null);\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = useRef(new Array(getItemSize ? numItems : 0));\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 = useRef(new Array(getItemSize ? numItems : 0));\n // The internal tracking REF for child array (updates often).\n const childArray = useRef(new Array(virtualizerLength));\n // We want to be methodical about updating the render with child reference array\n const forceUpdate = useReducer(() => ({}), {})[1];\n const horizontal = axis === 'horizontal';\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array(numItems);\n }\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array(numItems);\n }\n for (let index = 0; index < numItems; index++) {\n childSizes.current[index] = getItemSize(index);\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 const batchUpdateNewIndex = index => {\n // Local updates\n onUpdateIndex === null || onUpdateIndex === void 0 ? void 0 : onUpdateIndex(index, virtualizerStartIndex);\n updateChildRows(index);\n updateCurrentItemSizes(index);\n // State setters\n setVirtualizerStartIndex(index);\n };\n // Observe intersections of virtualized components\n const {\n setObserverList\n } = useIntersectionObserver((entries, observer) => {\n /* Sanity check - do we even need virtualization? */if (virtualizerLength > numItems) {\n if (virtualizerStartIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n /* IO initiates this function when needed (bookend entering view) */\n let measurementPos = 0;\n let bufferCount = bufferItems;\n // Grab latest entry that is intersecting\n const latestEntry = entries.length === 1 ? entries[0] : entries.sort((entry1, entry2) => entry2.time - entry1.time).find(entry => {\n return entry.intersectionRatio > 0;\n });\n if (!latestEntry) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n if (latestEntry.target === afterElementRef.current) {\n // We need to inverse the buffer count\n bufferCount = virtualizerLength - bufferItems;\n measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();\n if (!horizontal) {\n if (reversed) {\n // Scrolling 'up' and hit the after element below\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' and hit the after element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (reversed) {\n // Scrolling 'left' and hit the after element\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'right' and hit the after element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();\n if (!horizontal) {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' in reverse order and hit the before element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'left' and hit before element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n }\n if (reversed) {\n // We're reversed, up is down, left is right, invert the scroll measure.\n measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);\n }\n // For now lets use hardcoded size to assess current element to paginate on\n const startIndex = getIndexFromScrollPosition(measurementPos);\n let bufferedIndex = Math.max(startIndex - bufferCount, 0);\n if (onCalculateIndex) {\n // User has chance to intervene/customize prior to render\n // They may want to normalize this value.\n bufferedIndex = onCalculateIndex(bufferedIndex);\n }\n // Safety limits\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);\n if (virtualizerStartIndex !== newStartIndex) {\n // We flush sync this and perform an immediate state update\n // due to virtualizerStartIndex invalidation.\n flushSync(() => {\n batchUpdateNewIndex(newStartIndex);\n });\n }\n }, {\n root: scrollViewRef ? scrollViewRef === null || scrollViewRef === void 0 ? void 0 : scrollViewRef.current : null,\n rootMargin: '0px',\n threshold: 0\n });\n const findIndexRecursive = (scrollPos, lowIndex, highIndex) => {\n if (lowIndex > highIndex) {\n // We shouldn't get here - but no-op the index if we do.\n return virtualizerStartIndex;\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 if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n };\n const getIndexFromSizeArray = scrollPos => {\n /* Quick searches our progressive height array */if (scrollPos === 0 || childProgressiveSizes.current.length === 0 || scrollPos <= childProgressiveSizes.current[0]) {\n // Check start\n return 0;\n }\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n };\n const getIndexFromScrollPosition = scrollPos => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n return getIndexFromSizeArray(scrollPos);\n };\n const calculateTotalSize = () => {\n if (!getItemSize) {\n return itemSize * numItems;\n }\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n };\n const calculateBefore = () => {\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return virtualizerStartIndex * itemSize;\n }\n if (virtualizerStartIndex <= 0) {\n return 0;\n }\n // Time for custom size calcs\n return childProgressiveSizes.current[virtualizerStartIndex - 1];\n };\n const calculateAfter = () => {\n if (numItems === 0) {\n return 0;\n }\n const lastItemIndex = Math.min(virtualizerStartIndex + virtualizerLength, numItems - 1);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex - 1;\n return remainingItems * itemSize;\n }\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];\n };\n const updateChildRows = useCallback(newIndex => {\n if (numItems === 0) {\n /* Nothing to virtualize */return [];\n }\n if (childArray.current.length !== numItems) {\n childArray.current = new Array(virtualizerLength);\n }\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);\n }\n }, [numItems, renderChild, virtualizerLength]);\n const setBeforeRef = useCallback(element => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n newList.push(beforeElementRef.current);\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n // Ensure we update array if before element changed\n setObserverList(newList);\n }, [setObserverList]);\n const setAfterRef = useCallback(element => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n newList.push(afterElementRef.current);\n // Ensure we update array if after element changed\n setObserverList(newList);\n }, [setObserverList]);\n const updateCurrentItemSizes = newIndex => {\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 let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const newSize = getItemSize(i);\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\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 // Initialize the size array before first render.\n const hasInitialized = useRef(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n useEffect(() => {\n if (virtualizerStartIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (virtualizerStartIndex >= 0) {\n updateChildRows(virtualizerStartIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, updateChildRows]);\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\n }\n // Ensure we recalc if virtualizer length changes\n const maxCompare = Math.min(virtualizerLength, numItems);\n if (childArray.current.length !== maxCompare && virtualizerStartIndex + childArray.current.length < numItems) {\n updateChildRows(virtualizerStartIndex);\n }\n const isFullyInitialized = hasInitialized.current && virtualizerStartIndex >= 0;\n return {\n components: {\n before: 'div',\n after: 'div',\n beforeContainer: 'div',\n afterContainer: 'div'\n },\n virtualizedChildren: childArray.current,\n before: resolveShorthand(props.before, {\n required: true,\n defaultProps: {\n ref: setBeforeRef,\n role: 'none'\n }\n }),\n after: resolveShorthand(props.after, {\n required: true,\n defaultProps: {\n ref: setAfterRef,\n role: 'none'\n }\n }),\n beforeContainer: resolveShorthand(props.beforeContainer, {\n required: true,\n defaultProps: {\n role: 'none'\n }\n }),\n afterContainer: resolveShorthand(props.afterContainer, {\n required: true,\n defaultProps: {\n role: 'none'\n }\n }),\n beforeBufferHeight: isFullyInitialized ? calculateBefore() : 0,\n afterBufferHeight: isFullyInitialized ? calculateAfter() : 0,\n totalVirtualizerHeight: isFullyInitialized ? calculateTotalSize() : virtualizerLength * itemSize,\n virtualizerStartIndex,\n axis,\n bufferSize,\n reversed\n };\n}\n//# sourceMappingURL=useVirtualizer.js.map"],"names":["useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","scrollViewRef","axis","reversed","onUpdateIndex","onCalculateIndex","virtualizerStartIndex","setVirtualizerStartIndex","useState","beforeElementRef","useRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","useReducer","horizontal","populateSizeArrays","current","length","index","batchUpdateNewIndex","updateChildRows","updateCurrentItemSizes","setObserverList","useIntersectionObserver","entries","observer","measurementPos","bufferCount","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","target","calculateAfter","calculateTotalSize","abs","boundingClientRect","bottom","top","right","left","calculateBefore","max","startIndex","getIndexFromScrollPosition","bufferedIndex","maxIndex","newStartIndex","min","flushSync","root","rootMargin","threshold","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","lastItemIndex","remainingItems","useCallback","newIndex","actualIndex","end","i","setBeforeRef","element","newList","push","setAfterRef","endIndex","didUpdate","newSize","prevSize","hasInitialized","initializeSizeArray","useEffect","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","resolveShorthand","required","defaultProps","ref","role","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight"],"mappings":";;;;+BAIgBA;;aAAAA;;yCAJwB;uBAC6B;gCACpC;0BACP;AACnB,SAASA,wBAAwBC,KAAK,EAAE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AP,iBAAiBG,IAAAA,gCAAgB,EAAC9G,MAAM2G,eAAe,EAAE;YACvDI,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAN,gBAAgBE,IAAAA,gCAAgB,EAAC9G,MAAM4G,cAAc,EAAE;YACrDG,UAAU,IAAI;YACdC,cAAc;gBACZE,MAAM;YACR;QACF;QACAC,oBAAoBZ,qBAAqB3C,oBAAoB,CAAC;QAC9DwD,mBAAmBb,qBAAqBnD,mBAAmB,CAAC;QAC5DiE,wBAAwBd,qBAAqBlD,uBAAuBlD,oBAAoBF,QAAQ;QAChGgB;QACAJ;QACAH;QACAI;IACF;AACF,EACA,0CAA0C"}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/useVirtualizer.js"],"sourcesContent":["import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';\nimport { useEffect, useRef, useCallback, useReducer } from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { flushSync } from 'react-dom';\nimport { useVirtualizerContextState_unstable } from '../../Utilities';\nimport { renderVirtualizerChildPlaceholder } from './renderVirtualizer';\nexport function useVirtualizer_unstable(props) {\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 scrollViewRef,\n axis = 'vertical',\n reversed = false,\n virtualizerContext\n } = props;\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 const actualIndex = _virtualizerContext.contextIndex;\n const setActualIndex = _virtualizerContext.setContextIndex;\n // Store ref to before padding element\n const beforeElementRef = useRef(null);\n // Store ref to before padding element\n const afterElementRef = useRef(null);\n // We need to store an array to track dynamic sizes, we can use this to incrementally update changes\n const childSizes = useRef(new Array(getItemSize ? numItems : 0));\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 = useRef(new Array(getItemSize ? numItems : 0));\n // The internal tracking REF for child array (updates often).\n const childArray = useRef(new Array(virtualizerLength));\n // We want to be methodical about updating the render with child reference array\n const forceUpdate = useReducer(() => ({}), {})[1];\n const horizontal = axis === 'horizontal';\n const populateSizeArrays = () => {\n if (!getItemSize) {\n // Static sizes, never mind!\n return;\n }\n if (numItems !== childSizes.current.length) {\n childSizes.current = new Array(numItems);\n }\n if (numItems !== childProgressiveSizes.current.length) {\n childProgressiveSizes.current = new Array(numItems);\n }\n for (let index = 0; index < numItems; index++) {\n childSizes.current[index] = getItemSize(index);\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 const batchUpdateNewIndex = index => {\n // Local updates\n updateChildRows(index);\n updateCurrentItemSizes(index);\n // State setters\n setActualIndex(index);\n };\n // Observe intersections of virtualized components\n const {\n setObserverList\n } = useIntersectionObserver((entries, observer) => {\n /* Sanity check - do we even need virtualization? */if (virtualizerLength > numItems) {\n if (actualIndex !== 0) {\n batchUpdateNewIndex(0);\n }\n // No-op\n return;\n }\n /* IO initiates this function when needed (bookend entering view) */\n let measurementPos = 0;\n let bufferCount = bufferItems;\n // Grab latest entry that is intersecting\n const latestEntry = entries.length === 1 ? entries[0] : entries.sort((entry1, entry2) => entry2.time - entry1.time).find(entry => {\n return entry.intersectionRatio > 0;\n });\n if (!latestEntry) {\n // If we don't find an intersecting area, ignore for now.\n return;\n }\n if (latestEntry.target === afterElementRef.current) {\n // We need to inverse the buffer count\n bufferCount = virtualizerLength - bufferItems;\n measurementPos = reversed ? calculateAfter() : calculateTotalSize() - calculateAfter();\n if (!horizontal) {\n if (reversed) {\n // Scrolling 'up' and hit the after element below\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' and hit the after element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (reversed) {\n // Scrolling 'left' and hit the after element\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'right' and hit the after element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n } else if (latestEntry.target === beforeElementRef.current) {\n measurementPos = reversed ? calculateTotalSize() - calculateBefore() : calculateBefore();\n if (!horizontal) {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.bottom);\n } else if (latestEntry.boundingClientRect.top < 0) {\n // Scrolling 'down' in reverse order and hit the before element above top: 0\n measurementPos -= latestEntry.boundingClientRect.top;\n }\n } else {\n if (!reversed) {\n measurementPos -= Math.abs(latestEntry.boundingClientRect.right);\n } else if (latestEntry.boundingClientRect.left < 0) {\n // Scrolling 'left' and hit before element\n measurementPos -= latestEntry.boundingClientRect.left;\n }\n }\n }\n if (reversed) {\n // We're reversed, up is down, left is right, invert the scroll measure.\n measurementPos = Math.max(calculateTotalSize() - Math.abs(measurementPos), 0);\n }\n // For now lets use hardcoded size to assess current element to paginate on\n const startIndex = getIndexFromScrollPosition(measurementPos);\n const bufferedIndex = Math.max(startIndex - bufferCount, 0);\n // Safety limits\n const maxIndex = Math.max(numItems - virtualizerLength, 0);\n const newStartIndex = Math.min(Math.max(bufferedIndex, 0), maxIndex);\n if (actualIndex !== newStartIndex) {\n // We flush sync this and perform an immediate state update\n flushSync(() => {\n batchUpdateNewIndex(newStartIndex);\n });\n }\n }, {\n root: scrollViewRef ? scrollViewRef === null || scrollViewRef === void 0 ? void 0 : scrollViewRef.current : null,\n rootMargin: '0px',\n threshold: 0\n });\n const findIndexRecursive = (scrollPos, lowIndex, highIndex) => {\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 if (indexValue > scrollPos) {\n return findIndexRecursive(scrollPos, lowIndex, midpoint - 1);\n } else {\n return findIndexRecursive(scrollPos, midpoint + 1, highIndex);\n }\n };\n const getIndexFromSizeArray = scrollPos => {\n /* Quick searches our progressive height array */if (scrollPos === 0 || childProgressiveSizes.current.length === 0 || scrollPos <= childProgressiveSizes.current[0]) {\n // Check start\n return 0;\n }\n if (scrollPos >= childProgressiveSizes.current[childProgressiveSizes.current.length - 1]) {\n // Check end\n return childProgressiveSizes.current.length - 1;\n }\n return findIndexRecursive(scrollPos, 0, childProgressiveSizes.current.length - 1);\n };\n const getIndexFromScrollPosition = scrollPos => {\n if (!getItemSize) {\n return Math.round(scrollPos / itemSize);\n }\n return getIndexFromSizeArray(scrollPos);\n };\n const calculateTotalSize = () => {\n if (!getItemSize) {\n return itemSize * numItems;\n }\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1];\n };\n const calculateBefore = () => {\n const currentIndex = Math.min(actualIndex, numItems);\n if (!getItemSize) {\n // The missing items from before virtualization starts height\n return currentIndex * itemSize;\n }\n if (currentIndex <= 0) {\n return 0;\n }\n // Time for custom size calcs\n return childProgressiveSizes.current[currentIndex - 1];\n };\n const calculateAfter = () => {\n if (numItems === 0) {\n return 0;\n }\n const lastItemIndex = Math.min(actualIndex + virtualizerLength, numItems - 1);\n if (!getItemSize) {\n // The missing items from after virtualization ends height\n const remainingItems = numItems - lastItemIndex - 1;\n return remainingItems * itemSize;\n }\n // Time for custom size calcs\n return childProgressiveSizes.current[numItems - 1] - childProgressiveSizes.current[lastItemIndex];\n };\n const updateChildRows = useCallback(newIndex => {\n if (numItems === 0) {\n /* Nothing to virtualize */return [];\n }\n if (childArray.current.length !== numItems) {\n childArray.current = new Array(virtualizerLength);\n }\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] = renderVirtualizerChildPlaceholder(renderChild(i), i);\n }\n }, [numItems, renderChild, virtualizerLength]);\n const setBeforeRef = useCallback(element => {\n if (!element || beforeElementRef.current === element) {\n return;\n }\n beforeElementRef.current = element;\n const newList = [];\n newList.push(beforeElementRef.current);\n if (afterElementRef.current) {\n newList.push(afterElementRef.current);\n }\n // Ensure we update array if before element changed\n setObserverList(newList);\n }, [setObserverList]);\n const setAfterRef = useCallback(element => {\n if (!element || afterElementRef.current === element) {\n return;\n }\n afterElementRef.current = element;\n const newList = [];\n if (beforeElementRef.current) {\n newList.push(beforeElementRef.current);\n }\n newList.push(afterElementRef.current);\n // Ensure we update array if after element changed\n setObserverList(newList);\n }, [setObserverList]);\n const updateCurrentItemSizes = newIndex => {\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 let didUpdate = false;\n for (let i = startIndex; i < endIndex; i++) {\n const newSize = getItemSize(i);\n if (newSize !== childSizes.current[i]) {\n childSizes.current[i] = newSize;\n didUpdate = true;\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 // Initialize the size array before first render.\n const hasInitialized = useRef(false);\n const initializeSizeArray = () => {\n if (hasInitialized.current === false) {\n hasInitialized.current = true;\n populateSizeArrays();\n }\n };\n // Initialization on mount - update array index to 0 (ready state).\n // Only fire on mount (no deps).\n useEffect(() => {\n if (actualIndex < 0) {\n batchUpdateNewIndex(0);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n // If the user passes in an updated renderChild function - update current children\n useEffect(() => {\n if (actualIndex >= 0) {\n updateChildRows(actualIndex);\n forceUpdate();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [renderChild, updateChildRows]);\n useEffect(() => {\n // Ensure we repopulate if getItemSize callback changes\n populateSizeArrays();\n // We only run this effect on getItemSize change (recalc dynamic sizes)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getItemSize]);\n // Ensure we have run through and updated the whole size list array at least once.\n initializeSizeArray();\n if (getItemSize && (numItems !== childSizes.current.length || numItems !== childProgressiveSizes.current.length)) {\n // Child length mismatch, repopulate size arrays.\n populateSizeArrays();\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 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: resolveShorthand(props.before, {\n required: true,\n defaultProps: {\n ref: setBeforeRef,\n role: 'none'\n }\n }),\n after: resolveShorthand(props.after, {\n required: true,\n defaultProps: {\n ref: setAfterRef,\n role: 'none'\n }\n }),\n beforeContainer: resolveShorthand(props.beforeContainer, {\n required: true,\n defaultProps: {\n role: 'none'\n }\n }),\n afterContainer: resolveShorthand(props.afterContainer, {\n required: true,\n defaultProps: {\n role: 'none'\n }\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 };\n}\n//# sourceMappingURL=useVirtualizer.js.map"],"names":["useVirtualizer_unstable","props","itemSize","numItems","virtualizerLength","children","renderChild","getItemSize","bufferItems","Math","round","bufferSize","floor","scrollViewRef","axis","reversed","virtualizerContext","_virtualizerContext","useVirtualizerContextState_unstable","actualIndex","contextIndex","setActualIndex","setContextIndex","beforeElementRef","useRef","afterElementRef","childSizes","Array","childProgressiveSizes","childArray","forceUpdate","useReducer","horizontal","populateSizeArrays","current","length","index","batchUpdateNewIndex","updateChildRows","updateCurrentItemSizes","setObserverList","useIntersectionObserver","entries","observer","measurementPos","bufferCount","latestEntry","sort","entry1","entry2","time","find","entry","intersectionRatio","target","calculateAfter","calculateTotalSize","abs","boundingClientRect","bottom","top","right","left","calculateBefore","max","startIndex","getIndexFromScrollPosition","bufferedIndex","maxIndex","newStartIndex","min","flushSync","root","rootMargin","threshold","findIndexRecursive","scrollPos","lowIndex","highIndex","midpoint","iBefore","iAfter","indexValue","afterIndexValue","beforeIndexValue","getIndexFromSizeArray","currentIndex","lastItemIndex","remainingItems","useCallback","newIndex","_actualIndex","end","i","renderVirtualizerChildPlaceholder","setBeforeRef","element","newList","push","setAfterRef","endIndex","didUpdate","newSize","prevSize","hasInitialized","initializeSizeArray","useEffect","maxCompare","isFullyInitialized","components","before","after","beforeContainer","afterContainer","virtualizedChildren","resolveShorthand","required","defaultProps","ref","role","beforeBufferHeight","afterBufferHeight","totalVirtualizerHeight","virtualizerStartIndex"],"mappings":";;;;+BAMgBA;;aAAAA;;yCANwB;uBACmB;gCAC1B;0BACP;2BAC0B;mCACF;AAC3C,SAASA,wBAAwBC,KAAK,EAAE;IAC7C,MAAM,EACJC,SAAQ,EACRC,SAAQ,EACRC,kBAAiB,EACjBC,UAAUC,YAAW,EACrBC,YAAW,EACXC,aAAcC,KAAKC,KAAK,CAACN,oBAAoB,KAAI,EACjDO,YAAaF,KAAKG,KAAK,CAACJ,cAAc,OAAON,SAAQ,EACrDW,cAAa,EACbC,MAAO,WAAU,EACjBC,UAAW,KAAK,CAAA,EAChB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oBAAoB,CAAC;QAC9D0D,mBAAmBb,qBAAqBrD,mBAAmB,CAAC;QAC5DmE,wBAAwBd,qBAAqBpD,uBAAuBpD,oBAAoBF,QAAQ;QAChGyH,uBAAuBxG;QACvBL;QACAH;QACAI;IACF;AACF,EACA,0CAA0C"}
@@ -59,9 +59,10 @@ const useStyles = /*#__PURE__*/ (0, _react["__styles"])({
59
59
  });
60
60
  const useVirtualizerScrollViewStyles_unstable = (state)=>{
61
61
  const styles = useStyles();
62
- // For now - just return default style mods
62
+ // Default virtualizer styles base
63
63
  (0, _useVirtualizerStyles.useVirtualizerStyles_unstable)(state);
64
64
  const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
65
+ // Add container styles
65
66
  state.container.className = (0, _react.mergeClasses)(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
66
67
  return state;
67
68
  }; //# sourceMappingURL=useVirtualizerScrollViewStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js"],"sourcesContent":["import { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles';\nimport { __styles, mergeClasses } from '@griffel/react';\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\nexport const virtualizerScrollViewClassNames = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`\n};\nconst useStyles = /*#__PURE__*/__styles({\n base: {\n mc9l5x: \"f22iagw\",\n a9b677: \"fly5x3f\",\n Bqenvij: \"f1l02sjl\",\n Eiaeu8: \"f1115ve7\"\n },\n vertical: {\n Beiy3e4: \"f1vx9l62\",\n Eiaeu8: \"f1115ve7\",\n Bmxbyg5: \"f5zp4f\"\n },\n horizontal: {\n Beiy3e4: \"f1063pyq\",\n B68tc82: \"f1oy3dpc\"\n },\n verticalReversed: {\n Beiy3e4: \"f1gkdon0\",\n Bmxbyg5: \"f5zp4f\"\n },\n horizontalReversed: {\n Beiy3e4: \"f1oztnx0\",\n B68tc82: \"f1oy3dpc\"\n }\n}, {\n d: [\".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}\", \".fly5x3f{width:100%;}\", \".f1l02sjl{height:100%;}\", \".f1115ve7{overflow-anchor:none;}\", \".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}\", \".f5zp4f{overflow-y:auto;}\", \".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}\", \".f1oy3dpc{overflow-x:auto;}\", \".f1gkdon0{-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;}\", \".f1oztnx0{-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;}\"]\n});\n/**\n * Apply styling to the Virtualizer states\n */\nexport const useVirtualizerScrollViewStyles_unstable = state => {\n const styles = useStyles();\n // For now - just return default style mods\n useVirtualizerStyles_unstable(state);\n const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;\n state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);\n return state;\n};\n//# sourceMappingURL=useVirtualizerScrollViewStyles.js.map"],"names":["virtualizerScrollViewClassNames","useVirtualizerScrollViewStyles_unstable","virtualizerScrollViewClassName","virtualizerClassNames","container","useStyles","__styles","base","mc9l5x","a9b677","Bqenvij","Eiaeu8","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","state","styles","useVirtualizerStyles_unstable","containerStyle","axis","reversed","className","mergeClasses"],"mappings":";;;;;;;;;;;IAGaA,+BAA+B,MAA/BA;IAkCAC,uCAAuC,MAAvCA;;sCArCwD;uBAC9B;AACvC,MAAMC,iCAAiC;AAChC,MAAMF,kCAAkC;IAC7C,GAAGG,2CAAqB;IACxBC,WAAW,CAAC,EAAEF,+BAA+B,WAAW,CAAC;AAC3D;AACA,MAAMG,YAAY,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IACtCC,MAAM;QACJC,QAAQ;QACRC,QAAQ;QACRC,SAAS;QACTC,QAAQ;IACV;IACAC,UAAU;QACRC,SAAS;QACTF,QAAQ;QACRG,SAAS;IACX;IACAC,YAAY;QACVF,SAAS;QACTG,SAAS;IACX;IACAC,kBAAkB;QAChBJ,SAAS;QACTC,SAAS;IACX;IACAI,oBAAoB;QAClBL,SAAS;QACTG,SAAS;IACX;AACF,GAAG;IACDG,GAAG;QAAC;QAAwF;QAAyB;QAA2B;QAAoC;QAA6F;QAA6B;QAAoF;QAA+B;QAAqH;KAA2G;AACnoB;AAIO,MAAMlB,0CAA0CmB,CAAAA,QAAS;IAC9D,MAAMC,SAAShB;IACf,2CAA2C;IAC3CiB,IAAAA,mDAA6B,EAACF;IAC9B,MAAMG,iBAAiBH,MAAMI,IAAI,KAAK,eAAeJ,MAAMK,QAAQ,GAAGJ,OAAOH,kBAAkB,GAAGG,OAAON,UAAU,GAAGK,MAAMK,QAAQ,GAAGJ,OAAOJ,gBAAgB,GAAGI,OAAOT,QAAQ;IAChLQ,MAAMhB,SAAS,CAACsB,SAAS,GAAGC,IAAAA,mBAAY,EAAC3B,gCAAgCI,SAAS,EAAEiB,OAAOd,IAAI,EAAEgB,gBAAgBH,MAAMhB,SAAS,CAACsB,SAAS;IAC1I,OAAON;AACT,GACA,0DAA0D"}
1
+ {"version":3,"sources":["../../../lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js"],"sourcesContent":["import { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles';\nimport { __styles, mergeClasses } from '@griffel/react';\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\nexport const virtualizerScrollViewClassNames = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewClassName}__container`\n};\nconst useStyles = /*#__PURE__*/__styles({\n base: {\n mc9l5x: \"f22iagw\",\n a9b677: \"fly5x3f\",\n Bqenvij: \"f1l02sjl\",\n Eiaeu8: \"f1115ve7\"\n },\n vertical: {\n Beiy3e4: \"f1vx9l62\",\n Eiaeu8: \"f1115ve7\",\n Bmxbyg5: \"f5zp4f\"\n },\n horizontal: {\n Beiy3e4: \"f1063pyq\",\n B68tc82: \"f1oy3dpc\"\n },\n verticalReversed: {\n Beiy3e4: \"f1gkdon0\",\n Bmxbyg5: \"f5zp4f\"\n },\n horizontalReversed: {\n Beiy3e4: \"f1oztnx0\",\n B68tc82: \"f1oy3dpc\"\n }\n}, {\n d: [\".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}\", \".fly5x3f{width:100%;}\", \".f1l02sjl{height:100%;}\", \".f1115ve7{overflow-anchor:none;}\", \".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}\", \".f5zp4f{overflow-y:auto;}\", \".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}\", \".f1oy3dpc{overflow-x:auto;}\", \".f1gkdon0{-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;}\", \".f1oztnx0{-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;}\"]\n});\n/**\n * Apply styling to the Virtualizer states\n */\nexport const useVirtualizerScrollViewStyles_unstable = state => {\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//# sourceMappingURL=useVirtualizerScrollViewStyles.js.map"],"names":["virtualizerScrollViewClassNames","useVirtualizerScrollViewStyles_unstable","virtualizerScrollViewClassName","virtualizerClassNames","container","useStyles","__styles","base","mc9l5x","a9b677","Bqenvij","Eiaeu8","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","state","styles","useVirtualizerStyles_unstable","containerStyle","axis","reversed","className","mergeClasses"],"mappings":";;;;;;;;;;;IAGaA,+BAA+B,MAA/BA;IAkCAC,uCAAuC,MAAvCA;;sCArCwD;uBAC9B;AACvC,MAAMC,iCAAiC;AAChC,MAAMF,kCAAkC;IAC7C,GAAGG,2CAAqB;IACxBC,WAAW,CAAC,EAAEF,+BAA+B,WAAW,CAAC;AAC3D;AACA,MAAMG,YAAY,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IACtCC,MAAM;QACJC,QAAQ;QACRC,QAAQ;QACRC,SAAS;QACTC,QAAQ;IACV;IACAC,UAAU;QACRC,SAAS;QACTF,QAAQ;QACRG,SAAS;IACX;IACAC,YAAY;QACVF,SAAS;QACTG,SAAS;IACX;IACAC,kBAAkB;QAChBJ,SAAS;QACTC,SAAS;IACX;IACAI,oBAAoB;QAClBL,SAAS;QACTG,SAAS;IACX;AACF,GAAG;IACDG,GAAG;QAAC;QAAwF;QAAyB;QAA2B;QAAoC;QAA6F;QAA6B;QAAoF;QAA+B;QAAqH;KAA2G;AACnoB;AAIO,MAAMlB,0CAA0CmB,CAAAA,QAAS;IAC9D,MAAMC,SAAShB;IACf,kCAAkC;IAClCiB,IAAAA,mDAA6B,EAACF;IAC9B,MAAMG,iBAAiBH,MAAMI,IAAI,KAAK,eAAeJ,MAAMK,QAAQ,GAAGJ,OAAOH,kBAAkB,GAAGG,OAAON,UAAU,GAAGK,MAAMK,QAAQ,GAAGJ,OAAOJ,gBAAgB,GAAGI,OAAOT,QAAQ;IAChL,uBAAuB;IACvBQ,MAAMhB,SAAS,CAACsB,SAAS,GAAGC,IAAAA,mBAAY,EAAC3B,gCAAgCI,SAAS,EAAEiB,OAAOd,IAAI,EAAEgB,gBAAgBH,MAAMhB,SAAS,CAACsB,SAAS;IAC1I,OAAON;AACT,GACA,0DAA0D"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "VirtualizerScrollViewDynamic", {
6
+ enumerable: true,
7
+ get: ()=>VirtualizerScrollViewDynamic
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _useVirtualizerScrollViewDynamic = require("./useVirtualizerScrollViewDynamic");
11
+ const _renderVirtualizerScrollViewDynamic = require("./renderVirtualizerScrollViewDynamic");
12
+ const _useVirtualizerScrollViewDynamicStyles = require("./useVirtualizerScrollViewDynamicStyles");
13
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
14
+ const VirtualizerScrollViewDynamic = (props, context)=>{
15
+ const state = (0, _useVirtualizerScrollViewDynamic.useVirtualizerScrollViewDynamic_unstable)(props);
16
+ (0, _useVirtualizerScrollViewDynamicStyles.useVirtualizerScrollViewDynamicStyles_unstable)(state);
17
+ return (0, _renderVirtualizerScrollViewDynamic.renderVirtualizerScrollViewDynamic_unstable)(state);
18
+ };
19
+ VirtualizerScrollViewDynamic.displayName = 'VirtualizerScrollViewDynamic'; //# sourceMappingURL=VirtualizerScrollViewDynamic.js.map
20
+
21
+ //# sourceMappingURL=VirtualizerScrollViewDynamic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js"],"sourcesContent":["import { useVirtualizerScrollViewDynamic_unstable } from './useVirtualizerScrollViewDynamic';\nimport { renderVirtualizerScrollViewDynamic_unstable } from './renderVirtualizerScrollViewDynamic';\nimport { useVirtualizerScrollViewDynamicStyles_unstable } from './useVirtualizerScrollViewDynamicStyles';\nimport * as React from 'react';\n/**\n * Virtualizer ScrollView\n */\nexport const VirtualizerScrollViewDynamic = (props, context) => {\n const state = useVirtualizerScrollViewDynamic_unstable(props);\n useVirtualizerScrollViewDynamicStyles_unstable(state);\n return renderVirtualizerScrollViewDynamic_unstable(state);\n};\nVirtualizerScrollViewDynamic.displayName = 'VirtualizerScrollViewDynamic';\n//# sourceMappingURL=VirtualizerScrollViewDynamic.js.map"],"names":["VirtualizerScrollViewDynamic","props","context","state","useVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable","renderVirtualizerScrollViewDynamic_unstable","displayName"],"mappings":";;;;+BAOaA;;aAAAA;;;iDAP4C;oDACG;uDACG;6DACxC;AAIhB,MAAMA,+BAA+B,CAACC,OAAOC,UAAY;IAC9D,MAAMC,QAAQC,IAAAA,yEAAwC,EAACH;IACvDI,IAAAA,qFAA8C,EAACF;IAC/C,OAAOG,IAAAA,+EAA2C,EAACH;AACrD;AACAH,6BAA6BO,WAAW,GAAG,gCAC3C,wDAAwD"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ //# sourceMappingURL=VirtualizerScrollViewDynamic.types.js.map
6
+
7
+ //# sourceMappingURL=VirtualizerScrollViewDynamic.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=VirtualizerScrollViewDynamic.types.js.map"],"names":[],"mappings":";;;;CACA,8DAA8D"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./VirtualizerScrollViewDynamic"), exports);
7
+ _exportStar(require("./VirtualizerScrollViewDynamic.types"), exports);
8
+ _exportStar(require("./useVirtualizerScrollViewDynamic"), exports);
9
+ _exportStar(require("./renderVirtualizerScrollViewDynamic"), exports);
10
+ _exportStar(require("./useVirtualizerScrollViewDynamicStyles"), exports);
11
+ //# sourceMappingURL=index.js.map
12
+
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/components/VirtualizerScrollViewDynamic/index.js"],"sourcesContent":["export * from './VirtualizerScrollViewDynamic';\nexport * from './VirtualizerScrollViewDynamic.types';\nexport * from './useVirtualizerScrollViewDynamic';\nexport * from './renderVirtualizerScrollViewDynamic';\nexport * from './useVirtualizerScrollViewDynamicStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
@@ -0,0 +1,17 @@
1
+ /** @jsxRuntime classic */ /** @jsx createElement */ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderVirtualizerScrollViewDynamic_unstable", {
6
+ enumerable: true,
7
+ get: ()=>renderVirtualizerScrollViewDynamic_unstable
8
+ });
9
+ const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
10
+ const _reactUtilities = require("@fluentui/react-utilities");
11
+ const _renderVirtualizer = require("../Virtualizer/renderVirtualizer");
12
+ const renderVirtualizerScrollViewDynamic_unstable = (state)=>{
13
+ const { slots , slotProps } = (0, _reactUtilities.getSlotsNext)(state);
14
+ return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(slots.container, slotProps.container, (0, _renderVirtualizer.renderVirtualizer_unstable)(state));
15
+ }; //# sourceMappingURL=renderVirtualizerScrollViewDynamic.js.map
16
+
17
+ //# sourceMappingURL=renderVirtualizerScrollViewDynamic.js.map