@react-stately/menu
Advanced tools
Comparing version 3.0.0-alpha.1 to 3.0.0-nightly-016590a4a-250131
@@ -1,41 +0,25 @@ | ||
var _babelRuntimeHelpersSlicedToArray = $parcel$interopDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var $f39cdb649cd48930$exports = require("./useMenuTriggerState.main.js"); | ||
var $38ab7fb105c54ad2$exports = require("./useSubmenuTriggerState.main.js"); | ||
var useControlledState = require("@react-stately/utils").useControlledState; | ||
var useState = require("react").useState; | ||
function $parcel$interopDefault(a) { | ||
return a && a.__esModule ? a.default : a; | ||
function $parcel$export(e, n, v, s) { | ||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); | ||
} | ||
function useMenuTriggerState(props) { | ||
var _useControlledState = useControlledState(props.isOpen, props.defaultOpen || false, props.onOpenChange), | ||
_useControlledState2 = _babelRuntimeHelpersSlicedToArray(_useControlledState, 2), | ||
isOpen = _useControlledState2[0], | ||
setOpen = _useControlledState2[1]; | ||
$parcel$export(module.exports, "useMenuTriggerState", () => $f39cdb649cd48930$exports.useMenuTriggerState); | ||
$parcel$export(module.exports, "useSubmenuTriggerState", () => $38ab7fb105c54ad2$exports.useSubmenuTriggerState); | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
var _useState = useState('first'), | ||
_useState2 = _babelRuntimeHelpersSlicedToArray(_useState, 2), | ||
focusStrategy = _useState2[0], | ||
setFocusStrategy = _useState2[1]; | ||
return { | ||
isOpen: isOpen, | ||
setOpen: setOpen, | ||
focusStrategy: focusStrategy, | ||
setFocusStrategy: setFocusStrategy, | ||
open: function open() { | ||
setOpen(true); | ||
}, | ||
close: function close() { | ||
setOpen(false); | ||
}, | ||
toggle: function toggle() { | ||
var focusStrategy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'first'; | ||
setFocusStrategy(focusStrategy); | ||
setOpen(!isOpen); | ||
} | ||
}; | ||
} | ||
exports.useMenuTriggerState = useMenuTriggerState; | ||
//# sourceMappingURL=main.js.map |
@@ -1,26 +0,19 @@ | ||
import { useControlledState } from "@react-stately/utils"; | ||
import { useState } from "react"; | ||
export function useMenuTriggerState(props) { | ||
let [isOpen, setOpen] = useControlledState(props.isOpen, props.defaultOpen || false, props.onOpenChange); | ||
let [focusStrategy, setFocusStrategy] = useState('first'); | ||
return { | ||
isOpen, | ||
setOpen, | ||
focusStrategy, | ||
setFocusStrategy, | ||
import {useMenuTriggerState as $a28c903ee9ad8dc5$export$79fefeb1c2091ac3} from "./useMenuTriggerState.module.js"; | ||
import {useSubmenuTriggerState as $e5614764aa47eb35$export$cfc51cf86138bf98} from "./useSubmenuTriggerState.module.js"; | ||
open() { | ||
setOpen(true); | ||
}, | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
close() { | ||
setOpen(false); | ||
}, | ||
toggle(focusStrategy = 'first') { | ||
setFocusStrategy(focusStrategy); | ||
setOpen(!isOpen); | ||
} | ||
}; | ||
} | ||
export {$a28c903ee9ad8dc5$export$79fefeb1c2091ac3 as useMenuTriggerState, $e5614764aa47eb35$export$cfc51cf86138bf98 as useSubmenuTriggerState}; | ||
//# sourceMappingURL=module.js.map |
@@ -1,13 +0,59 @@ | ||
import { FocusStrategy, MenuTriggerProps } from "@react-types/menu"; | ||
export interface MenuTriggerState { | ||
import { FocusStrategy, Key } from "@react-types/shared"; | ||
import { MenuTriggerProps } from "@react-types/menu"; | ||
import { OverlayTriggerState } from "@react-stately/overlays"; | ||
export interface MenuTriggerState extends OverlayTriggerState { | ||
/** Controls which item will be auto focused when the menu opens. */ | ||
readonly focusStrategy: FocusStrategy | null; | ||
/** Opens the menu. */ | ||
open(focusStrategy?: FocusStrategy | null): void; | ||
/** Toggles the menu. */ | ||
toggle(focusStrategy?: FocusStrategy | null): void; | ||
} | ||
export interface RootMenuTriggerState extends MenuTriggerState { | ||
/** Opens a specific submenu tied to a specific menu item at a specific level. */ | ||
openSubmenu: (triggerKey: Key, level: number) => void; | ||
/** Closes a specific submenu tied to a specific menu item at a specific level. */ | ||
closeSubmenu: (triggerKey: Key, level: number) => void; | ||
/** An array of open submenu trigger keys within the menu tree. | ||
* The index of key within array matches the submenu level in the tree. | ||
*/ | ||
expandedKeysStack: Key[]; | ||
/** Closes the menu and all submenus in the menu tree. */ | ||
close: () => void; | ||
} | ||
/** | ||
* Manages state for a menu trigger. Tracks whether the menu is currently open, | ||
* and controls which item will receive focus when it opens. Also tracks the open submenus within | ||
* the menu tree via their trigger keys. | ||
*/ | ||
export function useMenuTriggerState(props: MenuTriggerProps): RootMenuTriggerState; | ||
export interface SubmenuTriggerProps { | ||
/** Key of the trigger item. */ | ||
triggerKey: Key; | ||
} | ||
export interface SubmenuTriggerState extends OverlayTriggerState { | ||
/** Whether the submenu is currently open. */ | ||
isOpen: boolean; | ||
setOpen(value: boolean): void; | ||
focusStrategy: FocusStrategy; | ||
setFocusStrategy(value: FocusStrategy): void; | ||
open(): void; | ||
close(): void; | ||
toggle(focusStrategy?: FocusStrategy): void; | ||
/** Controls which item will be auto focused when the submenu opens. */ | ||
focusStrategy: FocusStrategy | null; | ||
/** Opens the submenu. */ | ||
open: (focusStrategy?: FocusStrategy | null) => void; | ||
/** Closes the submenu. */ | ||
close: () => void; | ||
/** Closes all menus and submenus in the menu tree. */ | ||
closeAll: () => void; | ||
/** The level of the submenu. */ | ||
submenuLevel: number; | ||
/** Toggles the submenu. */ | ||
toggle: (focusStrategy?: FocusStrategy | null) => void; | ||
/** @private */ | ||
setOpen: () => void; | ||
} | ||
export function useMenuTriggerState(props: MenuTriggerProps): MenuTriggerState; | ||
/** | ||
* Manages state for a submenu trigger. Tracks whether the submenu is currently open, the level of the submenu, and | ||
* controls which item will receive focus when it opens. | ||
*/ | ||
export function useSubmenuTriggerState(props: SubmenuTriggerProps, state: RootMenuTriggerState): SubmenuTriggerState; | ||
export type { MenuTriggerProps } from '@react-types/menu'; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@react-stately/menu", | ||
"version": "3.0.0-alpha.1", | ||
"version": "3.0.0-nightly-016590a4a-250131", | ||
"description": "Spectrum UI components in React", | ||
@@ -8,6 +8,12 @@ "license": "Apache-2.0", | ||
"module": "dist/module.js", | ||
"exports": { | ||
"types": "./dist/types.d.ts", | ||
"import": "./dist/import.mjs", | ||
"require": "./dist/main.js" | ||
}, | ||
"types": "dist/types.d.ts", | ||
"source": "src/index.ts", | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"src" | ||
], | ||
@@ -17,16 +23,16 @@ "sideEffects": false, | ||
"type": "git", | ||
"url": "https://github.com/adobe-private/react-spectrum-v3" | ||
"url": "https://github.com/adobe/react-spectrum" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.6.2", | ||
"@react-stately/utils": "^3.0.0-rc.2", | ||
"@react-types/menu": "^3.0.0-alpha.1" | ||
"@react-stately/overlays": "3.0.0-nightly-016590a4a-250131", | ||
"@react-types/menu": "3.0.0-nightly-016590a4a-250131", | ||
"@react-types/shared": "3.0.0-nightly-016590a4a-250131", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410" | ||
} | ||
} | ||
} |
# @react-stately/menu | ||
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. |
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 6 instances in 1 package
53420
22
674
5
6
60
1
+ Added@react-stately/overlays@3.0.0-nightly-016590a4a-250131
+ Added@swc/helpers@^0.5.0
+ Added@react-stately/overlays@3.0.0-nightly-016590a4a-250131(transitive)
+ Added@react-stately/utils@3.0.0-nightly-016590a4a-250131(transitive)
+ Added@react-types/menu@3.0.0-nightly-016590a4a-250131(transitive)
+ Added@react-types/overlays@3.0.0-nightly-016590a4a-250131(transitive)
+ Added@react-types/shared@3.0.0-nightly-016590a4a-250131(transitive)
+ Addedreact@19.0.0(transitive)
- Removed@babel/runtime@^7.6.2
- Removed@react-stately/utils@^3.0.0-rc.2
- Removed@babel/runtime@7.26.7(transitive)
- Removed@react-stately/utils@3.10.5(transitive)
- Removed@react-types/menu@3.9.14(transitive)
- Removed@react-types/overlays@3.8.12(transitive)
- Removed@react-types/shared@3.27.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedregenerator-runtime@0.14.1(transitive)