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