@fluentui/react-virtualizer 9.0.0-alpha.12 → 9.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +49 -1
  3. package/CHANGELOG.md +23 -2
  4. package/dist/index.d.ts +90 -27
  5. package/lib/Hooks.js.map +1 -1
  6. package/lib/Virtualizer.js.map +1 -1
  7. package/lib/VirtualizerScrollView.js +2 -0
  8. package/lib/VirtualizerScrollView.js.map +1 -0
  9. package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
  10. package/lib/components/Virtualizer/Virtualizer.types.js +1 -1
  11. package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
  12. package/lib/components/Virtualizer/index.js.map +1 -1
  13. package/lib/components/Virtualizer/renderVirtualizer.js +1 -9
  14. package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
  15. package/lib/components/Virtualizer/useVirtualizer.js +13 -11
  16. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  17. package/lib/components/Virtualizer/useVirtualizerStyles.js.map +1 -1
  18. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +14 -0
  19. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
  20. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +2 -0
  21. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
  22. package/lib/components/VirtualizerScrollView/index.js +6 -0
  23. package/lib/components/VirtualizerScrollView/index.js.map +1 -0
  24. package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js +11 -0
  25. package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
  26. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +38 -0
  27. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
  28. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +46 -0
  29. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -0
  30. package/lib/hooks/index.js +1 -0
  31. package/lib/hooks/index.js.map +1 -1
  32. package/lib/hooks/useIntersectionObserver.js +2 -10
  33. package/lib/hooks/useIntersectionObserver.js.map +1 -1
  34. package/lib/hooks/useVirtualizerMeasure.js +76 -0
  35. package/lib/hooks/useVirtualizerMeasure.js.map +1 -0
  36. package/lib/hooks/useVirtualizerMeasure.types.js +2 -0
  37. package/lib/hooks/useVirtualizerMeasure.types.js.map +1 -0
  38. package/lib/index.js +2 -1
  39. package/lib/index.js.map +1 -1
  40. package/lib/utilities/debounce.js +20 -0
  41. package/lib/utilities/debounce.js.map +1 -0
  42. package/lib-commonjs/Hooks.js +5 -4
  43. package/lib-commonjs/Hooks.js.map +1 -1
  44. package/lib-commonjs/Virtualizer.js +5 -4
  45. package/lib-commonjs/Virtualizer.js.map +1 -1
  46. package/lib-commonjs/VirtualizerScrollView.js +9 -0
  47. package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
  48. package/lib-commonjs/components/Virtualizer/Virtualizer.js +14 -17
  49. package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
  50. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +5 -2
  51. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
  52. package/lib-commonjs/components/Virtualizer/index.js +9 -8
  53. package/lib-commonjs/components/Virtualizer/index.js.map +1 -1
  54. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +13 -21
  55. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
  56. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +358 -361
  57. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
  58. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js +112 -107
  59. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js.map +1 -1
  60. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +21 -0
  61. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
  62. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +7 -0
  63. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
  64. package/lib-commonjs/components/VirtualizerScrollView/index.js +13 -0
  65. package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -0
  66. package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js +18 -0
  67. package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
  68. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +43 -0
  69. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
  70. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +69 -0
  71. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -0
  72. package/lib-commonjs/hooks/index.js +6 -4
  73. package/lib-commonjs/hooks/index.js.map +1 -1
  74. package/lib-commonjs/hooks/useIntersectionObserver.js +41 -54
  75. package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
  76. package/lib-commonjs/hooks/useVirtualizerMeasure.js +75 -0
  77. package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
  78. package/lib-commonjs/hooks/useVirtualizerMeasure.types.js +7 -0
  79. package/lib-commonjs/hooks/useVirtualizerMeasure.types.js.map +1 -0
  80. package/lib-commonjs/index.js +25 -40
  81. package/lib-commonjs/index.js.map +1 -1
  82. package/lib-commonjs/utilities/debounce.js +29 -0
  83. package/lib-commonjs/utilities/debounce.js.map +1 -0
  84. package/package.json +7 -5
@@ -1 +1 @@
1
- {"version":3,"names":["__styles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","mc9l5x","Bkecrkj","relative","qhf8xq","horizontal","sshi5w","vertical","Bf4jedk","d","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginLeft","marginRight","afterBuffer","style","height","width"],"sources":["../src/packages/react-components/react-virtualizer/src/components/Virtualizer/useVirtualizerStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nconst virtualizerClassName = 'fui-Virtualizer';\nexport const virtualizerClassNames: SlotClassNames<VirtualizerSlots> = {\n before: `${virtualizerClassName}__before`,\n beforeContainer: `${virtualizerClassName}__beforeContainer`,\n after: `${virtualizerClassName}__after`,\n afterContainer: `${virtualizerClassName}__afterContainer`,\n};\n\nconst useStyles = makeStyles({\n base: {\n display: 'block',\n pointerEvents: 'none',\n },\n relative: {\n position: 'relative',\n },\n horizontal: {\n minHeight: '100%',\n },\n vertical: {\n minWidth: '100%',\n },\n});\n\n/**\n * Apply styling to the Virtualizer states\n */\nexport const useVirtualizerStyles_unstable = (state: VirtualizerState): VirtualizerState => {\n const styles = useStyles();\n const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;\n const horizontal = axis === 'horizontal';\n\n state.before.className = mergeClasses(\n virtualizerClassNames.before,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.before.className,\n );\n\n state.after.className = mergeClasses(\n virtualizerClassNames.after,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.after.className,\n );\n\n state.beforeContainer.className = mergeClasses(\n virtualizerClassNames.beforeContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.beforeContainer.className,\n );\n\n state.afterContainer.className = mergeClasses(\n virtualizerClassNames.afterContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.afterContainer.className,\n );\n\n const beforeHeightPx = beforeBufferHeight + 'px';\n const afterHeightPx = afterBufferHeight + 'px';\n const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';\n const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';\n const bufferPx = bufferSize + 'px';\n\n const beforeBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginRight: `-${bufferPx}` }),\n };\n\n const afterBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginRight: `-${bufferPx}` }),\n };\n\n state.before.style = {\n height: horizontal ? '100%' : beforeBufferHeightPx,\n width: horizontal ? beforeBufferHeightPx : '100%',\n ...beforeBuffer,\n ...state.before.style,\n };\n\n state.beforeContainer.style = {\n height: horizontal ? 'auto' : beforeHeightPx,\n width: horizontal ? beforeHeightPx : 'auto',\n ...state.beforeContainer.style,\n };\n\n state.after.style = {\n height: horizontal ? '100%' : afterBufferHeightPx,\n width: horizontal ? afterBufferHeightPx : '100%',\n ...afterBuffer,\n ...state.after.style,\n };\n\n state.afterContainer.style = {\n height: horizontal ? 'auto' : afterHeightPx,\n width: horizontal ? afterHeightPx : 'auto',\n ...state.afterContainer.style,\n };\n\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AAIzD,MAAMC,oBAAoB,GAAG,iBAAiB;AAC9C,OAAO,MAAMC,qBAAqB,GAAqC;EACrEC,MAAM,EAAE,GAAGF,oBAAoB,UAAU;EACzCG,eAAe,EAAE,GA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U,IAAI;MAAEsB,UAAU,EAAE,IAAIJ,QAAQ;IAAE,CAAE,CAAC;IAC9D;IACA,IAAIV,QAAQ,IAAIR,UAAU,IAAI;MAAEuB,WAAW,EAAE,IAAIL,QAAQ;IAAE,CAAE;GAC9D;EAEDZ,KAAK,CAAChB,MAAM,CAACmC,KAAK,GAAG;IACnBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGgB,oBAAoB;IAClDW,KAAK,EAAE3B,UAAU,GAAGgB,oBAAoB,GAAG,MAAM;IACjD,GAAGG,YAAY;IACf,GAAGb,KAAK,CAAChB,MAAM,CAACmC;GACjB;EAEDnB,KAAK,CAACf,eAAe,CAACkC,KAAK,GAAG;IAC5BC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGc,cAAc;IAC5Ca,KAAK,EAAE3B,UAAU,GAAGc,cAAc,GAAG,MAAM;IAC3C,GAAGR,KAAK,CAACf,eAAe,CAACkC;GAC1B;EAEDnB,KAAK,CAACd,KAAK,CAACiC,KAAK,GAAG;IAClBC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGiB,mBAAmB;IACjDU,KAAK,EAAE3B,UAAU,GAAGiB,mBAAmB,GAAG,MAAM;IAChD,GAAGO,WAAW;IACd,GAAGlB,KAAK,CAACd,KAAK,CAACiC;GAChB;EAEDnB,KAAK,CAACb,cAAc,CAACgC,KAAK,GAAG;IAC3BC,MAAM,EAAE1B,UAAU,GAAG,MAAM,GAAGe,aAAa;IAC3CY,KAAK,EAAE3B,UAAU,GAAGe,aAAa,GAAG,MAAM;IAC1C,GAAGT,KAAK,CAACb,cAAc,CAACgC;GACzB;EAED,OAAOnB,KAAK;AACd,CAAC"}
1
+ {"version":3,"names":["__styles","mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","base","mc9l5x","Bkecrkj","relative","qhf8xq","horizontal","sshi5w","vertical","Bf4jedk","d","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","className","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginLeft","marginRight","afterBuffer","style","height","width"],"sources":["../../../src/components/Virtualizer/useVirtualizerStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nconst virtualizerClassName = 'fui-Virtualizer';\nexport const virtualizerClassNames: SlotClassNames<VirtualizerSlots> = {\n before: `${virtualizerClassName}__before`,\n beforeContainer: `${virtualizerClassName}__beforeContainer`,\n after: `${virtualizerClassName}__after`,\n afterContainer: `${virtualizerClassName}__afterContainer`,\n};\n\nconst useStyles = makeStyles({\n base: {\n display: 'block',\n pointerEvents: 'none',\n },\n relative: {\n position: 'relative',\n },\n horizontal: {\n minHeight: '100%',\n },\n vertical: {\n minWidth: '100%',\n },\n});\n\n/**\n * Apply styling to the Virtualizer states\n */\nexport const useVirtualizerStyles_unstable = (state: VirtualizerState): VirtualizerState => {\n const styles = useStyles();\n const { reversed, axis, beforeBufferHeight, afterBufferHeight, bufferSize } = state;\n const horizontal = axis === 'horizontal';\n\n state.before.className = mergeClasses(\n virtualizerClassNames.before,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.before.className,\n );\n\n state.after.className = mergeClasses(\n virtualizerClassNames.after,\n styles.base,\n styles.relative,\n horizontal ? styles.horizontal : styles.vertical,\n state.after.className,\n );\n\n state.beforeContainer.className = mergeClasses(\n virtualizerClassNames.beforeContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.beforeContainer.className,\n );\n\n state.afterContainer.className = mergeClasses(\n virtualizerClassNames.afterContainer,\n styles.base,\n horizontal ? styles.horizontal : styles.vertical,\n state.afterContainer.className,\n );\n\n const beforeHeightPx = beforeBufferHeight + 'px';\n const afterHeightPx = afterBufferHeight + 'px';\n const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';\n const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';\n const bufferPx = bufferSize + 'px';\n\n const beforeBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginRight: `-${bufferPx}` }),\n };\n\n const afterBuffer = {\n // Column\n ...(!reversed && !horizontal && { marginTop: `-${bufferPx}` }),\n // Column-Reverse\n ...(reversed && !horizontal && { marginBottom: `-${bufferPx}` }),\n // Row\n ...(!reversed && horizontal && { marginLeft: `-${bufferPx}` }),\n // Row-Reverse\n ...(reversed && horizontal && { marginRight: `-${bufferPx}` }),\n };\n\n state.before.style = {\n height: horizontal ? '100%' : beforeBufferHeightPx,\n width: horizontal ? beforeBufferHeightPx : '100%',\n ...beforeBuffer,\n ...state.before.style,\n };\n\n state.beforeContainer.style = {\n height: horizontal ? 'auto' : beforeHeightPx,\n width: horizontal ? beforeHeightPx : 'auto',\n ...state.beforeContainer.style,\n };\n\n state.after.style = {\n height: horizontal ? '100%' : afterBufferHeightPx,\n width: horizontal ? afterBufferHeightPx : '100%',\n ...afterBuffer,\n ...state.after.style,\n };\n\n state.afterContainer.style = {\n height: horizontal ? 'auto' : afterHeightPx,\n width: horizontal ? afterHeightPx : 'auto',\n ...state.afterContainer.style,\n };\n\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ;AAIzC,MAAMC,oBAAA,GAAuB;AAC7B,OAAO,MAAMC,qBAAA,GAA0D;EACrEC,MAAA,EAAS,GAAEF,oBAAqB,UAAS;EACzCG,eAAA,EAAkB,GAAEH,oBAAqB,mBAAkB;EAC3DI,KAAA,EAAQ,GAAEJ,oBAAqB,SAAQ;EACvCK,cAAA,EAAiB,GAAEL,oBAA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A,CAAMhB,MAAM,CAACmC,KAAK,GAAG;IACnBC,MAAA,EAAQ1B,UAAA,GAAa,SAASgB,oBAAoB;IAClDW,KAAA,EAAO3B,UAAA,GAAagB,oBAAA,GAAuB,MAAM;IACjD,GAAGG,YAAY;IACf,GAAGb,KAAA,CAAMhB,MAAM,CAACmC;EAClB;EAEAnB,KAAA,CAAMf,eAAe,CAACkC,KAAK,GAAG;IAC5BC,MAAA,EAAQ1B,UAAA,GAAa,SAASc,cAAc;IAC5Ca,KAAA,EAAO3B,UAAA,GAAac,cAAA,GAAiB,MAAM;IAC3C,GAAGR,KAAA,CAAMf,eAAe,CAACkC;EAC3B;EAEAnB,KAAA,CAAMd,KAAK,CAACiC,KAAK,GAAG;IAClBC,MAAA,EAAQ1B,UAAA,GAAa,SAASiB,mBAAmB;IACjDU,KAAA,EAAO3B,UAAA,GAAaiB,mBAAA,GAAsB,MAAM;IAChD,GAAGO,WAAW;IACd,GAAGlB,KAAA,CAAMd,KAAK,CAACiC;EACjB;EAEAnB,KAAA,CAAMb,cAAc,CAACgC,KAAK,GAAG;IAC3BC,MAAA,EAAQ1B,UAAA,GAAa,SAASe,aAAa;IAC3CY,KAAA,EAAO3B,UAAA,GAAae,aAAA,GAAgB,MAAM;IAC1C,GAAGT,KAAA,CAAMb,cAAc,CAACgC;EAC1B;EAEA,OAAOnB,KAAA;AACT"}
@@ -0,0 +1,14 @@
1
+ import { useVirtualizerScrollView_unstable } from './useVirtualizerScrollView';
2
+ import { renderVirtualizerScrollView_unstable } from './renderVirtualizerScrollView';
3
+ import { useVirtualizerScrollViewStyles_unstable } from './useVirtualizerScrollViewStyles';
4
+ import * as React from 'react';
5
+ /**
6
+ * Virtualizer ScrollView
7
+ */
8
+ export const VirtualizerScrollView = props => {
9
+ const state = useVirtualizerScrollView_unstable(props);
10
+ useVirtualizerScrollViewStyles_unstable(state);
11
+ return renderVirtualizerScrollView_unstable(state);
12
+ };
13
+ VirtualizerScrollView.displayName = 'VirtualizerScrollView';
14
+ //# sourceMappingURL=VirtualizerScrollView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable","React","VirtualizerScrollView","props","state","displayName"],"sources":["../../../src/components/VirtualizerScrollView/VirtualizerScrollView.ts"],"sourcesContent":["import { VirtualizerScrollViewProps } from './VirtualizerScrollView.types';\nimport { useVirtualizerScrollView_unstable } from './useVirtualizerScrollView';\nimport { renderVirtualizerScrollView_unstable } from './renderVirtualizerScrollView';\nimport { useVirtualizerScrollViewStyles_unstable } from './useVirtualizerScrollViewStyles';\nimport * as React from 'react';\n\n/**\n * Virtualizer ScrollView\n */\n\nexport const VirtualizerScrollView: React.FC<VirtualizerScrollViewProps> = (props: VirtualizerScrollViewProps) => {\n const state = useVirtualizerScrollView_unstable(props);\n\n useVirtualizerScrollViewStyles_unstable(state);\n\n return renderVirtualizerScrollView_unstable(state);\n};\n\nVirtualizerScrollView.displayName = 'VirtualizerScrollView';\n"],"mappings":"AACA,SAASA,iCAAiC,QAAQ;AAClD,SAASC,oCAAoC,QAAQ;AACrD,SAASC,uCAAuC,QAAQ;AACxD,YAAYC,KAAA,MAAW;AAEvB;;;AAIA,OAAO,MAAMC,qBAAA,GAA+DC,KAAA,IAAsC;EAChH,MAAMC,KAAA,GAAQN,iCAAA,CAAkCK,KAAA;EAEhDH,uCAAA,CAAwCI,KAAA;EAExC,OAAOL,oCAAA,CAAqCK,KAAA;AAC9C;AAEAF,qBAAA,CAAsBG,WAAW,GAAG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=VirtualizerScrollView.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/components/VirtualizerScrollView/VirtualizerScrollView.types.ts"],"sourcesContent":["import { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport {\n VirtualizerSlots,\n VirtualizerConfigProps,\n VirtualizerConfigState,\n VirtualizerChildRenderFunction,\n} from '../Virtualizer/Virtualizer.types';\n\nexport type VirtualizerScrollViewSlots = VirtualizerSlots & {\n /**\n * The root container that provides embedded scrolling.\n */\n container: NonNullable<Slot<'div'>>;\n};\n\nexport type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> &\n Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children'>> & {\n /**\n * Virtualizer item size in pixels - static.\n * Axis: 'vertical' = Height\n * Axis: 'horizontal' = Width\n */\n itemSize: 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\nexport type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;\n"],"mappings":"AAAA"}
@@ -0,0 +1,6 @@
1
+ export * from './VirtualizerScrollView';
2
+ export * from './VirtualizerScrollView.types';
3
+ export * from './useVirtualizerScrollView';
4
+ export * from './renderVirtualizerScrollView';
5
+ export * from './useVirtualizerScrollViewStyles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../../src/components/VirtualizerScrollView/index.ts"],"sourcesContent":["export * from './VirtualizerScrollView';\nexport * from './VirtualizerScrollView.types';\nexport * from './useVirtualizerScrollView';\nexport * from './renderVirtualizerScrollView';\nexport * from './useVirtualizerScrollViewStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { getSlots } from '@fluentui/react-utilities';
3
+ import { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';
4
+ export const renderVirtualizerScrollView_unstable = state => {
5
+ const {
6
+ slots,
7
+ slotProps
8
+ } = getSlots(state);
9
+ return /*#__PURE__*/React.createElement(slots.container, slotProps.container, renderVirtualizer_unstable(state));
10
+ };
11
+ //# sourceMappingURL=renderVirtualizerScrollView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","getSlots","renderVirtualizer_unstable","renderVirtualizerScrollView_unstable","state","slots","slotProps","createElement","container"],"sources":["../../../src/components/VirtualizerScrollView/renderVirtualizerScrollView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { VirtualizerScrollViewSlots, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { renderVirtualizer_unstable } from '../Virtualizer/renderVirtualizer';\n\nexport const renderVirtualizerScrollView_unstable = (state: VirtualizerScrollViewState) => {\n const { slots, slotProps } = getSlots<VirtualizerScrollViewSlots>(state);\n\n return <slots.container {...slotProps.container}>{renderVirtualizer_unstable(state)}</slots.container>;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,0BAA0B,QAAQ;AAE3C,OAAO,MAAMC,oCAAA,GAAwCC,KAAA,IAAsC;EACzF,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGL,QAAA,CAAqCG,KAAA;EAElE,oBAAOJ,KAAA,CAAAO,aAAA,CAACF,KAAA,CAAMG,SAAS,EAAKF,SAAA,CAAUE,SAAS,EAAGN,0BAAA,CAA2BE,KAAA;AAC/E"}
@@ -0,0 +1,38 @@
1
+ import * as React from 'react';
2
+ import { resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';
3
+ import { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';
4
+ import { useStaticVirtualizerMeasure } from '../../Hooks';
5
+ export function useVirtualizerScrollView_unstable(props) {
6
+ var _props_axis;
7
+ const {
8
+ virtualizerLength,
9
+ bufferItems,
10
+ bufferSize,
11
+ scrollRef
12
+ } = useStaticVirtualizerMeasure({
13
+ defaultItemSize: props.itemSize,
14
+ direction: (_props_axis = props.axis) !== null && _props_axis !== void 0 ? _props_axis : 'vertical'
15
+ });
16
+ const iScrollRef = useMergedRefs(React.useRef(null), scrollRef);
17
+ const virtualizerState = useVirtualizer_unstable({
18
+ ...props,
19
+ virtualizerLength,
20
+ bufferItems,
21
+ bufferSize,
22
+ scrollViewRef: iScrollRef
23
+ });
24
+ return {
25
+ ...virtualizerState,
26
+ components: {
27
+ ...virtualizerState.components,
28
+ container: 'div'
29
+ },
30
+ container: resolveShorthand(props.container, {
31
+ required: true,
32
+ defaultProps: {
33
+ ref: iScrollRef
34
+ }
35
+ })
36
+ };
37
+ }
38
+ //# sourceMappingURL=useVirtualizerScrollView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","resolveShorthand","useMergedRefs","useVirtualizer_unstable","useStaticVirtualizerMeasure","useVirtualizerScrollView_unstable","props","_props_axis","virtualizerLength","bufferItems","bufferSize","scrollRef","defaultItemSize","itemSize","direction","axis","iScrollRef","useRef","virtualizerState","scrollViewRef","components","container","required","defaultProps","ref"],"sources":["../../../src/components/VirtualizerScrollView/useVirtualizerScrollView.ts"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand, useMergedRefs } from '@fluentui/react-utilities';\nimport { useVirtualizer_unstable } from '../Virtualizer/useVirtualizer';\nimport { VirtualizerScrollViewProps, VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport { useStaticVirtualizerMeasure } from '../../Hooks';\n\nexport function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState {\n const { virtualizerLength, bufferItems, bufferSize, scrollRef } = useStaticVirtualizerMeasure({\n defaultItemSize: props.itemSize,\n direction: props.axis ?? 'vertical',\n });\n\n const iScrollRef = useMergedRefs(React.useRef<HTMLDivElement>(null), scrollRef);\n\n const virtualizerState = useVirtualizer_unstable({\n ...props,\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollViewRef: iScrollRef,\n });\n\n return {\n ...virtualizerState,\n components: {\n ...virtualizerState.components,\n container: 'div',\n },\n container: resolveShorthand(props.container, {\n required: true,\n defaultProps: {\n ref: iScrollRef as React.RefObject<HTMLDivElement>,\n },\n }),\n };\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,EAAEC,aAAa,QAAQ;AAChD,SAASC,uBAAuB,QAAQ;AAExC,SAASC,2BAA2B,QAAQ;AAE5C,OAAO,SAASC,kCAAkCC,KAAiC,EAA8B;MAGlGC,WAAA;EAFb,MAAM;IAAEC,iBAAA;IAAmBC,WAAA;IAAaC,UAAA;IAAYC;EAAS,CAAE,GAAGP,2BAAA,CAA4B;IAC5FQ,eAAA,EAAiBN,KAAA,CAAMO,QAAQ;IAC/BC,SAAA,EAAW,CAAAP,WAAA,GAAAD,KAAA,CAAMS,IAAI,cAAVR,WAAA,cAAAA,WAAA,GAAc;EAC3B;EAEA,MAAMS,UAAA,GAAad,aAAA,CAAcF,KAAA,CAAMiB,MAAM,CAAiB,IAAI,GAAGN,SAAA;EAErE,MAAMO,gBAAA,GAAmBf,uBAAA,CAAwB;IAC/C,GAAGG,KAAK;IACRE,iBAAA;IACAC,WAAA;IACAC,UAAA;IACAS,aAAA,EAAeH;EACjB;EAEA,OAAO;IACL,GAAGE,gBAAgB;IACnBE,UAAA,EAAY;MACV,GAAGF,gBAAA,CAAiBE,UAAU;MAC9BC,SAAA,EAAW;IACb;IACAA,SAAA,EAAWpB,gBAAA,CAAiBK,KAAA,CAAMe,SAAS,EAAE;MAC3CC,QAAA,EAAU,IAAI;MACdC,YAAA,EAAc;QACZC,GAAA,EAAKR;MACP;IACF;EACF;AACF"}
@@ -0,0 +1,46 @@
1
+ import { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles';
2
+ import { __styles, mergeClasses } from '@griffel/react';
3
+ const virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';
4
+ export const virtualizerScrollViewClassNames = {
5
+ ...virtualizerClassNames,
6
+ container: `${virtualizerScrollViewClassName}__container`
7
+ };
8
+ const useStyles = /*#__PURE__*/__styles({
9
+ base: {
10
+ mc9l5x: "f22iagw",
11
+ a9b677: "fly5x3f",
12
+ Bqenvij: "f1l02sjl",
13
+ Eiaeu8: "f1115ve7"
14
+ },
15
+ vertical: {
16
+ Beiy3e4: "f1vx9l62",
17
+ Eiaeu8: "f1115ve7",
18
+ Bmxbyg5: "f5zp4f"
19
+ },
20
+ horizontal: {
21
+ Beiy3e4: "f1063pyq",
22
+ B68tc82: "f1oy3dpc"
23
+ },
24
+ verticalReversed: {
25
+ Beiy3e4: "f1gkdon0",
26
+ Bmxbyg5: "f5zp4f"
27
+ },
28
+ horizontalReversed: {
29
+ Beiy3e4: "f1oztnx0",
30
+ B68tc82: "f1oy3dpc"
31
+ }
32
+ }, {
33
+ d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fly5x3f{width:100%;}", ".f1l02sjl{height:100%;}", ".f1115ve7{overflow-anchor:none;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f5zp4f{overflow-y:auto;}", ".f1063pyq{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}", ".f1oy3dpc{overflow-x:auto;}", ".f1gkdon0{-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;}", ".f1oztnx0{-webkit-flex-direction:row-reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;}"]
34
+ });
35
+ /**
36
+ * Apply styling to the Virtualizer states
37
+ */
38
+ export const useVirtualizerScrollViewStyles_unstable = state => {
39
+ const styles = useStyles();
40
+ // For now - just return default style mods
41
+ useVirtualizerStyles_unstable(state);
42
+ const containerStyle = state.axis === 'horizontal' ? state.reversed ? styles.horizontalReversed : styles.horizontal : state.reversed ? styles.verticalReversed : styles.vertical;
43
+ state.container.className = mergeClasses(virtualizerScrollViewClassNames.container, styles.base, containerStyle, state.container.className);
44
+ return state;
45
+ };
46
+ //# sourceMappingURL=useVirtualizerScrollViewStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useVirtualizerStyles_unstable","virtualizerClassNames","__styles","mergeClasses","virtualizerScrollViewClassName","virtualizerScrollViewClassNames","container","useStyles","base","mc9l5x","a9b677","Bqenvij","Eiaeu8","vertical","Beiy3e4","Bmxbyg5","horizontal","B68tc82","verticalReversed","horizontalReversed","d","useVirtualizerScrollViewStyles_unstable","state","styles","containerStyle","axis","reversed","className"],"sources":["../../../src/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.ts"],"sourcesContent":["import { VirtualizerScrollViewState } from './VirtualizerScrollView.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { VirtualizerScrollViewSlots } from './VirtualizerScrollView.types';\nimport { useVirtualizerStyles_unstable, virtualizerClassNames } from '../Virtualizer/useVirtualizerStyles';\nimport { makeStyles, mergeClasses } from '@griffel/react';\n\nconst virtualizerScrollViewClassName = 'fui-Virtualizer-Scroll-View';\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 overflowAnchor: 'none',\n },\n vertical: {\n flexDirection: 'column',\n overflowAnchor: 'none',\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 */\nexport const useVirtualizerScrollViewStyles_unstable = (\n state: VirtualizerScrollViewState,\n): VirtualizerScrollViewState => {\n const styles = useStyles();\n\n // For now - just return default style mods\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 state.container.className = mergeClasses(\n virtualizerScrollViewClassNames.container,\n styles.base,\n containerStyle,\n state.container.className,\n );\n\n return state;\n};\n"],"mappings":"AAGA,SAASA,6BAA6B,EAAEC,qBAAqB,QAAQ;AACrE,SAAAC,QAAA,EAAqBC,YAAY,QAAQ;AAEzC,MAAMC,8BAAA,GAAiC;AAEvC,OAAO,MAAMC,+BAAA,GAA8E;EACzF,GAAGJ,qBAAqB;EACxBK,SAAA,EAAY,GAAEF,8BAA+B;AAC/C;AAEA,MAAMG,SAAA,gBAAYL,QAAA;EAAAM,IAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,QAAA;IAAAC,OAAA;IAAAF,MAAA;IAAAG,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,EAwBlB;AAEA;;;AAGA,OAAO,MAAMC,uCAAA,GACXC,KAAA,IAC+B;EAC/B,MAAMC,MAAA,GAAShB,SAAA;EAEf;EACAP,6BAAA,CAA8BsB,KAAA;EAE9B,MAAME,cAAA,GACJF,KAAA,CAAMG,IAAI,KAAK,eACXH,KAAA,CAAMI,QAAQ,GACZH,MAAA,CAAOJ,kBAAkB,GACzBI,MAAA,CAAOP,UAAU,GACnBM,KAAA,CAAMI,QAAQ,GACdH,MAAA,CAAOL,gBAAgB,GACvBK,MAAA,CAAOV,QAAQ;EAErBS,KAAA,CAAMhB,SAAS,CAACqB,SAAS,GAAGxB,YAAA,CAC1BE,+BAAA,CAAgCC,SAAS,EACzCiB,MAAA,CAAOf,IAAI,EACXgB,cAAA,EACAF,KAAA,CAAMhB,SAAS,CAACqB,SAAS;EAG3B,OAAOL,KAAA;AACT"}
@@ -1,2 +1,3 @@
1
1
  export * from './useIntersectionObserver';
2
+ export * from './useVirtualizerMeasure';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-virtualizer/src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './useIntersectionObserver';\n"]}
1
+ {"version":3,"names":[],"sources":["../../src/hooks/index.ts"],"sourcesContent":["export * from './useIntersectionObserver';\nexport * from './useVirtualizerMeasure';\n"],"mappings":"AAAA,cAAc;AACd,cAAc"}
@@ -14,14 +14,6 @@ const {
14
14
  * update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.
15
15
  */
16
16
  export const useIntersectionObserver = (callback, options) => {
17
- // export const useIntersectionObserver = (
18
- // callback: IntersectionObserverCallback,
19
- // options?: IntersectionObserverInit,
20
- // ): [
21
- // Dispatch<SetStateAction<Element[] | undefined>>,
22
- // Dispatch<SetStateAction<IntersectionObserverInit | undefined>>,
23
- // MutableRefObject<IntersectionObserver | undefined>,
24
- // ] => {
25
17
  const observer = useRef();
26
18
  const [observerList, setObserverList] = useState();
27
19
  const [observerInit, setObserverInit] = useState(options);
@@ -32,8 +24,8 @@ export const useIntersectionObserver = (callback, options) => {
32
24
  // If we have an instance of IO and a list with elements, observer the elements
33
25
  if (observer.current && observerList && observerList.length > 0) {
34
26
  observerList.forEach(element => {
35
- var _a;
36
- (_a = observer.current) === null || _a === void 0 ? void 0 : _a.observe(element);
27
+ var _observer_current;
28
+ (_observer_current = observer.current) === null || _observer_current === void 0 ? void 0 : _observer_current.observe(element);
37
29
  });
38
30
  }
39
31
  // clean up previous elements being listened to
@@ -1 +1 @@
1
- {"version":3,"names":["React","useIsomorphicLayoutEffect","useState","useRef","useIntersectionObserver","callback","options","observer","observerList","setObserverList","observerInit","setObserverInit","current","IntersectionObserver","length","forEach","element","_a","observe","disconnect"],"sources":["../src/packages/react-components/react-virtualizer/src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import type { Dispatch, MutableRefObject, SetStateAction } from 'react';\nimport * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\nconst { useState, useRef } = React;\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 */\n\nexport const useIntersectionObserver = (\n callback: IntersectionObserverCallback,\n options?: IntersectionObserverInit,\n): {\n setObserverList: Dispatch<SetStateAction<Element[] | undefined>>;\n setObserverInit: Dispatch<SetStateAction<IntersectionObserverInit | undefined>>;\n observer: MutableRefObject<IntersectionObserver | undefined>;\n} => {\n // export const useIntersectionObserver = (\n // callback: IntersectionObserverCallback,\n // options?: IntersectionObserverInit,\n // ): [\n // Dispatch<SetStateAction<Element[] | undefined>>,\n // Dispatch<SetStateAction<IntersectionObserverInit | undefined>>,\n // MutableRefObject<IntersectionObserver | undefined>,\n // ] => {\n const observer = useRef<IntersectionObserver>();\n const [observerList, setObserverList] = useState<Element[]>();\n const [observerInit, setObserverInit] = useState<IntersectionObserverInit | undefined>(options);\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 observer.current = new IntersectionObserver(callback, observerInit);\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]);\n\n return { setObserverList, setObserverInit, observer };\n};\n"],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,yBAAyB,QAAQ,2BAA2B;AAErE,MAAM;EAAEC,QAAQ;EAAEC;AAAM,CAAE,GAAGH,KAAK;AAElC;;;;;;;;;AAUA,OAAO,MAAMI,uBAAuB,GAAGA,CACrCC,QAAsC,EACtCC,OAAkC,KAKhC;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAGJ,MAAM,EAAwB;EAC/C,MAAM,CAACK,YAAY,EAAEC,eAAe,CAAC,GAAGP,QAAQ,EAAa;EAC7D,MAAM,CAACQ,YAAY,EAAEC,eAAe,CAAC,GAAGT,QAAQ,CAAuCI,OAAO,CAAC;EAE/F;EACA;EACAL,yBAAyB,CAAC,MAAK;IAC7BM,QAAQ,CAACK,OAAO,GAAG,IAAIC,oBAAoB,CAACR,QAAQ,EAAEK,YAAY,CAAC;IAEnE;IACA,IAAIH,QAAQ,CAACK,OAAO,IAAIJ,YAAY,IAAIA,YAAY,CAACM,MAAM,GAAG,CAAC,EAAE;MAC/DN,YAAY,CAACO,OAAO,CAACC,OAAO,IAAG;;QAC7B,CAAAC,EAAA,GAAAV,QAAQ,CAACK,OAAO,cAAAK,EAAA,uBAAAA,EAAA,CAAEC,OAAO,CAACF,OAAO,CAAC;MACpC,CAAC,CAAC;;IAGJ;IACA,OAAO,MAAK;MACV,IAAIT,QAAQ,CAACK,OAAO,EAAE;QACpBL,QAAQ,CAACK,OAAO,CAACO,UAAU,EAAE;;IAEjC,CAAC;EACH,CAAC,EAAE,CAACX,YAAY,EAAEE,YAAY,EAAEL,QAAQ,CAAC,CAAC;EAE1C,OAAO;IAAEI,eAAe;IAAEE,eAAe;IAAEJ;EAAQ,CAAE;AACvD,CAAC"}
1
+ {"version":3,"names":["React","useIsomorphicLayoutEffect","useState","useRef","useIntersectionObserver","callback","options","observer","observerList","setObserverList","observerInit","setObserverInit","current","IntersectionObserver","length","forEach","element","_observer_current","observe","disconnect"],"sources":["../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import type { Dispatch, MutableRefObject, SetStateAction } from 'react';\nimport * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\nconst { useState, useRef } = React;\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 */\n\nexport const useIntersectionObserver = (\n callback: IntersectionObserverCallback,\n options?: IntersectionObserverInit,\n): {\n setObserverList: Dispatch<SetStateAction<Element[] | undefined>>;\n setObserverInit: Dispatch<SetStateAction<IntersectionObserverInit | undefined>>;\n observer: MutableRefObject<IntersectionObserver | undefined>;\n} => {\n const observer = useRef<IntersectionObserver>();\n const [observerList, setObserverList] = useState<Element[]>();\n const [observerInit, setObserverInit] = useState<IntersectionObserverInit | undefined>(options);\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 observer.current = new IntersectionObserver(callback, observerInit);\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]);\n\n return { setObserverList, setObserverInit, observer };\n};\n"],"mappings":"AACA,YAAYA,KAAA,MAAW;AACvB,SAASC,yBAAyB,QAAQ;AAE1C,MAAM;EAAEC,QAAA;EAAUC;AAAM,CAAE,GAAGH,KAAA;AAE7B;;;;;;;;;AAUA,OAAO,MAAMI,uBAAA,GAA0BA,CACrCC,QAAA,EACAC,OAAA,KAKG;EACH,MAAMC,QAAA,GAAWJ,MAAA;EACjB,MAAM,CAACK,YAAA,EAAcC,eAAA,CAAgB,GAAGP,QAAA;EACxC,MAAM,CAACQ,YAAA,EAAcC,eAAA,CAAgB,GAAGT,QAAA,CAA+CI,OAAA;EAEvF;EACA;EACAL,yBAAA,CAA0B,MAAM;IAC9BM,QAAA,CAASK,OAAO,GAAG,IAAIC,oBAAA,CAAqBR,QAAA,EAAUK,YAAA;IAEtD;IACA,IAAIH,QAAA,CAASK,OAAO,IAAIJ,YAAA,IAAgBA,YAAA,CAAaM,MAAM,GAAG,GAAG;MAC/DN,YAAA,CAAaO,OAAO,CAACC,OAAA,IAAW;YAC9BC,iBAAA;QAAA,CAAAA,iBAAA,GAAAV,QAAA,CAASK,OAAO,cAAhBK,iBAAA,uBAAAA,iBAAA,CAAkBC,OAAA,CAAQF,OAAA;MAC5B;IACF;IAEA;IACA,OAAO,MAAM;MACX,IAAIT,QAAA,CAASK,OAAO,EAAE;QACpBL,QAAA,CAASK,OAAO,CAACO,UAAU;MAC7B;IACF;EACF,GAAG,CAACX,YAAA,EAAcE,YAAA,EAAcL,QAAA,CAAS;EAEzC,OAAO;IAAEI,eAAA;IAAiBE,eAAA;IAAiBJ;EAAS;AACtD"}
@@ -0,0 +1,76 @@
1
+ import * as React from 'react';
2
+ import { canUseDOM } from '@fluentui/react-utilities';
3
+ import { debounce } from '../utilities/debounce';
4
+ /**
5
+ * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.
6
+ */
7
+ export const useStaticVirtualizerMeasure = virtualizerProps => {
8
+ const {
9
+ defaultItemSize,
10
+ direction = 'vertical'
11
+ } = virtualizerProps;
12
+ const [state, setState] = React.useState({
13
+ virtualizerLength: 0,
14
+ bufferSize: 0,
15
+ bufferItems: 0
16
+ });
17
+ const {
18
+ virtualizerLength,
19
+ bufferItems,
20
+ bufferSize
21
+ } = state;
22
+ // The ref the user sets on their scrollView - Defaults to document.body to ensure no null on init
23
+ const container = React.useRef(null);
24
+ const resizeCallback = () => {
25
+ if (!container.current) {
26
+ return;
27
+ }
28
+ const containerSize = direction === 'vertical' ? container.current.getBoundingClientRect().height : container.current.getBoundingClientRect().width;
29
+ /*
30
+ * Number of items required to cover viewport.
31
+ */
32
+ const length = Math.ceil(containerSize / defaultItemSize + 1);
33
+ /*
34
+ * Number of items to append at each end, i.e. 'preload' each side before entering view.
35
+ */
36
+ const newBufferItems = Math.max(Math.floor(length / 4), 2);
37
+ /*
38
+ * This is how far we deviate into the bufferItems to detect a redraw.
39
+ */
40
+ const newBufferSize = Math.max(Math.floor(length / 8 * defaultItemSize), 1);
41
+ const totalLength = length + newBufferItems * 2 + 1;
42
+ setState({
43
+ virtualizerLength: totalLength,
44
+ bufferItems: newBufferItems,
45
+ bufferSize: newBufferSize
46
+ });
47
+ };
48
+ // the handler for resize observer
49
+ const handleResize = debounce(resizeCallback);
50
+ // Keep the reference of ResizeObserver in the state, as it should live through renders
51
+ const [resizeObserver] = React.useState(canUseDOM() ? new ResizeObserver(handleResize) : undefined);
52
+ React.useEffect(() => {
53
+ return () => {
54
+ resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
55
+ };
56
+ // eslint-disable-next-line react-hooks/exhaustive-deps
57
+ }, []);
58
+ const scrollRef = React.useCallback(el => {
59
+ if (container.current !== el) {
60
+ if (container.current) {
61
+ resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve(container.current);
62
+ }
63
+ container.current = el;
64
+ if (container.current) {
65
+ resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe(container.current);
66
+ }
67
+ }
68
+ }, [resizeObserver]);
69
+ return {
70
+ virtualizerLength,
71
+ bufferItems,
72
+ bufferSize,
73
+ scrollRef
74
+ };
75
+ };
76
+ //# sourceMappingURL=useVirtualizerMeasure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","canUseDOM","debounce","useStaticVirtualizerMeasure","virtualizerProps","defaultItemSize","direction","state","setState","useState","virtualizerLength","bufferSize","bufferItems","container","useRef","resizeCallback","current","containerSize","getBoundingClientRect","height","width","length","Math","ceil","newBufferItems","max","floor","newBufferSize","totalLength","handleResize","resizeObserver","ResizeObserver","undefined","useEffect","disconnect","scrollRef","useCallback","el","unobserve","observe"],"sources":["../../src/hooks/useVirtualizerMeasure.ts"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { VirtualizerMeasureProps } from './useVirtualizerMeasure.types';\nimport { debounce } from '../utilities/debounce';\n\n/**\n * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.\n */\nexport const useStaticVirtualizerMeasure = (\n virtualizerProps: VirtualizerMeasureProps,\n): {\n virtualizerLength: number;\n bufferItems: number;\n bufferSize: number;\n scrollRef: (instance: HTMLElement | HTMLDivElement | null) => void;\n} => {\n const { defaultItemSize, direction = 'vertical' } = virtualizerProps;\n\n const [state, setState] = React.useState({\n virtualizerLength: 0,\n bufferSize: 0,\n bufferItems: 0,\n });\n\n const { virtualizerLength, bufferItems, bufferSize } = state;\n\n // The ref the user sets on their scrollView - Defaults to document.body to ensure no null on init\n const container = React.useRef<HTMLElement | null>(null);\n\n const resizeCallback = () => {\n if (!container.current) {\n return;\n }\n\n const containerSize =\n direction === 'vertical'\n ? container.current.getBoundingClientRect().height\n : container.current.getBoundingClientRect().width;\n\n /*\n * Number of items required to cover viewport.\n */\n const length = Math.ceil(containerSize / defaultItemSize + 1);\n\n /*\n * Number of items to append at each end, i.e. 'preload' each side before entering view.\n */\n const newBufferItems = Math.max(Math.floor(length / 4), 2);\n\n /*\n * This is how far we deviate into the bufferItems to detect a redraw.\n */\n const newBufferSize = Math.max(Math.floor((length / 8) * defaultItemSize), 1);\n\n const totalLength = length + newBufferItems * 2 + 1;\n\n setState({\n virtualizerLength: totalLength,\n bufferItems: newBufferItems,\n bufferSize: newBufferSize,\n });\n };\n\n // the handler for resize observer\n const handleResize = debounce(resizeCallback);\n\n // Keep the reference of ResizeObserver in the state, as it should live through renders\n const [resizeObserver] = React.useState(canUseDOM() ? new ResizeObserver(handleResize) : undefined);\n\n React.useEffect(() => {\n return () => {\n resizeObserver?.disconnect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const scrollRef = React.useCallback(\n (el: HTMLElement | null) => {\n if (container.current !== el) {\n if (container.current) {\n resizeObserver?.unobserve(container.current);\n }\n\n container.current = el;\n if (container.current) {\n resizeObserver?.observe(container.current);\n }\n }\n },\n [resizeObserver],\n );\n\n return {\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollRef,\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,QAAQ;AAE1B,SAASC,QAAQ,QAAQ;AAEzB;;;AAGA,OAAO,MAAMC,2BAAA,GACXC,gBAAA,IAMG;EACH,MAAM;IAAEC,eAAA;IAAiBC,SAAA,GAAY;EAAU,CAAE,GAAGF,gBAAA;EAEpD,MAAM,CAACG,KAAA,EAAOC,QAAA,CAAS,GAAGR,KAAA,CAAMS,QAAQ,CAAC;IACvCC,iBAAA,EAAmB;IACnBC,UAAA,EAAY;IACZC,WAAA,EAAa;EACf;EAEA,MAAM;IAAEF,iBAAA;IAAmBE,WAAA;IAAaD;EAAU,CAAE,GAAGJ,KAAA;EAEvD;EACA,MAAMM,SAAA,GAAYb,KAAA,CAAMc,MAAM,CAAqB,IAAI;EAEvD,MAAMC,cAAA,GAAiBA,CAAA,KAAM;IAC3B,IAAI,CAACF,SAAA,CAAUG,OAAO,EAAE;MACtB;IACF;IAEA,MAAMC,aAAA,GACJX,SAAA,KAAc,aACVO,SAAA,CAAUG,OAAO,CAACE,qBAAqB,GAAGC,MAAM,GAChDN,SAAA,CAAUG,OAAO,CAACE,qBAAqB,GAAGE,KAAK;IAErD;;;IAGA,MAAMC,MAAA,GAASC,IAAA,CAAKC,IAAI,CAACN,aAAA,GAAgBZ,eAAA,GAAkB;IAE3D;;;IAGA,MAAMmB,cAAA,GAAiBF,IAAA,CAAKG,GAAG,CAACH,IAAA,CAAKI,KAAK,CAACL,MAAA,GAAS,IAAI;IAExD;;;IAGA,MA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ooks/useVirtualizerMeasure.types.ts"],"sourcesContent":["export type VirtualizerMeasureProps = {\n defaultItemSize: number;\n direction?: 'vertical' | 'horizontal';\n};\n"],"mappings":"AAAA"}
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { Virtualizer, virtualizerClassNames, useVirtualizer_unstable, renderVirtualizer_unstable, useVirtualizerStyles_unstable } from './Virtualizer';
2
- export { useIntersectionObserver } from './Hooks';
2
+ export { useIntersectionObserver, useStaticVirtualizerMeasure } from './Hooks';
3
+ export { VirtualizerScrollView, virtualizerScrollViewClassNames, useVirtualizerScrollView_unstable, renderVirtualizerScrollView_unstable, useVirtualizerScrollViewStyles_unstable } from './VirtualizerScrollView';
3
4
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Virtualizer","virtualizerClassNames","useVirtualizer_unstable","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useIntersectionObserver"],"sources":["../src/packages/react-components/react-virtualizer/src/index.ts"],"sourcesContent":["export {\n Virtualizer,\n virtualizerClassNames,\n useVirtualizer_unstable,\n renderVirtualizer_unstable,\n useVirtualizerStyles_unstable,\n} from './Virtualizer';\nexport type {\n VirtualizerProps,\n VirtualizerState,\n VirtualizerSlots,\n VirtualizerChildRenderFunction,\n} from './Virtualizer';\nexport { useIntersectionObserver } from './Hooks';\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,6BAA6B,QACxB,eAAe;AAOtB,SAASC,uBAAuB,QAAQ,SAAS"}
1
+ {"version":3,"names":["Virtualizer","virtualizerClassNames","useVirtualizer_unstable","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useIntersectionObserver","useStaticVirtualizerMeasure","VirtualizerScrollView","virtualizerScrollViewClassNames","useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable"],"sources":["../src/index.ts"],"sourcesContent":["export {\n Virtualizer,\n virtualizerClassNames,\n useVirtualizer_unstable,\n renderVirtualizer_unstable,\n useVirtualizerStyles_unstable,\n} from './Virtualizer';\nexport type {\n VirtualizerProps,\n VirtualizerState,\n VirtualizerSlots,\n VirtualizerChildRenderFunction,\n} from './Virtualizer';\nexport { useIntersectionObserver, useStaticVirtualizerMeasure } from './Hooks';\n\nexport {\n VirtualizerScrollView,\n virtualizerScrollViewClassNames,\n useVirtualizerScrollView_unstable,\n renderVirtualizerScrollView_unstable,\n useVirtualizerScrollViewStyles_unstable,\n} from './VirtualizerScrollView';\n\nexport type {\n VirtualizerScrollViewProps,\n VirtualizerScrollViewState,\n VirtualizerScrollViewSlots,\n} from './VirtualizerScrollView';\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,6BAA6B,QACxB;AAOP,SAASC,uBAAuB,EAAEC,2BAA2B,QAAQ;AAErE,SACEC,qBAAqB,EACrBC,+BAA+B,EAC/BC,iCAAiC,EACjCC,oCAAoC,EACpCC,uCAAuC,QAClC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Microtask debouncer
3
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide
4
+ * @param fn - Function to debounce
5
+ * @returns debounced function
6
+ */export function debounce(fn) {
7
+ let pending;
8
+ return () => {
9
+ if (!pending) {
10
+ pending = true;
11
+ queueMicrotask(() => {
12
+ // Need to set pending to `false` before the debounced function is run.
13
+ // React can actually interrupt the function while it's running!
14
+ pending = false;
15
+ fn();
16
+ });
17
+ }
18
+ };
19
+ }
20
+ //# sourceMappingURL=debounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["debounce","fn","pending","queueMicrotask"],"sources":["../../src/utilities/debounce.ts"],"sourcesContent":["/**\n * Microtask debouncer\n * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide\n * @param fn - Function to debounce\n * @returns debounced function\n */\nexport function debounce(fn: Function) {\n let pending: boolean;\n return () => {\n if (!pending) {\n pending = true;\n queueMicrotask(() => {\n // Need to set pending to `false` before the debounced function is run.\n // React can actually interrupt the function while it's running!\n pending = false;\n fn();\n });\n }\n };\n}\n"],"mappings":"AAAA;;;;;GAMA,OAAO,SAASA,SAASC,EAAY,EAAE;EACrC,IAAIC,OAAA;EACJ,OAAO,MAAM;IACX,IAAI,CAACA,OAAA,EAAS;MACZA,OAAA,GAAU,IAAI;MACdC,cAAA,CAAe,MAAM;QACnB;QACA;QACAD,OAAA,GAAU,KAAK;QACfD,EAAA;MACF;IACF;EACF;AACF"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./hooks/index"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./hooks/index"), exports);
7
+ //# sourceMappingURL=Hooks.js.map
8
+
8
9
  //# sourceMappingURL=Hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-virtualizer/src/Hooks.ts"],"sourcesContent":["export * from './hooks/index';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA"}
1
+ {"version":3,"sources":["../lib/Hooks.js"],"sourcesContent":["export * from './hooks/index';\n//# sourceMappingURL=Hooks.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iCAAiC"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./components/Virtualizer/index"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./components/Virtualizer/index"), exports);
7
+ //# sourceMappingURL=Virtualizer.js.map
8
+
8
9
  //# sourceMappingURL=Virtualizer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-virtualizer/src/Virtualizer.ts"],"sourcesContent":["export * from './components/Virtualizer/index';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,oCAAAC,OAAA"}
1
+ {"version":3,"sources":["../lib/Virtualizer.js"],"sourcesContent":["export * from './components/Virtualizer/index';\n//# sourceMappingURL=Virtualizer.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,uCAAuC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./components/VirtualizerScrollView/index"), exports);
7
+ //# sourceMappingURL=VirtualizerScrollView.js.map
8
+
9
+ //# sourceMappingURL=VirtualizerScrollView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../lib/VirtualizerScrollView.js"],"sourcesContent":["export * from './components/VirtualizerScrollView/index';\n//# sourceMappingURL=VirtualizerScrollView.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iDAAiD"}
@@ -1,22 +1,19 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "Virtualizer", {
6
+ enumerable: true,
7
+ get: ()=>Virtualizer
5
8
  });
6
- exports.Virtualizer = void 0;
7
- const useVirtualizerStyles_1 = /*#__PURE__*/require("./useVirtualizerStyles");
8
- const useVirtualizer_1 = /*#__PURE__*/require("./useVirtualizer");
9
- const renderVirtualizer_1 = /*#__PURE__*/require("./renderVirtualizer");
10
- /**
11
- * Virtualizer pseudo-component, this functional wrapper
12
- * provides a simple interface for reducing the total number
13
- * of elements rendered at one time in large lists.
14
- */
15
- const Virtualizer = props => {
16
- const state = useVirtualizer_1.useVirtualizer_unstable(props);
17
- useVirtualizerStyles_1.useVirtualizerStyles_unstable(state);
18
- return renderVirtualizer_1.renderVirtualizer_unstable(state);
9
+ const _useVirtualizerStyles = require("./useVirtualizerStyles");
10
+ const _useVirtualizer = require("./useVirtualizer");
11
+ const _renderVirtualizer = require("./renderVirtualizer");
12
+ const Virtualizer = (props)=>{
13
+ const state = (0, _useVirtualizer.useVirtualizer_unstable)(props);
14
+ (0, _useVirtualizerStyles.useVirtualizerStyles_unstable)(state);
15
+ return (0, _renderVirtualizer.renderVirtualizer_unstable)(state);
19
16
  };
20
- exports.Virtualizer = Virtualizer;
21
- exports.Virtualizer.displayName = 'Virtualizer';
17
+ Virtualizer.displayName = 'Virtualizer'; //# sourceMappingURL=Virtualizer.js.map
18
+
22
19
  //# sourceMappingURL=Virtualizer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useVirtualizerStyles_1","require","useVirtualizer_1","renderVirtualizer_1","Virtualizer","props","state","useVirtualizer_unstable","useVirtualizerStyles_unstable","renderVirtualizer_unstable","exports","displayName"],"sources":["../src/packages/react-components/react-virtualizer/src/components/Virtualizer/Virtualizer.ts"],"sourcesContent":["import type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles';\nimport { useVirtualizer_unstable } from './useVirtualizer';\nimport { renderVirtualizer_unstable } from './renderVirtualizer';\nimport type { FC } from 'react';\n\n/**\n * Virtualizer pseudo-component, this functional wrapper\n * provides a simple interface for reducing the total number\n * of elements rendered at one time in large lists.\n */\nexport const Virtualizer: FC<VirtualizerProps> = (props: VirtualizerProps) => {\n const state = useVirtualizer_unstable(props);\n useVirtualizerStyles_unstable(state);\n\n return renderVirtualizer_unstable(state);\n};\n\nVirtualizer.displayName = 'Virtualizer';\n"],"mappings":";;;;;;AACA,MAAAA,sBAAA,gBAAAC,OAAA;AACA,MAAAC,gBAAA,gBAAAD,OAAA;AACA,MAAAE,mBAAA,gBAAAF,OAAA;AAGA;;;;;AAKO,MAAMG,WAAW,GAA0BC,KAAuB,IAAI;EAC3E,MAAMC,KAAK,GAAGJ,gBAAA,CAAAK,uBAAuB,CAACF,KAAK,CAAC;EAC5CL,sBAAA,CAAAQ,6BAA6B,CAACF,KAAK,CAAC;EAEpC,OAAOH,mBAAA,CAAAM,0BAA0B,CAACH,KAAK,CAAC;AAC1C,CAAC;AALYI,OAAA,CAAAN,WAAW,GAAAA,WAAA;AAOxBM,OAAA,CAAAN,WAAW,CAACO,WAAW,GAAG,aAAa"}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/Virtualizer.js"],"sourcesContent":["import { useVirtualizerStyles_unstable } from './useVirtualizerStyles';\nimport { useVirtualizer_unstable } from './useVirtualizer';\nimport { renderVirtualizer_unstable } from './renderVirtualizer';\n/**\n * Virtualizer pseudo-component, this functional wrapper\n * provides a simple interface for reducing the total number\n * of elements rendered at one time in large lists.\n */\nexport const Virtualizer = props => {\n const state = useVirtualizer_unstable(props);\n useVirtualizerStyles_unstable(state);\n return renderVirtualizer_unstable(state);\n};\nVirtualizer.displayName = 'Virtualizer';\n//# sourceMappingURL=Virtualizer.js.map"],"names":["Virtualizer","props","state","useVirtualizer_unstable","useVirtualizerStyles_unstable","renderVirtualizer_unstable","displayName"],"mappings":";;;;+BAQaA;;aAAAA;;sCARiC;gCACN;mCACG;AAMpC,MAAMA,cAAcC,CAAAA,QAAS;IAClC,MAAMC,QAAQC,IAAAA,uCAAuB,EAACF;IACtCG,IAAAA,mDAA6B,EAACF;IAC9B,OAAOG,IAAAA,6CAA0B,EAACH;AACpC;AACAF,YAAYM,WAAW,GAAG,eAC1B,uCAAuC"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
5
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
+ //# sourceMappingURL=Virtualizer.types.js.map
8
+
6
9
  //# sourceMappingURL=Virtualizer.types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/packages/react-components/react-virtualizer/src/components/Virtualizer/Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type VirtualizerSlots = {\n /**\n * The intersection observed 'before' element will detect when scrolling towards the beginning.\n */\n before: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace at the beginning of current DOM children.\n */\n beforeContainer: NonNullable<Slot<'div', 'tr'>>;\n /**\n * The intersection observed 'after' element will detect when scrolling towards the end.\n */\n after: NonNullable<Slot<'div', 'td'>>;\n /**\n * A block place holding whitespace after the end of current DOM children.\n */\n afterContainer: NonNullable<Slot<'div', 'tr'>>;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & {\n /**\n * The current virtualized array of children to show in the DOM.\n */\n virtualizedChildren: React.ReactNode[];\n /**\n * The current start index for the virtualizer, all previous index's will be removed from DOM.\n */\n virtualizerStartIndex: number;\n /**\n * Current buffer height required at beginning of array.\n */\n afterBufferHeight: number;\n /**\n * Current buffer height required at end of array.\n */\n beforeBufferHeight: number;\n /**\n * The total current height of the scrollView/child content.\n */\n totalVirtualizerHeight: number;\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n */\n reversed?: boolean;\n /**\n * Tells the virtualizer how much\n */\n bufferSize: number;\n};\n\n// Virtualizer render function to procedurally generate children elements as rows or columns via index.\n// Q: Use generic typing and passing through object data or a simple index system?\nexport type VirtualizerChildRenderFunction = (index: number) => React.ReactNode;\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & {\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 * Can be used dynamically.\n */\n children: VirtualizerChildRenderFunction;\n\n /**\n * Default cell size to use if no custom callback provided.\n * If implementing `getItemSize` this should be the initial and ideally minimum cell size.\n */\n itemSize: number;\n\n /**\n * The total number of items to be virtualized.\n */\n numItems: number;\n\n /**\n * Number of children to render in the DOM during virtualization.\n * Constraints:\n * - Large enough that the items rendered in DOM cover the viewport\n * and intersection observer buffers (buffersize) at both ends.\n */\n virtualizerLength: number;\n\n /**\n * Defaults to 1/4th of virtualizerLength.\n * Controls the number of elements rendered before the current index entering the virtualized viewport.\n * Constraints:\n * - Large enough to cover bufferSize (prevents buffers intersecting into the viewport during rest state).\n * - Small enough that the end buffer and end index (start index + virtualizerLength) is not within viewport at rest.\n */\n bufferItems?: number;\n\n /**\n * Defaults to half of bufferItems size (in pixels).\n * The length (in pixels) before the end/start DOM index where the virtualizer recalculation will be triggered.\n * Increasing this reduces whitespace on ultra-fast scroll, as additional elements\n * are buffered to appear while virtualization recalculates.\n * Constraints:\n * - At least 1px - although this will only trigger the recalculation after bookends (whitespace) enter viewport.\n * - BufferSize must be smaller than bufferItems pixel size, as it prevents bookends entering viewport at rest.\n */\n bufferSize?: number;\n\n /**\n * Enables users to override the intersectionObserverRoot.\n * @default null\n */\n intersectionObserverRoot?: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * The scroll direction\n * @default vertical\n */\n axis?: 'vertical' | 'horizontal';\n\n /**\n * Tells the virtualizer to measure in the reverse direction (for column-reverse order etc.)\n * This value should be flipped in RTL implementation (TBD whether automate RTL).\n */\n reversed?: boolean;\n\n /**\n * Callback for acquiring size of individual items\n * @param index - the index of the requested size's child\n */\n getItemSize?: (index: number) => number;\n\n /**\n * Notify users of index changes\n */\n onUpdateIndex?: (index: number, prevIndex: number) => void;\n\n /**\n * Allow users to intervene in index calculation changes\n */\n onCalculateIndex?: (newIndex: number) => number;\n};\n"],"mappings":""}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/Virtualizer.types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=Virtualizer.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,6CAA6C"}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./Virtualizer"), exports);
8
- tslib_1.__exportStar(require("./Virtualizer.types"), exports);
9
- tslib_1.__exportStar(require("./useVirtualizer"), exports);
10
- tslib_1.__exportStar(require("./renderVirtualizer"), exports);
11
- tslib_1.__exportStar(require("./useVirtualizerStyles"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./Virtualizer"), exports);
7
+ _exportStar(require("./Virtualizer.types"), exports);
8
+ _exportStar(require("./useVirtualizer"), exports);
9
+ _exportStar(require("./renderVirtualizer"), exports);
10
+ _exportStar(require("./useVirtualizerStyles"), exports);
11
+ //# sourceMappingURL=index.js.map
12
+
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-virtualizer/src/components/Virtualizer/index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,sBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,4BAAAC,OAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/index.js"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}