@react-aria/selection 3.13.1 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/import.mjs CHANGED
@@ -271,10 +271,12 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
271
271
  // Restore the scroll position to what it was before.
272
272
  scrollRef.current.scrollTop = scrollPos.current.top;
273
273
  scrollRef.current.scrollLeft = scrollPos.current.left;
274
+ }
275
+ if (!isVirtualized && manager.focusedKey != null) {
274
276
  // Refocus and scroll the focused item into view if it exists within the scrollable region.
275
277
  let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
276
278
  if (element) {
277
- // This prevents a flash of focus on the first/last element in the collection
279
+ // This prevents a flash of focus on the first/last element in the collection, or the collection itself.
278
280
  (0, $eCAIO$focusWithoutScrolling)(element);
279
281
  (0, $eCAIO$scrollIntoView)(scrollRef.current, element);
280
282
  }
@@ -385,9 +387,9 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
385
387
  // Focus the associated DOM node when this item becomes the focusedKey
386
388
  (0, $eCAIO$useEffect)(()=>{
387
389
  let isFocused = key === manager.focusedKey;
388
- if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
390
+ if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
389
391
  if (focus) focus();
390
- else (0, $eCAIO$focusSafely)(ref.current);
392
+ else if (document.activeElement !== ref.current) (0, $eCAIO$focusSafely)(ref.current);
391
393
  }
392
394
  // eslint-disable-next-line react-hooks/exhaustive-deps
393
395
  }, [
@@ -511,6 +513,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
511
513
  }),
512
514
  isPressed: isPressed,
513
515
  isSelected: manager.isSelected(key),
516
+ isFocused: manager.isFocused && manager.focusedKey === key,
514
517
  isDisabled: isDisabled,
515
518
  allowsSelection: allowsSelection,
516
519
  hasAction: hasAction
@@ -555,6 +558,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
555
558
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
556
559
  key = this.collection.getKeyAfter(key);
557
560
  }
561
+ return null;
558
562
  }
559
563
  getKeyAbove(key) {
560
564
  key = this.collection.getKeyBefore(key);
@@ -563,6 +567,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
563
567
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
564
568
  key = this.collection.getKeyBefore(key);
565
569
  }
570
+ return null;
566
571
  }
567
572
  getFirstKey() {
568
573
  let key = this.collection.getFirstKey();
@@ -571,6 +576,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
571
576
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
572
577
  key = this.collection.getKeyAfter(key);
573
578
  }
579
+ return null;
574
580
  }
575
581
  getLastKey() {
576
582
  let key = this.collection.getLastKey();
@@ -579,6 +585,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
579
585
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
580
586
  key = this.collection.getKeyBefore(key);
581
587
  }
588
+ return null;
582
589
  }
583
590
  getItem(key) {
584
591
  return this.ref.current.querySelector(`[data-key="${key}"]`);
@@ -590,7 +597,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
590
597
  let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);
591
598
  while(item && item.offsetTop > pageY){
592
599
  key = this.getKeyAbove(key);
593
- item = this.getItem(key);
600
+ item = key == null ? null : this.getItem(key);
594
601
  }
595
602
  return key;
596
603
  }
@@ -601,7 +608,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
601
608
  let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);
602
609
  while(item && item.offsetTop < pageY){
603
610
  key = this.getKeyBelow(key);
604
- item = this.getItem(key);
611
+ item = key == null ? null : this.getItem(key);
605
612
  }
606
613
  return key;
607
614
  }
package/dist/main.js CHANGED
@@ -280,10 +280,12 @@ function $b6837c2f80a3c32f$export$d6daf82dcd84e87c(options) {
280
280
  // Restore the scroll position to what it was before.
281
281
  scrollRef.current.scrollTop = scrollPos.current.top;
282
282
  scrollRef.current.scrollLeft = scrollPos.current.left;
283
+ }
284
+ if (!isVirtualized && manager.focusedKey != null) {
283
285
  // Refocus and scroll the focused item into view if it exists within the scrollable region.
284
286
  let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
285
287
  if (element) {
286
- // This prevents a flash of focus on the first/last element in the collection
288
+ // This prevents a flash of focus on the first/last element in the collection, or the collection itself.
287
289
  (0, $glPPV$reactariautils.focusWithoutScrolling)(element);
288
290
  (0, $glPPV$reactariautils.scrollIntoView)(scrollRef.current, element);
289
291
  }
@@ -394,9 +396,9 @@ function $433b1145b0781e10$export$ecf600387e221c37(options) {
394
396
  // Focus the associated DOM node when this item becomes the focusedKey
395
397
  (0, $glPPV$react.useEffect)(()=>{
396
398
  let isFocused = key === manager.focusedKey;
397
- if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
399
+ if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
398
400
  if (focus) focus();
399
- else (0, $glPPV$reactariafocus.focusSafely)(ref.current);
401
+ else if (document.activeElement !== ref.current) (0, $glPPV$reactariafocus.focusSafely)(ref.current);
400
402
  }
401
403
  // eslint-disable-next-line react-hooks/exhaustive-deps
402
404
  }, [
@@ -520,6 +522,7 @@ function $433b1145b0781e10$export$ecf600387e221c37(options) {
520
522
  }),
521
523
  isPressed: isPressed,
522
524
  isSelected: manager.isSelected(key),
525
+ isFocused: manager.isFocused && manager.focusedKey === key,
523
526
  isDisabled: isDisabled,
524
527
  allowsSelection: allowsSelection,
525
528
  hasAction: hasAction
@@ -564,6 +567,7 @@ function $433b1145b0781e10$var$isSelectionKey() {
564
567
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
565
568
  key = this.collection.getKeyAfter(key);
566
569
  }
570
+ return null;
567
571
  }
568
572
  getKeyAbove(key) {
569
573
  key = this.collection.getKeyBefore(key);
@@ -572,6 +576,7 @@ function $433b1145b0781e10$var$isSelectionKey() {
572
576
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
573
577
  key = this.collection.getKeyBefore(key);
574
578
  }
579
+ return null;
575
580
  }
576
581
  getFirstKey() {
577
582
  let key = this.collection.getFirstKey();
@@ -580,6 +585,7 @@ function $433b1145b0781e10$var$isSelectionKey() {
580
585
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
581
586
  key = this.collection.getKeyAfter(key);
582
587
  }
588
+ return null;
583
589
  }
584
590
  getLastKey() {
585
591
  let key = this.collection.getLastKey();
@@ -588,6 +594,7 @@ function $433b1145b0781e10$var$isSelectionKey() {
588
594
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
589
595
  key = this.collection.getKeyBefore(key);
590
596
  }
597
+ return null;
591
598
  }
592
599
  getItem(key) {
593
600
  return this.ref.current.querySelector(`[data-key="${key}"]`);
@@ -599,7 +606,7 @@ function $433b1145b0781e10$var$isSelectionKey() {
599
606
  let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);
600
607
  while(item && item.offsetTop > pageY){
601
608
  key = this.getKeyAbove(key);
602
- item = this.getItem(key);
609
+ item = key == null ? null : this.getItem(key);
603
610
  }
604
611
  return key;
605
612
  }
@@ -610,7 +617,7 @@ function $433b1145b0781e10$var$isSelectionKey() {
610
617
  let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);
611
618
  while(item && item.offsetTop < pageY){
612
619
  key = this.getKeyBelow(key);
613
- item = this.getItem(key);
620
+ item = key == null ? null : this.getItem(key);
614
621
  }
615
622
  return key;
616
623
  }
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;;ACZA;;;;;;;;;;CAUC,GAED;;AASO,SAAS,0CAAiC,CA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IACb;AACF;;","sources":["packages/@react-aria/selection/src/index.ts","packages/@react-aria/selection/src/useSelectableCollection.ts","packages/@react-aria/selection/src/utils.ts","packages/@react-aria/selection/src/useTypeSelect.ts","packages/@react-aria/selection/src/useSelectableItem.ts","packages/@react-aria/selection/src/useSelectableList.ts","packages/@react-aria/selection/src/ListKeyboardDelegate.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 {useSelectableCollection} from './useSelectableCollection';\nexport {useSelectableItem} from './useSelectableItem';\nexport {useSelectableList} from './useSelectableList';\nexport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nexport {useTypeSelect} from './useTypeSelect';\n\nexport type {AriaSelectableCollectionOptions, SelectableCollectionAria} from './useSelectableCollection';\nexport type {AriaSelectableListOptions, SelectableListAria} from './useSelectableList';\nexport type {SelectableItemOptions, SelectableItemStates, SelectableItemAria} from './useSelectableItem';\nexport type {AriaTypeSelectOptions, TypeSelectAria} from './useTypeSelect';\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 {DOMAttributes, FocusableElement, FocusStrategy, KeyboardDelegate} from '@react-types/shared';\nimport {FocusEvent, Key, KeyboardEvent, RefObject, useEffect, useRef} from 'react';\nimport {focusSafely, getFocusableTreeWalker} from '@react-aria/focus';\nimport {focusWithoutScrolling, mergeProps, scrollIntoView, scrollIntoViewport, useEvent} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useLocale} from '@react-aria/i18n';\nimport {useTypeSelect} from './useTypeSelect';\n\nexport interface AriaSelectableCollectionOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A delegate object that implements behavior for keyboard focus movement.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * The ref attached to the element representing the collection.\n */\n ref: RefObject<HTMLElement>,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether the collection allows the user to select all items via keyboard shortcut.\n * @default false\n */\n disallowSelectAll?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean,\n /**\n * Whether the collection items are contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * The ref attached to the scrollable body. Used to provide automatic scrolling on item focus for non-virtualized collections.\n * If not provided, defaults to the collection ref.\n */\n scrollRef?: RefObject<HTMLElement>\n}\n\nexport interface SelectableCollectionAria {\n /** Props for the collection element. */\n collectionProps: DOMAttributes\n}\n\n/**\n * Handles interactions with selectable collections.\n */\nexport function useSelectableCollection(options: AriaSelectableCollectionOptions): SelectableCollectionAria {\n let {\n selectionManager: manager,\n keyboardDelegate: delegate,\n ref,\n autoFocus = false,\n shouldFocusWrap = false,\n disallowEmptySelection = false,\n disallowSelectAll = false,\n selectOnFocus = manager.selectionBehavior === 'replace',\n disallowTypeAhead = false,\n shouldUseVirtualFocus,\n allowsTabNavigation = false,\n isVirtualized,\n // If no scrollRef is provided, assume the collection ref is the scrollable region\n scrollRef = ref\n } = options;\n let {direction} = useLocale();\n\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes\n if (e.altKey && e.key === 'Tab') {\n e.preventDefault();\n }\n\n // Keyboard events bubble through portals. Don't handle keyboard events\n // for elements outside the collection (e.g. menus).\n if (!ref.current.contains(e.target as Element)) {\n return;\n }\n\n const navigateToKey = (key: Key | undefined, childFocus?: FocusStrategy) => {\n if (key != null) {\n manager.setFocusedKey(key, childFocus);\n\n if (e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(key);\n } else if (selectOnFocus && !isNonContiguousSelectionModifier(e)) {\n manager.replaceSelection(key);\n }\n }\n };\n\n switch (e.key) {\n case 'ArrowDown': {\n if (delegate.getKeyBelow) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyBelow(manager.focusedKey)\n : delegate.getFirstKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getFirstKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowUp': {\n if (delegate.getKeyAbove) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyAbove(manager.focusedKey)\n : delegate.getLastKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getLastKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowLeft': {\n if (delegate.getKeyLeftOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyLeftOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');\n }\n break;\n }\n case 'ArrowRight': {\n if (delegate.getKeyRightOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyRightOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');\n }\n break;\n }\n case 'Home':\n if (delegate.getFirstKey) {\n e.preventDefault();\n let firstKey = delegate.getFirstKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(firstKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(firstKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(firstKey);\n }\n }\n break;\n case 'End':\n if (delegate.getLastKey) {\n e.preventDefault();\n let lastKey = delegate.getLastKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(lastKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(lastKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(lastKey);\n }\n }\n break;\n case 'PageDown':\n if (delegate.getKeyPageBelow) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageBelow(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'PageUp':\n if (delegate.getKeyPageAbove) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageAbove(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'a':\n if (isCtrlKeyPressed(e) && manager.selectionMode === 'multiple' && disallowSelectAll !== true) {\n e.preventDefault();\n manager.selectAll();\n }\n break;\n case 'Escape':\n e.preventDefault();\n if (!disallowEmptySelection) {\n manager.clearSelection();\n }\n break;\n case 'Tab': {\n if (!allowsTabNavigation) {\n // There may be elements that are \"tabbable\" inside a collection (e.g. in a grid cell).\n // However, collections should be treated as a single tab stop, with arrow key navigation internally.\n // We don't control the rendering of these, so we can't override the tabIndex to prevent tabbing.\n // Instead, we handle the Tab key, and move focus manually to the first/last tabbable element\n // in the collection, so that the browser default behavior will apply starting from that element\n // rather than the currently focused one.\n if (e.shiftKey) {\n ref.current.focus();\n } else {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n let next: FocusableElement;\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n next = last;\n }\n } while (last);\n\n if (next && !next.contains(document.activeElement)) {\n focusWithoutScrolling(next);\n }\n }\n break;\n }\n }\n }\n };\n\n // Store the scroll position so we can restore it later.\n let scrollPos = useRef({top: 0, left: 0});\n useEvent(scrollRef, 'scroll', isVirtualized ? null : () => {\n scrollPos.current = {\n top: scrollRef.current.scrollTop,\n left: scrollRef.current.scrollLeft\n };\n });\n\n let onFocus = (e: FocusEvent) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n\n if (manager.focusedKey == null) {\n let navigateToFirstKey = (key: Key | undefined) => {\n if (key != null) {\n manager.setFocusedKey(key);\n if (selectOnFocus) {\n manager.replaceSelection(key);\n }\n }\n };\n // If the user hasn't yet interacted with the collection, there will be no focusedKey set.\n // Attempt to detect whether the user is tabbing forward or backward into the collection\n // and either focus the first or last item accordingly.\n let relatedTarget = e.relatedTarget as Element;\n if (relatedTarget && (e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)) {\n navigateToFirstKey(manager.lastSelectedKey ?? delegate.getLastKey());\n } else {\n navigateToFirstKey(manager.firstSelectedKey ?? delegate.getFirstKey());\n }\n } else if (!isVirtualized) {\n // Restore the scroll position to what it was before.\n scrollRef.current.scrollTop = scrollPos.current.top;\n scrollRef.current.scrollLeft = scrollPos.current.left;\n\n // Refocus and scroll the focused item into view if it exists within the scrollable region.\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n // This prevents a flash of focus on the first/last element in the collection\n focusWithoutScrolling(element);\n scrollIntoView(scrollRef.current, element);\n }\n }\n };\n\n let onBlur = (e) => {\n // Don't set blurred and then focused again if moving focus within the collection.\n if (!e.currentTarget.contains(e.relatedTarget as HTMLElement)) {\n manager.setFocused(false);\n }\n };\n\n const autoFocusRef = useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n let focusedKey = null;\n\n // Check focus strategy to determine which item to focus\n if (autoFocus === 'first') {\n focusedKey = delegate.getFirstKey();\n } if (autoFocus === 'last') {\n focusedKey = delegate.getLastKey();\n }\n\n // If there are any selected keys, make the first one the new focus target\n let selectedKeys = manager.selectedKeys;\n if (selectedKeys.size) {\n focusedKey = selectedKeys.values().next().value;\n }\n\n manager.setFocused(true);\n manager.setFocusedKey(focusedKey);\n\n // If no default focus key is selected, focus the collection itself.\n if (focusedKey == null && !shouldUseVirtualFocus) {\n focusSafely(ref.current);\n }\n }\n autoFocusRef.current = false;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If not virtualized, scroll the focused element into view when the focusedKey changes.\n // When virtualized, Virtualizer handles this internally.\n useEffect(() => {\n let modality = getInteractionModality();\n if (!isVirtualized && manager.isFocused && manager.focusedKey != null && scrollRef?.current) {\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n scrollIntoView(scrollRef.current, element);\n if (modality === 'keyboard') {\n scrollIntoViewport(element, {containingElement: ref.current});\n }\n }\n }\n }, [isVirtualized, scrollRef, manager.focusedKey, manager.isFocused, ref]);\n\n let handlers = {\n onKeyDown,\n onFocus,\n onBlur,\n onMouseDown(e) {\n // Ignore events that bubbled through portals.\n if (scrollRef.current === e.target) {\n // Prevent focus going to the collection when clicking on the scrollbar.\n e.preventDefault();\n }\n }\n };\n\n let {typeSelectProps} = useTypeSelect({\n keyboardDelegate: delegate,\n selectionManager: manager\n });\n\n if (!disallowTypeAhead) {\n handlers = mergeProps(typeSelectProps, handlers);\n }\n\n // If nothing is focused within the collection, make the collection itself tabbable.\n // This will be marshalled to either the first or last item depending on where focus came from.\n // If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try\n // to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n tabIndex = manager.focusedKey == null ? 0 : -1;\n }\n\n return {\n collectionProps: {\n ...handlers,\n tabIndex\n }\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\nimport {isAppleDevice} from '@react-aria/utils';\nimport {isMac} from '@react-aria/utils';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isNonContiguousSelectionModifier(e: Event) {\n // Ctrl + Arrow Up/Arrow Down has a system wide meaning on macOS, so use Alt instead.\n // On Windows and Ubuntu, Alt + Space has a system wide meaning.\n return isAppleDevice() ? e.altKey : e.ctrlKey;\n}\n\nexport function isCtrlKeyPressed(e: Event) {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\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 {DOMAttributes, KeyboardDelegate} from '@react-types/shared';\nimport {Key, KeyboardEvent, useRef} from 'react';\nimport {MultipleSelectionManager} from '@react-stately/selection';\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface AriaTypeSelectOptions {\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * Called when an item is focused by typing.\n */\n onTypeSelect?: (key: Key) => void\n}\n\nexport interface TypeSelectAria {\n /**\n * Props to be spread on the owner of the options.\n */\n typeSelectProps: DOMAttributes\n}\n\n/**\n * Handles typeahead interactions with collections.\n */\nexport function useTypeSelect(options: AriaTypeSelectOptions): TypeSelectAria {\n let {keyboardDelegate, selectionManager, onTypeSelect} = options;\n let state = useRef({\n search: '',\n timeout: null\n }).current;\n\n let onKeyDown = (e: KeyboardEvent) => {\n let character = getStringForKey(e.key);\n if (!character || e.ctrlKey || e.metaKey) {\n return;\n }\n\n // Do not propagate the Spacebar event if it's meant to be part of the search.\n // When we time out, the search term becomes empty, hence the check on length.\n // Trimming is to account for the case of pressing the Spacebar more than once,\n // which should cycle through the selection/deselection of the focused item.\n if (character === ' ' && state.search.trim().length > 0) {\n e.preventDefault();\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n }\n\n state.search += character;\n\n // Use the delegate to find a key to focus.\n // Prioritize items after the currently focused item, falling back to searching the whole list.\n let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);\n\n // If no key found, search from the top.\n if (key == null) {\n key = keyboardDelegate.getKeyForSearch(state.search);\n }\n\n if (key != null) {\n selectionManager.setFocusedKey(key);\n if (onTypeSelect) {\n onTypeSelect(key);\n }\n }\n\n clearTimeout(state.timeout);\n state.timeout = setTimeout(() => {\n state.search = '';\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n return {\n typeSelectProps: {\n // Using a capturing listener to catch the keydown event before\n // other hooks in order to handle the Spacebar event.\n onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null\n }\n };\n}\n\nfunction getStringForKey(key: string) {\n // If the key is of length 1, it is an ASCII value.\n // Otherwise, if there are no ASCII characters in the key name,\n // it is a Unicode character.\n // See https://www.w3.org/TR/uievents-key/\n if (key.length === 1 || !/^[A-Z]/i.test(key)) {\n return key;\n }\n\n return '';\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 {DOMAttributes, FocusableElement, LongPressEvent, PressEvent} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {Key, RefObject, useEffect, useRef} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {PressProps, useLongPress, usePress} from '@react-aria/interactions';\n\nexport interface SelectableItemOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A unique key for the item.\n */\n key: Key,\n /**\n * Ref to the item.\n */\n ref: RefObject<FocusableElement>,\n /**\n * By default, selection occurs on pointer down. This can be strange if selecting an\n * item causes the UI to disappear immediately (e.g. menus).\n */\n shouldSelectOnPressUp?: boolean,\n /**\n * Whether selection requires the pointer/mouse down and up events to occur on the same target or triggers selection on\n * the target of the pointer/mouse up event.\n */\n allowsDifferentPressOrigin?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Function to focus the item.\n */\n focus?: () => void,\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nexport interface SelectableItemStates {\n /** Whether the item is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the item is currently selected. */\n isSelected: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n */\n isDisabled: boolean,\n /**\n * Whether the item may be selected, dependent on `selectionMode`, `disabledKeys`, and `disabledBehavior`.\n */\n allowsSelection: boolean,\n /**\n * Whether the item has an action, dependent on `onAction`, `disabledKeys`,\n * and `disabledBehavior`. It may also change depending on the current selection state\n * of the list (e.g. when selection is primary). This can be used to enable or disable hover\n * styles or other visual indications of interactivity.\n */\n hasAction: boolean\n}\n\nexport interface SelectableItemAria extends SelectableItemStates {\n /**\n * Props to be spread on the item root node.\n */\n itemProps: DOMAttributes\n}\n\n/**\n * Handles interactions with an item in a selectable collection.\n */\nexport function useSelectableItem(options: SelectableItemOptions): SelectableItemAria {\n let {\n selectionManager: manager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n focus,\n isDisabled,\n onAction,\n allowsDifferentPressOrigin\n } = options;\n\n let onSelect = (e: PressEvent | LongPressEvent | PointerEvent) => {\n if (e.pointerType === 'keyboard' && isNonContiguousSelectionModifier(e)) {\n manager.toggleSelection(key);\n } else {\n if (manager.selectionMode === 'none') {\n return;\n }\n\n if (manager.selectionMode === 'single') {\n if (manager.isSelected(key) && !manager.disallowEmptySelection) {\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n } else if (e && e.shiftKey) {\n manager.extendSelection(key);\n } else if (manager.selectionBehavior === 'toggle' || (e && (isCtrlKeyPressed(e) || e.pointerType === 'touch' || e.pointerType === 'virtual'))) {\n // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n }\n };\n\n // Focus the associated DOM node when this item becomes the focusedKey\n useEffect(() => {\n let isFocused = key === manager.focusedKey;\n if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {\n if (focus) {\n focus();\n } else {\n focusSafely(ref.current);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, key, manager.focusedKey, manager.childFocusStrategy, manager.isFocused, shouldUseVirtualFocus]);\n\n isDisabled = isDisabled || manager.isDisabled(key);\n // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused\n // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver\n // on iOS 14 doesn't try to move real DOM focus to the item anyway.\n let itemProps: SelectableItemAria['itemProps'] = {};\n if (!shouldUseVirtualFocus && !isDisabled) {\n itemProps = {\n tabIndex: key === manager.focusedKey ? 0 : -1,\n onFocus(e) {\n if (e.target === ref.current) {\n manager.setFocusedKey(key);\n }\n }\n };\n } else if (isDisabled) {\n itemProps.onMouseDown = (e) => {\n // Prevent focus going to the body when clicking on a disabled item.\n e.preventDefault();\n };\n }\n\n // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.\n // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.\n // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.\n // With touch, onAction occurs on single tap, and long press enters selection mode.\n let allowsSelection = !isDisabled && manager.canSelectItem(key);\n let allowsActions = onAction && !isDisabled;\n let hasPrimaryAction = allowsActions && (\n manager.selectionBehavior === 'replace'\n ? !allowsSelection\n : manager.isEmpty\n );\n let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';\n let hasAction = hasPrimaryAction || hasSecondaryAction;\n let modality = useRef(null);\n\n let longPressEnabled = hasAction && allowsSelection;\n let longPressEnabledOnPressStart = useRef(false);\n let hadPrimaryActionOnPressStart = useRef(false);\n\n // By default, selection occurs on pointer down. This can be strange if selecting an\n // item causes the UI to disappear immediately (e.g. menus).\n // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.\n // onPress requires a pointer down event on the same element as pointer up. For menus,\n // we want to be able to have the pointer down on the trigger that opens the menu and\n // the pointer up on the menu item rather than requiring a separate press.\n // For keyboard events, selection still occurs on key down.\n let itemPressProps: PressProps = {};\n if (shouldSelectOnPressUp) {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n if (e.pointerType === 'keyboard' && (!hasAction || isSelectionKey())) {\n onSelect(e);\n }\n };\n\n // If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)\n // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)\n if (!allowsDifferentPressOrigin) {\n itemPressProps.onPress = (e) => {\n if (hasPrimaryAction || (hasSecondaryAction && e.pointerType !== 'mouse')) {\n if (e.pointerType === 'keyboard' && !isActionKey()) {\n return;\n }\n\n onAction();\n } else if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n } else {\n itemPressProps.onPressUp = (e) => {\n if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;\n }\n } else {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n hadPrimaryActionOnPressStart.current = hasPrimaryAction;\n\n // Select on mouse down unless there is a primary action which will occur on mouse up.\n // For keyboard, select on key down. If there is an action, the Space key selects on key down,\n // and the Enter key performs onAction on key up.\n if (\n (e.pointerType === 'mouse' && !hasPrimaryAction) ||\n (e.pointerType === 'keyboard' && (!onAction || isSelectionKey()))\n ) {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = (e) => {\n // Selection occurs on touch up. Primary actions always occur on pointer up.\n // Both primary and secondary actions occur on Enter key up. The only exception\n // is secondary actions, which occur on double click with a mouse.\n if (\n e.pointerType === 'touch' ||\n e.pointerType === 'pen' ||\n e.pointerType === 'virtual' ||\n (e.pointerType === 'keyboard' && hasAction && isActionKey()) ||\n (e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current)\n ) {\n if (hasAction) {\n onAction();\n } else {\n onSelect(e);\n }\n }\n };\n }\n\n if (!isVirtualized) {\n itemProps['data-key'] = key;\n }\n\n itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;\n let {pressProps, isPressed} = usePress(itemPressProps);\n\n // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.\n let onDoubleClick = hasSecondaryAction ? (e) => {\n if (modality.current === 'mouse') {\n e.stopPropagation();\n e.preventDefault();\n onAction();\n }\n } : undefined;\n\n // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior\n // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to\n // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.\n let {longPressProps} = useLongPress({\n isDisabled: !longPressEnabled,\n onLongPress(e) {\n if (e.pointerType === 'touch') {\n onSelect(e);\n manager.setSelectionBehavior('toggle');\n }\n }\n });\n\n // Prevent native drag and drop on long press if we also select on long press.\n // Once the user is in selection mode, they can long press again to drag.\n // Use a capturing listener to ensure this runs before useDrag, regardless of\n // the order the props get merged.\n let onDragStartCapture = e => {\n if (modality.current === 'touch' && longPressEnabledOnPressStart.current) {\n e.preventDefault();\n }\n };\n\n return {\n itemProps: mergeProps(\n itemProps,\n allowsSelection || hasPrimaryAction ? pressProps : {},\n longPressEnabled ? longPressProps : {},\n {onDoubleClick, onDragStartCapture}\n ),\n isPressed,\n isSelected: manager.isSelected(key),\n isDisabled,\n allowsSelection,\n hasAction\n };\n}\n\nfunction isActionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === 'Enter';\n}\n\nfunction isSelectionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === ' ' || event?.code === 'Space';\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 {Collection, DOMAttributes, FocusStrategy, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject, useMemo} from 'react';\nimport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useCollator} from '@react-aria/i18n';\nimport {useSelectableCollection} from './useSelectableCollection';\n\nexport interface AriaSelectableListOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * State of the collection.\n */\n collection: Collection<Node<unknown>>,\n /**\n * The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\n */\n disabledKeys: Set<Key>,\n /**\n * A ref to the item.\n */\n ref?: RefObject<HTMLElement>,\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean\n}\n\nexport interface SelectableListAria {\n /**\n * Props for the option element.\n */\n listProps: DOMAttributes\n}\n\n/**\n * Handles interactions with a selectable list.\n */\nexport function useSelectableList(props: AriaSelectableListOptions): SelectableListAria {\n let {\n selectionManager,\n collection,\n disabledKeys,\n ref,\n keyboardDelegate,\n autoFocus,\n shouldFocusWrap,\n isVirtualized,\n disallowEmptySelection,\n selectOnFocus = selectionManager.selectionBehavior === 'replace',\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let disabledBehavior = selectionManager.disabledBehavior;\n let delegate = useMemo(() => (\n keyboardDelegate || new ListKeyboardDelegate(collection, disabledBehavior === 'selection' ? new Set() : disabledKeys, ref, collator)\n ), [keyboardDelegate, collection, disabledKeys, ref, collator, disabledBehavior]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager,\n keyboardDelegate: delegate,\n autoFocus,\n shouldFocusWrap,\n disallowEmptySelection,\n selectOnFocus,\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation,\n isVirtualized,\n scrollRef: ref\n });\n\n return {\n listProps: collectionProps\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\nimport {Collection, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject} from 'react';\n\nexport class ListKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private disabledKeys: Set<Key>;\n private ref: RefObject<HTMLElement>;\n private collator: Intl.Collator;\n\n constructor(collection: Collection<Node<T>>, disabledKeys: Set<Key>, ref: RefObject<HTMLElement>, collator?: Intl.Collator) {\n this.collection = collection;\n this.disabledKeys = disabledKeys;\n this.ref = ref;\n this.collator = collator;\n }\n\n getKeyBelow(key: Key) {\n key = this.collection.getKeyAfter(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n }\n\n getKeyAbove(key: Key) {\n key = this.collection.getKeyBefore(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n }\n\n private getItem(key: Key): HTMLElement {\n return this.ref.current.querySelector(`[data-key=\"${key}\"]`);\n }\n\n getKeyPageAbove(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);\n\n while (item && item.offsetTop > pageY) {\n key = this.getKeyAbove(key);\n item = this.getItem(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);\n\n while (item && item.offsetTop < pageY) {\n key = this.getKeyBelow(key);\n item = this.getItem(key);\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let key = fromKey || this.getFirstKey();\n while (key != null) {\n let item = collection.getItem(key);\n let substring = item.textValue.slice(0, search.length);\n if (item.textValue && this.collator.compare(substring, search) === 0) {\n return key;\n }\n\n key = this.getKeyBelow(key);\n }\n\n return null;\n }\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;;ACZA;;;;;;;;;;CAUC,GAED;;AASO,SAAS,0CAAiC,CAAQ,EAAE;IACzD,qFAAqF;IACrF,gEAAgE;IAChE,OAAO,CAAA,GAAA,mCAAY,MAAM,EAAE,MAAM,GAAG,EAAE,OAAO;AAC/C;AAEO,SAAS,0CAAiB,CAAQ,EAAE;IACzC,IAAI,CAAA,GAAA,2BAAI,KACN,OAAO,EAAE,OAAO;IAGlB,OAAO,EAAE,OAAO;AAClB;;;;ACjCA;;;;;;;;;;CAUC,GAED;AAIA;;CAEC,GACD,MAAM,mDAA6B,MAAM,WAAW;AA2B7C,SAAS,0CAAc,OAA8B,EAAkB;IAC5E,IAAI,oBAAC,iBAAgB,oBAAE,iBAAgB,gBAAE,aAAY,EAAC,GAAG;IACzD,IAAI,QAAQ,CAAA,GAAA,mBAAK,EAAE;QACjB,QAAQ;QACR,SAAS,IAAI;IACf,GAAG,OAAO;IAEV,IAAI,YAAY,CAAC,IAAqB;QACpC,IAAI,YAAY,sCAAgB,EAAE,GAAG;QACrC,IAAI,CAAC,aAAa,EAAE,OAAO,IAAI,EAAE,OAAO,EACtC;QAGF,8EAA8E;QAC9E,8EAA8E;QAC9E,+EAA+E;QAC/E,4EAA4E;QAC5E,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;IAClB;AAmHF;;;;;ADpDO,SAAS,0CAAkB,KAAgC,EAAsB;IACtF,IAAI,oBACF,iBAAgB,cAChB,WAAU,gBACV,aAAY,OACZ,IAAG,oBACH,iBAAgB,aAChB,UAAS,mBACT,gBAAe,iBACf,cAAa,0BACb,uBAAsB,iBACtB,gBAAgB,iBAAiB,iBAAiB,KAAK,+BACvD,kBAAiB,yBACjB,sBAAqB,uBACrB,oBAAmB,EACpB,GAAG;IAEJ,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,gCAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,mBAAmB,iBAAiB,gBAAgB;IACxD,IAAI,WAAW,CAAA,GAAA,oBAAM,EAAE,IACrB,oBAAoB,IAAI,CAAA,GAAA,yCAAoB,AAAD,EAAE,YAAY,qBAAqB,cAAc,IAAI,QAAQ,YAAY,EAAE,KAAK,WAC1H;QAAC;QAAkB;QAAY;QAAc;QAAK;QAAU;KAAiB;IAEhF,IAAI,mBAAC,gBAAe,EAAC,GAAG,CAAA,GAAA,yCAAuB,AAAD,EAAE;aAC9C;0BACA;QACA,kBAAkB;mBAClB;yBACA;gCACA;uBACA;2BACA;+BACA;6BACA;uBACA;QACA,WAAW;IACb;IAEA,OAAO;QACL,WAAW;IACb;AACF;;","sources":["packages/@react-aria/selection/src/index.ts","packages/@react-aria/selection/src/useSelectableCollection.ts","packages/@react-aria/selection/src/utils.ts","packages/@react-aria/selection/src/useTypeSelect.ts","packages/@react-aria/selection/src/useSelectableItem.ts","packages/@react-aria/selection/src/useSelectableList.ts","packages/@react-aria/selection/src/ListKeyboardDelegate.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 {useSelectableCollection} from './useSelectableCollection';\nexport {useSelectableItem} from './useSelectableItem';\nexport {useSelectableList} from './useSelectableList';\nexport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nexport {useTypeSelect} from './useTypeSelect';\n\nexport type {AriaSelectableCollectionOptions, SelectableCollectionAria} from './useSelectableCollection';\nexport type {AriaSelectableListOptions, SelectableListAria} from './useSelectableList';\nexport type {SelectableItemOptions, SelectableItemStates, SelectableItemAria} from './useSelectableItem';\nexport type {AriaTypeSelectOptions, TypeSelectAria} from './useTypeSelect';\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 {DOMAttributes, FocusableElement, FocusStrategy, KeyboardDelegate} from '@react-types/shared';\nimport {FocusEvent, Key, KeyboardEvent, RefObject, useEffect, useRef} from 'react';\nimport {focusSafely, getFocusableTreeWalker} from '@react-aria/focus';\nimport {focusWithoutScrolling, mergeProps, scrollIntoView, scrollIntoViewport, useEvent} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useLocale} from '@react-aria/i18n';\nimport {useTypeSelect} from './useTypeSelect';\n\nexport interface AriaSelectableCollectionOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A delegate object that implements behavior for keyboard focus movement.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * The ref attached to the element representing the collection.\n */\n ref: RefObject<HTMLElement>,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether the collection allows the user to select all items via keyboard shortcut.\n * @default false\n */\n disallowSelectAll?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean,\n /**\n * Whether the collection items are contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * The ref attached to the scrollable body. Used to provide automatic scrolling on item focus for non-virtualized collections.\n * If not provided, defaults to the collection ref.\n */\n scrollRef?: RefObject<HTMLElement>\n}\n\nexport interface SelectableCollectionAria {\n /** Props for the collection element. */\n collectionProps: DOMAttributes\n}\n\n/**\n * Handles interactions with selectable collections.\n */\nexport function useSelectableCollection(options: AriaSelectableCollectionOptions): SelectableCollectionAria {\n let {\n selectionManager: manager,\n keyboardDelegate: delegate,\n ref,\n autoFocus = false,\n shouldFocusWrap = false,\n disallowEmptySelection = false,\n disallowSelectAll = false,\n selectOnFocus = manager.selectionBehavior === 'replace',\n disallowTypeAhead = false,\n shouldUseVirtualFocus,\n allowsTabNavigation = false,\n isVirtualized,\n // If no scrollRef is provided, assume the collection ref is the scrollable region\n scrollRef = ref\n } = options;\n let {direction} = useLocale();\n\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes\n if (e.altKey && e.key === 'Tab') {\n e.preventDefault();\n }\n\n // Keyboard events bubble through portals. Don't handle keyboard events\n // for elements outside the collection (e.g. menus).\n if (!ref.current.contains(e.target as Element)) {\n return;\n }\n\n const navigateToKey = (key: Key | undefined, childFocus?: FocusStrategy) => {\n if (key != null) {\n manager.setFocusedKey(key, childFocus);\n\n if (e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(key);\n } else if (selectOnFocus && !isNonContiguousSelectionModifier(e)) {\n manager.replaceSelection(key);\n }\n }\n };\n\n switch (e.key) {\n case 'ArrowDown': {\n if (delegate.getKeyBelow) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyBelow(manager.focusedKey)\n : delegate.getFirstKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getFirstKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowUp': {\n if (delegate.getKeyAbove) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyAbove(manager.focusedKey)\n : delegate.getLastKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getLastKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowLeft': {\n if (delegate.getKeyLeftOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyLeftOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');\n }\n break;\n }\n case 'ArrowRight': {\n if (delegate.getKeyRightOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyRightOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');\n }\n break;\n }\n case 'Home':\n if (delegate.getFirstKey) {\n e.preventDefault();\n let firstKey = delegate.getFirstKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(firstKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(firstKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(firstKey);\n }\n }\n break;\n case 'End':\n if (delegate.getLastKey) {\n e.preventDefault();\n let lastKey = delegate.getLastKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(lastKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(lastKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(lastKey);\n }\n }\n break;\n case 'PageDown':\n if (delegate.getKeyPageBelow) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageBelow(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'PageUp':\n if (delegate.getKeyPageAbove) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageAbove(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'a':\n if (isCtrlKeyPressed(e) && manager.selectionMode === 'multiple' && disallowSelectAll !== true) {\n e.preventDefault();\n manager.selectAll();\n }\n break;\n case 'Escape':\n e.preventDefault();\n if (!disallowEmptySelection) {\n manager.clearSelection();\n }\n break;\n case 'Tab': {\n if (!allowsTabNavigation) {\n // There may be elements that are \"tabbable\" inside a collection (e.g. in a grid cell).\n // However, collections should be treated as a single tab stop, with arrow key navigation internally.\n // We don't control the rendering of these, so we can't override the tabIndex to prevent tabbing.\n // Instead, we handle the Tab key, and move focus manually to the first/last tabbable element\n // in the collection, so that the browser default behavior will apply starting from that element\n // rather than the currently focused one.\n if (e.shiftKey) {\n ref.current.focus();\n } else {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n let next: FocusableElement;\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n next = last;\n }\n } while (last);\n\n if (next && !next.contains(document.activeElement)) {\n focusWithoutScrolling(next);\n }\n }\n break;\n }\n }\n }\n };\n\n // Store the scroll position so we can restore it later.\n let scrollPos = useRef({top: 0, left: 0});\n useEvent(scrollRef, 'scroll', isVirtualized ? null : () => {\n scrollPos.current = {\n top: scrollRef.current.scrollTop,\n left: scrollRef.current.scrollLeft\n };\n });\n\n let onFocus = (e: FocusEvent) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n\n if (manager.focusedKey == null) {\n let navigateToFirstKey = (key: Key | undefined) => {\n if (key != null) {\n manager.setFocusedKey(key);\n if (selectOnFocus) {\n manager.replaceSelection(key);\n }\n }\n };\n // If the user hasn't yet interacted with the collection, there will be no focusedKey set.\n // Attempt to detect whether the user is tabbing forward or backward into the collection\n // and either focus the first or last item accordingly.\n let relatedTarget = e.relatedTarget as Element;\n if (relatedTarget && (e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)) {\n navigateToFirstKey(manager.lastSelectedKey ?? delegate.getLastKey());\n } else {\n navigateToFirstKey(manager.firstSelectedKey ?? delegate.getFirstKey());\n }\n } else if (!isVirtualized) {\n // Restore the scroll position to what it was before.\n scrollRef.current.scrollTop = scrollPos.current.top;\n scrollRef.current.scrollLeft = scrollPos.current.left;\n }\n\n if (!isVirtualized && manager.focusedKey != null) {\n // Refocus and scroll the focused item into view if it exists within the scrollable region.\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n // This prevents a flash of focus on the first/last element in the collection, or the collection itself.\n focusWithoutScrolling(element);\n scrollIntoView(scrollRef.current, element);\n }\n }\n };\n\n let onBlur = (e) => {\n // Don't set blurred and then focused again if moving focus within the collection.\n if (!e.currentTarget.contains(e.relatedTarget as HTMLElement)) {\n manager.setFocused(false);\n }\n };\n\n const autoFocusRef = useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n let focusedKey = null;\n\n // Check focus strategy to determine which item to focus\n if (autoFocus === 'first') {\n focusedKey = delegate.getFirstKey();\n } if (autoFocus === 'last') {\n focusedKey = delegate.getLastKey();\n }\n\n // If there are any selected keys, make the first one the new focus target\n let selectedKeys = manager.selectedKeys;\n if (selectedKeys.size) {\n focusedKey = selectedKeys.values().next().value;\n }\n\n manager.setFocused(true);\n manager.setFocusedKey(focusedKey);\n\n // If no default focus key is selected, focus the collection itself.\n if (focusedKey == null && !shouldUseVirtualFocus) {\n focusSafely(ref.current);\n }\n }\n autoFocusRef.current = false;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If not virtualized, scroll the focused element into view when the focusedKey changes.\n // When virtualized, Virtualizer handles this internally.\n useEffect(() => {\n let modality = getInteractionModality();\n if (!isVirtualized && manager.isFocused && manager.focusedKey != null && scrollRef?.current) {\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n scrollIntoView(scrollRef.current, element);\n if (modality === 'keyboard') {\n scrollIntoViewport(element, {containingElement: ref.current});\n }\n }\n }\n }, [isVirtualized, scrollRef, manager.focusedKey, manager.isFocused, ref]);\n\n let handlers = {\n onKeyDown,\n onFocus,\n onBlur,\n onMouseDown(e) {\n // Ignore events that bubbled through portals.\n if (scrollRef.current === e.target) {\n // Prevent focus going to the collection when clicking on the scrollbar.\n e.preventDefault();\n }\n }\n };\n\n let {typeSelectProps} = useTypeSelect({\n keyboardDelegate: delegate,\n selectionManager: manager\n });\n\n if (!disallowTypeAhead) {\n handlers = mergeProps(typeSelectProps, handlers);\n }\n\n // If nothing is focused within the collection, make the collection itself tabbable.\n // This will be marshalled to either the first or last item depending on where focus came from.\n // If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try\n // to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n tabIndex = manager.focusedKey == null ? 0 : -1;\n }\n\n return {\n collectionProps: {\n ...handlers,\n tabIndex\n }\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\nimport {isAppleDevice} from '@react-aria/utils';\nimport {isMac} from '@react-aria/utils';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isNonContiguousSelectionModifier(e: Event) {\n // Ctrl + Arrow Up/Arrow Down has a system wide meaning on macOS, so use Alt instead.\n // On Windows and Ubuntu, Alt + Space has a system wide meaning.\n return isAppleDevice() ? e.altKey : e.ctrlKey;\n}\n\nexport function isCtrlKeyPressed(e: Event) {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\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 {DOMAttributes, KeyboardDelegate} from '@react-types/shared';\nimport {Key, KeyboardEvent, useRef} from 'react';\nimport {MultipleSelectionManager} from '@react-stately/selection';\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface AriaTypeSelectOptions {\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * Called when an item is focused by typing.\n */\n onTypeSelect?: (key: Key) => void\n}\n\nexport interface TypeSelectAria {\n /**\n * Props to be spread on the owner of the options.\n */\n typeSelectProps: DOMAttributes\n}\n\n/**\n * Handles typeahead interactions with collections.\n */\nexport function useTypeSelect(options: AriaTypeSelectOptions): TypeSelectAria {\n let {keyboardDelegate, selectionManager, onTypeSelect} = options;\n let state = useRef({\n search: '',\n timeout: null\n }).current;\n\n let onKeyDown = (e: KeyboardEvent) => {\n let character = getStringForKey(e.key);\n if (!character || e.ctrlKey || e.metaKey) {\n return;\n }\n\n // Do not propagate the Spacebar event if it's meant to be part of the search.\n // When we time out, the search term becomes empty, hence the check on length.\n // Trimming is to account for the case of pressing the Spacebar more than once,\n // which should cycle through the selection/deselection of the focused item.\n if (character === ' ' && state.search.trim().length > 0) {\n e.preventDefault();\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n }\n\n state.search += character;\n\n // Use the delegate to find a key to focus.\n // Prioritize items after the currently focused item, falling back to searching the whole list.\n let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);\n\n // If no key found, search from the top.\n if (key == null) {\n key = keyboardDelegate.getKeyForSearch(state.search);\n }\n\n if (key != null) {\n selectionManager.setFocusedKey(key);\n if (onTypeSelect) {\n onTypeSelect(key);\n }\n }\n\n clearTimeout(state.timeout);\n state.timeout = setTimeout(() => {\n state.search = '';\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n return {\n typeSelectProps: {\n // Using a capturing listener to catch the keydown event before\n // other hooks in order to handle the Spacebar event.\n onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null\n }\n };\n}\n\nfunction getStringForKey(key: string) {\n // If the key is of length 1, it is an ASCII value.\n // Otherwise, if there are no ASCII characters in the key name,\n // it is a Unicode character.\n // See https://www.w3.org/TR/uievents-key/\n if (key.length === 1 || !/^[A-Z]/i.test(key)) {\n return key;\n }\n\n return '';\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 {DOMAttributes, FocusableElement, LongPressEvent, PressEvent} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {Key, RefObject, useEffect, useRef} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {PressProps, useLongPress, usePress} from '@react-aria/interactions';\n\nexport interface SelectableItemOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A unique key for the item.\n */\n key: Key,\n /**\n * Ref to the item.\n */\n ref: RefObject<FocusableElement>,\n /**\n * By default, selection occurs on pointer down. This can be strange if selecting an\n * item causes the UI to disappear immediately (e.g. menus).\n */\n shouldSelectOnPressUp?: boolean,\n /**\n * Whether selection requires the pointer/mouse down and up events to occur on the same target or triggers selection on\n * the target of the pointer/mouse up event.\n */\n allowsDifferentPressOrigin?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Function to focus the item.\n */\n focus?: () => void,\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nexport interface SelectableItemStates {\n /** Whether the item is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the item is currently selected. */\n isSelected: boolean,\n /** Whether the item is currently focused. */\n isFocused: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n */\n isDisabled: boolean,\n /**\n * Whether the item may be selected, dependent on `selectionMode`, `disabledKeys`, and `disabledBehavior`.\n */\n allowsSelection: boolean,\n /**\n * Whether the item has an action, dependent on `onAction`, `disabledKeys`,\n * and `disabledBehavior`. It may also change depending on the current selection state\n * of the list (e.g. when selection is primary). This can be used to enable or disable hover\n * styles or other visual indications of interactivity.\n */\n hasAction: boolean\n}\n\nexport interface SelectableItemAria extends SelectableItemStates {\n /**\n * Props to be spread on the item root node.\n */\n itemProps: DOMAttributes\n}\n\n/**\n * Handles interactions with an item in a selectable collection.\n */\nexport function useSelectableItem(options: SelectableItemOptions): SelectableItemAria {\n let {\n selectionManager: manager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n focus,\n isDisabled,\n onAction,\n allowsDifferentPressOrigin\n } = options;\n\n let onSelect = (e: PressEvent | LongPressEvent | PointerEvent) => {\n if (e.pointerType === 'keyboard' && isNonContiguousSelectionModifier(e)) {\n manager.toggleSelection(key);\n } else {\n if (manager.selectionMode === 'none') {\n return;\n }\n\n if (manager.selectionMode === 'single') {\n if (manager.isSelected(key) && !manager.disallowEmptySelection) {\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n } else if (e && e.shiftKey) {\n manager.extendSelection(key);\n } else if (manager.selectionBehavior === 'toggle' || (e && (isCtrlKeyPressed(e) || e.pointerType === 'touch' || e.pointerType === 'virtual'))) {\n // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n }\n };\n\n // Focus the associated DOM node when this item becomes the focusedKey\n useEffect(() => {\n let isFocused = key === manager.focusedKey;\n if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {\n if (focus) {\n focus();\n } else if (document.activeElement !== ref.current) {\n focusSafely(ref.current);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, key, manager.focusedKey, manager.childFocusStrategy, manager.isFocused, shouldUseVirtualFocus]);\n\n isDisabled = isDisabled || manager.isDisabled(key);\n // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused\n // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver\n // on iOS 14 doesn't try to move real DOM focus to the item anyway.\n let itemProps: SelectableItemAria['itemProps'] = {};\n if (!shouldUseVirtualFocus && !isDisabled) {\n itemProps = {\n tabIndex: key === manager.focusedKey ? 0 : -1,\n onFocus(e) {\n if (e.target === ref.current) {\n manager.setFocusedKey(key);\n }\n }\n };\n } else if (isDisabled) {\n itemProps.onMouseDown = (e) => {\n // Prevent focus going to the body when clicking on a disabled item.\n e.preventDefault();\n };\n }\n\n // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.\n // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.\n // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.\n // With touch, onAction occurs on single tap, and long press enters selection mode.\n let allowsSelection = !isDisabled && manager.canSelectItem(key);\n let allowsActions = onAction && !isDisabled;\n let hasPrimaryAction = allowsActions && (\n manager.selectionBehavior === 'replace'\n ? !allowsSelection\n : manager.isEmpty\n );\n let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';\n let hasAction = hasPrimaryAction || hasSecondaryAction;\n let modality = useRef(null);\n\n let longPressEnabled = hasAction && allowsSelection;\n let longPressEnabledOnPressStart = useRef(false);\n let hadPrimaryActionOnPressStart = useRef(false);\n\n // By default, selection occurs on pointer down. This can be strange if selecting an\n // item causes the UI to disappear immediately (e.g. menus).\n // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.\n // onPress requires a pointer down event on the same element as pointer up. For menus,\n // we want to be able to have the pointer down on the trigger that opens the menu and\n // the pointer up on the menu item rather than requiring a separate press.\n // For keyboard events, selection still occurs on key down.\n let itemPressProps: PressProps = {};\n if (shouldSelectOnPressUp) {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n if (e.pointerType === 'keyboard' && (!hasAction || isSelectionKey())) {\n onSelect(e);\n }\n };\n\n // If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)\n // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)\n if (!allowsDifferentPressOrigin) {\n itemPressProps.onPress = (e) => {\n if (hasPrimaryAction || (hasSecondaryAction && e.pointerType !== 'mouse')) {\n if (e.pointerType === 'keyboard' && !isActionKey()) {\n return;\n }\n\n onAction();\n } else if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n } else {\n itemPressProps.onPressUp = (e) => {\n if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;\n }\n } else {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n hadPrimaryActionOnPressStart.current = hasPrimaryAction;\n\n // Select on mouse down unless there is a primary action which will occur on mouse up.\n // For keyboard, select on key down. If there is an action, the Space key selects on key down,\n // and the Enter key performs onAction on key up.\n if (\n (e.pointerType === 'mouse' && !hasPrimaryAction) ||\n (e.pointerType === 'keyboard' && (!onAction || isSelectionKey()))\n ) {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = (e) => {\n // Selection occurs on touch up. Primary actions always occur on pointer up.\n // Both primary and secondary actions occur on Enter key up. The only exception\n // is secondary actions, which occur on double click with a mouse.\n if (\n e.pointerType === 'touch' ||\n e.pointerType === 'pen' ||\n e.pointerType === 'virtual' ||\n (e.pointerType === 'keyboard' && hasAction && isActionKey()) ||\n (e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current)\n ) {\n if (hasAction) {\n onAction();\n } else {\n onSelect(e);\n }\n }\n };\n }\n\n if (!isVirtualized) {\n itemProps['data-key'] = key;\n }\n\n itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;\n let {pressProps, isPressed} = usePress(itemPressProps);\n\n // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.\n let onDoubleClick = hasSecondaryAction ? (e) => {\n if (modality.current === 'mouse') {\n e.stopPropagation();\n e.preventDefault();\n onAction();\n }\n } : undefined;\n\n // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior\n // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to\n // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.\n let {longPressProps} = useLongPress({\n isDisabled: !longPressEnabled,\n onLongPress(e) {\n if (e.pointerType === 'touch') {\n onSelect(e);\n manager.setSelectionBehavior('toggle');\n }\n }\n });\n\n // Prevent native drag and drop on long press if we also select on long press.\n // Once the user is in selection mode, they can long press again to drag.\n // Use a capturing listener to ensure this runs before useDrag, regardless of\n // the order the props get merged.\n let onDragStartCapture = e => {\n if (modality.current === 'touch' && longPressEnabledOnPressStart.current) {\n e.preventDefault();\n }\n };\n\n return {\n itemProps: mergeProps(\n itemProps,\n allowsSelection || hasPrimaryAction ? pressProps : {},\n longPressEnabled ? longPressProps : {},\n {onDoubleClick, onDragStartCapture}\n ),\n isPressed,\n isSelected: manager.isSelected(key),\n isFocused: manager.isFocused && manager.focusedKey === key,\n isDisabled,\n allowsSelection,\n hasAction\n };\n}\n\nfunction isActionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === 'Enter';\n}\n\nfunction isSelectionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === ' ' || event?.code === 'Space';\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 {Collection, DOMAttributes, FocusStrategy, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject, useMemo} from 'react';\nimport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useCollator} from '@react-aria/i18n';\nimport {useSelectableCollection} from './useSelectableCollection';\n\nexport interface AriaSelectableListOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * State of the collection.\n */\n collection: Collection<Node<unknown>>,\n /**\n * The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\n */\n disabledKeys: Set<Key>,\n /**\n * A ref to the item.\n */\n ref?: RefObject<HTMLElement>,\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean\n}\n\nexport interface SelectableListAria {\n /**\n * Props for the option element.\n */\n listProps: DOMAttributes\n}\n\n/**\n * Handles interactions with a selectable list.\n */\nexport function useSelectableList(props: AriaSelectableListOptions): SelectableListAria {\n let {\n selectionManager,\n collection,\n disabledKeys,\n ref,\n keyboardDelegate,\n autoFocus,\n shouldFocusWrap,\n isVirtualized,\n disallowEmptySelection,\n selectOnFocus = selectionManager.selectionBehavior === 'replace',\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let disabledBehavior = selectionManager.disabledBehavior;\n let delegate = useMemo(() => (\n keyboardDelegate || new ListKeyboardDelegate(collection, disabledBehavior === 'selection' ? new Set() : disabledKeys, ref, collator)\n ), [keyboardDelegate, collection, disabledKeys, ref, collator, disabledBehavior]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager,\n keyboardDelegate: delegate,\n autoFocus,\n shouldFocusWrap,\n disallowEmptySelection,\n selectOnFocus,\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation,\n isVirtualized,\n scrollRef: ref\n });\n\n return {\n listProps: collectionProps\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\nimport {Collection, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject} from 'react';\n\nexport class ListKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private disabledKeys: Set<Key>;\n private ref: RefObject<HTMLElement>;\n private collator: Intl.Collator;\n\n constructor(collection: Collection<Node<T>>, disabledKeys: Set<Key>, ref: RefObject<HTMLElement>, collator?: Intl.Collator) {\n this.collection = collection;\n this.disabledKeys = disabledKeys;\n this.ref = ref;\n this.collator = collator;\n }\n\n getKeyBelow(key: Key) {\n key = this.collection.getKeyAfter(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getKeyAbove(key: Key) {\n key = this.collection.getKeyBefore(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n private getItem(key: Key): HTMLElement {\n return this.ref.current.querySelector(`[data-key=\"${key}\"]`);\n }\n\n getKeyPageAbove(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);\n\n while (item && item.offsetTop > pageY) {\n key = this.getKeyAbove(key);\n item = key == null ? null : this.getItem(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);\n\n while (item && item.offsetTop < pageY) {\n key = this.getKeyBelow(key);\n item = key == null ? null : this.getItem(key);\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let key = fromKey || this.getFirstKey();\n while (key != null) {\n let item = collection.getItem(key);\n let substring = item.textValue.slice(0, search.length);\n if (item.textValue && this.collator.compare(substring, search) === 0) {\n return key;\n }\n\n key = this.getKeyBelow(key);\n }\n\n return null;\n }\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -271,10 +271,12 @@ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
271
271
  // Restore the scroll position to what it was before.
272
272
  scrollRef.current.scrollTop = scrollPos.current.top;
273
273
  scrollRef.current.scrollLeft = scrollPos.current.left;
274
+ }
275
+ if (!isVirtualized && manager.focusedKey != null) {
274
276
  // Refocus and scroll the focused item into view if it exists within the scrollable region.
275
277
  let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
276
278
  if (element) {
277
- // This prevents a flash of focus on the first/last element in the collection
279
+ // This prevents a flash of focus on the first/last element in the collection, or the collection itself.
278
280
  (0, $eCAIO$focusWithoutScrolling)(element);
279
281
  (0, $eCAIO$scrollIntoView)(scrollRef.current, element);
280
282
  }
@@ -385,9 +387,9 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
385
387
  // Focus the associated DOM node when this item becomes the focusedKey
386
388
  (0, $eCAIO$useEffect)(()=>{
387
389
  let isFocused = key === manager.focusedKey;
388
- if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
390
+ if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
389
391
  if (focus) focus();
390
- else (0, $eCAIO$focusSafely)(ref.current);
392
+ else if (document.activeElement !== ref.current) (0, $eCAIO$focusSafely)(ref.current);
391
393
  }
392
394
  // eslint-disable-next-line react-hooks/exhaustive-deps
393
395
  }, [
@@ -511,6 +513,7 @@ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
511
513
  }),
512
514
  isPressed: isPressed,
513
515
  isSelected: manager.isSelected(key),
516
+ isFocused: manager.isFocused && manager.focusedKey === key,
514
517
  isDisabled: isDisabled,
515
518
  allowsSelection: allowsSelection,
516
519
  hasAction: hasAction
@@ -555,6 +558,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
555
558
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
556
559
  key = this.collection.getKeyAfter(key);
557
560
  }
561
+ return null;
558
562
  }
559
563
  getKeyAbove(key) {
560
564
  key = this.collection.getKeyBefore(key);
@@ -563,6 +567,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
563
567
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
564
568
  key = this.collection.getKeyBefore(key);
565
569
  }
570
+ return null;
566
571
  }
567
572
  getFirstKey() {
568
573
  let key = this.collection.getFirstKey();
@@ -571,6 +576,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
571
576
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
572
577
  key = this.collection.getKeyAfter(key);
573
578
  }
579
+ return null;
574
580
  }
575
581
  getLastKey() {
576
582
  let key = this.collection.getLastKey();
@@ -579,6 +585,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
579
585
  if (item.type === "item" && !this.disabledKeys.has(key)) return key;
580
586
  key = this.collection.getKeyBefore(key);
581
587
  }
588
+ return null;
582
589
  }
583
590
  getItem(key) {
584
591
  return this.ref.current.querySelector(`[data-key="${key}"]`);
@@ -590,7 +597,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
590
597
  let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);
591
598
  while(item && item.offsetTop > pageY){
592
599
  key = this.getKeyAbove(key);
593
- item = this.getItem(key);
600
+ item = key == null ? null : this.getItem(key);
594
601
  }
595
602
  return key;
596
603
  }
@@ -601,7 +608,7 @@ function $880e95eb8b93ba9a$var$isSelectionKey() {
601
608
  let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);
602
609
  while(item && item.offsetTop < pageY){
603
610
  key = this.getKeyBelow(key);
604
- item = this.getItem(key);
611
+ item = key == null ? null : this.getItem(key);
605
612
  }
606
613
  return key;
607
614
  }
@@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;aAC9C;0BACA;QACA,kBAAkB;mBAClB;yBACA;gCACA;uBACA;2BACA;+BACA;6BACA;uBACA;QACA,WAAW;IACb;IAEA,OAAO;QACL,WAAW;IACb;AACF;;","sources":["packages/@react-aria/selection/src/index.ts","packages/@react-aria/selection/src/useSelectableCollection.ts","packages/@react-aria/selection/src/utils.ts","packages/@react-aria/selection/src/useTypeSelect.ts","packages/@react-aria/selection/src/useSelectableItem.ts","packages/@react-aria/selection/src/useSelectableList.ts","packages/@react-aria/selection/src/ListKeyboardDelegate.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 {useSelectableCollection} from './useSelectableCollection';\nexport {useSelectableItem} from './useSelectableItem';\nexport {useSelectableList} from './useSelectableList';\nexport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nexport {useTypeSelect} from './useTypeSelect';\n\nexport type {AriaSelectableCollectionOptions, SelectableCollectionAria} from './useSelectableCollection';\nexport type {AriaSelectableListOptions, SelectableListAria} from './useSelectableList';\nexport type {SelectableItemOptions, SelectableItemStates, SelectableItemAria} from './useSelectableItem';\nexport type {AriaTypeSelectOptions, TypeSelectAria} from './useTypeSelect';\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 {DOMAttributes, FocusableElement, FocusStrategy, KeyboardDelegate} from '@react-types/shared';\nimport {FocusEvent, Key, KeyboardEvent, RefObject, useEffect, useRef} from 'react';\nimport {focusSafely, getFocusableTreeWalker} from '@react-aria/focus';\nimport {focusWithoutScrolling, mergeProps, scrollIntoView, scrollIntoViewport, useEvent} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useLocale} from '@react-aria/i18n';\nimport {useTypeSelect} from './useTypeSelect';\n\nexport interface AriaSelectableCollectionOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A delegate object that implements behavior for keyboard focus movement.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * The ref attached to the element representing the collection.\n */\n ref: RefObject<HTMLElement>,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether the collection allows the user to select all items via keyboard shortcut.\n * @default false\n */\n disallowSelectAll?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean,\n /**\n * Whether the collection items are contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * The ref attached to the scrollable body. Used to provide automatic scrolling on item focus for non-virtualized collections.\n * If not provided, defaults to the collection ref.\n */\n scrollRef?: RefObject<HTMLElement>\n}\n\nexport interface SelectableCollectionAria {\n /** Props for the collection element. */\n collectionProps: DOMAttributes\n}\n\n/**\n * Handles interactions with selectable collections.\n */\nexport function useSelectableCollection(options: AriaSelectableCollectionOptions): SelectableCollectionAria {\n let {\n selectionManager: manager,\n keyboardDelegate: delegate,\n ref,\n autoFocus = false,\n shouldFocusWrap = false,\n disallowEmptySelection = false,\n disallowSelectAll = false,\n selectOnFocus = manager.selectionBehavior === 'replace',\n disallowTypeAhead = false,\n shouldUseVirtualFocus,\n allowsTabNavigation = false,\n isVirtualized,\n // If no scrollRef is provided, assume the collection ref is the scrollable region\n scrollRef = ref\n } = options;\n let {direction} = useLocale();\n\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes\n if (e.altKey && e.key === 'Tab') {\n e.preventDefault();\n }\n\n // Keyboard events bubble through portals. Don't handle keyboard events\n // for elements outside the collection (e.g. menus).\n if (!ref.current.contains(e.target as Element)) {\n return;\n }\n\n const navigateToKey = (key: Key | undefined, childFocus?: FocusStrategy) => {\n if (key != null) {\n manager.setFocusedKey(key, childFocus);\n\n if (e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(key);\n } else if (selectOnFocus && !isNonContiguousSelectionModifier(e)) {\n manager.replaceSelection(key);\n }\n }\n };\n\n switch (e.key) {\n case 'ArrowDown': {\n if (delegate.getKeyBelow) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyBelow(manager.focusedKey)\n : delegate.getFirstKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getFirstKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowUp': {\n if (delegate.getKeyAbove) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyAbove(manager.focusedKey)\n : delegate.getLastKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getLastKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowLeft': {\n if (delegate.getKeyLeftOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyLeftOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');\n }\n break;\n }\n case 'ArrowRight': {\n if (delegate.getKeyRightOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyRightOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');\n }\n break;\n }\n case 'Home':\n if (delegate.getFirstKey) {\n e.preventDefault();\n let firstKey = delegate.getFirstKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(firstKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(firstKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(firstKey);\n }\n }\n break;\n case 'End':\n if (delegate.getLastKey) {\n e.preventDefault();\n let lastKey = delegate.getLastKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(lastKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(lastKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(lastKey);\n }\n }\n break;\n case 'PageDown':\n if (delegate.getKeyPageBelow) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageBelow(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'PageUp':\n if (delegate.getKeyPageAbove) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageAbove(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'a':\n if (isCtrlKeyPressed(e) && manager.selectionMode === 'multiple' && disallowSelectAll !== true) {\n e.preventDefault();\n manager.selectAll();\n }\n break;\n case 'Escape':\n e.preventDefault();\n if (!disallowEmptySelection) {\n manager.clearSelection();\n }\n break;\n case 'Tab': {\n if (!allowsTabNavigation) {\n // There may be elements that are \"tabbable\" inside a collection (e.g. in a grid cell).\n // However, collections should be treated as a single tab stop, with arrow key navigation internally.\n // We don't control the rendering of these, so we can't override the tabIndex to prevent tabbing.\n // Instead, we handle the Tab key, and move focus manually to the first/last tabbable element\n // in the collection, so that the browser default behavior will apply starting from that element\n // rather than the currently focused one.\n if (e.shiftKey) {\n ref.current.focus();\n } else {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n let next: FocusableElement;\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n next = last;\n }\n } while (last);\n\n if (next && !next.contains(document.activeElement)) {\n focusWithoutScrolling(next);\n }\n }\n break;\n }\n }\n }\n };\n\n // Store the scroll position so we can restore it later.\n let scrollPos = useRef({top: 0, left: 0});\n useEvent(scrollRef, 'scroll', isVirtualized ? null : () => {\n scrollPos.current = {\n top: scrollRef.current.scrollTop,\n left: scrollRef.current.scrollLeft\n };\n });\n\n let onFocus = (e: FocusEvent) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n\n if (manager.focusedKey == null) {\n let navigateToFirstKey = (key: Key | undefined) => {\n if (key != null) {\n manager.setFocusedKey(key);\n if (selectOnFocus) {\n manager.replaceSelection(key);\n }\n }\n };\n // If the user hasn't yet interacted with the collection, there will be no focusedKey set.\n // Attempt to detect whether the user is tabbing forward or backward into the collection\n // and either focus the first or last item accordingly.\n let relatedTarget = e.relatedTarget as Element;\n if (relatedTarget && (e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)) {\n navigateToFirstKey(manager.lastSelectedKey ?? delegate.getLastKey());\n } else {\n navigateToFirstKey(manager.firstSelectedKey ?? delegate.getFirstKey());\n }\n } else if (!isVirtualized) {\n // Restore the scroll position to what it was before.\n scrollRef.current.scrollTop = scrollPos.current.top;\n scrollRef.current.scrollLeft = scrollPos.current.left;\n\n // Refocus and scroll the focused item into view if it exists within the scrollable region.\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n // This prevents a flash of focus on the first/last element in the collection\n focusWithoutScrolling(element);\n scrollIntoView(scrollRef.current, element);\n }\n }\n };\n\n let onBlur = (e) => {\n // Don't set blurred and then focused again if moving focus within the collection.\n if (!e.currentTarget.contains(e.relatedTarget as HTMLElement)) {\n manager.setFocused(false);\n }\n };\n\n const autoFocusRef = useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n let focusedKey = null;\n\n // Check focus strategy to determine which item to focus\n if (autoFocus === 'first') {\n focusedKey = delegate.getFirstKey();\n } if (autoFocus === 'last') {\n focusedKey = delegate.getLastKey();\n }\n\n // If there are any selected keys, make the first one the new focus target\n let selectedKeys = manager.selectedKeys;\n if (selectedKeys.size) {\n focusedKey = selectedKeys.values().next().value;\n }\n\n manager.setFocused(true);\n manager.setFocusedKey(focusedKey);\n\n // If no default focus key is selected, focus the collection itself.\n if (focusedKey == null && !shouldUseVirtualFocus) {\n focusSafely(ref.current);\n }\n }\n autoFocusRef.current = false;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If not virtualized, scroll the focused element into view when the focusedKey changes.\n // When virtualized, Virtualizer handles this internally.\n useEffect(() => {\n let modality = getInteractionModality();\n if (!isVirtualized && manager.isFocused && manager.focusedKey != null && scrollRef?.current) {\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n scrollIntoView(scrollRef.current, element);\n if (modality === 'keyboard') {\n scrollIntoViewport(element, {containingElement: ref.current});\n }\n }\n }\n }, [isVirtualized, scrollRef, manager.focusedKey, manager.isFocused, ref]);\n\n let handlers = {\n onKeyDown,\n onFocus,\n onBlur,\n onMouseDown(e) {\n // Ignore events that bubbled through portals.\n if (scrollRef.current === e.target) {\n // Prevent focus going to the collection when clicking on the scrollbar.\n e.preventDefault();\n }\n }\n };\n\n let {typeSelectProps} = useTypeSelect({\n keyboardDelegate: delegate,\n selectionManager: manager\n });\n\n if (!disallowTypeAhead) {\n handlers = mergeProps(typeSelectProps, handlers);\n }\n\n // If nothing is focused within the collection, make the collection itself tabbable.\n // This will be marshalled to either the first or last item depending on where focus came from.\n // If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try\n // to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n tabIndex = manager.focusedKey == null ? 0 : -1;\n }\n\n return {\n collectionProps: {\n ...handlers,\n tabIndex\n }\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\nimport {isAppleDevice} from '@react-aria/utils';\nimport {isMac} from '@react-aria/utils';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isNonContiguousSelectionModifier(e: Event) {\n // Ctrl + Arrow Up/Arrow Down has a system wide meaning on macOS, so use Alt instead.\n // On Windows and Ubuntu, Alt + Space has a system wide meaning.\n return isAppleDevice() ? e.altKey : e.ctrlKey;\n}\n\nexport function isCtrlKeyPressed(e: Event) {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\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 {DOMAttributes, KeyboardDelegate} from '@react-types/shared';\nimport {Key, KeyboardEvent, useRef} from 'react';\nimport {MultipleSelectionManager} from '@react-stately/selection';\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface AriaTypeSelectOptions {\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * Called when an item is focused by typing.\n */\n onTypeSelect?: (key: Key) => void\n}\n\nexport interface TypeSelectAria {\n /**\n * Props to be spread on the owner of the options.\n */\n typeSelectProps: DOMAttributes\n}\n\n/**\n * Handles typeahead interactions with collections.\n */\nexport function useTypeSelect(options: AriaTypeSelectOptions): TypeSelectAria {\n let {keyboardDelegate, selectionManager, onTypeSelect} = options;\n let state = useRef({\n search: '',\n timeout: null\n }).current;\n\n let onKeyDown = (e: KeyboardEvent) => {\n let character = getStringForKey(e.key);\n if (!character || e.ctrlKey || e.metaKey) {\n return;\n }\n\n // Do not propagate the Spacebar event if it's meant to be part of the search.\n // When we time out, the search term becomes empty, hence the check on length.\n // Trimming is to account for the case of pressing the Spacebar more than once,\n // which should cycle through the selection/deselection of the focused item.\n if (character === ' ' && state.search.trim().length > 0) {\n e.preventDefault();\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n }\n\n state.search += character;\n\n // Use the delegate to find a key to focus.\n // Prioritize items after the currently focused item, falling back to searching the whole list.\n let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);\n\n // If no key found, search from the top.\n if (key == null) {\n key = keyboardDelegate.getKeyForSearch(state.search);\n }\n\n if (key != null) {\n selectionManager.setFocusedKey(key);\n if (onTypeSelect) {\n onTypeSelect(key);\n }\n }\n\n clearTimeout(state.timeout);\n state.timeout = setTimeout(() => {\n state.search = '';\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n return {\n typeSelectProps: {\n // Using a capturing listener to catch the keydown event before\n // other hooks in order to handle the Spacebar event.\n onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null\n }\n };\n}\n\nfunction getStringForKey(key: string) {\n // If the key is of length 1, it is an ASCII value.\n // Otherwise, if there are no ASCII characters in the key name,\n // it is a Unicode character.\n // See https://www.w3.org/TR/uievents-key/\n if (key.length === 1 || !/^[A-Z]/i.test(key)) {\n return key;\n }\n\n return '';\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 {DOMAttributes, FocusableElement, LongPressEvent, PressEvent} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {Key, RefObject, useEffect, useRef} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {PressProps, useLongPress, usePress} from '@react-aria/interactions';\n\nexport interface SelectableItemOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A unique key for the item.\n */\n key: Key,\n /**\n * Ref to the item.\n */\n ref: RefObject<FocusableElement>,\n /**\n * By default, selection occurs on pointer down. This can be strange if selecting an\n * item causes the UI to disappear immediately (e.g. menus).\n */\n shouldSelectOnPressUp?: boolean,\n /**\n * Whether selection requires the pointer/mouse down and up events to occur on the same target or triggers selection on\n * the target of the pointer/mouse up event.\n */\n allowsDifferentPressOrigin?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Function to focus the item.\n */\n focus?: () => void,\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nexport interface SelectableItemStates {\n /** Whether the item is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the item is currently selected. */\n isSelected: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n */\n isDisabled: boolean,\n /**\n * Whether the item may be selected, dependent on `selectionMode`, `disabledKeys`, and `disabledBehavior`.\n */\n allowsSelection: boolean,\n /**\n * Whether the item has an action, dependent on `onAction`, `disabledKeys`,\n * and `disabledBehavior`. It may also change depending on the current selection state\n * of the list (e.g. when selection is primary). This can be used to enable or disable hover\n * styles or other visual indications of interactivity.\n */\n hasAction: boolean\n}\n\nexport interface SelectableItemAria extends SelectableItemStates {\n /**\n * Props to be spread on the item root node.\n */\n itemProps: DOMAttributes\n}\n\n/**\n * Handles interactions with an item in a selectable collection.\n */\nexport function useSelectableItem(options: SelectableItemOptions): SelectableItemAria {\n let {\n selectionManager: manager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n focus,\n isDisabled,\n onAction,\n allowsDifferentPressOrigin\n } = options;\n\n let onSelect = (e: PressEvent | LongPressEvent | PointerEvent) => {\n if (e.pointerType === 'keyboard' && isNonContiguousSelectionModifier(e)) {\n manager.toggleSelection(key);\n } else {\n if (manager.selectionMode === 'none') {\n return;\n }\n\n if (manager.selectionMode === 'single') {\n if (manager.isSelected(key) && !manager.disallowEmptySelection) {\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n } else if (e && e.shiftKey) {\n manager.extendSelection(key);\n } else if (manager.selectionBehavior === 'toggle' || (e && (isCtrlKeyPressed(e) || e.pointerType === 'touch' || e.pointerType === 'virtual'))) {\n // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n }\n };\n\n // Focus the associated DOM node when this item becomes the focusedKey\n useEffect(() => {\n let isFocused = key === manager.focusedKey;\n if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {\n if (focus) {\n focus();\n } else {\n focusSafely(ref.current);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, key, manager.focusedKey, manager.childFocusStrategy, manager.isFocused, shouldUseVirtualFocus]);\n\n isDisabled = isDisabled || manager.isDisabled(key);\n // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused\n // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver\n // on iOS 14 doesn't try to move real DOM focus to the item anyway.\n let itemProps: SelectableItemAria['itemProps'] = {};\n if (!shouldUseVirtualFocus && !isDisabled) {\n itemProps = {\n tabIndex: key === manager.focusedKey ? 0 : -1,\n onFocus(e) {\n if (e.target === ref.current) {\n manager.setFocusedKey(key);\n }\n }\n };\n } else if (isDisabled) {\n itemProps.onMouseDown = (e) => {\n // Prevent focus going to the body when clicking on a disabled item.\n e.preventDefault();\n };\n }\n\n // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.\n // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.\n // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.\n // With touch, onAction occurs on single tap, and long press enters selection mode.\n let allowsSelection = !isDisabled && manager.canSelectItem(key);\n let allowsActions = onAction && !isDisabled;\n let hasPrimaryAction = allowsActions && (\n manager.selectionBehavior === 'replace'\n ? !allowsSelection\n : manager.isEmpty\n );\n let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';\n let hasAction = hasPrimaryAction || hasSecondaryAction;\n let modality = useRef(null);\n\n let longPressEnabled = hasAction && allowsSelection;\n let longPressEnabledOnPressStart = useRef(false);\n let hadPrimaryActionOnPressStart = useRef(false);\n\n // By default, selection occurs on pointer down. This can be strange if selecting an\n // item causes the UI to disappear immediately (e.g. menus).\n // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.\n // onPress requires a pointer down event on the same element as pointer up. For menus,\n // we want to be able to have the pointer down on the trigger that opens the menu and\n // the pointer up on the menu item rather than requiring a separate press.\n // For keyboard events, selection still occurs on key down.\n let itemPressProps: PressProps = {};\n if (shouldSelectOnPressUp) {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n if (e.pointerType === 'keyboard' && (!hasAction || isSelectionKey())) {\n onSelect(e);\n }\n };\n\n // If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)\n // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)\n if (!allowsDifferentPressOrigin) {\n itemPressProps.onPress = (e) => {\n if (hasPrimaryAction || (hasSecondaryAction && e.pointerType !== 'mouse')) {\n if (e.pointerType === 'keyboard' && !isActionKey()) {\n return;\n }\n\n onAction();\n } else if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n } else {\n itemPressProps.onPressUp = (e) => {\n if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;\n }\n } else {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n hadPrimaryActionOnPressStart.current = hasPrimaryAction;\n\n // Select on mouse down unless there is a primary action which will occur on mouse up.\n // For keyboard, select on key down. If there is an action, the Space key selects on key down,\n // and the Enter key performs onAction on key up.\n if (\n (e.pointerType === 'mouse' && !hasPrimaryAction) ||\n (e.pointerType === 'keyboard' && (!onAction || isSelectionKey()))\n ) {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = (e) => {\n // Selection occurs on touch up. Primary actions always occur on pointer up.\n // Both primary and secondary actions occur on Enter key up. The only exception\n // is secondary actions, which occur on double click with a mouse.\n if (\n e.pointerType === 'touch' ||\n e.pointerType === 'pen' ||\n e.pointerType === 'virtual' ||\n (e.pointerType === 'keyboard' && hasAction && isActionKey()) ||\n (e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current)\n ) {\n if (hasAction) {\n onAction();\n } else {\n onSelect(e);\n }\n }\n };\n }\n\n if (!isVirtualized) {\n itemProps['data-key'] = key;\n }\n\n itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;\n let {pressProps, isPressed} = usePress(itemPressProps);\n\n // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.\n let onDoubleClick = hasSecondaryAction ? (e) => {\n if (modality.current === 'mouse') {\n e.stopPropagation();\n e.preventDefault();\n onAction();\n }\n } : undefined;\n\n // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior\n // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to\n // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.\n let {longPressProps} = useLongPress({\n isDisabled: !longPressEnabled,\n onLongPress(e) {\n if (e.pointerType === 'touch') {\n onSelect(e);\n manager.setSelectionBehavior('toggle');\n }\n }\n });\n\n // Prevent native drag and drop on long press if we also select on long press.\n // Once the user is in selection mode, they can long press again to drag.\n // Use a capturing listener to ensure this runs before useDrag, regardless of\n // the order the props get merged.\n let onDragStartCapture = e => {\n if (modality.current === 'touch' && longPressEnabledOnPressStart.current) {\n e.preventDefault();\n }\n };\n\n return {\n itemProps: mergeProps(\n itemProps,\n allowsSelection || hasPrimaryAction ? pressProps : {},\n longPressEnabled ? longPressProps : {},\n {onDoubleClick, onDragStartCapture}\n ),\n isPressed,\n isSelected: manager.isSelected(key),\n isDisabled,\n allowsSelection,\n hasAction\n };\n}\n\nfunction isActionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === 'Enter';\n}\n\nfunction isSelectionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === ' ' || event?.code === 'Space';\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 {Collection, DOMAttributes, FocusStrategy, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject, useMemo} from 'react';\nimport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useCollator} from '@react-aria/i18n';\nimport {useSelectableCollection} from './useSelectableCollection';\n\nexport interface AriaSelectableListOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * State of the collection.\n */\n collection: Collection<Node<unknown>>,\n /**\n * The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\n */\n disabledKeys: Set<Key>,\n /**\n * A ref to the item.\n */\n ref?: RefObject<HTMLElement>,\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean\n}\n\nexport interface SelectableListAria {\n /**\n * Props for the option element.\n */\n listProps: DOMAttributes\n}\n\n/**\n * Handles interactions with a selectable list.\n */\nexport function useSelectableList(props: AriaSelectableListOptions): SelectableListAria {\n let {\n selectionManager,\n collection,\n disabledKeys,\n ref,\n keyboardDelegate,\n autoFocus,\n shouldFocusWrap,\n isVirtualized,\n disallowEmptySelection,\n selectOnFocus = selectionManager.selectionBehavior === 'replace',\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let disabledBehavior = selectionManager.disabledBehavior;\n let delegate = useMemo(() => (\n keyboardDelegate || new ListKeyboardDelegate(collection, disabledBehavior === 'selection' ? new Set() : disabledKeys, ref, collator)\n ), [keyboardDelegate, collection, disabledKeys, ref, collator, disabledBehavior]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager,\n keyboardDelegate: delegate,\n autoFocus,\n shouldFocusWrap,\n disallowEmptySelection,\n selectOnFocus,\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation,\n isVirtualized,\n scrollRef: ref\n });\n\n return {\n listProps: collectionProps\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\nimport {Collection, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject} from 'react';\n\nexport class ListKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private disabledKeys: Set<Key>;\n private ref: RefObject<HTMLElement>;\n private collator: Intl.Collator;\n\n constructor(collection: Collection<Node<T>>, disabledKeys: Set<Key>, ref: RefObject<HTMLElement>, collator?: Intl.Collator) {\n this.collection = collection;\n this.disabledKeys = disabledKeys;\n this.ref = ref;\n this.collator = collator;\n }\n\n getKeyBelow(key: Key) {\n key = this.collection.getKeyAfter(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n }\n\n getKeyAbove(key: Key) {\n key = this.collection.getKeyBefore(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n }\n\n private getItem(key: Key): HTMLElement {\n return this.ref.current.querySelector(`[data-key=\"${key}\"]`);\n }\n\n getKeyPageAbove(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);\n\n while (item && item.offsetTop > pageY) {\n key = this.getKeyAbove(key);\n item = this.getItem(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);\n\n while (item && item.offsetTop < pageY) {\n key = this.getKeyBelow(key);\n item = this.getItem(key);\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let key = fromKey || this.getFirstKey();\n while (key != null) {\n let item = collection.getItem(key);\n let substring = item.textValue.slice(0, search.length);\n if (item.textValue && this.collator.compare(substring, search) === 0) {\n return key;\n }\n\n key = this.getKeyBelow(key);\n }\n\n return null;\n }\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;;ACZA;;;;;;;;;;CAUC,GAED;;AASO,SAAS,0CAAiC,CAAQ,EAAE;IACzD,qFAAqF;IACrF,gEAAgE;IAChE,OAAO,CAAA,GAAA,oBAAY,MAAM,EAAE,MAAM,GAAG,EAAE,OAAO;AAC/C;AAEO,SAAS,0CAAiB,CAAQ,EAAE;IACzC,IAAI,CAAA,GAAA,YAAI,KACN,OAAO,EAAE,OAAO;IAGlB,OAAO,EAAE,OAAO;AAClB;;;;ACjCA;;;;;;;;;;CAUC,GAED;AAIA;;CAEC,GACD,MAAM,mDAA6B,MAAM,WAAW;AA2B7C,SAAS,0CAAc,OAA8B,EAAkB;IAC5E,IAAI,oBAAC,iBAAgB,oBAAE,iBAAgB,gBAAE,aAAY,EAAC,GAAG;IACzD,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;QACjB,QAAQ;QACR,SAAS,IAAI;IACf,GAAG,OAAO;IAEV,IAAI,YAAY,CAAC,IAAqB;QACpC,IAAI,YAAY,sCAAgB,EAAE,GAAG;QACrC,IAAI,CAAC,aAAa,EA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AAG;QAClB,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,QAAQ,GAAG;IAClB;AAmHF;;;;;ADpDO,SAAS,0CAAkB,KAAgC,EAAsB;IACtF,IAAI,oBACF,iBAAgB,cAChB,WAAU,gBACV,aAAY,OACZ,IAAG,oBACH,iBAAgB,aAChB,UAAS,mBACT,gBAAe,iBACf,cAAa,0BACb,uBAAsB,iBACtB,gBAAgB,iBAAiB,iBAAiB,KAAK,+BACvD,kBAAiB,yBACjB,sBAAqB,uBACrB,oBAAmB,EACpB,GAAG;IAEJ,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,mBAAmB,iBAAiB,gBAAgB;IACxD,IAAI,WAAW,CAAA,GAAA,cAAM,EAAE,IACrB,oBAAoB,IAAI,CAAA,GAAA,yCAAoB,AAAD,EAAE,YAAY,qBAAqB,cAAc,IAAI,QAAQ,YAAY,EAAE,KAAK,WAC1H;QAAC;QAAkB;QAAY;QAAc;QAAK;QAAU;KAAiB;IAEhF,IAAI,mBAAC,gBAAe,EAAC,GAAG,CAAA,GAAA,yCAAuB,AAAD,EAAE;aAC9C;0BACA;QACA,kBAAkB;mBAClB;yBACA;gCACA;uBACA;2BACA;+BACA;6BACA;uBACA;QACA,WAAW;IACb;IAEA,OAAO;QACL,WAAW;IACb;AACF;;","sources":["packages/@react-aria/selection/src/index.ts","packages/@react-aria/selection/src/useSelectableCollection.ts","packages/@react-aria/selection/src/utils.ts","packages/@react-aria/selection/src/useTypeSelect.ts","packages/@react-aria/selection/src/useSelectableItem.ts","packages/@react-aria/selection/src/useSelectableList.ts","packages/@react-aria/selection/src/ListKeyboardDelegate.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 {useSelectableCollection} from './useSelectableCollection';\nexport {useSelectableItem} from './useSelectableItem';\nexport {useSelectableList} from './useSelectableList';\nexport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nexport {useTypeSelect} from './useTypeSelect';\n\nexport type {AriaSelectableCollectionOptions, SelectableCollectionAria} from './useSelectableCollection';\nexport type {AriaSelectableListOptions, SelectableListAria} from './useSelectableList';\nexport type {SelectableItemOptions, SelectableItemStates, SelectableItemAria} from './useSelectableItem';\nexport type {AriaTypeSelectOptions, TypeSelectAria} from './useTypeSelect';\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 {DOMAttributes, FocusableElement, FocusStrategy, KeyboardDelegate} from '@react-types/shared';\nimport {FocusEvent, Key, KeyboardEvent, RefObject, useEffect, useRef} from 'react';\nimport {focusSafely, getFocusableTreeWalker} from '@react-aria/focus';\nimport {focusWithoutScrolling, mergeProps, scrollIntoView, scrollIntoViewport, useEvent} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useLocale} from '@react-aria/i18n';\nimport {useTypeSelect} from './useTypeSelect';\n\nexport interface AriaSelectableCollectionOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A delegate object that implements behavior for keyboard focus movement.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * The ref attached to the element representing the collection.\n */\n ref: RefObject<HTMLElement>,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether the collection allows the user to select all items via keyboard shortcut.\n * @default false\n */\n disallowSelectAll?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean,\n /**\n * Whether the collection items are contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * The ref attached to the scrollable body. Used to provide automatic scrolling on item focus for non-virtualized collections.\n * If not provided, defaults to the collection ref.\n */\n scrollRef?: RefObject<HTMLElement>\n}\n\nexport interface SelectableCollectionAria {\n /** Props for the collection element. */\n collectionProps: DOMAttributes\n}\n\n/**\n * Handles interactions with selectable collections.\n */\nexport function useSelectableCollection(options: AriaSelectableCollectionOptions): SelectableCollectionAria {\n let {\n selectionManager: manager,\n keyboardDelegate: delegate,\n ref,\n autoFocus = false,\n shouldFocusWrap = false,\n disallowEmptySelection = false,\n disallowSelectAll = false,\n selectOnFocus = manager.selectionBehavior === 'replace',\n disallowTypeAhead = false,\n shouldUseVirtualFocus,\n allowsTabNavigation = false,\n isVirtualized,\n // If no scrollRef is provided, assume the collection ref is the scrollable region\n scrollRef = ref\n } = options;\n let {direction} = useLocale();\n\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Prevent option + tab from doing anything since it doesn't move focus to the cells, only buttons/checkboxes\n if (e.altKey && e.key === 'Tab') {\n e.preventDefault();\n }\n\n // Keyboard events bubble through portals. Don't handle keyboard events\n // for elements outside the collection (e.g. menus).\n if (!ref.current.contains(e.target as Element)) {\n return;\n }\n\n const navigateToKey = (key: Key | undefined, childFocus?: FocusStrategy) => {\n if (key != null) {\n manager.setFocusedKey(key, childFocus);\n\n if (e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(key);\n } else if (selectOnFocus && !isNonContiguousSelectionModifier(e)) {\n manager.replaceSelection(key);\n }\n }\n };\n\n switch (e.key) {\n case 'ArrowDown': {\n if (delegate.getKeyBelow) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyBelow(manager.focusedKey)\n : delegate.getFirstKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getFirstKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowUp': {\n if (delegate.getKeyAbove) {\n e.preventDefault();\n let nextKey = manager.focusedKey != null\n ? delegate.getKeyAbove(manager.focusedKey)\n : delegate.getLastKey?.();\n if (nextKey == null && shouldFocusWrap) {\n nextKey = delegate.getLastKey?.(manager.focusedKey);\n }\n navigateToKey(nextKey);\n }\n break;\n }\n case 'ArrowLeft': {\n if (delegate.getKeyLeftOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyLeftOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');\n }\n break;\n }\n case 'ArrowRight': {\n if (delegate.getKeyRightOf) {\n e.preventDefault();\n let nextKey = delegate.getKeyRightOf(manager.focusedKey);\n navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');\n }\n break;\n }\n case 'Home':\n if (delegate.getFirstKey) {\n e.preventDefault();\n let firstKey = delegate.getFirstKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(firstKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(firstKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(firstKey);\n }\n }\n break;\n case 'End':\n if (delegate.getLastKey) {\n e.preventDefault();\n let lastKey = delegate.getLastKey(manager.focusedKey, isCtrlKeyPressed(e));\n manager.setFocusedKey(lastKey);\n if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {\n manager.extendSelection(lastKey);\n } else if (selectOnFocus) {\n manager.replaceSelection(lastKey);\n }\n }\n break;\n case 'PageDown':\n if (delegate.getKeyPageBelow) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageBelow(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'PageUp':\n if (delegate.getKeyPageAbove) {\n e.preventDefault();\n let nextKey = delegate.getKeyPageAbove(manager.focusedKey);\n navigateToKey(nextKey);\n }\n break;\n case 'a':\n if (isCtrlKeyPressed(e) && manager.selectionMode === 'multiple' && disallowSelectAll !== true) {\n e.preventDefault();\n manager.selectAll();\n }\n break;\n case 'Escape':\n e.preventDefault();\n if (!disallowEmptySelection) {\n manager.clearSelection();\n }\n break;\n case 'Tab': {\n if (!allowsTabNavigation) {\n // There may be elements that are \"tabbable\" inside a collection (e.g. in a grid cell).\n // However, collections should be treated as a single tab stop, with arrow key navigation internally.\n // We don't control the rendering of these, so we can't override the tabIndex to prevent tabbing.\n // Instead, we handle the Tab key, and move focus manually to the first/last tabbable element\n // in the collection, so that the browser default behavior will apply starting from that element\n // rather than the currently focused one.\n if (e.shiftKey) {\n ref.current.focus();\n } else {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n let next: FocusableElement;\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n next = last;\n }\n } while (last);\n\n if (next && !next.contains(document.activeElement)) {\n focusWithoutScrolling(next);\n }\n }\n break;\n }\n }\n }\n };\n\n // Store the scroll position so we can restore it later.\n let scrollPos = useRef({top: 0, left: 0});\n useEvent(scrollRef, 'scroll', isVirtualized ? null : () => {\n scrollPos.current = {\n top: scrollRef.current.scrollTop,\n left: scrollRef.current.scrollLeft\n };\n });\n\n let onFocus = (e: FocusEvent) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n\n if (manager.focusedKey == null) {\n let navigateToFirstKey = (key: Key | undefined) => {\n if (key != null) {\n manager.setFocusedKey(key);\n if (selectOnFocus) {\n manager.replaceSelection(key);\n }\n }\n };\n // If the user hasn't yet interacted with the collection, there will be no focusedKey set.\n // Attempt to detect whether the user is tabbing forward or backward into the collection\n // and either focus the first or last item accordingly.\n let relatedTarget = e.relatedTarget as Element;\n if (relatedTarget && (e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)) {\n navigateToFirstKey(manager.lastSelectedKey ?? delegate.getLastKey());\n } else {\n navigateToFirstKey(manager.firstSelectedKey ?? delegate.getFirstKey());\n }\n } else if (!isVirtualized) {\n // Restore the scroll position to what it was before.\n scrollRef.current.scrollTop = scrollPos.current.top;\n scrollRef.current.scrollLeft = scrollPos.current.left;\n }\n\n if (!isVirtualized && manager.focusedKey != null) {\n // Refocus and scroll the focused item into view if it exists within the scrollable region.\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n // This prevents a flash of focus on the first/last element in the collection, or the collection itself.\n focusWithoutScrolling(element);\n scrollIntoView(scrollRef.current, element);\n }\n }\n };\n\n let onBlur = (e) => {\n // Don't set blurred and then focused again if moving focus within the collection.\n if (!e.currentTarget.contains(e.relatedTarget as HTMLElement)) {\n manager.setFocused(false);\n }\n };\n\n const autoFocusRef = useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n let focusedKey = null;\n\n // Check focus strategy to determine which item to focus\n if (autoFocus === 'first') {\n focusedKey = delegate.getFirstKey();\n } if (autoFocus === 'last') {\n focusedKey = delegate.getLastKey();\n }\n\n // If there are any selected keys, make the first one the new focus target\n let selectedKeys = manager.selectedKeys;\n if (selectedKeys.size) {\n focusedKey = selectedKeys.values().next().value;\n }\n\n manager.setFocused(true);\n manager.setFocusedKey(focusedKey);\n\n // If no default focus key is selected, focus the collection itself.\n if (focusedKey == null && !shouldUseVirtualFocus) {\n focusSafely(ref.current);\n }\n }\n autoFocusRef.current = false;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // If not virtualized, scroll the focused element into view when the focusedKey changes.\n // When virtualized, Virtualizer handles this internally.\n useEffect(() => {\n let modality = getInteractionModality();\n if (!isVirtualized && manager.isFocused && manager.focusedKey != null && scrollRef?.current) {\n let element = scrollRef.current.querySelector(`[data-key=\"${manager.focusedKey}\"]`) as HTMLElement;\n if (element) {\n scrollIntoView(scrollRef.current, element);\n if (modality === 'keyboard') {\n scrollIntoViewport(element, {containingElement: ref.current});\n }\n }\n }\n }, [isVirtualized, scrollRef, manager.focusedKey, manager.isFocused, ref]);\n\n let handlers = {\n onKeyDown,\n onFocus,\n onBlur,\n onMouseDown(e) {\n // Ignore events that bubbled through portals.\n if (scrollRef.current === e.target) {\n // Prevent focus going to the collection when clicking on the scrollbar.\n e.preventDefault();\n }\n }\n };\n\n let {typeSelectProps} = useTypeSelect({\n keyboardDelegate: delegate,\n selectionManager: manager\n });\n\n if (!disallowTypeAhead) {\n handlers = mergeProps(typeSelectProps, handlers);\n }\n\n // If nothing is focused within the collection, make the collection itself tabbable.\n // This will be marshalled to either the first or last item depending on where focus came from.\n // If using virtual focus, don't set a tabIndex at all so that VoiceOver on iOS 14 doesn't try\n // to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n tabIndex = manager.focusedKey == null ? 0 : -1;\n }\n\n return {\n collectionProps: {\n ...handlers,\n tabIndex\n }\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\nimport {isAppleDevice} from '@react-aria/utils';\nimport {isMac} from '@react-aria/utils';\n\ninterface Event {\n altKey: boolean,\n ctrlKey: boolean,\n metaKey: boolean\n}\n\nexport function isNonContiguousSelectionModifier(e: Event) {\n // Ctrl + Arrow Up/Arrow Down has a system wide meaning on macOS, so use Alt instead.\n // On Windows and Ubuntu, Alt + Space has a system wide meaning.\n return isAppleDevice() ? e.altKey : e.ctrlKey;\n}\n\nexport function isCtrlKeyPressed(e: Event) {\n if (isMac()) {\n return e.metaKey;\n }\n\n return e.ctrlKey;\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 {DOMAttributes, KeyboardDelegate} from '@react-types/shared';\nimport {Key, KeyboardEvent, useRef} from 'react';\nimport {MultipleSelectionManager} from '@react-stately/selection';\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface AriaTypeSelectOptions {\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * Called when an item is focused by typing.\n */\n onTypeSelect?: (key: Key) => void\n}\n\nexport interface TypeSelectAria {\n /**\n * Props to be spread on the owner of the options.\n */\n typeSelectProps: DOMAttributes\n}\n\n/**\n * Handles typeahead interactions with collections.\n */\nexport function useTypeSelect(options: AriaTypeSelectOptions): TypeSelectAria {\n let {keyboardDelegate, selectionManager, onTypeSelect} = options;\n let state = useRef({\n search: '',\n timeout: null\n }).current;\n\n let onKeyDown = (e: KeyboardEvent) => {\n let character = getStringForKey(e.key);\n if (!character || e.ctrlKey || e.metaKey) {\n return;\n }\n\n // Do not propagate the Spacebar event if it's meant to be part of the search.\n // When we time out, the search term becomes empty, hence the check on length.\n // Trimming is to account for the case of pressing the Spacebar more than once,\n // which should cycle through the selection/deselection of the focused item.\n if (character === ' ' && state.search.trim().length > 0) {\n e.preventDefault();\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n }\n\n state.search += character;\n\n // Use the delegate to find a key to focus.\n // Prioritize items after the currently focused item, falling back to searching the whole list.\n let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);\n\n // If no key found, search from the top.\n if (key == null) {\n key = keyboardDelegate.getKeyForSearch(state.search);\n }\n\n if (key != null) {\n selectionManager.setFocusedKey(key);\n if (onTypeSelect) {\n onTypeSelect(key);\n }\n }\n\n clearTimeout(state.timeout);\n state.timeout = setTimeout(() => {\n state.search = '';\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n return {\n typeSelectProps: {\n // Using a capturing listener to catch the keydown event before\n // other hooks in order to handle the Spacebar event.\n onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null\n }\n };\n}\n\nfunction getStringForKey(key: string) {\n // If the key is of length 1, it is an ASCII value.\n // Otherwise, if there are no ASCII characters in the key name,\n // it is a Unicode character.\n // See https://www.w3.org/TR/uievents-key/\n if (key.length === 1 || !/^[A-Z]/i.test(key)) {\n return key;\n }\n\n return '';\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 {DOMAttributes, FocusableElement, LongPressEvent, PressEvent} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {isCtrlKeyPressed, isNonContiguousSelectionModifier} from './utils';\nimport {Key, RefObject, useEffect, useRef} from 'react';\nimport {mergeProps} from '@react-aria/utils';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {PressProps, useLongPress, usePress} from '@react-aria/interactions';\n\nexport interface SelectableItemOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * A unique key for the item.\n */\n key: Key,\n /**\n * Ref to the item.\n */\n ref: RefObject<FocusableElement>,\n /**\n * By default, selection occurs on pointer down. This can be strange if selecting an\n * item causes the UI to disappear immediately (e.g. menus).\n */\n shouldSelectOnPressUp?: boolean,\n /**\n * Whether selection requires the pointer/mouse down and up events to occur on the same target or triggers selection on\n * the target of the pointer/mouse up event.\n */\n allowsDifferentPressOrigin?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Function to focus the item.\n */\n focus?: () => void,\n /**\n * Whether the option should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\nexport interface SelectableItemStates {\n /** Whether the item is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the item is currently selected. */\n isSelected: boolean,\n /** Whether the item is currently focused. */\n isFocused: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n */\n isDisabled: boolean,\n /**\n * Whether the item may be selected, dependent on `selectionMode`, `disabledKeys`, and `disabledBehavior`.\n */\n allowsSelection: boolean,\n /**\n * Whether the item has an action, dependent on `onAction`, `disabledKeys`,\n * and `disabledBehavior`. It may also change depending on the current selection state\n * of the list (e.g. when selection is primary). This can be used to enable or disable hover\n * styles or other visual indications of interactivity.\n */\n hasAction: boolean\n}\n\nexport interface SelectableItemAria extends SelectableItemStates {\n /**\n * Props to be spread on the item root node.\n */\n itemProps: DOMAttributes\n}\n\n/**\n * Handles interactions with an item in a selectable collection.\n */\nexport function useSelectableItem(options: SelectableItemOptions): SelectableItemAria {\n let {\n selectionManager: manager,\n key,\n ref,\n shouldSelectOnPressUp,\n isVirtualized,\n shouldUseVirtualFocus,\n focus,\n isDisabled,\n onAction,\n allowsDifferentPressOrigin\n } = options;\n\n let onSelect = (e: PressEvent | LongPressEvent | PointerEvent) => {\n if (e.pointerType === 'keyboard' && isNonContiguousSelectionModifier(e)) {\n manager.toggleSelection(key);\n } else {\n if (manager.selectionMode === 'none') {\n return;\n }\n\n if (manager.selectionMode === 'single') {\n if (manager.isSelected(key) && !manager.disallowEmptySelection) {\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n } else if (e && e.shiftKey) {\n manager.extendSelection(key);\n } else if (manager.selectionBehavior === 'toggle' || (e && (isCtrlKeyPressed(e) || e.pointerType === 'touch' || e.pointerType === 'virtual'))) {\n // if touch or virtual (VO) then we just want to toggle, otherwise it's impossible to multi select because they don't have modifier keys\n manager.toggleSelection(key);\n } else {\n manager.replaceSelection(key);\n }\n }\n };\n\n // Focus the associated DOM node when this item becomes the focusedKey\n useEffect(() => {\n let isFocused = key === manager.focusedKey;\n if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {\n if (focus) {\n focus();\n } else if (document.activeElement !== ref.current) {\n focusSafely(ref.current);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [ref, key, manager.focusedKey, manager.childFocusStrategy, manager.isFocused, shouldUseVirtualFocus]);\n\n isDisabled = isDisabled || manager.isDisabled(key);\n // Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused\n // item is tabbable. If using virtual focus, don't set a tabIndex at all so that VoiceOver\n // on iOS 14 doesn't try to move real DOM focus to the item anyway.\n let itemProps: SelectableItemAria['itemProps'] = {};\n if (!shouldUseVirtualFocus && !isDisabled) {\n itemProps = {\n tabIndex: key === manager.focusedKey ? 0 : -1,\n onFocus(e) {\n if (e.target === ref.current) {\n manager.setFocusedKey(key);\n }\n }\n };\n } else if (isDisabled) {\n itemProps.onMouseDown = (e) => {\n // Prevent focus going to the body when clicking on a disabled item.\n e.preventDefault();\n };\n }\n\n // With checkbox selection, onAction (i.e. navigation) becomes primary, and occurs on a single click of the row.\n // Clicking the checkbox enters selection mode, after which clicking anywhere on any row toggles selection for that row.\n // With highlight selection, onAction is secondary, and occurs on double click. Single click selects the row.\n // With touch, onAction occurs on single tap, and long press enters selection mode.\n let allowsSelection = !isDisabled && manager.canSelectItem(key);\n let allowsActions = onAction && !isDisabled;\n let hasPrimaryAction = allowsActions && (\n manager.selectionBehavior === 'replace'\n ? !allowsSelection\n : manager.isEmpty\n );\n let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === 'replace';\n let hasAction = hasPrimaryAction || hasSecondaryAction;\n let modality = useRef(null);\n\n let longPressEnabled = hasAction && allowsSelection;\n let longPressEnabledOnPressStart = useRef(false);\n let hadPrimaryActionOnPressStart = useRef(false);\n\n // By default, selection occurs on pointer down. This can be strange if selecting an\n // item causes the UI to disappear immediately (e.g. menus).\n // If shouldSelectOnPressUp is true, we use onPressUp instead of onPressStart.\n // onPress requires a pointer down event on the same element as pointer up. For menus,\n // we want to be able to have the pointer down on the trigger that opens the menu and\n // the pointer up on the menu item rather than requiring a separate press.\n // For keyboard events, selection still occurs on key down.\n let itemPressProps: PressProps = {};\n if (shouldSelectOnPressUp) {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n if (e.pointerType === 'keyboard' && (!hasAction || isSelectionKey())) {\n onSelect(e);\n }\n };\n\n // If allowsDifferentPressOrigin, make selection happen on pressUp (e.g. open menu on press down, selection on menu item happens on press up.)\n // Otherwise, have selection happen onPress (prevents listview row selection when clicking on interactable elements in the row)\n if (!allowsDifferentPressOrigin) {\n itemPressProps.onPress = (e) => {\n if (hasPrimaryAction || (hasSecondaryAction && e.pointerType !== 'mouse')) {\n if (e.pointerType === 'keyboard' && !isActionKey()) {\n return;\n }\n\n onAction();\n } else if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n } else {\n itemPressProps.onPressUp = (e) => {\n if (e.pointerType !== 'keyboard') {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;\n }\n } else {\n itemPressProps.onPressStart = (e) => {\n modality.current = e.pointerType;\n longPressEnabledOnPressStart.current = longPressEnabled;\n hadPrimaryActionOnPressStart.current = hasPrimaryAction;\n\n // Select on mouse down unless there is a primary action which will occur on mouse up.\n // For keyboard, select on key down. If there is an action, the Space key selects on key down,\n // and the Enter key performs onAction on key up.\n if (\n (e.pointerType === 'mouse' && !hasPrimaryAction) ||\n (e.pointerType === 'keyboard' && (!onAction || isSelectionKey()))\n ) {\n onSelect(e);\n }\n };\n\n itemPressProps.onPress = (e) => {\n // Selection occurs on touch up. Primary actions always occur on pointer up.\n // Both primary and secondary actions occur on Enter key up. The only exception\n // is secondary actions, which occur on double click with a mouse.\n if (\n e.pointerType === 'touch' ||\n e.pointerType === 'pen' ||\n e.pointerType === 'virtual' ||\n (e.pointerType === 'keyboard' && hasAction && isActionKey()) ||\n (e.pointerType === 'mouse' && hadPrimaryActionOnPressStart.current)\n ) {\n if (hasAction) {\n onAction();\n } else {\n onSelect(e);\n }\n }\n };\n }\n\n if (!isVirtualized) {\n itemProps['data-key'] = key;\n }\n\n itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;\n let {pressProps, isPressed} = usePress(itemPressProps);\n\n // Double clicking with a mouse with selectionBehavior = 'replace' performs an action.\n let onDoubleClick = hasSecondaryAction ? (e) => {\n if (modality.current === 'mouse') {\n e.stopPropagation();\n e.preventDefault();\n onAction();\n }\n } : undefined;\n\n // Long pressing an item with touch when selectionBehavior = 'replace' switches the selection behavior\n // to 'toggle'. This changes the single tap behavior from performing an action (i.e. navigating) to\n // selecting, and may toggle the appearance of a UI affordance like checkboxes on each item.\n let {longPressProps} = useLongPress({\n isDisabled: !longPressEnabled,\n onLongPress(e) {\n if (e.pointerType === 'touch') {\n onSelect(e);\n manager.setSelectionBehavior('toggle');\n }\n }\n });\n\n // Prevent native drag and drop on long press if we also select on long press.\n // Once the user is in selection mode, they can long press again to drag.\n // Use a capturing listener to ensure this runs before useDrag, regardless of\n // the order the props get merged.\n let onDragStartCapture = e => {\n if (modality.current === 'touch' && longPressEnabledOnPressStart.current) {\n e.preventDefault();\n }\n };\n\n return {\n itemProps: mergeProps(\n itemProps,\n allowsSelection || hasPrimaryAction ? pressProps : {},\n longPressEnabled ? longPressProps : {},\n {onDoubleClick, onDragStartCapture}\n ),\n isPressed,\n isSelected: manager.isSelected(key),\n isFocused: manager.isFocused && manager.focusedKey === key,\n isDisabled,\n allowsSelection,\n hasAction\n };\n}\n\nfunction isActionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === 'Enter';\n}\n\nfunction isSelectionKey() {\n let event = window.event as KeyboardEvent;\n return event?.key === ' ' || event?.code === 'Space';\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 {Collection, DOMAttributes, FocusStrategy, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject, useMemo} from 'react';\nimport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nimport {MultipleSelectionManager} from '@react-stately/selection';\nimport {useCollator} from '@react-aria/i18n';\nimport {useSelectableCollection} from './useSelectableCollection';\n\nexport interface AriaSelectableListOptions {\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * State of the collection.\n */\n collection: Collection<Node<unknown>>,\n /**\n * The item keys that are disabled. These items cannot be selected, focused, or otherwise interacted with.\n */\n disabledKeys: Set<Key>,\n /**\n * A ref to the item.\n */\n ref?: RefObject<HTMLElement>,\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether the collection or one of its items should be automatically focused upon render.\n * @default false\n */\n autoFocus?: boolean | FocusStrategy,\n /**\n * Whether focus should wrap around when the end/start is reached.\n * @default false\n */\n shouldFocusWrap?: boolean,\n /**\n * Whether the option is contained in a virtual scroller.\n */\n isVirtualized?: boolean,\n /**\n * Whether the collection allows empty selection.\n * @default false\n */\n disallowEmptySelection?: boolean,\n /**\n * Whether selection should occur automatically on focus.\n * @default false\n */\n selectOnFocus?: boolean,\n /**\n * Whether typeahead is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * Whether the collection items should use virtual focus instead of being focused directly.\n */\n shouldUseVirtualFocus?: boolean,\n /**\n * Whether navigation through tab key is enabled.\n */\n allowsTabNavigation?: boolean\n}\n\nexport interface SelectableListAria {\n /**\n * Props for the option element.\n */\n listProps: DOMAttributes\n}\n\n/**\n * Handles interactions with a selectable list.\n */\nexport function useSelectableList(props: AriaSelectableListOptions): SelectableListAria {\n let {\n selectionManager,\n collection,\n disabledKeys,\n ref,\n keyboardDelegate,\n autoFocus,\n shouldFocusWrap,\n isVirtualized,\n disallowEmptySelection,\n selectOnFocus = selectionManager.selectionBehavior === 'replace',\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let disabledBehavior = selectionManager.disabledBehavior;\n let delegate = useMemo(() => (\n keyboardDelegate || new ListKeyboardDelegate(collection, disabledBehavior === 'selection' ? new Set() : disabledKeys, ref, collator)\n ), [keyboardDelegate, collection, disabledKeys, ref, collator, disabledBehavior]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager,\n keyboardDelegate: delegate,\n autoFocus,\n shouldFocusWrap,\n disallowEmptySelection,\n selectOnFocus,\n disallowTypeAhead,\n shouldUseVirtualFocus,\n allowsTabNavigation,\n isVirtualized,\n scrollRef: ref\n });\n\n return {\n listProps: collectionProps\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\nimport {Collection, KeyboardDelegate, Node} from '@react-types/shared';\nimport {Key, RefObject} from 'react';\n\nexport class ListKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private disabledKeys: Set<Key>;\n private ref: RefObject<HTMLElement>;\n private collator: Intl.Collator;\n\n constructor(collection: Collection<Node<T>>, disabledKeys: Set<Key>, ref: RefObject<HTMLElement>, collator?: Intl.Collator) {\n this.collection = collection;\n this.disabledKeys = disabledKeys;\n this.ref = ref;\n this.collator = collator;\n }\n\n getKeyBelow(key: Key) {\n key = this.collection.getKeyAfter(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getKeyAbove(key: Key) {\n key = this.collection.getKeyBefore(key);\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n }\n\n return null;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n while (key != null) {\n let item = this.collection.getItem(key);\n if (item.type === 'item' && !this.disabledKeys.has(key)) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n\n return null;\n }\n\n private getItem(key: Key): HTMLElement {\n return this.ref.current.querySelector(`[data-key=\"${key}\"]`);\n }\n\n getKeyPageAbove(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);\n\n while (item && item.offsetTop > pageY) {\n key = this.getKeyAbove(key);\n item = key == null ? null : this.getItem(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(key: Key) {\n let menu = this.ref.current;\n let item = this.getItem(key);\n if (!item) {\n return null;\n }\n\n let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);\n\n while (item && item.offsetTop < pageY) {\n key = this.getKeyBelow(key);\n item = key == null ? null : this.getItem(key);\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let key = fromKey || this.getFirstKey();\n while (key != null) {\n let item = collection.getItem(key);\n let substring = item.textValue.slice(0, search.length);\n if (item.textValue && this.collator.compare(substring, search) === 0) {\n return key;\n }\n\n key = this.getKeyBelow(key);\n }\n\n return null;\n }\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -142,6 +142,8 @@ export interface SelectableItemStates {
142
142
  isPressed: boolean;
143
143
  /** Whether the item is currently selected. */
144
144
  isSelected: boolean;
145
+ /** Whether the item is currently focused. */
146
+ isFocused: boolean;
145
147
  /**
146
148
  * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may
147
149
  * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.
@@ -1 +1 @@
1
- {"mappings":";;;ACqBA;IACE;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IACnC;;OAEG;IACH,gBAAgB,EAAE,wBAAwB,CAAC;IAC3C;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;CAClC;AAED;IACE;;OAEG;IACH,eAAe,EAAE,aAAa,CAAA;CAC/B;AAED;;GAEG;AACH,8BAA8B,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAuD5E;AC/ED;IACE;;OAEG;IACH,gBAAgB,EAAE,wBAAwB,CAAC;IAC3C;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IACnC;;OAEG;IACH,GAAG,EAAE,UAAU,WAAW,CAAC,CAAC;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IACpC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAA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A;CAC9B;AAED;IACE;;OAEG;IACH,SAAS,EAAE,aAAa,CAAA;CACzB;AAED;;GAEG;AACH,kCAAkC,KAAK,EAAE,yBAAyB,GAAG,kBAAkB,CA2CtF","sources":["packages/@react-aria/selection/src/packages/@react-aria/selection/src/utils.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useTypeSelect.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useSelectableCollection.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useSelectableItem.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/ListKeyboardDelegate.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useSelectableList.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/index.ts","packages/@react-aria/selection/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 {useSelectableCollection} from './useSelectableCollection';\nexport {useSelectableItem} from './useSelectableItem';\nexport {useSelectableList} from './useSelectableList';\nexport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nexport {useTypeSelect} from './useTypeSelect';\n\nexport type {AriaSelectableCollectionOptions, SelectableCollectionAria} from './useSelectableCollection';\nexport type {AriaSelectableListOptions, SelectableListAria} from './useSelectableList';\nexport type {SelectableItemOptions, SelectableItemStates, SelectableItemAria} from './useSelectableItem';\nexport type {AriaTypeSelectOptions, TypeSelectAria} from './useTypeSelect';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;ACqBA;IACE;;OAEG;IACH,gBAAgB,EAAE,gBAAgB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E,GAAG;CAmB9C;AC1HD;IACE;;OAEG;IACH,gBAAgB,EAAE,wBAAwB,CAAC;IAC3C;;OAEG;IACH,UAAU,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC;IACtC;;OAEG;IACH,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,UAAU,WAAW,CAAC,CAAC;IAC7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IACpC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED;IACE;;OAEG;IACH,SAAS,EAAE,aAAa,CAAA;CACzB;AAED;;GAEG;AACH,kCAAkC,KAAK,EAAE,yBAAyB,GAAG,kBAAkB,CA2CtF","sources":["packages/@react-aria/selection/src/packages/@react-aria/selection/src/utils.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useTypeSelect.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useSelectableCollection.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useSelectableItem.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/ListKeyboardDelegate.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/useSelectableList.ts","packages/@react-aria/selection/src/packages/@react-aria/selection/src/index.ts","packages/@react-aria/selection/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 {useSelectableCollection} from './useSelectableCollection';\nexport {useSelectableItem} from './useSelectableItem';\nexport {useSelectableList} from './useSelectableList';\nexport {ListKeyboardDelegate} from './ListKeyboardDelegate';\nexport {useTypeSelect} from './useTypeSelect';\n\nexport type {AriaSelectableCollectionOptions, SelectableCollectionAria} from './useSelectableCollection';\nexport type {AriaSelectableListOptions, SelectableListAria} from './useSelectableList';\nexport type {SelectableItemOptions, SelectableItemStates, SelectableItemAria} from './useSelectableItem';\nexport type {AriaTypeSelectOptions, TypeSelectAria} from './useTypeSelect';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/selection",
3
- "version": "3.13.1",
3
+ "version": "3.14.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,13 +22,13 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.11.0",
26
- "@react-aria/i18n": "^3.7.0",
27
- "@react-aria/interactions": "^3.14.0",
28
- "@react-aria/utils": "^3.15.0",
29
- "@react-stately/collections": "^3.6.0",
30
- "@react-stately/selection": "^3.12.0",
31
- "@react-types/shared": "^3.17.0",
25
+ "@react-aria/focus": "^3.12.0",
26
+ "@react-aria/i18n": "^3.7.1",
27
+ "@react-aria/interactions": "^3.15.0",
28
+ "@react-aria/utils": "^3.16.0",
29
+ "@react-stately/collections": "^3.7.0",
30
+ "@react-stately/selection": "^3.13.0",
31
+ "@react-types/shared": "^3.18.0",
32
32
  "@swc/helpers": "^0.4.14"
33
33
  },
34
34
  "peerDependencies": {
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "e00dfc4ca2961753b8b1037d209992adb86a0ea7"
40
+ "gitHead": "9d1ba9bd8ebcd63bf3495ade16d349bcb71795ce"
41
41
  }
@@ -36,6 +36,8 @@ export class ListKeyboardDelegate<T> implements KeyboardDelegate {
36
36
 
37
37
  key = this.collection.getKeyAfter(key);
38
38
  }
39
+
40
+ return null;
39
41
  }
40
42
 
41
43
  getKeyAbove(key: Key) {
@@ -48,6 +50,8 @@ export class ListKeyboardDelegate<T> implements KeyboardDelegate {
48
50
 
49
51
  key = this.collection.getKeyBefore(key);
50
52
  }
53
+
54
+ return null;
51
55
  }
52
56
 
53
57
  getFirstKey() {
@@ -60,6 +64,8 @@ export class ListKeyboardDelegate<T> implements KeyboardDelegate {
60
64
 
61
65
  key = this.collection.getKeyAfter(key);
62
66
  }
67
+
68
+ return null;
63
69
  }
64
70
 
65
71
  getLastKey() {
@@ -72,6 +78,8 @@ export class ListKeyboardDelegate<T> implements KeyboardDelegate {
72
78
 
73
79
  key = this.collection.getKeyBefore(key);
74
80
  }
81
+
82
+ return null;
75
83
  }
76
84
 
77
85
  private getItem(key: Key): HTMLElement {
@@ -89,7 +97,7 @@ export class ListKeyboardDelegate<T> implements KeyboardDelegate {
89
97
 
90
98
  while (item && item.offsetTop > pageY) {
91
99
  key = this.getKeyAbove(key);
92
- item = this.getItem(key);
100
+ item = key == null ? null : this.getItem(key);
93
101
  }
94
102
 
95
103
  return key;
@@ -106,7 +114,7 @@ export class ListKeyboardDelegate<T> implements KeyboardDelegate {
106
114
 
107
115
  while (item && item.offsetTop < pageY) {
108
116
  key = this.getKeyBelow(key);
109
- item = this.getItem(key);
117
+ item = key == null ? null : this.getItem(key);
110
118
  }
111
119
 
112
120
  return key;
@@ -306,11 +306,13 @@ export function useSelectableCollection(options: AriaSelectableCollectionOptions
306
306
  // Restore the scroll position to what it was before.
307
307
  scrollRef.current.scrollTop = scrollPos.current.top;
308
308
  scrollRef.current.scrollLeft = scrollPos.current.left;
309
+ }
309
310
 
311
+ if (!isVirtualized && manager.focusedKey != null) {
310
312
  // Refocus and scroll the focused item into view if it exists within the scrollable region.
311
313
  let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`) as HTMLElement;
312
314
  if (element) {
313
- // This prevents a flash of focus on the first/last element in the collection
315
+ // This prevents a flash of focus on the first/last element in the collection, or the collection itself.
314
316
  focusWithoutScrolling(element);
315
317
  scrollIntoView(scrollRef.current, element);
316
318
  }
@@ -67,6 +67,8 @@ export interface SelectableItemStates {
67
67
  isPressed: boolean,
68
68
  /** Whether the item is currently selected. */
69
69
  isSelected: boolean,
70
+ /** Whether the item is currently focused. */
71
+ isFocused: boolean,
70
72
  /**
71
73
  * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may
72
74
  * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.
@@ -137,10 +139,10 @@ export function useSelectableItem(options: SelectableItemOptions): SelectableIte
137
139
  // Focus the associated DOM node when this item becomes the focusedKey
138
140
  useEffect(() => {
139
141
  let isFocused = key === manager.focusedKey;
140
- if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
142
+ if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
141
143
  if (focus) {
142
144
  focus();
143
- } else {
145
+ } else if (document.activeElement !== ref.current) {
144
146
  focusSafely(ref.current);
145
147
  }
146
148
  }
@@ -312,6 +314,7 @@ export function useSelectableItem(options: SelectableItemOptions): SelectableIte
312
314
  ),
313
315
  isPressed,
314
316
  isSelected: manager.isSelected(key),
317
+ isFocused: manager.isFocused && manager.focusedKey === key,
315
318
  isDisabled,
316
319
  allowsSelection,
317
320
  hasAction