import e from"classnames";import t,{useRef as o}from"react";import{getTestId as s,ComponentDefaultTestId as n}from"../../../tests/testIds.js";import{Button as i}from"@vibe/button/mockedClassNames";import r from"../../Tooltip/Tooltip.js";import l from"../../../hooks/useMergeRef.js";import m from"../MenuItem/hooks/useMenuItemMouseEvents.js";import a from"../MenuItem/hooks/useMenuItemKeyboardEvents.js";import{withStaticPropsWithoutForwardRef as u}from"../../../types/withStaticProps.js";import"../../../utils/colors-vars-map.js";import d from"../../Text/Text.js";import c from"./MenuItemButton.module.scss.js";import{TooltipPositions as p}from"../../Tooltip/TooltipConstants.js";var I=function(u){var p=u.className,I=u.kind,v=void 0===I?"primary":I,f=u.leftIcon,M=void 0===f?null:f,b=u.rightIcon,h=void 0===b?null:b,x=u.disabled,k=void 0!==x&&x,j=u.disableReason,C=u.index,E=u.activeItemIndex,S=void 0===E?-1:E,y=u.onClick,T=u.tooltipPosition,O=void 0===T?"right":T,N=u.tooltipShowDelay,B=void 0===N?300:N,g=u.children,A=u.resetOpenSubMenuIndex,w=u.setSubMenuIsOpenByIndex,D=u.setActiveItemIndex,R=u.menuRef,P=u.closeMenu,U=u.useDocumentEventListeners,L=u.id,_=u["data-testid"],z=o(null),K=o(null),q=l(z,K),F=k&&j,G=j,H=S===C,J=m({ref:z,resetOpenSubMenuIndex:A,setSubMenuIsOpenByIndex:w,isActive:H,setActiveItemIndex:D,index:C,hasChildren:!1}),Q=a({onClick:y,disabled:k,isActive:H,index:C,setActiveItemIndex:D,hasChildren:!1,shouldShowSubMenu:!1,setSubMenuIsOpenByIndex:w,menuRef:R,isMouseEnter:J,closeMenu:P,useDocumentEventListeners:U}).onClickCallback;return t.createElement(r,{content:F?G:null,position:O,showDelay:B},t.createElement(d,{type:"text2",element:"li","data-testid":_||s(n.MENU_ITEM_BUTTON,L),id:L,className:e(c.itemButton,p),ref:q,role:"menuitem","aria-current":H},t.createElement(i,{className:c.buttonComponent,active:H,disabled:k,leftIcon:M,rightIcon:h,onClick:Q,kind:v,size:"small",blurOnMouseUp:!1},t.createElement("div",{className:c.content},g))))};Object.assign(I,{isSelectable:!0,isMenuChild:!0});var v=u(I,{kinds:i.kinds,tooltipPositions:p});export{v as default};
//# sourceMappingURL=MenuItemButton.js.map
