@react-stately/menu
Advanced tools
Comparing version 3.0.0-nightly-641446f65-240905 to 3.0.0-nightly-65e3a52a3-241120
@@ -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.0.0-nightly-641446f65-240905", | ||
"version": "3.0.0-nightly-65e3a52a3-241120", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,9 +25,9 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-stately/overlays": "^3.0.0-nightly-641446f65-240905", | ||
"@react-types/menu": "^3.0.0-nightly-641446f65-240905", | ||
"@react-types/shared": "^3.0.0-nightly-641446f65-240905", | ||
"@react-stately/overlays": "^3.0.0-nightly-65e3a52a3-241120", | ||
"@react-types/menu": "^3.0.0-nightly-65e3a52a3-241120", | ||
"@react-types/shared": "^3.0.0-nightly-65e3a52a3-241120", | ||
"@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" | ||
}, | ||
@@ -37,3 +37,3 @@ "publishConfig": { | ||
}, | ||
"stableVersion": "3.8.2" | ||
"stableVersion": "3.8.3" | ||
} |
@@ -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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
53451
0