import{jsx as e}from"react/jsx-runtime";import{useRef as n}from"react";import t from"classnames";import s from"../../Button/Button.js";import i from"../../Tooltip/Tooltip.js";import o from"../../../hooks/useMergeRefs.js";import r from"../MenuItem/hooks/useMenuItemMouseEvents.js";import l from"../MenuItem/hooks/useMenuItemKeyboardEvents.js";import{DialogPosition as u}from"../../../constants/positions.js";import{backwardCompatibilityForProperties as c}from"../../../helpers/backwardCompatibilityForProperties.js";import"./MenuItemButton.scss.js";var m=function u(m){var d=m.className,a=m.classname,p=m.kind,I=void 0===p?u.kinds.PRIMARY:p,b=m.leftIcon,v=void 0===b?null:b,f=m.rightIcon,h=void 0===f?null:f,M=m.disabled,j=void 0!==M&&M,k=m.disableReason,x=m.index,O=m.activeItemIndex,S=void 0===O?-1:O,C=m.onClick,g=m.menuId,y=m.tooltipPosition,A=void 0===y?u.tooltipPositions.RIGHT:y,R=m.tooltipShowDelay,B=void 0===R?300:R,E=m.children,P=m.resetOpenSubMenuIndex,w=m.setSubMenuIsOpenByIndex,D=m.setActiveItemIndex,L=m.menuRef,N=m.closeMenu,T=m.useDocumentEventListeners,z=n(null),F=n(null),G=c([d,a]),H=o({refs:[z,F]}),K=j&&k,U=k,Y=S===x,q=r({ref:z,resetOpenSubMenuIndex:P,setSubMenuIsOpenByIndex:w,isActive:Y,setActiveItemIndex:D,index:x,hasChildren:!1}),J=l({onClick:C,disabled:j,isActive:Y,index:x,setActiveItemIndex:D,hasChildren:!1,shouldShowSubMenu:!1,setSubMenuIsOpenByIndex:w,menuRef:L,isMouseEnter:q,closeMenu:N,useDocumentEventListeners:T}).onClickCallback;return e(i,Object.assign({content:K?U:null,position:A,showDelay:B},{children:e("li",Object.assign({id:"".concat(g,"-").concat(x),className:t("l3-style-menu-item-button",G),ref:H,role:"menuitem","aria-current":Y},{children:e(s,Object.assign({active:Y,disabled:j,leftIcon:v,rightIcon:h,onClick:J,kind:I,size:s.sizes.SMALL,blurOnMouseUp:!1},{children:e("div",Object.assign({className:"menu-item-button-content"},{children:E}))}))}))}))};Object.assign(m,{kinds:s.kinds,tooltipPositions:u,isSelectable:!0,isMenuChild:!0});var d=m;export{d as default};
