@react-aria/combobox
Advanced tools
Comparing version
@@ -6,2 +6,3 @@ var $8d1e5da058b86bb9$exports = require("./intlStrings.main.js"); | ||
var $BGXP4$reactariautils = require("@react-aria/utils"); | ||
var $BGXP4$reactariafocus = require("@react-aria/focus"); | ||
var $BGXP4$react = require("react"); | ||
@@ -47,2 +48,3 @@ var $BGXP4$reactstatelycollections = require("@react-stately/collections"); | ||
function $242452271d1e4c0e$export$8c18d1b4f7232bbf(props, state) { | ||
@@ -210,3 +212,3 @@ let { buttonRef: buttonRef, popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, layoutDelegate: layoutDelegate, shouldFocusWrap: // completionMode = 'suggest', | ||
(0, $BGXP4$react.useEffect)(()=>{ | ||
if ((0, $BGXP4$reactariautils.isAppleDevice)() && focusedItem != null && itemKey !== lastItem.current) { | ||
if ((0, $BGXP4$reactariautils.isAppleDevice)() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) { | ||
let isSelected = state.selectionManager.isSelected(itemKey); | ||
@@ -270,2 +272,8 @@ let section = sectionKey != null ? state.collection.getItem(sectionKey) : null; | ||
]); | ||
(0, $BGXP4$reactariautils.useUpdateEffect)(()=>{ | ||
// Re-show focus ring when there is no virtually focused item. | ||
if (!focusedItem && inputRef.current && (0, $BGXP4$reactariautils.getActiveElement)((0, $BGXP4$reactariautils.getOwnerDocument)(inputRef.current)) === inputRef.current) (0, $BGXP4$reactariafocus.dispatchVirtualFocus)(inputRef.current, null); | ||
}, [ | ||
focusedItem | ||
]); | ||
return { | ||
@@ -296,3 +304,3 @@ labelProps: labelProps, | ||
listBoxProps: (0, $BGXP4$reactariautils.mergeProps)(menuProps, listBoxProps, { | ||
autoFocus: state.focusStrategy, | ||
autoFocus: state.focusStrategy || true, | ||
shouldUseVirtualFocus: true, | ||
@@ -299,0 +307,0 @@ shouldSelectOnPressUp: true, |
@@ -5,3 +5,4 @@ import $dShfP$intlStringsmodulejs from "./intlStrings.module.js"; | ||
import {listData as $dShfP$listData, getItemId as $dShfP$getItemId} from "@react-aria/listbox"; | ||
import {useRouter as $dShfP$useRouter, chain as $dShfP$chain, useLabels as $dShfP$useLabels, isAppleDevice as $dShfP$isAppleDevice, mergeProps as $dShfP$mergeProps} from "@react-aria/utils"; | ||
import {useRouter as $dShfP$useRouter, chain as $dShfP$chain, useLabels as $dShfP$useLabels, isAppleDevice as $dShfP$isAppleDevice, useUpdateEffect as $dShfP$useUpdateEffect, getActiveElement as $dShfP$getActiveElement, getOwnerDocument as $dShfP$getOwnerDocument, mergeProps as $dShfP$mergeProps} from "@react-aria/utils"; | ||
import {dispatchVirtualFocus as $dShfP$dispatchVirtualFocus} from "@react-aria/focus"; | ||
import {useRef as $dShfP$useRef, useMemo as $dShfP$useMemo, useEffect as $dShfP$useEffect} from "react"; | ||
@@ -41,2 +42,3 @@ import {getChildNodes as $dShfP$getChildNodes, getItemCount as $dShfP$getItemCount} from "@react-stately/collections"; | ||
function $c350ade66beef0af$export$8c18d1b4f7232bbf(props, state) { | ||
@@ -204,3 +206,3 @@ let { buttonRef: buttonRef, popoverRef: popoverRef, inputRef: inputRef, listBoxRef: listBoxRef, keyboardDelegate: keyboardDelegate, layoutDelegate: layoutDelegate, shouldFocusWrap: // completionMode = 'suggest', | ||
(0, $dShfP$useEffect)(()=>{ | ||
if ((0, $dShfP$isAppleDevice)() && focusedItem != null && itemKey !== lastItem.current) { | ||
if ((0, $dShfP$isAppleDevice)() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) { | ||
let isSelected = state.selectionManager.isSelected(itemKey); | ||
@@ -264,2 +266,8 @@ let section = sectionKey != null ? state.collection.getItem(sectionKey) : null; | ||
]); | ||
(0, $dShfP$useUpdateEffect)(()=>{ | ||
// Re-show focus ring when there is no virtually focused item. | ||
if (!focusedItem && inputRef.current && (0, $dShfP$getActiveElement)((0, $dShfP$getOwnerDocument)(inputRef.current)) === inputRef.current) (0, $dShfP$dispatchVirtualFocus)(inputRef.current, null); | ||
}, [ | ||
focusedItem | ||
]); | ||
return { | ||
@@ -290,3 +298,3 @@ labelProps: labelProps, | ||
listBoxProps: (0, $dShfP$mergeProps)(menuProps, listBoxProps, { | ||
autoFocus: state.focusStrategy, | ||
autoFocus: state.focusStrategy || true, | ||
shouldUseVirtualFocus: true, | ||
@@ -293,0 +301,0 @@ shouldSelectOnPressUp: true, |
{ | ||
"name": "@react-aria/combobox", | ||
"version": "3.0.0-nightly-262cc758b-241115", | ||
"version": "3.0.0-nightly-265b4d7f1-250605", | ||
"description": "Spectrum UI components in React", | ||
@@ -9,3 +9,7 @@ "license": "Apache-2.0", | ||
"exports": { | ||
"types": "./dist/types.d.ts", | ||
"source": "./src/index.ts", | ||
"types": [ | ||
"./dist/types.d.ts", | ||
"./src/index.ts" | ||
], | ||
"import": "./dist/import.mjs", | ||
@@ -26,26 +30,26 @@ "require": "./dist/main.js" | ||
"dependencies": { | ||
"@react-aria/i18n": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/listbox": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/live-announcer": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/menu": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/overlays": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/selection": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/textfield": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/utils": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-stately/collections": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-stately/combobox": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-stately/form": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-types/button": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-types/combobox": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-types/shared": "^3.0.0-nightly-262cc758b-241115", | ||
"@react-aria/focus": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/i18n": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/listbox": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/live-announcer": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/menu": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/overlays": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/selection": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/textfield": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-aria/utils": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-stately/collections": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-stately/combobox": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-stately/form": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-types/button": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-types/combobox": "3.0.0-nightly-265b4d7f1-250605", | ||
"@react-types/shared": "3.0.0-nightly-265b4d7f1-250605", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", | ||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"stableVersion": "3.10.5" | ||
} | ||
} |
# @react-aria/combobox | ||
This package is part of [react-spectrum](https://github.com/adobe-private/react-spectrum-v3). See the repo for more details. | ||
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details. |
@@ -19,4 +19,5 @@ /* | ||
import {BaseEvent, DOMAttributes, KeyboardDelegate, LayoutDelegate, PressEvent, RefObject, RouterOptions, ValidationResult} from '@react-types/shared'; | ||
import {chain, isAppleDevice, mergeProps, useLabels, useRouter} from '@react-aria/utils'; | ||
import {chain, getActiveElement, getOwnerDocument, isAppleDevice, mergeProps, useLabels, useRouter, useUpdateEffect} from '@react-aria/utils'; | ||
import {ComboBoxState} from '@react-stately/combobox'; | ||
import {dispatchVirtualFocus} from '@react-aria/focus'; | ||
import {FocusEvent, InputHTMLAttributes, KeyboardEvent, TouchEvent, useEffect, useMemo, useRef} from 'react'; | ||
@@ -287,3 +288,3 @@ import {getChildNodes, getItemCount} from '@react-stately/collections'; | ||
useEffect(() => { | ||
if (isAppleDevice() && focusedItem != null && itemKey !== lastItem.current) { | ||
if (isAppleDevice() && focusedItem != null && itemKey != null && itemKey !== lastItem.current) { | ||
let isSelected = state.selectionManager.isSelected(itemKey); | ||
@@ -347,2 +348,9 @@ let section = sectionKey != null ? state.collection.getItem(sectionKey) : null; | ||
useUpdateEffect(() => { | ||
// Re-show focus ring when there is no virtually focused item. | ||
if (!focusedItem && inputRef.current && getActiveElement(getOwnerDocument(inputRef.current)) === inputRef.current) { | ||
dispatchVirtualFocus(inputRef.current, null); | ||
} | ||
}, [focusedItem]); | ||
return { | ||
@@ -373,3 +381,3 @@ labelProps, | ||
listBoxProps: mergeProps(menuProps, listBoxProps, { | ||
autoFocus: state.focusStrategy, | ||
autoFocus: state.focusStrategy || true, | ||
shouldUseVirtualFocus: true, | ||
@@ -376,0 +384,0 @@ shouldSelectOnPressUp: true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3735
0.81%351979
-0.12%18
5.88%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated