@fluentui/react-virtualizer 9.0.0-alpha.1 → 9.0.0-alpha.100

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 (183) hide show
  1. package/CHANGELOG.md +1013 -2
  2. package/dist/index.d.ts +326 -33
  3. package/lib/Hooks.js +1 -2
  4. package/lib/Hooks.js.map +1 -1
  5. package/lib/Utilities.js +1 -0
  6. package/lib/Utilities.js.map +1 -0
  7. package/lib/Virtualizer.js +1 -2
  8. package/lib/Virtualizer.js.map +1 -1
  9. package/lib/VirtualizerScrollView.js +1 -0
  10. package/lib/VirtualizerScrollView.js.map +1 -0
  11. package/lib/VirtualizerScrollViewDynamic.js +1 -0
  12. package/lib/VirtualizerScrollViewDynamic.js.map +1 -0
  13. package/lib/components/Virtualizer/Virtualizer.js +8 -7
  14. package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
  15. package/lib/components/Virtualizer/Virtualizer.types.js +1 -2
  16. package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
  17. package/lib/components/Virtualizer/index.js +4 -6
  18. package/lib/components/Virtualizer/index.js.map +1 -1
  19. package/lib/components/Virtualizer/renderVirtualizer.js +21 -16
  20. package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
  21. package/lib/components/Virtualizer/useVirtualizer.js +526 -356
  22. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  23. package/lib/components/Virtualizer/{useVirtualizerStyles.js → useVirtualizerStyles.styles.js} +5 -4
  24. package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
  25. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +14 -0
  26. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
  27. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +1 -0
  28. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
  29. package/lib/components/VirtualizerScrollView/index.js +4 -0
  30. package/lib/components/VirtualizerScrollView/index.js.map +1 -0
  31. package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js +9 -0
  32. package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
  33. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +81 -0
  34. package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
  35. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +46 -0
  36. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
  37. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +14 -0
  38. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
  39. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +1 -0
  40. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
  41. package/lib/components/VirtualizerScrollViewDynamic/index.js +4 -0
  42. package/lib/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
  43. package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +9 -0
  44. package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
  45. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +153 -0
  46. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
  47. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +46 -0
  48. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
  49. package/lib/hooks/hooks.types.js +1 -0
  50. package/lib/hooks/hooks.types.js.map +1 -0
  51. package/lib/hooks/index.js +5 -2
  52. package/lib/hooks/index.js.map +1 -1
  53. package/lib/hooks/useDynamicPagination.js +126 -0
  54. package/lib/hooks/useDynamicPagination.js.map +1 -0
  55. package/lib/hooks/useDynamicVirtualizerMeasure.js +126 -0
  56. package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
  57. package/lib/hooks/useIntersectionObserver.js +117 -40
  58. package/lib/hooks/useIntersectionObserver.js.map +1 -1
  59. package/lib/hooks/useMeasureList.js +127 -0
  60. package/lib/hooks/useMeasureList.js.map +1 -0
  61. package/lib/hooks/useMutationObserver.js +38 -0
  62. package/lib/hooks/useMutationObserver.js.map +1 -0
  63. package/lib/hooks/useResizeObserverRef.js +60 -0
  64. package/lib/hooks/useResizeObserverRef.js.map +1 -0
  65. package/lib/hooks/useStaticPagination.js +102 -0
  66. package/lib/hooks/useStaticPagination.js.map +1 -0
  67. package/lib/hooks/useVirtualizerMeasure.js +62 -0
  68. package/lib/hooks/useVirtualizerMeasure.js.map +1 -0
  69. package/lib/index.js +4 -2
  70. package/lib/index.js.map +1 -1
  71. package/lib/utilities/ImperativeScrolling/imperativeScrolling.js +32 -0
  72. package/lib/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
  73. package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js +1 -0
  74. package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
  75. package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +45 -0
  76. package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
  77. package/lib/utilities/ImperativeScrolling/index.js +2 -0
  78. package/lib/utilities/ImperativeScrolling/index.js.map +1 -0
  79. package/lib/utilities/VirtualizerContext/VirtualizerContext.js +26 -0
  80. package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
  81. package/lib/utilities/VirtualizerContext/index.js +1 -0
  82. package/lib/utilities/VirtualizerContext/index.js.map +1 -0
  83. package/lib/utilities/VirtualizerContext/types.js +1 -0
  84. package/lib/utilities/VirtualizerContext/types.js.map +1 -0
  85. package/lib/utilities/createResizeObserverFromDocument.js +13 -0
  86. package/lib/utilities/createResizeObserverFromDocument.js.map +1 -0
  87. package/lib/utilities/debounce.js +19 -0
  88. package/lib/utilities/debounce.js.map +1 -0
  89. package/lib/utilities/index.js +2 -0
  90. package/lib/utilities/index.js.map +1 -0
  91. package/lib-commonjs/Hooks.js +31 -5
  92. package/lib-commonjs/Hooks.js.map +1 -1
  93. package/lib-commonjs/Utilities.js +28 -0
  94. package/lib-commonjs/Utilities.js.map +1 -0
  95. package/lib-commonjs/Virtualizer.js +28 -5
  96. package/lib-commonjs/Virtualizer.js.map +1 -1
  97. package/lib-commonjs/VirtualizerScrollView.js +28 -0
  98. package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
  99. package/lib-commonjs/VirtualizerScrollViewDynamic.js +28 -0
  100. package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -0
  101. package/lib-commonjs/components/Virtualizer/Virtualizer.js +19 -18
  102. package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
  103. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +3 -3
  104. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
  105. package/lib-commonjs/components/Virtualizer/index.js +31 -9
  106. package/lib-commonjs/components/Virtualizer/index.js.map +1 -1
  107. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +38 -21
  108. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
  109. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +535 -362
  110. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
  111. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js +123 -0
  112. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
  113. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +23 -0
  114. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
  115. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +6 -0
  116. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
  117. package/lib-commonjs/components/VirtualizerScrollView/index.js +31 -0
  118. package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -0
  119. package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js +19 -0
  120. package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
  121. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +92 -0
  122. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
  123. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js +70 -0
  124. package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
  125. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +23 -0
  126. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
  127. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +6 -0
  128. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
  129. package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js +31 -0
  130. package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js.map +1 -0
  131. package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js +19 -0
  132. package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -0
  133. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js +163 -0
  134. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
  135. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +70 -0
  136. package/lib-commonjs/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
  137. package/lib-commonjs/hooks/hooks.types.js +6 -0
  138. package/lib-commonjs/hooks/hooks.types.js.map +1 -0
  139. package/lib-commonjs/hooks/index.js +35 -5
  140. package/lib-commonjs/hooks/index.js.map +1 -1
  141. package/lib-commonjs/hooks/useDynamicPagination.js +131 -0
  142. package/lib-commonjs/hooks/useDynamicPagination.js.map +1 -0
  143. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js +134 -0
  144. package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -0
  145. package/lib-commonjs/hooks/useIntersectionObserver.js +129 -53
  146. package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
  147. package/lib-commonjs/hooks/useMeasureList.js +134 -0
  148. package/lib-commonjs/hooks/useMeasureList.js.map +1 -0
  149. package/lib-commonjs/hooks/useMutationObserver.js +48 -0
  150. package/lib-commonjs/hooks/useMutationObserver.js.map +1 -0
  151. package/lib-commonjs/hooks/useResizeObserverRef.js +69 -0
  152. package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -0
  153. package/lib-commonjs/hooks/useStaticPagination.js +107 -0
  154. package/lib-commonjs/hooks/useStaticPagination.js.map +1 -0
  155. package/lib-commonjs/hooks/useVirtualizerMeasure.js +70 -0
  156. package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
  157. package/lib-commonjs/index.js +85 -41
  158. package/lib-commonjs/index.js.map +1 -1
  159. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js +42 -0
  160. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -0
  161. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js +6 -0
  162. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -0
  163. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js +55 -0
  164. package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -0
  165. package/lib-commonjs/utilities/ImperativeScrolling/index.js +20 -0
  166. package/lib-commonjs/utilities/ImperativeScrolling/index.js.map +1 -0
  167. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +48 -0
  168. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
  169. package/lib-commonjs/utilities/VirtualizerContext/index.js +22 -0
  170. package/lib-commonjs/utilities/VirtualizerContext/index.js.map +1 -0
  171. package/lib-commonjs/utilities/VirtualizerContext/types.js +6 -0
  172. package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -0
  173. package/lib-commonjs/utilities/createResizeObserverFromDocument.js +23 -0
  174. package/lib-commonjs/utilities/createResizeObserverFromDocument.js.map +1 -0
  175. package/lib-commonjs/utilities/debounce.js +29 -0
  176. package/lib-commonjs/utilities/debounce.js.map +1 -0
  177. package/lib-commonjs/utilities/index.js +29 -0
  178. package/lib-commonjs/utilities/index.js.map +1 -0
  179. package/package.json +20 -24
  180. package/CHANGELOG.json +0 -20
  181. package/lib/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
  182. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js +0 -115
  183. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utilities/VirtualizerContext/VirtualizerContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { DynamicVirtualizerContextProps, VirtualizerContextProps } from './types';\n\nconst VirtualizerContext = React.createContext<VirtualizerContextProps | undefined>(\n undefined,\n) as React.Context<VirtualizerContextProps>;\n\nexport const VirtualizerContextProvider = VirtualizerContext.Provider;\n\nexport const useVirtualizerContext_unstable = () => {\n return React.useContext(VirtualizerContext);\n};\n\nexport const useVirtualizerContextState_unstable = (\n passedContext?: VirtualizerContextProps,\n): DynamicVirtualizerContextProps => {\n const virtualizerContext = useVirtualizerContext_unstable();\n const [_contextIndex, _setContextIndex] = React.useState<number>(-1);\n const childProgressiveSizes = React.useRef<number[]>([]);\n\n /* We respect any wrapped providers while also ensuring defaults or passed through\n * Order of usage -> Passed Prop -> Provider Context -> Internal State default\n */\n const context = React.useMemo(\n () => ({\n contextIndex: passedContext?.contextIndex ?? virtualizerContext?.contextIndex ?? _contextIndex,\n setContextIndex: passedContext?.setContextIndex ?? virtualizerContext?.setContextIndex ?? _setContextIndex,\n childProgressiveSizes,\n }),\n [_contextIndex, passedContext, virtualizerContext],\n );\n\n return context;\n};\n"],"names":["VirtualizerContextProvider","useVirtualizerContextState_unstable","useVirtualizerContext_unstable","VirtualizerContext","React","createContext","undefined","Provider","useContext","passedContext","virtualizerContext","_contextIndex","_setContextIndex","useState","childProgressiveSizes","useRef","context","useMemo","contextIndex","setContextIndex"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAOaA,0BAAAA;eAAAA;;IAMAC,mCAAAA;eAAAA;;IAJAC,8BAAAA;eAAAA;;;;iEATU;AAGvB,MAAMC,mCAAqBC,OAAMC,aAAa,CAC5CC;AAGK,MAAMN,6BAA6BG,mBAAmBI,QAAQ;AAE9D,MAAML,iCAAiC;IAC5C,OAAOE,OAAMI,UAAU,CAACL;AAC1B;AAEO,MAAMF,sCAAsC,CACjDQ;IAEA,MAAMC,qBAAqBR;IAC3B,MAAM,CAACS,eAAeC,iBAAiB,GAAGR,OAAMS,QAAQ,CAAS,CAAC;IAClE,MAAMC,wBAAwBV,OAAMW,MAAM,CAAW,EAAE;IAEvD;;GAEC,GACD,MAAMC,UAAUZ,OAAMa,OAAO,CAC3B;YACgBR,6BAAAA,MACGA,gCAAAA;eAFZ;YACLS,cAAcT,CAAAA,OAAAA,CAAAA,8BAAAA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeS,YAAY,AAAZA,MAAY,QAA3BT,gCAAAA,KAAAA,IAAAA,8BAA+BC,uBAAAA,QAAAA,uBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mBAAoBQ,YAAY,AAAZA,MAAY,QAA/DT,SAAAA,KAAAA,IAAAA,OAAmEE;YACjFQ,iBAAiBV,CAAAA,QAAAA,CAAAA,iCAAAA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeU,eAAe,AAAfA,MAAe,QAA9BV,mCAAAA,KAAAA,IAAAA,iCAAkCC,uBAAAA,QAAAA,uBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mBAAoBS,eAAe,AAAfA,MAAe,QAArEV,UAAAA,KAAAA,IAAAA,QAAyEG;YAC1FE;QACF;IAAA,GACA;QAACH;QAAeF;QAAeC;KAAmB;IAGpD,OAAOM;AACT"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ VirtualizerContextProvider: function() {
13
+ return _VirtualizerContext.VirtualizerContextProvider;
14
+ },
15
+ useVirtualizerContextState_unstable: function() {
16
+ return _VirtualizerContext.useVirtualizerContextState_unstable;
17
+ },
18
+ useVirtualizerContext_unstable: function() {
19
+ return _VirtualizerContext.useVirtualizerContext_unstable;
20
+ }
21
+ });
22
+ const _VirtualizerContext = require("./VirtualizerContext");
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utilities/VirtualizerContext/index.ts"],"sourcesContent":["export {\n VirtualizerContextProvider,\n useVirtualizerContextState_unstable,\n useVirtualizerContext_unstable,\n} from './VirtualizerContext';\nexport type { DynamicVirtualizerContextProps, VirtualizerContextProps } from './types';\n"],"names":["VirtualizerContextProvider","useVirtualizerContextState_unstable","useVirtualizerContext_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACEA,0BAA0B;eAA1BA,8CAA0B;;IAC1BC,mCAAmC;eAAnCA,uDAAmC;;IACnCC,8BAA8B;eAA9BA,kDAA8B;;;oCACzB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utilities/VirtualizerContext/types.ts"],"sourcesContent":["import * as React from 'react';\n/**\n * {@docCategory Virtualizer}\n */\nexport type VirtualizerContextProps = {\n contextIndex: number;\n setContextIndex: (index: number) => void;\n /*\n * These optional props are used in dynamic virtualizer\n */\n childProgressiveSizes?: React.MutableRefObject<number[]>;\n};\n\n/**\n * Some props are optional on static virtualizer, but required for dynamic.\n */\nexport type DynamicVirtualizerContextProps = Required<VirtualizerContextProps>;\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * FIXME - TS 3.8/3.9 don't have ResizeObserver types by default, move this to a shared utility once we bump the minbar
3
+ * A utility method that creates a ResizeObserver from a target document
4
+ * @param targetDocument - document to use to create the ResizeObserver
5
+ * @param callback - https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver#callback
6
+ * @returns a ResizeObserver instance or null if the global does not exist on the document
7
+ */ "use strict";
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ Object.defineProperty(exports, "createResizeObserverFromDocument", {
12
+ enumerable: true,
13
+ get: function() {
14
+ return createResizeObserverFromDocument;
15
+ }
16
+ });
17
+ function createResizeObserverFromDocument(targetDocument, callback) {
18
+ var _targetDocument_defaultView;
19
+ if (!(targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.ResizeObserver)) {
20
+ return null;
21
+ }
22
+ return new targetDocument.defaultView.ResizeObserver(callback);
23
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utilities/createResizeObserverFromDocument.ts"],"sourcesContent":["/**\n * FIXME - TS 3.8/3.9 don't have ResizeObserver types by default, move this to a shared utility once we bump the minbar\n * A utility method that creates a ResizeObserver from a target document\n * @param targetDocument - document to use to create the ResizeObserver\n * @param callback - https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver#callback\n * @returns a ResizeObserver instance or null if the global does not exist on the document\n */\nexport function createResizeObserverFromDocument(\n targetDocument: Document | null | undefined,\n callback: ResizeObserverCallback,\n) {\n if (!targetDocument?.defaultView?.ResizeObserver) {\n return null;\n }\n\n return new targetDocument.defaultView.ResizeObserver(callback);\n}\n"],"names":["createResizeObserverFromDocument","targetDocument","callback","defaultView","ResizeObserver"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;CAMC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,iCACdC,cAA2C,EAC3CC,QAAgC;QAE3BD;IAAL,IAAI,CAACA,CAAAA,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,8BAAAA,eAAgBE,WAAW,AAAXA,MAAW,QAA3BF,gCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,4BAA6BG,cAAc,AAAdA,GAAgB;QAChD,OAAO;IACT;IAEA,OAAO,IAAIH,eAAeE,WAAW,CAACC,cAAc,CAACF;AACvD"}
@@ -0,0 +1,29 @@
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
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ Object.defineProperty(exports, "debounce", {
11
+ enumerable: true,
12
+ get: function() {
13
+ return debounce;
14
+ }
15
+ });
16
+ function debounce(fn) {
17
+ let pending;
18
+ return ()=>{
19
+ if (!pending) {
20
+ pending = true;
21
+ queueMicrotask(()=>{
22
+ // Need to set pending to `false` before the debounced function is run.
23
+ // React can actually interrupt the function while it's running!
24
+ pending = false;
25
+ fn();
26
+ });
27
+ }
28
+ };
29
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"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"],"names":["debounce","fn","pending","queueMicrotask"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;CAKC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,SAASC,EAAY;IACnC,IAAIC;IACJ,OAAO;QACL,IAAI,CAACA,SAAS;YACZA,UAAU;YACVC,eAAe;gBACb,uEAAuE;gBACvE,gEAAgE;gBAChED,UAAU;gBACVD;YACF;QACF;IACF;AACF"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ VirtualizerContextProvider: function() {
13
+ return _VirtualizerContext.VirtualizerContextProvider;
14
+ },
15
+ scrollToItemDynamic: function() {
16
+ return _ImperativeScrolling.scrollToItemDynamic;
17
+ },
18
+ scrollToItemStatic: function() {
19
+ return _ImperativeScrolling.scrollToItemStatic;
20
+ },
21
+ useVirtualizerContextState_unstable: function() {
22
+ return _VirtualizerContext.useVirtualizerContextState_unstable;
23
+ },
24
+ useVirtualizerContext_unstable: function() {
25
+ return _VirtualizerContext.useVirtualizerContext_unstable;
26
+ }
27
+ });
28
+ const _VirtualizerContext = require("./VirtualizerContext");
29
+ const _ImperativeScrolling = require("./ImperativeScrolling");
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utilities/index.ts"],"sourcesContent":["export type { DynamicVirtualizerContextProps, VirtualizerContextProps } from './VirtualizerContext';\nexport {\n VirtualizerContextProvider,\n useVirtualizerContextState_unstable,\n useVirtualizerContext_unstable,\n} from './VirtualizerContext';\nexport type { ScrollToInterface, ScrollToItemDynamicParams, ScrollToItemStaticParams } from './ImperativeScrolling';\nexport { scrollToItemDynamic, scrollToItemStatic } from './ImperativeScrolling';\n"],"names":["VirtualizerContextProvider","scrollToItemDynamic","scrollToItemStatic","useVirtualizerContextState_unstable","useVirtualizerContext_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEEA,0BAA0B;eAA1BA,8CAA0B;;IAKnBC,mBAAmB;eAAnBA,wCAAmB;;IAAEC,kBAAkB;eAAlBA,uCAAkB;;IAJ9CC,mCAAmC;eAAnCA,uDAAmC;;IACnCC,8BAA8B;eAA9BA,kDAA8B;;;oCACzB;qCAEiD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-virtualizer",
3
- "version": "9.0.0-alpha.1",
3
+ "version": "9.0.0-alpha.100",
4
4
  "description": "Generic and composable virtualizer framework built on browser intersection observer",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -11,35 +11,24 @@
11
11
  "url": "https://github.com/microsoft/fluentui"
12
12
  },
13
13
  "license": "MIT",
14
- "scripts": {
15
- "build": "just-scripts build",
16
- "clean": "just-scripts clean",
17
- "code-style": "just-scripts code-style",
18
- "just": "just-scripts",
19
- "lint": "just-scripts lint",
20
- "test": "jest --passWithNoTests",
21
- "storybook": "start-storybook",
22
- "start": "yarn storybook",
23
- "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor",
24
- "type-check": "tsc -b tsconfig.json"
25
- },
26
14
  "devDependencies": {
27
15
  "@fluentui/eslint-plugin": "*",
28
16
  "@fluentui/react-conformance": "*",
29
- "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
30
- "@fluentui/scripts-api-extractor": "*",
31
- "@fluentui/scripts-tasks": "*"
17
+ "@fluentui/react-conformance-griffel": "*",
18
+ "@fluentui/scripts-api-extractor": "*"
32
19
  },
33
20
  "dependencies": {
34
- "@fluentui/react-utilities": "^9.4.0",
35
- "@griffel/react": "^1.5.2",
36
- "tslib": "^2.1.0"
21
+ "@fluentui/react-jsx-runtime": "^9.1.2",
22
+ "@fluentui/react-utilities": "^9.22.0",
23
+ "@fluentui/react-shared-contexts": "^9.24.0",
24
+ "@griffel/react": "^1.5.22",
25
+ "@swc/helpers": "^0.5.1"
37
26
  },
38
27
  "peerDependencies": {
39
- "@types/react": ">=16.8.0 <18.0.0",
40
- "@types/react-dom": ">=16.8.0 <18.0.0",
41
- "react": ">=16.8.0 <18.0.0",
42
- "react-dom": ">=16.8.0 <18.0.0"
28
+ "@types/react": ">=16.14.0 <19.0.0",
29
+ "@types/react-dom": ">=16.9.0 <19.0.0",
30
+ "react": ">=16.14.0 <19.0.0",
31
+ "react-dom": ">=16.14.0 <19.0.0"
43
32
  },
44
33
  "beachball": {
45
34
  "disallowedChangeTypes": [
@@ -51,9 +40,16 @@
51
40
  "exports": {
52
41
  ".": {
53
42
  "types": "./dist/index.d.ts",
43
+ "node": "./lib-commonjs/index.js",
54
44
  "import": "./lib/index.js",
55
45
  "require": "./lib-commonjs/index.js"
56
46
  },
57
47
  "./package.json": "./package.json"
58
- }
48
+ },
49
+ "files": [
50
+ "*.md",
51
+ "dist/*.d.ts",
52
+ "lib",
53
+ "lib-commonjs"
54
+ ]
59
55
  }
package/CHANGELOG.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "name": "@fluentui/react-virtualizer",
3
- "entries": [
4
- {
5
- "date": "Mon, 23 Jan 2023 16:41:44 GMT",
6
- "tag": "@fluentui/react-virtualizer_v9.0.0-alpha.1",
7
- "version": "9.0.0-alpha.1",
8
- "comments": {
9
- "prerelease": [
10
- {
11
- "author": "mifraser@microsoft.com",
12
- "package": "@fluentui/react-virtualizer",
13
- "commit": "547235ce85eef5fc65ed0cdd51ef5244d480b4b6",
14
- "comment": "feat: Initial unstable release of the Virtualizer"
15
- }
16
- ]
17
- }
18
- }
19
- ]
20
- }
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"AAAA,mBAAqBA,YAAY,QAAQ,gBAAgB;AAIzD,MAAMC,oBAAoB,GAAG,iBAAiB;AAC9C,OAAO,MAAMC,qBAAqB,GAAqC;EACrEC,MAAM,EAAE,GAAGF,oBAAoB,UAAU;EACzCG,eAAe,EAAE,GAAGH,oBAAoB,mBAAmB;EAC3DI,KAAK,EAAE,GAAGJ,oBAAoB,SAAS;EACvCK,cAAc,EAAE,GAAGL,oBAAoB;CACxC;AAED,MAAMM,SAAS,gBAAG;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAchB;AAEF;;;AAGA,OAAO,MAAMC,6BAA6B,GAAIC,KAAuB,IAAsB;EACzF,MAAMC,MAAM,GAAGH,SAAS,EAAE;EAC1B,MAAM;IAAEI,QAAQ;IAAEC,IAAI;IAAEC,kBAAkB;IAAEC,iBAAiB;IAAEC;EAAU,CAAE,GAAGN,KAAK;EACnF,MAAMO,UAAU,GAAGJ,IAAI,KAAK,YAAY;EAExCH,KAAK,CAACN,MAAM,CAACc,SAAS,GAAGjB,YAAY,CACnCE,qBAAqB,CAACC,MAAM,EAC5BO,MAAM,CAACQ,IAAI,EACXR,MAAM,CAACS,QAAQ,EACfH,UAAU,GAAGN,MAAM,CAACM,UAAU,GAAGN,MAAM,CAACU,QAAQ,EAChDX,KAAK,CAACN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AAC2B;GAChB;EAEDvB,KAAK,CAACH,cAAc,CAAC0B,KAAK,GAAG;IAC3BC,MAAM,EAAEjB,UAAU,GAAG,MAAM,GAAGM,aAAa;IAC3CY,KAAK,EAAElB,UAAU,GAAGM,aAAa,GAAG,MAAM;IAC1C,GAAGb,KAAK,CAACH,cAAc,CAAC0B;GACzB;EAED,OAAOvB,KAAK;AACd,CAAC","names":["mergeClasses","virtualizerClassName","virtualizerClassNames","before","beforeContainer","after","afterContainer","useStyles","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","horizontal","className","base","relative","vertical","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginLeft","marginRight","afterBuffer","style","height","width"],"sourceRoot":"../src/","sources":["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"]}
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useVirtualizerStyles_unstable = exports.virtualizerClassNames = void 0;
7
- const react_1 = /*#__PURE__*/require("@griffel/react");
8
- const virtualizerClassName = 'fui-Virtualizer';
9
- exports.virtualizerClassNames = {
10
- before: `${virtualizerClassName}__before`,
11
- beforeContainer: `${virtualizerClassName}__beforeContainer`,
12
- after: `${virtualizerClassName}__after`,
13
- afterContainer: `${virtualizerClassName}__afterContainer`
14
- };
15
- const useStyles = /*#__PURE__*/react_1.__styles({
16
- base: {
17
- mc9l5x: "ftgm304",
18
- Bkecrkj: "f1aehjj5"
19
- },
20
- relative: {
21
- qhf8xq: "f10pi13n"
22
- },
23
- horizontal: {
24
- sshi5w: "fan4evk"
25
- },
26
- vertical: {
27
- Bf4jedk: "f11qra4b"
28
- }
29
- }, {
30
- d: [".ftgm304{display:block;}", ".f1aehjj5{pointer-events:none;}", ".f10pi13n{position:relative;}", ".fan4evk{min-height:100%;}", ".f11qra4b{min-width:100%;}"]
31
- });
32
- /**
33
- * Apply styling to the Virtualizer states
34
- */
35
- const useVirtualizerStyles_unstable = state => {
36
- const styles = useStyles();
37
- const {
38
- reversed,
39
- axis,
40
- beforeBufferHeight,
41
- afterBufferHeight,
42
- bufferSize
43
- } = state;
44
- const horizontal = axis === 'horizontal';
45
- state.before.className = react_1.mergeClasses(exports.virtualizerClassNames.before, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.before.className);
46
- state.after.className = react_1.mergeClasses(exports.virtualizerClassNames.after, styles.base, styles.relative, horizontal ? styles.horizontal : styles.vertical, state.after.className);
47
- state.beforeContainer.className = react_1.mergeClasses(exports.virtualizerClassNames.beforeContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.beforeContainer.className);
48
- state.afterContainer.className = react_1.mergeClasses(exports.virtualizerClassNames.afterContainer, styles.base, horizontal ? styles.horizontal : styles.vertical, state.afterContainer.className);
49
- const beforeHeightPx = beforeBufferHeight + 'px';
50
- const afterHeightPx = afterBufferHeight + 'px';
51
- const beforeBufferHeightPx = beforeBufferHeight + bufferSize + 'px';
52
- const afterBufferHeightPx = afterBufferHeight + bufferSize + 'px';
53
- const bufferPx = bufferSize + 'px';
54
- const beforeBuffer = {
55
- // Column
56
- ...(!reversed && !horizontal && {
57
- marginBottom: `-${bufferPx}`
58
- }),
59
- // Column-Reverse
60
- ...(reversed && !horizontal && {
61
- marginTop: `-${bufferPx}`
62
- }),
63
- // Row
64
- ...(!reversed && horizontal && {
65
- marginLeft: `-${bufferPx}`
66
- }),
67
- // Row-Reverse
68
- ...(reversed && horizontal && {
69
- marginRight: `-${bufferPx}`
70
- })
71
- };
72
- const afterBuffer = {
73
- // Column
74
- ...(!reversed && !horizontal && {
75
- marginTop: `-${bufferPx}`
76
- }),
77
- // Column-Reverse
78
- ...(reversed && !horizontal && {
79
- marginBottom: `-${bufferPx}`
80
- }),
81
- // Row
82
- ...(!reversed && horizontal && {
83
- marginLeft: `-${bufferPx}`
84
- }),
85
- // Row-Reverse
86
- ...(reversed && horizontal && {
87
- marginRight: `-${bufferPx}`
88
- })
89
- };
90
- state.before.style = {
91
- height: horizontal ? '100%' : beforeBufferHeightPx,
92
- width: horizontal ? beforeBufferHeightPx : '100%',
93
- ...beforeBuffer,
94
- ...state.before.style
95
- };
96
- state.beforeContainer.style = {
97
- height: horizontal ? 'auto' : beforeHeightPx,
98
- width: horizontal ? beforeHeightPx : 'auto',
99
- ...state.beforeContainer.style
100
- };
101
- state.after.style = {
102
- height: horizontal ? '100%' : afterBufferHeightPx,
103
- width: horizontal ? afterBufferHeightPx : '100%',
104
- ...afterBuffer,
105
- ...state.after.style
106
- };
107
- state.afterContainer.style = {
108
- height: horizontal ? 'auto' : afterHeightPx,
109
- width: horizontal ? afterHeightPx : 'auto',
110
- ...state.afterContainer.style
111
- };
112
- return state;
113
- };
114
- exports.useVirtualizerStyles_unstable = useVirtualizerStyles_unstable;
115
- //# sourceMappingURL=useVirtualizerStyles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AAIA,MAAMA,oBAAoB,GAAG,iBAAiB;AACjCC,6BAAqB,GAAqC;EACrEC,MAAM,EAAE,GAAGF,oBAAoB,UAAU;EACzCG,eAAe,EAAE,GAAGH,oBAAoB,mBAAmB;EAC3DI,KAAK,EAAE,GAAGJ,oBAAoB,SAAS;EACvCK,cAAc,EAAE,GAAGL,oBAAoB;CACxC;AAED,MAAMM,SAAS,gBAAGC,gBAAU;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAc1B;AAEF;;;AAGO,MAAMC,6BAA6B,GAAIC,KAAuB,IAAsB;EACzF,MAAMC,MAAM,GAAGJ,SAAS,EAAE;EAC1B,MAAM;IAAEK,QAAQ;IAAEC,IAAI;IAAEC,kBAAkB;IAAEC,iBAAiB;IAAEC;EAAU,CAAE,GAAGN,KAAK;EACnF,MAAMO,UAAU,GAAGJ,IAAI,KAAK,YAAY;EAExCH,KAAK,CAACP,MAAM,CAACe,SAAS,GAAGV,oBAAY,CACnCN,6BAAqB,CAACC,MAAM,EAC5BQ,MAAM,CAACQ,IAAI,EACXR,MAAM,CAACS,QAAQ,EACfH,UAAU,GAAGN,MAAM,CAACM,UAAU,GAAGN,MAAM,CAACU,QAAQ,EAChDX,KAAK,CAACP,MAAM,CAACe,SAAS,CACvB;EAEDR,KAAK,CAACL,KAAK,CAACa,SAAS,GAAGV,oBAAY,CAClCN,6BAAqB,CAACG,KAAK,EAC3BM,MAAM,CAACQ,IAAI,EACXR,MAAM,CAACS,QAAQ,EACfH,UAAU,GAAGN,MAAM,CAACM,UAAU,GAAGN,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AC2B;GACzB;EAED,OAAOvB,KAAK;AACd,CAAC;AA1FYR,qCAA6B","names":["virtualizerClassName","exports","before","beforeContainer","after","afterContainer","useStyles","react_1","useVirtualizerStyles_unstable","state","styles","reversed","axis","beforeBufferHeight","afterBufferHeight","bufferSize","horizontal","className","base","relative","vertical","beforeHeightPx","afterHeightPx","beforeBufferHeightPx","afterBufferHeightPx","bufferPx","beforeBuffer","marginBottom","marginTop","marginLeft","marginRight","afterBuffer","style","height","width"],"sourceRoot":"../src/","sources":["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"]}