@ringcentral/juno 2.4.0 → 2.5.0-beta.0

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 (121) hide show
  1. package/components/Downshift/SuggestionList/SuggestionList.d.ts +74 -2
  2. package/components/Downshift/SuggestionList/SuggestionList.js +4 -1
  3. package/components/Grid/Grid.d.ts +1 -1
  4. package/components/Pagination/Pagination/Pagination.d.ts +1 -1
  5. package/components/Stepper/StepButton/StepButton.d.ts +1 -1
  6. package/components/Stepper/StepLabel/StepLabel.d.ts +1 -1
  7. package/components/Table/TableCell/styles/TableCellStyle.js +3 -1
  8. package/components/Table/types.d.ts +1 -1
  9. package/components/TablePagination/TablePagination.d.ts +1 -1
  10. package/components/VirtualizedMenu/VirtualizedMenu.js +11 -0
  11. package/components/VirtualizedMenu/VirtualizedMenuList.js +7 -14
  12. package/components/Virtuoso/react-virtuoso/AATree.js +15 -15
  13. package/components/Virtuoso/react-virtuoso/Grid.d.ts +193 -106
  14. package/components/Virtuoso/react-virtuoso/Grid.js +19 -24
  15. package/components/Virtuoso/react-virtuoso/List.d.ts +2664 -596
  16. package/components/Virtuoso/react-virtuoso/List.js +83 -70
  17. package/components/Virtuoso/react-virtuoso/Table.d.ts +6253 -0
  18. package/components/Virtuoso/react-virtuoso/Table.js +184 -0
  19. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +153 -37
  20. package/components/Virtuoso/react-virtuoso/components.d.ts +248 -41
  21. package/components/Virtuoso/react-virtuoso/components.js +2 -0
  22. package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +2 -4
  23. package/components/Virtuoso/react-virtuoso/domIOSystem.js +12 -10
  24. package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +146 -27
  25. package/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
  26. package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +67 -52
  27. package/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
  28. package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +17 -3
  29. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +2 -1
  30. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +32 -7
  31. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +1 -1
  32. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
  33. package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -2
  34. package/components/Virtuoso/react-virtuoso/hooks/useSize.js +26 -28
  35. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.d.ts +1 -1
  36. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
  37. package/components/Virtuoso/react-virtuoso/index.d.ts +1 -0
  38. package/components/Virtuoso/react-virtuoso/index.js +2 -0
  39. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +165 -35
  40. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
  41. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +160 -38
  42. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +54 -12
  43. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +26 -10
  44. package/components/Virtuoso/react-virtuoso/interfaces.d.ts +134 -28
  45. package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +141 -32
  46. package/components/Virtuoso/react-virtuoso/listStateSystem.js +1 -2
  47. package/components/Virtuoso/react-virtuoso/listSystem.d.ts +2123 -407
  48. package/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
  49. package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +17 -0
  50. package/components/Virtuoso/react-virtuoso/loggerSystem.js +37 -0
  51. package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +8 -1
  52. package/components/Virtuoso/react-virtuoso/propsReadySystem.js +8 -2
  53. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +641 -0
  54. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +42 -0
  55. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +52 -67
  56. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
  57. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +26 -5
  58. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
  59. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +11 -4
  60. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +44 -15
  61. package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +12 -2
  62. package/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
  63. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +17 -5
  64. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
  65. package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +145 -33
  66. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +149 -35
  67. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +183 -42
  68. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +37 -26
  69. package/components/Virtuoso/react-virtuoso/utils/correctItemSize.d.ts +1 -0
  70. package/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +6 -0
  71. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +7 -4
  72. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
  73. package/components/Virtuoso/utils/useHighlightScroll.d.ts +4 -0
  74. package/components/Virtuoso/utils/useHighlightScroll.js +17 -0
  75. package/es6/components/Downshift/SuggestionList/SuggestionList.js +5 -2
  76. package/es6/components/Table/TableCell/TableCell.js +2 -2
  77. package/es6/components/Table/TableCell/styles/TableCellStyle.js +3 -1
  78. package/es6/components/VirtualizedMenu/VirtualizedMenu.js +13 -2
  79. package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -16
  80. package/es6/components/Virtuoso/react-virtuoso/AATree.js +15 -15
  81. package/es6/components/Virtuoso/react-virtuoso/Grid.js +20 -25
  82. package/es6/components/Virtuoso/react-virtuoso/List.js +84 -72
  83. package/es6/components/Virtuoso/react-virtuoso/Table.js +182 -0
  84. package/es6/components/Virtuoso/react-virtuoso/components.js +2 -0
  85. package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +13 -10
  86. package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
  87. package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
  88. package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +31 -6
  89. package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
  90. package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +27 -29
  91. package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
  92. package/es6/components/Virtuoso/react-virtuoso/index.js +1 -0
  93. package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
  94. package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +25 -10
  95. package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +2 -3
  96. package/es6/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
  97. package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +34 -0
  98. package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +9 -2
  99. package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +40 -0
  100. package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
  101. package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
  102. package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +39 -11
  103. package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
  104. package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
  105. package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +39 -28
  106. package/es6/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +3 -0
  107. package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
  108. package/es6/components/Virtuoso/utils/useHighlightScroll.js +16 -0
  109. package/es6/foundation/index.js +1 -1
  110. package/es6/foundation/isWebKit154.js +57 -0
  111. package/es6/foundation/theme/ThemeProvider.js +4 -4
  112. package/foundation/index.d.ts +1 -1
  113. package/foundation/index.js +1 -1
  114. package/foundation/isWebKit154.d.ts +20 -0
  115. package/foundation/isWebKit154.js +59 -0
  116. package/foundation/theme/ThemeProvider.d.ts +6 -0
  117. package/foundation/theme/ThemeProvider.js +4 -4
  118. package/package.json +2 -2
  119. package/es6/foundation/isSafari154.js +0 -50
  120. package/foundation/isSafari154.d.ts +0 -15
  121. package/foundation/isSafari154.js +0 -52
@@ -1,5 +1,13 @@
1
1
  import * as u from '@virtuoso.dev/urx';
2
- export declare const initialTopMostItemIndexSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
2
+ import { IndexLocation } from './scrollToIndexSystem';
3
+ export declare function getInitialTopMostItemIndexNumber(location: IndexLocation, totalCount: number): number;
4
+ export declare const initialTopMostItemIndexSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<never[], () => {
5
+ log: u.StatefulStream<import("./loggerSystem").Log>;
6
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
7
+ }>], ([{ log }]: [{
8
+ log: u.StatefulStream<import("./loggerSystem").Log>;
9
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
10
+ }]) => {
3
11
  data: u.StatefulStream<import("./sizeSystem").Data>;
4
12
  totalCount: u.Stream<number>;
5
13
  sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
@@ -7,25 +15,35 @@ export declare const initialTopMostItemIndexSystem: u.SystemSpec<[u.SystemSpec<n
7
15
  defaultItemSize: u.StatefulStream<number | undefined>;
8
16
  fixedItemSize: u.StatefulStream<number | undefined>;
9
17
  unshiftWith: u.Stream<number>;
18
+ shiftWith: u.Stream<number>;
19
+ shiftWithOffset: u.Stream<number>;
10
20
  beforeUnshiftWith: u.Stream<number>;
11
21
  firstItemIndex: u.StatefulStream<number>;
12
22
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
13
23
  listRefresh: u.Stream<boolean>;
24
+ statefulTotalCount: u.StatefulStream<number>;
14
25
  trackItemSizes: u.StatefulStream<boolean>;
15
26
  itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
16
27
  }>, u.SystemSpec<never[], () => {
28
+ scrollContainerState: u.Stream<[number, number]>;
17
29
  scrollTop: u.Stream<number>;
18
30
  viewportHeight: u.Stream<number>;
19
31
  headerHeight: u.StatefulStream<number>;
20
32
  footerHeight: u.StatefulStream<number>;
33
+ scrollHeight: u.Stream<number>;
21
34
  smoothScrollTargetReached: u.Stream<true>;
22
35
  scrollTo: u.Stream<ScrollToOptions>;
23
36
  scrollBy: u.Stream<ScrollToOptions>;
24
- scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
25
37
  statefulScrollTop: u.StatefulStream<number>;
26
38
  deviation: u.StatefulStream<number>;
27
39
  scrollingInProgress: u.StatefulStream<boolean>;
28
- }>, u.SystemSpec<[u.SystemSpec<never[], () => {
40
+ }>, u.SystemSpec<[u.SystemSpec<[u.SystemSpec<never[], () => {
41
+ log: u.StatefulStream<import("./loggerSystem").Log>;
42
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
43
+ }>], ([{ log }]: [{
44
+ log: u.StatefulStream<import("./loggerSystem").Log>;
45
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
46
+ }]) => {
29
47
  data: u.StatefulStream<import("./sizeSystem").Data>;
30
48
  totalCount: u.Stream<number>;
31
49
  sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
@@ -33,25 +51,32 @@ export declare const initialTopMostItemIndexSystem: u.SystemSpec<[u.SystemSpec<n
33
51
  defaultItemSize: u.StatefulStream<number | undefined>;
34
52
  fixedItemSize: u.StatefulStream<number | undefined>;
35
53
  unshiftWith: u.Stream<number>;
54
+ shiftWith: u.Stream<number>;
55
+ shiftWithOffset: u.Stream<number>;
36
56
  beforeUnshiftWith: u.Stream<number>;
37
57
  firstItemIndex: u.StatefulStream<number>;
38
58
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
39
59
  listRefresh: u.Stream<boolean>;
60
+ statefulTotalCount: u.StatefulStream<number>;
40
61
  trackItemSizes: u.StatefulStream<boolean>;
41
62
  itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
42
63
  }>, u.SystemSpec<never[], () => {
64
+ scrollContainerState: u.Stream<[number, number]>;
43
65
  scrollTop: u.Stream<number>;
44
66
  viewportHeight: u.Stream<number>;
45
67
  headerHeight: u.StatefulStream<number>;
46
68
  footerHeight: u.StatefulStream<number>;
69
+ scrollHeight: u.Stream<number>;
47
70
  smoothScrollTargetReached: u.Stream<true>;
48
71
  scrollTo: u.Stream<ScrollToOptions>;
49
72
  scrollBy: u.Stream<ScrollToOptions>;
50
- scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
51
73
  statefulScrollTop: u.StatefulStream<number>;
52
74
  deviation: u.StatefulStream<number>;
53
75
  scrollingInProgress: u.StatefulStream<boolean>;
54
- }>], ([{ sizes, totalCount, listRefresh }, { scrollingInProgress, viewportHeight, scrollTo, smoothScrollTargetReached, headerHeight, footerHeight, },]: [{
76
+ }>, u.SystemSpec<never[], () => {
77
+ log: u.StatefulStream<import("./loggerSystem").Log>;
78
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
79
+ }>], ([{ sizes, totalCount, listRefresh }, { scrollingInProgress, viewportHeight, scrollTo, smoothScrollTargetReached, headerHeight, footerHeight, }, { log },]: [{
55
80
  data: u.StatefulStream<import("./sizeSystem").Data>;
56
81
  totalCount: u.Stream<number>;
57
82
  sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
@@ -59,31 +84,44 @@ export declare const initialTopMostItemIndexSystem: u.SystemSpec<[u.SystemSpec<n
59
84
  defaultItemSize: u.StatefulStream<number | undefined>;
60
85
  fixedItemSize: u.StatefulStream<number | undefined>;
61
86
  unshiftWith: u.Stream<number>;
87
+ shiftWith: u.Stream<number>;
88
+ shiftWithOffset: u.Stream<number>;
62
89
  beforeUnshiftWith: u.Stream<number>;
63
90
  firstItemIndex: u.StatefulStream<number>;
64
91
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
65
92
  listRefresh: u.Stream<boolean>;
93
+ statefulTotalCount: u.StatefulStream<number>;
66
94
  trackItemSizes: u.StatefulStream<boolean>;
67
95
  itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
68
96
  }, {
97
+ scrollContainerState: u.Stream<[number, number]>;
69
98
  scrollTop: u.Stream<number>;
70
99
  viewportHeight: u.Stream<number>;
71
100
  headerHeight: u.StatefulStream<number>;
72
101
  footerHeight: u.StatefulStream<number>;
102
+ scrollHeight: u.Stream<number>;
73
103
  smoothScrollTargetReached: u.Stream<true>;
74
104
  scrollTo: u.Stream<ScrollToOptions>;
75
105
  scrollBy: u.Stream<ScrollToOptions>;
76
- scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
77
106
  statefulScrollTop: u.StatefulStream<number>;
78
107
  deviation: u.StatefulStream<number>;
79
108
  scrollingInProgress: u.StatefulStream<boolean>;
109
+ }, {
110
+ log: u.StatefulStream<import("./loggerSystem").Log>;
111
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
80
112
  }]) => {
81
- scrollToIndex: u.Stream<import("./scrollToIndexSystem").IndexLocation>;
113
+ scrollToIndex: u.Stream<number | import("./interfaces").IndexLocationWithAlign>;
82
114
  topListHeight: u.StatefulStream<number>;
83
- }>, u.SystemSpec<never[], () => {
115
+ }>, u.SystemSpec<[u.SystemSpec<never[], () => {
116
+ log: u.StatefulStream<import("./loggerSystem").Log>;
117
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
118
+ }>], ([{ log }]: [{
119
+ log: u.StatefulStream<import("./loggerSystem").Log>;
120
+ logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
121
+ }]) => {
84
122
  propsReady: u.StatefulStream<boolean>;
85
123
  didMount: u.Stream<boolean>;
86
- }>], ([{ sizes, listRefresh }, { scrollTop }, { scrollToIndex }, { didMount },]: [{
124
+ }>], ([{ sizes, listRefresh, defaultItemSize }, { scrollTop }, { scrollToIndex }, { didMount },]: [{
87
125
  data: u.StatefulStream<import("./sizeSystem").Data>;
88
126
  totalCount: u.Stream<number>;
89
127
  sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
@@ -91,31 +129,35 @@ export declare const initialTopMostItemIndexSystem: u.SystemSpec<[u.SystemSpec<n
91
129
  defaultItemSize: u.StatefulStream<number | undefined>;
92
130
  fixedItemSize: u.StatefulStream<number | undefined>;
93
131
  unshiftWith: u.Stream<number>;
132
+ shiftWith: u.Stream<number>;
133
+ shiftWithOffset: u.Stream<number>;
94
134
  beforeUnshiftWith: u.Stream<number>;
95
135
  firstItemIndex: u.StatefulStream<number>;
96
136
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
97
137
  listRefresh: u.Stream<boolean>;
138
+ statefulTotalCount: u.StatefulStream<number>;
98
139
  trackItemSizes: u.StatefulStream<boolean>;
99
140
  itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
100
141
  }, {
142
+ scrollContainerState: u.Stream<[number, number]>;
101
143
  scrollTop: u.Stream<number>;
102
144
  viewportHeight: u.Stream<number>;
103
145
  headerHeight: u.StatefulStream<number>;
104
146
  footerHeight: u.StatefulStream<number>;
147
+ scrollHeight: u.Stream<number>;
105
148
  smoothScrollTargetReached: u.Stream<true>;
106
149
  scrollTo: u.Stream<ScrollToOptions>;
107
150
  scrollBy: u.Stream<ScrollToOptions>;
108
- scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
109
151
  statefulScrollTop: u.StatefulStream<number>;
110
152
  deviation: u.StatefulStream<number>;
111
153
  scrollingInProgress: u.StatefulStream<boolean>;
112
154
  }, {
113
- scrollToIndex: u.Stream<import("./scrollToIndexSystem").IndexLocation>;
155
+ scrollToIndex: u.Stream<number | import("./interfaces").IndexLocationWithAlign>;
114
156
  topListHeight: u.StatefulStream<number>;
115
157
  }, {
116
158
  propsReady: u.StatefulStream<boolean>;
117
159
  didMount: u.Stream<boolean>;
118
160
  }]) => {
119
161
  scrolledToInitialItem: u.StatefulStream<boolean>;
120
- initialTopMostItemIndex: u.StatefulStream<number>;
162
+ initialTopMostItemIndex: u.StatefulStream<number | import("./interfaces").IndexLocationWithAlign>;
121
163
  }>;
@@ -7,23 +7,39 @@ var domIOSystem_1 = require("./domIOSystem");
7
7
  var propsReadySystem_1 = require("./propsReadySystem");
8
8
  var scrollToIndexSystem_1 = require("./scrollToIndexSystem");
9
9
  var sizeSystem_1 = require("./sizeSystem");
10
+ function getInitialTopMostItemIndexNumber(location, totalCount) {
11
+ var lastIndex = totalCount - 1;
12
+ var index = typeof location === 'number'
13
+ ? location
14
+ : location.index === 'LAST'
15
+ ? lastIndex
16
+ : location.index;
17
+ return index;
18
+ }
19
+ exports.getInitialTopMostItemIndexNumber = getInitialTopMostItemIndexNumber;
10
20
  exports.initialTopMostItemIndexSystem = u.system(function (_a) {
11
- var _b = tslib_1.__read(_a, 4), _c = _b[0], sizes = _c.sizes, listRefresh = _c.listRefresh, scrollTop = _b[1].scrollTop, scrollToIndex = _b[2].scrollToIndex, didMount = _b[3].didMount;
21
+ var _b = tslib_1.__read(_a, 4), _c = _b[0], sizes = _c.sizes, listRefresh = _c.listRefresh, defaultItemSize = _c.defaultItemSize, scrollTop = _b[1].scrollTop, scrollToIndex = _b[2].scrollToIndex, didMount = _b[3].didMount;
12
22
  var scrolledToInitialItem = u.statefulStream(true);
13
23
  var initialTopMostItemIndex = u.statefulStream(0);
14
- u.connect(u.pipe(didMount, u.withLatestFrom(initialTopMostItemIndex), u.filter(function (_a) {
15
- var _b = tslib_1.__read(_a, 2), index = _b[1];
16
- return index !== 0;
24
+ u.connect(u.pipe(didMount, u.withLatestFrom(initialTopMostItemIndex),
25
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
26
+ u.filter(function (_a) {
27
+ var _b = tslib_1.__read(_a, 2), location = _b[1];
28
+ return !!location;
17
29
  }), u.mapTo(false)), scrolledToInitialItem);
18
- u.subscribe(u.pipe(listRefresh, u.withLatestFrom(scrolledToInitialItem, sizes), u.filter(function (_a) {
19
- var _b = tslib_1.__read(_a, 3), scrolledToInitialItem = _b[1], sizeTree = _b[2].sizeTree;
20
- return !AATree_1.empty(sizeTree) && !scrolledToInitialItem;
30
+ u.subscribe(u.pipe(u.combineLatest(listRefresh, didMount), u.withLatestFrom(scrolledToInitialItem, sizes, defaultItemSize), u.filter(function (_a) {
31
+ var _b = tslib_1.__read(_a, 4), _c = tslib_1.__read(_b[0], 2), didMount = _c[1], scrolledToInitialItem = _b[1], sizeTree = _b[2].sizeTree, defaultItemSize = _b[3];
32
+ return (didMount &&
33
+ (!AATree_1.empty(sizeTree) || defaultItemSize !== undefined) &&
34
+ !scrolledToInitialItem);
21
35
  }), u.withLatestFrom(initialTopMostItemIndex)), function (_a) {
22
36
  var _b = tslib_1.__read(_a, 2), initialTopMostItemIndex = _b[1];
23
- u.handleNext(scrollTop, function () {
24
- u.publish(scrolledToInitialItem, true);
37
+ setTimeout(function () {
38
+ u.handleNext(scrollTop, function () {
39
+ u.publish(scrolledToInitialItem, true);
40
+ });
41
+ u.publish(scrollToIndex, initialTopMostItemIndex);
25
42
  });
26
- u.publish(scrollToIndex, initialTopMostItemIndex);
27
43
  });
28
44
  return {
29
45
  scrolledToInitialItem: scrolledToInitialItem,
@@ -1,13 +1,14 @@
1
- import { ComponentPropsWithRef, ComponentType, CSSProperties, Key, ReactNode } from 'react';
1
+ import { ComponentPropsWithRef, ComponentType, Key, ReactNode } from 'react';
2
2
  export interface ListRange {
3
3
  startIndex: number;
4
4
  endIndex: number;
5
5
  }
6
- export interface ItemContent<D> {
7
- (index: number, data: D): ReactNode;
6
+ export interface ItemContent<D, C> {
7
+ (index: number, data: D, context: C): ReactNode;
8
8
  }
9
- export interface GroupItemContent<D> {
10
- (index: number, groupIndex: number, data: D): ReactNode;
9
+ export declare type FixedHeaderContent = (() => React.ReactChildren | React.ReactNode) | null;
10
+ export interface GroupItemContent<D, C> {
11
+ (index: number, groupIndex: number, data: D, context: C): ReactNode;
11
12
  }
12
13
  export interface GroupContent {
13
14
  (index: number): ReactNode;
@@ -24,10 +25,19 @@ export interface GroupProps {
24
25
  'data-known-size': number;
25
26
  }
26
27
  export declare type TopItemListProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children'>;
28
+ export declare type TableProps = Pick<ComponentPropsWithRef<'table'>, 'style'>;
29
+ /**
30
+ * Passed to the Components.TableBody custom component
31
+ */
32
+ export declare type TableBodyProps = Pick<ComponentPropsWithRef<'tbody'>, 'style' | 'children' | 'ref' | 'className'> & {
33
+ 'data-test-id': string;
34
+ };
27
35
  /**
28
36
  * Passed to the Components.List custom component
29
37
  */
30
- export declare type ListProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref'>;
38
+ export declare type ListProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref'> & {
39
+ 'data-test-id': string;
40
+ };
31
41
  /**
32
42
  * Passed to the Components.List custom component
33
43
  */
@@ -35,61 +45,142 @@ export declare type GridListProps = Pick<ComponentPropsWithRef<'div'>, 'style' |
35
45
  /**
36
46
  * Passed to the Components.Scroller custom component
37
47
  */
38
- export declare type ScrollerProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children' | 'tabIndex' | 'ref'>;
48
+ export declare type ScrollerProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'children' | 'tabIndex' | 'ref'> & {
49
+ 'data-test-id'?: string;
50
+ 'data-virtuoso-scroller'?: boolean;
51
+ };
39
52
  /**
40
53
  * Passed to the Components.ScrollSeekPlaceholder custom component
41
54
  */
42
55
  export interface ScrollSeekPlaceholderProps {
43
56
  index: number;
44
57
  height: number;
58
+ groupIndex?: number;
59
+ type: 'group' | 'item';
60
+ }
61
+ /**
62
+ * Passed to the GridComponents.ScrollSeekPlaceholder custom component
63
+ */
64
+ export interface GridScrollSeekPlaceholderProps {
65
+ index: number;
66
+ height: number;
67
+ width: number;
45
68
  }
46
69
  /**
47
70
  * Customize the Virtuoso rendering by passing a set of custom components.
48
71
  */
49
- export interface Components {
72
+ export interface Components<Context = unknown> {
50
73
  /**
51
74
  * Set to render a component at the top of the list.
52
75
  *
53
76
  * The header remains above the top items and does not remain sticky.
54
77
  */
55
- Header?: ComponentType;
78
+ Header?: ComponentType<{
79
+ context?: Context;
80
+ }>;
56
81
  /**
57
82
  * Set to render a component at the bottom of the list.
58
83
  */
59
- Footer?: ComponentType;
84
+ Footer?: ComponentType<{
85
+ context?: Context;
86
+ }>;
60
87
  /**
61
88
  * Set to customize the item wrapping element. Use only if you would like to render list from elements different than a `div`.
62
89
  */
63
- Item?: ComponentType<ItemProps>;
90
+ Item?: ComponentType<ItemProps & {
91
+ context?: Context;
92
+ }>;
64
93
  /**
65
94
  * Set to customize the group item wrapping element. Use only if you would like to render list from elements different than a `div`.
66
95
  */
67
- Group?: ComponentType<GroupProps>;
96
+ Group?: ComponentType<GroupProps & {
97
+ context?: Context;
98
+ }>;
68
99
  /**
69
100
  * Set to customize the top list item wrapping element. Use if you would like to render list from elements different than a `div`
70
101
  * or you want to set a custom z-index for the sticky position.
71
102
  */
72
- TopItemList?: ComponentType<TopItemListProps>;
103
+ TopItemList?: ComponentType<TopItemListProps & {
104
+ context?: Context;
105
+ }>;
73
106
  /**
74
107
  * Set to customize the outermost scrollable element. This should not be necessary in general,
75
108
  * as the component passes its HTML attribute props to it.
76
109
  */
77
- Scroller?: ComponentType<ScrollerProps>;
110
+ Scroller?: ComponentType<ScrollerProps & {
111
+ context?: Context;
112
+ }>;
78
113
  /**
79
114
  * Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
80
115
  */
81
- List?: ComponentType<ListProps>;
116
+ List?: ComponentType<ListProps & {
117
+ context?: Context;
118
+ }>;
82
119
  /**
83
120
  * Set to render a custom UI when the list is empty.
84
121
  */
85
- EmptyPlaceholder?: ComponentType;
122
+ EmptyPlaceholder?: ComponentType<{
123
+ context?: Context;
124
+ }>;
86
125
  /**
87
126
  * Set to render an item placeholder when the user scrolls fast. See the `scrollSeek` property for more details.
88
127
  */
89
- ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps>;
128
+ ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps & {
129
+ context?: Context;
130
+ }>;
90
131
  }
91
- export interface ComputeItemKey {
92
- (index: number): Key;
132
+ /**
133
+ * Customize the TableVirtuoso rendering by passing a set of custom components.
134
+ */
135
+ export interface TableComponents<Context = unknown> {
136
+ /**
137
+ * Set to customize the wrapping `table` element.
138
+ *
139
+ */
140
+ Table?: ComponentType<TableProps & {
141
+ context?: Context;
142
+ }>;
143
+ /**
144
+ * Set to render a fixed header at the top of the table (`thead`). use [[fixedHeaderHeight]] to set the contents
145
+ *
146
+ */
147
+ TableHead?: ComponentType<{
148
+ context?: Context;
149
+ }>;
150
+ /**
151
+ * Set to customize the item wrapping element. Default is `tr`.
152
+ */
153
+ TableRow?: ComponentType<ItemProps & {
154
+ context?: Context;
155
+ }>;
156
+ /**
157
+ * Set to customize the outermost scrollable element. This should not be necessary in general,
158
+ * as the component passes its HTML attribute props to it.
159
+ */
160
+ Scroller?: ComponentType<ScrollerProps & {
161
+ context?: Context;
162
+ }>;
163
+ /**
164
+ * Set to customize the items wrapper. Default is `tbody`.
165
+ */
166
+ TableBody?: ComponentType<TableBodyProps & {
167
+ context?: Context;
168
+ }>;
169
+ /**
170
+ * Set to render a custom UI when the list is empty.
171
+ */
172
+ EmptyPlaceholder?: ComponentType<{
173
+ context?: Context;
174
+ }>;
175
+ /**
176
+ * Set to render an item placeholder when the user scrolls fast. See the `scrollSeek` property for more details.
177
+ */
178
+ ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps & {
179
+ context?: Context;
180
+ }>;
181
+ }
182
+ export interface ComputeItemKey<D, C> {
183
+ (index: number, item: D, context: C): Key;
93
184
  }
94
185
  export interface ScrollSeekToggle {
95
186
  (velocity: number, range: ListRange): boolean;
@@ -132,7 +223,7 @@ export interface IndexLocationWithAlign {
132
223
  /**
133
224
  * The index of the item to scroll to.
134
225
  */
135
- index: number;
226
+ index: number | 'LAST';
136
227
  /**
137
228
  * How to position the item in the viewport.
138
229
  */
@@ -147,38 +238,53 @@ export interface IndexLocationWithAlign {
147
238
  offset?: number;
148
239
  }
149
240
  export declare type ListRootProps = Omit<React.HTMLProps<'div'>, 'ref' | 'data'>;
241
+ export declare type TableRootProps = Omit<React.HTMLProps<'table'>, 'ref' | 'data'>;
150
242
  export declare type GridRootProps = Omit<React.HTMLProps<'div'>, 'ref' | 'data'>;
151
243
  export interface GridItem {
152
244
  'data-index': number;
153
245
  className?: string;
154
246
  }
155
- export interface GridComponents {
247
+ export interface GridComponents<Context = any> {
156
248
  /**
157
249
  * Set to customize the item wrapping element. Use only if you would like to render list from elements different than a `div`.
158
250
  */
159
- Item?: ComponentType<GridItem>;
251
+ Item?: ComponentType<GridItem & {
252
+ context?: Context;
253
+ }>;
160
254
  /**
161
255
  * Set to customize the outermost scrollable element. This should not be necessary in general,
162
256
  * as the component passes its HTML attribute props to it.
163
257
  */
164
- Scroller?: ComponentType<ScrollerProps>;
258
+ Scroller?: ComponentType<ScrollerProps & {
259
+ context?: Context;
260
+ }>;
165
261
  /**
166
262
  * Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
167
263
  */
168
- List?: ComponentType<GridListProps>;
264
+ List?: ComponentType<GridListProps & {
265
+ context?: Context;
266
+ }>;
169
267
  /**
170
268
  * Set to render an item placeholder when the user scrolls fast.
171
269
  * See the `scrollSeekConfiguration` property for more details.
172
270
  */
173
- ScrollSeekPlaceholder?: ComponentType<{
174
- style: CSSProperties;
271
+ ScrollSeekPlaceholder?: ComponentType<GridScrollSeekPlaceholderProps & {
272
+ context?: Context;
175
273
  }>;
176
274
  }
177
- export interface GridItemContent {
178
- (index: number): ReactNode;
275
+ export interface GridComputeItemKey {
276
+ (index: number): Key;
277
+ }
278
+ export interface GridItemContent<C> {
279
+ (index: number, context: C): ReactNode;
179
280
  }
180
281
  export interface WindowViewportInfo {
181
282
  offsetTop: number;
182
283
  visibleHeight: number;
183
284
  visibleWidth: number;
184
285
  }
286
+ export interface ScrollIntoViewLocation {
287
+ index: number;
288
+ behavior?: 'auto' | 'smooth';
289
+ done?: () => void;
290
+ }