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