@fluentui/react-virtualizer 9.0.0-alpha.111 → 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.
- package/CHANGELOG.md +22 -2
- package/lib/components/Virtualizer/Virtualizer.js +0 -1
- package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib/components/Virtualizer/Virtualizer.types.js +3 -1
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +10 -2
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.js +8 -0
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.raw.js +8 -0
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.raw.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +0 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +3 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +2 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -1
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +0 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +7 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js +1 -0
- package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js.map +1 -1
- package/lib/hooks/hooks.types.js +5 -1
- package/lib/hooks/hooks.types.js.map +1 -1
- package/lib/hooks/useDynamicPagination.js +3 -1
- package/lib/hooks/useDynamicPagination.js.map +1 -1
- package/lib/hooks/useDynamicVirtualizerMeasure.js +2 -4
- package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/lib/hooks/useIntersectionObserver.js +2 -0
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useMeasureList.js +1 -0
- package/lib/hooks/useMeasureList.js.map +1 -1
- package/lib/hooks/useMutationObserver.js +1 -0
- package/lib/hooks/useMutationObserver.js.map +1 -1
- package/lib/hooks/useResizeObserverRef.js +2 -0
- package/lib/hooks/useResizeObserverRef.js.map +1 -1
- package/lib/hooks/useStaticPagination.js +3 -1
- package/lib/hooks/useStaticPagination.js.map +1 -1
- package/lib/hooks/useVirtualizerMeasure.js +1 -2
- package/lib/hooks/useVirtualizerMeasure.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -1
- package/lib/utilities/VirtualizerContext/types.js +4 -1
- package/lib/utilities/VirtualizerContext/types.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/Virtualizer.js +0 -2
- package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +3 -3
- package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +10 -2
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js +8 -0
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.raw.js +8 -0
- package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +0 -2
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +3 -3
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +2 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +0 -2
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +0 -2
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +5 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/hooks/hooks.types.js +5 -3
- package/lib-commonjs/hooks/hooks.types.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicPagination.js +3 -1
- package/lib-commonjs/hooks/useDynamicPagination.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/lib-commonjs/hooks/useIntersectionObserver.js +2 -0
- package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
- package/lib-commonjs/hooks/useMeasureList.js +1 -0
- package/lib-commonjs/hooks/useMeasureList.js.map +1 -1
- package/lib-commonjs/hooks/useMutationObserver.js +1 -0
- package/lib-commonjs/hooks/useMutationObserver.js.map +1 -1
- package/lib-commonjs/hooks/useResizeObserverRef.js +2 -0
- package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -1
- package/lib-commonjs/hooks/useStaticPagination.js +3 -1
- package/lib-commonjs/hooks/useStaticPagination.js.map +1 -1
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js +0 -2
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -1
- package/lib-commonjs/utilities/VirtualizerContext/types.js +4 -3
- package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -1
- package/package.json +3 -3
|
@@ -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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAChE,SAASC,uBAAuB,QAAQ,gCAAgC;AAExE,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,kBAAkB,QAAQ,kBAAkB;AAErD,SAASC,8BAA8B,QAAQ,kCAAkC;AAEjF;;CAEC,GACD,OAAO,SAASC,kCAAkCC,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,GAAGf,4BAA4B;QAC9GgB,iBAAiBZ,MAAME,QAAQ;QAC/BW,WAAWb,CAAAA,cAAAA,MAAMI,IAAI,cAAVJ,yBAAAA,cAAc;IAC3B;IAEA,kEAAkE;IAClE,MAAMc,uBAAuBtB,MAAMuB,MAAM,CAASR;IAClD,IAAIO,qBAAqBE,OAAO,KAAKT,mBAAmB;
|
|
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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAChE,SAASC,uBAAuB,QAAQ,gCAAgC;AAExE,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,kBAAkB,QAAQ,kBAAkB;AAErD,SAASC,8BAA8B,QAAQ,kCAAkC;AAEjF;;CAEC,GACD,OAAO,SAASC,kCAAkCC,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,GAAGf,4BAA4B;QAC9GgB,iBAAiBZ,MAAME,QAAQ;QAC/BW,WAAWb,CAAAA,cAAAA,MAAMI,IAAI,cAAVJ,yBAAAA,cAAc;IAC3B;IAEA,kEAAkE;IAClE,MAAMc,uBAAuBtB,MAAMuB,MAAM,CAASR;IAClD,yFAAyF;IACzF,IAAIO,qBAAqBE,OAAO,KAAKT,mBAAmB;QACtD,yFAAyF;QACzFO,qBAAqBE,OAAO,GAAGT;IACjC;IAEA,MAAMU,gBAAgBnB,+BAA+B;QAAEM;QAAMF;IAAS,GAAGI;IACzE,MAAMY,gBAAgBxB,cAAcM,MAAMkB,aAAa,EAAER,WAAWO;IACpE,MAAME,2BAA2B3B,MAAMuB,MAAM,CAA4B;IACzE,MAAMK,oBAAoB5B,MAAMuB,MAAM,CAAmC;IAEzEvB,MAAM6B,mBAAmB,CACvBpB,eACA;YAekBkB;QAdhB,OAAO;YACLG,UAASC,KAAa,EAAEC,WAAW,MAAM,EAAEC,QAA+C;oBAExFN;gBADAC,kBAAkBJ,OAAO,GAAGS,qBAAAA,sBAAAA,WAAY;iBACxCN,oCAAAA,yBAAyBH,OAAO,cAAhCG,wDAAAA,kCAAkCO,eAAe,CAACH;gBAClD1B,mBAAmB;oBACjB0B;oBACArB;oBACAyB,YAAYxB;oBACZe;oBACAd;oBACAC;oBACAmB;gBACF;YACF;YACAI,YAAY,GAAET,oCAAAA,yBAAyBH,OAAO,cAAhCG,wDAAAA,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,mBAAmBnC,wBAAwB;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,KAAKyC,MAAM,CAAClC,MAAMiC,SAAS,EAAE;YACtCE,cAAc;gBACZC,KAAKlB;YACP;YACAmB,aAAa;QACf;IACF;AACF"}
|
|
@@ -47,6 +47,7 @@ export const useVirtualizerScrollViewStyles_unstable = state => {
|
|
|
47
47
|
useVirtualizerStyles_unstable(state);
|
|
48
48
|
const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
|
|
49
49
|
// Add container styles
|
|
50
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
50
51
|
state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
|
|
51
52
|
return state;
|
|
52
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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"],"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"],"mappings":"AAAA,YAAY;;AACZ,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,4CAA4C;AACjH,SAAAC,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,MAAMC,8BAA8B,GAAG,6BAA6B;AACpE;AACA;AACA;AAAI,OAAO,MAAMC,+BAA+B,GAAG;EAC/C,GAAGJ,qBAAqB;EACxBK,SAAS,EAAE,GAAGF,8BAA8B;AAChD,CAAC;AACD,MAAMG,SAAS,gBAAGL,QAAA;EAAAM,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,UAAA;IAAAF,OAAA;IAAAG,OAAA;EAAA;EAAAC,gBAAA;IAAAJ,OAAA;IAAAC,OAAA;EAAA;EAAAI,kBAAA;IAAAL,OAAA;IAAAG,OAAA;EAAA;AAAA;EAAAG,CAAA;AAAA,CAsBjB,CAAC;AACF;AACA;AACA;AACA;AAAI,OAAO,MAAMC,uCAAuC,GAAIC,KAAK,IAAG;EAChE,aAAa;;EACb,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1B;EACAP,6BAA6B,CAACqB,KAAK,CAAC;EACpC,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;EAChL;EACAS,KAAK,CAACf,SAAS,CAACoB,SAAS,GAAGvB,YAAY,CAACE,+BAA+B,CAACC,SAAS,EAAEgB,MAAM,CAACd,IAAI,EAAEe,cAAc,EAAEF,KAAK,CAACf,SAAS,CAACoB,SAAS,CAAC;EAC3I,OAAOL,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"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"],"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"],"mappings":"AAAA,YAAY;;AACZ,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,4CAA4C;AACjH,SAAAC,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,MAAMC,8BAA8B,GAAG,6BAA6B;AACpE;AACA;AACA;AAAI,OAAO,MAAMC,+BAA+B,GAAG;EAC/C,GAAGJ,qBAAqB;EACxBK,SAAS,EAAE,GAAGF,8BAA8B;AAChD,CAAC;AACD,MAAMG,SAAS,gBAAGL,QAAA;EAAAM,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,UAAA;IAAAF,OAAA;IAAAG,OAAA;EAAA;EAAAC,gBAAA;IAAAJ,OAAA;IAAAC,OAAA;EAAA;EAAAI,kBAAA;IAAAL,OAAA;IAAAG,OAAA;EAAA;AAAA;EAAAG,CAAA;AAAA,CAsBjB,CAAC;AACF;AACA;AACA;AACA;AAAI,OAAO,MAAMC,uCAAuC,GAAIC,KAAK,IAAG;EAChE,aAAa;;EACb,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1B;EACAP,6BAA6B,CAACqB,KAAK,CAAC;EACpC,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;EAChL;EACA;EACAS,KAAK,CAACf,SAAS,CAACoB,SAAS,GAAGvB,YAAY,CAACE,+BAA+B,CAACC,SAAS,EAAEgB,MAAM,CAACd,IAAI,EAAEe,cAAc,EAAEF,KAAK,CAACf,SAAS,CAACoB,SAAS,CAAC;EAC3I,OAAOL,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -41,6 +41,7 @@ const useStyles = makeStyles({
|
|
|
41
41
|
useVirtualizerStyles_unstable(state);
|
|
42
42
|
const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
|
|
43
43
|
// Add container styles
|
|
44
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
44
45
|
state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
|
|
45
46
|
return state;
|
|
46
47
|
};
|
package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.raw.js.map
CHANGED
|
@@ -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;AAKA,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,6CAA6C;AAClH,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAE1D,MAAMC,iCAAiC;AAEvC;;CAEC,GACD,OAAO,MAAMC,kCAA8E;IACzF,GAAGJ,qBAAqB;IACxBK,WAAW,GAAGF,+BAA+B,WAAW,CAAC;AAC3D,EAAE;AAEF,MAAMG,YAAYL,WAAW;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;AAEA;;;CAGC,GACD,OAAO,MAAMG,0CAA0C,CACrDC;IAEA;IAEA,MAAMC,SAASd;IAEf,kCAAkC;IAClCP,8BAA8BoB;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;
|
|
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;AAKA,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,6CAA6C;AAClH,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAE1D,MAAMC,iCAAiC;AAEvC;;CAEC,GACD,OAAO,MAAMC,kCAA8E;IACzF,GAAGJ,qBAAqB;IACxBK,WAAW,GAAGF,+BAA+B,WAAW,CAAC;AAC3D,EAAE;AAEF,MAAMG,YAAYL,WAAW;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;AAEA;;;CAGC,GACD,OAAO,MAAMG,0CAA0C,CACrDC;IAEA;IAEA,MAAMC,SAASd;IAEf,kCAAkC;IAClCP,8BAA8BoB;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,GAAGtB,aAC1BE,gCAAgCC,SAAS,EACzCe,OAAOb,IAAI,EACXc,gBACAF,MAAMd,SAAS,CAACmB,SAAS;IAG3B,OAAOL;AACT,EAAE"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { useVirtualizerScrollViewDynamic_unstable } from './useVirtualizerScrollViewDynamic';
|
|
3
3
|
import { renderVirtualizerScrollViewDynamic_unstable } from './renderVirtualizerScrollViewDynamic';
|
|
4
4
|
import { useVirtualizerScrollViewDynamicStyles_unstable } from './useVirtualizerScrollViewDynamicStyles.styles';
|
|
5
|
-
import * as React from 'react';
|
|
6
5
|
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
7
6
|
/**
|
|
8
7
|
* Virtualizer ScrollView
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.ts"],"sourcesContent":["'use client';\n\nimport type { VirtualizerScrollViewDynamicProps } from './VirtualizerScrollViewDynamic.types';\nimport { useVirtualizerScrollViewDynamic_unstable } from './useVirtualizerScrollViewDynamic';\nimport { renderVirtualizerScrollViewDynamic_unstable } from './renderVirtualizerScrollViewDynamic';\nimport { useVirtualizerScrollViewDynamicStyles_unstable } from './useVirtualizerScrollViewDynamicStyles.styles';\nimport * as React from 'react';\nimport type { VirtualizerContextProps } from '../../Utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Virtualizer ScrollView\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const VirtualizerScrollViewDynamic = ((\n props: VirtualizerScrollViewDynamicProps,\n // NOTE: this second context parameter doesn't exists in React 19\n _context: React.Context<VirtualizerContextProps>,\n) => {\n const state = useVirtualizerScrollViewDynamic_unstable(props);\n\n useVirtualizerScrollViewDynamicStyles_unstable(state);\n useCustomStyleHook_unstable('useVirtualizerScrollViewDynamicStyles_unstable')(state);\n\n return renderVirtualizerScrollViewDynamic_unstable(state);\n // NOTE: we need to assert the type to satisfy tsc (React 19 FC doesn't have 2nd context parameter anymore)\n}) as React.FC<VirtualizerScrollViewDynamicProps>;\n\nVirtualizerScrollViewDynamic.displayName = 'VirtualizerScrollViewDynamic';\n"],"names":["useVirtualizerScrollViewDynamic_unstable","renderVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable","
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.ts"],"sourcesContent":["'use client';\n\nimport type { VirtualizerScrollViewDynamicProps } from './VirtualizerScrollViewDynamic.types';\nimport { useVirtualizerScrollViewDynamic_unstable } from './useVirtualizerScrollViewDynamic';\nimport { renderVirtualizerScrollViewDynamic_unstable } from './renderVirtualizerScrollViewDynamic';\nimport { useVirtualizerScrollViewDynamicStyles_unstable } from './useVirtualizerScrollViewDynamicStyles.styles';\nimport type * as React from 'react';\nimport type { VirtualizerContextProps } from '../../Utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Virtualizer ScrollView\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const VirtualizerScrollViewDynamic = ((\n props: VirtualizerScrollViewDynamicProps,\n // NOTE: this second context parameter doesn't exists in React 19\n _context: React.Context<VirtualizerContextProps>,\n) => {\n const state = useVirtualizerScrollViewDynamic_unstable(props);\n\n useVirtualizerScrollViewDynamicStyles_unstable(state);\n useCustomStyleHook_unstable('useVirtualizerScrollViewDynamicStyles_unstable')(state);\n\n return renderVirtualizerScrollViewDynamic_unstable(state);\n // NOTE: we need to assert the type to satisfy tsc (React 19 FC doesn't have 2nd context parameter anymore)\n}) as React.FC<VirtualizerScrollViewDynamicProps>;\n\nVirtualizerScrollViewDynamic.displayName = 'VirtualizerScrollViewDynamic';\n"],"names":["useVirtualizerScrollViewDynamic_unstable","renderVirtualizerScrollViewDynamic_unstable","useVirtualizerScrollViewDynamicStyles_unstable","useCustomStyleHook_unstable","VirtualizerScrollViewDynamic","props","_context","state","displayName"],"mappings":"AAAA;AAGA,SAASA,wCAAwC,QAAQ,oCAAoC;AAC7F,SAASC,2CAA2C,QAAQ,uCAAuC;AACnG,SAASC,8CAA8C,QAAQ,iDAAiD;AAGhH,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,+BAAgC,CAC3CC,OACA,iEAAiE;AACjEC;IAEA,MAAMC,QAAQP,yCAAyCK;IAEvDH,+CAA+CK;IAC/CJ,4BAA4B,kDAAkDI;IAE9E,OAAON,4CAA4CM;AACnD,2GAA2G;AAC7G,EAAkD;AAElDH,6BAA6BI,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type {\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\n\nimport type { VirtualizerScrollViewSlots } from '../VirtualizerScrollView/VirtualizerScrollView.types';\nimport type { DynamicVirtualizerContextProps, ScrollToInterface } from '../../Utilities';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> &\n Partial<\n Omit<\n VirtualizerConfigProps,\n 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'virtualizerContext'\n >\n > & {\n /**\n * Set as the minimum item size.\n * Axis: 'vertical' = Height\n * Axis: 'horizontal' = Width\n */\n itemSize: number;\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n * If undefined, Virtualizer will auto-measure by default (performance tradeoff)\n */\n getItemSize?: (index: number) => number;\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\n /**\n * Child render function.\n * Iteratively called to return current virtualizer DOM children.\n * Will act as a row or column indexer depending on Virtualizer settings.\n */\n children: VirtualizerChildRenderFunction;\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeRef?: React.RefObject<ScrollToInterface | null>;\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n enablePagination?: boolean;\n /**\n * Enables override of dynamic virtualizer context if required.\n */\n virtualizerContext?: DynamicVirtualizerContextProps;\n };\n\nexport type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> &\n VirtualizerConfigState;\n"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type {\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\n\nimport type { VirtualizerScrollViewSlots } from '../VirtualizerScrollView/VirtualizerScrollView.types';\nimport type { DynamicVirtualizerContextProps, ScrollToInterface } from '../../Utilities';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> &\n Partial<\n Omit<\n VirtualizerConfigProps,\n 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'virtualizerContext'\n >\n > & {\n /**\n * Set as the minimum item size.\n * Axis: 'vertical' = Height\n * Axis: 'horizontal' = Width\n */\n itemSize: number;\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n * If undefined, Virtualizer will auto-measure by default (performance tradeoff)\n */\n getItemSize?: (index: number) => number;\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\n /**\n * Child render function.\n * Iteratively called to return current virtualizer DOM children.\n * Will act as a row or column indexer depending on Virtualizer settings.\n */\n children: VirtualizerChildRenderFunction;\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeRef?: React.RefObject<ScrollToInterface | null>;\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n enablePagination?: boolean;\n /**\n * Enables override of dynamic virtualizer context if required.\n */\n virtualizerContext?: DynamicVirtualizerContextProps;\n };\n\nexport type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> &\n VirtualizerConfigState;\n"],"names":[],"mappings":"AA8DA,WACyB"}
|
package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport type * as React from 'react';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport {\n VirtualizerScrollViewDynamicSlots,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const renderVirtualizerScrollViewDynamic_unstable = (\n state: VirtualizerScrollViewDynamicState,\n): React.ReactElement => {\n assertSlots<VirtualizerScrollViewDynamicSlots>(state);\n return <state.container>{renderVirtualizer_unstable(state)}</state.container>;\n};\n"],"names":["assertSlots","renderVirtualizer_unstable","renderVirtualizerScrollViewDynamic_unstable","state","container"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD,SAASC,0BAA0B,QAAQ,mCAAmC;AAE9E;;CAEC,GACD,OAAO,MAAMC,8CAA8C,CACzDC;IAEAH,YAA+CG;IAC/C,qBAAO,KAACA,MAAMC,SAAS;kBAAEH,2BAA2BE;;AACtD,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport type * as React from 'react';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type {\n VirtualizerScrollViewDynamicSlots,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const renderVirtualizerScrollViewDynamic_unstable = (\n state: VirtualizerScrollViewDynamicState,\n): React.ReactElement => {\n assertSlots<VirtualizerScrollViewDynamicSlots>(state);\n return <state.container>{renderVirtualizer_unstable(state)}</state.container>;\n};\n"],"names":["assertSlots","renderVirtualizer_unstable","renderVirtualizerScrollViewDynamic_unstable","state","container"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD,SAASC,0BAA0B,QAAQ,mCAAmC;AAE9E;;CAEC,GACD,OAAO,MAAMC,8CAA8C,CACzDC;IAEAH,YAA+CG;IAC/C,qBAAO,KAACA,MAAMC,SAAS;kBAAEH,2BAA2BE;;AACtD,EAAE"}
|
|
@@ -42,15 +42,19 @@ import { useDynamicVirtualizerPagination } from '../../hooks/useDynamicPaginatio
|
|
|
42
42
|
});
|
|
43
43
|
const _imperativeVirtualizerRef = useMergedRefs(React.useRef(null), imperativeVirtualizerRef);
|
|
44
44
|
var _contextState_contextIndex;
|
|
45
|
-
const paginationRef = useDynamicVirtualizerPagination(
|
|
45
|
+
const paginationRef = useDynamicVirtualizerPagination(// eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
|
|
46
|
+
{
|
|
46
47
|
axis,
|
|
48
|
+
// eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
|
|
47
49
|
progressiveItemSizes: (_imperativeVirtualizerRef_current = _imperativeVirtualizerRef.current) === null || _imperativeVirtualizerRef_current === void 0 ? void 0 : _imperativeVirtualizerRef_current.progressiveSizes,
|
|
48
50
|
virtualizerLength,
|
|
49
51
|
currentIndex: (_contextState_contextIndex = contextState === null || contextState === void 0 ? void 0 : contextState.contextIndex) !== null && _contextState_contextIndex !== void 0 ? _contextState_contextIndex : 0
|
|
50
52
|
}, enablePagination);
|
|
51
53
|
// Store the virtualizer length as a ref for imperative ref access
|
|
52
54
|
const virtualizerLengthRef = React.useRef(virtualizerLength);
|
|
55
|
+
// eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
|
|
53
56
|
if (virtualizerLengthRef.current !== virtualizerLength) {
|
|
57
|
+
// eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
|
|
54
58
|
virtualizerLengthRef.current = virtualizerLength;
|
|
55
59
|
}
|
|
56
60
|
const scrollViewRef = useMergedRefs(props.scrollViewRef, scrollRef, paginationRef);
|
|
@@ -110,6 +114,7 @@ import { useDynamicVirtualizerPagination } from '../../hooks/useDynamicPaginatio
|
|
|
110
114
|
triggers a re-render but is only required on pagination (else index change handles) */ setSizeUpdateCount(measureObject.sizeUpdateCount);
|
|
111
115
|
}
|
|
112
116
|
if (axis === 'horizontal') {
|
|
117
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
113
118
|
sizeTrackingArray = measureObject.widthArray;
|
|
114
119
|
} else {
|
|
115
120
|
sizeTrackingArray = measureObject.heightArray;
|
|
@@ -118,6 +123,7 @@ import { useDynamicVirtualizerPagination } from '../../hooks/useDynamicPaginatio
|
|
|
118
123
|
// Auto-measuring is required
|
|
119
124
|
React.Children.map(virtualizerState.virtualizedChildren, (child, index)=>{
|
|
120
125
|
if (/*#__PURE__*/ React.isValidElement(child)) {
|
|
126
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
121
127
|
virtualizerState.virtualizedChildren[index] = /*#__PURE__*/ React.createElement(child.type, {
|
|
122
128
|
...child.props,
|
|
123
129
|
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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAChE,SAASC,uBAAuB,QAAQ,gCAAgC;AAKxE,SAASC,4BAA4B,Q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AAMM,cAAc,CAAC,QAAQ;4BAC/B,wEAAwE;4BACxE,+DAA+D;4BAC/D,MAAMC,WAAYP,kBAAAA,4BAAD,AAACA,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,KAAKkF,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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAChE,SAASC,uBAAuB,QAAQ,gCAAgC;AAKxE,SAASC,4BAA4B,QAAQ,cAAc;AAC3D,SAASC,mCAAmC,EAAEC,mBAAmB,QAAQ,kBAAkB;AAE3F,SAASC,cAAc,QAAQ,6BAA6B;AAE5D,SAASC,+BAA+B,QAAQ,mCAAmC;AAEnF;;CAEC,GACD,OAAO,SAASC,yCACdC,KAAwC;IAExC;QAmD0BC;IAjD1B,MAAMC,eAAeP,oCAAoCK,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,MAAMwB,MAAM,CAAW,IAAIC,MAAMf,MAAMgB,QAAQ,EAAEC,IAAI,CAACjB,MAAMkB,QAAQ;IAE5F,0DAA0D;IAC1D,MAAM,CAACC,iBAAiBC,mBAAmB,GAAG9B,MAAM+B,QAAQ,CAAC;IAE7D,MAAMC,mBAAmBhC,MAAMiC,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,uDAAuD;IACvD;QAACX;QAAmBb,MAAMkB,QAAQ;QAAEC;KAAgB;QAMvCnB,aACEA;IAJjB,MAAM,EAAE2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cG,WAAW;IAC/C;IAEA,IAAI,CAAC1D,MAAMiC,WAAW,EAAE;QACtB,6BAA6B;QAC7B3C,MAAMqE,QAAQ,CAACC,GAAG,CAACP,iBAAiBQ,mBAAmB,EAAE,CAACC,OAAOtC;YAC/D,kBAAIlC,MAAMyE,cAAc,CAACD,QAAQ;gBAC/B,iGAAiG;gBACjGT,iBAAiBQ,mBAAmB,CAACrC,MAAM,iBACzC,oBAACsC,MAAME,IAAI;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,kBAAAA,4BAAD,AAACA,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,KAAKkF,MAAM,CAACzE,MAAMwE,SAAS,EAAE;YACtCE,cAAc;gBACZR,KAAK1B;YACP;YACAmC,aAAa;QACf;IACF;AACF"}
|
package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js
CHANGED
|
@@ -47,6 +47,7 @@ export const useVirtualizerScrollViewDynamicStyles_unstable = state => {
|
|
|
47
47
|
useVirtualizerStyles_unstable(state);
|
|
48
48
|
const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
|
|
49
49
|
// Add container styles
|
|
50
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
50
51
|
state.container.className = mergeClasses(virtualizerScrollViewDynamicClassNames.container, styles.base, containerStyle, state.container.className);
|
|
51
52
|
return state;
|
|
52
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewDynamicClassName","virtualizerScrollViewDynamicClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","useVirtualizerScrollViewDynamicStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"sources":["useVirtualizerScrollViewDynamicStyles.styles.js"],"sourcesContent":["'use client';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerScrollViewDynamicClassName = 'fui-Virtualizer-Scroll-View-Dynamic';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const virtualizerScrollViewDynamicClassNames = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewDynamicClassName}__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 useVirtualizerScrollViewDynamicStyles_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(virtualizerScrollViewDynamicClassNames.container, styles.base, containerStyle, state.container.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,4CAA4C;AACjH,SAAAC,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,MAAMC,qCAAqC,GAAG,qCAAqC;AACnF;AACA;AACA;AAAI,OAAO,MAAMC,sCAAsC,GAAG;EACtD,GAAGJ,qBAAqB;EACxBK,SAAS,EAAE,GAAGF,qCAAqC;AACvD,CAAC;AACD,MAAMG,SAAS,gBAAGL,QAAA;EAAAM,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,UAAA;IAAAF,OAAA;IAAAG,OAAA;EAAA;EAAAC,gBAAA;IAAAJ,OAAA;IAAAC,OAAA;EAAA;EAAAI,kBAAA;IAAAL,OAAA;IAAAG,OAAA;EAAA;AAAA;EAAAG,CAAA;AAAA,CAsBjB,CAAC;AACF;AACA;AACA;AACA;AAAI,OAAO,MAAMC,8CAA8C,GAAIC,KAAK,IAAG;EACvE,aAAa;;EACb,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1B;EACAP,6BAA6B,CAACqB,KAAK,CAAC;EACpC,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;EAChL;EACAS,KAAK,CAACf,SAAS,CAACoB,SAAS,GAAGvB,YAAY,CAACE,sCAAsC,CAACC,SAAS,EAAEgB,MAAM,CAACd,IAAI,EAAEe,cAAc,EAAEF,KAAK,CAACf,SAAS,CAACoB,SAAS,CAAC;EAClJ,OAAOL,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewDynamicClassName","virtualizerScrollViewDynamicClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","useVirtualizerScrollViewDynamicStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"sources":["useVirtualizerScrollViewDynamicStyles.styles.js"],"sourcesContent":["'use client';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nconst virtualizerScrollViewDynamicClassName = 'fui-Virtualizer-Scroll-View-Dynamic';\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */ export const virtualizerScrollViewDynamicClassNames = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewDynamicClassName}__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 useVirtualizerScrollViewDynamicStyles_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(virtualizerScrollViewDynamicClassNames.container, styles.base, containerStyle, state.container.className);\n return state;\n};\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,4CAA4C;AACjH,SAAAC,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,MAAMC,qCAAqC,GAAG,qCAAqC;AACnF;AACA;AACA;AAAI,OAAO,MAAMC,sCAAsC,GAAG;EACtD,GAAGJ,qBAAqB;EACxBK,SAAS,EAAE,GAAGF,qCAAqC;AACvD,CAAC;AACD,MAAMG,SAAS,gBAAGL,QAAA;EAAAM,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,UAAA;IAAAF,OAAA;IAAAG,OAAA;EAAA;EAAAC,gBAAA;IAAAJ,OAAA;IAAAC,OAAA;EAAA;EAAAI,kBAAA;IAAAL,OAAA;IAAAG,OAAA;EAAA;AAAA;EAAAG,CAAA;AAAA,CAsBjB,CAAC;AACF;AACA;AACA;AACA;AAAI,OAAO,MAAMC,8CAA8C,GAAIC,KAAK,IAAG;EACvE,aAAa;;EACb,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1B;EACAP,6BAA6B,CAACqB,KAAK,CAAC;EACpC,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;EAChL;EACA;EACAS,KAAK,CAACf,SAAS,CAACoB,SAAS,GAAGvB,YAAY,CAACE,sCAAsC,CAACC,SAAS,EAAEgB,MAAM,CAACd,IAAI,EAAEe,cAAc,EAAEF,KAAK,CAACf,SAAS,CAACoB,SAAS,CAAC;EAClJ,OAAOL,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -41,6 +41,7 @@ const useStyles = makeStyles({
|
|
|
41
41
|
useVirtualizerStyles_unstable(state);
|
|
42
42
|
const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
|
|
43
43
|
// Add container styles
|
|
44
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
44
45
|
state.container.className = mergeClasses(virtualizerScrollViewDynamicClassNames.container, styles.base, containerStyle, state.container.className);
|
|
45
46
|
return state;
|
|
46
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type {\n VirtualizerScrollViewDynamicSlots,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst virtualizerScrollViewDynamicClassName = 'fui-Virtualizer-Scroll-View-Dynamic';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const virtualizerScrollViewDynamicClassNames: SlotClassNames<VirtualizerScrollViewDynamicSlots> = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewDynamicClassName}__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 useVirtualizerScrollViewDynamicStyles_unstable = (\n state: VirtualizerScrollViewDynamicState,\n): VirtualizerScrollViewDynamicState => {\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 virtualizerScrollViewDynamicClassNames.container,\n styles.base,\n containerStyle,\n state.container.className,\n );\n\n return state;\n};\n"],"names":["useVirtualizerStyles_unstable","virtualizerClassNames","makeStyles","mergeClasses","virtualizerScrollViewDynamicClassName","virtualizerScrollViewDynamicClassNames","container","useStyles","base","display","width","height","vertical","flexDirection","overflowY","horizontal","overflowX","verticalReversed","horizontalReversed","useVirtualizerScrollViewDynamicStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"mappings":"AAAA;AAOA,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,6CAA6C;AAClH,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAE1D,MAAMC,wCAAwC;AAE9C;;CAEC,GACD,OAAO,MAAMC,yCAA4F;IACvG,GAAGJ,qBAAqB;IACxBK,WAAW,GAAGF,sCAAsC,WAAW,CAAC;AAClE,EAAE;AAEF,MAAMG,YAAYL,WAAW;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;AAEA;;;CAGC,GACD,OAAO,MAAMG,iDAAiD,CAC5DC;IAEA;IAEA,MAAMC,SAASd;IAEf,kCAAkC;IAClCP,8BAA8BoB;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;
|
|
1
|
+
{"version":3,"sources":["../src/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type {\n VirtualizerScrollViewDynamicSlots,\n VirtualizerScrollViewDynamicState,\n} from './VirtualizerScrollViewDynamic.types';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles.styles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst virtualizerScrollViewDynamicClassName = 'fui-Virtualizer-Scroll-View-Dynamic';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const virtualizerScrollViewDynamicClassNames: SlotClassNames<VirtualizerScrollViewDynamicSlots> = {\n ...virtualizerClassNames,\n container: `${virtualizerScrollViewDynamicClassName}__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 useVirtualizerScrollViewDynamicStyles_unstable = (\n state: VirtualizerScrollViewDynamicState,\n): VirtualizerScrollViewDynamicState => {\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 virtualizerScrollViewDynamicClassNames.container,\n styles.base,\n containerStyle,\n state.container.className,\n );\n\n return state;\n};\n"],"names":["useVirtualizerStyles_unstable","virtualizerClassNames","makeStyles","mergeClasses","virtualizerScrollViewDynamicClassName","virtualizerScrollViewDynamicClassNames","container","useStyles","base","display","width","height","vertical","flexDirection","overflowY","horizontal","overflowX","verticalReversed","horizontalReversed","useVirtualizerScrollViewDynamicStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"mappings":"AAAA;AAOA,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ,6CAA6C;AAClH,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAE1D,MAAMC,wCAAwC;AAE9C;;CAEC,GACD,OAAO,MAAMC,yCAA4F;IACvG,GAAGJ,qBAAqB;IACxBK,WAAW,GAAGF,sCAAsC,WAAW,CAAC;AAClE,EAAE;AAEF,MAAMG,YAAYL,WAAW;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;AAEA;;;CAGC,GACD,OAAO,MAAMG,iDAAiD,CAC5DC;IAEA;IAEA,MAAMC,SAASd;IAEf,kCAAkC;IAClCP,8BAA8BoB;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,GAAGtB,aAC1BE,uCAAuCC,SAAS,EAChDe,OAAOb,IAAI,EACXc,gBACAF,MAAMd,SAAS,CAACmB,SAAS;IAG3B,OAAOL;AACT,EAAE"}
|
package/lib/hooks/hooks.types.js
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Additional direct Ref prevents reading old resize entry data
|
|
3
|
+
* Backwards compatible with ResizeObserverCallback if preferred
|
|
4
|
+
* @deprecated migrated to \@fluentui\-contrib/react\-virtualizer for stable release.
|
|
5
|
+
*/ export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/hooks.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { DynamicVirtualizerContextProps } from '../Utilities';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerMeasureProps = {\n defaultItemSize: number;\n direction?: 'vertical' | 'horizontal';\n\n /**\n * Override recommended number of buffer items\n */\n bufferItems?: number;\n\n /**\n * Override recommended buffer size (px)\n */\n bufferSize?: number;\n};\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerMeasureDynamicProps = {\n defaultItemSize: number;\n virtualizerContext: DynamicVirtualizerContextProps;\n numItems: number;\n getItemSize: (index: number) => number;\n direction?: 'vertical' | 'horizontal';\n\n /**\n * Override recommended number of buffer items\n */\n bufferItems?: number;\n\n /**\n * Override recommended buffer size (px)\n */\n bufferSize?: number;\n};\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerStaticPaginationProps = {\n itemSize: number;\n axis?: 'vertical' | 'horizontal';\n};\n\n/**\n * Props to be passed into dynamic virtualization hooks\n * All props can be acquired from useVirtualizer hooks themselves and passed in\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerDynamicPaginationProps = {\n /**\n * An array that tracks the sizing of each item in virtualizer cumulatively\n */\n progressiveItemSizes: React.RefObject<number[]> | undefined;\n /**\n * The current starting index of the virtualizer's DOM elements\n */\n currentIndex: number;\n /**\n * The axis we should paginate on (should match virtualizer's axis)\n */\n axis?: 'vertical' | 'horizontal';\n /**\n * The current length of Virtualizer's actual DOM elements\n */\n virtualizerLength: number;\n};\n\n/**\n * Additional direct Ref prevents reading old resize entry data\n * Backwards compatible with ResizeObserverCallback if preferred\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport interface ResizeCallbackWithRef {\n (\n entries: ResizeObserverEntry[],\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n observer: ResizeObserver,\n
|
|
1
|
+
{"version":3,"sources":["../src/hooks/hooks.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { DynamicVirtualizerContextProps } from '../Utilities';\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerMeasureProps = {\n defaultItemSize: number;\n direction?: 'vertical' | 'horizontal';\n\n /**\n * Override recommended number of buffer items\n */\n bufferItems?: number;\n\n /**\n * Override recommended buffer size (px)\n */\n bufferSize?: number;\n};\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerMeasureDynamicProps = {\n defaultItemSize: number;\n virtualizerContext: DynamicVirtualizerContextProps;\n numItems: number;\n getItemSize: (index: number) => number;\n direction?: 'vertical' | 'horizontal';\n\n /**\n * Override recommended number of buffer items\n */\n bufferItems?: number;\n\n /**\n * Override recommended buffer size (px)\n */\n bufferSize?: number;\n};\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerStaticPaginationProps = {\n itemSize: number;\n axis?: 'vertical' | 'horizontal';\n};\n\n/**\n * Props to be passed into dynamic virtualization hooks\n * All props can be acquired from useVirtualizer hooks themselves and passed in\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerDynamicPaginationProps = {\n /**\n * An array that tracks the sizing of each item in virtualizer cumulatively\n */\n progressiveItemSizes: React.RefObject<number[]> | undefined;\n /**\n * The current starting index of the virtualizer's DOM elements\n */\n currentIndex: number;\n /**\n * The axis we should paginate on (should match virtualizer's axis)\n */\n axis?: 'vertical' | 'horizontal';\n /**\n * The current length of Virtualizer's actual DOM elements\n */\n virtualizerLength: number;\n};\n\n/**\n * Additional direct Ref prevents reading old resize entry data\n * Backwards compatible with ResizeObserverCallback if preferred\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport interface ResizeCallbackWithRef {\n (\n entries: ResizeObserverEntry[],\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n observer: ResizeObserver,\n\n scrollRef?: React.MutableRefObject<HTMLElement | null>,\n ): void;\n}\n"],"names":[],"mappings":"AA0EA;;;;CAIC,GACD,WASC"}
|
|
@@ -16,6 +16,7 @@ import { useTimeout } from '@fluentui/react-utilities';
|
|
|
16
16
|
const scrollContainer = React.useRef(null);
|
|
17
17
|
const clearListeners = ()=>{
|
|
18
18
|
if (scrollContainer.current) {
|
|
19
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
19
20
|
scrollContainer.current.removeEventListener('scroll', onScroll);
|
|
20
21
|
scrollContainer.current = null;
|
|
21
22
|
clearScrollTimer();
|
|
@@ -94,7 +95,8 @@ import { useTimeout } from '@fluentui/react-utilities';
|
|
|
94
95
|
]);
|
|
95
96
|
/**
|
|
96
97
|
* On scroll timer that will continuously delay callback until scrolling stops
|
|
97
|
-
*/
|
|
98
|
+
*/ // eslint-disable-next-line react-hooks/preserve-manual-memoization -- deprecated package, not worth refactoring
|
|
99
|
+
const onScroll = React.useCallback(()=>{
|
|
98
100
|
clearScrollTimer();
|
|
99
101
|
setScrollTimer(onScrollEnd, 100);
|
|
100
102
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useDynamicPagination.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { VirtualizerDynamicPaginationProps } from './hooks.types';\nimport { useTimeout } from '@fluentui/react-utilities';\n\n/**\n * Optional hook that will enable pagination on the virtualizer so that it 'autoscrolls' to an items exact position\n * Sizes are dynamic so we require a progressive sizing array (passed in from Dynamic virtualizer hooks)\n * On short scrolls, we will go at minimum to the next/previous item so that arrow pagination works\n * All VirtualizerDynamicPaginationProps can be grabbed from dynamic Virtualizer hooks externally and passed in\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useDynamicVirtualizerPagination = (\n virtualizerProps: VirtualizerDynamicPaginationProps,\n paginationEnabled: Boolean = true,\n): ((instance: HTMLElement | HTMLDivElement | null) => void) => {\n 'use no memo';\n\n const { axis = 'vertical', currentIndex, progressiveItemSizes, virtualizerLength } = virtualizerProps;\n\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const lastScrollPos = React.useRef<number>(-1);\n const lastIndexScrolled = React.useRef<number>(-1);\n\n const scrollContainer = React.useRef<HTMLElement | null>(null);\n\n const clearListeners = () => {\n if (scrollContainer.current) {\n scrollContainer.current.removeEventListener('scroll', onScroll);\n scrollContainer.current = null;\n clearScrollTimer();\n }\n };\n\n React.useEffect(() => {\n return () => {\n clearListeners();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /**\n * Handle scroll stop event and paginate to the closest item\n * If the closest item is the same as the previous scroll end\n * we paginate to the next/previous one based on direction\n *\n * Users/Virtualizer-Hooks must pass in a cumulative array of sizes\n * This prevents the need to recalculate and ensures size arrays are synced externally\n */\n const onScrollEnd = React.useCallback(() => {\n if (!scrollContainer.current || !paginationEnabled || !progressiveItemSizes?.current) {\n // No container found\n return;\n }\n\n const currentScrollPos = Math.round(\n axis === 'vertical' ? scrollContainer.current.scrollTop : scrollContainer.current.scrollLeft,\n );\n let closestItemPos = 0;\n let closestItem = 0;\n const endItem = Math.min(currentIndex + virtualizerLength, progressiveItemSizes.current.length);\n\n for (let i = currentIndex; i < endItem - 1; i++) {\n if (\n currentScrollPos <= progressiveItemSizes.current[i + 1] &&\n currentScrollPos >= progressiveItemSizes.current[i]\n ) {\n // Found our in between position\n const distanceToPrev = Math.abs(currentScrollPos - progressiveItemSizes.current[i]);\n const distanceToNext = Math.abs(progressiveItemSizes.current[i + 1] - currentScrollPos);\n if (distanceToPrev < distanceToNext) {\n closestItem = i;\n } else {\n closestItem = i + 1;\n }\n break;\n }\n }\n\n let nextItem;\n if (Math.round(closestItem - lastIndexScrolled.current) === 0) {\n // Special case for go to next/previous with minimum amount of scroll needed\n const nextTarget = lastScrollPos.current < currentScrollPos ? 1 : -1;\n // This will also handle a case where we scrolled to the exact correct position (noop)\n const isSecondaryScroll = Math.round(lastScrollPos.current - currentScrollPos) === 0;\n const posMod = isSecondaryScroll ? 0 : nextTarget;\n nextItem = closestItem + posMod;\n } else {\n // Pagination for anything else can just jump to the closest!\n nextItem = closestItem;\n }\n\n // Safeguard nextItem\n nextItem = Math.min(Math.max(0, nextItem), progressiveItemSizes.current.length);\n closestItemPos = progressiveItemSizes.current[nextItem];\n\n if (axis === 'vertical') {\n scrollContainer.current.scrollTo({ top: closestItemPos, behavior: 'smooth' });\n } else {\n scrollContainer.current.scrollTo({ left: closestItemPos, behavior: 'smooth' });\n }\n lastScrollPos.current = progressiveItemSizes.current[nextItem];\n lastIndexScrolled.current = nextItem;\n }, [paginationEnabled, currentIndex, scrollContainer, virtualizerLength, axis, progressiveItemSizes]);\n\n /**\n * On scroll timer that will continuously delay callback until scrolling stops\n */\n const onScroll = React.useCallback(() => {\n clearScrollTimer();\n setScrollTimer(onScrollEnd, 100);\n }, [onScrollEnd, clearScrollTimer, setScrollTimer]);\n\n /**\n * Pagination ref will ensure we attach listeners to containers on change\n * It is returned from hook and merged into the scroll container externally\n */\n const paginationRef = React.useCallback(\n (instance: HTMLElement | HTMLDivElement | null) => {\n if (!paginationEnabled) {\n clearListeners();\n scrollContainer.current = null;\n return;\n }\n if (scrollContainer.current !== instance) {\n clearListeners();\n\n scrollContainer.current = instance;\n if (scrollContainer.current) {\n scrollContainer.current.addEventListener('scroll', onScroll);\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [onScroll, onScrollEnd, paginationEnabled],\n );\n\n return paginationRef;\n};\n"],"names":["React","useTimeout","useDynamicVirtualizerPagination","virtualizerProps","paginationEnabled","axis","currentIndex","progressiveItemSizes","virtualizerLength","setScrollTimer","clearScrollTimer","lastScrollPos","useRef","lastIndexScrolled","scrollContainer","clearListeners","current","removeEventListener","onScroll","useEffect","onScrollEnd","useCallback","currentScrollPos","Math","round","scrollTop","scrollLeft","closestItemPos","closestItem","endItem","min","length","i","distanceToPrev","abs","distanceToNext","nextItem","nextTarget","isSecondaryScroll","posMod","max","scrollTo","top","behavior","left","paginationRef","instance","addEventListener"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,UAAU,QAAQ,4BAA4B;AAEvD;;;;;;CAMC,GACD,OAAO,MAAMC,kCAAkC,CAC7CC,kBACAC,oBAA6B,IAAI;IAEjC;IAEA,MAAM,EAAEC,OAAO,UAAU,EAAEC,YAAY,EAAEC,oBAAoB,EAAEC,iBAAiB,EAAE,GAAGL;IAErF,MAAM,CAACM,gBAAgBC,iBAAiB,GAAGT;IAC3C,MAAMU,gBAAgBX,MAAMY,MAAM,CAAS,CAAC;IAC5C,MAAMC,oBAAoBb,MAAMY,MAAM,CAAS,CAAC;IAEhD,MAAME,kBAAkBd,MAAMY,MAAM,CAAqB;IAEzD,MAAMG,iBAAiB;QACrB,IAAID,gBAAgBE,OAAO,EAAE;
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useDynamicPagination.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { VirtualizerDynamicPaginationProps } from './hooks.types';\nimport { useTimeout } from '@fluentui/react-utilities';\n\n/**\n * Optional hook that will enable pagination on the virtualizer so that it 'autoscrolls' to an items exact position\n * Sizes are dynamic so we require a progressive sizing array (passed in from Dynamic virtualizer hooks)\n * On short scrolls, we will go at minimum to the next/previous item so that arrow pagination works\n * All VirtualizerDynamicPaginationProps can be grabbed from dynamic Virtualizer hooks externally and passed in\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useDynamicVirtualizerPagination = (\n virtualizerProps: VirtualizerDynamicPaginationProps,\n paginationEnabled: Boolean = true,\n): ((instance: HTMLElement | HTMLDivElement | null) => void) => {\n 'use no memo';\n\n const { axis = 'vertical', currentIndex, progressiveItemSizes, virtualizerLength } = virtualizerProps;\n\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const lastScrollPos = React.useRef<number>(-1);\n const lastIndexScrolled = React.useRef<number>(-1);\n\n const scrollContainer = React.useRef<HTMLElement | null>(null);\n\n const clearListeners = () => {\n if (scrollContainer.current) {\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n scrollContainer.current.removeEventListener('scroll', onScroll);\n scrollContainer.current = null;\n clearScrollTimer();\n }\n };\n\n React.useEffect(() => {\n return () => {\n clearListeners();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /**\n * Handle scroll stop event and paginate to the closest item\n * If the closest item is the same as the previous scroll end\n * we paginate to the next/previous one based on direction\n *\n * Users/Virtualizer-Hooks must pass in a cumulative array of sizes\n * This prevents the need to recalculate and ensures size arrays are synced externally\n */\n const onScrollEnd = React.useCallback(() => {\n if (!scrollContainer.current || !paginationEnabled || !progressiveItemSizes?.current) {\n // No container found\n return;\n }\n\n const currentScrollPos = Math.round(\n axis === 'vertical' ? scrollContainer.current.scrollTop : scrollContainer.current.scrollLeft,\n );\n let closestItemPos = 0;\n let closestItem = 0;\n const endItem = Math.min(currentIndex + virtualizerLength, progressiveItemSizes.current.length);\n\n for (let i = currentIndex; i < endItem - 1; i++) {\n if (\n currentScrollPos <= progressiveItemSizes.current[i + 1] &&\n currentScrollPos >= progressiveItemSizes.current[i]\n ) {\n // Found our in between position\n const distanceToPrev = Math.abs(currentScrollPos - progressiveItemSizes.current[i]);\n const distanceToNext = Math.abs(progressiveItemSizes.current[i + 1] - currentScrollPos);\n if (distanceToPrev < distanceToNext) {\n closestItem = i;\n } else {\n closestItem = i + 1;\n }\n break;\n }\n }\n\n let nextItem;\n if (Math.round(closestItem - lastIndexScrolled.current) === 0) {\n // Special case for go to next/previous with minimum amount of scroll needed\n const nextTarget = lastScrollPos.current < currentScrollPos ? 1 : -1;\n // This will also handle a case where we scrolled to the exact correct position (noop)\n const isSecondaryScroll = Math.round(lastScrollPos.current - currentScrollPos) === 0;\n const posMod = isSecondaryScroll ? 0 : nextTarget;\n nextItem = closestItem + posMod;\n } else {\n // Pagination for anything else can just jump to the closest!\n nextItem = closestItem;\n }\n\n // Safeguard nextItem\n nextItem = Math.min(Math.max(0, nextItem), progressiveItemSizes.current.length);\n closestItemPos = progressiveItemSizes.current[nextItem];\n\n if (axis === 'vertical') {\n scrollContainer.current.scrollTo({ top: closestItemPos, behavior: 'smooth' });\n } else {\n scrollContainer.current.scrollTo({ left: closestItemPos, behavior: 'smooth' });\n }\n lastScrollPos.current = progressiveItemSizes.current[nextItem];\n lastIndexScrolled.current = nextItem;\n }, [paginationEnabled, currentIndex, scrollContainer, virtualizerLength, axis, progressiveItemSizes]);\n\n /**\n * On scroll timer that will continuously delay callback until scrolling stops\n */\n // eslint-disable-next-line react-hooks/preserve-manual-memoization -- deprecated package, not worth refactoring\n const onScroll = React.useCallback(() => {\n clearScrollTimer();\n setScrollTimer(onScrollEnd, 100);\n }, [onScrollEnd, clearScrollTimer, setScrollTimer]);\n\n /**\n * Pagination ref will ensure we attach listeners to containers on change\n * It is returned from hook and merged into the scroll container externally\n */\n const paginationRef = React.useCallback(\n (instance: HTMLElement | HTMLDivElement | null) => {\n if (!paginationEnabled) {\n clearListeners();\n scrollContainer.current = null;\n return;\n }\n if (scrollContainer.current !== instance) {\n clearListeners();\n\n scrollContainer.current = instance;\n if (scrollContainer.current) {\n scrollContainer.current.addEventListener('scroll', onScroll);\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [onScroll, onScrollEnd, paginationEnabled],\n );\n\n return paginationRef;\n};\n"],"names":["React","useTimeout","useDynamicVirtualizerPagination","virtualizerProps","paginationEnabled","axis","currentIndex","progressiveItemSizes","virtualizerLength","setScrollTimer","clearScrollTimer","lastScrollPos","useRef","lastIndexScrolled","scrollContainer","clearListeners","current","removeEventListener","onScroll","useEffect","onScrollEnd","useCallback","currentScrollPos","Math","round","scrollTop","scrollLeft","closestItemPos","closestItem","endItem","min","length","i","distanceToPrev","abs","distanceToNext","nextItem","nextTarget","isSecondaryScroll","posMod","max","scrollTo","top","behavior","left","paginationRef","instance","addEventListener"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,UAAU,QAAQ,4BAA4B;AAEvD;;;;;;CAMC,GACD,OAAO,MAAMC,kCAAkC,CAC7CC,kBACAC,oBAA6B,IAAI;IAEjC;IAEA,MAAM,EAAEC,OAAO,UAAU,EAAEC,YAAY,EAAEC,oBAAoB,EAAEC,iBAAiB,EAAE,GAAGL;IAErF,MAAM,CAACM,gBAAgBC,iBAAiB,GAAGT;IAC3C,MAAMU,gBAAgBX,MAAMY,MAAM,CAAS,CAAC;IAC5C,MAAMC,oBAAoBb,MAAMY,MAAM,CAAS,CAAC;IAEhD,MAAME,kBAAkBd,MAAMY,MAAM,CAAqB;IAEzD,MAAMG,iBAAiB;QACrB,IAAID,gBAAgBE,OAAO,EAAE;YAC3B,iGAAiG;YACjGF,gBAAgBE,OAAO,CAACC,mBAAmB,CAAC,UAAUC;YACtDJ,gBAAgBE,O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{ useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts
|
|
|
18
18
|
const { virtualizerLength, virtualizerBufferItems, virtualizerBufferSize } = state;
|
|
19
19
|
const { targetDocument } = useFluent();
|
|
20
20
|
const container = React.useRef(null);
|
|
21
|
-
const handleScrollResize = React.useCallback(
|
|
22
|
-
(scrollRef)=>{
|
|
21
|
+
const handleScrollResize = React.useCallback((scrollRef)=>{
|
|
23
22
|
if (!(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
|
|
24
23
|
// Error? ignore?
|
|
25
24
|
return;
|
|
@@ -90,8 +89,7 @@ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts
|
|
|
90
89
|
virtualizerLength
|
|
91
90
|
]);
|
|
92
91
|
const resizeCallback = React.useCallback((_entries, // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
|
|
93
|
-
_observer,
|
|
94
|
-
scrollRef)=>{
|
|
92
|
+
_observer, scrollRef)=>{
|
|
95
93
|
if (scrollRef) {
|
|
96
94
|
handleScrollResize(scrollRef);
|
|
97
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useDynamicVirtualizerMeasure.ts"],"sourcesContent":["'use client';\n\nimport { useIsomorphicLayoutEffect, useMergedRefs } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport { VirtualizerMeasureDynamicProps } from './hooks.types';\nimport { useResizeObserverRef_unstable } from './useResizeObserverRef';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * React hook that measures virtualized space dynamically to ensure optimized virtualization length.\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useDynamicVirtualizerMeasure = <TElement extends HTMLElement>(\n virtualizerProps: VirtualizerMeasureDynamicProps,\n): {\n virtualizerLength: number;\n bufferItems: number;\n bufferSize: number;\n scrollRef: (instance: TElement | null) => void;\n containerSizeRef: React.RefObject<number>;\n updateScrollPosition: (scrollPosition: number) => void;\n} => {\n const {\n defaultItemSize,\n direction = 'vertical',\n numItems,\n getItemSize,\n bufferItems,\n bufferSize,\n virtualizerContext,\n } = virtualizerProps;\n\n const [state, setState] = React.useState({\n virtualizerLength: 0,\n virtualizerBufferItems: 0,\n virtualizerBufferSize: 0,\n });\n\n const containerSizeRef = React.useRef<number>(0);\n const scrollPosition = React.useRef<number>(0);\n const { virtualizerLength, virtualizerBufferItems, virtualizerBufferSize } = state;\n\n const { targetDocument } = useFluent();\n const container = React.useRef<HTMLElement | null>(null);\n const handleScrollResize = React.useCallback(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (scrollRef: React.MutableRefObject<HTMLElement | null>) => {\n if (!scrollRef?.current) {\n // Error? ignore?\n return;\n }\n\n if (scrollRef.current !== targetDocument?.body) {\n // We have a local scroll container\n containerSizeRef.current =\n direction === 'vertical'\n ? scrollRef?.current.getBoundingClientRect().height\n : scrollRef?.current.getBoundingClientRect().width;\n } else if (targetDocument?.defaultView) {\n // If our scroll ref is the document body, we should check window height\n containerSizeRef.current =\n direction === 'vertical' ? targetDocument?.defaultView?.innerHeight : targetDocument?.defaultView?.innerWidth;\n }\n\n let indexSizer = 0;\n let i = 0;\n let length = 0;\n\n const startIndex = virtualizerContext.contextIndex;\n const sizeToBeat = containerSizeRef.current + virtualizerBufferSize * 2;\n\n while (indexSizer <= sizeToBeat && i + startIndex < numItems) {\n const iItemSize = getItemSize(startIndex + i);\n if (virtualizerContext.childProgressiveSizes.current.length < numItems) {\n /* We are in unknown territory, either an initial render or an update\n in virtualizer item length has occurred.\n We need to let the new items render first then we can accurately assess.*/\n return virtualizerLength - virtualizerBufferSize * 2;\n }\n\n const currentScrollPos = scrollPosition.current;\n const currentItemPos = virtualizerContext.childProgressiveSizes.current[startIndex + i] - iItemSize;\n\n if (currentScrollPos > currentItemPos + iItemSize) {\n // The item isn't in view, ignore for now.\n i++;\n continue;\n } else if (currentScrollPos > currentItemPos) {\n // The item is partially out of view, ignore the out of bounds portion\n const variance = currentItemPos + iItemSize - currentScrollPos;\n indexSizer += variance;\n } else {\n // Item is in view\n indexSizer += iItemSize;\n }\n // Increment\n i++;\n length++;\n }\n\n /*\n * Number of items to append at each end, i.e. 'preload' each side before entering view.\n * Minimum: 2 - we give slightly more buffer for dynamic version.\n */\n const newBufferItems = bufferItems ?? Math.max(Math.ceil(length / 3), 1);\n\n /*\n * This is how far we deviate into the bufferItems to detect a redraw.\n */\n const newBufferSize = bufferSize ?? Math.max(defaultItemSize / 2, 1);\n const totalLength = length + newBufferItems * 2;\n\n setState({\n virtualizerLength: totalLength,\n virtualizerBufferSize: newBufferSize,\n virtualizerBufferItems: newBufferItems,\n });\n },\n [\n bufferItems,\n bufferSize,\n defaultItemSize,\n direction,\n getItemSize,\n numItems,\n targetDocument?.body,\n targetDocument?.defaultView,\n virtualizerBufferSize,\n virtualizerContext.childProgressiveSizes,\n virtualizerContext.contextIndex,\n virtualizerLength,\n ],\n );\n\n const resizeCallback = React.useCallback(\n (\n _entries: ResizeObserverEntry[],\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n _observer: ResizeObserver,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n scrollRef?: React.MutableRefObject<HTMLElement | null>,\n ) => {\n if (scrollRef) {\n handleScrollResize(scrollRef);\n }\n },\n [handleScrollResize],\n );\n\n const scrollRef = useMergedRefs(container, useResizeObserverRef_unstable(resizeCallback));\n\n useIsomorphicLayoutEffect(() => {\n if (virtualizerContext.contextIndex + virtualizerLength < numItems) {\n // Avoid re-rendering/re-calculating when the end index has already been reached\n handleScrollResize(container);\n }\n }, [handleScrollResize, numItems, virtualizerContext.contextIndex, virtualizerLength]);\n\n const updateScrollPosition = React.useCallback(\n (_scrollPosition: number) => {\n scrollPosition.current = _scrollPosition;\n // Check if our vLength's need recalculating\n handleScrollResize(scrollRef);\n },\n [handleScrollResize, scrollRef],\n );\n\n return {\n virtualizerLength,\n bufferItems: virtualizerBufferItems,\n bufferSize: virtualizerBufferSize,\n scrollRef,\n containerSizeRef,\n updateScrollPosition,\n };\n};\n"],"names":["useIsomorphicLayoutEffect","useMergedRefs","React","useResizeObserverRef_unstable","useFluent_unstable","useFluent","useDynamicVirtualizerMeasure","virtualizerProps","defaultItemSize","direction","numItems","getItemSize","bufferItems","bufferSize","virtualizerContext","state","setState","useState","virtualizerLength","virtualizerBufferItems","virtualizerBufferSize","containerSizeRef","useRef","scrollPosition","targetDocument","container","handleScrollResize","useCallback","scrollRef","current","body","getBoundingClientRect","height","width","defaultView","innerHeight","innerWidth","indexSizer","i","length","startIndex","contextIndex","sizeToBeat","iItemSize","childProgressiveSizes","currentScrollPos","currentItemPos","variance","newBufferItems","Math","max","ceil","newBufferSize","totalLength","resizeCallback","_entries","_observer","updateScrollPosition","_scrollPosition"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,EAAEC,aAAa,QAAQ,4BAA4B;AACrF,YAAYC,WAAW,QAAQ;AAE/B,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF;;;CAGC,GACD,OAAO,MAAMC,+BAA+B,CAC1CC;IASA,MAAM,EACJC,eAAe,EACfC,YAAY,UAAU,EACtBC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,UAAU,EACVC,kBAAkB,EACnB,GAAGP;IAEJ,MAAM,CAACQ,OAAOC,SAAS,GAAGd,MAAMe,QAAQ,CAAC;QACvCC,mBAAmB;QACnBC,wBAAwB;QACxBC,uBAAuB;IACzB;IAEA,MAAMC,mBAAmBnB,MAAMoB,MAAM,CAAS;IAC9C,MAAMC,iBAAiBrB,MAAMoB,MAAM,CAAS;IAC5C,MAAM,EAAEJ,iBAAiB,EAAEC,sBAAsB,EAAEC,qBAAqB,EAAE,GAAGL;IAE7E,MAAM,EAAES,cAAc,EAAE,GAAGnB;IAC3B,MAAMoB,YAAYvB,MAAMoB,MAAM,CAAqB;IACnD,MAAMI,qBAAqB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ACF;QAAoBE;KAAU;IAGjC,OAAO;QACLV;QACAN,aAAaO;QACbN,YAAYO;QACZQ;QACAP;QACAoC;IACF;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useDynamicVirtualizerMeasure.ts"],"sourcesContent":["'use client';\n\nimport { useIsomorphicLayoutEffect, useMergedRefs } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type { VirtualizerMeasureDynamicProps } from './hooks.types';\nimport { useResizeObserverRef_unstable } from './useResizeObserverRef';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * React hook that measures virtualized space dynamically to ensure optimized virtualization length.\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useDynamicVirtualizerMeasure = <TElement extends HTMLElement>(\n virtualizerProps: VirtualizerMeasureDynamicProps,\n): {\n virtualizerLength: number;\n bufferItems: number;\n bufferSize: number;\n scrollRef: (instance: TElement | null) => void;\n containerSizeRef: React.RefObject<number>;\n updateScrollPosition: (scrollPosition: number) => void;\n} => {\n const {\n defaultItemSize,\n direction = 'vertical',\n numItems,\n getItemSize,\n bufferItems,\n bufferSize,\n virtualizerContext,\n } = virtualizerProps;\n\n const [state, setState] = React.useState({\n virtualizerLength: 0,\n virtualizerBufferItems: 0,\n virtualizerBufferSize: 0,\n });\n\n const containerSizeRef = React.useRef<number>(0);\n const scrollPosition = React.useRef<number>(0);\n const { virtualizerLength, virtualizerBufferItems, virtualizerBufferSize } = state;\n\n const { targetDocument } = useFluent();\n const container = React.useRef<HTMLElement | null>(null);\n const handleScrollResize = React.useCallback(\n (scrollRef: React.MutableRefObject<HTMLElement | null>) => {\n if (!scrollRef?.current) {\n // Error? ignore?\n return;\n }\n\n if (scrollRef.current !== targetDocument?.body) {\n // We have a local scroll container\n containerSizeRef.current =\n direction === 'vertical'\n ? scrollRef?.current.getBoundingClientRect().height\n : scrollRef?.current.getBoundingClientRect().width;\n } else if (targetDocument?.defaultView) {\n // If our scroll ref is the document body, we should check window height\n containerSizeRef.current =\n direction === 'vertical' ? targetDocument?.defaultView?.innerHeight : targetDocument?.defaultView?.innerWidth;\n }\n\n let indexSizer = 0;\n let i = 0;\n let length = 0;\n\n const startIndex = virtualizerContext.contextIndex;\n const sizeToBeat = containerSizeRef.current + virtualizerBufferSize * 2;\n\n while (indexSizer <= sizeToBeat && i + startIndex < numItems) {\n const iItemSize = getItemSize(startIndex + i);\n if (virtualizerContext.childProgressiveSizes.current.length < numItems) {\n /* We are in unknown territory, either an initial render or an update\n in virtualizer item length has occurred.\n We need to let the new items render first then we can accurately assess.*/\n return virtualizerLength - virtualizerBufferSize * 2;\n }\n\n const currentScrollPos = scrollPosition.current;\n const currentItemPos = virtualizerContext.childProgressiveSizes.current[startIndex + i] - iItemSize;\n\n if (currentScrollPos > currentItemPos + iItemSize) {\n // The item isn't in view, ignore for now.\n i++;\n continue;\n } else if (currentScrollPos > currentItemPos) {\n // The item is partially out of view, ignore the out of bounds portion\n const variance = currentItemPos + iItemSize - currentScrollPos;\n indexSizer += variance;\n } else {\n // Item is in view\n indexSizer += iItemSize;\n }\n // Increment\n i++;\n length++;\n }\n\n /*\n * Number of items to append at each end, i.e. 'preload' each side before entering view.\n * Minimum: 2 - we give slightly more buffer for dynamic version.\n */\n const newBufferItems = bufferItems ?? Math.max(Math.ceil(length / 3), 1);\n\n /*\n * This is how far we deviate into the bufferItems to detect a redraw.\n */\n const newBufferSize = bufferSize ?? Math.max(defaultItemSize / 2, 1);\n const totalLength = length + newBufferItems * 2;\n\n setState({\n virtualizerLength: totalLength,\n virtualizerBufferSize: newBufferSize,\n virtualizerBufferItems: newBufferItems,\n });\n },\n [\n bufferItems,\n bufferSize,\n defaultItemSize,\n direction,\n getItemSize,\n numItems,\n targetDocument?.body,\n targetDocument?.defaultView,\n virtualizerBufferSize,\n virtualizerContext.childProgressiveSizes,\n virtualizerContext.contextIndex,\n virtualizerLength,\n ],\n );\n\n const resizeCallback = React.useCallback(\n (\n _entries: ResizeObserverEntry[],\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n _observer: ResizeObserver,\n\n scrollRef?: React.MutableRefObject<HTMLElement | null>,\n ) => {\n if (scrollRef) {\n handleScrollResize(scrollRef);\n }\n },\n [handleScrollResize],\n );\n\n const scrollRef = useMergedRefs(container, useResizeObserverRef_unstable(resizeCallback));\n\n useIsomorphicLayoutEffect(() => {\n if (virtualizerContext.contextIndex + virtualizerLength < numItems) {\n // Avoid re-rendering/re-calculating when the end index has already been reached\n handleScrollResize(container);\n }\n }, [handleScrollResize, numItems, virtualizerContext.contextIndex, virtualizerLength]);\n\n const updateScrollPosition = React.useCallback(\n (_scrollPosition: number) => {\n scrollPosition.current = _scrollPosition;\n // Check if our vLength's need recalculating\n handleScrollResize(scrollRef);\n },\n [handleScrollResize, scrollRef],\n );\n\n return {\n virtualizerLength,\n bufferItems: virtualizerBufferItems,\n bufferSize: virtualizerBufferSize,\n scrollRef,\n containerSizeRef,\n updateScrollPosition,\n };\n};\n"],"names":["useIsomorphicLayoutEffect","useMergedRefs","React","useResizeObserverRef_unstable","useFluent_unstable","useFluent","useDynamicVirtualizerMeasure","virtualizerProps","defaultItemSize","direction","numItems","getItemSize","bufferItems","bufferSize","virtualizerContext","state","setState","useState","virtualizerLength","virtualizerBufferItems","virtualizerBufferSize","containerSizeRef","useRef","scrollPosition","targetDocument","container","handleScrollResize","useCallback","scrollRef","current","body","getBoundingClientRect","height","width","defaultView","innerHeight","innerWidth","indexSizer","i","length","startIndex","contextIndex","sizeToBeat","iItemSize","childProgressiveSizes","currentScrollPos","currentItemPos","variance","newBufferItems","Math","max","ceil","newBufferSize","totalLength","resizeCallback","_entries","_observer","updateScrollPosition","_scrollPosition"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,EAAEC,aAAa,QAAQ,4BAA4B;AACrF,YAAYC,WAAW,QAAQ;AAE/B,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,sBAAsBC,SA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ACxC9B,mBAAmB2B,YAAY;QAC/BvB;KACD;IAGH,MAAMoC,iBAAiBpD,MAAMyB,WAAW,CACtC,CACE4B,UACA,8FAA8F;IAE9FC,WAEA5B;QAEA,IAAIA,WAAW;YACbF,mBAAmBE;QACrB;IACF,GACA;QAACF;KAAmB;IAGtB,MAAME,YAAY3B,cAAcwB,WAAWtB,8BAA8BmD;IAEzEtD,0BAA0B;QACxB,IAAIc,mBAAmB2B,YAAY,GAAGvB,oBAAoBR,UAAU;YAClE,gFAAgF;YAChFgB,mBAAmBD;QACrB;IACF,GAAG;QAACC;QAAoBhB;QAAUI,mBAAmB2B,YAAY;QAAEvB;KAAkB;IAErF,MAAMuC,uBAAuBvD,MAAMyB,WAAW,CAC5C,CAAC+B;QACCnC,eAAeM,OAAO,GAAG6B;QACzB,4CAA4C;QAC5ChC,mBAAmBE;IACrB,GACA;QAACF;QAAoBE;KAAU;IAGjC,OAAO;QACLV;QACAN,aAAaO;QACbN,YAAYO;QACZQ;QACAP;QACAoC;IACF;AACF,EAAE"}
|
|
@@ -85,6 +85,7 @@ import { useMutationObserver } from './useMutationObserver';
|
|
|
85
85
|
if (!win) {
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
88
89
|
observer.current = new win.IntersectionObserver(callback, {
|
|
89
90
|
...observerInit,
|
|
90
91
|
rootMargin: getRTLRootMargin(ltrRootMargin.current, observerInit === null || observerInit === void 0 ? void 0 : observerInit.root, win)
|
|
@@ -112,6 +113,7 @@ import { useMutationObserver } from './useMutationObserver';
|
|
|
112
113
|
const setObserverInitExternal = useCallback((newInit)=>{
|
|
113
114
|
var _newInit_rootMargin;
|
|
114
115
|
// Since we know this is coming from consumers, we can store this value as LTR somewhat safely.
|
|
116
|
+
// eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring
|
|
115
117
|
ltrRootMargin.current = (_newInit_rootMargin = newInit === null || newInit === void 0 ? void 0 : newInit.rootMargin) !== null && _newInit_rootMargin !== void 0 ? _newInit_rootMargin : '0px';
|
|
116
118
|
// Call the internal setter to update the value and ensure if our calculated direction is rtl, we flip the margin
|
|
117
119
|
setObserverInit({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst { useCallback, useState, useRef } = React;\nimport { useMutationObserver } from './useMutationObserver';\n\n/**\n * This function will take the rootMargin and flip the sides if we are in RTL based on the computed reading direction of the target element.\n * @param ltrRootMargin the margin to be processed and flipped if required\n * @param target target element that will have its current reading direction determined\n * @returns the corrected rootMargin (if it was necessary to correct)\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const getRTLRootMargin = (\n ltrRootMargin: string,\n target?: Element | Document | null | undefined,\n win?: Window | null,\n): string => {\n if (target && win) {\n // get the computed dir for the target element\n const newDir = win.getComputedStyle(target as Element).direction;\n\n // If we're in rtl reading direction, we might need to flip the margins on the left/right sides\n if (newDir === 'rtl') {\n let newMargin = ltrRootMargin;\n const splitMargins = ltrRootMargin.split(' ');\n\n // We only need to do this if we get four values, otherwise the sides are equal and don't require flipping.\n if (splitMargins.length === 4) {\n newMargin = `${splitMargins[0]} ${splitMargins[3]} ${splitMargins[2]} ${splitMargins[1]}`;\n }\n\n return newMargin;\n } else {\n return ltrRootMargin;\n }\n }\n\n return ltrRootMargin;\n};\n\n/**\n * React hook that allows easy usage of the browser API IntersectionObserver within React\n * @param callback - A function called when the percentage of the target element is visible crosses a threshold.\n * @param options - An optional object which customizes the observer. If options isn't specified, the observer uses the\n * document's viewport as the root, with no margin, and a 0% threshold (meaning that even a one-pixel change is\n * enough to trigger a callback).\n * @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to\n * update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useIntersectionObserver = (\n callback: IntersectionObserverCallback,\n options?: IntersectionObserverInit,\n): {\n setObserverList: React.Dispatch<React.SetStateAction<Element[] | undefined>>;\n setObserverInit: (newInit: IntersectionObserverInit | undefined) => void;\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n observer: React.MutableRefObject<IntersectionObserver | undefined>;\n} => {\n 'use no memo';\n\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n const observer = useRef<IntersectionObserver>(undefined);\n const [observerList, setObserverList] = useState<Element[]>();\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n // set the initial init with corrected margins based on the observed root's calculated reading direction.\n const [observerInit, setObserverInit] = useState<IntersectionObserverInit | undefined>(\n options && {\n ...options,\n rootMargin: getRTLRootMargin(options.rootMargin ?? '0px', options.root as Element, win),\n },\n );\n\n // We have to assume that any values passed in for rootMargin by the consuming app are ltr values. As such we will store the ltr value.\n const ltrRootMargin = useRef<string>(options?.rootMargin ?? '0px');\n\n // Callback function to execute when mutations are observed\n const mutationObserverCallback: MutationCallback = useCallback(\n mutationList => {\n for (const mutation of mutationList) {\n // Ensuring that the right attribute is being observed and that the root is within the tree of the element being mutated.\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'dir' &&\n options?.root &&\n mutation.target.contains(options?.root)\n ) {\n setObserverInit({\n ...observerInit,\n rootMargin: getRTLRootMargin(ltrRootMargin.current, observerInit?.root, win),\n });\n }\n }\n },\n [ltrRootMargin, observerInit, options?.root, win],\n );\n\n // Mutation observer for dir attribute changes in the document\n useMutationObserver(targetDocument, mutationObserverCallback, {\n attributes: true,\n subtree: true,\n attributeFilter: ['dir'],\n });\n\n // Observer elements in passed in list and clean up previous list\n // This effect is only triggered when observerList is updated\n useIsomorphicLayoutEffect(() => {\n if (!win) {\n return;\n }\n\n observer.current = new win.IntersectionObserver(callback, {\n ...observerInit,\n rootMargin: getRTLRootMargin(ltrRootMargin.current, observerInit?.root, win),\n });\n\n // If we have an instance of IO and a list with elements, observer the elements\n if (observer.current && observerList && observerList.length > 0) {\n observerList.forEach(element => {\n observer.current?.observe(element);\n });\n }\n\n // clean up previous elements being listened to\n return () => {\n if (observer.current) {\n observer.current.disconnect();\n }\n };\n }, [observerList, observerInit, callback, win]);\n\n // Do not use internally, we need to track external settings only here\n const setObserverInitExternal = useCallback(\n (newInit: IntersectionObserverInit | undefined) => {\n // Since we know this is coming from consumers, we can store this value as LTR somewhat safely.\n ltrRootMargin.current = newInit?.rootMargin ?? '0px';\n\n // Call the internal setter to update the value and ensure if our calculated direction is rtl, we flip the margin\n setObserverInit({\n ...newInit,\n rootMargin: getRTLRootMargin(ltrRootMargin.current, newInit?.root as Element, win),\n });\n },\n [ltrRootMargin, setObserverInit, win],\n );\n\n return { setObserverList, setObserverInit: setObserverInitExternal, observer };\n};\n"],"names":["React","useIsomorphicLayoutEffect","useFluent_unstable","useFluent","useCallback","useState","useRef","useMutationObserver","getRTLRootMargin","ltrRootMargin","target","win","newDir","getComputedStyle","direction","newMargin","splitMargins","split","length","useIntersectionObserver","callback","options","observer","undefined","observerList","setObserverList","targetDocument","defaultView","observerInit","setObserverInit","rootMargin","root","mutationObserverCallback","mutationList","mutation","type","attributeName","contains","current","attributes","subtree","attributeFilter","IntersectionObserver","forEach","element","observe","disconnect","setObserverInitExternal","newInit"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,4BAA4B;AACtE,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF,MAAM,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGN;AAC1C,SAASO,mBAAmB,QAAQ,wBAAwB;AAE5D;;;;;;CAMC,GACD,OAAO,MAAMC,mBAAmB,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AU,cAAnBkB,iCAAAA,sBAAuB;QAE/C,iHAAiH;QACjHnB,gBAAgB;YACd,GAAGmB,OAAO;YACVlB,YAAYtB,iBAAiBC,cAAc6B,OAAO,EAAEU,oBAAAA,8BAAAA,QAASjB,IAAI,EAAapB;QAChF;IACF,GACA;QAACF;QAAeoB;QAAiBlB;KAAI;IAGvC,OAAO;QAAEc;QAAiBI,iBAAiBkB;QAAyBzB;IAAS;AAC/E,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst { useCallback, useState, useRef } = React;\nimport { useMutationObserver } from './useMutationObserver';\n\n/**\n * This function will take the rootMargin and flip the sides if we are in RTL based on the computed reading direction of the target element.\n * @param ltrRootMargin the margin to be processed and flipped if required\n * @param target target element that will have its current reading direction determined\n * @returns the corrected rootMargin (if it was necessary to correct)\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const getRTLRootMargin = (\n ltrRootMargin: string,\n target?: Element | Document | null | undefined,\n win?: Window | null,\n): string => {\n if (target && win) {\n // get the computed dir for the target element\n const newDir = win.getComputedStyle(target as Element).direction;\n\n // If we're in rtl reading direction, we might need to flip the margins on the left/right sides\n if (newDir === 'rtl') {\n let newMargin = ltrRootMargin;\n const splitMargins = ltrRootMargin.split(' ');\n\n // We only need to do this if we get four values, otherwise the sides are equal and don't require flipping.\n if (splitMargins.length === 4) {\n newMargin = `${splitMargins[0]} ${splitMargins[3]} ${splitMargins[2]} ${splitMargins[1]}`;\n }\n\n return newMargin;\n } else {\n return ltrRootMargin;\n }\n }\n\n return ltrRootMargin;\n};\n\n/**\n * React hook that allows easy usage of the browser API IntersectionObserver within React\n * @param callback - A function called when the percentage of the target element is visible crosses a threshold.\n * @param options - An optional object which customizes the observer. If options isn't specified, the observer uses the\n * document's viewport as the root, with no margin, and a 0% threshold (meaning that even a one-pixel change is\n * enough to trigger a callback).\n * @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to\n * update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useIntersectionObserver = (\n callback: IntersectionObserverCallback,\n options?: IntersectionObserverInit,\n): {\n setObserverList: React.Dispatch<React.SetStateAction<Element[] | undefined>>;\n setObserverInit: (newInit: IntersectionObserverInit | undefined) => void;\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n observer: React.MutableRefObject<IntersectionObserver | undefined>;\n} => {\n 'use no memo';\n\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n const observer = useRef<IntersectionObserver>(undefined);\n const [observerList, setObserverList] = useState<Element[]>();\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n // set the initial init with corrected margins based on the observed root's calculated reading direction.\n const [observerInit, setObserverInit] = useState<IntersectionObserverInit | undefined>(\n options && {\n ...options,\n rootMargin: getRTLRootMargin(options.rootMargin ?? '0px', options.root as Element, win),\n },\n );\n\n // We have to assume that any values passed in for rootMargin by the consuming app are ltr values. As such we will store the ltr value.\n const ltrRootMargin = useRef<string>(options?.rootMargin ?? '0px');\n\n // Callback function to execute when mutations are observed\n const mutationObserverCallback: MutationCallback = useCallback(\n mutationList => {\n for (const mutation of mutationList) {\n // Ensuring that the right attribute is being observed and that the root is within the tree of the element being mutated.\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'dir' &&\n options?.root &&\n mutation.target.contains(options?.root)\n ) {\n setObserverInit({\n ...observerInit,\n rootMargin: getRTLRootMargin(ltrRootMargin.current, observerInit?.root, win),\n });\n }\n }\n },\n [ltrRootMargin, observerInit, options?.root, win],\n );\n\n // Mutation observer for dir attribute changes in the document\n useMutationObserver(targetDocument, mutationObserverCallback, {\n attributes: true,\n subtree: true,\n attributeFilter: ['dir'],\n });\n\n // Observer elements in passed in list and clean up previous list\n // This effect is only triggered when observerList is updated\n useIsomorphicLayoutEffect(() => {\n if (!win) {\n return;\n }\n\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n observer.current = new win.IntersectionObserver(callback, {\n ...observerInit,\n rootMargin: getRTLRootMargin(ltrRootMargin.current, observerInit?.root, win),\n });\n\n // If we have an instance of IO and a list with elements, observer the elements\n if (observer.current && observerList && observerList.length > 0) {\n observerList.forEach(element => {\n observer.current?.observe(element);\n });\n }\n\n // clean up previous elements being listened to\n return () => {\n if (observer.current) {\n observer.current.disconnect();\n }\n };\n }, [observerList, observerInit, callback, win]);\n\n // Do not use internally, we need to track external settings only here\n const setObserverInitExternal = useCallback(\n (newInit: IntersectionObserverInit | undefined) => {\n // Since we know this is coming from consumers, we can store this value as LTR somewhat safely.\n // eslint-disable-next-line react-hooks/immutability -- deprecated package, not worth refactoring\n ltrRootMargin.current = newInit?.rootMargin ?? '0px';\n\n // Call the internal setter to update the value and ensure if our calculated direction is rtl, we flip the margin\n setObserverInit({\n ...newInit,\n rootMargin: getRTLRootMargin(ltrRootMargin.current, newInit?.root as Element, win),\n });\n },\n [ltrRootMargin, setObserverInit, win],\n );\n\n return { setObserverList, setObserverInit: setObserverInitExternal, observer };\n};\n"],"names":["React","useIsomorphicLayoutEffect","useFluent_unstable","useFluent","useCallback","useState","useRef","useMutationObserver","getRTLRootMargin","ltrRootMargin","target","win","newDir","getComputedStyle","direction","newMargin","splitMargins","split","length","useIntersectionObserver","callback","options","observer","undefined","observerList","setObserverList","targetDocument","defaultView","observerInit","setObserverInit","rootMargin","root","mutationObserverCallback","mutationList","mutation","type","attributeName","contains","current","attributes","subtree","attributeFilter","IntersectionObserver","forEach","element","observe","disconnect","setObserverInitExternal","newInit"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,4BAA4B;AACtE,SAASC,s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,GAAG;QAACtB;QAAcI;QAAcR;QAAUT;KAAI;IAE9C,sEAAsE;IACtE,MAAMoC,0BAA0B3C,YAC9B,CAAC4C;YAGyBA;QAFxB,+FAA+F;QAC/F,iGAAiG;QACjGvC,cAAc6B,OAAO,GAAGU,CAAAA,sBAAAA,oBAAAA,8BAAAA,QAASlB,UAAU,cAAnBkB,iCAAAA,sBAAuB;QAE/C,iHAAiH;QACjHnB,gBAAgB;YACd,GAAGmB,OAAO;YACVlB,YAAYtB,iBAAiBC,cAAc6B,OAAO,EAAEU,oBAAAA,8BAAAA,QAASjB,IAAI,EAAapB;QAChF;IACF,GACA;QAACF;QAAeoB;QAAiBlB;KAAI;IAGvC,OAAO;QAAEc;QAAiBI,iBAAiBkB;QAAyBzB;IAAS;AAC/E,EAAE"}
|
|
@@ -106,6 +106,7 @@ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts
|
|
|
106
106
|
}, [
|
|
107
107
|
resizeObserver
|
|
108
108
|
]);
|
|
109
|
+
// eslint-disable-next-line react-hooks/refs -- deprecated package, not worth refactoring
|
|
109
110
|
return {
|
|
110
111
|
widthArray,
|
|
111
112
|
heightArray,
|