UNPKG

sui-explorer-local

Version:
2 lines (1 loc) 2.66 kB
import{j as w}from"./jsx-runtime-ffb262ed.js";import{_ as p}from"./extends-98964cd2.js";import{r as e}from"./index-76fb7be0.js";import{$ as P,a as O,b as A,c as m,d as I,e as k,f as M}from"./index-378103fb.js";import{$ as T}from"./index-d5a566d3.js";const j=t=>w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 12 12",...t,children:w.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m5 9 3-3-3-3"})}),Q=j;try{ChevronRight12.displayName="ChevronRight12",ChevronRight12.__docgenInfo={description:"",displayName:"ChevronRight12",props:{}}}catch{}const y="Collapsible",[D,U]=P(y),[L,h]=D(y),S=e.forwardRef((t,a)=>{const{__scopeCollapsible:s,open:r,defaultOpen:n,disabled:i,onOpenChange:c,...$}=t,[d=!1,l]=O({prop:r,defaultProp:n,onChange:c});return e.createElement(L,{scope:s,disabled:i,contentId:A(),open:d,onOpenToggle:e.useCallback(()=>l(b=>!b),[l])},e.createElement(m.div,p({"data-state":C(d),"data-disabled":i?"":void 0},$,{ref:a})))}),B="CollapsibleTrigger",F=e.forwardRef((t,a)=>{const{__scopeCollapsible:s,...r}=t,n=h(B,s);return e.createElement(m.button,p({type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":C(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled},r,{ref:a,onClick:I(t.onClick,n.onOpenToggle)}))}),N="CollapsibleContent",G=e.forwardRef((t,a)=>{const{forceMount:s,...r}=t,n=h(N,t.__scopeCollapsible);return e.createElement(k,{present:s||n.open},({present:i})=>e.createElement(q,p({},r,{ref:a,present:i})))}),q=e.forwardRef((t,a)=>{const{__scopeCollapsible:s,present:r,children:n,...i}=t,c=h(N,s),[$,d]=e.useState(r),l=e.useRef(null),b=T(a,l),x=e.useRef(0),g=x.current,_=e.useRef(0),R=_.current,u=c.open||$,v=e.useRef(u),f=e.useRef();return e.useEffect(()=>{const o=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(o)},[]),M(()=>{const o=l.current;if(o){f.current=f.current||{transitionDuration:o.style.transitionDuration,animationName:o.style.animationName},o.style.transitionDuration="0s",o.style.animationName="none";const E=o.getBoundingClientRect();x.current=E.height,_.current=E.width,v.current||(o.style.transitionDuration=f.current.transitionDuration,o.style.animationName=f.current.animationName),d(r)}},[c.open,r]),e.createElement(m.div,p({"data-state":C(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!u},i,{ref:b,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":R?`${R}px`:void 0,...t.style}}),u&&n)});function C(t){return t?"open":"closed"}const V=S,X=F,Y=G;export{V as $,Q as C,X as a,Y as b};