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 c}from"../../../helpers/typesciptCssModulesHelper.js";import{getTestId as l,ComponentDefaultTestId as d}from"../../../tests/testIds.js";import m from"./Tab.module.scss.js";import p from"../../Tooltip/Tooltip.js";import{ComponentVibeId as f}from"../../../tests/constants.js";import{keyCodes as u}from"../../../constants/keyCodes.js";import"../../../constants/sizes.js";import v from"../../../../components/icon/dist/Icon/Icon.js";var b=i((function(i,b){var y=i.className,j=i.tabInnerClassName,C=i.id,I=i.value,k=void 0===I?0:I,T=i.disabled,E=void 0!==T&&T,h=i.active,N=void 0!==h&&h,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(p,Object.assign({},z,{content:z.content}),r.createElement("li",{ref:V,key:C,className:o(m.tabWrapper,y,e(e(e(e({},m.active,N),m.disabled,E),m.tabFocusVisibleInset,g),m.stretchedUnderline,S)),id:C,role:"tab","aria-selected":N,"aria-disabled":E,"aria-controls":K||void 0,tabIndex:w,"data-testid":_||l(d.TAB,C),"data-vibe":f.TAB,onClick:function(){return!E&&B(k)},onKeyDown:function(e){e.key!==u.ENTER&&e.key!==u.SPACE||(e.preventDefault(),!E&&B(k))}},r.createElement("div",{className:o(m.tabInner,j)},function(){if(!D)return U;var e=r.createElement(v,{ariaHidden:!0,iconType:F,icon:D,className:o(m.tabIcon,c(m,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
