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 3.2.0 to 3.2.1

5

dist/es/_virtual/_rollupPluginBabelHelpers.js

@@ -5,3 +5,2 @@ function _extends() {

var source = arguments[i];
for (var key in source) {

@@ -13,3 +12,2 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;

@@ -19,3 +17,2 @@ };

}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -26,3 +23,2 @@ if (source == null) return {};

var key, i;
for (i = 0; i < sourceKeys.length; i++) {

@@ -33,3 +29,2 @@ key = sourceKeys[i];

}
return target;

@@ -36,0 +31,0 @@ }

56

dist/es/components/ControlledMenu.js

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

var ariaLabel = _ref['aria-label'],
className = _ref.className,
containerProps = _ref.containerProps,
initialMounted = _ref.initialMounted,
unmountOnClose = _ref.unmountOnClose,
transition = _ref.transition,
transitionTimeout = _ref.transitionTimeout,
boundingBoxRef = _ref.boundingBoxRef,
boundingBoxPadding = _ref.boundingBoxPadding,
_ref$reposition = _ref.reposition,
reposition = _ref$reposition === void 0 ? 'auto' : _ref$reposition,
_ref$submenuOpenDelay = _ref.submenuOpenDelay,
submenuOpenDelay = _ref$submenuOpenDelay === void 0 ? 300 : _ref$submenuOpenDelay,
_ref$submenuCloseDela = _ref.submenuCloseDelay,
submenuCloseDelay = _ref$submenuCloseDela === void 0 ? 150 : _ref$submenuCloseDela,
skipOpen = _ref.skipOpen,
_ref$viewScroll = _ref.viewScroll,
viewScroll = _ref$viewScroll === void 0 ? 'initial' : _ref$viewScroll,
portal = _ref.portal,
theming = _ref.theming,
onItemClick = _ref.onItemClick,
onClose = _ref.onClose,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
className = _ref.className,
containerProps = _ref.containerProps,
initialMounted = _ref.initialMounted,
unmountOnClose = _ref.unmountOnClose,
transition = _ref.transition,
transitionTimeout = _ref.transitionTimeout,
boundingBoxRef = _ref.boundingBoxRef,
boundingBoxPadding = _ref.boundingBoxPadding,
_ref$reposition = _ref.reposition,
reposition = _ref$reposition === void 0 ? 'auto' : _ref$reposition,
_ref$submenuOpenDelay = _ref.submenuOpenDelay,
submenuOpenDelay = _ref$submenuOpenDelay === void 0 ? 300 : _ref$submenuOpenDelay,
_ref$submenuCloseDela = _ref.submenuCloseDelay,
submenuCloseDelay = _ref$submenuCloseDela === void 0 ? 150 : _ref$submenuCloseDela,
skipOpen = _ref.skipOpen,
_ref$viewScroll = _ref.viewScroll,
viewScroll = _ref$viewScroll === void 0 ? 'initial' : _ref$viewScroll,
portal = _ref.portal,
theming = _ref.theming,
onItemClick = _ref.onItemClick,
onClose = _ref.onClose,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var containerRef = useRef(null);
var scrollNodesRef = useRef({});
var anchorRef = restProps.anchorRef,
state = restProps.state;
state = restProps.state;
var settings = useMemo(function () {

@@ -69,7 +68,5 @@ return {

var keepOpen = event.keepOpen;
if (keepOpen === undefined) {
keepOpen = isCheckorRadio && event.key === Keys.SPACE;
}
if (!keepOpen) {

@@ -91,6 +88,4 @@ safeCall(onClose, {

}, [onItemClick, onClose]);
var onKeyDown = function onKeyDown(_ref2) {
var key = _ref2.key;
switch (key) {

@@ -105,3 +100,2 @@ case Keys.ESC:

};
var onBlur = function onBlur(e) {

@@ -121,3 +115,2 @@ if (isMenuOpen(state) && !e.currentTarget.contains(e.relatedTarget || document.activeElement)) {

};
var itemTransition = getTransition(transition, 'item');

@@ -130,3 +123,2 @@ var modifiers = useMemo(function () {

}, [theming, itemTransition]);
var menuList = /*#__PURE__*/jsx("div", _extends({}, mergeProps({

@@ -161,3 +153,2 @@ onKeyDown: onKeyDown,

}));
if (portal === true && typeof document !== 'undefined') {

@@ -168,3 +159,2 @@ return /*#__PURE__*/createPortal(menuList, document.body);

}
return menuList;

@@ -171,0 +161,0 @@ });

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

var _excluded = ["className", "disabled", "children", "isHovering", "itemRef", "externalRef"],
_excluded2 = ["setHover", "onPointerLeave"];
_excluded2 = ["setHover", "onPointerLeave"];
var FocusableItem = /*#__PURE__*/withHovering('FocusableItem', function FocusableItem(_ref) {
var className = _ref.className,
disabled = _ref.disabled,
children = _ref.children,
isHovering = _ref.isHovering,
itemRef = _ref.itemRef,
externalRef = _ref.externalRef,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
disabled = _ref.disabled,
children = _ref.children,
isHovering = _ref.isHovering,
itemRef = _ref.itemRef,
externalRef = _ref.externalRef,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var isDisabled = !!disabled;
var ref = useRef(null);
var _useItemState = useItemState(itemRef, ref, isHovering, isDisabled),
setHover = _useItemState.setHover,
_onPointerLeave = _useItemState.onPointerLeave,
restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2);
setHover = _useItemState.setHover,
_onPointerLeave = _useItemState.onPointerLeave,
restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2);
var _useContext = useContext(EventHandlersContext),
handleClose = _useContext.handleClose;
handleClose = _useContext.handleClose;
var modifiers = useMemo(function () {

@@ -37,0 +33,0 @@ return {

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

var ariaLabel = _ref['aria-label'],
menuButton = _ref.menuButton,
instanceRef = _ref.instanceRef,
onMenuChange = _ref.onMenuChange,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
menuButton = _ref.menuButton,
instanceRef = _ref.instanceRef,
onMenuChange = _ref.onMenuChange,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useMenuStateAndFocus = useMenuStateAndFocus(restProps),
stateProps = _useMenuStateAndFocus[0],
toggleMenu = _useMenuStateAndFocus[1],
openMenu = _useMenuStateAndFocus[2];
stateProps = _useMenuStateAndFocus[0],
toggleMenu = _useMenuStateAndFocus[1],
openMenu = _useMenuStateAndFocus[2];
var isOpen = isMenuOpen(stateProps.state);

@@ -34,3 +32,2 @@ var skipOpen = useRef(false);

}, [toggleMenu]);
var onClick = function onClick(e) {

@@ -40,3 +37,2 @@ if (skipOpen.current) return;

};
var onKeyDown = function onKeyDown(e) {

@@ -47,14 +43,10 @@ switch (e.key) {

break;
case Keys.DOWN:
openMenu(FocusPositions.FIRST);
break;
default:
return;
}
e.preventDefault();
};
var button = safeCall(menuButton, {

@@ -64,3 +56,2 @@ open: isOpen

if (!button || !button.type) throw new Error('Menu requires a menuButton prop.');
var buttonProps = _extends({

@@ -72,7 +63,5 @@ ref: useCombinedRef(button.ref, buttonRef)

}, button.props));
if (getName(button.type) === 'MenuButton') {
buttonProps.isOpen = isOpen;
}
var renderButton = /*#__PURE__*/cloneElement(button, buttonProps);

@@ -79,0 +68,0 @@ useMenuChange(onMenuChange, isOpen);

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

var className = _ref.className,
isOpen = _ref.isOpen,
disabled = _ref.disabled,
children = _ref.children,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
isOpen = _ref.isOpen,
disabled = _ref.disabled,
children = _ref.children,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var modifiers = useMemo(function () {

@@ -20,0 +19,0 @@ return {

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

var className = _ref.className,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
return /*#__PURE__*/jsx("li", _extends({

@@ -15,0 +14,0 @@ role: "separator"

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

var className = _ref.className,
style = _ref.style,
takeOverflow = _ref.takeOverflow,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
style = _ref.style,
takeOverflow = _ref.takeOverflow,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var ref = useRef(null);
var _useState = useState(),
overflowStyle = _useState[0],
setOverflowStyle = _useState[1];
overflowStyle = _useState[0],
setOverflowStyle = _useState[1];
var _useContext = useContext(MenuListContext),
overflow = _useContext.overflow,
overflowAmt = _useContext.overflowAmt;
overflow = _useContext.overflow,
overflowAmt = _useContext.overflowAmt;
useIsomorphicLayoutEffect(function () {
var maxHeight;
if (takeOverflow && overflowAmt >= 0) {

@@ -36,3 +31,2 @@ maxHeight = ref.current.getBoundingClientRect().height - overflowAmt;

}
setOverflowStyle(maxHeight >= 0 ? {

@@ -39,0 +33,0 @@ maxHeight: maxHeight,

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

var className = _ref.className,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
return /*#__PURE__*/jsx("li", _extends({

@@ -15,0 +14,0 @@ role: "presentation"

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

var _excluded = ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "itemRef", "externalRef"],
_excluded2 = ["setHover"];
_excluded2 = ["setHover"];
var MenuItem = /*#__PURE__*/withHovering('MenuItem', function MenuItem(_ref) {
var className = _ref.className,
value = _ref.value,
href = _ref.href,
type = _ref.type,
checked = _ref.checked,
disabled = _ref.disabled,
children = _ref.children,
onClick = _ref.onClick,
isHovering = _ref.isHovering,
itemRef = _ref.itemRef,
externalRef = _ref.externalRef,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
value = _ref.value,
href = _ref.href,
type = _ref.type,
checked = _ref.checked,
disabled = _ref.disabled,
children = _ref.children,
onClick = _ref.onClick,
isHovering = _ref.isHovering,
itemRef = _ref.itemRef,
externalRef = _ref.externalRef,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var isDisabled = !!disabled;
var _useItemState = useItemState(itemRef, itemRef, isHovering, isDisabled),
setHover = _useItemState.setHover,
restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2);
setHover = _useItemState.setHover,
restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2);
var eventHandlers = useContext(EventHandlersContext);

@@ -42,3 +39,2 @@ var radioGroup = useContext(RadioGroupContext);

var isChecked = isRadio ? radioGroup.value === value : isCheckBox ? !!checked : false;
var handleClick = function handleClick(e) {

@@ -50,3 +46,2 @@ if (isDisabled) {

}
var event = {

@@ -63,6 +58,4 @@ value: value,

};
var handleKeyDown = function handleKeyDown(e) {
if (!isHovering) return;
switch (e.key) {

@@ -76,7 +69,5 @@ case Keys.ENTER:

}
break;
}
};
var modifiers = useMemo(function () {

@@ -112,3 +103,2 @@ return {

});
if (isAnchor) {

@@ -115,0 +105,0 @@ return /*#__PURE__*/jsx("li", {

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

import { getPositionHelpers } from '../positionUtils/getPositionHelpers.js';
import { positionContextMenu } from '../positionUtils/positionContextMenu.js';
import { positionMenu } from '../positionUtils/positionMenu.js';

@@ -19,75 +18,67 @@ import { useLayoutEffect as useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect.js';

var ariaLabel = _ref.ariaLabel,
menuClassName = _ref.menuClassName,
menuStyle = _ref.menuStyle,
arrowClassName = _ref.arrowClassName,
arrowStyle = _ref.arrowStyle,
anchorPoint = _ref.anchorPoint,
anchorRef = _ref.anchorRef,
containerRef = _ref.containerRef,
externalRef = _ref.externalRef,
parentScrollingRef = _ref.parentScrollingRef,
arrow = _ref.arrow,
_ref$align = _ref.align,
align = _ref$align === void 0 ? 'start' : _ref$align,
_ref$direction = _ref.direction,
direction = _ref$direction === void 0 ? 'bottom' : _ref$direction,
_ref$position = _ref.position,
position = _ref$position === void 0 ? 'auto' : _ref$position,
_ref$overflow = _ref.overflow,
overflow = _ref$overflow === void 0 ? 'visible' : _ref$overflow,
setDownOverflow = _ref.setDownOverflow,
repositionFlag = _ref.repositionFlag,
_ref$captureFocus = _ref.captureFocus,
captureFocus = _ref$captureFocus === void 0 ? true : _ref$captureFocus,
state = _ref.state,
endTransition = _ref.endTransition,
isDisabled = _ref.isDisabled,
menuItemFocus = _ref.menuItemFocus,
_ref$offsetX = _ref.offsetX,
offsetX = _ref$offsetX === void 0 ? 0 : _ref$offsetX,
_ref$offsetY = _ref.offsetY,
offsetY = _ref$offsetY === void 0 ? 0 : _ref$offsetY,
children = _ref.children,
onClose = _ref.onClose,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
menuClassName = _ref.menuClassName,
menuStyle = _ref.menuStyle,
arrowClassName = _ref.arrowClassName,
arrowStyle = _ref.arrowStyle,
anchorPoint = _ref.anchorPoint,
anchorRef = _ref.anchorRef,
containerRef = _ref.containerRef,
externalRef = _ref.externalRef,
parentScrollingRef = _ref.parentScrollingRef,
arrow = _ref.arrow,
_ref$align = _ref.align,
align = _ref$align === void 0 ? 'start' : _ref$align,
_ref$direction = _ref.direction,
direction = _ref$direction === void 0 ? 'bottom' : _ref$direction,
_ref$position = _ref.position,
position = _ref$position === void 0 ? 'auto' : _ref$position,
_ref$overflow = _ref.overflow,
overflow = _ref$overflow === void 0 ? 'visible' : _ref$overflow,
setDownOverflow = _ref.setDownOverflow,
repositionFlag = _ref.repositionFlag,
_ref$captureFocus = _ref.captureFocus,
captureFocus = _ref$captureFocus === void 0 ? true : _ref$captureFocus,
state = _ref.state,
endTransition = _ref.endTransition,
isDisabled = _ref.isDisabled,
menuItemFocus = _ref.menuItemFocus,
_ref$offsetX = _ref.offsetX,
offsetX = _ref$offsetX === void 0 ? 0 : _ref$offsetX,
_ref$offsetY = _ref.offsetY,
offsetY = _ref$offsetY === void 0 ? 0 : _ref$offsetY,
children = _ref.children,
onClose = _ref.onClose,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useState = useState({
x: 0,
y: 0
}),
menuPosition = _useState[0],
setMenuPosition = _useState[1];
x: 0,
y: 0
}),
menuPosition = _useState[0],
setMenuPosition = _useState[1];
var _useState2 = useState({}),
arrowPosition = _useState2[0],
setArrowPosition = _useState2[1];
arrowPosition = _useState2[0],
setArrowPosition = _useState2[1];
var _useState3 = useState(),
overflowData = _useState3[0],
setOverflowData = _useState3[1];
overflowData = _useState3[0],
setOverflowData = _useState3[1];
var _useState4 = useState(direction),
expandedDirection = _useState4[0],
setExpandedDirection = _useState4[1];
expandedDirection = _useState4[0],
setExpandedDirection = _useState4[1];
var _useState5 = useState(0),
openSubmenuCount = _useState5[0],
setOpenSubmenuCount = _useState5[1];
openSubmenuCount = _useState5[0],
setOpenSubmenuCount = _useState5[1];
var _useReducer = useReducer(function (c) {
return c + 1;
}, 1),
reposSubmenu = _useReducer[0],
forceReposSubmenu = _useReducer[1];
return c + 1;
}, 1),
reposSubmenu = _useReducer[0],
forceReposSubmenu = _useReducer[1];
var _useContext = useContext(SettingsContext),
transition = _useContext.transition,
boundingBoxRef = _useContext.boundingBoxRef,
boundingBoxPadding = _useContext.boundingBoxPadding,
rootMenuRef = _useContext.rootMenuRef,
rootAnchorRef = _useContext.rootAnchorRef,
scrollNodesRef = _useContext.scrollNodesRef,
reposition = _useContext.reposition,
viewScroll = _useContext.viewScroll;
transition = _useContext.transition,
boundingBoxRef = _useContext.boundingBoxRef,
boundingBoxPadding = _useContext.boundingBoxPadding,
rootMenuRef = _useContext.rootMenuRef,
rootAnchorRef = _useContext.rootAnchorRef,
scrollNodesRef = _useContext.scrollNodesRef,
reposition = _useContext.reposition,
viewScroll = _useContext.viewScroll;
var reposFlag = useContext(MenuListContext).reposSubmenu || repositionFlag;

@@ -103,8 +94,6 @@ var menuRef = useRef(null);

var latestHandlePosition = useRef(function () {});
var _useItems = useItems(menuRef, focusRef),
hoverItem = _useItems.hoverItem,
dispatch = _useItems.dispatch,
updateItems = _useItems.updateItems;
hoverItem = _useItems.hoverItem,
dispatch = _useItems.dispatch,
updateItems = _useItems.updateItems;
var isOpen = isMenuOpen(state);

@@ -114,3 +103,2 @@ var openTransition = getTransition(transition, 'open');

var scrollNodes = scrollNodesRef.current;
var onKeyDown = function onKeyDown(e) {

@@ -121,11 +109,8 @@ switch (e.key) {

break;
case Keys.END:
dispatch(HoverActionTypes.LAST);
break;
case Keys.UP:
dispatch(HoverActionTypes.DECREASE, hoverItem);
break;
case Keys.DOWN:

@@ -139,13 +124,9 @@ dispatch(HoverActionTypes.INCREASE, hoverItem);

}
return;
default:
return;
}
e.preventDefault();
e.stopPropagation();
};
var onAnimationEnd = function onAnimationEnd() {

@@ -158,3 +139,2 @@ if (state === 'closing') {

};
var handlePosition = useCallback(function (noOverflowCheck) {

@@ -165,6 +145,18 @@ if (!containerRef.current) {

}
return;
}
var anchorRect = anchorRef ? anchorRef.current.getBoundingClientRect() : anchorPoint ? {
left: anchorPoint.x,
right: anchorPoint.x,
top: anchorPoint.y,
bottom: anchorPoint.y,
width: 0,
height: 0
} : null;
if (!anchorRect) {
if (process.env.NODE_ENV !== 'production') {
console.warn('[React-Menu] Menu might not be positioned properly as one of the anchorRef and anchorPoint prop should be provided.');
}
return;
}
if (!scrollNodes.menu) {

@@ -175,14 +167,3 @@ scrollNodes.menu = (boundingBoxRef ? boundingBoxRef.current : getScrollAncestor(rootMenuRef.current)) || window;

var positionHelpers = getPositionHelpers(containerRef, menuRef, scrollNodes.menu, boundingBoxPadding);
var menuRect = positionHelpers.menuRect;
var results = {
computedDirection: 'bottom'
};
if (anchorPoint) {
results = positionContextMenu({
positionHelpers: positionHelpers,
anchorPoint: anchorPoint
});
} else if (anchorRef) {
results = positionMenu({
var _positionMenu = positionMenu({
arrow: arrow,

@@ -194,25 +175,19 @@ align: align,

position: position,
anchorRef: anchorRef,
anchorRect: anchorRect,
arrowRef: arrowRef,
positionHelpers: positionHelpers
});
}
var _results = results,
arrowX = _results.arrowX,
arrowY = _results.arrowY,
x = _results.x,
y = _results.y,
computedDirection = _results.computedDirection;
}),
arrowX = _positionMenu.arrowX,
arrowY = _positionMenu.arrowY,
x = _positionMenu.x,
y = _positionMenu.y,
computedDirection = _positionMenu.computedDirection;
var menuRect = positionHelpers.menuRect;
var menuHeight = menuRect.height;
if (!noOverflowCheck && overflow !== 'visible') {
var getTopOverflow = positionHelpers.getTopOverflow,
getBottomOverflow = positionHelpers.getBottomOverflow;
getBottomOverflow = positionHelpers.getBottomOverflow;
var height, _overflowAmt;
var prevHeight = latestMenuSize.current.height;
var bottomOverflow = getBottomOverflow(y);
if (bottomOverflow > 0 || floatEqual(bottomOverflow, 0) && floatEqual(menuHeight, prevHeight)) {

@@ -223,3 +198,2 @@ height = menuHeight - bottomOverflow;

var topOverflow = getTopOverflow(y);
if (topOverflow < 0 || floatEqual(topOverflow, 0) && floatEqual(menuHeight, prevHeight)) {

@@ -231,3 +205,2 @@ height = menuHeight + topOverflow;

}
if (height >= 0) {

@@ -243,3 +216,2 @@ menuHeight = height;

}
if (arrow) setArrowPosition({

@@ -264,3 +236,2 @@ x: arrowX,

}
prevOpen.current = isOpen;

@@ -279,7 +250,5 @@ latestHandlePosition.current = handlePosition;

menuScroll = menuScroll.addEventListener ? menuScroll : window;
if (!scrollNodes.anchors) {
scrollNodes.anchors = [];
var anchorScroll = getScrollAncestor(rootAnchorRef && rootAnchorRef.current);
while (anchorScroll && anchorScroll !== menuScroll) {

@@ -290,7 +259,5 @@ scrollNodes.anchors.push(anchorScroll);

}
var scroll = viewScroll;
if (scrollNodes.anchors.length && scroll === 'initial') scroll = 'auto';
if (scroll === 'initial') return;
var handleScroll = function handleScroll() {

@@ -307,3 +274,2 @@ if (scroll === 'auto') {

};
var scrollObservers = scrollNodes.anchors.concat(viewScroll !== 'initial' ? menuScroll : []);

@@ -322,7 +288,5 @@ scrollObservers.forEach(function (o) {

if (hasOverflow || !isOpen || !parentScrollingRef) return;
var handleScroll = function handleScroll() {
return batchedUpdates(handlePosition);
};
var parentScroll = parentScrollingRef.current;

@@ -339,10 +303,8 @@ parentScroll.addEventListener('scroll', handleScroll);

var borderBoxSize = entry.borderBoxSize,
target = entry.target;
target = entry.target;
var width, height;
if (borderBoxSize) {
var _ref3 = borderBoxSize[0] || borderBoxSize,
inlineSize = _ref3.inlineSize,
blockSize = _ref3.blockSize;
inlineSize = _ref3.inlineSize,
blockSize = _ref3.blockSize;
width = inlineSize;

@@ -355,3 +317,2 @@ height = blockSize;

}
if (width === 0 || height === 0) return;

@@ -378,7 +339,5 @@ if (floatEqual(width, latestMenuSize.current.width, 1) && floatEqual(height, latestMenuSize.current.height, 1)) return;

}
var _ref4 = menuItemFocus || {},
position = _ref4.position,
alwaysUpdate = _ref4.alwaysUpdate;
position = _ref4.position,
alwaysUpdate = _ref4.alwaysUpdate;
var setItemFocus = function setItemFocus() {

@@ -393,3 +352,2 @@ if (position === FocusPositions.FIRST) {

};
if (alwaysUpdate) {

@@ -420,7 +378,5 @@ setItemFocus();

var maxHeight, overflowAmt;
if (overflowData) {
setDownOverflow ? overflowAmt = overflowData.overflowAmt : maxHeight = overflowData.height;
}
var listContext = useMemo(function () {

@@ -450,3 +406,2 @@ return {

}, [expandedDirection]);
var _arrowClass = useBEM({

@@ -458,3 +413,2 @@ block: menuClass,

});
return /*#__PURE__*/jsxs("ul", _extends({

@@ -461,0 +415,0 @@ role: "menu",

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

var ariaLabel = _ref['aria-label'],
className = _ref.className,
name = _ref.name,
value = _ref.value,
onRadioChange = _ref.onRadioChange,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
className = _ref.className,
name = _ref.name,
value = _ref.value,
onRadioChange = _ref.onRadioChange,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var contextValue = useMemo(function () {

@@ -20,0 +19,0 @@ return {

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

var _excluded = ["aria-label", "className", "disabled", "direction", "label", "openTrigger", "onMenuChange", "isHovering", "instanceRef", "itemRef", "captureFocus", "repositionFlag", "itemProps"],
_excluded2 = ["ref", "className"];
_excluded2 = ["ref", "className"];
var SubMenu = /*#__PURE__*/withHovering('SubMenu', function SubMenu(_ref) {
var ariaLabel = _ref['aria-label'],
className = _ref.className,
disabled = _ref.disabled,
direction = _ref.direction,
label = _ref.label,
openTrigger = _ref.openTrigger,
onMenuChange = _ref.onMenuChange,
isHovering = _ref.isHovering,
instanceRef = _ref.instanceRef,
itemRef = _ref.itemRef,
_ref$itemProps = _ref.itemProps,
itemProps = _ref$itemProps === void 0 ? {} : _ref$itemProps,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
className = _ref.className,
disabled = _ref.disabled,
direction = _ref.direction,
label = _ref.label,
openTrigger = _ref.openTrigger,
onMenuChange = _ref.onMenuChange,
isHovering = _ref.isHovering,
instanceRef = _ref.instanceRef,
itemRef = _ref.itemRef,
_ref$itemProps = _ref.itemProps,
itemProps = _ref$itemProps === void 0 ? {} : _ref$itemProps,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var settings = useContext(SettingsContext);
var rootMenuRef = settings.rootMenuRef;
var _useContext = useContext(ItemSettingsContext),
submenuOpenDelay = _useContext.submenuOpenDelay,
submenuCloseDelay = _useContext.submenuCloseDelay;
submenuOpenDelay = _useContext.submenuOpenDelay,
submenuCloseDelay = _useContext.submenuCloseDelay;
var _useContext2 = useContext(MenuListContext),
parentMenuRef = _useContext2.parentMenuRef,
parentDir = _useContext2.parentDir,
parentOverflow = _useContext2.overflow;
parentMenuRef = _useContext2.parentMenuRef,
parentDir = _useContext2.parentDir,
parentOverflow = _useContext2.overflow;
var _useContext3 = useContext(MenuListItemContext),
isParentOpen = _useContext3.isParentOpen,
isSubmenuOpen = _useContext3.isSubmenuOpen,
setOpenSubmenuCount = _useContext3.setOpenSubmenuCount,
dispatch = _useContext3.dispatch,
updateItems = _useContext3.updateItems;
isParentOpen = _useContext3.isParentOpen,
isSubmenuOpen = _useContext3.isSubmenuOpen,
setOpenSubmenuCount = _useContext3.setOpenSubmenuCount,
dispatch = _useContext3.dispatch,
updateItems = _useContext3.updateItems;
var isPortal = parentOverflow !== 'visible';
var _useMenuStateAndFocus = useMenuStateAndFocus(settings),
stateProps = _useMenuStateAndFocus[0],
toggleMenu = _useMenuStateAndFocus[1],
_openMenu = _useMenuStateAndFocus[2];
stateProps = _useMenuStateAndFocus[0],
toggleMenu = _useMenuStateAndFocus[1],
_openMenu = _useMenuStateAndFocus[2];
var state = stateProps.state;

@@ -66,3 +59,2 @@ var isDisabled = !!disabled;

var timeoutId = useRef(0);
var stopTimer = function stopTimer() {

@@ -74,3 +66,2 @@ if (timeoutId.current) {

};
var _openMenu2 = function openMenu() {

@@ -81,7 +72,5 @@ stopTimer();

};
var setHover = function setHover() {
return !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, itemRef.current);
};
var delayOpen = function delayOpen(delay) {

@@ -93,6 +82,4 @@ setHover();

};
var handlePointerMove = function handlePointerMove() {
if (timeoutId.current || isOpen || isDisabled) return;
if (isSubmenuOpen) {

@@ -106,3 +93,2 @@ timeoutId.current = setTimeout(function () {

};
var handlePointerLeave = function handlePointerLeave() {

@@ -112,6 +98,4 @@ stopTimer();

};
var handleKeyDown = function handleKeyDown(e) {
var handled = false;
switch (e.key) {

@@ -124,3 +108,2 @@ case Keys.LEFT:

}
break;

@@ -132,3 +115,2 @@

}
if (handled) {

@@ -139,6 +121,4 @@ e.preventDefault();

};
var handleItemKeyDown = function handleItemKeyDown(e) {
if (!isHovering) return;
switch (e.key) {

@@ -152,3 +132,2 @@ case Keys.ENTER:

};
useItemEffect(isDisabled, itemRef, updateItems);

@@ -194,7 +173,5 @@ useMenuChange(onMenuChange, isOpen);

}, [isOpen, isHovering, isDisabled]);
var externalItemRef = itemProps.ref,
itemClassName = itemProps.className,
restItemProps = _objectWithoutPropertiesLoose(itemProps, _excluded2);
itemClassName = itemProps.className,
restItemProps = _objectWithoutPropertiesLoose(itemProps, _excluded2);
var mergedItemProps = mergeProps({

@@ -208,3 +185,2 @@ onPointerMove: handlePointerMove,

}, restItemProps);
var getMenuList = function getMenuList() {

@@ -219,7 +195,5 @@ var menuList = /*#__PURE__*/jsx(MenuList, _extends({}, restProps, stateProps, {

}));
var container = rootMenuRef.current;
return isPortal && container ? /*#__PURE__*/createPortal(menuList, container) : menuList;
};
return /*#__PURE__*/jsxs("li", {

@@ -226,0 +200,0 @@ className: useBEM({

@@ -5,5 +5,5 @@ import { useMemo } from 'react';

var block = _ref.block,
element = _ref.element,
modifiers = _ref.modifiers,
className = _ref.className;
element = _ref.element,
modifiers = _ref.modifiers,
className = _ref.className;
return useMemo(function () {

@@ -17,3 +17,2 @@ var blockElement = element ? block + "__" + element : block;

var expandedClassName = typeof className === 'function' ? className(modifiers) : className;
if (typeof expandedClassName === 'string') {

@@ -23,3 +22,2 @@ expandedClassName = expandedClassName.trim();

}
return classString;

@@ -26,0 +24,0 @@ }, [block, element, modifiers, className]);

@@ -6,3 +6,2 @@ import { useMemo } from 'react';

}
var useCombinedRef = function useCombinedRef(refA, refB) {

@@ -9,0 +8,0 @@ return useMemo(function () {

@@ -8,3 +8,2 @@ import { useLayoutEffect as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';

}
if (isDisabled) return;

@@ -11,0 +10,0 @@ var item = itemRef.current;

@@ -7,5 +7,4 @@ import { useState, useRef, useCallback } from 'react';

var _useState = useState(),
hoverItem = _useState[0],
setHoverItem = _useState[1];
hoverItem = _useState[0],
setHoverItem = _useState[1];
var stateRef = useRef({

@@ -19,3 +18,2 @@ items: [],

var items = mutableState.items;
if (!item) {

@@ -27,6 +25,4 @@ mutableState.items = [];

var index = items.indexOf(item);
if (index > -1) {
items.splice(index, 1);
if (item.contains(document.activeElement)) {

@@ -38,3 +34,2 @@ focusRef.current.focus();

}
mutableState.hoverIndex = -1;

@@ -45,4 +40,3 @@ mutableState.sorted = false;

var items = mutableState.items,
hoverIndex = mutableState.hoverIndex;
hoverIndex = mutableState.hoverIndex;
var sortItems = function sortItems() {

@@ -56,14 +50,10 @@ if (mutableState.sorted) return;

};
var index = -1,
newItem = undefined;
newItem = undefined;
switch (actionType) {
case HoverActionTypes.RESET:
break;
case HoverActionTypes.SET:
newItem = item;
break;
case HoverActionTypes.UNSET:

@@ -73,5 +63,3 @@ newItem = function newItem(prevItem) {

};
break;
case HoverActionTypes.FIRST:

@@ -82,3 +70,2 @@ sortItems();

break;
case HoverActionTypes.LAST:

@@ -89,3 +76,2 @@ sortItems();

break;
case HoverActionTypes.SET_INDEX:

@@ -96,3 +82,2 @@ sortItems();

break;
case HoverActionTypes.INCREASE:

@@ -106,3 +91,2 @@ sortItems();

break;
case HoverActionTypes.DECREASE:

@@ -116,7 +100,5 @@ sortItems();

break;
default:
if (process.env.NODE_ENV !== 'production') throw new Error("[React-Menu] Unknown hover action type: " + actionType);
}
if (!newItem) index = -1;

@@ -123,0 +105,0 @@ setHoverItem(newItem);

@@ -7,24 +7,18 @@ import { useContext, useRef, useEffect } from 'react';

var _useContext = useContext(ItemSettingsContext),
submenuCloseDelay = _useContext.submenuCloseDelay;
submenuCloseDelay = _useContext.submenuCloseDelay;
var _useContext2 = useContext(MenuListItemContext),
isParentOpen = _useContext2.isParentOpen,
isSubmenuOpen = _useContext2.isSubmenuOpen,
dispatch = _useContext2.dispatch,
updateItems = _useContext2.updateItems;
isParentOpen = _useContext2.isParentOpen,
isSubmenuOpen = _useContext2.isSubmenuOpen,
dispatch = _useContext2.dispatch,
updateItems = _useContext2.updateItems;
var timeoutId = useRef(0);
var setHover = function setHover() {
!isHovering && !isDisabled && dispatch(HoverActionTypes.SET, itemRef.current);
};
var unsetHover = function unsetHover() {
!isDisabled && dispatch(HoverActionTypes.UNSET, itemRef.current);
};
var onBlur = function onBlur(e) {
if (isHovering && !e.currentTarget.contains(e.relatedTarget)) unsetHover();
};
var onPointerMove = function onPointerMove() {

@@ -40,3 +34,2 @@ if (isSubmenuOpen) {

};
var onPointerLeave = function onPointerLeave(_, keepHover) {

@@ -47,6 +40,4 @@ if (timeoutId.current) {

}
!keepHover && unsetHover();
};
useItemEffect(isDisabled, itemRef, updateItems);

@@ -53,0 +44,0 @@ useEffect(function () {

@@ -7,19 +7,17 @@ import { useTransition } from 'react-transition-state';

var _ref = _temp === void 0 ? {} : _temp,
initialMounted = _ref.initialMounted,
unmountOnClose = _ref.unmountOnClose,
transition = _ref.transition,
_ref$transitionTimeou = _ref.transitionTimeout,
transitionTimeout = _ref$transitionTimeou === void 0 ? 500 : _ref$transitionTimeou;
initialMounted = _ref.initialMounted,
unmountOnClose = _ref.unmountOnClose,
transition = _ref.transition,
_ref$transitionTimeou = _ref.transitionTimeout,
transitionTimeout = _ref$transitionTimeou === void 0 ? 500 : _ref$transitionTimeou;
var _useTransition = useTransition({
mountOnEnter: !initialMounted,
unmountOnExit: unmountOnClose,
timeout: transitionTimeout,
enter: getTransition(transition, 'open'),
exit: getTransition(transition, 'close')
}),
state = _useTransition[0],
toggleMenu = _useTransition[1],
endTransition = _useTransition[2];
mountOnEnter: !initialMounted,
unmountOnExit: unmountOnClose,
timeout: transitionTimeout,
enter: getTransition(transition, 'open'),
exit: getTransition(transition, 'close')
}),
state = _useTransition[0],
toggleMenu = _useTransition[1],
endTransition = _useTransition[2];
return [{

@@ -26,0 +24,0 @@ state: MenuStateMap[state],

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

var _useMenuState = useMenuState(options),
menuProps = _useMenuState[0],
toggleMenu = _useMenuState[1];
menuProps = _useMenuState[0],
toggleMenu = _useMenuState[1];
var _useState = useState(),
menuItemFocus = _useState[0],
setMenuItemFocus = _useState[1];
menuItemFocus = _useState[0],
setMenuItemFocus = _useState[1];
var openMenu = function openMenu(position, alwaysUpdate) {

@@ -22,3 +20,2 @@ setMenuItemFocus({

};
return [_extends({

@@ -25,0 +22,0 @@ menuItemFocus: menuItemFocus

@@ -17,18 +17,13 @@ import { parsePadding } from '../utils/utils.js';

};
var getRightOverflow = function getRightOverflow(x) {
return x + containerRect.left + menuRect.width - boundingRect.right + padding.right;
};
var getTopOverflow = function getTopOverflow(y) {
return y + containerRect.top - boundingRect.top - padding.top;
};
var getBottomOverflow = function getBottomOverflow(y) {
return y + containerRect.top + menuRect.height - boundingRect.bottom + padding.bottom;
};
var confineHorizontally = function confineHorizontally(x) {
var leftOverflow = getLeftOverflow(x);
if (leftOverflow < 0) {

@@ -38,3 +33,2 @@ x -= leftOverflow;

var rightOverflow = getRightOverflow(x);
if (rightOverflow > 0) {

@@ -46,9 +40,6 @@ x -= rightOverflow;

}
return x;
};
var confineVertically = function confineVertically(y) {
var topOverflow = getTopOverflow(y);
if (topOverflow < 0) {

@@ -58,3 +49,2 @@ y -= topOverflow;

var bottomOverflow = getBottomOverflow(y);
if (bottomOverflow > 0) {

@@ -66,6 +56,4 @@ y -= bottomOverflow;

}
return y;
};
return {

@@ -72,0 +60,0 @@ menuRect: menuRect,

var placeArrowHorizontal = function placeArrowHorizontal(_ref) {
var arrowRef = _ref.arrowRef,
menuX = _ref.menuX,
anchorRect = _ref.anchorRect,
containerRect = _ref.containerRect,
menuRect = _ref.menuRect;
menuX = _ref.menuX,
anchorRect = _ref.anchorRect,
containerRect = _ref.containerRect,
menuRect = _ref.menuRect;
var x = anchorRect.left - containerRect.left - menuX + anchorRect.width / 2;

@@ -8,0 +8,0 @@ var offset = arrowRef.current.offsetWidth * 1.25;

var placeArrowVertical = function placeArrowVertical(_ref) {
var arrowRef = _ref.arrowRef,
menuY = _ref.menuY,
anchorRect = _ref.anchorRect,
containerRect = _ref.containerRect,
menuRect = _ref.menuRect;
menuY = _ref.menuY,
anchorRect = _ref.anchorRect,
containerRect = _ref.containerRect,
menuRect = _ref.menuRect;
var y = anchorRect.top - containerRect.top - menuY + anchorRect.height / 2;

@@ -8,0 +8,0 @@ var offset = arrowRef.current.offsetHeight * 1.25;

@@ -5,21 +5,19 @@ import { placeArrowVertical } from './placeArrowVertical.js';

var anchorRect = _ref.anchorRect,
containerRect = _ref.containerRect,
menuRect = _ref.menuRect,
placeLeftorRightY = _ref.placeLeftorRightY,
placeLeftX = _ref.placeLeftX,
placeRightX = _ref.placeRightX,
getLeftOverflow = _ref.getLeftOverflow,
getRightOverflow = _ref.getRightOverflow,
confineHorizontally = _ref.confineHorizontally,
confineVertically = _ref.confineVertically,
arrowRef = _ref.arrowRef,
arrow = _ref.arrow,
direction = _ref.direction,
position = _ref.position;
containerRect = _ref.containerRect,
menuRect = _ref.menuRect,
placeLeftorRightY = _ref.placeLeftorRightY,
placeLeftX = _ref.placeLeftX,
placeRightX = _ref.placeRightX,
getLeftOverflow = _ref.getLeftOverflow,
getRightOverflow = _ref.getRightOverflow,
confineHorizontally = _ref.confineHorizontally,
confineVertically = _ref.confineVertically,
arrowRef = _ref.arrowRef,
arrow = _ref.arrow,
direction = _ref.direction,
position = _ref.position;
var computedDirection = direction;
var y = placeLeftorRightY;
if (position !== 'initial') {
y = confineVertically(y);
if (position === 'anchor') {

@@ -30,14 +28,9 @@ y = Math.min(y, anchorRect.bottom - containerRect.top);

}
var x, leftOverflow, rightOverflow;
if (computedDirection === 'left') {
x = placeLeftX;
if (position !== 'initial') {
leftOverflow = getLeftOverflow(x);
if (leftOverflow < 0) {
rightOverflow = getRightOverflow(placeRightX);
if (rightOverflow <= 0 || -leftOverflow > rightOverflow) {

@@ -51,9 +44,6 @@ x = placeRightX;

x = placeRightX;
if (position !== 'initial') {
rightOverflow = getRightOverflow(x);
if (rightOverflow > 0) {
leftOverflow = getLeftOverflow(placeLeftX);
if (leftOverflow >= 0 || -leftOverflow < rightOverflow) {

@@ -66,3 +56,2 @@ x = placeLeftX;

}
if (position === 'auto') x = confineHorizontally(x);

@@ -69,0 +58,0 @@ var arrowY = arrow ? placeArrowVertical({

@@ -5,21 +5,19 @@ import { placeArrowHorizontal } from './placeArrowHorizontal.js';

var anchorRect = _ref.anchorRect,
containerRect = _ref.containerRect,
menuRect = _ref.menuRect,
placeToporBottomX = _ref.placeToporBottomX,
placeTopY = _ref.placeTopY,
placeBottomY = _ref.placeBottomY,
getTopOverflow = _ref.getTopOverflow,
getBottomOverflow = _ref.getBottomOverflow,
confineHorizontally = _ref.confineHorizontally,
confineVertically = _ref.confineVertically,
arrowRef = _ref.arrowRef,
arrow = _ref.arrow,
direction = _ref.direction,
position = _ref.position;
containerRect = _ref.containerRect,
menuRect = _ref.menuRect,
placeToporBottomX = _ref.placeToporBottomX,
placeTopY = _ref.placeTopY,
placeBottomY = _ref.placeBottomY,
getTopOverflow = _ref.getTopOverflow,
getBottomOverflow = _ref.getBottomOverflow,
confineHorizontally = _ref.confineHorizontally,
confineVertically = _ref.confineVertically,
arrowRef = _ref.arrowRef,
arrow = _ref.arrow,
direction = _ref.direction,
position = _ref.position;
var computedDirection = direction === 'top' ? 'top' : 'bottom';
var x = placeToporBottomX;
if (position !== 'initial') {
x = confineHorizontally(x);
if (position === 'anchor') {

@@ -30,14 +28,9 @@ x = Math.min(x, anchorRect.right - containerRect.left);

}
var y, topOverflow, bottomOverflow;
if (computedDirection === 'top') {
y = placeTopY;
if (position !== 'initial') {
topOverflow = getTopOverflow(y);
if (topOverflow < 0) {
bottomOverflow = getBottomOverflow(placeBottomY);
if (bottomOverflow <= 0 || -topOverflow > bottomOverflow) {

@@ -51,9 +44,6 @@ y = placeBottomY;

y = placeBottomY;
if (position !== 'initial') {
bottomOverflow = getBottomOverflow(y);
if (bottomOverflow > 0) {
topOverflow = getTopOverflow(placeTopY);
if (topOverflow >= 0 || -topOverflow < bottomOverflow) {

@@ -66,3 +56,2 @@ y = placeTopY;

}
if (position === 'auto') y = confineVertically(y);

@@ -69,0 +58,0 @@ var arrowX = arrow ? placeArrowHorizontal({

@@ -7,15 +7,14 @@ import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';

var arrow = _ref.arrow,
align = _ref.align,
direction = _ref.direction,
offsetX = _ref.offsetX,
offsetY = _ref.offsetY,
position = _ref.position,
anchorRef = _ref.anchorRef,
arrowRef = _ref.arrowRef,
positionHelpers = _ref.positionHelpers;
align = _ref.align,
direction = _ref.direction,
offsetX = _ref.offsetX,
offsetY = _ref.offsetY,
position = _ref.position,
anchorRect = _ref.anchorRect,
arrowRef = _ref.arrowRef,
positionHelpers = _ref.positionHelpers;
var menuRect = positionHelpers.menuRect,
containerRect = positionHelpers.containerRect;
containerRect = positionHelpers.containerRect;
var horizontalOffset = offsetX;
var verticalOffset = offsetY;
if (arrow) {

@@ -28,4 +27,2 @@ if (direction === 'left' || direction === 'right') {

}
var anchorRect = anchorRef.current.getBoundingClientRect();
var placeLeftX = anchorRect.left - containerRect.left - menuRect.width - horizontalOffset;

@@ -36,3 +33,2 @@ var placeRightX = anchorRect.right - containerRect.left + horizontalOffset;

var placeToporBottomX, placeLeftorRightY;
if (align === 'end') {

@@ -48,6 +44,4 @@ placeToporBottomX = anchorRect.right - containerRect.left - menuRect.width;

}
placeToporBottomX += horizontalOffset;
placeLeftorRightY += verticalOffset;
var options = _extends({}, positionHelpers, {

@@ -66,3 +60,2 @@ anchorRect: anchorRect,

});
switch (direction) {

@@ -72,3 +65,2 @@ case 'left':

return placeLeftorRight(options);
case 'top':

@@ -75,0 +67,0 @@ case 'bottom':

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

var _ref;
return _ref = {}, _ref[name ? name + "ClassName" : 'className'] = oneOfType([string, func]), _ref;
};
var menuPropTypes = /*#__PURE__*/_extends({

@@ -24,2 +24,3 @@ className: string

});
var rootMenuPropTypes = /*#__PURE__*/_extends({}, menuPropTypes, {

@@ -49,2 +50,3 @@ containerProps: object,

});
var uncontrolledMenuPropTypes = {

@@ -51,0 +53,0 @@ instanceRef: /*#__PURE__*/oneOfType([object, func]),

@@ -18,3 +18,2 @@ import { unstable_batchedUpdates } from 'react-dom';

}
return Math.abs(a - b) < diff;

@@ -41,3 +40,2 @@ };

var sourceProp = source[key];
if (typeof sourceProp === 'function' && targetProp) {

@@ -71,2 +69,3 @@ target[key] = function () {

};
var getScrollAncestor = function getScrollAncestor(node) {

@@ -76,8 +75,6 @@ while (node) {

if (!node || node === document.body) return;
var _getComputedStyle = getComputedStyle(node),
overflow = _getComputedStyle.overflow,
overflowX = _getComputedStyle.overflowX,
overflowY = _getComputedStyle.overflowY;
overflow = _getComputedStyle.overflow,
overflowX = _getComputedStyle.overflowX,
overflowY = _getComputedStyle.overflowY;
if (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX)) return node;

@@ -96,3 +93,2 @@ }

}
return -1;

@@ -99,0 +95,0 @@ }

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var menuContainerClass = 'szh-menu-container';

@@ -26,3 +24,2 @@ var menuClass = 'szh-menu';

};
var createSelector = function createSelector(blockElement, modifiers) {

@@ -32,3 +29,2 @@ if (modifiers === void 0) {

}
var selectorObj = {};

@@ -50,3 +46,2 @@ Object.defineProperty(selectorObj, 'name', {

};
var directions = ['dir-left', 'dir-right', 'dir-top', 'dir-bottom'];

@@ -53,0 +48,0 @@ var menuBlock = /*#__PURE__*/bem(menuClass);

@@ -22,3 +22,2 @@ var menuContainerClass = 'szh-menu-container';

};
var createSelector = function createSelector(blockElement, modifiers) {

@@ -28,3 +27,2 @@ if (modifiers === void 0) {

}
var selectorObj = {};

@@ -46,3 +44,2 @@ Object.defineProperty(selectorObj, 'name', {

};
var directions = ['dir-left', 'dir-right', 'dir-top', 'dir-bottom'];

@@ -49,0 +46,0 @@ var menuBlock = /*#__PURE__*/bem(menuClass);

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

@@ -47,25 +47,25 @@ "author": "Zheng Song",

"prop-types": "^15.7.2",
"react-transition-state": "^1.1.4"
"react-transition-state": "^1.1.5"
},
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/preset-env": "^7.19.1",
"@babel/core": "^7.19.6",
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-node-resolve": "^14.1.0",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.0.0",
"@types/react": "^18.0.17",
"@types/jest": "^29.2.0",
"@types/react": "^18.0.21",
"babel-plugin-pure-annotations": "^0.1.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"dtslint": "^4.2.1",
"eslint": "^8.23.0",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.0.1",
"eslint-plugin-react": "^7.31.1",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-hooks-addons": "^0.3.1",
"jest": "^29.0.2",
"jest-environment-jsdom": "^29.0.2",
"jest": "^29.2.2",
"jest-environment-jsdom": "^29.2.2",
"npm-run-all": "^4.1.5",

@@ -75,5 +75,5 @@ "prettier": "^2.7.1",

"react-dom": "^18.2.0",
"rollup": "^2.79.0",
"sass": "^1.54.8",
"typescript": "^4.8.2"
"rollup": "^3.2.3",
"sass": "^1.55.0",
"typescript": "^4.8.4"
},

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

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