@ringcentral/juno 2.4.1 → 2.5.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 (145) hide show
  1. package/components/Buttons/IconButton/IconButton.d.ts +6 -2
  2. package/components/Buttons/IconButton/IconButton.js +9 -7
  3. package/components/Buttons/IconButton/styles/StyledIconButton.js +15 -7
  4. package/components/Buttons/IconButton/utils/IconButtonUtils.d.ts +1 -1
  5. package/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
  6. package/components/Dialer/DialPad/DialPad.d.ts +25 -7
  7. package/components/Dialer/DialPad/DialPad.js +6 -6
  8. package/components/Dialer/DialPad/utils/useDialKeyboard.d.ts +8 -9
  9. package/components/Dialer/DialTextField/DialTextField.d.ts +3 -1
  10. package/components/Dialer/DialTextField/DialTextField.js +7 -6
  11. package/components/Downshift/SuggestionList/SuggestionList.d.ts +74 -2
  12. package/components/Downshift/SuggestionList/SuggestionList.js +4 -1
  13. package/components/Downshift/styles/DownshiftStyle.d.ts +1 -1
  14. package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.d.ts +1 -1
  15. package/components/Forms/Picker/DatePicker/styles/StyledYear.d.ts +1 -1
  16. package/components/Forms/Picker/TimePicker/styles/StyledSelectionItem.d.ts +1 -1
  17. package/components/Forms/Picker/TimePicker/styles/StyledTimeIconButton.d.ts +1 -1
  18. package/components/Forms/Picker/styles/PickerBaseIconButton.d.ts +1 -1
  19. package/components/Forms/TextField/styles/ClearIconButton.d.ts +2 -2
  20. package/components/Grid/Grid.d.ts +1 -1
  21. package/components/Pagination/Pagination/Pagination.d.ts +1 -1
  22. package/components/Stepper/StepButton/StepButton.d.ts +1 -1
  23. package/components/Stepper/StepLabel/StepLabel.d.ts +1 -1
  24. package/components/Table/TableCell/styles/TableCellStyle.js +3 -1
  25. package/components/Table/types.d.ts +1 -1
  26. package/components/TablePagination/TablePagination.d.ts +1 -1
  27. package/components/VirtualizedMenu/VirtualizedMenu.js +11 -0
  28. package/components/VirtualizedMenu/VirtualizedMenuList.js +7 -14
  29. package/components/Virtuoso/react-virtuoso/AATree.js +15 -15
  30. package/components/Virtuoso/react-virtuoso/Grid.d.ts +193 -106
  31. package/components/Virtuoso/react-virtuoso/Grid.js +19 -24
  32. package/components/Virtuoso/react-virtuoso/List.d.ts +2664 -596
  33. package/components/Virtuoso/react-virtuoso/List.js +83 -70
  34. package/components/Virtuoso/react-virtuoso/Table.d.ts +6253 -0
  35. package/components/Virtuoso/react-virtuoso/Table.js +184 -0
  36. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +153 -37
  37. package/components/Virtuoso/react-virtuoso/components.d.ts +248 -41
  38. package/components/Virtuoso/react-virtuoso/components.js +2 -0
  39. package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +2 -4
  40. package/components/Virtuoso/react-virtuoso/domIOSystem.js +12 -10
  41. package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +146 -27
  42. package/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
  43. package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +67 -52
  44. package/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
  45. package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +17 -3
  46. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +2 -1
  47. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +32 -7
  48. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +1 -1
  49. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
  50. package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -2
  51. package/components/Virtuoso/react-virtuoso/hooks/useSize.js +26 -28
  52. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.d.ts +1 -1
  53. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
  54. package/components/Virtuoso/react-virtuoso/index.d.ts +1 -0
  55. package/components/Virtuoso/react-virtuoso/index.js +2 -0
  56. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +165 -35
  57. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
  58. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +160 -38
  59. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +54 -12
  60. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +26 -10
  61. package/components/Virtuoso/react-virtuoso/interfaces.d.ts +134 -28
  62. package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +141 -32
  63. package/components/Virtuoso/react-virtuoso/listStateSystem.js +1 -2
  64. package/components/Virtuoso/react-virtuoso/listSystem.d.ts +2123 -407
  65. package/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
  66. package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +17 -0
  67. package/components/Virtuoso/react-virtuoso/loggerSystem.js +37 -0
  68. package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +8 -1
  69. package/components/Virtuoso/react-virtuoso/propsReadySystem.js +8 -2
  70. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +641 -0
  71. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +42 -0
  72. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +52 -67
  73. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
  74. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +26 -5
  75. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
  76. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +11 -4
  77. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +44 -15
  78. package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +12 -2
  79. package/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
  80. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +17 -5
  81. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
  82. package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +145 -33
  83. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +149 -35
  84. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +183 -42
  85. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +37 -26
  86. package/components/Virtuoso/react-virtuoso/utils/correctItemSize.d.ts +1 -0
  87. package/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +6 -0
  88. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +7 -4
  89. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
  90. package/components/Virtuoso/utils/useHighlightScroll.d.ts +4 -0
  91. package/components/Virtuoso/utils/useHighlightScroll.js +17 -0
  92. package/es6/components/Buttons/IconButton/IconButton.js +11 -9
  93. package/es6/components/Buttons/IconButton/styles/StyledIconButton.js +16 -8
  94. package/es6/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
  95. package/es6/components/Dialer/DialPad/DialPad.js +6 -6
  96. package/es6/components/Dialer/DialTextField/DialTextField.js +7 -6
  97. package/es6/components/Downshift/SuggestionList/SuggestionList.js +5 -2
  98. package/es6/components/Table/TableCell/TableCell.js +2 -2
  99. package/es6/components/Table/TableCell/styles/TableCellStyle.js +3 -1
  100. package/es6/components/VirtualizedMenu/VirtualizedMenu.js +13 -2
  101. package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -16
  102. package/es6/components/Virtuoso/react-virtuoso/AATree.js +15 -15
  103. package/es6/components/Virtuoso/react-virtuoso/Grid.js +20 -25
  104. package/es6/components/Virtuoso/react-virtuoso/List.js +84 -72
  105. package/es6/components/Virtuoso/react-virtuoso/Table.js +182 -0
  106. package/es6/components/Virtuoso/react-virtuoso/components.js +2 -0
  107. package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +13 -10
  108. package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
  109. package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
  110. package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +31 -6
  111. package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
  112. package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +27 -29
  113. package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
  114. package/es6/components/Virtuoso/react-virtuoso/index.js +1 -0
  115. package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
  116. package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +25 -10
  117. package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +2 -3
  118. package/es6/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
  119. package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +34 -0
  120. package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +9 -2
  121. package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +40 -0
  122. package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
  123. package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
  124. package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +39 -11
  125. package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
  126. package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
  127. package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +39 -28
  128. package/es6/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +3 -0
  129. package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
  130. package/es6/components/Virtuoso/utils/useHighlightScroll.js +16 -0
  131. package/es6/foundation/hooks/useLongPress/useLongPress.js +7 -7
  132. package/es6/foundation/index.js +1 -1
  133. package/es6/foundation/isWebKit154.js +57 -0
  134. package/es6/foundation/theme/ThemeProvider.js +4 -4
  135. package/foundation/hooks/useLongPress/useLongPress.d.ts +3 -1
  136. package/foundation/hooks/useLongPress/useLongPress.js +7 -7
  137. package/foundation/index.d.ts +1 -1
  138. package/foundation/index.js +1 -1
  139. package/foundation/isWebKit154.d.ts +20 -0
  140. package/foundation/{isSafari154.js → isWebKit154.js} +22 -17
  141. package/foundation/theme/ThemeProvider.d.ts +1 -1
  142. package/foundation/theme/ThemeProvider.js +4 -4
  143. package/package.json +2 -2
  144. package/es6/foundation/isSafari154.js +0 -52
  145. package/foundation/isSafari154.d.ts +0 -15
@@ -2,18 +2,18 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  var tslib_1 = require("tslib");
5
+ /* eslint-disable no-console */
5
6
  var React = tslib_1.__importStar(require("react"));
6
7
  var react_1 = require("react");
7
- /* eslint-disable no-console */
8
8
  var react_urx_1 = require("@virtuoso.dev/react-urx");
9
9
  var urx_1 = require("@virtuoso.dev/urx");
10
- var foundation_1 = require("../../../foundation");
11
10
  var useChangedChildSizes_1 = tslib_1.__importDefault(require("./hooks/useChangedChildSizes"));
12
11
  var useIsomorphicLayoutEffect_1 = tslib_1.__importDefault(require("./hooks/useIsomorphicLayoutEffect"));
13
12
  var useScrollTop_1 = tslib_1.__importDefault(require("./hooks/useScrollTop"));
14
13
  var useSize_1 = tslib_1.__importDefault(require("./hooks/useSize"));
15
14
  var useWindowViewportRect_1 = tslib_1.__importDefault(require("./hooks/useWindowViewportRect"));
16
15
  var listSystem_1 = require("./listSystem");
16
+ var correctItemSize_1 = require("./utils/correctItemSize");
17
17
  var positionStickyCssValue_1 = require("./utils/positionStickyCssValue");
18
18
  function identity(value) {
19
19
  return value;
@@ -21,6 +21,7 @@ function identity(value) {
21
21
  exports.identity = identity;
22
22
  var listComponentPropsSystem = urx_1.system(function () {
23
23
  var itemContent = urx_1.statefulStream(function (index) { return "Item " + index; });
24
+ var context = urx_1.statefulStream(null);
24
25
  var groupContent = urx_1.statefulStream(function (index) { return "Group " + index; });
25
26
  var components = urx_1.statefulStream({});
26
27
  var computeItemKey = urx_1.statefulStream(identity);
@@ -31,6 +32,7 @@ var listComponentPropsSystem = urx_1.system(function () {
31
32
  return urx_1.statefulStreamFromEmitter(urx_1.pipe(components, urx_1.map(function (components) { return components[propName]; }), urx_1.distinctUntilChanged()), defaultValue);
32
33
  };
33
34
  return {
35
+ context: context,
34
36
  itemContent: itemContent,
35
37
  groupContent: groupContent,
36
38
  components: components,
@@ -119,17 +121,30 @@ var DefaultScrollSeekPlaceholder = function (_a) {
119
121
  var height = _a.height;
120
122
  return (React.createElement("div", { style: { height: height } }));
121
123
  };
122
- var GROUP_STYLE = { position: positionStickyCssValue_1.positionStickyCssValue(), zIndex: 1 };
124
+ var GROUP_STYLE = {
125
+ position: positionStickyCssValue_1.positionStickyCssValue(),
126
+ zIndex: 1,
127
+ overflowAnchor: 'none',
128
+ };
123
129
  exports.Items = React.memo(function VirtuosoItems(_a) {
124
130
  var _b = _a.showTopList, showTopList = _b === void 0 ? false : _b;
125
131
  var listState = exports.useEmitterValue('listState');
126
132
  var deviation = exports.useEmitterValue('deviation');
127
133
  var sizeRanges = exports.usePublisher('sizeRanges');
134
+ var useWindowScroll = exports.useEmitterValue('useWindowScroll');
135
+ var customScrollParent = exports.useEmitterValue('customScrollParent');
136
+ var windowScrollContainerStateCallback = exports.usePublisher('windowScrollContainerState');
137
+ var _scrollContainerStateCallback = exports.usePublisher('scrollContainerState');
138
+ var scrollContainerStateCallback = customScrollParent || useWindowScroll
139
+ ? windowScrollContainerStateCallback
140
+ : _scrollContainerStateCallback;
128
141
  var itemContent = exports.useEmitterValue('itemContent');
142
+ var context = exports.useEmitterValue('context');
129
143
  var groupContent = exports.useEmitterValue('groupContent');
130
144
  var trackItemSizes = exports.useEmitterValue('trackItemSizes');
131
145
  var itemSize = exports.useEmitterValue('itemSize');
132
- var ref = useChangedChildSizes_1.default(sizeRanges, itemSize, trackItemSizes);
146
+ var log = exports.useEmitterValue('log');
147
+ var ref = useChangedChildSizes_1.default(sizeRanges, itemSize, trackItemSizes, showTopList ? urx_1.noop : scrollContainerStateCallback, log, customScrollParent);
133
148
  var EmptyPlaceholder = exports.useEmitterValue('EmptyPlaceholder');
134
149
  var ScrollSeekPlaceholder = exports.useEmitterValue('ScrollSeekPlaceholder') || DefaultScrollSeekPlaceholder;
135
150
  var ListComponent = exports.useEmitterValue('ListComponent');
@@ -139,8 +154,8 @@ exports.Items = React.memo(function VirtuosoItems(_a) {
139
154
  var isSeeking = exports.useEmitterValue('isSeeking');
140
155
  var hasGroups = exports.useEmitterValue('groupIndices').length > 0;
141
156
  var paddingTopAddition = exports.useEmitterValue('paddingTopAddition');
142
- var scrolledToInitialItem = exports.useEmitterValue('scrolledToInitialItem');
143
- // const calculatedHeight = listState.offsetBottom + listState.bottom
157
+ var firstItemIndex = exports.useEmitterValue('firstItemIndex');
158
+ var statefulTotalCount = exports.useEmitterValue('statefulTotalCount');
144
159
  var containerStyle = showTopList
145
160
  ? {}
146
161
  : {
@@ -149,40 +164,23 @@ exports.Items = React.memo(function VirtuosoItems(_a) {
149
164
  paddingBottom: listState.offsetBottom,
150
165
  marginTop: deviation,
151
166
  };
152
- if (!showTopList &&
153
- listState.items.length === 0 &&
154
- EmptyPlaceholder &&
155
- scrolledToInitialItem) {
156
- return react_1.createElement(EmptyPlaceholder);
167
+ if (!showTopList && statefulTotalCount === 0 && EmptyPlaceholder) {
168
+ return react_1.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
157
169
  }
158
- return react_1.createElement(ListComponent, { ref: ref, style: containerStyle }, (showTopList ? listState.topItems : listState.items).map(function (item) {
170
+ return react_1.createElement(ListComponent, tslib_1.__assign(tslib_1.__assign({}, contextPropIfNotDomElement(ListComponent, context)), { ref: ref, style: containerStyle, 'data-test-id': showTopList
171
+ ? 'virtuoso-top-item-list'
172
+ : 'virtuoso-item-list' }), (showTopList ? listState.topItems : listState.items).map(function (item) {
159
173
  var index = item.originalIndex;
160
- var key = computeItemKey(index);
174
+ var key = computeItemKey(index + firstItemIndex, item.data, context);
161
175
  if (isSeeking) {
162
- return react_1.createElement(ScrollSeekPlaceholder, {
163
- key: key,
164
- index: item.index,
165
- height: item.size,
166
- });
176
+ return react_1.createElement(ScrollSeekPlaceholder, tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { key: key, index: item.index, height: item.size, type: item.type || 'item' }), (item.type === 'group' ? {} : { groupIndex: item.groupIndex })));
167
177
  }
168
178
  if (item.type === 'group') {
169
- return react_1.createElement(GroupComponent, {
170
- key: key,
171
- 'data-index': index,
172
- 'data-known-size': item.size,
173
- 'data-item-index': item.index,
174
- style: GROUP_STYLE,
175
- }, groupContent(item.index));
179
+ return react_1.createElement(GroupComponent, tslib_1.__assign(tslib_1.__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));
176
180
  }
177
- return react_1.createElement(ItemComponent, {
178
- key: key,
179
- 'data-index': index,
180
- 'data-known-size': item.size,
181
- 'data-item-index': item.index,
182
- 'data-item-group-index': item.groupIndex,
183
- }, hasGroups
184
- ? itemContent(item.index, item.groupIndex, item.data)
185
- : itemContent(item.index, item.data));
181
+ return react_1.createElement(ItemComponent, tslib_1.__assign(tslib_1.__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: { overflowAnchor: 'none' } }), hasGroups
182
+ ? itemContent(item.index, item.groupIndex, item.data, context)
183
+ : itemContent(item.index, item.data, context));
186
184
  }));
187
185
  });
188
186
  exports.scrollerStyle = {
@@ -203,58 +201,73 @@ var topItemListStyle = {
203
201
  position: positionStickyCssValue_1.positionStickyCssValue(),
204
202
  top: 0,
205
203
  };
204
+ function contextPropIfNotDomElement(element, context) {
205
+ if (typeof element === 'string') {
206
+ return undefined;
207
+ }
208
+ return { context: context };
209
+ }
210
+ exports.contextPropIfNotDomElement = contextPropIfNotDomElement;
206
211
  var Header = React.memo(function VirtuosoHeader() {
207
212
  var Header = exports.useEmitterValue('HeaderComponent');
208
213
  var headerHeight = exports.usePublisher('headerHeight');
209
214
  var headerFooterTag = exports.useEmitterValue('headerFooterTag');
210
- var ref = useSize_1.default(function (el) { return headerHeight(el.offsetHeight); });
215
+ var ref = useSize_1.default(function (el) { return headerHeight(correctItemSize_1.correctItemSize(el, 'height')); });
216
+ var context = exports.useEmitterValue('context');
211
217
  return Header
212
- ? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Header))
218
+ ? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Header, contextPropIfNotDomElement(Header, context)))
213
219
  : null;
214
220
  });
215
221
  var Footer = React.memo(function VirtuosoFooter() {
216
222
  var Footer = exports.useEmitterValue('FooterComponent');
217
223
  var footerHeight = exports.usePublisher('footerHeight');
218
224
  var headerFooterTag = exports.useEmitterValue('headerFooterTag');
219
- var ref = useSize_1.default(function (el) { return footerHeight(el.offsetHeight); });
225
+ var ref = useSize_1.default(function (el) { return footerHeight(correctItemSize_1.correctItemSize(el, 'height')); });
226
+ var context = exports.useEmitterValue('context');
220
227
  return Footer
221
- ? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Footer))
228
+ ? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Footer, contextPropIfNotDomElement(Footer, context)))
222
229
  : null;
223
230
  });
224
231
  function buildScroller(_a) {
225
- var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue, customWindow = _a.window;
232
+ var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue;
226
233
  var Scroller = React.memo(function VirtuosoScroller(_a) {
227
234
  var style = _a.style, children = _a.children, props = tslib_1.__rest(_a, ["style", "children"]);
228
- var scrollTopCallback = usePublisher('scrollTop');
235
+ var scrollContainerStateCallback = usePublisher('scrollContainerState');
229
236
  var ScrollerComponent = useEmitterValue('ScrollerComponent');
230
237
  var smoothScrollTargetReached = usePublisher('smoothScrollTargetReached');
231
238
  var scrollerRefCallback = useEmitterValue('scrollerRef');
232
- var _b = useScrollTop_1.default(scrollTopCallback, smoothScrollTargetReached, ScrollerComponent, scrollerRefCallback, customWindow), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
239
+ var context = useEmitterValue('context');
240
+ var _b = useScrollTop_1.default(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, scrollerRefCallback), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
233
241
  useEmitter('scrollTo', scrollToCallback);
234
242
  useEmitter('scrollBy', scrollByCallback);
235
- return react_1.createElement(ScrollerComponent, tslib_1.__assign({ ref: scrollerRef, style: tslib_1.__assign(tslib_1.__assign({}, exports.scrollerStyle), style), tabIndex: 0 }, props), children);
243
+ return react_1.createElement(ScrollerComponent, tslib_1.__assign(tslib_1.__assign({ ref: scrollerRef, style: tslib_1.__assign(tslib_1.__assign({}, exports.scrollerStyle), style), 'data-test-id': 'virtuoso-scroller', 'data-virtuoso-scroller': true, tabIndex: 0 }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
236
244
  });
237
245
  return Scroller;
238
246
  }
239
247
  exports.buildScroller = buildScroller;
240
248
  function buildWindowScroller(_a) {
241
- var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue, customWindow = _a.window;
249
+ var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue;
242
250
  var Scroller = React.memo(function VirtuosoWindowScroller(_a) {
243
251
  var style = _a.style, children = _a.children, props = tslib_1.__rest(_a, ["style", "children"]);
244
- var scrollTopCallback = usePublisher('windowScrollTop');
252
+ var scrollContainerStateCallback = usePublisher('windowScrollContainerState');
245
253
  var ScrollerComponent = useEmitterValue('ScrollerComponent');
246
254
  var smoothScrollTargetReached = usePublisher('smoothScrollTargetReached');
247
255
  var totalListHeight = useEmitterValue('totalListHeight');
248
- var _b = useScrollTop_1.default(scrollTopCallback, smoothScrollTargetReached, ScrollerComponent, undefined, customWindow), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
256
+ var deviation = useEmitterValue('deviation');
257
+ var customScrollParent = useEmitterValue('customScrollParent');
258
+ var context = useEmitterValue('context');
259
+ var _b = useScrollTop_1.default(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, urx_1.noop, customScrollParent), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
249
260
  useIsomorphicLayoutEffect_1.default(function () {
250
- scrollerRef.current = window;
261
+ scrollerRef.current = customScrollParent ? customScrollParent : window;
251
262
  return function () {
252
263
  scrollerRef.current = null;
253
264
  };
254
- }, [scrollerRef]);
265
+ }, [scrollerRef, customScrollParent]);
255
266
  useEmitter('windowScrollTo', scrollToCallback);
256
267
  useEmitter('scrollBy', scrollByCallback);
257
- return react_1.createElement(ScrollerComponent, tslib_1.__assign({ style: tslib_1.__assign(tslib_1.__assign({ position: 'relative' }, style), (totalListHeight !== 0 ? { height: totalListHeight } : {})) }, props), children);
268
+ return react_1.createElement(ScrollerComponent, tslib_1.__assign(tslib_1.__assign({ style: tslib_1.__assign(tslib_1.__assign({ position: 'relative' }, style), (totalListHeight !== 0
269
+ ? { height: totalListHeight + deviation }
270
+ : {})), 'data-virtuoso-scroller': true }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
258
271
  });
259
272
  return Scroller;
260
273
  }
@@ -262,31 +275,30 @@ exports.buildWindowScroller = buildWindowScroller;
262
275
  var Viewport = function (_a) {
263
276
  var children = _a.children;
264
277
  var viewportHeight = exports.usePublisher('viewportHeight');
265
- var viewportRef = useSize_1.default(urx_1.compose(viewportHeight, urx_1.prop('offsetHeight')));
266
- return (React.createElement("div", { style: exports.viewportStyle, ref: viewportRef }, children));
278
+ var viewportRef = useSize_1.default(urx_1.compose(viewportHeight, function (el) { return correctItemSize_1.correctItemSize(el, 'height'); }));
279
+ return (React.createElement("div", { style: exports.viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children));
267
280
  };
268
281
  var WindowViewport = function (_a) {
269
282
  var children = _a.children;
270
283
  var windowViewportRect = exports.usePublisher('windowViewportRect');
271
- var externalWindow = foundation_1.useRcPortalWindowContext().externalWindow;
272
- var viewportRef = useWindowViewportRect_1.default(windowViewportRect, externalWindow);
273
- return (React.createElement("div", { ref: viewportRef, style: exports.viewportStyle }, children));
284
+ var customScrollParent = exports.useEmitterValue('customScrollParent');
285
+ var viewportRef = useWindowViewportRect_1.default(windowViewportRect, customScrollParent);
286
+ return (React.createElement("div", { ref: viewportRef, style: exports.viewportStyle, "data-viewport-type": "window" }, children));
274
287
  };
275
288
  var TopItemListContainer = function (_a) {
276
289
  var children = _a.children;
277
290
  var TopItemList = exports.useEmitterValue('TopItemListComponent');
278
291
  var headerHeight = exports.useEmitterValue('headerHeight');
279
292
  var style = tslib_1.__assign(tslib_1.__assign({}, topItemListStyle), { marginTop: headerHeight + "px" });
280
- return react_1.createElement(TopItemList || 'div', { style: style }, children);
293
+ var context = exports.useEmitterValue('context');
294
+ return react_1.createElement(TopItemList || 'div', { style: style, context: context }, children);
281
295
  };
282
296
  var ListRoot = React.memo(function VirtuosoRoot(props) {
283
297
  var useWindowScroll = exports.useEmitterValue('useWindowScroll');
284
298
  var showTopList = exports.useEmitterValue('topItemsIndexes').length > 0;
285
- var externalWindow = foundation_1.useRcPortalWindowContext().externalWindow;
286
- var TheScroller = React.useMemo(function () {
287
- return (useWindowScroll ? createWindowScroller : createScroller)(externalWindow || window);
288
- }, [externalWindow, useWindowScroll]);
289
- var TheViewport = useWindowScroll ? WindowViewport : Viewport;
299
+ var customScrollParent = exports.useEmitterValue('customScrollParent');
300
+ var TheScroller = customScrollParent || useWindowScroll ? WindowScroller : Scroller;
301
+ var TheViewport = customScrollParent || useWindowScroll ? WindowViewport : Viewport;
290
302
  return (React.createElement(TheScroller, tslib_1.__assign({}, props),
291
303
  React.createElement(TheViewport, null,
292
304
  React.createElement(Header, null),
@@ -298,16 +310,19 @@ var ListRoot = React.memo(function VirtuosoRoot(props) {
298
310
  exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
299
311
  required: {},
300
312
  optional: {
313
+ context: 'context',
301
314
  followOutput: 'followOutput',
302
315
  firstItemIndex: 'firstItemIndex',
303
316
  itemContent: 'itemContent',
304
317
  groupContent: 'groupContent',
305
318
  overscan: 'overscan',
319
+ increaseViewportBy: 'increaseViewportBy',
306
320
  totalCount: 'totalCount',
307
321
  topItemCount: 'topItemCount',
308
322
  initialTopMostItemIndex: 'initialTopMostItemIndex',
309
323
  components: 'components',
310
324
  groupCounts: 'groupCounts',
325
+ atBottomThreshold: 'atBottomThreshold',
311
326
  computeItemKey: 'computeItemKey',
312
327
  defaultItemHeight: 'defaultItemHeight',
313
328
  fixedItemHeight: 'fixedItemHeight',
@@ -319,7 +334,9 @@ exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
319
334
  initialScrollTop: 'initialScrollTop',
320
335
  alignToBottom: 'alignToBottom',
321
336
  useWindowScroll: 'useWindowScroll',
337
+ customScrollParent: 'customScrollParent',
322
338
  scrollerRef: 'scrollerRef',
339
+ logLevel: 'logLevel',
323
340
  // deprecated
324
341
  item: 'item',
325
342
  group: 'group',
@@ -340,6 +357,7 @@ exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
340
357
  },
341
358
  methods: {
342
359
  scrollToIndex: 'scrollToIndex',
360
+ scrollIntoView: 'scrollIntoView',
343
361
  scrollTo: 'scrollTo',
344
362
  scrollBy: 'scrollBy',
345
363
  adjustForPrependedItems: 'adjustForPrependedItems',
@@ -356,14 +374,9 @@ exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
356
374
  groupIndices: 'groupIndices',
357
375
  },
358
376
  }, ListRoot), _a.Component), exports.usePublisher = _a.usePublisher, exports.useEmitterValue = _a.useEmitterValue, exports.useEmitter = _a.useEmitter;
359
- var createScroller = function (window) {
360
- return buildScroller({ usePublisher: exports.usePublisher, useEmitterValue: exports.useEmitterValue, useEmitter: exports.useEmitter, window: window });
361
- };
362
- var createWindowScroller = function (window) {
363
- return buildWindowScroller({
364
- usePublisher: exports.usePublisher,
365
- useEmitterValue: exports.useEmitterValue,
366
- useEmitter: exports.useEmitter,
367
- window: window,
368
- });
369
- };
377
+ var Scroller = buildScroller({ usePublisher: exports.usePublisher, useEmitterValue: exports.useEmitterValue, useEmitter: exports.useEmitter });
378
+ var WindowScroller = buildWindowScroller({
379
+ usePublisher: exports.usePublisher,
380
+ useEmitterValue: exports.useEmitterValue,
381
+ useEmitter: exports.useEmitter,
382
+ });