@szhsin/react-menu
Advanced tools
Comparing version 3.3.1-alpha.0 to 3.3.1
@@ -52,3 +52,3 @@ import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
role: "menuitem" | ||
}, mergedProps, commonProps(isDisabled), { | ||
}, commonProps(isDisabled), mergedProps, { | ||
ref: useCombinedRef(externalRef, itemRef), | ||
@@ -55,0 +55,0 @@ className: useBEM({ |
@@ -35,3 +35,2 @@ import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
}); | ||
if (skipOpen) { | ||
@@ -38,0 +37,0 @@ skipOpen.current = true; |
@@ -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", "disableFocus"], | ||
var _excluded = ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "itemRef", "externalRef"], | ||
_excluded2 = ["setHover"]; | ||
@@ -28,6 +28,5 @@ 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, disableFocus), | ||
var _useItemState = useItemState(itemRef, itemRef, isHovering, isDisabled), | ||
setHover = _useItemState.setHover, | ||
@@ -85,3 +84,2 @@ restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2); | ||
}), restProps); | ||
var menuItemProps = _extends({ | ||
@@ -88,0 +86,0 @@ role: isRadio ? 'menuitemradio' : isCheckBox ? 'menuitemcheckbox' : 'menuitem', |
@@ -116,3 +116,2 @@ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
break; | ||
case Keys.SPACE: | ||
@@ -133,3 +132,2 @@ if (e.target && e.target.className.indexOf(menuClass) !== -1) { | ||
} | ||
safeCall(endTransition); | ||
@@ -156,3 +154,2 @@ }; | ||
} | ||
var positionHelpers = getPositionHelpers(containerRef, menuRef, scrollNodes.menu, boundingBoxPadding); | ||
@@ -159,0 +156,0 @@ var _positionMenu = positionMenu({ |
@@ -102,3 +102,2 @@ import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
break; | ||
case Keys.RIGHT: | ||
@@ -202,3 +201,3 @@ if (!isOpen) handled = true; | ||
"aria-expanded": isOpen | ||
}, mergedItemProps, commonProps(isDisabled, isHovering), { | ||
}, commonProps(isDisabled, isHovering), mergedItemProps, { | ||
ref: useCombinedRef(externalItemRef, itemRef), | ||
@@ -205,0 +204,0 @@ className: useBEM({ |
@@ -5,3 +5,3 @@ import { useContext, useRef, useEffect } from 'react'; | ||
var useItemState = function useItemState(itemRef, focusRef, isHovering, isDisabled, disableFocus) { | ||
var useItemState = function useItemState(itemRef, focusRef, isHovering, isDisabled) { | ||
var _useContext = useContext(ItemSettingsContext), | ||
@@ -48,6 +48,6 @@ submenuCloseDelay = _useContext.submenuCloseDelay; | ||
useEffect(function () { | ||
if (!disableFocus && isHovering && isParentOpen) { | ||
if (isHovering && isParentOpen) { | ||
focusRef.current && focusRef.current.focus(); | ||
} | ||
}, [focusRef, isHovering, isParentOpen, disableFocus]); | ||
}, [focusRef, isHovering, isParentOpen]); | ||
return { | ||
@@ -54,0 +54,0 @@ setHover: setHover, |
@@ -13,3 +13,2 @@ import { parsePadding } from '../utils/utils.js'; | ||
var padding = parsePadding(boundingBoxPadding); | ||
var getLeftOverflow = function getLeftOverflow(x) { | ||
@@ -16,0 +15,0 @@ return x + containerRect.left - boundingRect.left - padding.left; |
@@ -8,3 +8,2 @@ import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
}; | ||
var menuPropTypes = /*#__PURE__*/_extends({ | ||
@@ -24,3 +23,2 @@ className: string | ||
}); | ||
var rootMenuPropTypes = /*#__PURE__*/_extends({}, menuPropTypes, { | ||
@@ -50,3 +48,2 @@ containerProps: object, | ||
}); | ||
var uncontrolledMenuPropTypes = { | ||
@@ -53,0 +50,0 @@ instanceRef: /*#__PURE__*/oneOfType([object, func]), |
@@ -67,3 +67,2 @@ import { unstable_batchedUpdates } from 'react-dom'; | ||
}; | ||
var getScrollAncestor = function getScrollAncestor(node) { | ||
@@ -70,0 +69,0 @@ while (node) { |
{ | ||
"name": "@szhsin/react-menu", | ||
"version": "3.3.1-alpha.0", | ||
"version": "3.3.1", | ||
"description": "React component for building accessible menu, dropdown, submenu, context menu and more.", | ||
@@ -5,0 +5,0 @@ "author": "Zheng Song", |
@@ -539,6 +539,2 @@ import React = require('react'); | ||
/** | ||
* Whether to not focus the item on hover. | ||
*/ | ||
disableFocus?: boolean; | ||
/** | ||
* Event fired when the menu item is clicked. | ||
@@ -545,0 +541,0 @@ */ |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
186882
5206