@ringcentral/juno 2.40.0 → 2.41.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 (183) hide show
  1. package/components/Downshift/SuggestionList/SuggestionList.d.ts +3 -3
  2. package/components/Downshift/utils/useDownshift.d.ts +1 -1
  3. package/components/Tooltip/Tooltip.js +20 -2
  4. package/components/Virtuoso/index.d.ts +1 -1
  5. package/components/Virtuoso/index.js +1 -1
  6. package/components/Virtuoso/react-virtuoso/AATree.d.ts +1 -1
  7. package/components/Virtuoso/react-virtuoso/AATree.js +60 -48
  8. package/components/Virtuoso/react-virtuoso/TableVirtuoso.d.ts +5 -0
  9. package/components/Virtuoso/react-virtuoso/TableVirtuoso.js +217 -0
  10. package/components/Virtuoso/react-virtuoso/Virtuoso.d.ts +7696 -0
  11. package/components/Virtuoso/react-virtuoso/Virtuoso.js +317 -0
  12. package/components/Virtuoso/react-virtuoso/{Grid.d.ts → VirtuosoGrid.d.ts} +170 -72
  13. package/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +199 -0
  14. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +119 -65
  15. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
  16. package/components/Virtuoso/react-virtuoso/comparators.d.ts +1 -1
  17. package/components/Virtuoso/react-virtuoso/comparators.js +1 -3
  18. package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.d.ts +194 -0
  19. package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +2 -0
  20. package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.d.ts +274 -0
  21. package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +2 -0
  22. package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.d.ts +125 -0
  23. package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +2 -0
  24. package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +3 -2
  25. package/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
  26. package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +80 -43
  27. package/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
  28. package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +57 -31
  29. package/components/Virtuoso/react-virtuoso/gridSystem.js +173 -86
  30. package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +76 -67
  31. package/components/Virtuoso/react-virtuoso/groupedListSystem.js +12 -12
  32. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +6 -3
  33. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +36 -17
  34. package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  35. package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +3 -2
  36. package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.d.ts +2 -0
  37. package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +5 -0
  38. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +2 -3
  39. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +36 -51
  40. package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -3
  41. package/components/Virtuoso/react-virtuoso/hooks/useSize.js +13 -13
  42. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +17 -15
  43. package/components/Virtuoso/react-virtuoso/index.d.ts +7 -1
  44. package/components/Virtuoso/react-virtuoso/index.js +8 -1
  45. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +304 -68
  46. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +9 -31
  47. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +127 -109
  48. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
  49. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +38 -22
  50. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
  51. package/components/Virtuoso/react-virtuoso/interfaces.d.ts +150 -51
  52. package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +109 -59
  53. package/components/Virtuoso/react-virtuoso/listStateSystem.js +100 -52
  54. package/components/Virtuoso/react-virtuoso/listSystem.d.ts +1691 -693
  55. package/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
  56. package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +1 -1
  57. package/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
  58. package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +1 -1
  59. package/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
  60. package/components/Virtuoso/react-virtuoso/react-urx/index.d.ts +110 -0
  61. package/components/Virtuoso/react-virtuoso/react-urx/index.js +200 -0
  62. package/components/Virtuoso/react-virtuoso/react-urx/package.json +5 -0
  63. package/components/Virtuoso/react-virtuoso/recalcSystem.d.ts +4 -0
  64. package/components/Virtuoso/react-virtuoso/recalcSystem.js +8 -0
  65. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +144 -78
  66. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +33 -21
  67. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +12 -7
  68. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
  69. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +19 -11
  70. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
  71. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +7 -6
  72. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +15 -27
  73. package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +20 -11
  74. package/components/Virtuoso/react-virtuoso/sizeSystem.js +182 -52
  75. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +8 -5
  76. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
  77. package/components/Virtuoso/react-virtuoso/stateLoadSystem.d.ts +318 -0
  78. package/components/Virtuoso/react-virtuoso/stateLoadSystem.js +41 -0
  79. package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +518 -467
  80. package/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
  81. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +115 -63
  82. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
  83. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +139 -73
  84. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +74 -31
  85. package/components/Virtuoso/react-virtuoso/urx/actions.d.ts +127 -0
  86. package/components/Virtuoso/react-virtuoso/urx/actions.js +98 -0
  87. package/components/Virtuoso/react-virtuoso/urx/constants.d.ts +8 -0
  88. package/components/Virtuoso/react-virtuoso/urx/constants.js +6 -0
  89. package/components/Virtuoso/react-virtuoso/urx/index.d.ts +6 -0
  90. package/components/Virtuoso/react-virtuoso/urx/index.js +9 -0
  91. package/components/Virtuoso/react-virtuoso/urx/package.json +5 -0
  92. package/components/Virtuoso/react-virtuoso/urx/pipe.d.ts +220 -0
  93. package/components/Virtuoso/react-virtuoso/urx/pipe.js +279 -0
  94. package/components/Virtuoso/react-virtuoso/urx/streams.d.ts +143 -0
  95. package/components/Virtuoso/react-virtuoso/urx/streams.js +227 -0
  96. package/components/Virtuoso/react-virtuoso/urx/system.d.ts +148 -0
  97. package/components/Virtuoso/react-virtuoso/urx/system.js +106 -0
  98. package/components/Virtuoso/react-virtuoso/urx/transformers.d.ts +71 -0
  99. package/components/Virtuoso/react-virtuoso/urx/transformers.js +106 -0
  100. package/components/Virtuoso/react-virtuoso/urx/utils.d.ts +57 -0
  101. package/components/Virtuoso/react-virtuoso/urx/utils.js +102 -0
  102. package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.d.ts +1 -0
  103. package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +6 -0
  104. package/components/Virtuoso/react-virtuoso/utils/context.d.ts +13 -0
  105. package/components/Virtuoso/react-virtuoso/utils/context.js +6 -0
  106. package/components/Virtuoso/react-virtuoso/utils/skipFrames.d.ts +1 -0
  107. package/components/Virtuoso/react-virtuoso/utils/skipFrames.js +11 -0
  108. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +6 -4
  109. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
  110. package/components/Virtuoso/utils/isOutOfRange.d.ts +1 -1
  111. package/components/Virtuoso/utils/useHighlightScroll.d.ts +2 -2
  112. package/es6/components/Tooltip/Tooltip.js +21 -3
  113. package/es6/components/Virtuoso/index.js +1 -1
  114. package/es6/components/Virtuoso/react-virtuoso/AATree.js +60 -48
  115. package/es6/components/Virtuoso/react-virtuoso/{Table.js → TableVirtuoso.js} +73 -52
  116. package/es6/components/Virtuoso/react-virtuoso/{List.js → Virtuoso.js} +85 -161
  117. package/es6/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +198 -0
  118. package/es6/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
  119. package/es6/components/Virtuoso/react-virtuoso/comparators.js +1 -3
  120. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +0 -0
  121. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +0 -0
  122. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +0 -0
  123. package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
  124. package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
  125. package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +173 -87
  126. package/es6/components/Virtuoso/react-virtuoso/groupedListSystem.js +13 -13
  127. package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +35 -16
  128. package/es6/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +2 -2
  129. package/es6/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +2 -0
  130. package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +35 -50
  131. package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +11 -12
  132. package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +15 -14
  133. package/es6/components/Virtuoso/react-virtuoso/index.js +4 -1
  134. package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +11 -33
  135. package/es6/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
  136. package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
  137. package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +101 -54
  138. package/es6/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
  139. package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
  140. package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
  141. package/es6/components/Virtuoso/react-virtuoso/react-urx/index.js +197 -0
  142. package/es6/components/Virtuoso/react-virtuoso/recalcSystem.js +5 -0
  143. package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +34 -22
  144. package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
  145. package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
  146. package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +16 -28
  147. package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +180 -53
  148. package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
  149. package/es6/components/Virtuoso/react-virtuoso/stateLoadSystem.js +39 -0
  150. package/es6/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
  151. package/es6/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
  152. package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +75 -32
  153. package/es6/components/Virtuoso/react-virtuoso/urx/actions.js +90 -0
  154. package/es6/components/Virtuoso/react-virtuoso/urx/constants.js +4 -0
  155. package/es6/components/Virtuoso/react-virtuoso/urx/index.js +6 -0
  156. package/es6/components/Virtuoso/react-virtuoso/urx/pipe.js +266 -0
  157. package/es6/components/Virtuoso/react-virtuoso/urx/streams.js +220 -0
  158. package/es6/components/Virtuoso/react-virtuoso/urx/system.js +102 -0
  159. package/es6/components/Virtuoso/react-virtuoso/urx/transformers.js +101 -0
  160. package/es6/components/Virtuoso/react-virtuoso/urx/utils.js +88 -0
  161. package/es6/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +3 -0
  162. package/es6/components/Virtuoso/react-virtuoso/utils/context.js +3 -0
  163. package/es6/components/Virtuoso/react-virtuoso/utils/skipFrames.js +8 -0
  164. package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
  165. package/es6/foundation/hooks/useForkRef/useForkRef.js +2 -1
  166. package/foundation/hooks/useForkRef/useForkRef.d.ts +2 -1
  167. package/foundation/hooks/useForkRef/useForkRef.js +1 -0
  168. package/package.json +2 -2
  169. package/components/Virtuoso/Virtuoso.d.ts +0 -1
  170. package/components/Virtuoso/Virtuoso.js +0 -4
  171. package/components/Virtuoso/react-virtuoso/Grid.js +0 -168
  172. package/components/Virtuoso/react-virtuoso/List.d.ts +0 -6749
  173. package/components/Virtuoso/react-virtuoso/List.js +0 -393
  174. package/components/Virtuoso/react-virtuoso/Table.d.ts +0 -6515
  175. package/components/Virtuoso/react-virtuoso/Table.js +0 -196
  176. package/components/Virtuoso/react-virtuoso/components.d.ts +0 -505
  177. package/components/Virtuoso/react-virtuoso/components.js +0 -9
  178. package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.d.ts +0 -1
  179. package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -11
  180. package/es6/components/Virtuoso/Virtuoso.js +0 -1
  181. package/es6/components/Virtuoso/react-virtuoso/Grid.js +0 -166
  182. package/es6/components/Virtuoso/react-virtuoso/components.js +0 -7
  183. package/es6/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -8
@@ -1,33 +1,31 @@
1
1
  var _a;
2
2
  import { __assign, __read, __rest } from "tslib";
3
- /* eslint-disable no-console */
4
- import * as React from 'react';
5
- import { createElement, } from 'react';
6
- import { systemToComponent } from '@virtuoso.dev/react-urx';
7
- import { compose, connect, distinctUntilChanged, getValue, map, noop, pipe, publish, statefulStream, statefulStreamFromEmitter, stream, subscribe, system, tup, withLatestFrom, } from '@virtuoso.dev/urx';
8
- import useChangedListContentsSizes from './hooks/useChangedChildSizes';
3
+ import { systemToComponent } from './react-urx';
4
+ import * as u from './urx';
5
+ import React from 'react';
9
6
  import useIsomorphicLayoutEffect from './hooks/useIsomorphicLayoutEffect';
7
+ import useChangedListContentsSizes from './hooks/useChangedChildSizes';
10
8
  import useScrollTop from './hooks/useScrollTop';
11
9
  import useSize from './hooks/useSize';
12
- import useWindowViewportRectRef from './hooks/useWindowViewportRect';
13
10
  import { listSystem } from './listSystem';
14
- import conditionalFlushSync from './utils/conditionalFlushSync';
15
- import { correctItemSize } from './utils/correctItemSize';
16
11
  import { positionStickyCssValue } from './utils/positionStickyCssValue';
12
+ import useWindowViewportRectRef from './hooks/useWindowViewportRect';
13
+ import { correctItemSize } from './utils/correctItemSize';
14
+ import { VirtuosoMockContext } from './utils/context';
17
15
  export function identity(value) {
18
16
  return value;
19
17
  }
20
- var listComponentPropsSystem = system(function () {
21
- var itemContent = statefulStream(function (index) { return "Item " + index; });
22
- var context = statefulStream(null);
23
- var groupContent = statefulStream(function (index) { return "Group " + index; });
24
- var components = statefulStream({});
25
- var computeItemKey = statefulStream(identity);
26
- var headerFooterTag = statefulStream('div');
27
- var scrollerRef = statefulStream(noop);
18
+ var listComponentPropsSystem = /*#__PURE__*/ u.system(function () {
19
+ var itemContent = u.statefulStream(function (index) { return "Item " + index; });
20
+ var context = u.statefulStream(null);
21
+ var groupContent = u.statefulStream(function (index) { return "Group " + index; });
22
+ var components = u.statefulStream({});
23
+ var computeItemKey = u.statefulStream(identity);
24
+ var headerFooterTag = u.statefulStream('div');
25
+ var scrollerRef = u.statefulStream(u.noop);
28
26
  var distinctProp = function (propName, defaultValue) {
29
27
  if (defaultValue === void 0) { defaultValue = null; }
30
- return statefulStreamFromEmitter(pipe(components, map(function (components) { return components[propName]; }), distinctUntilChanged()), defaultValue);
28
+ return u.statefulStreamFromEmitter(u.pipe(components, u.map(function (components) { return components[propName]; }), u.distinctUntilChanged()), defaultValue);
31
29
  };
32
30
  return {
33
31
  context: context,
@@ -48,109 +46,40 @@ var listComponentPropsSystem = system(function () {
48
46
  ScrollSeekPlaceholder: distinctProp('ScrollSeekPlaceholder'),
49
47
  };
50
48
  });
51
- export function addDeprecatedAlias(prop, message) {
52
- var alias = stream();
53
- subscribe(alias, function () {
54
- return console.warn("react-virtuoso: You are using a deprecated property. " + message, 'color: red;', 'color: inherit;', 'color: blue;');
55
- });
56
- connect(alias, prop);
57
- return alias;
58
- }
59
- var combinedSystem = system(function (_a) {
49
+ var combinedSystem = /*#__PURE__*/ u.system(function (_a) {
60
50
  var _b = __read(_a, 2), listSystem = _b[0], propsSystem = _b[1];
61
- var deprecatedProps = {
62
- item: addDeprecatedAlias(propsSystem.itemContent, 'Rename the %citem%c prop to %citemContent.'),
63
- group: addDeprecatedAlias(propsSystem.groupContent, 'Rename the %cgroup%c prop to %cgroupContent.'),
64
- topItems: addDeprecatedAlias(listSystem.topItemCount, 'Rename the %ctopItems%c prop to %ctopItemCount.'),
65
- itemHeight: addDeprecatedAlias(listSystem.fixedItemHeight, 'Rename the %citemHeight%c prop to %cfixedItemHeight.'),
66
- scrollingStateChange: addDeprecatedAlias(listSystem.isScrolling, 'Rename the %cscrollingStateChange%c prop to %cisScrolling.'),
67
- adjustForPrependedItems: stream(),
68
- maxHeightCacheSize: stream(),
69
- footer: stream(),
70
- header: stream(),
71
- HeaderContainer: stream(),
72
- FooterContainer: stream(),
73
- ItemContainer: stream(),
74
- ScrollContainer: stream(),
75
- GroupContainer: stream(),
76
- ListContainer: stream(),
77
- emptyComponent: stream(),
78
- scrollSeek: stream(),
79
- };
80
- subscribe(deprecatedProps.adjustForPrependedItems, function () {
81
- console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.", 'color: red;', 'color: inherit;', 'color: blue;');
82
- });
83
- subscribe(deprecatedProps.maxHeightCacheSize, function () {
84
- console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.");
85
- });
86
- subscribe(deprecatedProps.HeaderContainer, function () {
87
- console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.");
88
- });
89
- subscribe(deprecatedProps.FooterContainer, function () {
90
- console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.");
91
- });
92
- function deprecateComponentProp(stream, componentName, propName) {
93
- connect(pipe(stream, withLatestFrom(propsSystem.components), map(function (_a) {
94
- var _b;
95
- var _c = __read(_a, 2), comp = _c[0], components = _c[1];
96
- console.warn("react-virtuoso: " + propName + " property is deprecated. Pass components." + componentName + " instead.");
97
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
98
- return __assign(__assign({}, components), (_b = {}, _b[componentName] = comp, _b));
99
- })), propsSystem.components);
100
- }
101
- subscribe(deprecatedProps.scrollSeek, function (_a) {
102
- var placeholder = _a.placeholder, config = __rest(_a, ["placeholder"]);
103
- console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");
104
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
105
- publish(propsSystem.components, __assign(__assign({}, getValue(propsSystem.components)), { ScrollSeekPlaceholder: placeholder }));
106
- publish(listSystem.scrollSeekConfiguration, config);
107
- });
108
- deprecateComponentProp(deprecatedProps.footer, 'Footer', 'footer');
109
- deprecateComponentProp(deprecatedProps.header, 'Header', 'header');
110
- deprecateComponentProp(deprecatedProps.ItemContainer, 'Item', 'ItemContainer');
111
- deprecateComponentProp(deprecatedProps.ListContainer, 'List', 'ListContainer');
112
- deprecateComponentProp(deprecatedProps.ScrollContainer, 'Scroller', 'ScrollContainer');
113
- deprecateComponentProp(deprecatedProps.emptyComponent, 'EmptyPlaceholder', 'emptyComponent');
114
- deprecateComponentProp(deprecatedProps.GroupContainer, 'Group', 'GroupContainer');
115
- return __assign(__assign(__assign({}, listSystem), propsSystem), deprecatedProps);
116
- }, tup(listSystem, listComponentPropsSystem));
51
+ return __assign(__assign({}, listSystem), propsSystem);
52
+ }, u.tup(listSystem, listComponentPropsSystem));
117
53
  var DefaultScrollSeekPlaceholder = function (_a) {
118
54
  var height = _a.height;
119
- return (React.createElement("div", { style: { height: height } }));
120
- };
121
- var GROUP_STYLE = {
122
- position: positionStickyCssValue(),
123
- zIndex: 1,
124
- overflowAnchor: 'none',
55
+ return React.createElement("div", { style: { height: height } });
125
56
  };
57
+ var GROUP_STYLE = { position: positionStickyCssValue(), zIndex: 1, overflowAnchor: 'none' };
126
58
  var ITEM_STYLE = { overflowAnchor: 'none' };
127
- export var Items = React.memo(function VirtuosoItems(_a) {
59
+ var Items = /*#__PURE__*/ React.memo(function VirtuosoItems(_a) {
128
60
  var _b = _a.showTopList, showTopList = _b === void 0 ? false : _b;
129
61
  var listState = useEmitterValue('listState');
130
- var _c = __read(React.useState(0), 2), deviation = _c[0], setDeviation = _c[1];
131
- var react18ConcurrentRendering = useEmitterValue('react18ConcurrentRendering');
132
- useEmitter('deviation', function (value) {
133
- if (deviation !== value) {
134
- conditionalFlushSync(react18ConcurrentRendering)(function () {
135
- return setDeviation(value);
136
- });
137
- }
138
- });
139
62
  var sizeRanges = usePublisher('sizeRanges');
140
63
  var useWindowScroll = useEmitterValue('useWindowScroll');
141
64
  var customScrollParent = useEmitterValue('customScrollParent');
142
65
  var windowScrollContainerStateCallback = usePublisher('windowScrollContainerState');
143
66
  var _scrollContainerStateCallback = usePublisher('scrollContainerState');
144
- var scrollContainerStateCallback = customScrollParent || useWindowScroll
145
- ? windowScrollContainerStateCallback
146
- : _scrollContainerStateCallback;
67
+ var scrollContainerStateCallback = customScrollParent || useWindowScroll ? windowScrollContainerStateCallback : _scrollContainerStateCallback;
147
68
  var itemContent = useEmitterValue('itemContent');
148
69
  var context = useEmitterValue('context');
149
70
  var groupContent = useEmitterValue('groupContent');
150
71
  var trackItemSizes = useEmitterValue('trackItemSizes');
151
72
  var itemSize = useEmitterValue('itemSize');
152
73
  var log = useEmitterValue('log');
153
- var ref = useChangedListContentsSizes(sizeRanges, itemSize, trackItemSizes, showTopList ? noop : scrollContainerStateCallback, log, customScrollParent);
74
+ var listGap = usePublisher('gap');
75
+ var callbackRef = useChangedListContentsSizes(sizeRanges, itemSize, trackItemSizes, showTopList ? u.noop : scrollContainerStateCallback, log, listGap, customScrollParent).callbackRef;
76
+ var _c = __read(React.useState(0), 2), deviation = _c[0], setDeviation = _c[1];
77
+ useEmitter('deviation', function (value) {
78
+ if (deviation !== value) {
79
+ // ref.current!.style.marginTop = `${value}px`
80
+ setDeviation(value);
81
+ }
82
+ });
154
83
  var EmptyPlaceholder = useEmitterValue('EmptyPlaceholder');
155
84
  var ScrollSeekPlaceholder = useEmitterValue('ScrollSeekPlaceholder') || DefaultScrollSeekPlaceholder;
156
85
  var ListComponent = useEmitterValue('ListComponent');
@@ -160,33 +89,27 @@ export var Items = React.memo(function VirtuosoItems(_a) {
160
89
  var isSeeking = useEmitterValue('isSeeking');
161
90
  var hasGroups = useEmitterValue('groupIndices').length > 0;
162
91
  var paddingTopAddition = useEmitterValue('paddingTopAddition');
163
- var firstItemIndex = useEmitterValue('firstItemIndex');
164
- var statefulTotalCount = useEmitterValue('statefulTotalCount');
92
+ var scrolledToInitialItem = useEmitterValue('scrolledToInitialItem');
165
93
  var containerStyle = showTopList
166
94
  ? {}
167
- : {
168
- boxSizing: 'border-box',
169
- paddingTop: listState.offsetTop + paddingTopAddition,
170
- paddingBottom: listState.offsetBottom,
171
- marginTop: deviation,
172
- };
173
- if (!showTopList && statefulTotalCount === 0 && EmptyPlaceholder) {
174
- return createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
95
+ : __assign({ boxSizing: 'border-box', paddingTop: listState.offsetTop + paddingTopAddition, paddingBottom: listState.offsetBottom, marginTop: deviation }, (scrolledToInitialItem ? {} : { visibility: 'hidden' }));
96
+ if (!showTopList && listState.totalCount === 0 && EmptyPlaceholder) {
97
+ return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
175
98
  }
176
- return createElement(ListComponent, __assign(__assign({}, contextPropIfNotDomElement(ListComponent, context)), { ref: ref, style: containerStyle, 'data-test-id': showTopList
177
- ? 'virtuoso-top-item-list'
178
- : 'virtuoso-item-list' }), (showTopList ? listState.topItems : listState.items).map(function (item) {
99
+ return React.createElement(ListComponent, __assign(__assign({}, contextPropIfNotDomElement(ListComponent, context)), { ref: callbackRef, style: containerStyle, 'data-test-id': showTopList ? 'virtuoso-top-item-list' : 'virtuoso-item-list' }), (showTopList ? listState.topItems : listState.items).map(function (item) {
179
100
  var index = item.originalIndex;
180
- var key = computeItemKey(index + firstItemIndex, item.data, context);
101
+ var key = computeItemKey(index + listState.firstItemIndex, item.data, context);
181
102
  if (isSeeking) {
182
- return createElement(ScrollSeekPlaceholder, __assign(__assign(__assign({}, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { key: key, index: item.index, height: item.size, type: item.type || 'item' }), (item.type === 'group' ? {} : { groupIndex: item.groupIndex })));
103
+ return React.createElement(ScrollSeekPlaceholder, __assign(__assign(__assign({}, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { key: key, index: item.index, height: item.size, type: item.type || 'item' }), (item.type === 'group' ? {} : { groupIndex: item.groupIndex })));
183
104
  }
184
105
  if (item.type === 'group') {
185
- return createElement(GroupComponent, __assign(__assign({}, contextPropIfNotDomElement(GroupComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, style: GROUP_STYLE }), groupContent(item.index));
106
+ return React.createElement(GroupComponent, __assign(__assign({}, contextPropIfNotDomElement(GroupComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, style: GROUP_STYLE }), groupContent(item.index, context));
107
+ }
108
+ else {
109
+ return React.createElement(ItemComponent, __assign(__assign(__assign({}, contextPropIfNotDomElement(ItemComponent, context)), itemPropIfNotDomElement(ItemComponent, item.data)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, 'data-item-group-index': item.groupIndex, style: ITEM_STYLE }), hasGroups
110
+ ? itemContent(item.index, item.groupIndex, item.data, context)
111
+ : itemContent(item.index, item.data, context));
186
112
  }
187
- return createElement(ItemComponent, __assign(__assign({}, contextPropIfNotDomElement(ItemComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, 'data-item-group-index': item.groupIndex, style: ITEM_STYLE }), hasGroups
188
- ? itemContent(item.index, item.groupIndex, item.data, context)
189
- : itemContent(item.index, item.data, context));
190
113
  }));
191
114
  });
192
115
  export var scrollerStyle = {
@@ -206,6 +129,7 @@ var topItemListStyle = {
206
129
  width: '100%',
207
130
  position: positionStickyCssValue(),
208
131
  top: 0,
132
+ zIndex: 1,
209
133
  };
210
134
  export function contextPropIfNotDomElement(element, context) {
211
135
  if (typeof element === 'string') {
@@ -213,6 +137,9 @@ export function contextPropIfNotDomElement(element, context) {
213
137
  }
214
138
  return { context: context };
215
139
  }
140
+ export function itemPropIfNotDomElement(element, item) {
141
+ return { item: typeof element === 'string' ? undefined : item };
142
+ }
216
143
  var Header = React.memo(function VirtuosoHeader() {
217
144
  var Header = useEmitterValue('HeaderComponent');
218
145
  var headerHeight = usePublisher('headerHeight');
@@ -220,7 +147,7 @@ var Header = React.memo(function VirtuosoHeader() {
220
147
  var ref = useSize(function (el) { return headerHeight(correctItemSize(el, 'height')); });
221
148
  var context = useEmitterValue('context');
222
149
  return Header
223
- ? createElement(headerFooterTag, { ref: ref }, createElement(Header, contextPropIfNotDomElement(Header, context)))
150
+ ? React.createElement(headerFooterTag, { ref: ref }, React.createElement(Header, contextPropIfNotDomElement(Header, context)))
224
151
  : null;
225
152
  });
226
153
  var Footer = React.memo(function VirtuosoFooter() {
@@ -230,7 +157,7 @@ var Footer = React.memo(function VirtuosoFooter() {
230
157
  var ref = useSize(function (el) { return footerHeight(correctItemSize(el, 'height')); });
231
158
  var context = useEmitterValue('context');
232
159
  return Footer
233
- ? createElement(headerFooterTag, { ref: ref }, createElement(Footer, contextPropIfNotDomElement(Footer, context)))
160
+ ? React.createElement(headerFooterTag, { ref: ref }, React.createElement(Footer, contextPropIfNotDomElement(Footer, context)))
234
161
  : null;
235
162
  });
236
163
  export function buildScroller(_a) {
@@ -245,7 +172,7 @@ export function buildScroller(_a) {
245
172
  var _b = useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, scrollerRefCallback), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
246
173
  useEmitter('scrollTo', scrollToCallback);
247
174
  useEmitter('scrollBy', scrollByCallback);
248
- return createElement(ScrollerComponent, __assign(__assign({ ref: scrollerRef, style: __assign(__assign({}, scrollerStyle), style), 'data-test-id': 'virtuoso-scroller', 'data-virtuoso-scroller': true, tabIndex: 0 }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
175
+ return React.createElement(ScrollerComponent, __assign(__assign({ ref: scrollerRef, style: __assign(__assign({}, scrollerStyle), style), 'data-test-id': 'virtuoso-scroller', 'data-virtuoso-scroller': true, tabIndex: 0 }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
249
176
  });
250
177
  return Scroller;
251
178
  }
@@ -260,7 +187,7 @@ export function buildWindowScroller(_a) {
260
187
  var deviation = useEmitterValue('deviation');
261
188
  var customScrollParent = useEmitterValue('customScrollParent');
262
189
  var context = useEmitterValue('context');
263
- var _b = useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, noop, customScrollParent), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
190
+ var _b = useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, u.noop, customScrollParent), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
264
191
  useIsomorphicLayoutEffect(function () {
265
192
  scrollerRef.current = customScrollParent ? customScrollParent : window;
266
193
  return function () {
@@ -269,23 +196,37 @@ export function buildWindowScroller(_a) {
269
196
  }, [scrollerRef, customScrollParent]);
270
197
  useEmitter('windowScrollTo', scrollToCallback);
271
198
  useEmitter('scrollBy', scrollByCallback);
272
- return createElement(ScrollerComponent, __assign(__assign({ style: __assign(__assign({ position: 'relative' }, style), (totalListHeight !== 0
273
- ? { height: totalListHeight + deviation }
274
- : {})), 'data-virtuoso-scroller': true }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
199
+ return React.createElement(ScrollerComponent, __assign(__assign({ style: __assign(__assign({ position: 'relative' }, style), (totalListHeight !== 0 ? { height: totalListHeight + deviation } : {})), 'data-virtuoso-scroller': true }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
275
200
  });
276
201
  return Scroller;
277
202
  }
278
203
  var Viewport = function (_a) {
279
204
  var children = _a.children;
205
+ var ctx = React.useContext(VirtuosoMockContext);
280
206
  var viewportHeight = usePublisher('viewportHeight');
281
- var viewportRef = useSize(compose(viewportHeight, function (el) { return correctItemSize(el, 'height'); }));
207
+ var fixedItemHeight = usePublisher('fixedItemHeight');
208
+ var viewportRef = useSize(u.compose(viewportHeight, function (el) { return correctItemSize(el, 'height'); }));
209
+ React.useEffect(function () {
210
+ if (ctx) {
211
+ viewportHeight(ctx.viewportHeight);
212
+ fixedItemHeight(ctx.itemHeight);
213
+ }
214
+ }, [ctx, viewportHeight, fixedItemHeight]);
282
215
  return (React.createElement("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children));
283
216
  };
284
217
  var WindowViewport = function (_a) {
285
218
  var children = _a.children;
219
+ var ctx = React.useContext(VirtuosoMockContext);
286
220
  var windowViewportRect = usePublisher('windowViewportRect');
221
+ var fixedItemHeight = usePublisher('fixedItemHeight');
287
222
  var customScrollParent = useEmitterValue('customScrollParent');
288
223
  var viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
224
+ React.useEffect(function () {
225
+ if (ctx) {
226
+ fixedItemHeight(ctx.itemHeight);
227
+ windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
228
+ }
229
+ }, [ctx, windowViewportRect, fixedItemHeight]);
289
230
  return (React.createElement("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window" }, children));
290
231
  };
291
232
  var TopItemListContainer = function (_a) {
@@ -294,7 +235,7 @@ var TopItemListContainer = function (_a) {
294
235
  var headerHeight = useEmitterValue('headerHeight');
295
236
  var style = __assign(__assign({}, topItemListStyle), { marginTop: headerHeight + "px" });
296
237
  var context = useEmitterValue('context');
297
- return createElement(TopItemList || 'div', { style: style, context: context }, children);
238
+ return React.createElement(TopItemList || 'div', { style: style, context: context }, children);
298
239
  };
299
240
  var ListRoot = React.memo(function VirtuosoRoot(props) {
300
241
  var useWindowScroll = useEmitterValue('useWindowScroll');
@@ -303,29 +244,31 @@ var ListRoot = React.memo(function VirtuosoRoot(props) {
303
244
  var TheScroller = customScrollParent || useWindowScroll ? WindowScroller : Scroller;
304
245
  var TheViewport = customScrollParent || useWindowScroll ? WindowViewport : Viewport;
305
246
  return (React.createElement(TheScroller, __assign({}, props),
247
+ showTopList && (React.createElement(TopItemListContainer, null,
248
+ React.createElement(Items, { showTopList: true }))),
306
249
  React.createElement(TheViewport, null,
307
250
  React.createElement(Header, null),
308
251
  React.createElement(Items, null),
309
- React.createElement(Footer, null)),
310
- showTopList && (React.createElement(TopItemListContainer, null,
311
- React.createElement(Items, { showTopList: true })))));
252
+ React.createElement(Footer, null))));
312
253
  });
313
254
  export var List = (_a = systemToComponent(combinedSystem, {
314
255
  required: {},
315
256
  optional: {
257
+ restoreStateFrom: 'restoreStateFrom',
316
258
  context: 'context',
317
259
  followOutput: 'followOutput',
318
- firstItemIndex: 'firstItemIndex',
319
260
  itemContent: 'itemContent',
320
261
  groupContent: 'groupContent',
321
262
  overscan: 'overscan',
322
263
  increaseViewportBy: 'increaseViewportBy',
323
264
  totalCount: 'totalCount',
265
+ groupCounts: 'groupCounts',
324
266
  topItemCount: 'topItemCount',
267
+ firstItemIndex: 'firstItemIndex',
325
268
  initialTopMostItemIndex: 'initialTopMostItemIndex',
326
269
  components: 'components',
327
- groupCounts: 'groupCounts',
328
270
  atBottomThreshold: 'atBottomThreshold',
271
+ atTopThreshold: 'atTopThreshold',
329
272
  computeItemKey: 'computeItemKey',
330
273
  defaultItemHeight: 'defaultItemHeight',
331
274
  fixedItemHeight: 'fixedItemHeight',
@@ -340,31 +283,14 @@ export var List = (_a = systemToComponent(combinedSystem, {
340
283
  customScrollParent: 'customScrollParent',
341
284
  scrollerRef: 'scrollerRef',
342
285
  logLevel: 'logLevel',
343
- react18ConcurrentRendering: 'react18ConcurrentRendering',
344
- // deprecated
345
- item: 'item',
346
- group: 'group',
347
- topItems: 'topItems',
348
- itemHeight: 'itemHeight',
349
- scrollingStateChange: 'scrollingStateChange',
350
- maxHeightCacheSize: 'maxHeightCacheSize',
351
- footer: 'footer',
352
- header: 'header',
353
- ItemContainer: 'ItemContainer',
354
- ScrollContainer: 'ScrollContainer',
355
- ListContainer: 'ListContainer',
356
- GroupContainer: 'GroupContainer',
357
- emptyComponent: 'emptyComponent',
358
- HeaderContainer: 'HeaderContainer',
359
- FooterContainer: 'FooterContainer',
360
- scrollSeek: 'scrollSeek',
361
286
  },
362
287
  methods: {
363
288
  scrollToIndex: 'scrollToIndex',
364
289
  scrollIntoView: 'scrollIntoView',
365
290
  scrollTo: 'scrollTo',
366
291
  scrollBy: 'scrollBy',
367
- adjustForPrependedItems: 'adjustForPrependedItems',
292
+ autoscrollToBottom: 'autoscrollToBottom',
293
+ getState: 'getState',
368
294
  },
369
295
  events: {
370
296
  isScrolling: 'isScrolling',
@@ -378,9 +304,7 @@ export var List = (_a = systemToComponent(combinedSystem, {
378
304
  groupIndices: 'groupIndices',
379
305
  },
380
306
  }, ListRoot), _a.Component), usePublisher = _a.usePublisher, useEmitterValue = _a.useEmitterValue, useEmitter = _a.useEmitter;
381
- var Scroller = buildScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
382
- var WindowScroller = buildWindowScroller({
383
- usePublisher: usePublisher,
384
- useEmitterValue: useEmitterValue,
385
- useEmitter: useEmitter,
386
- });
307
+ var Scroller = /*#__PURE__*/ buildScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
308
+ var WindowScroller = /*#__PURE__*/ buildWindowScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
309
+ export var Virtuoso = List;
310
+ export var GroupedVirtuoso = List;
@@ -0,0 +1,198 @@
1
+ import { __assign, __read, __rest } from "tslib";
2
+ import { systemToComponent } from './react-urx';
3
+ import * as u from './urx';
4
+ import React from 'react';
5
+ import { gridSystem } from './gridSystem';
6
+ import useSize from './hooks/useSize';
7
+ import useWindowViewportRectRef from './hooks/useWindowViewportRect';
8
+ import { buildScroller, buildWindowScroller, contextPropIfNotDomElement, identity, viewportStyle } from './Virtuoso';
9
+ import { LogLevel } from './loggerSystem';
10
+ import { correctItemSize } from './utils/correctItemSize';
11
+ import { VirtuosoGridMockContext } from './utils/context';
12
+ var gridComponentPropsSystem = /*#__PURE__*/ u.system(function () {
13
+ var itemContent = u.statefulStream(function (index) { return "Item " + index; });
14
+ var components = u.statefulStream({});
15
+ var context = u.statefulStream(null);
16
+ var itemClassName = u.statefulStream('virtuoso-grid-item');
17
+ var listClassName = u.statefulStream('virtuoso-grid-list');
18
+ var computeItemKey = u.statefulStream(identity);
19
+ var headerFooterTag = u.statefulStream('div');
20
+ var scrollerRef = u.statefulStream(u.noop);
21
+ var distinctProp = function (propName, defaultValue) {
22
+ if (defaultValue === void 0) { defaultValue = null; }
23
+ return u.statefulStreamFromEmitter(u.pipe(components, u.map(function (components) { return components[propName]; }), u.distinctUntilChanged()), defaultValue);
24
+ };
25
+ return {
26
+ context: context,
27
+ itemContent: itemContent,
28
+ components: components,
29
+ computeItemKey: computeItemKey,
30
+ itemClassName: itemClassName,
31
+ listClassName: listClassName,
32
+ headerFooterTag: headerFooterTag,
33
+ scrollerRef: scrollerRef,
34
+ FooterComponent: distinctProp('Footer'),
35
+ HeaderComponent: distinctProp('Header'),
36
+ ListComponent: distinctProp('List', 'div'),
37
+ ItemComponent: distinctProp('Item', 'div'),
38
+ ScrollerComponent: distinctProp('Scroller', 'div'),
39
+ ScrollSeekPlaceholder: distinctProp('ScrollSeekPlaceholder', 'div'),
40
+ };
41
+ });
42
+ var combinedSystem = /*#__PURE__*/ u.system(function (_a) {
43
+ var _b = __read(_a, 2), gridSystem = _b[0], gridComponentPropsSystem = _b[1];
44
+ return __assign(__assign({}, gridSystem), gridComponentPropsSystem);
45
+ }, u.tup(gridSystem, gridComponentPropsSystem));
46
+ var GridItems = React.memo(function GridItems() {
47
+ var gridState = useEmitterValue('gridState');
48
+ var listClassName = useEmitterValue('listClassName');
49
+ var itemClassName = useEmitterValue('itemClassName');
50
+ var itemContent = useEmitterValue('itemContent');
51
+ var computeItemKey = useEmitterValue('computeItemKey');
52
+ var isSeeking = useEmitterValue('isSeeking');
53
+ var scrollHeightCallback = usePublisher('scrollHeight');
54
+ var ItemComponent = useEmitterValue('ItemComponent');
55
+ var ListComponent = useEmitterValue('ListComponent');
56
+ var ScrollSeekPlaceholder = useEmitterValue('ScrollSeekPlaceholder');
57
+ var context = useEmitterValue('context');
58
+ var itemDimensions = usePublisher('itemDimensions');
59
+ var gridGap = usePublisher('gap');
60
+ var log = useEmitterValue('log');
61
+ var stateRestoreInProgress = useEmitterValue('stateRestoreInProgress');
62
+ var listRef = useSize(function (el) {
63
+ var scrollHeight = el.parentElement.parentElement.scrollHeight;
64
+ scrollHeightCallback(scrollHeight);
65
+ var firstItem = el.firstChild;
66
+ if (firstItem) {
67
+ var _a = firstItem.getBoundingClientRect(), width = _a.width, height = _a.height;
68
+ itemDimensions({ width: width, height: height });
69
+ }
70
+ gridGap({
71
+ row: resolveGapValue('row-gap', getComputedStyle(el).rowGap, log),
72
+ column: resolveGapValue('column-gap', getComputedStyle(el).columnGap, log),
73
+ });
74
+ });
75
+ if (stateRestoreInProgress) {
76
+ return null;
77
+ }
78
+ // console.log('rendering items', gridState.items)
79
+ return React.createElement(ListComponent, __assign(__assign({ ref: listRef, className: listClassName }, contextPropIfNotDomElement(ListComponent, context)), { style: { paddingTop: gridState.offsetTop, paddingBottom: gridState.offsetBottom }, 'data-test-id': 'virtuoso-item-list' }), gridState.items.map(function (item) {
80
+ var key = computeItemKey(item.index, item.data, context);
81
+ return isSeeking
82
+ ? React.createElement(ScrollSeekPlaceholder, __assign(__assign({ key: key }, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { index: item.index, height: gridState.itemHeight, width: gridState.itemWidth }))
83
+ : React.createElement(ItemComponent, __assign(__assign({}, contextPropIfNotDomElement(ItemComponent, context)), { className: itemClassName, 'data-index': item.index, key: key }), itemContent(item.index, item.data, context));
84
+ }));
85
+ });
86
+ var Header = React.memo(function VirtuosoHeader() {
87
+ var Header = useEmitterValue('HeaderComponent');
88
+ var headerHeight = usePublisher('headerHeight');
89
+ var headerFooterTag = useEmitterValue('headerFooterTag');
90
+ var ref = useSize(function (el) { return headerHeight(correctItemSize(el, 'height')); });
91
+ var context = useEmitterValue('context');
92
+ return Header
93
+ ? React.createElement(headerFooterTag, { ref: ref }, React.createElement(Header, contextPropIfNotDomElement(Header, context)))
94
+ : null;
95
+ });
96
+ var Footer = React.memo(function VirtuosoGridFooter() {
97
+ var Footer = useEmitterValue('FooterComponent');
98
+ var footerHeight = usePublisher('footerHeight');
99
+ var headerFooterTag = useEmitterValue('headerFooterTag');
100
+ var ref = useSize(function (el) { return footerHeight(correctItemSize(el, 'height')); });
101
+ var context = useEmitterValue('context');
102
+ return Footer
103
+ ? React.createElement(headerFooterTag, { ref: ref }, React.createElement(Footer, contextPropIfNotDomElement(Footer, context)))
104
+ : null;
105
+ });
106
+ var Viewport = function (_a) {
107
+ var children = _a.children;
108
+ var ctx = React.useContext(VirtuosoGridMockContext);
109
+ var itemDimensions = usePublisher('itemDimensions');
110
+ var viewportDimensions = usePublisher('viewportDimensions');
111
+ var viewportRef = useSize(function (el) {
112
+ viewportDimensions(el.getBoundingClientRect());
113
+ });
114
+ React.useEffect(function () {
115
+ if (ctx) {
116
+ viewportDimensions({ height: ctx.viewportHeight, width: ctx.viewportWidth });
117
+ itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
118
+ }
119
+ }, [ctx, viewportDimensions, itemDimensions]);
120
+ return (React.createElement("div", { style: viewportStyle, ref: viewportRef }, children));
121
+ };
122
+ var WindowViewport = function (_a) {
123
+ var children = _a.children;
124
+ var ctx = React.useContext(VirtuosoGridMockContext);
125
+ var windowViewportRect = usePublisher('windowViewportRect');
126
+ var itemDimensions = usePublisher('itemDimensions');
127
+ var customScrollParent = useEmitterValue('customScrollParent');
128
+ var viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
129
+ React.useEffect(function () {
130
+ if (ctx) {
131
+ itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
132
+ windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: ctx.viewportWidth });
133
+ }
134
+ }, [ctx, windowViewportRect, itemDimensions]);
135
+ return (React.createElement("div", { ref: viewportRef, style: viewportStyle }, children));
136
+ };
137
+ var GridRoot = React.memo(function GridRoot(_a) {
138
+ var props = __rest(_a, []);
139
+ var useWindowScroll = useEmitterValue('useWindowScroll');
140
+ var customScrollParent = useEmitterValue('customScrollParent');
141
+ var TheScroller = customScrollParent || useWindowScroll ? WindowScroller : Scroller;
142
+ var TheViewport = customScrollParent || useWindowScroll ? WindowViewport : Viewport;
143
+ return (React.createElement(TheScroller, __assign({}, props),
144
+ React.createElement(TheViewport, null,
145
+ React.createElement(Header, null),
146
+ React.createElement(GridItems, null),
147
+ React.createElement(Footer, null))));
148
+ });
149
+ var _a = systemToComponent(combinedSystem, {
150
+ optional: {
151
+ context: 'context',
152
+ totalCount: 'totalCount',
153
+ overscan: 'overscan',
154
+ itemContent: 'itemContent',
155
+ components: 'components',
156
+ computeItemKey: 'computeItemKey',
157
+ data: 'data',
158
+ initialItemCount: 'initialItemCount',
159
+ scrollSeekConfiguration: 'scrollSeekConfiguration',
160
+ headerFooterTag: 'headerFooterTag',
161
+ listClassName: 'listClassName',
162
+ itemClassName: 'itemClassName',
163
+ useWindowScroll: 'useWindowScroll',
164
+ customScrollParent: 'customScrollParent',
165
+ scrollerRef: 'scrollerRef',
166
+ logLevel: 'logLevel',
167
+ restoreStateFrom: 'restoreStateFrom',
168
+ initialTopMostItemIndex: 'initialTopMostItemIndex',
169
+ },
170
+ methods: {
171
+ scrollTo: 'scrollTo',
172
+ scrollBy: 'scrollBy',
173
+ scrollToIndex: 'scrollToIndex',
174
+ },
175
+ events: {
176
+ isScrolling: 'isScrolling',
177
+ endReached: 'endReached',
178
+ startReached: 'startReached',
179
+ rangeChanged: 'rangeChanged',
180
+ atBottomStateChange: 'atBottomStateChange',
181
+ atTopStateChange: 'atTopStateChange',
182
+ stateChanged: 'stateChanged',
183
+ },
184
+ }, GridRoot), Grid = _a.Component, usePublisher = _a.usePublisher, useEmitterValue = _a.useEmitterValue, useEmitter = _a.useEmitter;
185
+ // Fix
186
+ export { Grid };
187
+ var Scroller = /*#__PURE__*/ buildScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
188
+ var WindowScroller = /*#__PURE__*/ buildWindowScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
189
+ function resolveGapValue(property, value, log) {
190
+ if (value !== 'normal' && !(value === null || value === void 0 ? void 0 : value.endsWith('px'))) {
191
+ log(property + " was not resolved to pixel value correctly", value, LogLevel.WARN);
192
+ }
193
+ if (value === 'normal') {
194
+ return 0;
195
+ }
196
+ return parseInt(value !== null && value !== void 0 ? value : '0', 10);
197
+ }
198
+ export var VirtuosoGrid = Grid;
@@ -1,7 +1,7 @@
1
1
  import { __read } from "tslib";
2
- import * as u from '@virtuoso.dev/urx';
3
- import { domIOSystem } from './domIOSystem';
2
+ import * as u from './urx';
4
3
  import { totalListHeightSystem } from './totalListHeightSystem';
4
+ import { domIOSystem } from './domIOSystem';
5
5
  export var alignToBottomSystem = u.system(function (_a) {
6
6
  var _b = __read(_a, 2), viewportHeight = _b[0].viewportHeight, totalListHeight = _b[1].totalListHeight;
7
7
  var alignToBottom = u.statefulStream(false);
@@ -11,6 +11,6 @@ export var alignToBottomSystem = u.system(function (_a) {
11
11
  }), u.map(function (_a) {
12
12
  var _b = __read(_a, 3), viewportHeight = _b[1], totalListHeight = _b[2];
13
13
  return Math.max(0, viewportHeight - totalListHeight);
14
- }), u.distinctUntilChanged()), 0);
14
+ }), u.throttleTime(0), u.distinctUntilChanged()), 0);
15
15
  return { alignToBottom: alignToBottom, paddingTopAddition: paddingTopAddition };
16
16
  }, u.tup(domIOSystem, totalListHeightSystem), { singleton: true });
@@ -2,7 +2,5 @@ export function tupleComparator(prev, current) {
2
2
  return !!(prev && prev[0] === current[0] && prev[1] === current[1]);
3
3
  }
4
4
  export function rangeComparator(prev, next) {
5
- return !!(prev &&
6
- prev.startIndex === next.startIndex &&
7
- prev.endIndex === next.endIndex);
5
+ return !!(prev && prev.startIndex === next.startIndex && prev.endIndex === next.endIndex);
8
6
  }