@react-aria/virtualizer 3.9.3-nightly.4149 → 3.9.3-nightly.4157

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/import.mjs CHANGED
@@ -78,11 +78,11 @@ function $ce415dc67314b753$export$faf7630257ad4304(recalculate = false) {
78
78
  return $ce415dc67314b753$var$cachedRTLResult;
79
79
  }
80
80
  function $ce415dc67314b753$export$1389d168952b34b5(node, direction) {
81
- let { scrollLeft: scrollLeft } = node;
81
+ let { scrollLeft: scrollLeft } = node;
82
82
  // scrollLeft in rtl locales differs across browsers, so normalize.
83
83
  // See comment by getRTLOffsetType below for details.
84
84
  if (direction === "rtl") {
85
- let { scrollWidth: scrollWidth , clientWidth: clientWidth } = node;
85
+ let { scrollWidth: scrollWidth, clientWidth: clientWidth } = node;
86
86
  switch($ce415dc67314b753$export$faf7630257ad4304()){
87
87
  case "negative":
88
88
  scrollLeft = -scrollLeft;
@@ -103,7 +103,7 @@ function $ce415dc67314b753$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
103
103
  break;
104
104
  default:
105
105
  {
106
- const { clientWidth: clientWidth , scrollWidth: scrollWidth } = node;
106
+ const { clientWidth: clientWidth, scrollWidth: scrollWidth } = node;
107
107
  scrollLeft = scrollWidth - clientWidth - scrollLeft;
108
108
  break;
109
109
  }
@@ -117,7 +117,7 @@ function $ce415dc67314b753$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
117
117
 
118
118
 
119
119
  function $44a6ee657928b002$var$ScrollView(props, ref) {
120
- let { contentSize: contentSize , onVisibleRectChange: onVisibleRectChange , children: children , innerStyle: innerStyle , sizeToFit: sizeToFit , onScrollStart: onScrollStart , onScrollEnd: onScrollEnd , scrollDirection: scrollDirection = "both" , ...otherProps } = props;
120
+ let { contentSize: contentSize, onVisibleRectChange: onVisibleRectChange, children: children, innerStyle: innerStyle, sizeToFit: sizeToFit, onScrollStart: onScrollStart, onScrollEnd: onScrollEnd, scrollDirection: scrollDirection = "both", ...otherProps } = props;
121
121
  let defaultRef = (0, $kSaV5$useRef)();
122
122
  ref = ref || defaultRef;
123
123
  let state = (0, $kSaV5$useRef)({
@@ -129,7 +129,7 @@ function $44a6ee657928b002$var$ScrollView(props, ref) {
129
129
  height: 0,
130
130
  isScrolling: false
131
131
  }).current;
132
- let { direction: direction } = (0, $kSaV5$useLocale)();
132
+ let { direction: direction } = (0, $kSaV5$useLocale)();
133
133
  let [isScrolling, setScrolling] = (0, $kSaV5$useState)(false);
134
134
  let onScroll = (0, $kSaV5$useCallback)((e)=>{
135
135
  if (e.target !== e.currentTarget) return;
@@ -264,7 +264,7 @@ const $44a6ee657928b002$export$5665e3d6be6adea = /*#__PURE__*/ (0, $kSaV5$react)
264
264
 
265
265
 
266
266
  function $47736c1e63ba1c6d$export$1da781778207e0a2(options) {
267
- let { layoutInfo: layoutInfo , virtualizer: virtualizer , ref: ref } = options;
267
+ let { layoutInfo: layoutInfo, virtualizer: virtualizer, ref: ref } = options;
268
268
  let updateSize = (0, $kSaV5$useCallback)(()=>{
269
269
  let size = $47736c1e63ba1c6d$var$getSize(ref.current);
270
270
  virtualizer.updateItemSize(layoutInfo.key, size);
@@ -291,8 +291,8 @@ function $47736c1e63ba1c6d$var$getSize(node) {
291
291
 
292
292
 
293
293
  function $ccf8a0a04e4175ae$export$6796df8ba7398521(props) {
294
- let { className: className , layoutInfo: layoutInfo , virtualizer: virtualizer , parent: parent , children: children } = props;
295
- let { direction: direction } = (0, $kSaV5$useLocale)();
294
+ let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
295
+ let { direction: direction } = (0, $kSaV5$useLocale)();
296
296
  let ref = (0, $kSaV5$useRef)();
297
297
  (0, $47736c1e63ba1c6d$export$1da781778207e0a2)({
298
298
  layoutInfo: layoutInfo,
@@ -341,13 +341,13 @@ function $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
341
341
 
342
342
 
343
343
  function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
344
- let { children: renderView , renderWrapper: renderWrapper , layout: layout , collection: collection , sizeToFit: sizeToFit , scrollDirection: scrollDirection , transitionDuration: transitionDuration , isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
345
- isLoading , onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
346
- onLoadMore , focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
347
- focusedKey , shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
348
- shouldUseVirtualFocus , scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
349
- scrollToItem , autoFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
350
- autoFocus , ...otherProps } = props;
344
+ let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, sizeToFit: sizeToFit, scrollDirection: scrollDirection, transitionDuration: transitionDuration, isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
345
+ isLoading, onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
346
+ onLoadMore, focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
347
+ focusedKey, shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
348
+ shouldUseVirtualFocus, scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
349
+ scrollToItem, autoFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
350
+ autoFocus, ...otherProps } = props;
351
351
  let fallbackRef = (0, $kSaV5$useRef)();
352
352
  ref = ref || fallbackRef;
353
353
  let state = (0, $kSaV5$useVirtualizerState)({
@@ -361,7 +361,7 @@ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
361
361
  ref.current.scrollTop = rect.y;
362
362
  }
363
363
  });
364
- let { virtualizerProps: virtualizerProps , scrollViewProps: scrollViewProps } = $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref);
364
+ let { virtualizerProps: virtualizerProps, scrollViewProps: scrollViewProps } = $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref);
365
365
  return /*#__PURE__*/ (0, $kSaV5$react).createElement((0, $44a6ee657928b002$export$5665e3d6be6adea), {
366
366
  ...(0, $kSaV5$mergeProps)(otherProps, virtualizerProps, scrollViewProps),
367
367
  ref: ref,
@@ -376,8 +376,8 @@ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
376
376
  }, state.visibleViews);
377
377
  }
378
378
  function $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref) {
379
- let { focusedKey: focusedKey , scrollToItem: scrollToItem , shouldUseVirtualFocus: shouldUseVirtualFocus , isLoading: isLoading , onLoadMore: onLoadMore } = props;
380
- let { virtualizer: virtualizer } = state;
379
+ let { focusedKey: focusedKey, scrollToItem: scrollToItem, shouldUseVirtualFocus: shouldUseVirtualFocus, isLoading: isLoading, onLoadMore: onLoadMore } = props;
380
+ let { virtualizer: virtualizer } = state;
381
381
  // Scroll to the focusedKey when it changes. Actually focusing the focusedKey
382
382
  // is up to the implementation using Virtualizer since we don't have refs
383
383
  // to all of the item DOM nodes.
package/dist/main.js CHANGED
@@ -94,11 +94,11 @@ function $efdd61e59e023a1d$export$faf7630257ad4304(recalculate = false) {
94
94
  return $efdd61e59e023a1d$var$cachedRTLResult;
95
95
  }
96
96
  function $efdd61e59e023a1d$export$1389d168952b34b5(node, direction) {
97
- let { scrollLeft: scrollLeft } = node;
97
+ let { scrollLeft: scrollLeft } = node;
98
98
  // scrollLeft in rtl locales differs across browsers, so normalize.
99
99
  // See comment by getRTLOffsetType below for details.
100
100
  if (direction === "rtl") {
101
- let { scrollWidth: scrollWidth , clientWidth: clientWidth } = node;
101
+ let { scrollWidth: scrollWidth, clientWidth: clientWidth } = node;
102
102
  switch($efdd61e59e023a1d$export$faf7630257ad4304()){
103
103
  case "negative":
104
104
  scrollLeft = -scrollLeft;
@@ -119,7 +119,7 @@ function $efdd61e59e023a1d$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
119
119
  break;
120
120
  default:
121
121
  {
122
- const { clientWidth: clientWidth , scrollWidth: scrollWidth } = node;
122
+ const { clientWidth: clientWidth, scrollWidth: scrollWidth } = node;
123
123
  scrollLeft = scrollWidth - clientWidth - scrollLeft;
124
124
  break;
125
125
  }
@@ -133,7 +133,7 @@ function $efdd61e59e023a1d$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
133
133
 
134
134
 
135
135
  function $00ca8c0b29e3e07c$var$ScrollView(props, ref) {
136
- let { contentSize: contentSize , onVisibleRectChange: onVisibleRectChange , children: children , innerStyle: innerStyle , sizeToFit: sizeToFit , onScrollStart: onScrollStart , onScrollEnd: onScrollEnd , scrollDirection: scrollDirection = "both" , ...otherProps } = props;
136
+ let { contentSize: contentSize, onVisibleRectChange: onVisibleRectChange, children: children, innerStyle: innerStyle, sizeToFit: sizeToFit, onScrollStart: onScrollStart, onScrollEnd: onScrollEnd, scrollDirection: scrollDirection = "both", ...otherProps } = props;
137
137
  let defaultRef = (0, $kYtlh$react.useRef)();
138
138
  ref = ref || defaultRef;
139
139
  let state = (0, $kYtlh$react.useRef)({
@@ -145,7 +145,7 @@ function $00ca8c0b29e3e07c$var$ScrollView(props, ref) {
145
145
  height: 0,
146
146
  isScrolling: false
147
147
  }).current;
148
- let { direction: direction } = (0, $kYtlh$reactariai18n.useLocale)();
148
+ let { direction: direction } = (0, $kYtlh$reactariai18n.useLocale)();
149
149
  let [isScrolling, setScrolling] = (0, $kYtlh$react.useState)(false);
150
150
  let onScroll = (0, $kYtlh$react.useCallback)((e)=>{
151
151
  if (e.target !== e.currentTarget) return;
@@ -280,7 +280,7 @@ const $00ca8c0b29e3e07c$export$5665e3d6be6adea = /*#__PURE__*/ (0, ($parcel$inte
280
280
 
281
281
 
282
282
  function $7d70e069fceb2deb$export$1da781778207e0a2(options) {
283
- let { layoutInfo: layoutInfo , virtualizer: virtualizer , ref: ref } = options;
283
+ let { layoutInfo: layoutInfo, virtualizer: virtualizer, ref: ref } = options;
284
284
  let updateSize = (0, $kYtlh$react.useCallback)(()=>{
285
285
  let size = $7d70e069fceb2deb$var$getSize(ref.current);
286
286
  virtualizer.updateItemSize(layoutInfo.key, size);
@@ -307,8 +307,8 @@ function $7d70e069fceb2deb$var$getSize(node) {
307
307
 
308
308
 
309
309
  function $d6a26279cc31826b$export$6796df8ba7398521(props) {
310
- let { className: className , layoutInfo: layoutInfo , virtualizer: virtualizer , parent: parent , children: children } = props;
311
- let { direction: direction } = (0, $kYtlh$reactariai18n.useLocale)();
310
+ let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
311
+ let { direction: direction } = (0, $kYtlh$reactariai18n.useLocale)();
312
312
  let ref = (0, $kYtlh$react.useRef)();
313
313
  (0, $7d70e069fceb2deb$export$1da781778207e0a2)({
314
314
  layoutInfo: layoutInfo,
@@ -357,13 +357,13 @@ function $d6a26279cc31826b$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
357
357
 
358
358
 
359
359
  function $e1fb6f3669e1c329$var$Virtualizer(props, ref) {
360
- let { children: renderView , renderWrapper: renderWrapper , layout: layout , collection: collection , sizeToFit: sizeToFit , scrollDirection: scrollDirection , transitionDuration: transitionDuration , isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
361
- isLoading , onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
362
- onLoadMore , focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
363
- focusedKey , shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
364
- shouldUseVirtualFocus , scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
365
- scrollToItem , autoFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
366
- autoFocus , ...otherProps } = props;
360
+ let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, sizeToFit: sizeToFit, scrollDirection: scrollDirection, transitionDuration: transitionDuration, isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
361
+ isLoading, onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
362
+ onLoadMore, focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
363
+ focusedKey, shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
364
+ shouldUseVirtualFocus, scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
365
+ scrollToItem, autoFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
366
+ autoFocus, ...otherProps } = props;
367
367
  let fallbackRef = (0, $kYtlh$react.useRef)();
368
368
  ref = ref || fallbackRef;
369
369
  let state = (0, $kYtlh$reactstatelyvirtualizer.useVirtualizerState)({
@@ -377,7 +377,7 @@ function $e1fb6f3669e1c329$var$Virtualizer(props, ref) {
377
377
  ref.current.scrollTop = rect.y;
378
378
  }
379
379
  });
380
- let { virtualizerProps: virtualizerProps , scrollViewProps: scrollViewProps } = $e1fb6f3669e1c329$export$dd6d526d88b5a137(props, state, ref);
380
+ let { virtualizerProps: virtualizerProps, scrollViewProps: scrollViewProps } = $e1fb6f3669e1c329$export$dd6d526d88b5a137(props, state, ref);
381
381
  return /*#__PURE__*/ (0, ($parcel$interopDefault($kYtlh$react))).createElement((0, $00ca8c0b29e3e07c$export$5665e3d6be6adea), {
382
382
  ...(0, $kYtlh$reactariautils.mergeProps)(otherProps, virtualizerProps, scrollViewProps),
383
383
  ref: ref,
@@ -392,8 +392,8 @@ function $e1fb6f3669e1c329$var$Virtualizer(props, ref) {
392
392
  }, state.visibleViews);
393
393
  }
394
394
  function $e1fb6f3669e1c329$export$dd6d526d88b5a137(props, state, ref) {
395
- let { focusedKey: focusedKey , scrollToItem: scrollToItem , shouldUseVirtualFocus: shouldUseVirtualFocus , isLoading: isLoading , onLoadMore: onLoadMore } = props;
396
- let { virtualizer: virtualizer } = state;
395
+ let { focusedKey: focusedKey, scrollToItem: scrollToItem, shouldUseVirtualFocus: shouldUseVirtualFocus, isLoading: isLoading, onLoadMore: onLoadMore } = props;
396
+ let { virtualizer: virtualizer } = state;
397
397
  // Scroll to the focusedKey when it changes. Actually focusing the focusedKey
398
398
  // is up to the implementation using Virtualizer since we don't have refs
399
399
  // to all of the item DOM nodes.
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;;ACVD;;;;;;;;;;CAUC,GAED,aAAa;;ACZb;;;;;;;;;;CAUC,GASD,IAAI,wCAAwC;AAarC,SAAS,0CAAiB,cAAuB,KAAK;IAC3D,IAAI,0CAAoB,QAAQ,aAAa;QAC3C,MAAM,WAAW,SAAS,cAAc;QACxC,MAAM,aAAa,SAAS;QAC5B,WAAW,QAAQ;QACnB,WAAW,SAAS;QACpB,WAAW,WAAW;QACtB,WAAW,YAAY;QAEvB,MAAM,WAAW,SAAS,cAAc;QACxC,MAAM,aAAa,SAAS;QAC5B,WAAW,QAAQ;QACnB,WAAW,SAAS;QAEpB,SAAS,YAAY;QAErB,SAAS,KAAK,YAAY;QAE1B,IAAI,SAAS,aAAa,GACxB,wCAAkB;aACb;YACL,SAAS,aAAa;YACtB,IAAI,SAAS,eAAe,GAC1B,wCAAkB;iBAElB,wCAAkB;QAEtB;QAEA,SAAS,KAAK,YAAY;QAE1B,OAAO;IACT;IAEA,OAAO;AACT;AAEO,SAAS,0CAAc,IAAa,EAAE,SAAoB;IAC/D,IAAI,cAAC,WAAU,EAAC,GAAG;IAEnB,mEAAmE;IACnE,qDAAqD;IACrD,IAAI,cAAc,OAAO;QACvB,IAAI,eAAC,YAAW,eAAE,YAAW,EAAC,GAAG;QACjC,OAAQ;YACN,KAAK;gBACH,aAAa,CAAC;gBACd;YACF,KAAK;gBACH,aAAa,cAAc,cAAc;gBACzC;QACJ;IACF;IAEA,OAAO;AACT;AAEO,SAAS,yCAAc,IAAa,EAAE,SAAoB,EAAE,UAAkB;IACnF,IAAI,cAAc,OAChB,OAAQ;Q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@react-aria/virtualizer/src/index.ts","packages/@react-aria/virtualizer/src/Virtualizer.tsx","packages/@react-aria/virtualizer/src/ScrollView.tsx","packages/@react-aria/virtualizer/src/utils.ts","packages/@react-aria/virtualizer/src/VirtualizerItem.tsx","packages/@react-aria/virtualizer/src/useVirtualizerItem.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {RTLOffsetType} from './utils';\nexport type {VirtualizerItemOptions} from './useVirtualizerItem';\nexport {useVirtualizer, Virtualizer} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection} from '@react-types/shared';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n ) => ReactElement,\n layout: Layout<T>,\n collection: Collection<T>,\n focusedKey?: Key,\n sizeToFit?: 'width' | 'height',\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n transitionDuration?: number,\n isLoading?: boolean,\n onLoadMore?: () => void,\n shouldUseVirtualFocus?: boolean,\n scrollToItem?: (key: Key) => void,\n autoFocus?: boolean\n}\n\nfunction Virtualizer<T extends object, V extends ReactNode>(props: VirtualizerProps<T, V>, ref: RefObject<HTMLDivElement>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n sizeToFit,\n scrollDirection,\n transitionDuration,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n focusedKey,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n shouldUseVirtualFocus,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n scrollToItem,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n autoFocus,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>();\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n transitionDuration,\n layout,\n collection,\n renderView,\n renderWrapper: renderWrapper || defaultRenderWrapper,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n }\n });\n\n let {virtualizerProps, scrollViewProps} = useVirtualizer(props, state, ref);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps, scrollViewProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n sizeToFit={sizeToFit}\n scrollDirection={scrollDirection}>\n {state.visibleViews}\n </ScrollView>\n );\n}\n\ninterface VirtualizerOptions {\n tabIndex?: number,\n focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean,\n autoFocus?: boolean,\n isLoading?: boolean,\n onLoadMore?: () => void\n}\n\nexport function useVirtualizer<T extends object, V extends ReactNode, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus, isLoading, onLoadMore} = props;\n let {virtualizer} = state;\n // Scroll to the focusedKey when it changes. Actually focusing the focusedKey\n // is up to the implementation using Virtualizer since we don't have refs\n // to all of the item DOM nodes.\n let lastFocusedKey = useRef(null);\n let isFocusWithin = useRef(false);\n let autoFocus = useRef(props.autoFocus);\n useEffect(() => {\n if (virtualizer.visibleRect.height === 0) {\n return;\n }\n\n // Only scroll the focusedKey into view if the modality is not pointer to avoid jumps in position when clicking/pressing tall items.\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || autoFocus.current)) {\n autoFocus.current = false;\n if (scrollToItem) {\n // If user provides scrolltoitem, then it is their responsibility to call scrollIntoViewport if desired\n // since we don't know if their scrollToItem may take some time to actually bring the active element into the virtualizer's visible rect.\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem, ref]);\n\n // Persist the focusedKey and prevent it from being removed from the DOM when scrolled out of view.\n virtualizer.persistedKeys = useMemo(() => focusedKey ? new Set([focusedKey]) : new Set(), [focusedKey]);\n\n let onFocus = useCallback((e: FocusEvent) => {\n // If the focused item is scrolled out of view and is not in the DOM, the collection\n // will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.\n // Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)\n // Don't scroll focused key into view if modality is pointer to prevent sudden jump in position (e.g. CardView).\n let modality = getInteractionModality();\n if (!isFocusWithin.current && ref.current.contains(e.target) && modality !== 'pointer') {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n isFocusWithin.current = e.target !== ref.current;\n }, [ref, virtualizer, focusedKey, scrollToItem]);\n\n let onBlur = useCallback((e: FocusEvent) => {\n isFocusWithin.current = ref.current.contains(e.relatedTarget as Element);\n }, [ref]);\n\n // Set tabIndex to -1 if there is a focused key, otherwise 0 so that the collection\n // itself is tabbable. When the collection receives focus, we scroll the focused item back into\n // view, which will allow it to be properly focused. If using virtual focus, don't set a\n // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n // When there is no focusedKey the default tabIndex is 0. We include logic for empty collections too.\n // For collections that are empty, but have a link in the empty children we want to skip focusing this\n // and let focus move to the link similar to link moving to children.\n tabIndex = focusedKey != null ? -1 : 0;\n\n // If the collection is empty, we want the tabIndex provided from props (if any)\n // so that we handle when tabbable items are added to the empty state.\n if (virtualizer.collection.size === 0 && props.tabIndex != null) {\n tabIndex = props.tabIndex;\n }\n }\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoadingRef.current && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, state]);\n\n let lastContentSize = useRef(0);\n useLayoutEffect(() => {\n // If animating, wait until we're done.\n if (state.isAnimating) {\n return;\n }\n\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n let wasLoading = isLoadingRef.current;\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n let shouldLoadMore = !isLoadingRef.current\n && onLoadMore\n && state.contentSize.height > 0\n && state.contentSize.height <= state.virtualizer.visibleRect.height\n // Only try loading more if the content size changed, or if we just finished\n // loading and still have room for more items.\n && (wasLoading || state.contentSize.height !== lastContentSize.current);\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n lastContentSize.current = state.contentSize.height;\n }, [state.contentSize, state.isAnimating, state.virtualizer, isLoading, onLoadMore, props]);\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\n },\n scrollViewProps: {\n onVisibleRectChange\n }\n };\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V>(props: VirtualizerProps<T, V> & {ref?: RefObject<HTMLDivElement>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// @ts-ignore\nimport {flushSync} from 'react-dom';\nimport {getScrollLeft} from './utils';\nimport React, {\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {Rect, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ScrollViewProps extends HTMLAttributes<HTMLElement> {\n contentSize: Size,\n onVisibleRectChange: (rect: Rect) => void,\n children: ReactNode,\n innerStyle?: CSSProperties,\n sizeToFit?: 'width' | 'height',\n onScrollStart?: () => void,\n onScrollEnd?: () => void,\n scrollDirection?: 'horizontal' | 'vertical' | 'both'\n}\n\nfunction ScrollView(props: ScrollViewProps, ref: RefObject<HTMLDivElement>) {\n let {\n contentSize,\n onVisibleRectChange,\n children,\n innerStyle,\n sizeToFit,\n onScrollStart,\n onScrollEnd,\n scrollDirection = 'both',\n ...otherProps\n } = props;\n\n let defaultRef = useRef();\n ref = ref || defaultRef;\n let state = useRef({\n scrollTop: 0,\n scrollLeft: 0,\n scrollEndTime: 0,\n scrollTimeout: null,\n width: 0,\n height: 0,\n isScrolling: false\n }).current;\n let {direction} = useLocale();\n\n let [isScrolling, setScrolling] = useState(false);\n let onScroll = useCallback((e) => {\n if (e.target !== e.currentTarget) {\n return;\n }\n\n if (props.onScroll) {\n props.onScroll(e);\n }\n\n flushSync(() => {\n let scrollTop = e.currentTarget.scrollTop;\n let scrollLeft = getScrollLeft(e.currentTarget, direction);\n\n // Prevent rubber band scrolling from shaking when scrolling out of bounds\n state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));\n state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));\n\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, state.width, state.height));\n\n if (!state.isScrolling) {\n state.isScrolling = true;\n setScrolling(true);\n\n if (onScrollStart) {\n onScrollStart();\n }\n }\n\n // So we don't constantly call clearTimeout and setTimeout,\n // keep track of the current timeout time and only reschedule\n // the timer when it is getting close.\n let now = Date.now();\n if (state.scrollEndTime <= now + 50) {\n state.scrollEndTime = now + 300;\n\n clearTimeout(state.scrollTimeout);\n state.scrollTimeout = setTimeout(() => {\n state.isScrolling = false;\n setScrolling(false);\n state.scrollTimeout = null;\n\n if (onScrollEnd) {\n onScrollEnd();\n }\n }, 300);\n }\n });\n }, [props, direction, state, contentSize, onVisibleRectChange, onScrollStart, onScrollEnd]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n clearTimeout(state.scrollTimeout);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let updateSize = useCallback(() => {\n let dom = ref.current;\n if (!dom) {\n return;\n }\n\n let w = dom.clientWidth;\n let h = dom.clientHeight;\n if (sizeToFit && contentSize.width > 0 && contentSize.height > 0) {\n if (sizeToFit === 'width') {\n w = Math.min(w, contentSize.width);\n } else if (sizeToFit === 'height') {\n h = Math.min(h, contentSize.height);\n }\n }\n\n if (state.width !== w || state.height !== h) {\n state.width = w;\n state.height = h;\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, w, h));\n }\n }, [onVisibleRectChange, ref, state, sizeToFit, contentSize]);\n\n useLayoutEffect(() => {\n updateSize();\n }, [updateSize]);\n useResizeObserver({ref, onResize: updateSize});\n\n let style: React.CSSProperties = {\n // Reset padding so that relative positioning works correctly. Padding will be done in JS layout.\n padding: 0,\n ...otherProps.style\n };\n\n if (scrollDirection === 'horizontal') {\n style.overflowX = 'auto';\n style.overflowY = 'hidden';\n } else if (scrollDirection === 'vertical') {\n style.overflowY = 'auto';\n style.overflowX = 'hidden';\n } else {\n style.overflow = 'auto';\n }\n\n return (\n <div {...otherProps} style={style} ref={ref} onScroll={onScroll}>\n <div role=\"presentation\" style={{width: contentSize.width, height: contentSize.height, pointerEvents: isScrolling ? 'none' : 'auto', position: 'relative', ...innerStyle}}>\n {children}\n </div>\n </div>\n );\n}\n\nconst ScrollViewForwardRef = React.forwardRef(ScrollView);\nexport {ScrollViewForwardRef as ScrollView};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\n\nexport type RTLOffsetType =\n | 'negative'\n | 'positive-descending'\n | 'positive-ascending';\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/bvaughn/react-window/blob/master/src/createGridComponent.js\n\n// According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement('div');\n const outerStyle = outerDiv.style;\n outerStyle.width = '50px';\n outerStyle.height = '50px';\n outerStyle.overflow = 'scroll';\n outerStyle.direction = 'rtl';\n\n const innerDiv = document.createElement('div');\n const innerStyle = innerDiv.style;\n innerStyle.width = '100px';\n innerStyle.height = '100px';\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = 'positive-descending';\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = 'negative';\n } else {\n cachedRTLResult = 'positive-ascending';\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n\nexport function getScrollLeft(node: Element, direction: Direction): number {\n let {scrollLeft} = node;\n\n // scrollLeft in rtl locales differs across browsers, so normalize.\n // See comment by getRTLOffsetType below for details.\n if (direction === 'rtl') {\n let {scrollWidth, clientWidth} = node;\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-descending':\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n\n return scrollLeft;\n}\n\nexport function setScrollLeft(node: Element, direction: Direction, scrollLeft: number) {\n if (direction === 'rtl') {\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-ascending':\n break;\n default: {\n const {clientWidth, scrollWidth} = node;\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n }\n\n node.scrollLeft = scrollLeft;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n transition: 'all',\n WebkitTransition: 'all',\n WebkitTransitionDuration: 'inherit',\n transitionDuration: 'inherit',\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height,\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style'\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, RefObject, useCallback} from 'react';\nimport {LayoutInfo, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface IVirtualizer {\n updateItemSize(key: Key, size: Size): void\n}\n\nexport interface VirtualizerItemOptions {\n layoutInfo: LayoutInfo,\n virtualizer: IVirtualizer,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem(options: VirtualizerItemOptions) {\n let {layoutInfo, virtualizer, ref} = options;\n\n let updateSize = useCallback(() => {\n let size = getSize(ref.current);\n virtualizer.updateItemSize(layoutInfo.key, size);\n }, [virtualizer, layoutInfo.key, ref]);\n\n useLayoutEffect(() => {\n if (layoutInfo.estimatedSize) {\n updateSize();\n }\n });\n\n return {updateSize};\n}\n\nfunction getSize(node: HTMLElement) {\n // Reset height before measuring so we get the intrinsic size\n let height = node.style.height;\n node.style.height = '';\n let size = new Size(node.scrollWidth, node.scrollHeight);\n node.style.height = height;\n return size;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;;ACVD;;;;;;;;;;CAUC,GAED,aAAa;;ACZb;;;;;;;;;;CAUC,GASD,IAAI,wCAAwC;AAarC,SAAS,0CAAiB,cAAuB,KAAK;IAC3D,IAAI,0CAAoB,QAAQ,aAAa;QAC3C,MAAM,WAAW,SAAS,cAAc;QACxC,MAAM,aAAa,SAAS;QAC5B,WAAW,QAAQ;QACnB,WAAW,SAAS;QACpB,WAAW,WAAW;QACtB,WAAW,YAAY;QAEvB,MAAM,WAAW,SAAS,cAAc;QACxC,MAAM,aAAa,SAAS;QAC5B,WAAW,QAAQ;QACnB,WAAW,SAAS;QAEpB,SAAS,YAAY;QAErB,SAAS,KAAK,YAAY;QAE1B,IAAI,SAAS,aAAa,GACxB,wCAAkB;aACb;YACL,SAAS,aAAa;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AU;YACvB;QACF;QACA,gBAAgB,UAAU,MAAM,YAAY;IAC9C,GAAG;QAAC,MAAM;QAAa,MAAM;QAAa,MAAM;QAAa;QAAW;QAAY;KAAM;IAE1F,OAAO;QACL,kBAAkB;sBAChB;qBACA;oBACA;QACF;QACA,iBAAiB;iCACf;QACF;IACF;AACF;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,sCAAI,EAAE,WAAW;AAGtC,SAAS,2CACP,MAAiC,EACjC,YAAgC;IAEhC,qBACE,0DAAC,CAAA,GAAA,yCAAc;QACb,KAAK,aAAa;QAClB,YAAY,aAAa;QACzB,aAAa,aAAa;QAC1B,QAAQ,mBAAA,oBAAA,KAAA,IAAA,OAAQ;OACf,aAAa;AAGpB;;CDrPC","sources":["packages/@react-aria/virtualizer/src/index.ts","packages/@react-aria/virtualizer/src/Virtualizer.tsx","packages/@react-aria/virtualizer/src/ScrollView.tsx","packages/@react-aria/virtualizer/src/utils.ts","packages/@react-aria/virtualizer/src/VirtualizerItem.tsx","packages/@react-aria/virtualizer/src/useVirtualizerItem.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {RTLOffsetType} from './utils';\nexport type {VirtualizerItemOptions} from './useVirtualizerItem';\nexport {useVirtualizer, Virtualizer} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection} from '@react-types/shared';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n ) => ReactElement,\n layout: Layout<T>,\n collection: Collection<T>,\n focusedKey?: Key,\n sizeToFit?: 'width' | 'height',\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n transitionDuration?: number,\n isLoading?: boolean,\n onLoadMore?: () => void,\n shouldUseVirtualFocus?: boolean,\n scrollToItem?: (key: Key) => void,\n autoFocus?: boolean\n}\n\nfunction Virtualizer<T extends object, V extends ReactNode>(props: VirtualizerProps<T, V>, ref: RefObject<HTMLDivElement>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n sizeToFit,\n scrollDirection,\n transitionDuration,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n focusedKey,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n shouldUseVirtualFocus,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n scrollToItem,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n autoFocus,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>();\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n transitionDuration,\n layout,\n collection,\n renderView,\n renderWrapper: renderWrapper || defaultRenderWrapper,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n }\n });\n\n let {virtualizerProps, scrollViewProps} = useVirtualizer(props, state, ref);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps, scrollViewProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n sizeToFit={sizeToFit}\n scrollDirection={scrollDirection}>\n {state.visibleViews}\n </ScrollView>\n );\n}\n\ninterface VirtualizerOptions {\n tabIndex?: number,\n focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean,\n autoFocus?: boolean,\n isLoading?: boolean,\n onLoadMore?: () => void\n}\n\nexport function useVirtualizer<T extends object, V extends ReactNode, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus, isLoading, onLoadMore} = props;\n let {virtualizer} = state;\n // Scroll to the focusedKey when it changes. Actually focusing the focusedKey\n // is up to the implementation using Virtualizer since we don't have refs\n // to all of the item DOM nodes.\n let lastFocusedKey = useRef(null);\n let isFocusWithin = useRef(false);\n let autoFocus = useRef(props.autoFocus);\n useEffect(() => {\n if (virtualizer.visibleRect.height === 0) {\n return;\n }\n\n // Only scroll the focusedKey into view if the modality is not pointer to avoid jumps in position when clicking/pressing tall items.\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || autoFocus.current)) {\n autoFocus.current = false;\n if (scrollToItem) {\n // If user provides scrolltoitem, then it is their responsibility to call scrollIntoViewport if desired\n // since we don't know if their scrollToItem may take some time to actually bring the active element into the virtualizer's visible rect.\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem, ref]);\n\n // Persist the focusedKey and prevent it from being removed from the DOM when scrolled out of view.\n virtualizer.persistedKeys = useMemo(() => focusedKey ? new Set([focusedKey]) : new Set(), [focusedKey]);\n\n let onFocus = useCallback((e: FocusEvent) => {\n // If the focused item is scrolled out of view and is not in the DOM, the collection\n // will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.\n // Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)\n // Don't scroll focused key into view if modality is pointer to prevent sudden jump in position (e.g. CardView).\n let modality = getInteractionModality();\n if (!isFocusWithin.current && ref.current.contains(e.target) && modality !== 'pointer') {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n isFocusWithin.current = e.target !== ref.current;\n }, [ref, virtualizer, focusedKey, scrollToItem]);\n\n let onBlur = useCallback((e: FocusEvent) => {\n isFocusWithin.current = ref.current.contains(e.relatedTarget as Element);\n }, [ref]);\n\n // Set tabIndex to -1 if there is a focused key, otherwise 0 so that the collection\n // itself is tabbable. When the collection receives focus, we scroll the focused item back into\n // view, which will allow it to be properly focused. If using virtual focus, don't set a\n // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n // When there is no focusedKey the default tabIndex is 0. We include logic for empty collections too.\n // For collections that are empty, but have a link in the empty children we want to skip focusing this\n // and let focus move to the link similar to link moving to children.\n tabIndex = focusedKey != null ? -1 : 0;\n\n // If the collection is empty, we want the tabIndex provided from props (if any)\n // so that we handle when tabbable items are added to the empty state.\n if (virtualizer.collection.size === 0 && props.tabIndex != null) {\n tabIndex = props.tabIndex;\n }\n }\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoadingRef.current && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, state]);\n\n let lastContentSize = useRef(0);\n useLayoutEffect(() => {\n // If animating, wait until we're done.\n if (state.isAnimating) {\n return;\n }\n\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n let wasLoading = isLoadingRef.current;\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n let shouldLoadMore = !isLoadingRef.current\n && onLoadMore\n && state.contentSize.height > 0\n && state.contentSize.height <= state.virtualizer.visibleRect.height\n // Only try loading more if the content size changed, or if we just finished\n // loading and still have room for more items.\n && (wasLoading || state.contentSize.height !== lastContentSize.current);\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n lastContentSize.current = state.contentSize.height;\n }, [state.contentSize, state.isAnimating, state.virtualizer, isLoading, onLoadMore, props]);\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\n },\n scrollViewProps: {\n onVisibleRectChange\n }\n };\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V>(props: VirtualizerProps<T, V> & {ref?: RefObject<HTMLDivElement>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// @ts-ignore\nimport {flushSync} from 'react-dom';\nimport {getScrollLeft} from './utils';\nimport React, {\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {Rect, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ScrollViewProps extends HTMLAttributes<HTMLElement> {\n contentSize: Size,\n onVisibleRectChange: (rect: Rect) => void,\n children: ReactNode,\n innerStyle?: CSSProperties,\n sizeToFit?: 'width' | 'height',\n onScrollStart?: () => void,\n onScrollEnd?: () => void,\n scrollDirection?: 'horizontal' | 'vertical' | 'both'\n}\n\nfunction ScrollView(props: ScrollViewProps, ref: RefObject<HTMLDivElement>) {\n let {\n contentSize,\n onVisibleRectChange,\n children,\n innerStyle,\n sizeToFit,\n onScrollStart,\n onScrollEnd,\n scrollDirection = 'both',\n ...otherProps\n } = props;\n\n let defaultRef = useRef();\n ref = ref || defaultRef;\n let state = useRef({\n scrollTop: 0,\n scrollLeft: 0,\n scrollEndTime: 0,\n scrollTimeout: null,\n width: 0,\n height: 0,\n isScrolling: false\n }).current;\n let {direction} = useLocale();\n\n let [isScrolling, setScrolling] = useState(false);\n let onScroll = useCallback((e) => {\n if (e.target !== e.currentTarget) {\n return;\n }\n\n if (props.onScroll) {\n props.onScroll(e);\n }\n\n flushSync(() => {\n let scrollTop = e.currentTarget.scrollTop;\n let scrollLeft = getScrollLeft(e.currentTarget, direction);\n\n // Prevent rubber band scrolling from shaking when scrolling out of bounds\n state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));\n state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));\n\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, state.width, state.height));\n\n if (!state.isScrolling) {\n state.isScrolling = true;\n setScrolling(true);\n\n if (onScrollStart) {\n onScrollStart();\n }\n }\n\n // So we don't constantly call clearTimeout and setTimeout,\n // keep track of the current timeout time and only reschedule\n // the timer when it is getting close.\n let now = Date.now();\n if (state.scrollEndTime <= now + 50) {\n state.scrollEndTime = now + 300;\n\n clearTimeout(state.scrollTimeout);\n state.scrollTimeout = setTimeout(() => {\n state.isScrolling = false;\n setScrolling(false);\n state.scrollTimeout = null;\n\n if (onScrollEnd) {\n onScrollEnd();\n }\n }, 300);\n }\n });\n }, [props, direction, state, contentSize, onVisibleRectChange, onScrollStart, onScrollEnd]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n clearTimeout(state.scrollTimeout);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let updateSize = useCallback(() => {\n let dom = ref.current;\n if (!dom) {\n return;\n }\n\n let w = dom.clientWidth;\n let h = dom.clientHeight;\n if (sizeToFit && contentSize.width > 0 && contentSize.height > 0) {\n if (sizeToFit === 'width') {\n w = Math.min(w, contentSize.width);\n } else if (sizeToFit === 'height') {\n h = Math.min(h, contentSize.height);\n }\n }\n\n if (state.width !== w || state.height !== h) {\n state.width = w;\n state.height = h;\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, w, h));\n }\n }, [onVisibleRectChange, ref, state, sizeToFit, contentSize]);\n\n useLayoutEffect(() => {\n updateSize();\n }, [updateSize]);\n useResizeObserver({ref, onResize: updateSize});\n\n let style: React.CSSProperties = {\n // Reset padding so that relative positioning works correctly. Padding will be done in JS layout.\n padding: 0,\n ...otherProps.style\n };\n\n if (scrollDirection === 'horizontal') {\n style.overflowX = 'auto';\n style.overflowY = 'hidden';\n } else if (scrollDirection === 'vertical') {\n style.overflowY = 'auto';\n style.overflowX = 'hidden';\n } else {\n style.overflow = 'auto';\n }\n\n return (\n <div {...otherProps} style={style} ref={ref} onScroll={onScroll}>\n <div role=\"presentation\" style={{width: contentSize.width, height: contentSize.height, pointerEvents: isScrolling ? 'none' : 'auto', position: 'relative', ...innerStyle}}>\n {children}\n </div>\n </div>\n );\n}\n\nconst ScrollViewForwardRef = React.forwardRef(ScrollView);\nexport {ScrollViewForwardRef as ScrollView};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\n\nexport type RTLOffsetType =\n | 'negative'\n | 'positive-descending'\n | 'positive-ascending';\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/bvaughn/react-window/blob/master/src/createGridComponent.js\n\n// According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement('div');\n const outerStyle = outerDiv.style;\n outerStyle.width = '50px';\n outerStyle.height = '50px';\n outerStyle.overflow = 'scroll';\n outerStyle.direction = 'rtl';\n\n const innerDiv = document.createElement('div');\n const innerStyle = innerDiv.style;\n innerStyle.width = '100px';\n innerStyle.height = '100px';\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = 'positive-descending';\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = 'negative';\n } else {\n cachedRTLResult = 'positive-ascending';\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n\nexport function getScrollLeft(node: Element, direction: Direction): number {\n let {scrollLeft} = node;\n\n // scrollLeft in rtl locales differs across browsers, so normalize.\n // See comment by getRTLOffsetType below for details.\n if (direction === 'rtl') {\n let {scrollWidth, clientWidth} = node;\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-descending':\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n\n return scrollLeft;\n}\n\nexport function setScrollLeft(node: Element, direction: Direction, scrollLeft: number) {\n if (direction === 'rtl') {\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-ascending':\n break;\n default: {\n const {clientWidth, scrollWidth} = node;\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n }\n\n node.scrollLeft = scrollLeft;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n transition: 'all',\n WebkitTransition: 'all',\n WebkitTransitionDuration: 'inherit',\n transitionDuration: 'inherit',\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height,\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style'\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, RefObject, useCallback} from 'react';\nimport {LayoutInfo, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface IVirtualizer {\n updateItemSize(key: Key, size: Size): void\n}\n\nexport interface VirtualizerItemOptions {\n layoutInfo: LayoutInfo,\n virtualizer: IVirtualizer,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem(options: VirtualizerItemOptions) {\n let {layoutInfo, virtualizer, ref} = options;\n\n let updateSize = useCallback(() => {\n let size = getSize(ref.current);\n virtualizer.updateItemSize(layoutInfo.key, size);\n }, [virtualizer, layoutInfo.key, ref]);\n\n useLayoutEffect(() => {\n if (layoutInfo.estimatedSize) {\n updateSize();\n }\n });\n\n return {updateSize};\n}\n\nfunction getSize(node: HTMLElement) {\n // Reset height before measuring so we get the intrinsic size\n let height = node.style.height;\n node.style.height = '';\n let size = new Size(node.scrollWidth, node.scrollHeight);\n node.style.height = height;\n return size;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -78,11 +78,11 @@ function $ce415dc67314b753$export$faf7630257ad4304(recalculate = false) {
78
78
  return $ce415dc67314b753$var$cachedRTLResult;
79
79
  }
80
80
  function $ce415dc67314b753$export$1389d168952b34b5(node, direction) {
81
- let { scrollLeft: scrollLeft } = node;
81
+ let { scrollLeft: scrollLeft } = node;
82
82
  // scrollLeft in rtl locales differs across browsers, so normalize.
83
83
  // See comment by getRTLOffsetType below for details.
84
84
  if (direction === "rtl") {
85
- let { scrollWidth: scrollWidth , clientWidth: clientWidth } = node;
85
+ let { scrollWidth: scrollWidth, clientWidth: clientWidth } = node;
86
86
  switch($ce415dc67314b753$export$faf7630257ad4304()){
87
87
  case "negative":
88
88
  scrollLeft = -scrollLeft;
@@ -103,7 +103,7 @@ function $ce415dc67314b753$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
103
103
  break;
104
104
  default:
105
105
  {
106
- const { clientWidth: clientWidth , scrollWidth: scrollWidth } = node;
106
+ const { clientWidth: clientWidth, scrollWidth: scrollWidth } = node;
107
107
  scrollLeft = scrollWidth - clientWidth - scrollLeft;
108
108
  break;
109
109
  }
@@ -117,7 +117,7 @@ function $ce415dc67314b753$export$ed5fd5ffe5ab0ac(node, direction, scrollLeft) {
117
117
 
118
118
 
119
119
  function $44a6ee657928b002$var$ScrollView(props, ref) {
120
- let { contentSize: contentSize , onVisibleRectChange: onVisibleRectChange , children: children , innerStyle: innerStyle , sizeToFit: sizeToFit , onScrollStart: onScrollStart , onScrollEnd: onScrollEnd , scrollDirection: scrollDirection = "both" , ...otherProps } = props;
120
+ let { contentSize: contentSize, onVisibleRectChange: onVisibleRectChange, children: children, innerStyle: innerStyle, sizeToFit: sizeToFit, onScrollStart: onScrollStart, onScrollEnd: onScrollEnd, scrollDirection: scrollDirection = "both", ...otherProps } = props;
121
121
  let defaultRef = (0, $kSaV5$useRef)();
122
122
  ref = ref || defaultRef;
123
123
  let state = (0, $kSaV5$useRef)({
@@ -129,7 +129,7 @@ function $44a6ee657928b002$var$ScrollView(props, ref) {
129
129
  height: 0,
130
130
  isScrolling: false
131
131
  }).current;
132
- let { direction: direction } = (0, $kSaV5$useLocale)();
132
+ let { direction: direction } = (0, $kSaV5$useLocale)();
133
133
  let [isScrolling, setScrolling] = (0, $kSaV5$useState)(false);
134
134
  let onScroll = (0, $kSaV5$useCallback)((e)=>{
135
135
  if (e.target !== e.currentTarget) return;
@@ -264,7 +264,7 @@ const $44a6ee657928b002$export$5665e3d6be6adea = /*#__PURE__*/ (0, $kSaV5$react)
264
264
 
265
265
 
266
266
  function $47736c1e63ba1c6d$export$1da781778207e0a2(options) {
267
- let { layoutInfo: layoutInfo , virtualizer: virtualizer , ref: ref } = options;
267
+ let { layoutInfo: layoutInfo, virtualizer: virtualizer, ref: ref } = options;
268
268
  let updateSize = (0, $kSaV5$useCallback)(()=>{
269
269
  let size = $47736c1e63ba1c6d$var$getSize(ref.current);
270
270
  virtualizer.updateItemSize(layoutInfo.key, size);
@@ -291,8 +291,8 @@ function $47736c1e63ba1c6d$var$getSize(node) {
291
291
 
292
292
 
293
293
  function $ccf8a0a04e4175ae$export$6796df8ba7398521(props) {
294
- let { className: className , layoutInfo: layoutInfo , virtualizer: virtualizer , parent: parent , children: children } = props;
295
- let { direction: direction } = (0, $kSaV5$useLocale)();
294
+ let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
295
+ let { direction: direction } = (0, $kSaV5$useLocale)();
296
296
  let ref = (0, $kSaV5$useRef)();
297
297
  (0, $47736c1e63ba1c6d$export$1da781778207e0a2)({
298
298
  layoutInfo: layoutInfo,
@@ -341,13 +341,13 @@ function $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
341
341
 
342
342
 
343
343
  function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
344
- let { children: renderView , renderWrapper: renderWrapper , layout: layout , collection: collection , sizeToFit: sizeToFit , scrollDirection: scrollDirection , transitionDuration: transitionDuration , isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
345
- isLoading , onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
346
- onLoadMore , focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
347
- focusedKey , shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
348
- shouldUseVirtualFocus , scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
349
- scrollToItem , autoFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
350
- autoFocus , ...otherProps } = props;
344
+ let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, sizeToFit: sizeToFit, scrollDirection: scrollDirection, transitionDuration: transitionDuration, isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
345
+ isLoading, onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
346
+ onLoadMore, focusedKey: // eslint-disable-next-line @typescript-eslint/no-unused-vars
347
+ focusedKey, shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
348
+ shouldUseVirtualFocus, scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
349
+ scrollToItem, autoFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
350
+ autoFocus, ...otherProps } = props;
351
351
  let fallbackRef = (0, $kSaV5$useRef)();
352
352
  ref = ref || fallbackRef;
353
353
  let state = (0, $kSaV5$useVirtualizerState)({
@@ -361,7 +361,7 @@ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
361
361
  ref.current.scrollTop = rect.y;
362
362
  }
363
363
  });
364
- let { virtualizerProps: virtualizerProps , scrollViewProps: scrollViewProps } = $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref);
364
+ let { virtualizerProps: virtualizerProps, scrollViewProps: scrollViewProps } = $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref);
365
365
  return /*#__PURE__*/ (0, $kSaV5$react).createElement((0, $44a6ee657928b002$export$5665e3d6be6adea), {
366
366
  ...(0, $kSaV5$mergeProps)(otherProps, virtualizerProps, scrollViewProps),
367
367
  ref: ref,
@@ -376,8 +376,8 @@ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
376
376
  }, state.visibleViews);
377
377
  }
378
378
  function $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref) {
379
- let { focusedKey: focusedKey , scrollToItem: scrollToItem , shouldUseVirtualFocus: shouldUseVirtualFocus , isLoading: isLoading , onLoadMore: onLoadMore } = props;
380
- let { virtualizer: virtualizer } = state;
379
+ let { focusedKey: focusedKey, scrollToItem: scrollToItem, shouldUseVirtualFocus: shouldUseVirtualFocus, isLoading: isLoading, onLoadMore: onLoadMore } = props;
380
+ let { virtualizer: virtualizer } = state;
381
381
  // Scroll to the focusedKey when it changes. Actually focusing the focusedKey
382
382
  // is up to the implementation using Virtualizer since we don't have refs
383
383
  // to all of the item DOM nodes.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;;ACVD;;;;;;;;;;CAUC,GAED,aAAa;;ACZb;;;;;;;;;;CAUC,GASD,IAAI,wCAAwC;AAarC,SAAS,0CAAiB,cAAuB,KAAK;IAC3D,IAAI,0CAAoB,QAAQ,aAAa;QAC3C,MAAM,WAAW,SAAS,cAAc;QACxC,MAAM,aAAa,SAAS;QAC5B,WAAW,QAAQ;QACnB,WAAW,SAAS;QACpB,WAAW,WAAW;QACtB,WAAW,YAAY;QAEvB,MAAM,WAAW,SAAS,cAAc;QACxC,MAAM,aAAa,SAAS;QAC5B,WAAW,QAAQ;QACnB,WAAW,SAAS;QAEpB,SAAS,YAAY;QAErB,SAAS,KAAK,YAAY;QAE1B,IAAI,SAAS,aAAa,GACxB,wCAAkB;aACb;YACL,SAAS,aAAa;YACtB,IAAI,SAAS,eAAe,GAC1B,wCAAkB;iBAElB,wCAAkB;QAEtB;QAEA,SAAS,KAAK,YAAY;QAE1B,OAAO;IACT;IAEA,OAAO;AACT;AAEO,SAAS,0CAAc,IAAa,EAAE,SAAoB;IAC/D,IAAI,cAA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IACF;AACF;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,YAAI,EAAE,WAAW;AAGtC,SAAS,2CACP,MAAiC,EACjC,YAAgC;IAEhC,qBACE,gCAAC,CAAA,GAAA,yCAAc;QACb,KAAK,aAAa;QAClB,YAAY,aAAa;QACzB,aAAa,aAAa;QAC1B,QAAQ,mBAAA,oBAAA,KAAA,IAAA,OAAQ;OACf,aAAa;AAGpB;;CDrPC","sources":["packages/@react-aria/virtualizer/src/index.ts","packages/@react-aria/virtualizer/src/Virtualizer.tsx","packages/@react-aria/virtualizer/src/ScrollView.tsx","packages/@react-aria/virtualizer/src/utils.ts","packages/@react-aria/virtualizer/src/VirtualizerItem.tsx","packages/@react-aria/virtualizer/src/useVirtualizerItem.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {RTLOffsetType} from './utils';\nexport type {VirtualizerItemOptions} from './useVirtualizerItem';\nexport {useVirtualizer, Virtualizer} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection} from '@react-types/shared';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n ) => ReactElement,\n layout: Layout<T>,\n collection: Collection<T>,\n focusedKey?: Key,\n sizeToFit?: 'width' | 'height',\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n transitionDuration?: number,\n isLoading?: boolean,\n onLoadMore?: () => void,\n shouldUseVirtualFocus?: boolean,\n scrollToItem?: (key: Key) => void,\n autoFocus?: boolean\n}\n\nfunction Virtualizer<T extends object, V extends ReactNode>(props: VirtualizerProps<T, V>, ref: RefObject<HTMLDivElement>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n sizeToFit,\n scrollDirection,\n transitionDuration,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n focusedKey,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n shouldUseVirtualFocus,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n scrollToItem,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n autoFocus,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>();\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n transitionDuration,\n layout,\n collection,\n renderView,\n renderWrapper: renderWrapper || defaultRenderWrapper,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n }\n });\n\n let {virtualizerProps, scrollViewProps} = useVirtualizer(props, state, ref);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps, scrollViewProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n sizeToFit={sizeToFit}\n scrollDirection={scrollDirection}>\n {state.visibleViews}\n </ScrollView>\n );\n}\n\ninterface VirtualizerOptions {\n tabIndex?: number,\n focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean,\n autoFocus?: boolean,\n isLoading?: boolean,\n onLoadMore?: () => void\n}\n\nexport function useVirtualizer<T extends object, V extends ReactNode, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus, isLoading, onLoadMore} = props;\n let {virtualizer} = state;\n // Scroll to the focusedKey when it changes. Actually focusing the focusedKey\n // is up to the implementation using Virtualizer since we don't have refs\n // to all of the item DOM nodes.\n let lastFocusedKey = useRef(null);\n let isFocusWithin = useRef(false);\n let autoFocus = useRef(props.autoFocus);\n useEffect(() => {\n if (virtualizer.visibleRect.height === 0) {\n return;\n }\n\n // Only scroll the focusedKey into view if the modality is not pointer to avoid jumps in position when clicking/pressing tall items.\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || autoFocus.current)) {\n autoFocus.current = false;\n if (scrollToItem) {\n // If user provides scrolltoitem, then it is their responsibility to call scrollIntoViewport if desired\n // since we don't know if their scrollToItem may take some time to actually bring the active element into the virtualizer's visible rect.\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem, ref]);\n\n // Persist the focusedKey and prevent it from being removed from the DOM when scrolled out of view.\n virtualizer.persistedKeys = useMemo(() => focusedKey ? new Set([focusedKey]) : new Set(), [focusedKey]);\n\n let onFocus = useCallback((e: FocusEvent) => {\n // If the focused item is scrolled out of view and is not in the DOM, the collection\n // will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.\n // Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)\n // Don't scroll focused key into view if modality is pointer to prevent sudden jump in position (e.g. CardView).\n let modality = getInteractionModality();\n if (!isFocusWithin.current && ref.current.contains(e.target) && modality !== 'pointer') {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n isFocusWithin.current = e.target !== ref.current;\n }, [ref, virtualizer, focusedKey, scrollToItem]);\n\n let onBlur = useCallback((e: FocusEvent) => {\n isFocusWithin.current = ref.current.contains(e.relatedTarget as Element);\n }, [ref]);\n\n // Set tabIndex to -1 if there is a focused key, otherwise 0 so that the collection\n // itself is tabbable. When the collection receives focus, we scroll the focused item back into\n // view, which will allow it to be properly focused. If using virtual focus, don't set a\n // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n // When there is no focusedKey the default tabIndex is 0. We include logic for empty collections too.\n // For collections that are empty, but have a link in the empty children we want to skip focusing this\n // and let focus move to the link similar to link moving to children.\n tabIndex = focusedKey != null ? -1 : 0;\n\n // If the collection is empty, we want the tabIndex provided from props (if any)\n // so that we handle when tabbable items are added to the empty state.\n if (virtualizer.collection.size === 0 && props.tabIndex != null) {\n tabIndex = props.tabIndex;\n }\n }\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoadingRef.current && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, state]);\n\n let lastContentSize = useRef(0);\n useLayoutEffect(() => {\n // If animating, wait until we're done.\n if (state.isAnimating) {\n return;\n }\n\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n let wasLoading = isLoadingRef.current;\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n let shouldLoadMore = !isLoadingRef.current\n && onLoadMore\n && state.contentSize.height > 0\n && state.contentSize.height <= state.virtualizer.visibleRect.height\n // Only try loading more if the content size changed, or if we just finished\n // loading and still have room for more items.\n && (wasLoading || state.contentSize.height !== lastContentSize.current);\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n lastContentSize.current = state.contentSize.height;\n }, [state.contentSize, state.isAnimating, state.virtualizer, isLoading, onLoadMore, props]);\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\n },\n scrollViewProps: {\n onVisibleRectChange\n }\n };\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V>(props: VirtualizerProps<T, V> & {ref?: RefObject<HTMLDivElement>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// @ts-ignore\nimport {flushSync} from 'react-dom';\nimport {getScrollLeft} from './utils';\nimport React, {\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {Rect, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ScrollViewProps extends HTMLAttributes<HTMLElement> {\n contentSize: Size,\n onVisibleRectChange: (rect: Rect) => void,\n children: ReactNode,\n innerStyle?: CSSProperties,\n sizeToFit?: 'width' | 'height',\n onScrollStart?: () => void,\n onScrollEnd?: () => void,\n scrollDirection?: 'horizontal' | 'vertical' | 'both'\n}\n\nfunction ScrollView(props: ScrollViewProps, ref: RefObject<HTMLDivElement>) {\n let {\n contentSize,\n onVisibleRectChange,\n children,\n innerStyle,\n sizeToFit,\n onScrollStart,\n onScrollEnd,\n scrollDirection = 'both',\n ...otherProps\n } = props;\n\n let defaultRef = useRef();\n ref = ref || defaultRef;\n let state = useRef({\n scrollTop: 0,\n scrollLeft: 0,\n scrollEndTime: 0,\n scrollTimeout: null,\n width: 0,\n height: 0,\n isScrolling: false\n }).current;\n let {direction} = useLocale();\n\n let [isScrolling, setScrolling] = useState(false);\n let onScroll = useCallback((e) => {\n if (e.target !== e.currentTarget) {\n return;\n }\n\n if (props.onScroll) {\n props.onScroll(e);\n }\n\n flushSync(() => {\n let scrollTop = e.currentTarget.scrollTop;\n let scrollLeft = getScrollLeft(e.currentTarget, direction);\n\n // Prevent rubber band scrolling from shaking when scrolling out of bounds\n state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));\n state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));\n\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, state.width, state.height));\n\n if (!state.isScrolling) {\n state.isScrolling = true;\n setScrolling(true);\n\n if (onScrollStart) {\n onScrollStart();\n }\n }\n\n // So we don't constantly call clearTimeout and setTimeout,\n // keep track of the current timeout time and only reschedule\n // the timer when it is getting close.\n let now = Date.now();\n if (state.scrollEndTime <= now + 50) {\n state.scrollEndTime = now + 300;\n\n clearTimeout(state.scrollTimeout);\n state.scrollTimeout = setTimeout(() => {\n state.isScrolling = false;\n setScrolling(false);\n state.scrollTimeout = null;\n\n if (onScrollEnd) {\n onScrollEnd();\n }\n }, 300);\n }\n });\n }, [props, direction, state, contentSize, onVisibleRectChange, onScrollStart, onScrollEnd]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n clearTimeout(state.scrollTimeout);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let updateSize = useCallback(() => {\n let dom = ref.current;\n if (!dom) {\n return;\n }\n\n let w = dom.clientWidth;\n let h = dom.clientHeight;\n if (sizeToFit && contentSize.width > 0 && contentSize.height > 0) {\n if (sizeToFit === 'width') {\n w = Math.min(w, contentSize.width);\n } else if (sizeToFit === 'height') {\n h = Math.min(h, contentSize.height);\n }\n }\n\n if (state.width !== w || state.height !== h) {\n state.width = w;\n state.height = h;\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, w, h));\n }\n }, [onVisibleRectChange, ref, state, sizeToFit, contentSize]);\n\n useLayoutEffect(() => {\n updateSize();\n }, [updateSize]);\n useResizeObserver({ref, onResize: updateSize});\n\n let style: React.CSSProperties = {\n // Reset padding so that relative positioning works correctly. Padding will be done in JS layout.\n padding: 0,\n ...otherProps.style\n };\n\n if (scrollDirection === 'horizontal') {\n style.overflowX = 'auto';\n style.overflowY = 'hidden';\n } else if (scrollDirection === 'vertical') {\n style.overflowY = 'auto';\n style.overflowX = 'hidden';\n } else {\n style.overflow = 'auto';\n }\n\n return (\n <div {...otherProps} style={style} ref={ref} onScroll={onScroll}>\n <div role=\"presentation\" style={{width: contentSize.width, height: contentSize.height, pointerEvents: isScrolling ? 'none' : 'auto', position: 'relative', ...innerStyle}}>\n {children}\n </div>\n </div>\n );\n}\n\nconst ScrollViewForwardRef = React.forwardRef(ScrollView);\nexport {ScrollViewForwardRef as ScrollView};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\n\nexport type RTLOffsetType =\n | 'negative'\n | 'positive-descending'\n | 'positive-ascending';\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/bvaughn/react-window/blob/master/src/createGridComponent.js\n\n// According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement('div');\n const outerStyle = outerDiv.style;\n outerStyle.width = '50px';\n outerStyle.height = '50px';\n outerStyle.overflow = 'scroll';\n outerStyle.direction = 'rtl';\n\n const innerDiv = document.createElement('div');\n const innerStyle = innerDiv.style;\n innerStyle.width = '100px';\n innerStyle.height = '100px';\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = 'positive-descending';\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = 'negative';\n } else {\n cachedRTLResult = 'positive-ascending';\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n\nexport function getScrollLeft(node: Element, direction: Direction): number {\n let {scrollLeft} = node;\n\n // scrollLeft in rtl locales differs across browsers, so normalize.\n // See comment by getRTLOffsetType below for details.\n if (direction === 'rtl') {\n let {scrollWidth, clientWidth} = node;\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-descending':\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n\n return scrollLeft;\n}\n\nexport function setScrollLeft(node: Element, direction: Direction, scrollLeft: number) {\n if (direction === 'rtl') {\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-ascending':\n break;\n default: {\n const {clientWidth, scrollWidth} = node;\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n }\n\n node.scrollLeft = scrollLeft;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n transition: 'all',\n WebkitTransition: 'all',\n WebkitTransitionDuration: 'inherit',\n transitionDuration: 'inherit',\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height,\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style'\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, RefObject, useCallback} from 'react';\nimport {LayoutInfo, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface IVirtualizer {\n updateItemSize(key: Key, size: Size): void\n}\n\nexport interface VirtualizerItemOptions {\n layoutInfo: LayoutInfo,\n virtualizer: IVirtualizer,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem(options: VirtualizerItemOptions) {\n let {layoutInfo, virtualizer, ref} = options;\n\n let updateSize = useCallback(() => {\n let size = getSize(ref.current);\n virtualizer.updateItemSize(layoutInfo.key, size);\n }, [virtualizer, layoutInfo.key, ref]);\n\n useLayoutEffect(() => {\n if (layoutInfo.estimatedSize) {\n updateSize();\n }\n });\n\n return {updateSize};\n}\n\nfunction getSize(node: HTMLElement) {\n // Reset height before measuring so we get the intrinsic size\n let height = node.style.height;\n node.style.height = '';\n let size = new Size(node.scrollWidth, node.scrollHeight);\n node.style.height = height;\n return size;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;;ACVD;;;;;;;;;;CAUC,GAED,aAAa;;ACZb;;;;;;;;;;CAUC,GASD,IAAI,wCAAwC;AAarC,SAAS,0CAAiB,cAAuB,KAAK;IAC3D,IAAI,0CAAoB,QAAQ,aAAa;QAC3C,MAAM,WAAW,SAAS,cAAc;QACxC,MAAM,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C9B,IAAI,UAAU,UAAU,SAAS;YAC/B,aAAa,UAAU;YACvB,UAAU,UAAU;QACtB;QAEA,IAAI,iBAAiB,CAAC,aAAa,WAC9B,cACA,MAAM,YAAY,SAAS,KAC3B,MAAM,YAAY,UAAU,MAAM,YAAY,YAAY,UAGzD,CAAA,cAAc,MAAM,YAAY,WAAW,gBAAgB,OAAM;QAEvE,IAAI,gBAAgB;YAClB,aAAa,UAAU;YACvB;QACF;QACA,gBAAgB,UAAU,MAAM,YAAY;IAC9C,GAAG;QAAC,MAAM;QAAa,MAAM;QAAa,MAAM;QAAa;QAAW;QAAY;KAAM;IAE1F,OAAO;QACL,kBAAkB;sBAChB;qBACA;oBACA;QACF;QACA,iBAAiB;iCACf;QACF;IACF;AACF;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,YAAI,EAAE,WAAW;AAGtC,SAAS,2CACP,MAAiC,EACjC,YAAgC;IAEhC,qBACE,gCAAC,CAAA,GAAA,yCAAc;QACb,KAAK,aAAa;QAClB,YAAY,aAAa;QACzB,aAAa,aAAa;QAC1B,QAAQ,mBAAA,oBAAA,KAAA,IAAA,OAAQ;OACf,aAAa;AAGpB;;CDrPC","sources":["packages/@react-aria/virtualizer/src/index.ts","packages/@react-aria/virtualizer/src/Virtualizer.tsx","packages/@react-aria/virtualizer/src/ScrollView.tsx","packages/@react-aria/virtualizer/src/utils.ts","packages/@react-aria/virtualizer/src/VirtualizerItem.tsx","packages/@react-aria/virtualizer/src/useVirtualizerItem.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {RTLOffsetType} from './utils';\nexport type {VirtualizerItemOptions} from './useVirtualizerItem';\nexport {useVirtualizer, Virtualizer} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection} from '@react-types/shared';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n ) => ReactElement,\n layout: Layout<T>,\n collection: Collection<T>,\n focusedKey?: Key,\n sizeToFit?: 'width' | 'height',\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n transitionDuration?: number,\n isLoading?: boolean,\n onLoadMore?: () => void,\n shouldUseVirtualFocus?: boolean,\n scrollToItem?: (key: Key) => void,\n autoFocus?: boolean\n}\n\nfunction Virtualizer<T extends object, V extends ReactNode>(props: VirtualizerProps<T, V>, ref: RefObject<HTMLDivElement>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n sizeToFit,\n scrollDirection,\n transitionDuration,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n focusedKey,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n shouldUseVirtualFocus,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n scrollToItem,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n autoFocus,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>();\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n transitionDuration,\n layout,\n collection,\n renderView,\n renderWrapper: renderWrapper || defaultRenderWrapper,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n }\n });\n\n let {virtualizerProps, scrollViewProps} = useVirtualizer(props, state, ref);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps, scrollViewProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n sizeToFit={sizeToFit}\n scrollDirection={scrollDirection}>\n {state.visibleViews}\n </ScrollView>\n );\n}\n\ninterface VirtualizerOptions {\n tabIndex?: number,\n focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean,\n autoFocus?: boolean,\n isLoading?: boolean,\n onLoadMore?: () => void\n}\n\nexport function useVirtualizer<T extends object, V extends ReactNode, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus, isLoading, onLoadMore} = props;\n let {virtualizer} = state;\n // Scroll to the focusedKey when it changes. Actually focusing the focusedKey\n // is up to the implementation using Virtualizer since we don't have refs\n // to all of the item DOM nodes.\n let lastFocusedKey = useRef(null);\n let isFocusWithin = useRef(false);\n let autoFocus = useRef(props.autoFocus);\n useEffect(() => {\n if (virtualizer.visibleRect.height === 0) {\n return;\n }\n\n // Only scroll the focusedKey into view if the modality is not pointer to avoid jumps in position when clicking/pressing tall items.\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || autoFocus.current)) {\n autoFocus.current = false;\n if (scrollToItem) {\n // If user provides scrolltoitem, then it is their responsibility to call scrollIntoViewport if desired\n // since we don't know if their scrollToItem may take some time to actually bring the active element into the virtualizer's visible rect.\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem, ref]);\n\n // Persist the focusedKey and prevent it from being removed from the DOM when scrolled out of view.\n virtualizer.persistedKeys = useMemo(() => focusedKey ? new Set([focusedKey]) : new Set(), [focusedKey]);\n\n let onFocus = useCallback((e: FocusEvent) => {\n // If the focused item is scrolled out of view and is not in the DOM, the collection\n // will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.\n // Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)\n // Don't scroll focused key into view if modality is pointer to prevent sudden jump in position (e.g. CardView).\n let modality = getInteractionModality();\n if (!isFocusWithin.current && ref.current.contains(e.target) && modality !== 'pointer') {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n isFocusWithin.current = e.target !== ref.current;\n }, [ref, virtualizer, focusedKey, scrollToItem]);\n\n let onBlur = useCallback((e: FocusEvent) => {\n isFocusWithin.current = ref.current.contains(e.relatedTarget as Element);\n }, [ref]);\n\n // Set tabIndex to -1 if there is a focused key, otherwise 0 so that the collection\n // itself is tabbable. When the collection receives focus, we scroll the focused item back into\n // view, which will allow it to be properly focused. If using virtual focus, don't set a\n // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n // When there is no focusedKey the default tabIndex is 0. We include logic for empty collections too.\n // For collections that are empty, but have a link in the empty children we want to skip focusing this\n // and let focus move to the link similar to link moving to children.\n tabIndex = focusedKey != null ? -1 : 0;\n\n // If the collection is empty, we want the tabIndex provided from props (if any)\n // so that we handle when tabbable items are added to the empty state.\n if (virtualizer.collection.size === 0 && props.tabIndex != null) {\n tabIndex = props.tabIndex;\n }\n }\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoadingRef.current && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, state]);\n\n let lastContentSize = useRef(0);\n useLayoutEffect(() => {\n // If animating, wait until we're done.\n if (state.isAnimating) {\n return;\n }\n\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n let wasLoading = isLoadingRef.current;\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n let shouldLoadMore = !isLoadingRef.current\n && onLoadMore\n && state.contentSize.height > 0\n && state.contentSize.height <= state.virtualizer.visibleRect.height\n // Only try loading more if the content size changed, or if we just finished\n // loading and still have room for more items.\n && (wasLoading || state.contentSize.height !== lastContentSize.current);\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n lastContentSize.current = state.contentSize.height;\n }, [state.contentSize, state.isAnimating, state.virtualizer, isLoading, onLoadMore, props]);\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\n },\n scrollViewProps: {\n onVisibleRectChange\n }\n };\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V>(props: VirtualizerProps<T, V> & {ref?: RefObject<HTMLDivElement>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// @ts-ignore\nimport {flushSync} from 'react-dom';\nimport {getScrollLeft} from './utils';\nimport React, {\n CSSProperties,\n HTMLAttributes,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {Rect, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ScrollViewProps extends HTMLAttributes<HTMLElement> {\n contentSize: Size,\n onVisibleRectChange: (rect: Rect) => void,\n children: ReactNode,\n innerStyle?: CSSProperties,\n sizeToFit?: 'width' | 'height',\n onScrollStart?: () => void,\n onScrollEnd?: () => void,\n scrollDirection?: 'horizontal' | 'vertical' | 'both'\n}\n\nfunction ScrollView(props: ScrollViewProps, ref: RefObject<HTMLDivElement>) {\n let {\n contentSize,\n onVisibleRectChange,\n children,\n innerStyle,\n sizeToFit,\n onScrollStart,\n onScrollEnd,\n scrollDirection = 'both',\n ...otherProps\n } = props;\n\n let defaultRef = useRef();\n ref = ref || defaultRef;\n let state = useRef({\n scrollTop: 0,\n scrollLeft: 0,\n scrollEndTime: 0,\n scrollTimeout: null,\n width: 0,\n height: 0,\n isScrolling: false\n }).current;\n let {direction} = useLocale();\n\n let [isScrolling, setScrolling] = useState(false);\n let onScroll = useCallback((e) => {\n if (e.target !== e.currentTarget) {\n return;\n }\n\n if (props.onScroll) {\n props.onScroll(e);\n }\n\n flushSync(() => {\n let scrollTop = e.currentTarget.scrollTop;\n let scrollLeft = getScrollLeft(e.currentTarget, direction);\n\n // Prevent rubber band scrolling from shaking when scrolling out of bounds\n state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));\n state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));\n\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, state.width, state.height));\n\n if (!state.isScrolling) {\n state.isScrolling = true;\n setScrolling(true);\n\n if (onScrollStart) {\n onScrollStart();\n }\n }\n\n // So we don't constantly call clearTimeout and setTimeout,\n // keep track of the current timeout time and only reschedule\n // the timer when it is getting close.\n let now = Date.now();\n if (state.scrollEndTime <= now + 50) {\n state.scrollEndTime = now + 300;\n\n clearTimeout(state.scrollTimeout);\n state.scrollTimeout = setTimeout(() => {\n state.isScrolling = false;\n setScrolling(false);\n state.scrollTimeout = null;\n\n if (onScrollEnd) {\n onScrollEnd();\n }\n }, 300);\n }\n });\n }, [props, direction, state, contentSize, onVisibleRectChange, onScrollStart, onScrollEnd]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n clearTimeout(state.scrollTimeout);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let updateSize = useCallback(() => {\n let dom = ref.current;\n if (!dom) {\n return;\n }\n\n let w = dom.clientWidth;\n let h = dom.clientHeight;\n if (sizeToFit && contentSize.width > 0 && contentSize.height > 0) {\n if (sizeToFit === 'width') {\n w = Math.min(w, contentSize.width);\n } else if (sizeToFit === 'height') {\n h = Math.min(h, contentSize.height);\n }\n }\n\n if (state.width !== w || state.height !== h) {\n state.width = w;\n state.height = h;\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, w, h));\n }\n }, [onVisibleRectChange, ref, state, sizeToFit, contentSize]);\n\n useLayoutEffect(() => {\n updateSize();\n }, [updateSize]);\n useResizeObserver({ref, onResize: updateSize});\n\n let style: React.CSSProperties = {\n // Reset padding so that relative positioning works correctly. Padding will be done in JS layout.\n padding: 0,\n ...otherProps.style\n };\n\n if (scrollDirection === 'horizontal') {\n style.overflowX = 'auto';\n style.overflowY = 'hidden';\n } else if (scrollDirection === 'vertical') {\n style.overflowY = 'auto';\n style.overflowX = 'hidden';\n } else {\n style.overflow = 'auto';\n }\n\n return (\n <div {...otherProps} style={style} ref={ref} onScroll={onScroll}>\n <div role=\"presentation\" style={{width: contentSize.width, height: contentSize.height, pointerEvents: isScrolling ? 'none' : 'auto', position: 'relative', ...innerStyle}}>\n {children}\n </div>\n </div>\n );\n}\n\nconst ScrollViewForwardRef = React.forwardRef(ScrollView);\nexport {ScrollViewForwardRef as ScrollView};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\n\nexport type RTLOffsetType =\n | 'negative'\n | 'positive-descending'\n | 'positive-ascending';\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/bvaughn/react-window/blob/master/src/createGridComponent.js\n\n// According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n if (cachedRTLResult === null || recalculate) {\n const outerDiv = document.createElement('div');\n const outerStyle = outerDiv.style;\n outerStyle.width = '50px';\n outerStyle.height = '50px';\n outerStyle.overflow = 'scroll';\n outerStyle.direction = 'rtl';\n\n const innerDiv = document.createElement('div');\n const innerStyle = innerDiv.style;\n innerStyle.width = '100px';\n innerStyle.height = '100px';\n\n outerDiv.appendChild(innerDiv);\n\n document.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = 'positive-descending';\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = 'negative';\n } else {\n cachedRTLResult = 'positive-ascending';\n }\n }\n\n document.body.removeChild(outerDiv);\n\n return cachedRTLResult;\n }\n\n return cachedRTLResult;\n}\n\nexport function getScrollLeft(node: Element, direction: Direction): number {\n let {scrollLeft} = node;\n\n // scrollLeft in rtl locales differs across browsers, so normalize.\n // See comment by getRTLOffsetType below for details.\n if (direction === 'rtl') {\n let {scrollWidth, clientWidth} = node;\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-descending':\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n\n return scrollLeft;\n}\n\nexport function setScrollLeft(node: Element, direction: Direction, scrollLeft: number) {\n if (direction === 'rtl') {\n switch (getRTLOffsetType()) {\n case 'negative':\n scrollLeft = -scrollLeft;\n break;\n case 'positive-ascending':\n break;\n default: {\n const {clientWidth, scrollWidth} = node;\n scrollLeft = scrollWidth - clientWidth - scrollLeft;\n break;\n }\n }\n }\n\n node.scrollLeft = scrollLeft;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n transition: 'all',\n WebkitTransition: 'all',\n WebkitTransitionDuration: 'inherit',\n transitionDuration: 'inherit',\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height,\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style'\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key, RefObject, useCallback} from 'react';\nimport {LayoutInfo, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface IVirtualizer {\n updateItemSize(key: Key, size: Size): void\n}\n\nexport interface VirtualizerItemOptions {\n layoutInfo: LayoutInfo,\n virtualizer: IVirtualizer,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem(options: VirtualizerItemOptions) {\n let {layoutInfo, virtualizer, ref} = options;\n\n let updateSize = useCallback(() => {\n let size = getSize(ref.current);\n virtualizer.updateItemSize(layoutInfo.key, size);\n }, [virtualizer, layoutInfo.key, ref]);\n\n useLayoutEffect(() => {\n if (layoutInfo.estimatedSize) {\n updateSize();\n }\n });\n\n return {updateSize};\n}\n\nfunction getSize(node: HTMLElement) {\n // Reset height before measuring so we get the intrinsic size\n let height = node.style.height;\n node.style.height = '';\n let size = new Size(node.scrollWidth, node.scrollHeight);\n node.style.height = height;\n return size;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/virtualizer",
3
- "version": "3.9.3-nightly.4149+a399db1e3",
3
+ "version": "3.9.3-nightly.4157+633bb4fb6",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,12 +22,12 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "3.0.0-nightly.2440+a399db1e3",
26
- "@react-aria/i18n": "3.0.0-nightly.2440+a399db1e3",
27
- "@react-aria/interactions": "3.0.0-nightly.2440+a399db1e3",
28
- "@react-aria/utils": "3.0.0-nightly.2440+a399db1e3",
29
- "@react-stately/virtualizer": "3.6.3-nightly.4149+a399db1e3",
30
- "@react-types/shared": "3.0.0-nightly.2440+a399db1e3",
25
+ "@react-aria/focus": "3.0.0-nightly.2448+633bb4fb6",
26
+ "@react-aria/i18n": "3.0.0-nightly.2448+633bb4fb6",
27
+ "@react-aria/interactions": "3.0.0-nightly.2448+633bb4fb6",
28
+ "@react-aria/utils": "3.0.0-nightly.2448+633bb4fb6",
29
+ "@react-stately/virtualizer": "3.6.3-nightly.4157+633bb4fb6",
30
+ "@react-types/shared": "3.0.0-nightly.2448+633bb4fb6",
31
31
  "@swc/helpers": "^0.5.0"
32
32
  },
33
33
  "peerDependencies": {
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "a399db1e314243a023f7b5c95e319eba4496604c"
40
+ "gitHead": "633bb4fb6cc205b9911a21fb81a7a70c662ec0ce"
41
41
  }