New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/virtualizer

Package Overview
Dependencies
Maintainers
2
Versions
883
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/virtualizer - npm Package Compare versions

Comparing version 3.3.7-nightly.3111 to 3.3.7

178

dist/main.js

@@ -1,6 +0,6 @@

var $3gjlC$reactariautils = require("@react-aria/utils");
var $3gjlC$reactstatelyvirtualizer = require("@react-stately/virtualizer");
var $3gjlC$react = require("react");
var $3gjlC$reactdom = require("react-dom");
var $3gjlC$reactariai18n = require("@react-aria/i18n");
var $7MV0W$reactariautils = require("@react-aria/utils");
var $7MV0W$reactstatelyvirtualizer = require("@react-stately/virtualizer");
var $7MV0W$react = require("react");
var $7MV0W$reactdom = require("react-dom");
var $7MV0W$reactariai18n = require("@react-aria/i18n");

@@ -29,21 +29,21 @@ function $parcel$exportWildcard(dest, source) {

}
var $ca3723f8a4684ab3$exports = {};
var $e66fdc09badf2561$exports = {};
$parcel$export($ca3723f8a4684ab3$exports, "useVirtualizer", () => $ca3723f8a4684ab3$export$dd6d526d88b5a137);
$parcel$export($ca3723f8a4684ab3$exports, "Virtualizer", () => $ca3723f8a4684ab3$export$89be5a243e59c4b2);
$parcel$export($e66fdc09badf2561$exports, "useVirtualizer", () => $e66fdc09badf2561$export$dd6d526d88b5a137);
$parcel$export($e66fdc09badf2561$exports, "Virtualizer", () => $e66fdc09badf2561$export$89be5a243e59c4b2);
var $ac16625e392cd577$exports = {};
var $0581d5c472ebf526$exports = {};
$parcel$export($ac16625e392cd577$exports, "ScrollView", () => $ac16625e392cd577$export$5665e3d6be6adea);
$parcel$export($0581d5c472ebf526$exports, "ScrollView", () => $0581d5c472ebf526$export$5665e3d6be6adea);
var $57bbbd99c9e34298$exports = {};
var $e57feec0328c28a1$exports = {};
$parcel$export($57bbbd99c9e34298$exports, "getRTLOffsetType", () => $57bbbd99c9e34298$export$faf7630257ad4304);
$parcel$export($57bbbd99c9e34298$exports, "getScrollLeft", () => $57bbbd99c9e34298$export$1389d168952b34b5);
$parcel$export($57bbbd99c9e34298$exports, "setScrollLeft", () => $57bbbd99c9e34298$export$ed5fd5ffe5ab0ac);
let $57bbbd99c9e34298$var$cachedRTLResult = null;
function $57bbbd99c9e34298$export$faf7630257ad4304(recalculate = false) {
if ($57bbbd99c9e34298$var$cachedRTLResult === null || recalculate) {
$parcel$export($e57feec0328c28a1$exports, "getRTLOffsetType", () => $e57feec0328c28a1$export$faf7630257ad4304);
$parcel$export($e57feec0328c28a1$exports, "getScrollLeft", () => $e57feec0328c28a1$export$1389d168952b34b5);
$parcel$export($e57feec0328c28a1$exports, "setScrollLeft", () => $e57feec0328c28a1$export$ed5fd5ffe5ab0ac);
let $e57feec0328c28a1$var$cachedRTLResult = null;
function $e57feec0328c28a1$export$faf7630257ad4304(recalculate = false) {
if ($e57feec0328c28a1$var$cachedRTLResult === null || recalculate) {
const outerDiv = document.createElement('div');

@@ -61,14 +61,14 @@ const outerStyle = outerDiv.style;

document.body.appendChild(outerDiv);
if (outerDiv.scrollLeft > 0) $57bbbd99c9e34298$var$cachedRTLResult = 'positive-descending';
if (outerDiv.scrollLeft > 0) $e57feec0328c28a1$var$cachedRTLResult = 'positive-descending';
else {
outerDiv.scrollLeft = 1;
if (outerDiv.scrollLeft === 0) $57bbbd99c9e34298$var$cachedRTLResult = 'negative';
else $57bbbd99c9e34298$var$cachedRTLResult = 'positive-ascending';
if (outerDiv.scrollLeft === 0) $e57feec0328c28a1$var$cachedRTLResult = 'negative';
else $e57feec0328c28a1$var$cachedRTLResult = 'positive-ascending';
}
document.body.removeChild(outerDiv);
return $57bbbd99c9e34298$var$cachedRTLResult;
return $e57feec0328c28a1$var$cachedRTLResult;
}
return $57bbbd99c9e34298$var$cachedRTLResult;
return $e57feec0328c28a1$var$cachedRTLResult;
}
function $57bbbd99c9e34298$export$1389d168952b34b5(node, direction) {
function $e57feec0328c28a1$export$1389d168952b34b5(node, direction) {
let { scrollLeft: scrollLeft } = node;

@@ -79,3 +79,3 @@ // scrollLeft in rtl locales differs across browsers, so normalize.

let { scrollWidth: scrollWidth , clientWidth: clientWidth } = node;
switch($57bbbd99c9e34298$export$faf7630257ad4304()){
switch($e57feec0328c28a1$export$faf7630257ad4304()){
case 'negative':

@@ -91,4 +91,4 @@ scrollLeft = -scrollLeft;

}
function $57bbbd99c9e34298$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
if (direction === 'rtl') switch($57bbbd99c9e34298$export$faf7630257ad4304()){
function $e57feec0328c28a1$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
if (direction === 'rtl') switch($e57feec0328c28a1$export$faf7630257ad4304()){
case 'negative':

@@ -115,7 +115,7 @@ scrollLeft = -scrollLeft;

function $ac16625e392cd577$var$ScrollView(props, ref) {
function $0581d5c472ebf526$var$ScrollView(props, ref) {
let { contentSize: contentSize , onVisibleRectChange: onVisibleRectChange , children: children , innerStyle: innerStyle , sizeToFit: sizeToFit , onScrollStart: onScrollStart , onScrollEnd: onScrollEnd , scrollDirection: scrollDirection = 'both' , ...otherProps } = props;
let defaultRef = $3gjlC$react.useRef();
let defaultRef = $7MV0W$react.useRef();
ref = ref || defaultRef;
let state = $3gjlC$react.useRef({
let state = $7MV0W$react.useRef({
scrollTop: 0,

@@ -129,14 +129,14 @@ scrollLeft: 0,

}).current;
let { direction: direction } = $3gjlC$reactariai18n.useLocale();
let [isScrolling, setScrolling] = $3gjlC$react.useState(false);
let onScroll = $3gjlC$react.useCallback((e)=>{
let { direction: direction } = $7MV0W$reactariai18n.useLocale();
let [isScrolling, setScrolling] = $7MV0W$react.useState(false);
let onScroll = $7MV0W$react.useCallback((e)=>{
if (e.target !== e.currentTarget) return;
if (props.onScroll) props.onScroll(e);
$3gjlC$reactdom.flushSync(()=>{
$7MV0W$reactdom.flushSync(()=>{
let scrollTop = e.currentTarget.scrollTop;
let scrollLeft = $57bbbd99c9e34298$export$1389d168952b34b5(e.currentTarget, direction);
let scrollLeft = $e57feec0328c28a1$export$1389d168952b34b5(e.currentTarget, direction);
// Prevent rubber band scrolling from shaking when scrolling out of bounds
state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));
state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));
onVisibleRectChange(new $3gjlC$reactstatelyvirtualizer.Rect(state.scrollLeft, state.scrollTop, state.width, state.height));
onVisibleRectChange(new $7MV0W$reactstatelyvirtualizer.Rect(state.scrollLeft, state.scrollTop, state.width, state.height));
if (!state.isScrolling) {

@@ -172,3 +172,3 @@ state.isScrolling = true;

// eslint-disable-next-line arrow-body-style
$3gjlC$react.useEffect(()=>{
$7MV0W$react.useEffect(()=>{
return ()=>{

@@ -178,3 +178,3 @@ clearTimeout(state.scrollTimeout);

}, []);
let updateSize = $3gjlC$react.useCallback(()=>{
let updateSize = $7MV0W$react.useCallback(()=>{
let dom = ref.current;

@@ -191,3 +191,3 @@ if (!dom) return;

state.height = h;
onVisibleRectChange(new $3gjlC$reactstatelyvirtualizer.Rect(state.scrollLeft, state.scrollTop, w, h));
onVisibleRectChange(new $7MV0W$reactstatelyvirtualizer.Rect(state.scrollLeft, state.scrollTop, w, h));
}

@@ -201,3 +201,3 @@ }, [

]);
$3gjlC$reactariautils.useLayoutEffect(()=>{
$7MV0W$reactariautils.useLayoutEffect(()=>{
updateSize();

@@ -207,3 +207,3 @@ }, [

]);
$3gjlC$reactariautils.useResizeObserver({
$7MV0W$reactariautils.useResizeObserver({
ref: ref,

@@ -224,3 +224,3 @@ onResize: updateSize

} else style.overflow = 'auto';
return(/*#__PURE__*/ ($parcel$interopDefault($3gjlC$react)).createElement("div", {
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement("div", {
...otherProps,

@@ -230,3 +230,3 @@ style: style,

onScroll: onScroll
}, /*#__PURE__*/ ($parcel$interopDefault($3gjlC$react)).createElement("div", {
}, /*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement("div", {
role: "presentation",

@@ -242,21 +242,21 @@ style: {

}
const $ac16625e392cd577$export$5665e3d6be6adea = /*#__PURE__*/ ($parcel$interopDefault($3gjlC$react)).forwardRef($ac16625e392cd577$var$ScrollView);
const $0581d5c472ebf526$export$5665e3d6be6adea = /*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).forwardRef($0581d5c472ebf526$var$ScrollView);
var $4a6b6f510b9f3ab3$exports = {};
var $6504e5d37f19f01d$exports = {};
$parcel$export($4a6b6f510b9f3ab3$exports, "VirtualizerItem", () => $4a6b6f510b9f3ab3$export$6796df8ba7398521);
$parcel$export($4a6b6f510b9f3ab3$exports, "layoutInfoToStyle", () => $4a6b6f510b9f3ab3$export$1481e64fbe01b8b3);
$parcel$export($6504e5d37f19f01d$exports, "VirtualizerItem", () => $6504e5d37f19f01d$export$6796df8ba7398521);
$parcel$export($6504e5d37f19f01d$exports, "layoutInfoToStyle", () => $6504e5d37f19f01d$export$1481e64fbe01b8b3);
var $9e4914e897cd775b$exports = {};
var $e916556bbb66d2be$exports = {};
$parcel$export($9e4914e897cd775b$exports, "useVirtualizerItem", () => $9e4914e897cd775b$export$1da781778207e0a2);
$parcel$export($e916556bbb66d2be$exports, "useVirtualizerItem", () => $e916556bbb66d2be$export$1da781778207e0a2);
function $9e4914e897cd775b$export$1da781778207e0a2(options) {
function $e916556bbb66d2be$export$1da781778207e0a2(options) {
let { reusableView: { layoutInfo: layoutInfo , virtualizer: virtualizer } , ref: ref } = options;
let updateSize = $3gjlC$react.useCallback(()=>{
let size = $9e4914e897cd775b$var$getSize(ref.current);
let updateSize = $7MV0W$react.useCallback(()=>{
let size = $e916556bbb66d2be$var$getSize(ref.current);
virtualizer.updateItemSize(layoutInfo.key, size);

@@ -268,3 +268,3 @@ }, [

]);
$3gjlC$reactariautils.useLayoutEffect(()=>{
$7MV0W$reactariautils.useLayoutEffect(()=>{
if (layoutInfo.estimatedSize) updateSize();

@@ -276,7 +276,7 @@ });

}
function $9e4914e897cd775b$var$getSize(node) {
function $e916556bbb66d2be$var$getSize(node) {
// Reset height before measuring so we get the intrinsic size
let height = node.style.height;
node.style.height = '';
let size = new $3gjlC$reactstatelyvirtualizer.Size(node.scrollWidth, node.scrollHeight);
let size = new $7MV0W$reactstatelyvirtualizer.Size(node.scrollWidth, node.scrollHeight);
node.style.height = height;

@@ -287,21 +287,21 @@ return size;

function $4a6b6f510b9f3ab3$export$6796df8ba7398521(props) {
function $6504e5d37f19f01d$export$6796df8ba7398521(props) {
let { className: className , reusableView: reusableView , parent: parent } = props;
let { direction: direction } = $3gjlC$reactariai18n.useLocale();
let ref = $3gjlC$react.useRef();
$9e4914e897cd775b$export$1da781778207e0a2({
let { direction: direction } = $7MV0W$reactariai18n.useLocale();
let ref = $7MV0W$react.useRef();
$e916556bbb66d2be$export$1da781778207e0a2({
reusableView: reusableView,
ref: ref
});
return(/*#__PURE__*/ ($parcel$interopDefault($3gjlC$react)).createElement("div", {
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement("div", {
role: "presentation",
ref: ref,
className: className,
style: $4a6b6f510b9f3ab3$export$1481e64fbe01b8b3(reusableView.layoutInfo, direction, parent && parent.layoutInfo)
style: $6504e5d37f19f01d$export$1481e64fbe01b8b3(reusableView.layoutInfo, direction, parent && parent.layoutInfo)
}, reusableView.rendered));
}
let $4a6b6f510b9f3ab3$var$cache = new WeakMap();
function $4a6b6f510b9f3ab3$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
let $6504e5d37f19f01d$var$cache = new WeakMap();
function $6504e5d37f19f01d$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
let xProperty = dir === 'rtl' ? 'right' : 'left';
let cached = $4a6b6f510b9f3ab3$var$cache.get(layoutInfo);
let cached = $6504e5d37f19f01d$var$cache.get(layoutInfo);
if (cached && cached[xProperty] != null) {

@@ -330,3 +330,3 @@ if (!parent) return cached;

};
$4a6b6f510b9f3ab3$var$cache.set(layoutInfo, style);
$6504e5d37f19f01d$var$cache.set(layoutInfo, style);
return style;

@@ -336,3 +336,3 @@ }

function $ca3723f8a4684ab3$var$Virtualizer(props, ref) {
function $e66fdc09badf2561$var$Virtualizer(props, ref) {
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

@@ -342,5 +342,5 @@ focusedKey , shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars

scrollToItem , ...otherProps } = props;
let fallbackRef = $3gjlC$react.useRef();
let fallbackRef = $7MV0W$react.useRef();
ref = ref || fallbackRef;
let state = $3gjlC$reactstatelyvirtualizer.useVirtualizerState({
let state = $7MV0W$reactstatelyvirtualizer.useVirtualizerState({
transitionDuration: transitionDuration,

@@ -350,3 +350,3 @@ layout: layout,

renderView: renderView,
renderWrapper: renderWrapper || $ca3723f8a4684ab3$var$defaultRenderWrapper,
renderWrapper: renderWrapper || $e66fdc09badf2561$var$defaultRenderWrapper,
onVisibleRectChange (rect) {

@@ -357,5 +357,5 @@ ref.current.scrollLeft = rect.x;

});
let { virtualizerProps: virtualizerProps } = $ca3723f8a4684ab3$export$dd6d526d88b5a137(props, state, ref);
let { virtualizerProps: virtualizerProps } = $e66fdc09badf2561$export$dd6d526d88b5a137(props, state, ref);
// Handle scrolling, and call onLoadMore when nearing the bottom.
let onVisibleRectChange = $3gjlC$react.useCallback((rect)=>{
let onVisibleRectChange = $7MV0W$react.useCallback((rect)=>{
state.setVisibleRect(rect);

@@ -371,3 +371,3 @@ if (!isLoading && onLoadMore) {

]);
$3gjlC$reactariautils.useLayoutEffect(()=>{
$7MV0W$reactariautils.useLayoutEffect(()=>{
if (!isLoading && onLoadMore && !state.isAnimating) {

@@ -383,4 +383,4 @@ if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();

]);
return(/*#__PURE__*/ ($parcel$interopDefault($3gjlC$react)).createElement($ac16625e392cd577$export$5665e3d6be6adea, {
...$3gjlC$reactariautils.mergeProps(otherProps, virtualizerProps),
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement($0581d5c472ebf526$export$5665e3d6be6adea, {
...$7MV0W$reactariautils.mergeProps(otherProps, virtualizerProps),
ref: ref,

@@ -398,3 +398,3 @@ innerStyle: state.isAnimating ? {

}
function $ca3723f8a4684ab3$export$dd6d526d88b5a137(props, state, ref) {
function $e66fdc09badf2561$export$dd6d526d88b5a137(props, state, ref) {
let { focusedKey: focusedKey , scrollToItem: scrollToItem , shouldUseVirtualFocus: shouldUseVirtualFocus } = props;

@@ -405,4 +405,4 @@ let { virtualizer: virtualizer } = state;

// to all of the item DOM nodes.
let lastFocusedKey = $3gjlC$react.useRef(null);
$3gjlC$react.useEffect(()=>{
let lastFocusedKey = $7MV0W$react.useRef(null);
$7MV0W$react.useEffect(()=>{
if (virtualizer.visibleRect.height === 0) return;

@@ -423,4 +423,4 @@ if (focusedKey !== lastFocusedKey.current) {

]);
let isFocusWithin = $3gjlC$react.useRef(false);
let onFocus = $3gjlC$react.useCallback((e)=>{
let isFocusWithin = $7MV0W$react.useRef(false);
let onFocus = $7MV0W$react.useCallback((e)=>{
// If the focused item is scrolled out of view and is not in the DOM, the collection

@@ -442,3 +442,3 @@ // will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.

]);
let onBlur = $3gjlC$react.useCallback((e)=>{
let onBlur = $7MV0W$react.useCallback((e)=>{
isFocusWithin.current = ref.current.contains(e.relatedTarget);

@@ -451,4 +451,4 @@ }, [

let focusedView = virtualizer.getView(focusedKey);
$3gjlC$react.useEffect(()=>{
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $3gjlC$reactariautils.focusWithoutScrolling(ref.current);
$7MV0W$react.useEffect(()=>{
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $7MV0W$reactariautils.focusWithoutScrolling(ref.current);
});

@@ -471,5 +471,5 @@ // Set tabIndex to -1 if the focused view is in the DOM, otherwise 0 so that the collection

// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
const $ca3723f8a4684ab3$export$89be5a243e59c4b2 = /*#__PURE__*/ ($parcel$interopDefault($3gjlC$react)).forwardRef($ca3723f8a4684ab3$var$Virtualizer);
function $ca3723f8a4684ab3$var$defaultRenderWrapper(parent, reusableView) {
return(/*#__PURE__*/ ($parcel$interopDefault($3gjlC$react)).createElement($4a6b6f510b9f3ab3$export$6796df8ba7398521, {
const $e66fdc09badf2561$export$89be5a243e59c4b2 = /*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).forwardRef($e66fdc09badf2561$var$Virtualizer);
function $e66fdc09badf2561$var$defaultRenderWrapper(parent, reusableView) {
return(/*#__PURE__*/ ($parcel$interopDefault($7MV0W$react)).createElement($6504e5d37f19f01d$export$6796df8ba7398521, {
key: reusableView.key,

@@ -486,9 +486,9 @@ reusableView: reusableView,

$parcel$exportWildcard(module.exports, $ca3723f8a4684ab3$exports);
$parcel$exportWildcard(module.exports, $9e4914e897cd775b$exports);
$parcel$exportWildcard(module.exports, $4a6b6f510b9f3ab3$exports);
$parcel$exportWildcard(module.exports, $ac16625e392cd577$exports);
$parcel$exportWildcard(module.exports, $57bbbd99c9e34298$exports);
$parcel$exportWildcard(module.exports, $e66fdc09badf2561$exports);
$parcel$exportWildcard(module.exports, $e916556bbb66d2be$exports);
$parcel$exportWildcard(module.exports, $6504e5d37f19f01d$exports);
$parcel$exportWildcard(module.exports, $0581d5c472ebf526$exports);
$parcel$exportWildcard(module.exports, $e57feec0328c28a1$exports);
//# sourceMappingURL=main.js.map

@@ -1,6 +0,6 @@

import {useLayoutEffect as $1R1HF$useLayoutEffect, mergeProps as $1R1HF$mergeProps, focusWithoutScrolling as $1R1HF$focusWithoutScrolling, useResizeObserver as $1R1HF$useResizeObserver} from "@react-aria/utils";
import {useVirtualizerState as $1R1HF$useVirtualizerState, Rect as $1R1HF$Rect, Size as $1R1HF$Size} from "@react-stately/virtualizer";
import $1R1HF$react, {useRef as $1R1HF$useRef, useCallback as $1R1HF$useCallback, useEffect as $1R1HF$useEffect, useState as $1R1HF$useState} from "react";
import {flushSync as $1R1HF$flushSync} from "react-dom";
import {useLocale as $1R1HF$useLocale} from "@react-aria/i18n";
import {useLayoutEffect as $6Y8zc$useLayoutEffect, mergeProps as $6Y8zc$mergeProps, focusWithoutScrolling as $6Y8zc$focusWithoutScrolling, useResizeObserver as $6Y8zc$useResizeObserver} from "@react-aria/utils";
import {useVirtualizerState as $6Y8zc$useVirtualizerState, Rect as $6Y8zc$Rect, Size as $6Y8zc$Size} from "@react-stately/virtualizer";
import $6Y8zc$react, {useRef as $6Y8zc$useRef, useCallback as $6Y8zc$useCallback, useEffect as $6Y8zc$useEffect, useState as $6Y8zc$useState} from "react";
import {flushSync as $6Y8zc$flushSync} from "react-dom";
import {useLocale as $6Y8zc$useLocale} from "@react-aria/i18n";

@@ -10,21 +10,21 @@ function $parcel$export(e, n, v, s) {

}
var $a5dbc9cf2d19f590$exports = {};
var $28b0c838a8280658$exports = {};
$parcel$export($a5dbc9cf2d19f590$exports, "useVirtualizer", () => $a5dbc9cf2d19f590$export$dd6d526d88b5a137);
$parcel$export($a5dbc9cf2d19f590$exports, "Virtualizer", () => $a5dbc9cf2d19f590$export$89be5a243e59c4b2);
$parcel$export($28b0c838a8280658$exports, "useVirtualizer", () => $28b0c838a8280658$export$dd6d526d88b5a137);
$parcel$export($28b0c838a8280658$exports, "Virtualizer", () => $28b0c838a8280658$export$89be5a243e59c4b2);
var $9ced0cda9903d8f8$exports = {};
var $ea9606230722b6cd$exports = {};
$parcel$export($9ced0cda9903d8f8$exports, "ScrollView", () => $9ced0cda9903d8f8$export$5665e3d6be6adea);
$parcel$export($ea9606230722b6cd$exports, "ScrollView", () => $ea9606230722b6cd$export$5665e3d6be6adea);
var $c1608e43f6cbad04$exports = {};
var $bdbd287fd4ad4690$exports = {};
$parcel$export($c1608e43f6cbad04$exports, "getRTLOffsetType", () => $c1608e43f6cbad04$export$faf7630257ad4304);
$parcel$export($c1608e43f6cbad04$exports, "getScrollLeft", () => $c1608e43f6cbad04$export$1389d168952b34b5);
$parcel$export($c1608e43f6cbad04$exports, "setScrollLeft", () => $c1608e43f6cbad04$export$ed5fd5ffe5ab0ac);
let $c1608e43f6cbad04$var$cachedRTLResult = null;
function $c1608e43f6cbad04$export$faf7630257ad4304(recalculate = false) {
if ($c1608e43f6cbad04$var$cachedRTLResult === null || recalculate) {
$parcel$export($bdbd287fd4ad4690$exports, "getRTLOffsetType", () => $bdbd287fd4ad4690$export$faf7630257ad4304);
$parcel$export($bdbd287fd4ad4690$exports, "getScrollLeft", () => $bdbd287fd4ad4690$export$1389d168952b34b5);
$parcel$export($bdbd287fd4ad4690$exports, "setScrollLeft", () => $bdbd287fd4ad4690$export$ed5fd5ffe5ab0ac);
let $bdbd287fd4ad4690$var$cachedRTLResult = null;
function $bdbd287fd4ad4690$export$faf7630257ad4304(recalculate = false) {
if ($bdbd287fd4ad4690$var$cachedRTLResult === null || recalculate) {
const outerDiv = document.createElement('div');

@@ -42,14 +42,14 @@ const outerStyle = outerDiv.style;

document.body.appendChild(outerDiv);
if (outerDiv.scrollLeft > 0) $c1608e43f6cbad04$var$cachedRTLResult = 'positive-descending';
if (outerDiv.scrollLeft > 0) $bdbd287fd4ad4690$var$cachedRTLResult = 'positive-descending';
else {
outerDiv.scrollLeft = 1;
if (outerDiv.scrollLeft === 0) $c1608e43f6cbad04$var$cachedRTLResult = 'negative';
else $c1608e43f6cbad04$var$cachedRTLResult = 'positive-ascending';
if (outerDiv.scrollLeft === 0) $bdbd287fd4ad4690$var$cachedRTLResult = 'negative';
else $bdbd287fd4ad4690$var$cachedRTLResult = 'positive-ascending';
}
document.body.removeChild(outerDiv);
return $c1608e43f6cbad04$var$cachedRTLResult;
return $bdbd287fd4ad4690$var$cachedRTLResult;
}
return $c1608e43f6cbad04$var$cachedRTLResult;
return $bdbd287fd4ad4690$var$cachedRTLResult;
}
function $c1608e43f6cbad04$export$1389d168952b34b5(node, direction) {
function $bdbd287fd4ad4690$export$1389d168952b34b5(node, direction) {
let { scrollLeft: scrollLeft } = node;

@@ -60,3 +60,3 @@ // scrollLeft in rtl locales differs across browsers, so normalize.

let { scrollWidth: scrollWidth , clientWidth: clientWidth } = node;
switch($c1608e43f6cbad04$export$faf7630257ad4304()){
switch($bdbd287fd4ad4690$export$faf7630257ad4304()){
case 'negative':

@@ -72,4 +72,4 @@ scrollLeft = -scrollLeft;

}
function $c1608e43f6cbad04$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
if (direction === 'rtl') switch($c1608e43f6cbad04$export$faf7630257ad4304()){
function $bdbd287fd4ad4690$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
if (direction === 'rtl') switch($bdbd287fd4ad4690$export$faf7630257ad4304()){
case 'negative':

@@ -96,7 +96,7 @@ scrollLeft = -scrollLeft;

function $9ced0cda9903d8f8$var$ScrollView(props, ref) {
function $ea9606230722b6cd$var$ScrollView(props, ref) {
let { contentSize: contentSize , onVisibleRectChange: onVisibleRectChange , children: children , innerStyle: innerStyle , sizeToFit: sizeToFit , onScrollStart: onScrollStart , onScrollEnd: onScrollEnd , scrollDirection: scrollDirection = 'both' , ...otherProps } = props;
let defaultRef = $1R1HF$useRef();
let defaultRef = $6Y8zc$useRef();
ref = ref || defaultRef;
let state = $1R1HF$useRef({
let state = $6Y8zc$useRef({
scrollTop: 0,

@@ -110,14 +110,14 @@ scrollLeft: 0,

}).current;
let { direction: direction } = $1R1HF$useLocale();
let [isScrolling, setScrolling] = $1R1HF$useState(false);
let onScroll = $1R1HF$useCallback((e)=>{
let { direction: direction } = $6Y8zc$useLocale();
let [isScrolling, setScrolling] = $6Y8zc$useState(false);
let onScroll = $6Y8zc$useCallback((e)=>{
if (e.target !== e.currentTarget) return;
if (props.onScroll) props.onScroll(e);
$1R1HF$flushSync(()=>{
$6Y8zc$flushSync(()=>{
let scrollTop = e.currentTarget.scrollTop;
let scrollLeft = $c1608e43f6cbad04$export$1389d168952b34b5(e.currentTarget, direction);
let scrollLeft = $bdbd287fd4ad4690$export$1389d168952b34b5(e.currentTarget, direction);
// Prevent rubber band scrolling from shaking when scrolling out of bounds
state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));
state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));
onVisibleRectChange(new $1R1HF$Rect(state.scrollLeft, state.scrollTop, state.width, state.height));
onVisibleRectChange(new $6Y8zc$Rect(state.scrollLeft, state.scrollTop, state.width, state.height));
if (!state.isScrolling) {

@@ -153,3 +153,3 @@ state.isScrolling = true;

// eslint-disable-next-line arrow-body-style
$1R1HF$useEffect(()=>{
$6Y8zc$useEffect(()=>{
return ()=>{

@@ -159,3 +159,3 @@ clearTimeout(state.scrollTimeout);

}, []);
let updateSize = $1R1HF$useCallback(()=>{
let updateSize = $6Y8zc$useCallback(()=>{
let dom = ref.current;

@@ -172,3 +172,3 @@ if (!dom) return;

state.height = h;
onVisibleRectChange(new $1R1HF$Rect(state.scrollLeft, state.scrollTop, w, h));
onVisibleRectChange(new $6Y8zc$Rect(state.scrollLeft, state.scrollTop, w, h));
}

@@ -182,3 +182,3 @@ }, [

]);
$1R1HF$useLayoutEffect(()=>{
$6Y8zc$useLayoutEffect(()=>{
updateSize();

@@ -188,3 +188,3 @@ }, [

]);
$1R1HF$useResizeObserver({
$6Y8zc$useResizeObserver({
ref: ref,

@@ -205,3 +205,3 @@ onResize: updateSize

} else style.overflow = 'auto';
return(/*#__PURE__*/ $1R1HF$react.createElement("div", {
return(/*#__PURE__*/ $6Y8zc$react.createElement("div", {
...otherProps,

@@ -211,3 +211,3 @@ style: style,

onScroll: onScroll
}, /*#__PURE__*/ $1R1HF$react.createElement("div", {
}, /*#__PURE__*/ $6Y8zc$react.createElement("div", {
role: "presentation",

@@ -223,21 +223,21 @@ style: {

}
const $9ced0cda9903d8f8$export$5665e3d6be6adea = /*#__PURE__*/ $1R1HF$react.forwardRef($9ced0cda9903d8f8$var$ScrollView);
const $ea9606230722b6cd$export$5665e3d6be6adea = /*#__PURE__*/ $6Y8zc$react.forwardRef($ea9606230722b6cd$var$ScrollView);
var $a72628bad5aca288$exports = {};
var $59d9cc29f1abde27$exports = {};
$parcel$export($a72628bad5aca288$exports, "VirtualizerItem", () => $a72628bad5aca288$export$6796df8ba7398521);
$parcel$export($a72628bad5aca288$exports, "layoutInfoToStyle", () => $a72628bad5aca288$export$1481e64fbe01b8b3);
$parcel$export($59d9cc29f1abde27$exports, "VirtualizerItem", () => $59d9cc29f1abde27$export$6796df8ba7398521);
$parcel$export($59d9cc29f1abde27$exports, "layoutInfoToStyle", () => $59d9cc29f1abde27$export$1481e64fbe01b8b3);
var $48758ee8332cc648$exports = {};
var $a699ae714be8549e$exports = {};
$parcel$export($48758ee8332cc648$exports, "useVirtualizerItem", () => $48758ee8332cc648$export$1da781778207e0a2);
$parcel$export($a699ae714be8549e$exports, "useVirtualizerItem", () => $a699ae714be8549e$export$1da781778207e0a2);
function $48758ee8332cc648$export$1da781778207e0a2(options) {
function $a699ae714be8549e$export$1da781778207e0a2(options) {
let { reusableView: { layoutInfo: layoutInfo , virtualizer: virtualizer } , ref: ref } = options;
let updateSize = $1R1HF$useCallback(()=>{
let size = $48758ee8332cc648$var$getSize(ref.current);
let updateSize = $6Y8zc$useCallback(()=>{
let size = $a699ae714be8549e$var$getSize(ref.current);
virtualizer.updateItemSize(layoutInfo.key, size);

@@ -249,3 +249,3 @@ }, [

]);
$1R1HF$useLayoutEffect(()=>{
$6Y8zc$useLayoutEffect(()=>{
if (layoutInfo.estimatedSize) updateSize();

@@ -257,7 +257,7 @@ });

}
function $48758ee8332cc648$var$getSize(node) {
function $a699ae714be8549e$var$getSize(node) {
// Reset height before measuring so we get the intrinsic size
let height = node.style.height;
node.style.height = '';
let size = new $1R1HF$Size(node.scrollWidth, node.scrollHeight);
let size = new $6Y8zc$Size(node.scrollWidth, node.scrollHeight);
node.style.height = height;

@@ -268,21 +268,21 @@ return size;

function $a72628bad5aca288$export$6796df8ba7398521(props) {
function $59d9cc29f1abde27$export$6796df8ba7398521(props) {
let { className: className , reusableView: reusableView , parent: parent } = props;
let { direction: direction } = $1R1HF$useLocale();
let ref = $1R1HF$useRef();
$48758ee8332cc648$export$1da781778207e0a2({
let { direction: direction } = $6Y8zc$useLocale();
let ref = $6Y8zc$useRef();
$a699ae714be8549e$export$1da781778207e0a2({
reusableView: reusableView,
ref: ref
});
return(/*#__PURE__*/ $1R1HF$react.createElement("div", {
return(/*#__PURE__*/ $6Y8zc$react.createElement("div", {
role: "presentation",
ref: ref,
className: className,
style: $a72628bad5aca288$export$1481e64fbe01b8b3(reusableView.layoutInfo, direction, parent && parent.layoutInfo)
style: $59d9cc29f1abde27$export$1481e64fbe01b8b3(reusableView.layoutInfo, direction, parent && parent.layoutInfo)
}, reusableView.rendered));
}
let $a72628bad5aca288$var$cache = new WeakMap();
function $a72628bad5aca288$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
let $59d9cc29f1abde27$var$cache = new WeakMap();
function $59d9cc29f1abde27$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
let xProperty = dir === 'rtl' ? 'right' : 'left';
let cached = $a72628bad5aca288$var$cache.get(layoutInfo);
let cached = $59d9cc29f1abde27$var$cache.get(layoutInfo);
if (cached && cached[xProperty] != null) {

@@ -311,3 +311,3 @@ if (!parent) return cached;

};
$a72628bad5aca288$var$cache.set(layoutInfo, style);
$59d9cc29f1abde27$var$cache.set(layoutInfo, style);
return style;

@@ -317,3 +317,3 @@ }

function $a5dbc9cf2d19f590$var$Virtualizer(props, ref) {
function $28b0c838a8280658$var$Virtualizer(props, ref) {
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

@@ -323,5 +323,5 @@ focusedKey , shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars

scrollToItem , ...otherProps } = props;
let fallbackRef = $1R1HF$useRef();
let fallbackRef = $6Y8zc$useRef();
ref = ref || fallbackRef;
let state = $1R1HF$useVirtualizerState({
let state = $6Y8zc$useVirtualizerState({
transitionDuration: transitionDuration,

@@ -331,3 +331,3 @@ layout: layout,

renderView: renderView,
renderWrapper: renderWrapper || $a5dbc9cf2d19f590$var$defaultRenderWrapper,
renderWrapper: renderWrapper || $28b0c838a8280658$var$defaultRenderWrapper,
onVisibleRectChange (rect) {

@@ -338,5 +338,5 @@ ref.current.scrollLeft = rect.x;

});
let { virtualizerProps: virtualizerProps } = $a5dbc9cf2d19f590$export$dd6d526d88b5a137(props, state, ref);
let { virtualizerProps: virtualizerProps } = $28b0c838a8280658$export$dd6d526d88b5a137(props, state, ref);
// Handle scrolling, and call onLoadMore when nearing the bottom.
let onVisibleRectChange = $1R1HF$useCallback((rect)=>{
let onVisibleRectChange = $6Y8zc$useCallback((rect)=>{
state.setVisibleRect(rect);

@@ -352,3 +352,3 @@ if (!isLoading && onLoadMore) {

]);
$1R1HF$useLayoutEffect(()=>{
$6Y8zc$useLayoutEffect(()=>{
if (!isLoading && onLoadMore && !state.isAnimating) {

@@ -364,4 +364,4 @@ if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();

]);
return(/*#__PURE__*/ $1R1HF$react.createElement($9ced0cda9903d8f8$export$5665e3d6be6adea, {
...$1R1HF$mergeProps(otherProps, virtualizerProps),
return(/*#__PURE__*/ $6Y8zc$react.createElement($ea9606230722b6cd$export$5665e3d6be6adea, {
...$6Y8zc$mergeProps(otherProps, virtualizerProps),
ref: ref,

@@ -379,3 +379,3 @@ innerStyle: state.isAnimating ? {

}
function $a5dbc9cf2d19f590$export$dd6d526d88b5a137(props, state, ref) {
function $28b0c838a8280658$export$dd6d526d88b5a137(props, state, ref) {
let { focusedKey: focusedKey , scrollToItem: scrollToItem , shouldUseVirtualFocus: shouldUseVirtualFocus } = props;

@@ -386,4 +386,4 @@ let { virtualizer: virtualizer } = state;

// to all of the item DOM nodes.
let lastFocusedKey = $1R1HF$useRef(null);
$1R1HF$useEffect(()=>{
let lastFocusedKey = $6Y8zc$useRef(null);
$6Y8zc$useEffect(()=>{
if (virtualizer.visibleRect.height === 0) return;

@@ -404,4 +404,4 @@ if (focusedKey !== lastFocusedKey.current) {

]);
let isFocusWithin = $1R1HF$useRef(false);
let onFocus = $1R1HF$useCallback((e)=>{
let isFocusWithin = $6Y8zc$useRef(false);
let onFocus = $6Y8zc$useCallback((e)=>{
// If the focused item is scrolled out of view and is not in the DOM, the collection

@@ -423,3 +423,3 @@ // will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.

]);
let onBlur = $1R1HF$useCallback((e)=>{
let onBlur = $6Y8zc$useCallback((e)=>{
isFocusWithin.current = ref.current.contains(e.relatedTarget);

@@ -432,4 +432,4 @@ }, [

let focusedView = virtualizer.getView(focusedKey);
$1R1HF$useEffect(()=>{
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $1R1HF$focusWithoutScrolling(ref.current);
$6Y8zc$useEffect(()=>{
if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $6Y8zc$focusWithoutScrolling(ref.current);
});

@@ -452,5 +452,5 @@ // Set tabIndex to -1 if the focused view is in the DOM, otherwise 0 so that the collection

// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
const $a5dbc9cf2d19f590$export$89be5a243e59c4b2 = /*#__PURE__*/ $1R1HF$react.forwardRef($a5dbc9cf2d19f590$var$Virtualizer);
function $a5dbc9cf2d19f590$var$defaultRenderWrapper(parent, reusableView) {
return(/*#__PURE__*/ $1R1HF$react.createElement($a72628bad5aca288$export$6796df8ba7398521, {
const $28b0c838a8280658$export$89be5a243e59c4b2 = /*#__PURE__*/ $6Y8zc$react.forwardRef($28b0c838a8280658$var$Virtualizer);
function $28b0c838a8280658$var$defaultRenderWrapper(parent, reusableView) {
return(/*#__PURE__*/ $6Y8zc$react.createElement($59d9cc29f1abde27$export$6796df8ba7398521, {
key: reusableView.key,

@@ -469,3 +469,3 @@ reusableView: reusableView,

export {$a5dbc9cf2d19f590$export$dd6d526d88b5a137 as useVirtualizer, $a5dbc9cf2d19f590$export$89be5a243e59c4b2 as Virtualizer, $48758ee8332cc648$export$1da781778207e0a2 as useVirtualizerItem, $a72628bad5aca288$export$6796df8ba7398521 as VirtualizerItem, $a72628bad5aca288$export$1481e64fbe01b8b3 as layoutInfoToStyle, $9ced0cda9903d8f8$export$5665e3d6be6adea as ScrollView, $c1608e43f6cbad04$export$faf7630257ad4304 as getRTLOffsetType, $c1608e43f6cbad04$export$1389d168952b34b5 as getScrollLeft, $c1608e43f6cbad04$export$ed5fd5ffe5ab0ac as setScrollLeft};
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};
//# sourceMappingURL=module.js.map
{
"name": "@react-aria/virtualizer",
"version": "3.3.7-nightly.3111+d6ded0736",
"version": "3.3.7",
"description": "Spectrum UI components in React",

@@ -21,6 +21,6 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@react-aria/i18n": "3.0.0-nightly.1415+d6ded0736",
"@react-aria/utils": "3.0.0-nightly.1415+d6ded0736",
"@react-stately/virtualizer": "3.1.7-nightly.3111+d6ded0736",
"@react-types/shared": "3.0.0-nightly.1415+d6ded0736"
"@react-aria/i18n": "^3.3.6",
"@react-aria/utils": "^3.11.2",
"@react-stately/virtualizer": "^3.1.7",
"@react-types/shared": "^3.11.1"
},

@@ -34,3 +34,3 @@ "peerDependencies": {

},
"gitHead": "d6ded0736edd4c36d0abeb1ae615cacfa90ea8ff"
"gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc