New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@szhsin/react-menu

Package Overview
Dependencies
Maintainers
1
Versions
84
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 2.2.0 to 2.3.0

dist/style-utils/index.cjs.js

50

dist/es/components/SubMenu.js
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';
import React, { memo, useContext, useRef, useEffect, useImperativeHandle, useMemo } from 'react';
import { createPortal } from 'react-dom';
import { bool, oneOfType, node, func, shape } from 'prop-types';
import { bool, oneOf, oneOfType, node, func, shape } from 'prop-types';
import { MenuList } from './MenuList.js';

@@ -17,3 +17,3 @@ import { withHovering } from '../utils/withHovering.js';

var _excluded = ["aria-label", "className", "disabled", "label", "index", "onMenuChange", "isHovering", "instanceRef", "captureFocus", "repositionFlag", "itemProps"],
var _excluded = ["aria-label", "className", "disabled", "label", "index", "openTrigger", "onMenuChange", "isHovering", "instanceRef", "captureFocus", "repositionFlag", "itemProps"],
_excluded2 = ["openMenu", "toggleMenu", "state"],

@@ -28,2 +28,3 @@ _excluded3 = ["isActive", "onKeyUp"],

index = _ref.index,
openTrigger = _ref.openTrigger,
onMenuChange = _ref.onMenuChange,

@@ -81,4 +82,9 @@ isHovering = _ref.isHovering,

var _openMenu2 = function openMenu() {
clearTimeout(timeoutId.current);
!isDisabled && _openMenu.apply(void 0, arguments);
};
var setHover = function setHover() {
return !isHovering && dispatch({
return !isDisabled && !isHovering && dispatch({
type: HoverIndexActionTypes.SET,

@@ -90,7 +96,4 @@ index: index

var delayOpen = function delayOpen(delay) {
dispatch({
type: HoverIndexActionTypes.SET,
index: index
});
timeoutId.current = setTimeout(_openMenu, Math.max(delay, 0));
setHover();
if (!openTrigger) timeoutId.current = setTimeout(_openMenu2, Math.max(delay, 0));
};

@@ -112,18 +115,8 @@

clearTimeout(timeoutId.current);
if (!isOpen) {
dispatch({
type: HoverIndexActionTypes.UNSET,
index: index
});
}
if (!isOpen) dispatch({
type: HoverIndexActionTypes.UNSET,
index: index
});
};
var handleClick = function handleClick() {
if (isDisabled) return;
clearTimeout(timeoutId.current);
_openMenu();
};
var handleKeyDown = function handleKeyDown(e) {

@@ -161,4 +154,3 @@ var handled = false;

case Keys.RIGHT:
_openMenu(FocusPositions.FIRST);
openTrigger !== 'none' && _openMenu2(FocusPositions.FIRST);
break;

@@ -192,3 +184,3 @@ }

_openMenu.apply(void 0, arguments);
_openMenu2.apply(void 0, arguments);
}

@@ -209,3 +201,4 @@ },

active: isActive,
disabled: isDisabled
disabled: isDisabled,
submenu: true
});

@@ -223,3 +216,5 @@ }, [isOpen, isHovering, isActive, isDisabled]);

onMouseDown: setHover,
onClick: handleClick,
onClick: function onClick() {
return openTrigger !== 'none' && _openMenu2();
},
onKeyUp: handleKeyUp

@@ -270,2 +265,3 @@ }), restItemProps);

disabled: bool,
openTrigger: /*#__PURE__*/oneOf(['none', 'clickOnly']),
label: /*#__PURE__*/oneOfType([node, func]),

@@ -272,0 +268,0 @@ itemProps: /*#__PURE__*/shape( /*#__PURE__*/_extends({}, /*#__PURE__*/stylePropTypes()))

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

viewScroll: 'initial',
transitionTimeout: 200,
transitionTimeout: 500,
submenuOpenDelay: 300,

@@ -59,0 +59,0 @@ submenuCloseDelay: 150

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

@@ -11,6 +11,14 @@ "author": "Zheng Song",

"module": "dist/es/index.js",
"types": "dist/index.d.ts",
"types": "types/index.d.ts",
"publishConfig": {
"access": "public"
},
"sideEffects": [
"*.css"
],
"files": [
"dist",
"types/*.d.ts",
"style-utils"
],
"scripts": {

@@ -29,4 +37,3 @@ "bundle": "rollup -c",

"pret": "prettier --write .",
"dtslint": "dtslint --localTs node_modules/typescript/lib types",
"types": "npm run dtslint && cp -f types/index.d.ts dist/",
"types": "dtslint --localTs node_modules/typescript/lib types",
"tsc": "cd types && tsc",

@@ -44,16 +51,16 @@ "eg": "npm start --prefix example"

"devDependencies": {
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-react": "^7.16.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^13.0.5",
"@testing-library/jest-dom": "^5.14.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^12.1.2",
"@types/react": "^17.0.27",
"@types/react": "^17.0.34",
"babel-plugin-pure-annotations": "^0.1.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"dtslint": "^4.1.6",
"dtslint": "^4.2.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^24.6.0",
"eslint-plugin-jest": "^25.2.2",
"eslint-plugin-react": "^7.26.1",

@@ -66,9 +73,6 @@ "eslint-plugin-react-hooks": "^4.2.0",

"react-dom": "^17.0.2",
"rollup": "^2.58.0",
"sass": "^1.42.1",
"typescript": "^4.4.3"
"rollup": "^2.58.3",
"sass": "^1.43.4",
"typescript": "^4.4.4"
},
"files": [
"dist"
],
"keywords": [

@@ -75,0 +79,0 @@ "react",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc