import{__rest as o}from"../../../../_virtual/_tslib.js";import e,{forwardRef as t,useRef as i,useMemo as r}from"react";import s from"../../Tooltip/Tooltip.js";import n from"../../../hooks/useIsOverflowing/useIsOverflowing.js";import{withStaticProps as l}from"../../../types/withStaticProps.js";import"../../../utils/colors-vars-map.js";import a from"../../Label/Label.js";import c from"./MenuItem.module.scss.js";import p from"./components/BaseMenuItem/BaseMenuItem.js";import m from"./components/MenuItemIcon/MenuItemIcon.js";import{TooltipPositions as d}from"../../Tooltip/TooltipConstants.js";import u from"classnames";import f from"../../../../components/icon/dist/Icon/Icon.js";var g=t((function(t,l){var d=t.className,f=t.iconWrapperClassName,g=t.title,b=void 0===g?"":g,I=t.label,h=void 0===I?"":I,v=t.icon,y=void 0===v?"":v,C=t.rightIcon,j=void 0===C?"":C,k=t.rightIconType,N=t.rightIconBackgroundColor,T=t.rightIconWrapperClassName,w=t.iconType,E=t.iconBackgroundColor,M=t.disabled,B=void 0!==M&&M,P=t.disableReason,O=t.selected,W=void 0!==O&&O,S=t.key,D=t.children,x=t.tooltipContent,L=t.tooltipPosition,R=void 0===L?"right":L,_=t.tooltipShowDelay,V=void 0===_?300:_,q=t.tooltipProps,z=t["aria-label"],A=o(t,["className","iconWrapperClassName","title","label","icon","rightIcon","rightIconType","rightIconBackgroundColor","rightIconWrapperClassName","iconType","iconBackgroundColor","disabled","disableReason","selected","key","children","tooltipContent","tooltipPosition","tooltipShowDelay","tooltipProps","aria-label"]),F=i(),G=null!=z?z:b,H=n({ref:F})||B||x,J=r((function(){return B?P:x||b}),[P,B,b,x]),K=r((function(){if(h)return"string"==typeof h?e.createElement(a,{kind:"line",text:h}):e.isValidElement(h)&&h.type===a?h:void 0}),[h]);return console.log("icon",y),e.createElement(s,Object.assign({content:H?J:null,position:R,showDelay:V},q),e.createElement(p,Object.assign({key:S,ref:l,subMenu:D,className:d,disabled:B,selected:W},A),!!y&&e.createElement(m,{icon:y,type:w,label:G,disabled:B,selected:W,backgroundColor:E,wrapperClassName:f}),e.createElement("div",{ref:F,className:c.title},b),K,!!j&&!D&&!h&&e.createElement(m,{icon:j,type:k,disabled:B,selected:W,backgroundColor:N,wrapperClassName:u(c.rightIconWrapper,T)})))}));Object.assign(g,{isSelectable:!0,isMenuChild:!0});var b=l(g,{iconType:f.type,tooltipPositions:d});export{b as default};
//# sourceMappingURL=MenuItem.js.map
