You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@szhsin/react-menu

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@szhsin/react-menu - npm Package Compare versions

Comparing version

to
3.3.1-alpha.0

7

dist/es/components/MenuItem.js

@@ -13,3 +13,3 @@ import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../_virtual/_rollupPluginBabelHelpers.js';

var _excluded = ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "itemRef", "externalRef"],
var _excluded = ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "itemRef", "externalRef", "disableFocus"],
_excluded2 = ["setHover"];

@@ -28,5 +28,6 @@ var MenuItem = /*#__PURE__*/withHovering('MenuItem', function MenuItem(_ref) {

externalRef = _ref.externalRef,
disableFocus = _ref.disableFocus,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var isDisabled = !!disabled;
var _useItemState = useItemState(itemRef, itemRef, isHovering, isDisabled),
var _useItemState = useItemState(itemRef, itemRef, isHovering, isDisabled, disableFocus),
setHover = _useItemState.setHover,

@@ -88,3 +89,3 @@ restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2);

'aria-checked': isRadio || isCheckBox ? isChecked : undefined
}, mergedProps, commonProps(isDisabled, isHovering), {
}, commonProps(isDisabled, isHovering), mergedProps, {
ref: useCombinedRef(externalRef, itemRef),

@@ -91,0 +92,0 @@ className: useBEM({

@@ -5,3 +5,3 @@ import { useContext, useRef, useEffect } from 'react';

var useItemState = function useItemState(itemRef, focusRef, isHovering, isDisabled) {
var useItemState = function useItemState(itemRef, focusRef, isHovering, isDisabled, disableFocus) {
var _useContext = useContext(ItemSettingsContext),

@@ -48,6 +48,6 @@ submenuCloseDelay = _useContext.submenuCloseDelay;

useEffect(function () {
if (isHovering && isParentOpen) {
if (!disableFocus && isHovering && isParentOpen) {
focusRef.current && focusRef.current.focus();
}
}, [focusRef, isHovering, isParentOpen]);
}, [focusRef, isHovering, isParentOpen, disableFocus]);
return {

@@ -54,0 +54,0 @@ setHover: setHover,

{
"name": "@szhsin/react-menu",
"version": "3.3.0",
"version": "3.3.1-alpha.0",
"description": "React component for building accessible menu, dropdown, submenu, context menu and more.",

@@ -50,18 +50,18 @@ "author": "Zheng Song",

"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@rollup/plugin-babel": "^6.0.2",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.2.3",
"@types/react": "^18.0.25",
"@types/jest": "^29.2.4",
"@types/react": "^18.0.26",
"babel-plugin-pure-annotations": "^0.1.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"dtslint": "^4.2.1",
"eslint": "^8.27.0",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.1.5",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-jest": "^27.1.7",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",

@@ -72,8 +72,8 @@ "eslint-plugin-react-hooks-addons": "^0.3.1",

"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"prettier": "^2.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^3.3.0",
"sass": "^1.56.1",
"typescript": "^4.9.3"
"rollup": "^3.7.4",
"sass": "^1.56.2",
"typescript": "^4.9.4"
},

@@ -80,0 +80,0 @@ "keywords": [

@@ -539,2 +539,6 @@ import React = require('react');

/**
* Whether to not focus the item on hover.
*/
disableFocus?: boolean;
/**
* Event fired when the menu item is clicked.

@@ -541,0 +545,0 @@ */

Sorry, the diff of this file is too big to display