import{defineProperty as e,toConsumableArray as t}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import o from"classnames";import r,{forwardRef as i,useRef as s}from"react";import{noop as a}from"es-toolkit";import n from"../../../hooks/useMergeRef.js";import{getStyle as l}from"../../../helpers/typesciptCssModulesHelper.js";import{Icon as c}from"@vibe/icon/mockedClassNames";import{getTestId as d,ComponentDefaultTestId as m}from"../../../tests/testIds.js";import p from"./Tab.module.scss.js";import f from"../../Tooltip/Tooltip.js";import{ComponentVibeId as u}from"../../../tests/constants.js";import{keyCodes as v}from"../../../constants/keyCodes.js";import"../../../constants/sizes.js";var b=i((function(i,b){var y=i.className,j=i.tabInnerClassName,C=i.id,k=i.value,T=void 0===k?0:k,E=i.disabled,I=void 0!==E&&E,N=i.active,h=void 0!==N&&N,A=i.focus,g=void 0!==A&&A,P=i.stretchedUnderline,S=void 0!==P&&P,x=i.onClick,B=void 0===x?a:x,H=i.tooltipProps,z=void 0===H?{}:H,D=i.icon,F=i.iconType,M=i.iconSide,R=void 0===M?"left":M,U=i.children,_=i["data-testid"],w=i.tabIndex,K=i.ariaControls,O=s(null),V=n(b,O);return r.createElement(f,Object.assign({},z,{content:z.content}),r.createElement("li",{ref:V,key:C,className:o(p.tabWrapper,y,e(e(e(e({},p.active,h),p.disabled,I),p.tabFocusVisibleInset,g),p.stretchedUnderline,S)),id:C,role:"tab","aria-selected":h,"aria-disabled":I,"aria-controls":K||void 0,tabIndex:w,"data-testid":_||d(m.TAB,C),"data-vibe":u.TAB,onClick:function(){return!I&&B(T)},onKeyDown:function(e){e.key!==v.ENTER&&e.key!==v.SPACE||(e.preventDefault(),!I&&B(T))}},r.createElement("div",{className:o(p.tabInner,j)},function(){if(!D)return U;var e=r.createElement(c,{ariaHidden:!0,iconType:F,icon:D,className:o(p.tabIcon,l(p,R)),iconSize:18,ignoreFocusStyle:!0}),i=r.Children.toArray(U);return"left"===R?[e].concat(t(i)):[].concat(t(i),[e])}())))}));export{b as default};
//# sourceMappingURL=Tab.js.map
