import*as e from"react";import{composeEventHandlers as t}from"../../primitive/dist/index.js";import{createContextScope as a}from"../../react-context/dist/index.js";import{createRovingFocusGroupScope as o,Root as r,Item as i}from"../../react-roving-focus/dist/index.js";import{Presence as n}from"../../react-presence/dist/index.js";import{Primitive as s}from"../../react-primitive/dist/index.js";import{useDirection as d}from"../../react-direction/dist/index.js";import{useControllableState as c}from"../../react-use-controllable-state/dist/index.js";import{useId as l}from"../../react-id/dist/index.js";import{jsx as u}from"react/jsx-runtime";var m="Tabs",[f,p]=a(m,[o]),v=o(),[b,h]=f(m),x=e.forwardRef(((e,t)=>{const{__scopeTabs:a,value:o,onValueChange:r,defaultValue:i,orientation:n="horizontal",dir:m,activationMode:f="automatic",...p}=e,v=d(m),[h,x]=c({prop:o,onChange:r,defaultProp:i});return u(b,{scope:a,baseId:l(),value:h,onValueChange:x,orientation:n,dir:v,activationMode:f,children:u(s.div,{dir:v,"data-orientation":n,...p,ref:t})})}));x.displayName=m;var y="TabsList",g=e.forwardRef(((e,t)=>{const{__scopeTabs:a,loop:o=!0,...i}=e,n=h(y,a),d=v(a);return u(r,{asChild:!0,...d,orientation:n.orientation,dir:n.dir,loop:o,children:u(s.div,{role:"tablist","aria-orientation":n.orientation,...i,ref:t})})}));g.displayName=y;var j="TabsTrigger",C=e.forwardRef(((e,a)=>{const{__scopeTabs:o,value:r,disabled:n=!1,...d}=e,c=h(j,o),l=v(o),m=_(c.baseId,r),f=D(c.baseId,r),p=r===c.value;return u(i,{asChild:!0,...l,focusable:!n,active:p,children:u(s.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:m,...d,ref:a,onMouseDown:t(e.onMouseDown,(e=>{n||0!==e.button||!1!==e.ctrlKey?e.preventDefault():c.onValueChange(r)})),onKeyDown:t(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&c.onValueChange(r)})),onFocus:t(e.onFocus,(()=>{const e="manual"!==c.activationMode;p||n||!e||c.onValueChange(r)}))})})}));C.displayName=j;var T="TabsContent",w=e.forwardRef(((t,a)=>{const{__scopeTabs:o,value:r,forceMount:i,children:d,...c}=t,l=h(T,o),m=_(l.baseId,r),f=D(l.baseId,r),p=r===l.value,v=e.useRef(p);return e.useEffect((()=>{const e=requestAnimationFrame((()=>v.current=!1));return()=>cancelAnimationFrame(e)}),[]),u(n,{present:i||p,children:({present:e})=>u(s.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":m,hidden:!e,id:f,tabIndex:0,...c,ref:a,style:{...t.style,animationDuration:v.current?"0s":void 0},children:e&&d})})}));function _(e,t){return`${e}-trigger-${t}`}function D(e,t){return`${e}-content-${t}`}w.displayName=T;var I=x,M=g,R=C,V=w;export{V as Content,M as List,I as Root,x as Tabs,w as TabsContent,g as TabsList,C as TabsTrigger,R as Trigger,p as createTabsScope};
//# sourceMappingURL=index.js.map
