2 lines
3.6 KiB
JavaScript
2 lines
3.6 KiB
JavaScript
import{r as b,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{J as M,v as P,r as S,K as k,s as p,M as h,R as F,N as $,x as m,P as D,m as g}from"./index-LZWfu62c.js";var x="Tabs",[V]=S(x,[h]),C=h(),[G,T]=V(x),j=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,onValueChange:r,defaultValue:d,orientation:o="horizontal",dir:u,activationMode:v="automatic",...f}=e,i=M(u),[n,l]=P({prop:a,onChange:r,defaultProp:d??"",caller:x});return s.jsx(G,{scope:c,baseId:k(),value:n,onValueChange:l,orientation:o,dir:i,activationMode:v,children:s.jsx(p.div,{dir:i,"data-orientation":o,...f,ref:t})})});j.displayName=x;var y="TabsList",I=b.forwardRef((e,t)=>{const{__scopeTabs:c,loop:a=!0,...r}=e,d=T(y,c),o=C(c);return s.jsx(F,{asChild:!0,...o,orientation:d.orientation,dir:d.dir,loop:a,children:s.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:t})})});I.displayName=y;var _="TabsTrigger",N=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,disabled:r=!1,...d}=e,o=T(_,c),u=C(c),v=A(o.baseId,a),f=E(o.baseId,a),i=a===o.value;return s.jsx($,{asChild:!0,...u,focusable:!r,active:i,children:s.jsx(p.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":f,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:v,...d,ref:t,onMouseDown:m(e.onMouseDown,n=>{!r&&n.button===0&&n.ctrlKey===!1?o.onValueChange(a):n.preventDefault()}),onKeyDown:m(e.onKeyDown,n=>{[" ","Enter"].includes(n.key)&&o.onValueChange(a)}),onFocus:m(e.onFocus,()=>{const n=o.activationMode!=="manual";!i&&!r&&n&&o.onValueChange(a)})})})});N.displayName=_;var R="TabsContent",w=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,forceMount:r,children:d,...o}=e,u=T(R,c),v=A(u.baseId,a),f=E(u.baseId,a),i=a===u.value,n=b.useRef(i);return b.useEffect(()=>{const l=requestAnimationFrame(()=>n.current=!1);return()=>cancelAnimationFrame(l)},[]),s.jsx(D,{present:r||i,children:({present:l})=>s.jsx(p.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":v,hidden:!l,id:f,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:n.current?"0s":void 0},children:l&&d})})});w.displayName=R;function A(e,t){return`${e}-trigger-${t}`}function E(e,t){return`${e}-content-${t}`}var L=j,K=I,z=N,B=w;function J({className:e,...t}){return s.jsx(L,{"code-path":"src/components/ui/tabs.tsx:13:5","data-slot":"tabs",className:g("flex flex-col gap-2",e),...t})}function O({className:e,...t}){return s.jsx(K,{"code-path":"src/components/ui/tabs.tsx:26:5","data-slot":"tabs-list",className:g("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Q({className:e,...t}){return s.jsx(z,{"code-path":"src/components/ui/tabs.tsx:42:5","data-slot":"tabs-trigger",className:g("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function U({className:e,...t}){return s.jsx(B,{"code-path":"src/components/ui/tabs.tsx:58:5","data-slot":"tabs-content",className:g("flex-1 outline-none",e),...t})}export{J as T,O as a,Q as b,U as c};
|