import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{t}from"./react-Augu_vA3.js";import{_t as n,ct as r,dt as i}from"./forms-CL2ODv4X.js";import{t as a}from"./jsx-runtime-CTknu7_t.js";var o=e(i()),s=e(t()),c=e(a()),l=r.button` border-color: ${({theme:e})=>e.borderColor}; color: ${({theme:e})=>e.textColor}; &:hover { color: ${({theme:e})=>e.hoverTextColor}; } `;function u(e){let t=n(),{withoutVerticalMargin:r,withHorizontalPadding:i=!1,horizontalPaddingWidth:a=`7rem`,fullRightPadding:u=!1,style:d}=e,[f,p]=(0,s.useState)(e.defaultTabIndex||0),m=t=>{p(t),e.onTabChange?.(t)};return(0,s.useEffect)(()=>{p(e.defaultTabIndex||0)},[e.defaultTabIndex]),(0,c.jsxs)(`div`,{className:(0,o.default)(e.className,{"w-full":e.width===`full`}),"data-cy":`tabs`,style:d,children:[(0,c.jsx)(`div`,{className:`flex justify-between relative`,children:(0,c.jsxs)(`div`,{className:`flex flex-1 overflow-x-auto relative`,children:[i&&(0,c.jsx)(`div`,{style:{width:a,height:`100%`,borderBottom:`1px solid ${t.$20}`}}),e.tabs.map((n,r)=>(0,c.jsx)(`div`,{className:(0,o.default)({"flex-1":e.width===`full`}),children:(0,c.jsx)(l,{className:(0,o.default)(`whitespace-nowrap font-medium text-sm py-3 px-4 focus:outline-none`,{"w-full":e.width===`full`}),type:`button`,tabIndex:-1,onMouseDown:e=>e.preventDefault(),onClick:()=>m(r),theme:{textColor:f===r?t.$3:t.$17,hoverTextColor:t.$3},style:{borderBottom:f===r?`1px solid ${t.$3}`:`1px solid ${t.$20}`},children:e.formatTabLabel?.(r)||n})},r)),(0,c.jsx)(`div`,{className:(0,o.default)({"flex-1":!i||u}),style:{...!!(i&&!u)&&{width:a},height:`100%`,borderBottom:`1px solid ${t.$20}`}})]})}),(0,c.jsx)(`div`,{className:(0,o.default)(e.childrenClassName,{"flex flex-1":e.height===`full`,"my-4":e.height!==`full`&&!r,"overflow-y-scroll px-[5px]":e.withScrollableContent}),children:[...e.children].map((t,n)=>s.isValidElement(t)&&s.cloneElement(t,{key:n,className:(0,o.default)(t.props?.className,{"flex flex-col flex-1":e.height===`full`,"block my-4":e.height!==`full`&&!r,hidden:f!==n})}))})]})}export{u as t};