@react-aria/virtualizer 3.5.2-nightly.3536 → 3.5.2-nightly.3538

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -4,6 +4,7 @@ var $kYtlh$reactstatelyvirtualizer = require("@react-stately/virtualizer");
4
4
  var $kYtlh$react = require("react");
5
5
  var $kYtlh$reactdom = require("react-dom");
6
6
  var $kYtlh$reactariai18n = require("@react-aria/i18n");
7
+ var $kYtlh$reactariafocus = require("@react-aria/focus");
7
8
 
8
9
  function $parcel$export(e, n, v, s) {
9
10
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
@@ -216,6 +217,27 @@ const $00ca8c0b29e3e07c$export$5665e3d6be6adea = /*#__PURE__*/ ($parcel$interopD
216
217
 
217
218
 
218
219
 
220
+ function $d9e30fd7b96073c4$export$eac1895992b9f3d6({ isEmpty: isEmpty , hasRenderedAnything: hasRenderedAnything }, ref) {
221
+ let [hasTabbableChild, setHasTabbableChild] = $kYtlh$react.useState(false);
222
+ $kYtlh$react.useEffect(()=>{
223
+ if ((ref === null || ref === void 0 ? void 0 : ref.current) && isEmpty && hasRenderedAnything) {
224
+ // Detect if there are any tabbable elements and update the tabIndex accordingly.
225
+ let walker = $kYtlh$reactariafocus.getFocusableTreeWalker(ref.current, {
226
+ tabbable: true
227
+ });
228
+ setHasTabbableChild(!!walker.nextNode());
229
+ }
230
+ }, [
231
+ ref,
232
+ isEmpty,
233
+ hasRenderedAnything
234
+ ]);
235
+ return hasTabbableChild;
236
+ }
237
+
238
+
239
+
240
+
219
241
 
220
242
 
221
243
 
@@ -413,12 +435,19 @@ function $e1fb6f3669e1c329$export$dd6d526d88b5a137(props, state, ref) {
413
435
  $kYtlh$react.useEffect(()=>{
414
436
  if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $kYtlh$reactariautils.focusWithoutScrolling(ref.current);
415
437
  });
438
+ let hasTabbableChild = $d9e30fd7b96073c4$export$eac1895992b9f3d6({
439
+ isEmpty: virtualizer.collection.size === 0,
440
+ hasRenderedAnything: virtualizer.contentSize.height > 0 || virtualizer.contentSize.width > 0
441
+ }, ref);
416
442
  // Set tabIndex to -1 if the focused view is in the DOM, otherwise 0 so that the collection
417
443
  // itself is tabbable. When the collection receives focus, we scroll the focused item back into
418
444
  // view, which will allow it to be properly focused. If using virtual focus, don't set a
419
445
  // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.
420
446
  let tabIndex;
421
- if (!shouldUseVirtualFocus) tabIndex = focusedView ? -1 : 0;
447
+ if (!shouldUseVirtualFocus) // When there is no focusedView the default tabIndex is 0. We include logic for empty collections too.
448
+ // For collections that are empty, but have a link in the empty children we want to skip focusing this
449
+ // and let focus move to the link similar to link moving to children.
450
+ tabIndex = focusedView || hasTabbableChild ? -1 : 0;
422
451
  return {
423
452
  virtualizerProps: {
424
453
  tabIndex: tabIndex,
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AGmBA,GAAG,CAAC,qCAAe,GAAyB,IAAI;SAahC,yCAAgB,CAAC,WAAoB,GAAG,KAAK,EAAiB,CAAC;IAC7E,EAAE,EAAE,qCAAe,KAAK,IAAI,IAAI,WAAW,EAAE,CAAC;QAC5C,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAK;QAC7C,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;QACjC,UAAU,CAAC,KAAK,GAAG,CAAM;QACzB,UAAU,CAAC,MAAM,GAAG,CAAM;QAC1B,UAAU,CAAC,QAAQ,GAAG,CAAQ;QAC9B,UAAU,CAAC,SAAS,GAAG,CAAK;QAE5B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAK;QAC7C,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;QACjC,UAAU,CAAC,KA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;IACZ,EAAE,GAAG,qBAAqB,EACxB,QAAQ,GAAG,WAAW,GAAG,EAAE,GAAG,CAAC;IAGjC,MAAM,CAAC,CAAC;QACN,gBAAgB,EAAE,CAAC;sBACjB,QAAQ;qBACR,OAAO;oBACP,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,EAAwF,AAAxF,sFAAwF;AACxF,EAA2G,AAA3G,yGAA2G;AAC3G,KAAK,CAAC,yCAAY,iBAAG,sCAAK,CAAC,UAAU,CAAC,iCAAW;SAGxC,0CAAoB,CAC3B,MAAiC,EACjC,YAAgC,EAChC,CAAC;IACD,MAAM,oEACH,yCAAe;QACd,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,MAAM;;AAEpB,CAAC","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 {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 {focusWithoutScrolling, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends HTMLAttributes<HTMLElement> {\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}\n\nfunction Virtualizer<T extends object, V>(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 isLoading,\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 ...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} = useVirtualizer(props, state, ref);\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoading && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n onLoadMore();\n }\n }\n }, [isLoading, onLoadMore, state]);\n\n useLayoutEffect(() => {\n if (!isLoading && onLoadMore && !state.isAnimating) {\n if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) {\n onLoadMore();\n }\n }\n }, [state.contentSize, state.isAnimating, state.virtualizer, onLoadMore, isLoading]);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onVisibleRectChange={onVisibleRectChange}\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 focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean\n}\n\nexport function useVirtualizer<T extends object, V, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus} = props;\n let {virtualizer} = state;\n\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 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 // Exception made if focus isn't within the virtualizer (e.g. opening a picker via click should scroll the selected item into view)\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || !isFocusWithin.current)) {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem]);\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 // When the focused item is scrolled out of view and is removed from the DOM,\n // move focus to the collection view as a whole if focus was within before.\n let focusedView = virtualizer.getView(focusedKey);\n useEffect(() => {\n if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) {\n focusWithoutScrolling(ref.current);\n }\n });\n\n // Set tabIndex to -1 if the focused view is in the DOM, 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 tabIndex = focusedView ? -1 : 0;\n }\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\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>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n reusableView={reusableView}\n parent={parent} />\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} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useResizeObserver} from '@react-aria/utils';\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, ReusableView} from '@react-stately/virtualizer';\nimport React, {CSSProperties, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps<T extends object, V> {\n reusableView: ReusableView<T, V>,\n parent?: ReusableView<T, V>,\n className?: string\n}\n\nexport function VirtualizerItem<T extends object, V>(props: VirtualizerItemProps<T, V>) {\n let {className, reusableView, parent} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n reusableView,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo)}>\n {reusableView.rendered}\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 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 {RefObject, useCallback} from 'react';\nimport {ReusableView, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface VirtualizerItemOptions<T extends object, V> {\n reusableView: ReusableView<T, V>,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem<T extends object, V>(options: VirtualizerItemOptions<T, V>) {\n let {reusableView: {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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AGmBA,GAAG,CAAC,qCAAe,GAAyB,IAAI;SAahC,yCAAgB,CAAC,WAAoB,GAAG,KAAK,EAAiB,CAAC;IAC7E,EAAE,EAAE,qCAAe,KAAK,IAAI,IAAI,WAAW,EAAE,CAAC;QAC5C,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAK;QAC7C,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;QACjC,UAAU,CAAC,KAAK,GAAG,CAAM;QACzB,UAAU,CAAC,MAAM,GAAG,CAAM;QAC1B,UAAU,CAAC,QAAQ,GAAG,CAAQ;QAC9B,UAAU,CAAC,SAAS,GAAG,CAAK;QAE5B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAK;QAC7C,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;QACjC,UAAU,CAAC,KAAK,GAAG,CAAO;QAC1B,UAAU,CAAC,MAAM,GAAG,CAAO;QAE3B,QAAQ,CAAC,WAAW,CAAC,QAAQ;QAE7B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ;QAElC,EAAE,EAAE,QAAQ,CAAC,UAAU,GAAG,CAAC,EACzB,qCAAe,GAAG,CAAqB;aAClC,CAAC;YACN,QAAQ,CAAC,UAAU,GAAG,CAAC;YACvB,EAAE,EAAE,QAAQ,CAAC,UAAU,KAAK,CAAC,EAC3B,qCAAe,GAAG,CAAU;iBAE5B,qCAAe,GAAG,CAAoB;QAE1C,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,Q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a,KAAK,GAAG,CAAC,OAAO,EAC/F,2CAAqB,CAAC,GAAG,CAAC,OAAO;IAErC,CAAC;IAED,GAAG,CAAC,gBAAgB,GAAG,yCAAmB,CAAC,CAAC;QAC1C,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC;QAC1C,mBAAmB,EAAE,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC;IAC9F,CAAC,EAAE,GAAG;IAEN,EAA2F,AAA3F,yFAA2F;IAC3F,EAA+F,AAA/F,6FAA+F;IAC/F,EAAwF,AAAxF,sFAAwF;IACxF,EAAwG,AAAxG,sGAAwG;IACxG,GAAG,CAAC,QAAQ;IACZ,EAAE,GAAG,qBAAqB,EACxB,EAAsG,AAAtG,oGAAsG;IACtG,EAAsG,AAAtG,oGAAsG;IACtG,EAAqE,AAArE,mEAAqE;IACrE,QAAQ,GAAG,WAAW,IAAI,gBAAgB,GAAG,EAAE,GAAG,CAAC;IAGrD,MAAM,CAAC,CAAC;QACN,gBAAgB,EAAE,CAAC;sBACjB,QAAQ;qBACR,OAAO;oBACP,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,EAAwF,AAAxF,sFAAwF;AACxF,EAA2G,AAA3G,yGAA2G;AAC3G,KAAK,CAAC,yCAAY,iBAAG,sCAAK,CAAC,UAAU,CAAC,iCAAW;SAGxC,0CAAoB,CAC3B,MAAiC,EACjC,YAAgC,EAChC,CAAC;IACD,MAAM,oEACH,yCAAe;QACd,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,MAAM;;AAEpB,CAAC","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/useHasTabbableChild.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 {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 {focusWithoutScrolling, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {useHasTabbableChild} from './useHasTabbableChild';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends HTMLAttributes<HTMLElement> {\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}\n\nfunction Virtualizer<T extends object, V>(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 isLoading,\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 ...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} = useVirtualizer(props, state, ref);\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoading && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n onLoadMore();\n }\n }\n }, [isLoading, onLoadMore, state]);\n\n useLayoutEffect(() => {\n if (!isLoading && onLoadMore && !state.isAnimating) {\n if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) {\n onLoadMore();\n }\n }\n }, [state.contentSize, state.isAnimating, state.virtualizer, onLoadMore, isLoading]);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onVisibleRectChange={onVisibleRectChange}\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 focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean\n}\n\nexport function useVirtualizer<T extends object, V, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus} = props;\n let {virtualizer} = state;\n\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 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 // Exception made if focus isn't within the virtualizer (e.g. opening a picker via click should scroll the selected item into view)\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || !isFocusWithin.current)) {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem]);\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 // When the focused item is scrolled out of view and is removed from the DOM,\n // move focus to the collection view as a whole if focus was within before.\n let focusedView = virtualizer.getView(focusedKey);\n useEffect(() => {\n if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) {\n focusWithoutScrolling(ref.current);\n }\n });\n\n let hasTabbableChild = useHasTabbableChild({\n isEmpty: virtualizer.collection.size === 0,\n hasRenderedAnything: virtualizer.contentSize.height > 0 || virtualizer.contentSize.width > 0\n }, ref);\n\n // Set tabIndex to -1 if the focused view is in the DOM, 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 focusedView 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 = focusedView || hasTabbableChild ? -1 : 0;\n }\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\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>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n reusableView={reusableView}\n parent={parent} />\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} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useResizeObserver} from '@react-aria/utils';\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 2022 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 {getFocusableTreeWalker} from '@react-aria/focus';\nimport {RefObject, useEffect, useState} from 'react';\n\ninterface AriaHasTabbableChildProps {\n isEmpty: boolean,\n hasRenderedAnything: boolean\n}\n\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n//\n// This looks at the element's children and determines if any are tabbable.\nexport function useHasTabbableChild({isEmpty, hasRenderedAnything}: AriaHasTabbableChildProps, ref: RefObject<HTMLElement>): boolean {\n let [hasTabbableChild, setHasTabbableChild] = useState(false);\n\n useEffect(() => {\n if (ref?.current && isEmpty && hasRenderedAnything) {\n // Detect if there are any tabbable elements and update the tabIndex accordingly.\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setHasTabbableChild(!!walker.nextNode());\n }\n }, [ref, isEmpty, hasRenderedAnything]);\n\n return hasTabbableChild;\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, ReusableView} from '@react-stately/virtualizer';\nimport React, {CSSProperties, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps<T extends object, V> {\n reusableView: ReusableView<T, V>,\n parent?: ReusableView<T, V>,\n className?: string\n}\n\nexport function VirtualizerItem<T extends object, V>(props: VirtualizerItemProps<T, V>) {\n let {className, reusableView, parent} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n reusableView,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo)}>\n {reusableView.rendered}\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 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 {RefObject, useCallback} from 'react';\nimport {ReusableView, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface VirtualizerItemOptions<T extends object, V> {\n reusableView: ReusableView<T, V>,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem<T extends object, V>(options: VirtualizerItemOptions<T, V>) {\n let {reusableView: {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
@@ -4,6 +4,7 @@ import {useVirtualizerState as $kSaV5$useVirtualizerState, Rect as $kSaV5$Rect,
4
4
  import $kSaV5$react, {useRef as $kSaV5$useRef, useCallback as $kSaV5$useCallback, useEffect as $kSaV5$useEffect, useMemo as $kSaV5$useMemo, useState as $kSaV5$useState} from "react";
5
5
  import {flushSync as $kSaV5$flushSync} from "react-dom";
6
6
  import {useLocale as $kSaV5$useLocale} from "@react-aria/i18n";
7
+ import {getFocusableTreeWalker as $kSaV5$getFocusableTreeWalker} from "@react-aria/focus";
7
8
 
8
9
 
9
10
 
@@ -200,6 +201,27 @@ const $44a6ee657928b002$export$5665e3d6be6adea = /*#__PURE__*/ $kSaV5$react.forw
200
201
 
201
202
 
202
203
 
204
+ function $15be78fb069d96f5$export$eac1895992b9f3d6({ isEmpty: isEmpty , hasRenderedAnything: hasRenderedAnything }, ref) {
205
+ let [hasTabbableChild, setHasTabbableChild] = $kSaV5$useState(false);
206
+ $kSaV5$useEffect(()=>{
207
+ if ((ref === null || ref === void 0 ? void 0 : ref.current) && isEmpty && hasRenderedAnything) {
208
+ // Detect if there are any tabbable elements and update the tabIndex accordingly.
209
+ let walker = $kSaV5$getFocusableTreeWalker(ref.current, {
210
+ tabbable: true
211
+ });
212
+ setHasTabbableChild(!!walker.nextNode());
213
+ }
214
+ }, [
215
+ ref,
216
+ isEmpty,
217
+ hasRenderedAnything
218
+ ]);
219
+ return hasTabbableChild;
220
+ }
221
+
222
+
223
+
224
+
203
225
 
204
226
 
205
227
 
@@ -397,12 +419,19 @@ function $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref) {
397
419
  $kSaV5$useEffect(()=>{
398
420
  if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) $kSaV5$focusWithoutScrolling(ref.current);
399
421
  });
422
+ let hasTabbableChild = $15be78fb069d96f5$export$eac1895992b9f3d6({
423
+ isEmpty: virtualizer.collection.size === 0,
424
+ hasRenderedAnything: virtualizer.contentSize.height > 0 || virtualizer.contentSize.width > 0
425
+ }, ref);
400
426
  // Set tabIndex to -1 if the focused view is in the DOM, otherwise 0 so that the collection
401
427
  // itself is tabbable. When the collection receives focus, we scroll the focused item back into
402
428
  // view, which will allow it to be properly focused. If using virtual focus, don't set a
403
429
  // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.
404
430
  let tabIndex;
405
- if (!shouldUseVirtualFocus) tabIndex = focusedView ? -1 : 0;
431
+ if (!shouldUseVirtualFocus) // When there is no focusedView the default tabIndex is 0. We include logic for empty collections too.
432
+ // For collections that are empty, but have a link in the empty children we want to skip focusing this
433
+ // and let focus move to the link similar to link moving to children.
434
+ tabIndex = focusedView || hasTabbableChild ? -1 : 0;
406
435
  return {
407
436
  virtualizerProps: {
408
437
  tabIndex: tabIndex,
@@ -1 +1 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CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa;IAC9D,CAAC,EAAE,CAAC;QAAA,GAAG;IAAA,CAAC;IAER,EAA6E,AAA7E,2EAA6E;IAC7E,EAA2E,AAA3E,yEAA2E;IAC3E,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU;IAChD,gBAAS,KAAO,CAAC;QACf,EAAE,EAAE,UAAU,KAAK,WAAW,IAAI,aAAa,CAAC,OAAO,IAAI,QAAQ,CAAC,aAAa,KAAK,GAAG,CAAC,OAAO,EAC/F,4BAAqB,CAAC,GAAG,CAAC,OAAO;IAErC,CAAC;IAED,EAA2F,AAA3F,yFAA2F;IAC3F,EAA+F,AAA/F,6FAA+F;IAC/F,EAAwF,AAAxF,sFAAwF;IACxF,EAAwG,AAAxG,sGAAwG;IACxG,GAAG,CAAC,QAAQ;IACZ,EAAE,GAAG,qBAAqB,EACxB,QAAQ,GAAG,WAAW,GAAG,EAAE,GAAG,CAAC;IAGjC,MAAM,CAAC,CAAC;QACN,gBAAgB,EAAE,CAAC;sBACjB,QAAQ;qBACR,OAAO;oBACP,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,EAAwF,AAAxF,sFAAwF;AACxF,EAA2G,AAA3G,yGAA2G;AAC3G,KAAK,CAAC,yCAAY,iBAAG,YAAK,CAAC,UAAU,CAAC,iCAAW;SAGxC,0CAAoB,CAC3B,MAAiC,EACjC,YAAgC,EAChC,CAAC;IACD,MAAM,0CACH,yCAAe;QACd,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,MAAM;;AAEpB,CAAC","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 {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 {focusWithoutScrolling, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends HTMLAttributes<HTMLElement> {\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}\n\nfunction Virtualizer<T extends object, V>(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 isLoading,\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 ...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} = useVirtualizer(props, state, ref);\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoading && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n onLoadMore();\n }\n }\n }, [isLoading, onLoadMore, state]);\n\n useLayoutEffect(() => {\n if (!isLoading && onLoadMore && !state.isAnimating) {\n if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) {\n onLoadMore();\n }\n }\n }, [state.contentSize, state.isAnimating, state.virtualizer, onLoadMore, isLoading]);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onVisibleRectChange={onVisibleRectChange}\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 focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean\n}\n\nexport function useVirtualizer<T extends object, V, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus} = props;\n let {virtualizer} = state;\n\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 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 // Exception made if focus isn't within the virtualizer (e.g. opening a picker via click should scroll the selected item into view)\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || !isFocusWithin.current)) {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem]);\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 // When the focused item is scrolled out of view and is removed from the DOM,\n // move focus to the collection view as a whole if focus was within before.\n let focusedView = virtualizer.getView(focusedKey);\n useEffect(() => {\n if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) {\n focusWithoutScrolling(ref.current);\n }\n });\n\n // Set tabIndex to -1 if the focused view is in the DOM, 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 tabIndex = focusedView ? -1 : 0;\n }\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\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>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n reusableView={reusableView}\n parent={parent} />\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} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useResizeObserver} from '@react-aria/utils';\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, ReusableView} from '@react-stately/virtualizer';\nimport React, {CSSProperties, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps<T extends object, V> {\n reusableView: ReusableView<T, V>,\n parent?: ReusableView<T, V>,\n className?: string\n}\n\nexport function VirtualizerItem<T extends object, V>(props: VirtualizerItemProps<T, V>) {\n let {className, reusableView, parent} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n reusableView,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo)}>\n {reusableView.rendered}\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 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 {RefObject, useCallback} from 'react';\nimport {ReusableView, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface VirtualizerItemOptions<T extends object, V> {\n reusableView: ReusableView<T, V>,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem<T extends object, V>(options: VirtualizerItemOptions<T, V>) {\n let {reusableView: {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":";;;;;;;;;;;;;AGmBA,GAAG,CAAC,qCAAe,GAAyB,IAAI;SAahC,yCAAgB,CAAC,WAAoB,GAAG,KAAK,EAAiB,CAAC;IAC7E,EAAE,EAAE,qCAAe,KAAK,IAAI,IAAI,WAAW,EAAE,CAAC;QAC5C,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAK;QAC7C,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;QACjC,UAAU,CAAC,KAAK,GAAG,CAAM;QACzB,UAAU,CAAC,MAAM,GAAG,CAAM;QAC1B,UAAU,CAAC,QAAQ,GAAG,CAAQ;QAC9B,UAAU,CAAC,SAAS,GAAG,CAAK;QAE5B,KAAK,CAA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ACjB,QAAQ;qBACR,OAAO;oBACP,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,EAAwF,AAAxF,sFAAwF;AACxF,EAA2G,AAA3G,yGAA2G;AAC3G,KAAK,CAAC,yCAAY,iBAAG,YAAK,CAAC,UAAU,CAAC,iCAAW;SAGxC,0CAAoB,CAC3B,MAAiC,EACjC,YAAgC,EAChC,CAAC;IACD,MAAM,0CACH,yCAAe;QACd,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,YAAY,EAAE,YAAY;QAC1B,MAAM,EAAE,MAAM;;AAEpB,CAAC","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/useHasTabbableChild.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 {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 {focusWithoutScrolling, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport React, {FocusEvent, HTMLAttributes, Key, ReactElement, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {useHasTabbableChild} from './useHasTabbableChild';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends HTMLAttributes<HTMLElement> {\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}\n\nfunction Virtualizer<T extends object, V>(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 isLoading,\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 ...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} = useVirtualizer(props, state, ref);\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoading && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n onLoadMore();\n }\n }\n }, [isLoading, onLoadMore, state]);\n\n useLayoutEffect(() => {\n if (!isLoading && onLoadMore && !state.isAnimating) {\n if (state.contentSize.height > 0 && state.contentSize.height <= state.virtualizer.visibleRect.height) {\n onLoadMore();\n }\n }\n }, [state.contentSize, state.isAnimating, state.virtualizer, onLoadMore, isLoading]);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onVisibleRectChange={onVisibleRectChange}\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 focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean\n}\n\nexport function useVirtualizer<T extends object, V, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus} = props;\n let {virtualizer} = state;\n\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 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 // Exception made if focus isn't within the virtualizer (e.g. opening a picker via click should scroll the selected item into view)\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || !isFocusWithin.current)) {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem]);\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 // When the focused item is scrolled out of view and is removed from the DOM,\n // move focus to the collection view as a whole if focus was within before.\n let focusedView = virtualizer.getView(focusedKey);\n useEffect(() => {\n if (focusedKey && !focusedView && isFocusWithin.current && document.activeElement !== ref.current) {\n focusWithoutScrolling(ref.current);\n }\n });\n\n let hasTabbableChild = useHasTabbableChild({\n isEmpty: virtualizer.collection.size === 0,\n hasRenderedAnything: virtualizer.contentSize.height > 0 || virtualizer.contentSize.width > 0\n }, ref);\n\n // Set tabIndex to -1 if the focused view is in the DOM, 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 focusedView 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 = focusedView || hasTabbableChild ? -1 : 0;\n }\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\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>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n reusableView={reusableView}\n parent={parent} />\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} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useResizeObserver} from '@react-aria/utils';\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 2022 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 {getFocusableTreeWalker} from '@react-aria/focus';\nimport {RefObject, useEffect, useState} from 'react';\n\ninterface AriaHasTabbableChildProps {\n isEmpty: boolean,\n hasRenderedAnything: boolean\n}\n\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n//\n// This looks at the element's children and determines if any are tabbable.\nexport function useHasTabbableChild({isEmpty, hasRenderedAnything}: AriaHasTabbableChildProps, ref: RefObject<HTMLElement>): boolean {\n let [hasTabbableChild, setHasTabbableChild] = useState(false);\n\n useEffect(() => {\n if (ref?.current && isEmpty && hasRenderedAnything) {\n // Detect if there are any tabbable elements and update the tabIndex accordingly.\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setHasTabbableChild(!!walker.nextNode());\n }\n }, [ref, isEmpty, hasRenderedAnything]);\n\n return hasTabbableChild;\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, ReusableView} from '@react-stately/virtualizer';\nimport React, {CSSProperties, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps<T extends object, V> {\n reusableView: ReusableView<T, V>,\n parent?: ReusableView<T, V>,\n className?: string\n}\n\nexport function VirtualizerItem<T extends object, V>(props: VirtualizerItemProps<T, V>) {\n let {className, reusableView, parent} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n reusableView,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo)}>\n {reusableView.rendered}\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 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 {RefObject, useCallback} from 'react';\nimport {ReusableView, Size} from '@react-stately/virtualizer';\nimport {useLayoutEffect} from '@react-aria/utils';\n\ninterface VirtualizerItemOptions<T extends object, V> {\n reusableView: ReusableView<T, V>,\n ref: RefObject<HTMLElement>\n}\n\nexport function useVirtualizerItem<T extends object, V>(options: VirtualizerItemOptions<T, V>) {\n let {reusableView: {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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AC,EAAE,OAAO,CAAA;CAChC;AAED,+BAA+B,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC;;;qBA+B/G,UAAU;oBAiBX,UAAU;;EA6BxC;AAID,OAAA,MAAM;UAA6G,UAAU,cAAc,CAAC;MAAM,YAAY,CAAC","sources":["packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/utils.ts","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/ScrollView.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/useVirtualizerItem.ts","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/VirtualizerItem.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/Virtualizer.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/index.ts","packages/@react-aria/virtualizer/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\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 {useVirtualizer, Virtualizer} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;AAcA,4BACI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,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC;;;qBA+B/G,UAAU;oBAiBX,UAAU;;EAqCxC;AAID,OAAA,MAAM;UAA6G,UAAU,cAAc,CAAC;MAAM,YAAY,CAAC","sources":["packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/utils.ts","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/ScrollView.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/useHasTabbableChild.ts","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/useVirtualizerItem.ts","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/VirtualizerItem.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/Virtualizer.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/index.ts","packages/@react-aria/virtualizer/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\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 {useVirtualizer, Virtualizer} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/virtualizer",
3
- "version": "3.5.2-nightly.3536+fc97a5d82",
3
+ "version": "3.5.2-nightly.3538+d10f20a3f",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,11 +18,12 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/i18n": "3.0.0-nightly.1836+fc97a5d82",
22
- "@react-aria/interactions": "3.0.0-nightly.1836+fc97a5d82",
23
- "@react-aria/utils": "3.0.0-nightly.1836+fc97a5d82",
24
- "@react-stately/virtualizer": "3.3.2-nightly.3536+fc97a5d82",
25
- "@react-types/shared": "3.0.0-nightly.1836+fc97a5d82"
21
+ "@react-aria/focus": "3.0.0-nightly.1838+d10f20a3f",
22
+ "@react-aria/i18n": "3.0.0-nightly.1838+d10f20a3f",
23
+ "@react-aria/interactions": "3.0.0-nightly.1838+d10f20a3f",
24
+ "@react-aria/utils": "3.0.0-nightly.1838+d10f20a3f",
25
+ "@react-stately/virtualizer": "3.3.2-nightly.3538+d10f20a3f",
26
+ "@react-types/shared": "3.0.0-nightly.1838+d10f20a3f"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
@@ -31,5 +32,5 @@
31
32
  "publishConfig": {
32
33
  "access": "public"
33
34
  },
34
- "gitHead": "fc97a5d82cd7bd07efa13bbcffe9741ee327799b"
35
+ "gitHead": "d10f20a3f4ca7ffa807fcaceb944274da825a7b9"
35
36
  }
@@ -16,6 +16,7 @@ import {getInteractionModality} from '@react-aria/interactions';
16
16
  import {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';
17
17
  import React, {FocusEvent, HTMLAttributes, Key, ReactElement, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';
18
18
  import {ScrollView} from './ScrollView';
19
+ import {useHasTabbableChild} from './useHasTabbableChild';
19
20
  import {VirtualizerItem} from './VirtualizerItem';
20
21
 
21
22
  interface VirtualizerProps<T extends object, V> extends HTMLAttributes<HTMLElement> {
@@ -178,13 +179,21 @@ export function useVirtualizer<T extends object, V, W>(props: VirtualizerOptions
178
179
  }
179
180
  });
180
181
 
182
+ let hasTabbableChild = useHasTabbableChild({
183
+ isEmpty: virtualizer.collection.size === 0,
184
+ hasRenderedAnything: virtualizer.contentSize.height > 0 || virtualizer.contentSize.width > 0
185
+ }, ref);
186
+
181
187
  // Set tabIndex to -1 if the focused view is in the DOM, otherwise 0 so that the collection
182
188
  // itself is tabbable. When the collection receives focus, we scroll the focused item back into
183
189
  // view, which will allow it to be properly focused. If using virtual focus, don't set a
184
190
  // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.
185
191
  let tabIndex: number;
186
192
  if (!shouldUseVirtualFocus) {
187
- tabIndex = focusedView ? -1 : 0;
193
+ // When there is no focusedView the default tabIndex is 0. We include logic for empty collections too.
194
+ // For collections that are empty, but have a link in the empty children we want to skip focusing this
195
+ // and let focus move to the link similar to link moving to children.
196
+ tabIndex = focusedView || hasTabbableChild ? -1 : 0;
188
197
  }
189
198
 
190
199
  return {
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2022 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {getFocusableTreeWalker} from '@react-aria/focus';
14
+ import {RefObject, useEffect, useState} from 'react';
15
+
16
+ interface AriaHasTabbableChildProps {
17
+ isEmpty: boolean,
18
+ hasRenderedAnything: boolean
19
+ }
20
+
21
+ // This was created for a special empty case of a component that can have child or
22
+ // be empty, like Collection/Virtualizer/Table/ListView/etc. When these components
23
+ // are empty they can have a message with a tabbable element, which is like them
24
+ // being not empty, when it comes to focus and tab order.
25
+ //
26
+ // This looks at the element's children and determines if any are tabbable.
27
+ export function useHasTabbableChild({isEmpty, hasRenderedAnything}: AriaHasTabbableChildProps, ref: RefObject<HTMLElement>): boolean {
28
+ let [hasTabbableChild, setHasTabbableChild] = useState(false);
29
+
30
+ useEffect(() => {
31
+ if (ref?.current && isEmpty && hasRenderedAnything) {
32
+ // Detect if there are any tabbable elements and update the tabIndex accordingly.
33
+ let walker = getFocusableTreeWalker(ref.current, {tabbable: true});
34
+ setHasTabbableChild(!!walker.nextNode());
35
+ }
36
+ }, [ref, isEmpty, hasRenderedAnything]);
37
+
38
+ return hasTabbableChild;
39
+ }