@fluentui/react-virtualizer 9.0.0-alpha.8 → 9.0.0-alpha.81

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 +754 -8
  2. package/dist/index.d.ts +248 -30
  3. package/lib/Hooks.js +0 -1
  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 +0 -1
  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 +5 -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 +1 -2
  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 +439 -355
  22. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  23. package/lib/components/Virtualizer/{useVirtualizerStyles.js → useVirtualizerStyles.styles.js} +5 -3
  24. package/lib/components/Virtualizer/useVirtualizerStyles.styles.js.map +1 -0
  25. package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +12 -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 +5 -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 +47 -0
  36. package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.styles.js.map +1 -0
  37. package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +12 -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 +5 -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 +149 -0
  46. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamic.js.map +1 -0
  47. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js +47 -0
  48. package/lib/components/VirtualizerScrollViewDynamic/useVirtualizerScrollViewDynamicStyles.styles.js.map +1 -0
  49. package/lib/hooks/hooks.types.js +4 -0
  50. package/lib/hooks/hooks.types.js.map +1 -0
  51. package/lib/hooks/index.js +4 -1
  52. package/lib/hooks/index.js.map +1 -1
  53. package/lib/hooks/useDynamicPagination.js +127 -0
  54. package/lib/hooks/useDynamicPagination.js.map +1 -0
  55. package/lib/hooks/useDynamicVirtualizerMeasure.js +101 -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 +116 -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 +50 -0
  64. package/lib/hooks/useResizeObserverRef.js.map +1 -0
  65. package/lib/hooks/useStaticPagination.js +103 -0
  66. package/lib/hooks/useStaticPagination.js.map +1 -0
  67. package/lib/hooks/useVirtualizerMeasure.js +46 -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 +3 -0
  78. package/lib/utilities/ImperativeScrolling/index.js.map +1 -0
  79. package/lib/utilities/VirtualizerContext/VirtualizerContext.js +33 -0
  80. package/lib/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
  81. package/lib/utilities/VirtualizerContext/index.js +2 -0
  82. package/lib/utilities/VirtualizerContext/index.js.map +1 -0
  83. package/lib/utilities/VirtualizerContext/types.js +3 -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 +3 -5
  92. package/lib-commonjs/Hooks.js.map +1 -1
  93. package/lib-commonjs/Utilities.js +6 -0
  94. package/lib-commonjs/Utilities.js.map +1 -0
  95. package/lib-commonjs/Virtualizer.js +3 -5
  96. package/lib-commonjs/Virtualizer.js.map +1 -1
  97. package/lib-commonjs/VirtualizerScrollView.js +6 -0
  98. package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
  99. package/lib-commonjs/VirtualizerScrollViewDynamic.js +6 -0
  100. package/lib-commonjs/VirtualizerScrollViewDynamic.js.map +1 -0
  101. package/lib-commonjs/components/Virtualizer/Virtualizer.js +15 -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 +7 -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 +447 -361
  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 +21 -0
  114. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
  115. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +4 -0
  116. package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
  117. package/lib-commonjs/components/VirtualizerScrollView/index.js +10 -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 +91 -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 +21 -0
  126. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -0
  127. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +4 -0
  128. package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -0
  129. package/lib-commonjs/components/VirtualizerScrollViewDynamic/index.js +10 -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 +158 -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 +7 -0
  138. package/lib-commonjs/hooks/hooks.types.js.map +1 -0
  139. package/lib-commonjs/hooks/index.js +7 -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 +108 -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 +122 -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 +59 -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 +54 -0
  156. package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
  157. package/lib-commonjs/index.js +82 -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 +4 -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 +8 -0
  166. package/lib-commonjs/utilities/ImperativeScrolling/index.js.map +1 -0
  167. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js +54 -0
  168. package/lib-commonjs/utilities/VirtualizerContext/VirtualizerContext.js.map +1 -0
  169. package/lib-commonjs/utilities/VirtualizerContext/index.js +7 -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 +7 -0
  178. package/lib-commonjs/utilities/index.js.map +1 -0
  179. package/package.json +22 -13
  180. package/CHANGELOG.json +0 -125
  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
package/dist/index.d.ts CHANGED
@@ -2,14 +2,67 @@ import type { ComponentProps } from '@fluentui/react-utilities';
2
2
  import type { ComponentState } from '@fluentui/react-utilities';
3
3
  import type { Dispatch } from 'react';
4
4
  import type { FC } from 'react';
5
- import type { MutableRefObject } from 'react';
5
+ import { MutableRefObject } from 'react';
6
6
  import * as React_2 from 'react';
7
+ import type { RefObject } from 'react';
7
8
  import type { SetStateAction } from 'react';
8
9
  import type { Slot } from '@fluentui/react-utilities';
9
10
  import type { SlotClassNames } from '@fluentui/react-utilities';
10
11
 
11
12
  export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JSX.Element;
12
13
 
14
+ export declare const renderVirtualizerScrollView_unstable: (state: VirtualizerScrollViewState) => JSX.Element;
15
+
16
+ export declare const renderVirtualizerScrollViewDynamic_unstable: (state: VirtualizerScrollViewDynamicState) => JSX.Element;
17
+
18
+ /**
19
+ * Additional direct Ref prevents reading old resize entry data
20
+ * Backwards compatible with ResizeObserverCallback if preferred
21
+ */
22
+ export declare interface ResizeCallbackWithRef {
23
+ (entries: ResizeObserverEntry[], observer: ResizeObserver, scrollRef?: MutableRefObject<HTMLElement | null>): void;
24
+ }
25
+
26
+ export declare type ScrollToInterface = {
27
+ scrollTo: (index: number, behavior?: ScrollBehavior, callback?: (index: number) => void) => void;
28
+ virtualizerLength: RefObject<number>;
29
+ currentIndex: RefObject<number> | undefined;
30
+ };
31
+
32
+ export declare const scrollToItemDynamic: (params: ScrollToItemDynamicParams) => void;
33
+
34
+ export declare type ScrollToItemDynamicParams = {
35
+ index: number;
36
+ itemSizes: RefObject<number[]>;
37
+ totalSize: number;
38
+ scrollViewRef: RefObject<HTMLDivElement>;
39
+ axis?: 'horizontal' | 'vertical';
40
+ reversed?: boolean;
41
+ behavior?: ScrollBehavior;
42
+ };
43
+
44
+ export declare const scrollToItemStatic: (params: ScrollToItemStaticParams) => void;
45
+
46
+ export declare type ScrollToItemStaticParams = {
47
+ index: number;
48
+ itemSize: number;
49
+ totalItems: number;
50
+ scrollViewRef: RefObject<HTMLDivElement>;
51
+ axis?: 'horizontal' | 'vertical';
52
+ reversed?: boolean;
53
+ behavior?: ScrollBehavior;
54
+ };
55
+
56
+ /**
57
+ * React hook that measures virtualized space dynamically to ensure optimized virtualization length.
58
+ */
59
+ export declare const useDynamicVirtualizerMeasure: <TElement extends HTMLElement>(virtualizerProps: VirtualizerMeasureDynamicProps) => {
60
+ virtualizerLength: number;
61
+ bufferItems: number;
62
+ bufferSize: number;
63
+ scrollRef: (instance: TElement | null) => void;
64
+ };
65
+
13
66
  /**
14
67
  * React hook that allows easy usage of the browser API IntersectionObserver within React
15
68
  * @param callback - A function called when the percentage of the target element is visible crosses a threshold.
@@ -19,14 +72,45 @@ export declare const renderVirtualizer_unstable: (state: VirtualizerState) => JS
19
72
  * @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to
20
73
  * update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.
21
74
  */
22
- export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit | undefined) => {
75
+ export declare const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit) => {
23
76
  setObserverList: Dispatch<SetStateAction<Element[] | undefined>>;
24
- setObserverInit: Dispatch<SetStateAction<IntersectionObserverInit | undefined>>;
77
+ setObserverInit: (newInit: IntersectionObserverInit | undefined) => void;
25
78
  observer: MutableRefObject<IntersectionObserver | undefined>;
26
79
  };
27
80
 
81
+ /**
82
+ * useResizeObserverRef_unstable simplifies resize observer connection and ensures debounce/cleanup
83
+ */
84
+ export declare const useResizeObserverRef_unstable: (resizeCallback: ResizeCallbackWithRef) => (instance: HTMLElement | HTMLDivElement | null) => void;
85
+
86
+ /**
87
+ * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.
88
+ */
89
+ export declare const useStaticVirtualizerMeasure: <TElement extends HTMLElement>(virtualizerProps: VirtualizerMeasureProps) => {
90
+ virtualizerLength: number;
91
+ bufferItems: number;
92
+ bufferSize: number;
93
+ scrollRef: (instance: TElement | null) => void;
94
+ };
95
+
28
96
  export declare function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState;
29
97
 
98
+ export declare const useVirtualizerContext_unstable: () => VirtualizerContextProps;
99
+
100
+ export declare function useVirtualizerScrollView_unstable(props: VirtualizerScrollViewProps): VirtualizerScrollViewState;
101
+
102
+ export declare function useVirtualizerScrollViewDynamic_unstable(props: VirtualizerScrollViewDynamicProps): VirtualizerScrollViewDynamicState;
103
+
104
+ /**
105
+ * Apply styling to the Virtualizer states
106
+ */
107
+ export declare const useVirtualizerScrollViewDynamicStyles_unstable: (state: VirtualizerScrollViewDynamicState) => VirtualizerScrollViewDynamicState;
108
+
109
+ /**
110
+ * Apply styling to the Virtualizer states
111
+ */
112
+ export declare const useVirtualizerScrollViewStyles_unstable: (state: VirtualizerScrollViewState) => VirtualizerScrollViewState;
113
+
30
114
  /**
31
115
  * Apply styling to the Virtualizer states
32
116
  */
@@ -39,11 +123,11 @@ export declare const useVirtualizerStyles_unstable: (state: VirtualizerState) =>
39
123
  */
40
124
  export declare const Virtualizer: FC<VirtualizerProps>;
41
125
 
42
- export declare type VirtualizerChildRenderFunction = (index: number) => React_2.ReactNode;
126
+ export declare type VirtualizerChildRenderFunction = (index: number, isScrolling: boolean) => React_2.ReactNode;
43
127
 
44
128
  export declare const virtualizerClassNames: SlotClassNames<VirtualizerSlots>;
45
129
 
46
- export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & {
130
+ declare type VirtualizerConfigProps = {
47
131
  /**
48
132
  * Child render function.
49
133
  * Iteratively called to return current virtualizer DOM children.
@@ -87,9 +171,8 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
87
171
  bufferSize?: number;
88
172
  /**
89
173
  * Enables users to override the intersectionObserverRoot.
90
- * @default null
91
174
  */
92
- intersectionObserverRoot?: React_2.MutableRefObject<HTMLElement | null>;
175
+ scrollViewRef?: React_2.MutableRefObject<HTMLElement | null>;
93
176
  /**
94
177
  * The scroll direction
95
178
  * @default vertical
@@ -106,35 +189,21 @@ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>>
106
189
  */
107
190
  getItemSize?: (index: number) => number;
108
191
  /**
109
- * Notify users of index changes
110
- */
111
- onUpdateIndex?: (index: number, prevIndex: number) => void;
112
- /**
113
- * Allow users to intervene in index calculation changes
192
+ * Virtualizer context can be passed as a prop for extended class use
114
193
  */
115
- onCalculateIndex?: (newIndex: number) => number;
116
- };
117
-
118
- export declare type VirtualizerSlots = {
194
+ virtualizerContext?: VirtualizerContextProps;
119
195
  /**
120
- * The intersection observed 'before' element will detect when scrolling towards the beginning.
196
+ * Callback for notifying when a flagged index has been rendered
121
197
  */
122
- before: NonNullable<Slot<'div', 'td'>>;
198
+ onRenderedFlaggedIndex?: (index: number) => void;
199
+ flaggedIndex?: MutableRefObject<number | null>;
123
200
  /**
124
- * A block place holding whitespace at the beginning of current DOM children.
125
- */
126
- beforeContainer: NonNullable<Slot<'div', 'tr'>>;
127
- /**
128
- * The intersection observed 'after' element will detect when scrolling towards the end.
129
- */
130
- after: NonNullable<Slot<'div', 'td'>>;
131
- /**
132
- * A block place holding whitespace after the end of current DOM children.
201
+ * Imperative ref contains our scrollTo index functionality for user control.
133
202
  */
134
- afterContainer: NonNullable<Slot<'div', 'tr'>>;
203
+ imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;
135
204
  };
136
205
 
137
- export declare type VirtualizerState = ComponentState<VirtualizerSlots> & {
206
+ declare type VirtualizerConfigState = {
138
207
  /**
139
208
  * The current virtualized array of children to show in the DOM.
140
209
  */
@@ -165,9 +234,158 @@ export declare type VirtualizerState = ComponentState<VirtualizerSlots> & {
165
234
  */
166
235
  reversed?: boolean;
167
236
  /**
168
- * Tells the virtualizer how much
237
+ * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.
238
+ * Minimum 1px.
169
239
  */
170
240
  bufferSize: number;
241
+ /**
242
+ * Ref for access to internal size knowledge, can be used to measure updates
243
+ */
244
+ childSizes: React_2.MutableRefObject<number[]>;
245
+ /**
246
+ * Ref for access to internal progressive size knowledge, can be used to measure updates
247
+ */
248
+ childProgressiveSizes: React_2.MutableRefObject<number[]>;
249
+ };
250
+
251
+ /**
252
+ * {@docCategory Virtualizer}
253
+ */
254
+ export declare type VirtualizerContextProps = {
255
+ contextIndex: number;
256
+ setContextIndex: (index: number) => void;
257
+ };
258
+
259
+ export declare const VirtualizerContextProvider: React_2.Provider<VirtualizerContextProps>;
260
+
261
+ export declare type VirtualizerDataRef = {
262
+ progressiveSizes: RefObject<number[]>;
263
+ nodeSizes: RefObject<number[]>;
264
+ setFlaggedIndex: (index: number | null) => void;
265
+ currentIndex: RefObject<number>;
266
+ };
267
+
268
+ export declare type VirtualizerMeasureDynamicProps = {
269
+ defaultItemSize: number;
270
+ currentIndex: number;
271
+ numItems: number;
272
+ getItemSize: (index: number) => number;
273
+ direction?: 'vertical' | 'horizontal';
274
+ };
275
+
276
+ export declare type VirtualizerMeasureProps = {
277
+ defaultItemSize: number;
278
+ direction?: 'vertical' | 'horizontal';
279
+ };
280
+
281
+ export declare type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;
282
+
283
+ /**
284
+ * Virtualizer ScrollView
285
+ */
286
+ export declare const VirtualizerScrollView: React_2.FC<VirtualizerScrollViewProps>;
287
+
288
+ export declare const virtualizerScrollViewClassNames: SlotClassNames<VirtualizerScrollViewSlots>;
289
+
290
+ /**
291
+ * Virtualizer ScrollView
292
+ */
293
+ export declare const VirtualizerScrollViewDynamic: React_2.FC<VirtualizerScrollViewDynamicProps>;
294
+
295
+ export declare const virtualizerScrollViewDynamicClassNames: SlotClassNames<VirtualizerScrollViewDynamicSlots>;
296
+
297
+ export declare type VirtualizerScrollViewDynamicProps = ComponentProps<Partial<VirtualizerScrollViewDynamicSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex'>> & {
298
+ /**
299
+ * Set as the minimum item size.
300
+ * Axis: 'vertical' = Height
301
+ * Axis: 'horizontal' = Width
302
+ */
303
+ itemSize: number;
304
+ /**
305
+ * Callback for acquiring size of individual items
306
+ * @param index - the index of the requested size's child
307
+ * If undefined, Virtualizer will auto-measure by default (performance tradeoff)
308
+ */
309
+ getItemSize?: (index: number) => number;
310
+ /**
311
+ * The total number of items to be virtualized.
312
+ */
313
+ numItems: number;
314
+ /**
315
+ * Child render function.
316
+ * Iteratively called to return current virtualizer DOM children.
317
+ * Will act as a row or column indexer depending on Virtualizer settings.
318
+ */
319
+ children: VirtualizerChildRenderFunction;
320
+ /**
321
+ * Imperative ref contains our scrollTo index functionality for user control.
322
+ */
323
+ imperativeRef?: RefObject<ScrollToInterface>;
324
+ /**
325
+ * Imperative ref contains our scrollTo index functionality for user control.
326
+ */
327
+ enablePagination?: boolean;
171
328
  };
172
329
 
330
+ export declare type VirtualizerScrollViewDynamicSlots = VirtualizerScrollViewSlots;
331
+
332
+ export declare type VirtualizerScrollViewDynamicState = ComponentState<VirtualizerScrollViewDynamicSlots> & VirtualizerConfigState;
333
+
334
+ export declare type VirtualizerScrollViewProps = ComponentProps<Partial<VirtualizerScrollViewSlots>> & Partial<Omit<VirtualizerConfigProps, 'itemSize' | 'numItems' | 'getItemSize' | 'children' | 'flagIndex' | 'imperativeVirtualizerRef'>> & {
335
+ /**
336
+ * Virtualizer item size in pixels - static.
337
+ * Axis: 'vertical' = Height
338
+ * Axis: 'horizontal' = Width
339
+ */
340
+ itemSize: number;
341
+ /**
342
+ * The total number of items to be virtualized.
343
+ */
344
+ numItems: number;
345
+ /**
346
+ * Child render function.
347
+ * Iteratively called to return current virtualizer DOM children.
348
+ * Will act as a row or column indexer depending on Virtualizer settings.
349
+ */
350
+ children: VirtualizerChildRenderFunction;
351
+ /**
352
+ * Imperative ref contains our scrollTo index functionality for user control.
353
+ */
354
+ imperativeRef?: RefObject<ScrollToInterface>;
355
+ /**
356
+ * Imperative ref contains our scrollTo index functionality for user control.
357
+ */
358
+ enablePagination?: boolean;
359
+ };
360
+
361
+ export declare type VirtualizerScrollViewSlots = VirtualizerSlots & {
362
+ /**
363
+ * The root container that provides embedded scrolling.
364
+ */
365
+ container: NonNullable<Slot<'div'>>;
366
+ };
367
+
368
+ export declare type VirtualizerScrollViewState = ComponentState<VirtualizerScrollViewSlots> & VirtualizerConfigState;
369
+
370
+ export declare type VirtualizerSlots = {
371
+ /**
372
+ * The intersection observed 'before' element will detect when scrolling towards the beginning.
373
+ */
374
+ before: NonNullable<Slot<'div', 'td'>>;
375
+ /**
376
+ * A block place holding whitespace at the beginning of current DOM children.
377
+ */
378
+ beforeContainer: NonNullable<Slot<'div', 'tr'>>;
379
+ /**
380
+ * The intersection observed 'after' element will detect when scrolling towards the end.
381
+ */
382
+ after: NonNullable<Slot<'div', 'td'>>;
383
+ /**
384
+ * A block place holding whitespace after the end of current DOM children.
385
+ */
386
+ afterContainer: NonNullable<Slot<'div', 'tr'>>;
387
+ };
388
+
389
+ export declare type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;
390
+
173
391
  export { }
package/lib/Hooks.js CHANGED
@@ -1,2 +1 @@
1
1
  export * from './hooks/index';
2
- //# sourceMappingURL=Hooks.js.map
package/lib/Hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Hooks.js","sourceRoot":"../src/","sources":["packages/react-components/react-virtualizer/src/Hooks.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC","sourcesContent":["export * from './hooks/index';\n"]}
1
+ {"version":3,"sources":["Hooks.ts"],"sourcesContent":["export * from './hooks/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,gBAAgB"}
@@ -0,0 +1 @@
1
+ export * from './utilities/index';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Utilities.ts"],"sourcesContent":["export * from './utilities/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oBAAoB"}
@@ -1,2 +1 @@
1
1
  export * from './components/Virtualizer/index';
2
- //# sourceMappingURL=Virtualizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Virtualizer.js","sourceRoot":"../src/","sources":["packages/react-components/react-virtualizer/src/Virtualizer.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './components/Virtualizer/index';\n"]}
1
+ {"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["export * from './components/Virtualizer/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,iCAAiC"}
@@ -0,0 +1 @@
1
+ export * from './components/VirtualizerScrollView/index';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["VirtualizerScrollView.ts"],"sourcesContent":["export * from './components/VirtualizerScrollView/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,2CAA2C"}
@@ -0,0 +1 @@
1
+ export * from './components/VirtualizerScrollViewDynamic/index';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["VirtualizerScrollViewDynamic.ts"],"sourcesContent":["export * from './components/VirtualizerScrollViewDynamic/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,kDAAkD"}
@@ -1,15 +1,13 @@
1
- import { useVirtualizerStyles_unstable } from './useVirtualizerStyles';
1
+ import { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';
2
2
  import { useVirtualizer_unstable } from './useVirtualizer';
3
3
  import { renderVirtualizer_unstable } from './renderVirtualizer';
4
4
  /**
5
5
  * Virtualizer pseudo-component, this functional wrapper
6
6
  * provides a simple interface for reducing the total number
7
7
  * of elements rendered at one time in large lists.
8
- */
9
- export const Virtualizer = props => {
10
- const state = useVirtualizer_unstable(props);
11
- useVirtualizerStyles_unstable(state);
12
- return renderVirtualizer_unstable(state);
8
+ */ export const Virtualizer = (props)=>{
9
+ const state = useVirtualizer_unstable(props);
10
+ useVirtualizerStyles_unstable(state);
11
+ return renderVirtualizer_unstable(state);
13
12
  };
14
13
  Virtualizer.displayName = 'Virtualizer';
15
- //# sourceMappingURL=Virtualizer.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":"AACA,SAASA,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,uBAAuB,QAAQ,kBAAkB;AAC1D,SAASC,0BAA0B,QAAQ,qBAAqB;AAGhE;;;;;AAKA,OAAO,MAAMC,WAAW,GAA0BC,KAAuB,IAAI;EAC3E,MAAMC,KAAK,GAAGJ,uBAAuB,CAACG,KAAK,CAAC;EAC5CJ,6BAA6B,CAACK,KAAK,CAAC;EAEpC,OAAOH,0BAA0B,CAACG,KAAK,CAAC;AAC1C,CAAC;AAEDF,WAAW,CAACG,WAAW,GAAG,aAAa","names":["useVirtualizerStyles_unstable","useVirtualizer_unstable","renderVirtualizer_unstable","Virtualizer","props","state","displayName"],"sourceRoot":"../src/","sources":["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"]}
1
+ {"version":3,"sources":["Virtualizer.ts"],"sourcesContent":["import type { VirtualizerProps } from './Virtualizer.types';\nimport { useVirtualizerStyles_unstable } from './useVirtualizerStyles.styles';\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"],"names":["useVirtualizerStyles_unstable","useVirtualizer_unstable","renderVirtualizer_unstable","Virtualizer","props","state","displayName"],"rangeMappings":";;;;;;;;;;;;","mappings":"AACA,SAASA,6BAA6B,QAAQ,gCAAgC;AAC9E,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,sBAAsB;AAGjE;;;;CAIC,GACD,OAAO,MAAMC,cAAoC,CAACC;IAChD,MAAMC,QAAQJ,wBAAwBG;IACtCJ,8BAA8BK;IAE9B,OAAOH,2BAA2BG;AACpC,EAAE;AAEFF,YAAYG,WAAW,GAAG"}
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=Virtualizer.types.js.map
1
+ import * as React from 'react';
@@ -1 +1 @@
1
- {"version":3,"file":"Virtualizer.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-virtualizer/src/components/Virtualizer/Virtualizer.types.ts"],"names":[],"mappings":"","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"]}
1
+ {"version":3,"sources":["Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { VirtualizerContextProps } from '../../Utilities';\nimport type { RefObject, MutableRefObject } from 'react';\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 VirtualizerConfigState = {\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 * Pixel size of intersection observers and how much they 'cross over' into the bufferItems index.\n * Minimum 1px.\n */\n bufferSize: number;\n /**\n * Ref for access to internal size knowledge, can be used to measure updates\n */\n childSizes: React.MutableRefObject<number[]>;\n /**\n * Ref for access to internal progressive size knowledge, can be used to measure updates\n */\n childProgressiveSizes: React.MutableRefObject<number[]>;\n};\n\nexport type VirtualizerState = ComponentState<VirtualizerSlots> & VirtualizerConfigState;\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, isScrolling: boolean) => React.ReactNode;\n\nexport type VirtualizerDataRef = {\n progressiveSizes: RefObject<number[]>;\n nodeSizes: RefObject<number[]>;\n setFlaggedIndex: (index: number | null) => void;\n currentIndex: RefObject<number>;\n};\n\nexport type VirtualizerConfigProps = {\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 */\n scrollViewRef?: 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 * Virtualizer context can be passed as a prop for extended class use\n */\n virtualizerContext?: VirtualizerContextProps;\n\n /**\n * Callback for notifying when a flagged index has been rendered\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onRenderedFlaggedIndex?: (index: number) => void;\n\n /*\n * Callback for notifying when a flagged index has been rendered\n */\n flaggedIndex?: MutableRefObject<number | null>;\n\n /**\n * Imperative ref contains our scrollTo index functionality for user control.\n */\n imperativeVirtualizerRef?: RefObject<VirtualizerDataRef>;\n};\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & VirtualizerConfigProps;\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -2,5 +2,4 @@ export * from './Virtualizer';
2
2
  export * from './Virtualizer.types';
3
3
  export * from './useVirtualizer';
4
4
  export * from './renderVirtualizer';
5
- export * from './useVirtualizerStyles';
6
- //# sourceMappingURL=index.js.map
5
+ export * from './useVirtualizerStyles.styles';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-virtualizer/src/components/Virtualizer/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles';\n"]}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,gCAAgC"}
@@ -1,18 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
1
2
  import * as React from 'react';
2
- import { getSlots } from '@fluentui/react-utilities';
3
- export const renderVirtualizer_unstable = state => {
4
- const {
5
- slots,
6
- slotProps
7
- } = getSlots(state);
8
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(slots.beforeContainer, {
9
- ...slotProps.beforeContainer
10
- }, /*#__PURE__*/React.createElement(slots.before, {
11
- ...slotProps.before
12
- })), state.virtualizedChildren, /*#__PURE__*/React.createElement(slots.afterContainer, {
13
- ...slotProps.afterContainer
14
- }, /*#__PURE__*/React.createElement(slots.after, {
15
- ...slotProps.after
16
- })));
3
+ import { assertSlots } from '@fluentui/react-utilities';
4
+ export const renderVirtualizer_unstable = (state)=>{
5
+ assertSlots(state);
6
+ return /*#__PURE__*/ _jsxs(React.Fragment, {
7
+ children: [
8
+ /*#__PURE__*/ _jsx(state.beforeContainer, {
9
+ children: /*#__PURE__*/ _jsx(state.before, {})
10
+ }),
11
+ state.virtualizedChildren,
12
+ /*#__PURE__*/ _jsx(state.afterContainer, {
13
+ children: /*#__PURE__*/ _jsx(state.after, {})
14
+ })
15
+ ]
16
+ });
17
+ };
18
+ export const renderVirtualizerChildPlaceholder = (child, index)=>{
19
+ return /*#__PURE__*/ _jsx(React.Suspense, {
20
+ fallback: null,
21
+ children: child
22
+ }, `fui-virtualizer-placeholder-${index}`);
17
23
  };
18
- //# sourceMappingURL=renderVirtualizer.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAGpD,OAAO,MAAMC,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,QAAQ,CAAmBE,KAAK,CAAC;EAE9D,oBACEH,oBAACA,KAAK,CAACM,QAAQ,qBAEbN,oBAACI,KAAK,CAACG,eAAe;IAAA,GAAKF,SAAS,CAACE;EAAe,gBAClDP,oBAACI,KAAK,CAACI,MAAM;IAAA,GAAKH,SAAS,CAACG;EAAM,EAAI,CAChB,EAEvBL,KAAK,CAACM,mBAAmB,eAE1BT,oBAACI,KAAK,CAACM,cAAc;IAAA,GAAKL,SAAS,CAACK;EAAc,gBAChDV,oBAACI,KAAK,CAACO,KAAK;IAAA,GAAKN,SAAS,CAACM;EAAK,EAAI,CACf,CACR;AAErB,CAAC","names":["React","getSlots","renderVirtualizer_unstable","state","slots","slotProps","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after"],"sourceRoot":"../src/","sources":["packages/react-components/react-virtualizer/src/components/Virtualizer/renderVirtualizer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n const { slots, slotProps } = getSlots<VirtualizerSlots>(state);\n\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <slots.beforeContainer {...slotProps.beforeContainer}>\n <slots.before {...slotProps.before} />\n </slots.beforeContainer>\n {/* The reduced list of non-virtualized children to be rendered */}\n {state.virtualizedChildren}\n {/* The 'after' bookend to hold items in place and detect scroll next */}\n <slots.afterContainer {...slotProps.afterContainer}>\n <slots.after {...slotProps.after} />\n </slots.afterContainer>\n </React.Fragment>\n );\n};\n"]}
1
+ {"version":3,"sources":["renderVirtualizer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport type { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\nimport type { ReactNode } from 'react';\n\nimport { assertSlots } from '@fluentui/react-utilities';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n assertSlots<VirtualizerSlots>(state);\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <state.beforeContainer>\n <state.before />\n </state.beforeContainer>\n {/* The reduced list of non-virtualized children to be rendered */}\n {state.virtualizedChildren}\n {/* The 'after' bookend to hold items in place and detect scroll next */}\n <state.afterContainer>\n <state.after />\n </state.afterContainer>\n </React.Fragment>\n );\n};\n\nexport const renderVirtualizerChildPlaceholder = (child: ReactNode, index: number) => {\n return (\n <React.Suspense key={`fui-virtualizer-placeholder-${index}`} fallback={null}>\n {child}\n </React.Suspense>\n );\n};\n"],"names":["React","assertSlots","renderVirtualizer_unstable","state","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","renderVirtualizerChildPlaceholder","child","index","Suspense","fallback"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAI/B,SAASC,WAAW,QAAQ,4BAA4B;AAExD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAC9B,qBACE,MAACH,MAAMI,QAAQ;;0BAEb,KAACD,MAAME,eAAe;0BACpB,cAAA,KAACF,MAAMG,MAAM;;YAGdH,MAAMI,mBAAmB;0BAE1B,KAACJ,MAAMK,cAAc;0BACnB,cAAA,KAACL,MAAMM,KAAK;;;;AAIpB,EAAE;AAEF,OAAO,MAAMC,oCAAoC,CAACC,OAAkBC;IAClE,qBACE,KAACZ,MAAMa,QAAQ;QAA8CC,UAAU;kBACpEH;OADkB,CAAC,4BAA4B,EAAEC,MAAM,CAAC;AAI/D,EAAE"}