@react-aria/virtualizer 3.3.7-nightly.3111 → 3.3.7
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.
- package/dist/main.js +89 -89
- package/dist/module.js +85 -85
- package/package.json +6 -6
package/dist/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
1
|
+
var $7MV0W$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $7MV0W$reactstatelyvirtualizer = require("@react-stately/virtualizer");
|
|
3
|
+
var $7MV0W$react = require("react");
|
|
4
|
+
var $7MV0W$reactdom = require("react-dom");
|
|
5
|
+
var $7MV0W$reactariai18n = require("@react-aria/i18n");
|
|
6
6
|
|
|
7
7
|
function $parcel$exportWildcard(dest, source) {
|
|
8
8
|
Object.keys(source).forEach(function(key) {
|
|
@@ -26,25 +26,25 @@ function $parcel$interopDefault(a) {
|
|
|
26
26
|
function $parcel$export(e, n, v, s) {
|
|
27
27
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
28
28
|
}
|
|
29
|
-
var $
|
|
29
|
+
var $e66fdc09badf2561$exports = {};
|
|
30
30
|
|
|
31
|
-
$parcel$export($
|
|
32
|
-
$parcel$export($
|
|
31
|
+
$parcel$export($e66fdc09badf2561$exports, "useVirtualizer", () => $e66fdc09badf2561$export$dd6d526d88b5a137);
|
|
32
|
+
$parcel$export($e66fdc09badf2561$exports, "Virtualizer", () => $e66fdc09badf2561$export$89be5a243e59c4b2);
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var $
|
|
36
|
+
var $0581d5c472ebf526$exports = {};
|
|
37
37
|
|
|
38
|
-
$parcel$export($
|
|
38
|
+
$parcel$export($0581d5c472ebf526$exports, "ScrollView", () => $0581d5c472ebf526$export$5665e3d6be6adea);
|
|
39
39
|
|
|
40
|
-
var $
|
|
40
|
+
var $e57feec0328c28a1$exports = {};
|
|
41
41
|
|
|
42
|
-
$parcel$export($
|
|
43
|
-
$parcel$export($
|
|
44
|
-
$parcel$export($
|
|
45
|
-
let $
|
|
46
|
-
function $
|
|
47
|
-
if ($
|
|
42
|
+
$parcel$export($e57feec0328c28a1$exports, "getRTLOffsetType", () => $e57feec0328c28a1$export$faf7630257ad4304);
|
|
43
|
+
$parcel$export($e57feec0328c28a1$exports, "getScrollLeft", () => $e57feec0328c28a1$export$1389d168952b34b5);
|
|
44
|
+
$parcel$export($e57feec0328c28a1$exports, "setScrollLeft", () => $e57feec0328c28a1$export$ed5fd5ffe5ab0ac);
|
|
45
|
+
let $e57feec0328c28a1$var$cachedRTLResult = null;
|
|
46
|
+
function $e57feec0328c28a1$export$faf7630257ad4304(recalculate = false) {
|
|
47
|
+
if ($e57feec0328c28a1$var$cachedRTLResult === null || recalculate) {
|
|
48
48
|
const outerDiv = document.createElement('div');
|
|
49
49
|
const outerStyle = outerDiv.style;
|
|
50
50
|
outerStyle.width = '50px';
|
|
@@ -57,24 +57,24 @@ function $57bbbd99c9e34298$export$faf7630257ad4304(recalculate = false) {
|
|
|
57
57
|
innerStyle.height = '100px';
|
|
58
58
|
outerDiv.appendChild(innerDiv);
|
|
59
59
|
document.body.appendChild(outerDiv);
|
|
60
|
-
if (outerDiv.scrollLeft > 0) $
|
|
60
|
+
if (outerDiv.scrollLeft > 0) $e57feec0328c28a1$var$cachedRTLResult = 'positive-descending';
|
|
61
61
|
else {
|
|
62
62
|
outerDiv.scrollLeft = 1;
|
|
63
|
-
if (outerDiv.scrollLeft === 0) $
|
|
64
|
-
else $
|
|
63
|
+
if (outerDiv.scrollLeft === 0) $e57feec0328c28a1$var$cachedRTLResult = 'negative';
|
|
64
|
+
else $e57feec0328c28a1$var$cachedRTLResult = 'positive-ascending';
|
|
65
65
|
}
|
|
66
66
|
document.body.removeChild(outerDiv);
|
|
67
|
-
return $
|
|
67
|
+
return $e57feec0328c28a1$var$cachedRTLResult;
|
|
68
68
|
}
|
|
69
|
-
return $
|
|
69
|
+
return $e57feec0328c28a1$var$cachedRTLResult;
|
|
70
70
|
}
|
|
71
|
-
function $
|
|
71
|
+
function $e57feec0328c28a1$export$1389d168952b34b5(node, direction) {
|
|
72
72
|
let { scrollLeft: scrollLeft } = node;
|
|
73
73
|
// scrollLeft in rtl locales differs across browsers, so normalize.
|
|
74
74
|
// See comment by getRTLOffsetType below for details.
|
|
75
75
|
if (direction === 'rtl') {
|
|
76
76
|
let { scrollWidth: scrollWidth , clientWidth: clientWidth } = node;
|
|
77
|
-
switch($
|
|
77
|
+
switch($e57feec0328c28a1$export$faf7630257ad4304()){
|
|
78
78
|
case 'negative':
|
|
79
79
|
scrollLeft = -scrollLeft;
|
|
80
80
|
break;
|
|
@@ -85,8 +85,8 @@ function $57bbbd99c9e34298$export$1389d168952b34b5(node, direction) {
|
|
|
85
85
|
}
|
|
86
86
|
return scrollLeft;
|
|
87
87
|
}
|
|
88
|
-
function $
|
|
89
|
-
if (direction === 'rtl') switch($
|
|
88
|
+
function $e57feec0328c28a1$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
|
|
89
|
+
if (direction === 'rtl') switch($e57feec0328c28a1$export$faf7630257ad4304()){
|
|
90
90
|
case 'negative':
|
|
91
91
|
scrollLeft = -scrollLeft;
|
|
92
92
|
break;
|
|
@@ -108,11 +108,11 @@ function $57bbbd99c9e34298$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
function $
|
|
111
|
+
function $0581d5c472ebf526$var$ScrollView(props, ref) {
|
|
112
112
|
let { contentSize: contentSize , onVisibleRectChange: onVisibleRectChange , children: children , innerStyle: innerStyle , sizeToFit: sizeToFit , onScrollStart: onScrollStart , onScrollEnd: onScrollEnd , scrollDirection: scrollDirection = 'both' , ...otherProps } = props;
|
|
113
|
-
let defaultRef = $
|
|
113
|
+
let defaultRef = $7MV0W$react.useRef();
|
|
114
114
|
ref = ref || defaultRef;
|
|
115
|
-
let state = $
|
|
115
|
+
let state = $7MV0W$react.useRef({
|
|
116
116
|
scrollTop: 0,
|
|
117
117
|
scrollLeft: 0,
|
|
118
118
|
scrollEndTime: 0,
|
|
@@ -121,18 +121,18 @@ function $ac16625e392cd577$var$ScrollView(props, ref) {
|
|
|
121
121
|
height: 0,
|
|
122
122
|
isScrolling: false
|
|
123
123
|
}).current;
|
|
124
|
-
let { direction: direction } = $
|
|
125
|
-
let [isScrolling, setScrolling] = $
|
|
126
|
-
let onScroll = $
|
|
124
|
+
let { direction: direction } = $7MV0W$reactariai18n.useLocale();
|
|
125
|
+
let [isScrolling, setScrolling] = $7MV0W$react.useState(false);
|
|
126
|
+
let onScroll = $7MV0W$react.useCallback((e)=>{
|
|
127
127
|
if (e.target !== e.currentTarget) return;
|
|
128
128
|
if (props.onScroll) props.onScroll(e);
|
|
129
|
-
$
|
|
129
|
+
$7MV0W$reactdom.flushSync(()=>{
|
|
130
130
|
let scrollTop = e.currentTarget.scrollTop;
|
|
131
|
-
let scrollLeft = $
|
|
131
|
+
let scrollLeft = $e57feec0328c28a1$export$1389d168952b34b5(e.currentTarget, direction);
|
|
132
132
|
// Prevent rubber band scrolling from shaking when scrolling out of bounds
|
|
133
133
|
state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));
|
|
134
134
|
state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));
|
|
135
|
-
onVisibleRectChange(new $
|
|
135
|
+
onVisibleRectChange(new $7MV0W$reactstatelyvirtualizer.Rect(state.scrollLeft, state.scrollTop, state.width, state.height));
|
|
136
136
|
if (!state.isScrolling) {
|
|
137
137
|
state.isScrolling = true;
|
|
138
138
|
setScrolling(true);
|
|
@@ -163,12 +163,12 @@ function $ac16625e392cd577$var$ScrollView(props, ref) {
|
|
|
163
163
|
onScrollEnd
|
|
164
164
|
]);
|
|
165
165
|
// eslint-disable-next-line arrow-body-style
|
|
166
|
-
$
|
|
166
|
+
$7MV0W$react.useEffect(()=>{
|
|
167
167
|
return ()=>{
|
|
168
168
|
clearTimeout(state.scrollTimeout);
|
|
169
169
|
};
|
|
170
170
|
}, []);
|
|
171
|
-
let updateSize = $
|
|
171
|
+
let updateSize = $7MV0W$react.useCallback(()=>{
|
|
172
172
|
let dom = ref.current;
|
|
173
173
|
if (!dom) return;
|
|
174
174
|
let w = dom.clientWidth;
|
|
@@ -180,7 +180,7 @@ function $ac16625e392cd577$var$ScrollView(props, ref) {
|
|
|
180
180
|
if (state.width !== w || state.height !== h) {
|
|
181
181
|
state.width = w;
|
|
182
182
|
state.height = h;
|
|
183
|
-
onVisibleRectChange(new $
|
|
183
|
+
onVisibleRectChange(new $7MV0W$reactstatelyvirtualizer.Rect(state.scrollLeft, state.scrollTop, w, h));
|
|
184
184
|
}
|
|
185
185
|
}, [
|
|
186
186
|
onVisibleRectChange,
|
|
@@ -189,12 +189,12 @@ function $ac16625e392cd577$var$ScrollView(props, ref) {
|
|
|
189
189
|
sizeToFit,
|
|
190
190
|
contentSize
|
|
191
191
|
]);
|
|
192
|
-
$
|
|
192
|
+
$7MV0W$reactariautils.useLayoutEffect(()=>{
|
|
193
193
|
updateSize();
|
|
194
194
|
}, [
|
|
195
195
|
updateSize
|
|
196
196
|
]);
|
|
197
|
-
$
|
|
197
|
+
$7MV0W$reactariautils.useResizeObserver({
|
|
198
198
|
ref: ref,
|
|
199
199
|
onResize: updateSize
|
|
200
200
|
});
|
|
@@ -210,12 +210,12 @@ function $ac16625e392cd577$var$ScrollView(props, ref) {
|
|
|
210
210
|
style.overflowY = 'auto';
|
|
211
211
|
style.overflowX = 'hidden';
|
|
212
212
|
} else style.overflow = 'auto';
|
|
213
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($
|
|
213
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement("div", {
|
|
214
214
|
...otherProps,
|
|
215
215
|
style: style,
|
|
216
216
|
ref: ref,
|
|
217
217
|
onScroll: onScroll
|
|
218
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($
|
|
218
|
+
}, /*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement("div", {
|
|
219
219
|
role: "presentation",
|
|
220
220
|
style: {
|
|
221
221
|
width: contentSize.width,
|
|
@@ -226,67 +226,67 @@ function $ac16625e392cd577$var$ScrollView(props, ref) {
|
|
|
226
226
|
}
|
|
227
227
|
}, children)));
|
|
228
228
|
}
|
|
229
|
-
const $
|
|
229
|
+
const $0581d5c472ebf526$export$5665e3d6be6adea = /*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).forwardRef($0581d5c472ebf526$var$ScrollView);
|
|
230
230
|
|
|
231
231
|
|
|
232
|
-
var $
|
|
232
|
+
var $6504e5d37f19f01d$exports = {};
|
|
233
233
|
|
|
234
|
-
$parcel$export($
|
|
235
|
-
$parcel$export($
|
|
234
|
+
$parcel$export($6504e5d37f19f01d$exports, "VirtualizerItem", () => $6504e5d37f19f01d$export$6796df8ba7398521);
|
|
235
|
+
$parcel$export($6504e5d37f19f01d$exports, "layoutInfoToStyle", () => $6504e5d37f19f01d$export$1481e64fbe01b8b3);
|
|
236
236
|
|
|
237
237
|
|
|
238
|
-
var $
|
|
238
|
+
var $e916556bbb66d2be$exports = {};
|
|
239
239
|
|
|
240
|
-
$parcel$export($
|
|
240
|
+
$parcel$export($e916556bbb66d2be$exports, "useVirtualizerItem", () => $e916556bbb66d2be$export$1da781778207e0a2);
|
|
241
241
|
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
function $
|
|
244
|
+
function $e916556bbb66d2be$export$1da781778207e0a2(options) {
|
|
245
245
|
let { reusableView: { layoutInfo: layoutInfo , virtualizer: virtualizer } , ref: ref } = options;
|
|
246
|
-
let updateSize = $
|
|
247
|
-
let size = $
|
|
246
|
+
let updateSize = $7MV0W$react.useCallback(()=>{
|
|
247
|
+
let size = $e916556bbb66d2be$var$getSize(ref.current);
|
|
248
248
|
virtualizer.updateItemSize(layoutInfo.key, size);
|
|
249
249
|
}, [
|
|
250
250
|
virtualizer,
|
|
251
251
|
layoutInfo.key,
|
|
252
252
|
ref
|
|
253
253
|
]);
|
|
254
|
-
$
|
|
254
|
+
$7MV0W$reactariautils.useLayoutEffect(()=>{
|
|
255
255
|
if (layoutInfo.estimatedSize) updateSize();
|
|
256
256
|
});
|
|
257
257
|
return {
|
|
258
258
|
updateSize: updateSize
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
function $
|
|
261
|
+
function $e916556bbb66d2be$var$getSize(node) {
|
|
262
262
|
// Reset height before measuring so we get the intrinsic size
|
|
263
263
|
let height = node.style.height;
|
|
264
264
|
node.style.height = '';
|
|
265
|
-
let size = new $
|
|
265
|
+
let size = new $7MV0W$reactstatelyvirtualizer.Size(node.scrollWidth, node.scrollHeight);
|
|
266
266
|
node.style.height = height;
|
|
267
267
|
return size;
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
|
|
271
|
-
function $
|
|
271
|
+
function $6504e5d37f19f01d$export$6796df8ba7398521(props) {
|
|
272
272
|
let { className: className , reusableView: reusableView , parent: parent } = props;
|
|
273
|
-
let { direction: direction } = $
|
|
274
|
-
let ref = $
|
|
275
|
-
$
|
|
273
|
+
let { direction: direction } = $7MV0W$reactariai18n.useLocale();
|
|
274
|
+
let ref = $7MV0W$react.useRef();
|
|
275
|
+
$e916556bbb66d2be$export$1da781778207e0a2({
|
|
276
276
|
reusableView: reusableView,
|
|
277
277
|
ref: ref
|
|
278
278
|
});
|
|
279
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($
|
|
279
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement("div", {
|
|
280
280
|
role: "presentation",
|
|
281
281
|
ref: ref,
|
|
282
282
|
className: className,
|
|
283
|
-
style: $
|
|
283
|
+
style: $6504e5d37f19f01d$export$1481e64fbe01b8b3(reusableView.layoutInfo, direction, parent && parent.layoutInfo)
|
|
284
284
|
}, reusableView.rendered));
|
|
285
285
|
}
|
|
286
|
-
let $
|
|
287
|
-
function $
|
|
286
|
+
let $6504e5d37f19f01d$var$cache = new WeakMap();
|
|
287
|
+
function $6504e5d37f19f01d$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
|
|
288
288
|
let xProperty = dir === 'rtl' ? 'right' : 'left';
|
|
289
|
-
let cached = $
|
|
289
|
+
let cached = $6504e5d37f19f01d$var$cache.get(layoutInfo);
|
|
290
290
|
if (cached && cached[xProperty] != null) {
|
|
291
291
|
if (!parent) return cached;
|
|
292
292
|
// Invalidate if the parent position changed.
|
|
@@ -310,32 +310,32 @@ function $4a6b6f510b9f3ab3$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
|
|
|
310
310
|
transform: layoutInfo.transform,
|
|
311
311
|
contain: layoutInfo.allowOverflow ? 'size layout style' : 'size layout style paint'
|
|
312
312
|
};
|
|
313
|
-
$
|
|
313
|
+
$6504e5d37f19f01d$var$cache.set(layoutInfo, style);
|
|
314
314
|
return style;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
|
|
318
|
-
function $
|
|
318
|
+
function $e66fdc09badf2561$var$Virtualizer(props, ref) {
|
|
319
319
|
let { children: renderView , renderWrapper: renderWrapper , layout: layout , collection: collection , sizeToFit: sizeToFit , scrollDirection: scrollDirection , transitionDuration: transitionDuration , isLoading: isLoading , onLoadMore: onLoadMore , focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
320
320
|
focusedKey , shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
321
321
|
shouldUseVirtualFocus , scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
322
322
|
scrollToItem , ...otherProps } = props;
|
|
323
|
-
let fallbackRef = $
|
|
323
|
+
let fallbackRef = $7MV0W$react.useRef();
|
|
324
324
|
ref = ref || fallbackRef;
|
|
325
|
-
let state = $
|
|
325
|
+
let state = $7MV0W$reactstatelyvirtualizer.useVirtualizerState({
|
|
326
326
|
transitionDuration: transitionDuration,
|
|
327
327
|
layout: layout,
|
|
328
328
|
collection: collection,
|
|
329
329
|
renderView: renderView,
|
|
330
|
-
renderWrapper: renderWrapper || $
|
|
330
|
+
renderWrapper: renderWrapper || $e66fdc09badf2561$var$defaultRenderWrapper,
|
|
331
331
|
onVisibleRectChange (rect) {
|
|
332
332
|
ref.current.scrollLeft = rect.x;
|
|
333
333
|
ref.current.scrollTop = rect.y;
|
|
334
334
|
}
|
|
335
335
|
});
|
|
336
|
-
let { virtualizerProps: virtualizerProps } = $
|
|
336
|
+
let { virtualizerProps: virtualizerProps } = $e66fdc09badf2561$export$dd6d526d88b5a137(props, state, ref);
|
|
337
337
|
// Handle scrolling, and call onLoadMore when nearing the bottom.
|
|
338
|
-
let onVisibleRectChange = $
|
|
338
|
+
let onVisibleRectChange = $7MV0W$react.useCallback((rect)=>{
|
|
339
339
|
state.setVisibleRect(rect);
|
|
340
340
|
if (!isLoading && onLoadMore) {
|
|
341
341
|
let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
|
|
@@ -346,7 +346,7 @@ function $ca3723f8a4684ab3$var$Virtualizer(props, ref) {
|
|
|
346
346
|
onLoadMore,
|
|
347
347
|
state
|
|
348
348
|
]);
|
|
349
|
-
$
|
|
349
|
+
$7MV0W$reactariautils.useLayoutEffect(()=>{
|
|
350
350
|
if (!isLoading && onLoadMore && !state.isAnimating) {
|
|
351
351
|
if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();
|
|
352
352
|
}
|
|
@@ -357,8 +357,8 @@ function $ca3723f8a4684ab3$var$Virtualizer(props, ref) {
|
|
|
357
357
|
onLoadMore,
|
|
358
358
|
isLoading
|
|
359
359
|
]);
|
|
360
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($
|
|
361
|
-
...$
|
|
360
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement($0581d5c472ebf526$export$5665e3d6be6adea, {
|
|
361
|
+
...$7MV0W$reactariautils.mergeProps(otherProps, virtualizerProps),
|
|
362
362
|
ref: ref,
|
|
363
363
|
innerStyle: state.isAnimating ? {
|
|
364
364
|
transition: `none ${state.virtualizer.transitionDuration}ms`
|
|
@@ -371,14 +371,14 @@ function $ca3723f8a4684ab3$var$Virtualizer(props, ref) {
|
|
|
371
371
|
scrollDirection: scrollDirection
|
|
372
372
|
}, state.visibleViews));
|
|
373
373
|
}
|
|
374
|
-
function $
|
|
374
|
+
function $e66fdc09badf2561$export$dd6d526d88b5a137(props, state, ref) {
|
|
375
375
|
let { focusedKey: focusedKey , scrollToItem: scrollToItem , shouldUseVirtualFocus: shouldUseVirtualFocus } = props;
|
|
376
376
|
let { virtualizer: virtualizer } = state;
|
|
377
377
|
// Scroll to the focusedKey when it changes. Actually focusing the focusedKey
|
|
378
378
|
// is up to the implementation using Virtualizer since we don't have refs
|
|
379
379
|
// to all of the item DOM nodes.
|
|
380
|
-
let lastFocusedKey = $
|
|
381
|
-
$
|
|
380
|
+
let lastFocusedKey = $7MV0W$react.useRef(null);
|
|
381
|
+
$7MV0W$react.useEffect(()=>{
|
|
382
382
|
if (virtualizer.visibleRect.height === 0) return;
|
|
383
383
|
if (focusedKey !== lastFocusedKey.current) {
|
|
384
384
|
if (scrollToItem) scrollToItem(focusedKey);
|
|
@@ -394,8 +394,8 @@ function $ca3723f8a4684ab3$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
394
394
|
lastFocusedKey,
|
|
395
395
|
scrollToItem
|
|
396
396
|
]);
|
|
397
|
-
let isFocusWithin = $
|
|
398
|
-
let onFocus = $
|
|
397
|
+
let isFocusWithin = $7MV0W$react.useRef(false);
|
|
398
|
+
let onFocus = $7MV0W$react.useCallback((e)=>{
|
|
399
399
|
// If the focused item is scrolled out of view and is not in the DOM, the collection
|
|
400
400
|
// will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.
|
|
401
401
|
// Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)
|
|
@@ -412,7 +412,7 @@ function $ca3723f8a4684ab3$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
412
412
|
focusedKey,
|
|
413
413
|
scrollToItem
|
|
414
414
|
]);
|
|
415
|
-
let onBlur = $
|
|
415
|
+
let onBlur = $7MV0W$react.useCallback((e)=>{
|
|
416
416
|
isFocusWithin.current = ref.current.contains(e.relatedTarget);
|
|
417
417
|
}, [
|
|
418
418
|
ref
|
|
@@ -420,8 +420,8 @@ function $ca3723f8a4684ab3$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
420
420
|
// When the focused item is scrolled out of view and is removed from the DOM,
|
|
421
421
|
// move focus to the collection view as a whole if focus was within before.
|
|
422
422
|
let focusedView = virtualizer.getView(focusedKey);
|
|
423
|
-
$
|
|
424
|
-
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $
|
|
423
|
+
$7MV0W$react.useEffect(()=>{
|
|
424
|
+
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $7MV0W$reactariautils.focusWithoutScrolling(ref.current);
|
|
425
425
|
});
|
|
426
426
|
// Set tabIndex to -1 if the focused view is in the DOM, otherwise 0 so that the collection
|
|
427
427
|
// itself is tabbable. When the collection receives focus, we scroll the focused item back into
|
|
@@ -439,9 +439,9 @@ function $ca3723f8a4684ab3$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
439
439
|
}
|
|
440
440
|
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
441
441
|
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
442
|
-
const $
|
|
443
|
-
function $
|
|
444
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($
|
|
442
|
+
const $e66fdc09badf2561$export$89be5a243e59c4b2 = /*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).forwardRef($e66fdc09badf2561$var$Virtualizer);
|
|
443
|
+
function $e66fdc09badf2561$var$defaultRenderWrapper(parent, reusableView) {
|
|
444
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement($6504e5d37f19f01d$export$6796df8ba7398521, {
|
|
445
445
|
key: reusableView.key,
|
|
446
446
|
reusableView: reusableView,
|
|
447
447
|
parent: parent
|
|
@@ -453,11 +453,11 @@ function $ca3723f8a4684ab3$var$defaultRenderWrapper(parent, reusableView) {
|
|
|
453
453
|
|
|
454
454
|
|
|
455
455
|
|
|
456
|
-
$parcel$exportWildcard(module.exports, $
|
|
457
|
-
$parcel$exportWildcard(module.exports, $
|
|
458
|
-
$parcel$exportWildcard(module.exports, $
|
|
459
|
-
$parcel$exportWildcard(module.exports, $
|
|
460
|
-
$parcel$exportWildcard(module.exports, $
|
|
456
|
+
$parcel$exportWildcard(module.exports, $e66fdc09badf2561$exports);
|
|
457
|
+
$parcel$exportWildcard(module.exports, $e916556bbb66d2be$exports);
|
|
458
|
+
$parcel$exportWildcard(module.exports, $6504e5d37f19f01d$exports);
|
|
459
|
+
$parcel$exportWildcard(module.exports, $0581d5c472ebf526$exports);
|
|
460
|
+
$parcel$exportWildcard(module.exports, $e57feec0328c28a1$exports);
|
|
461
461
|
|
|
462
462
|
|
|
463
463
|
//# sourceMappingURL=main.js.map
|
package/dist/module.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {useLayoutEffect as $
|
|
2
|
-
import {useVirtualizerState as $
|
|
3
|
-
import $
|
|
4
|
-
import {flushSync as $
|
|
5
|
-
import {useLocale as $
|
|
1
|
+
import {useLayoutEffect as $6Y8zc$useLayoutEffect, mergeProps as $6Y8zc$mergeProps, focusWithoutScrolling as $6Y8zc$focusWithoutScrolling, useResizeObserver as $6Y8zc$useResizeObserver} from "@react-aria/utils";
|
|
2
|
+
import {useVirtualizerState as $6Y8zc$useVirtualizerState, Rect as $6Y8zc$Rect, Size as $6Y8zc$Size} from "@react-stately/virtualizer";
|
|
3
|
+
import $6Y8zc$react, {useRef as $6Y8zc$useRef, useCallback as $6Y8zc$useCallback, useEffect as $6Y8zc$useEffect, useState as $6Y8zc$useState} from "react";
|
|
4
|
+
import {flushSync as $6Y8zc$flushSync} from "react-dom";
|
|
5
|
+
import {useLocale as $6Y8zc$useLocale} from "@react-aria/i18n";
|
|
6
6
|
|
|
7
7
|
function $parcel$export(e, n, v, s) {
|
|
8
8
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
9
|
}
|
|
10
|
-
var $
|
|
10
|
+
var $28b0c838a8280658$exports = {};
|
|
11
11
|
|
|
12
|
-
$parcel$export($
|
|
13
|
-
$parcel$export($
|
|
12
|
+
$parcel$export($28b0c838a8280658$exports, "useVirtualizer", () => $28b0c838a8280658$export$dd6d526d88b5a137);
|
|
13
|
+
$parcel$export($28b0c838a8280658$exports, "Virtualizer", () => $28b0c838a8280658$export$89be5a243e59c4b2);
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var $
|
|
17
|
+
var $ea9606230722b6cd$exports = {};
|
|
18
18
|
|
|
19
|
-
$parcel$export($
|
|
19
|
+
$parcel$export($ea9606230722b6cd$exports, "ScrollView", () => $ea9606230722b6cd$export$5665e3d6be6adea);
|
|
20
20
|
|
|
21
|
-
var $
|
|
21
|
+
var $bdbd287fd4ad4690$exports = {};
|
|
22
22
|
|
|
23
|
-
$parcel$export($
|
|
24
|
-
$parcel$export($
|
|
25
|
-
$parcel$export($
|
|
26
|
-
let $
|
|
27
|
-
function $
|
|
28
|
-
if ($
|
|
23
|
+
$parcel$export($bdbd287fd4ad4690$exports, "getRTLOffsetType", () => $bdbd287fd4ad4690$export$faf7630257ad4304);
|
|
24
|
+
$parcel$export($bdbd287fd4ad4690$exports, "getScrollLeft", () => $bdbd287fd4ad4690$export$1389d168952b34b5);
|
|
25
|
+
$parcel$export($bdbd287fd4ad4690$exports, "setScrollLeft", () => $bdbd287fd4ad4690$export$ed5fd5ffe5ab0ac);
|
|
26
|
+
let $bdbd287fd4ad4690$var$cachedRTLResult = null;
|
|
27
|
+
function $bdbd287fd4ad4690$export$faf7630257ad4304(recalculate = false) {
|
|
28
|
+
if ($bdbd287fd4ad4690$var$cachedRTLResult === null || recalculate) {
|
|
29
29
|
const outerDiv = document.createElement('div');
|
|
30
30
|
const outerStyle = outerDiv.style;
|
|
31
31
|
outerStyle.width = '50px';
|
|
@@ -38,24 +38,24 @@ function $c1608e43f6cbad04$export$faf7630257ad4304(recalculate = false) {
|
|
|
38
38
|
innerStyle.height = '100px';
|
|
39
39
|
outerDiv.appendChild(innerDiv);
|
|
40
40
|
document.body.appendChild(outerDiv);
|
|
41
|
-
if (outerDiv.scrollLeft > 0) $
|
|
41
|
+
if (outerDiv.scrollLeft > 0) $bdbd287fd4ad4690$var$cachedRTLResult = 'positive-descending';
|
|
42
42
|
else {
|
|
43
43
|
outerDiv.scrollLeft = 1;
|
|
44
|
-
if (outerDiv.scrollLeft === 0) $
|
|
45
|
-
else $
|
|
44
|
+
if (outerDiv.scrollLeft === 0) $bdbd287fd4ad4690$var$cachedRTLResult = 'negative';
|
|
45
|
+
else $bdbd287fd4ad4690$var$cachedRTLResult = 'positive-ascending';
|
|
46
46
|
}
|
|
47
47
|
document.body.removeChild(outerDiv);
|
|
48
|
-
return $
|
|
48
|
+
return $bdbd287fd4ad4690$var$cachedRTLResult;
|
|
49
49
|
}
|
|
50
|
-
return $
|
|
50
|
+
return $bdbd287fd4ad4690$var$cachedRTLResult;
|
|
51
51
|
}
|
|
52
|
-
function $
|
|
52
|
+
function $bdbd287fd4ad4690$export$1389d168952b34b5(node, direction) {
|
|
53
53
|
let { scrollLeft: scrollLeft } = node;
|
|
54
54
|
// scrollLeft in rtl locales differs across browsers, so normalize.
|
|
55
55
|
// See comment by getRTLOffsetType below for details.
|
|
56
56
|
if (direction === 'rtl') {
|
|
57
57
|
let { scrollWidth: scrollWidth , clientWidth: clientWidth } = node;
|
|
58
|
-
switch($
|
|
58
|
+
switch($bdbd287fd4ad4690$export$faf7630257ad4304()){
|
|
59
59
|
case 'negative':
|
|
60
60
|
scrollLeft = -scrollLeft;
|
|
61
61
|
break;
|
|
@@ -66,8 +66,8 @@ function $c1608e43f6cbad04$export$1389d168952b34b5(node, direction) {
|
|
|
66
66
|
}
|
|
67
67
|
return scrollLeft;
|
|
68
68
|
}
|
|
69
|
-
function $
|
|
70
|
-
if (direction === 'rtl') switch($
|
|
69
|
+
function $bdbd287fd4ad4690$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
|
|
70
|
+
if (direction === 'rtl') switch($bdbd287fd4ad4690$export$faf7630257ad4304()){
|
|
71
71
|
case 'negative':
|
|
72
72
|
scrollLeft = -scrollLeft;
|
|
73
73
|
break;
|
|
@@ -89,11 +89,11 @@ function $c1608e43f6cbad04$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
function $
|
|
92
|
+
function $ea9606230722b6cd$var$ScrollView(props, ref) {
|
|
93
93
|
let { contentSize: contentSize , onVisibleRectChange: onVisibleRectChange , children: children , innerStyle: innerStyle , sizeToFit: sizeToFit , onScrollStart: onScrollStart , onScrollEnd: onScrollEnd , scrollDirection: scrollDirection = 'both' , ...otherProps } = props;
|
|
94
|
-
let defaultRef = $
|
|
94
|
+
let defaultRef = $6Y8zc$useRef();
|
|
95
95
|
ref = ref || defaultRef;
|
|
96
|
-
let state = $
|
|
96
|
+
let state = $6Y8zc$useRef({
|
|
97
97
|
scrollTop: 0,
|
|
98
98
|
scrollLeft: 0,
|
|
99
99
|
scrollEndTime: 0,
|
|
@@ -102,18 +102,18 @@ function $9ced0cda9903d8f8$var$ScrollView(props, ref) {
|
|
|
102
102
|
height: 0,
|
|
103
103
|
isScrolling: false
|
|
104
104
|
}).current;
|
|
105
|
-
let { direction: direction } = $
|
|
106
|
-
let [isScrolling, setScrolling] = $
|
|
107
|
-
let onScroll = $
|
|
105
|
+
let { direction: direction } = $6Y8zc$useLocale();
|
|
106
|
+
let [isScrolling, setScrolling] = $6Y8zc$useState(false);
|
|
107
|
+
let onScroll = $6Y8zc$useCallback((e)=>{
|
|
108
108
|
if (e.target !== e.currentTarget) return;
|
|
109
109
|
if (props.onScroll) props.onScroll(e);
|
|
110
|
-
$
|
|
110
|
+
$6Y8zc$flushSync(()=>{
|
|
111
111
|
let scrollTop = e.currentTarget.scrollTop;
|
|
112
|
-
let scrollLeft = $
|
|
112
|
+
let scrollLeft = $bdbd287fd4ad4690$export$1389d168952b34b5(e.currentTarget, direction);
|
|
113
113
|
// Prevent rubber band scrolling from shaking when scrolling out of bounds
|
|
114
114
|
state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));
|
|
115
115
|
state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));
|
|
116
|
-
onVisibleRectChange(new $
|
|
116
|
+
onVisibleRectChange(new $6Y8zc$Rect(state.scrollLeft, state.scrollTop, state.width, state.height));
|
|
117
117
|
if (!state.isScrolling) {
|
|
118
118
|
state.isScrolling = true;
|
|
119
119
|
setScrolling(true);
|
|
@@ -144,12 +144,12 @@ function $9ced0cda9903d8f8$var$ScrollView(props, ref) {
|
|
|
144
144
|
onScrollEnd
|
|
145
145
|
]);
|
|
146
146
|
// eslint-disable-next-line arrow-body-style
|
|
147
|
-
$
|
|
147
|
+
$6Y8zc$useEffect(()=>{
|
|
148
148
|
return ()=>{
|
|
149
149
|
clearTimeout(state.scrollTimeout);
|
|
150
150
|
};
|
|
151
151
|
}, []);
|
|
152
|
-
let updateSize = $
|
|
152
|
+
let updateSize = $6Y8zc$useCallback(()=>{
|
|
153
153
|
let dom = ref.current;
|
|
154
154
|
if (!dom) return;
|
|
155
155
|
let w = dom.clientWidth;
|
|
@@ -161,7 +161,7 @@ function $9ced0cda9903d8f8$var$ScrollView(props, ref) {
|
|
|
161
161
|
if (state.width !== w || state.height !== h) {
|
|
162
162
|
state.width = w;
|
|
163
163
|
state.height = h;
|
|
164
|
-
onVisibleRectChange(new $
|
|
164
|
+
onVisibleRectChange(new $6Y8zc$Rect(state.scrollLeft, state.scrollTop, w, h));
|
|
165
165
|
}
|
|
166
166
|
}, [
|
|
167
167
|
onVisibleRectChange,
|
|
@@ -170,12 +170,12 @@ function $9ced0cda9903d8f8$var$ScrollView(props, ref) {
|
|
|
170
170
|
sizeToFit,
|
|
171
171
|
contentSize
|
|
172
172
|
]);
|
|
173
|
-
$
|
|
173
|
+
$6Y8zc$useLayoutEffect(()=>{
|
|
174
174
|
updateSize();
|
|
175
175
|
}, [
|
|
176
176
|
updateSize
|
|
177
177
|
]);
|
|
178
|
-
$
|
|
178
|
+
$6Y8zc$useResizeObserver({
|
|
179
179
|
ref: ref,
|
|
180
180
|
onResize: updateSize
|
|
181
181
|
});
|
|
@@ -191,12 +191,12 @@ function $9ced0cda9903d8f8$var$ScrollView(props, ref) {
|
|
|
191
191
|
style.overflowY = 'auto';
|
|
192
192
|
style.overflowX = 'hidden';
|
|
193
193
|
} else style.overflow = 'auto';
|
|
194
|
-
return(/*#__PURE__*/ $
|
|
194
|
+
return(/*#__PURE__*/ $6Y8zc$react.createElement("div", {
|
|
195
195
|
...otherProps,
|
|
196
196
|
style: style,
|
|
197
197
|
ref: ref,
|
|
198
198
|
onScroll: onScroll
|
|
199
|
-
}, /*#__PURE__*/ $
|
|
199
|
+
}, /*#__PURE__*/ $6Y8zc$react.createElement("div", {
|
|
200
200
|
role: "presentation",
|
|
201
201
|
style: {
|
|
202
202
|
width: contentSize.width,
|
|
@@ -207,67 +207,67 @@ function $9ced0cda9903d8f8$var$ScrollView(props, ref) {
|
|
|
207
207
|
}
|
|
208
208
|
}, children)));
|
|
209
209
|
}
|
|
210
|
-
const $
|
|
210
|
+
const $ea9606230722b6cd$export$5665e3d6be6adea = /*#__PURE__*/ $6Y8zc$react.forwardRef($ea9606230722b6cd$var$ScrollView);
|
|
211
211
|
|
|
212
212
|
|
|
213
|
-
var $
|
|
213
|
+
var $59d9cc29f1abde27$exports = {};
|
|
214
214
|
|
|
215
|
-
$parcel$export($
|
|
216
|
-
$parcel$export($
|
|
215
|
+
$parcel$export($59d9cc29f1abde27$exports, "VirtualizerItem", () => $59d9cc29f1abde27$export$6796df8ba7398521);
|
|
216
|
+
$parcel$export($59d9cc29f1abde27$exports, "layoutInfoToStyle", () => $59d9cc29f1abde27$export$1481e64fbe01b8b3);
|
|
217
217
|
|
|
218
218
|
|
|
219
|
-
var $
|
|
219
|
+
var $a699ae714be8549e$exports = {};
|
|
220
220
|
|
|
221
|
-
$parcel$export($
|
|
221
|
+
$parcel$export($a699ae714be8549e$exports, "useVirtualizerItem", () => $a699ae714be8549e$export$1da781778207e0a2);
|
|
222
222
|
|
|
223
223
|
|
|
224
224
|
|
|
225
|
-
function $
|
|
225
|
+
function $a699ae714be8549e$export$1da781778207e0a2(options) {
|
|
226
226
|
let { reusableView: { layoutInfo: layoutInfo , virtualizer: virtualizer } , ref: ref } = options;
|
|
227
|
-
let updateSize = $
|
|
228
|
-
let size = $
|
|
227
|
+
let updateSize = $6Y8zc$useCallback(()=>{
|
|
228
|
+
let size = $a699ae714be8549e$var$getSize(ref.current);
|
|
229
229
|
virtualizer.updateItemSize(layoutInfo.key, size);
|
|
230
230
|
}, [
|
|
231
231
|
virtualizer,
|
|
232
232
|
layoutInfo.key,
|
|
233
233
|
ref
|
|
234
234
|
]);
|
|
235
|
-
$
|
|
235
|
+
$6Y8zc$useLayoutEffect(()=>{
|
|
236
236
|
if (layoutInfo.estimatedSize) updateSize();
|
|
237
237
|
});
|
|
238
238
|
return {
|
|
239
239
|
updateSize: updateSize
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
function $
|
|
242
|
+
function $a699ae714be8549e$var$getSize(node) {
|
|
243
243
|
// Reset height before measuring so we get the intrinsic size
|
|
244
244
|
let height = node.style.height;
|
|
245
245
|
node.style.height = '';
|
|
246
|
-
let size = new $
|
|
246
|
+
let size = new $6Y8zc$Size(node.scrollWidth, node.scrollHeight);
|
|
247
247
|
node.style.height = height;
|
|
248
248
|
return size;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
|
|
252
|
-
function $
|
|
252
|
+
function $59d9cc29f1abde27$export$6796df8ba7398521(props) {
|
|
253
253
|
let { className: className , reusableView: reusableView , parent: parent } = props;
|
|
254
|
-
let { direction: direction } = $
|
|
255
|
-
let ref = $
|
|
256
|
-
$
|
|
254
|
+
let { direction: direction } = $6Y8zc$useLocale();
|
|
255
|
+
let ref = $6Y8zc$useRef();
|
|
256
|
+
$a699ae714be8549e$export$1da781778207e0a2({
|
|
257
257
|
reusableView: reusableView,
|
|
258
258
|
ref: ref
|
|
259
259
|
});
|
|
260
|
-
return(/*#__PURE__*/ $
|
|
260
|
+
return(/*#__PURE__*/ $6Y8zc$react.createElement("div", {
|
|
261
261
|
role: "presentation",
|
|
262
262
|
ref: ref,
|
|
263
263
|
className: className,
|
|
264
|
-
style: $
|
|
264
|
+
style: $59d9cc29f1abde27$export$1481e64fbe01b8b3(reusableView.layoutInfo, direction, parent && parent.layoutInfo)
|
|
265
265
|
}, reusableView.rendered));
|
|
266
266
|
}
|
|
267
|
-
let $
|
|
268
|
-
function $
|
|
267
|
+
let $59d9cc29f1abde27$var$cache = new WeakMap();
|
|
268
|
+
function $59d9cc29f1abde27$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
|
|
269
269
|
let xProperty = dir === 'rtl' ? 'right' : 'left';
|
|
270
|
-
let cached = $
|
|
270
|
+
let cached = $59d9cc29f1abde27$var$cache.get(layoutInfo);
|
|
271
271
|
if (cached && cached[xProperty] != null) {
|
|
272
272
|
if (!parent) return cached;
|
|
273
273
|
// Invalidate if the parent position changed.
|
|
@@ -291,32 +291,32 @@ function $a72628bad5aca288$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
|
|
|
291
291
|
transform: layoutInfo.transform,
|
|
292
292
|
contain: layoutInfo.allowOverflow ? 'size layout style' : 'size layout style paint'
|
|
293
293
|
};
|
|
294
|
-
$
|
|
294
|
+
$59d9cc29f1abde27$var$cache.set(layoutInfo, style);
|
|
295
295
|
return style;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
|
|
299
|
-
function $
|
|
299
|
+
function $28b0c838a8280658$var$Virtualizer(props, ref) {
|
|
300
300
|
let { children: renderView , renderWrapper: renderWrapper , layout: layout , collection: collection , sizeToFit: sizeToFit , scrollDirection: scrollDirection , transitionDuration: transitionDuration , isLoading: isLoading , onLoadMore: onLoadMore , focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
301
301
|
focusedKey , shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
302
302
|
shouldUseVirtualFocus , scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
303
303
|
scrollToItem , ...otherProps } = props;
|
|
304
|
-
let fallbackRef = $
|
|
304
|
+
let fallbackRef = $6Y8zc$useRef();
|
|
305
305
|
ref = ref || fallbackRef;
|
|
306
|
-
let state = $
|
|
306
|
+
let state = $6Y8zc$useVirtualizerState({
|
|
307
307
|
transitionDuration: transitionDuration,
|
|
308
308
|
layout: layout,
|
|
309
309
|
collection: collection,
|
|
310
310
|
renderView: renderView,
|
|
311
|
-
renderWrapper: renderWrapper || $
|
|
311
|
+
renderWrapper: renderWrapper || $28b0c838a8280658$var$defaultRenderWrapper,
|
|
312
312
|
onVisibleRectChange (rect) {
|
|
313
313
|
ref.current.scrollLeft = rect.x;
|
|
314
314
|
ref.current.scrollTop = rect.y;
|
|
315
315
|
}
|
|
316
316
|
});
|
|
317
|
-
let { virtualizerProps: virtualizerProps } = $
|
|
317
|
+
let { virtualizerProps: virtualizerProps } = $28b0c838a8280658$export$dd6d526d88b5a137(props, state, ref);
|
|
318
318
|
// Handle scrolling, and call onLoadMore when nearing the bottom.
|
|
319
|
-
let onVisibleRectChange = $
|
|
319
|
+
let onVisibleRectChange = $6Y8zc$useCallback((rect)=>{
|
|
320
320
|
state.setVisibleRect(rect);
|
|
321
321
|
if (!isLoading && onLoadMore) {
|
|
322
322
|
let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
|
|
@@ -327,7 +327,7 @@ function $a5dbc9cf2d19f590$var$Virtualizer(props, ref) {
|
|
|
327
327
|
onLoadMore,
|
|
328
328
|
state
|
|
329
329
|
]);
|
|
330
|
-
$
|
|
330
|
+
$6Y8zc$useLayoutEffect(()=>{
|
|
331
331
|
if (!isLoading && onLoadMore && !state.isAnimating) {
|
|
332
332
|
if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();
|
|
333
333
|
}
|
|
@@ -338,8 +338,8 @@ function $a5dbc9cf2d19f590$var$Virtualizer(props, ref) {
|
|
|
338
338
|
onLoadMore,
|
|
339
339
|
isLoading
|
|
340
340
|
]);
|
|
341
|
-
return(/*#__PURE__*/ $
|
|
342
|
-
...$
|
|
341
|
+
return(/*#__PURE__*/ $6Y8zc$react.createElement($ea9606230722b6cd$export$5665e3d6be6adea, {
|
|
342
|
+
...$6Y8zc$mergeProps(otherProps, virtualizerProps),
|
|
343
343
|
ref: ref,
|
|
344
344
|
innerStyle: state.isAnimating ? {
|
|
345
345
|
transition: `none ${state.virtualizer.transitionDuration}ms`
|
|
@@ -352,14 +352,14 @@ function $a5dbc9cf2d19f590$var$Virtualizer(props, ref) {
|
|
|
352
352
|
scrollDirection: scrollDirection
|
|
353
353
|
}, state.visibleViews));
|
|
354
354
|
}
|
|
355
|
-
function $
|
|
355
|
+
function $28b0c838a8280658$export$dd6d526d88b5a137(props, state, ref) {
|
|
356
356
|
let { focusedKey: focusedKey , scrollToItem: scrollToItem , shouldUseVirtualFocus: shouldUseVirtualFocus } = props;
|
|
357
357
|
let { virtualizer: virtualizer } = state;
|
|
358
358
|
// Scroll to the focusedKey when it changes. Actually focusing the focusedKey
|
|
359
359
|
// is up to the implementation using Virtualizer since we don't have refs
|
|
360
360
|
// to all of the item DOM nodes.
|
|
361
|
-
let lastFocusedKey = $
|
|
362
|
-
$
|
|
361
|
+
let lastFocusedKey = $6Y8zc$useRef(null);
|
|
362
|
+
$6Y8zc$useEffect(()=>{
|
|
363
363
|
if (virtualizer.visibleRect.height === 0) return;
|
|
364
364
|
if (focusedKey !== lastFocusedKey.current) {
|
|
365
365
|
if (scrollToItem) scrollToItem(focusedKey);
|
|
@@ -375,8 +375,8 @@ function $a5dbc9cf2d19f590$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
375
375
|
lastFocusedKey,
|
|
376
376
|
scrollToItem
|
|
377
377
|
]);
|
|
378
|
-
let isFocusWithin = $
|
|
379
|
-
let onFocus = $
|
|
378
|
+
let isFocusWithin = $6Y8zc$useRef(false);
|
|
379
|
+
let onFocus = $6Y8zc$useCallback((e)=>{
|
|
380
380
|
// If the focused item is scrolled out of view and is not in the DOM, the collection
|
|
381
381
|
// will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.
|
|
382
382
|
// Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)
|
|
@@ -393,7 +393,7 @@ function $a5dbc9cf2d19f590$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
393
393
|
focusedKey,
|
|
394
394
|
scrollToItem
|
|
395
395
|
]);
|
|
396
|
-
let onBlur = $
|
|
396
|
+
let onBlur = $6Y8zc$useCallback((e)=>{
|
|
397
397
|
isFocusWithin.current = ref.current.contains(e.relatedTarget);
|
|
398
398
|
}, [
|
|
399
399
|
ref
|
|
@@ -401,8 +401,8 @@ function $a5dbc9cf2d19f590$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
401
401
|
// When the focused item is scrolled out of view and is removed from the DOM,
|
|
402
402
|
// move focus to the collection view as a whole if focus was within before.
|
|
403
403
|
let focusedView = virtualizer.getView(focusedKey);
|
|
404
|
-
$
|
|
405
|
-
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $
|
|
404
|
+
$6Y8zc$useEffect(()=>{
|
|
405
|
+
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $6Y8zc$focusWithoutScrolling(ref.current);
|
|
406
406
|
});
|
|
407
407
|
// Set tabIndex to -1 if the focused view is in the DOM, otherwise 0 so that the collection
|
|
408
408
|
// itself is tabbable. When the collection receives focus, we scroll the focused item back into
|
|
@@ -420,9 +420,9 @@ function $a5dbc9cf2d19f590$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
420
420
|
}
|
|
421
421
|
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
422
422
|
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
423
|
-
const $
|
|
424
|
-
function $
|
|
425
|
-
return(/*#__PURE__*/ $
|
|
423
|
+
const $28b0c838a8280658$export$89be5a243e59c4b2 = /*#__PURE__*/ $6Y8zc$react.forwardRef($28b0c838a8280658$var$Virtualizer);
|
|
424
|
+
function $28b0c838a8280658$var$defaultRenderWrapper(parent, reusableView) {
|
|
425
|
+
return(/*#__PURE__*/ $6Y8zc$react.createElement($59d9cc29f1abde27$export$6796df8ba7398521, {
|
|
426
426
|
key: reusableView.key,
|
|
427
427
|
reusableView: reusableView,
|
|
428
428
|
parent: parent
|
|
@@ -436,5 +436,5 @@ function $a5dbc9cf2d19f590$var$defaultRenderWrapper(parent, reusableView) {
|
|
|
436
436
|
|
|
437
437
|
|
|
438
438
|
|
|
439
|
-
export {$
|
|
439
|
+
export {$28b0c838a8280658$export$dd6d526d88b5a137 as useVirtualizer, $28b0c838a8280658$export$89be5a243e59c4b2 as Virtualizer, $a699ae714be8549e$export$1da781778207e0a2 as useVirtualizerItem, $59d9cc29f1abde27$export$6796df8ba7398521 as VirtualizerItem, $59d9cc29f1abde27$export$1481e64fbe01b8b3 as layoutInfoToStyle, $ea9606230722b6cd$export$5665e3d6be6adea as ScrollView, $bdbd287fd4ad4690$export$faf7630257ad4304 as getRTLOffsetType, $bdbd287fd4ad4690$export$1389d168952b34b5 as getScrollLeft, $bdbd287fd4ad4690$export$ed5fd5ffe5ab0ac as setScrollLeft};
|
|
440
440
|
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/virtualizer",
|
|
3
|
-
"version": "3.3.7
|
|
3
|
+
"version": "3.3.7",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/i18n": "3.
|
|
22
|
-
"@react-aria/utils": "3.
|
|
23
|
-
"@react-stately/virtualizer": "3.1.7
|
|
24
|
-
"@react-types/shared": "3.
|
|
21
|
+
"@react-aria/i18n": "^3.3.6",
|
|
22
|
+
"@react-aria/utils": "^3.11.2",
|
|
23
|
+
"@react-stately/virtualizer": "^3.1.7",
|
|
24
|
+
"@react-types/shared": "^3.11.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "^16.8.0 || ^17.0.0-rc.1",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
|
|
34
34
|
}
|