@react-stately/menu
Advanced tools
Comparing version 3.8.3 to 3.9.0
@@ -6,3 +6,3 @@ import { FocusStrategy, Key } from "@react-types/shared"; | ||
/** Controls which item will be auto focused when the menu opens. */ | ||
readonly focusStrategy: FocusStrategy; | ||
readonly focusStrategy: FocusStrategy | null; | ||
/** Opens the menu. */ | ||
@@ -9,0 +9,0 @@ open(focusStrategy?: FocusStrategy | null): void; |
@@ -30,4 +30,4 @@ var $9cbje$react = require("react"); | ||
let [focusStrategy, setFocusStrategy] = (0, $9cbje$react.useState)(null); | ||
let open = (0, $9cbje$react.useCallback)((focusStrategy = null)=>{ | ||
setFocusStrategy(focusStrategy); | ||
let open = (0, $9cbje$react.useCallback)((focusStrategy)=>{ | ||
setFocusStrategy(focusStrategy !== null && focusStrategy !== void 0 ? focusStrategy : null); | ||
openSubmenu(triggerKey, submenuLevel); | ||
@@ -47,4 +47,4 @@ }, [ | ||
]); | ||
let toggle = (0, $9cbje$react.useCallback)((focusStrategy = null)=>{ | ||
setFocusStrategy(focusStrategy); | ||
let toggle = (0, $9cbje$react.useCallback)((focusStrategy)=>{ | ||
setFocusStrategy(focusStrategy !== null && focusStrategy !== void 0 ? focusStrategy : null); | ||
if (isOpen) close(); | ||
@@ -51,0 +51,0 @@ else open(focusStrategy); |
@@ -24,4 +24,4 @@ import {useState as $7exkJ$useState, useMemo as $7exkJ$useMemo, useCallback as $7exkJ$useCallback} from "react"; | ||
let [focusStrategy, setFocusStrategy] = (0, $7exkJ$useState)(null); | ||
let open = (0, $7exkJ$useCallback)((focusStrategy = null)=>{ | ||
setFocusStrategy(focusStrategy); | ||
let open = (0, $7exkJ$useCallback)((focusStrategy)=>{ | ||
setFocusStrategy(focusStrategy !== null && focusStrategy !== void 0 ? focusStrategy : null); | ||
openSubmenu(triggerKey, submenuLevel); | ||
@@ -41,4 +41,4 @@ }, [ | ||
]); | ||
let toggle = (0, $7exkJ$useCallback)((focusStrategy = null)=>{ | ||
setFocusStrategy(focusStrategy); | ||
let toggle = (0, $7exkJ$useCallback)((focusStrategy)=>{ | ||
setFocusStrategy(focusStrategy !== null && focusStrategy !== void 0 ? focusStrategy : null); | ||
if (isOpen) close(); | ||
@@ -45,0 +45,0 @@ else open(focusStrategy); |
{ | ||
"name": "@react-stately/menu", | ||
"version": "3.8.3", | ||
"version": "3.9.0", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,13 +25,14 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-stately/overlays": "^3.6.11", | ||
"@react-types/menu": "^3.9.12", | ||
"@react-types/shared": "^3.25.0", | ||
"@react-stately/overlays": "^3.6.12", | ||
"@react-types/menu": "^3.9.13", | ||
"@react-types/shared": "^3.26.0", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^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" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} | ||
}, | ||
"gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849" | ||
} |
@@ -20,3 +20,3 @@ /* | ||
/** Controls which item will be auto focused when the menu opens. */ | ||
readonly focusStrategy: FocusStrategy, | ||
readonly focusStrategy: FocusStrategy | null, | ||
@@ -53,3 +53,3 @@ /** Opens the menu. */ | ||
let overlayTriggerState = useOverlayTriggerState(props); | ||
let [focusStrategy, setFocusStrategy] = useState<FocusStrategy>(null); | ||
let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null); | ||
let [expandedKeysStack, setExpandedKeysStack] = useState<Key[]>([]); | ||
@@ -86,7 +86,7 @@ | ||
...overlayTriggerState, | ||
open(focusStrategy: FocusStrategy = null) { | ||
open(focusStrategy: FocusStrategy | null = null) { | ||
setFocusStrategy(focusStrategy); | ||
overlayTriggerState.open(); | ||
}, | ||
toggle(focusStrategy: FocusStrategy = null) { | ||
toggle(focusStrategy: FocusStrategy | null = null) { | ||
setFocusStrategy(focusStrategy); | ||
@@ -93,0 +93,0 @@ overlayTriggerState.toggle(); |
@@ -51,6 +51,6 @@ /* | ||
let isOpen = useMemo(() => expandedKeysStack[submenuLevel] === triggerKey, [expandedKeysStack, triggerKey, submenuLevel]); | ||
let [focusStrategy, setFocusStrategy] = useState<FocusStrategy>(null); | ||
let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null); | ||
let open = useCallback((focusStrategy: FocusStrategy = null) => { | ||
setFocusStrategy(focusStrategy); | ||
let open = useCallback((focusStrategy?: FocusStrategy | null) => { | ||
setFocusStrategy(focusStrategy ?? null); | ||
openSubmenu(triggerKey, submenuLevel); | ||
@@ -64,4 +64,4 @@ }, [openSubmenu, submenuLevel, triggerKey]); | ||
let toggle = useCallback((focusStrategy: FocusStrategy = null) => { | ||
setFocusStrategy(focusStrategy); | ||
let toggle = useCallback((focusStrategy?: FocusStrategy | null) => { | ||
setFocusStrategy(focusStrategy ?? null); | ||
if (isOpen) { | ||
@@ -68,0 +68,0 @@ close(); |
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
64719
23
Updated@react-types/menu@^3.9.13
Updated@react-types/shared@^3.26.0