@accounter/client
Version:
Accounter client application
1 lines • 2.46 kB
JavaScript
import{s as e}from"./dist-ypP48_Ax.js";import{i as t,o as n}from"./utils-CbS-oR5I.js";import{$ as r,at as i,et as a,nt as o,rt as s,st as c,tt as l}from"./select-Zdatwv1b.js";import{s as u}from"./button-DUNsVBiu.js";var d=e(n(),1),f=t(),p=Object.defineProperty,m=(e,t)=>p(e,`name`,{value:t,configurable:!0}),h=`Collapsible`,[g,_]=i(h),[v,y]=g(h),b=d.forwardRef(m(function(e,t){let{__scopeCollapsible:n,open:i,defaultOpen:a,disabled:o,onOpenChange:s,...u}=e,[p,m]=l({prop:i,defaultProp:a??!1,onChange:s,caller:h});return(0,f.jsx)(v,{scope:n,disabled:o,contentId:r(),open:p,onOpenToggle:d.useCallback(()=>m(e=>!e),[m]),children:(0,f.jsx)(c.div,{"data-state":E(p),"data-disabled":o?``:void 0,...u,ref:t})})},`Collapsible`)),x=`CollapsibleTrigger`,S=d.forwardRef(m(function(e,t){let{__scopeCollapsible:n,...r}=e,i=y(x,n);return(0,f.jsx)(c.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":E(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:s(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),C=`CollapsibleContent`,w=d.forwardRef(m(function(e,t){let{forceMount:n,...r}=e,i=y(C,e.__scopeCollapsible);return(0,f.jsx)(a,{present:n||i.open,children:({present:e})=>(0,f.jsx)(T,{...r,ref:t,present:e})})},`CollapsibleContent`)),T=d.forwardRef(m(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,s=y(C,n),[l,p]=d.useState(r),m=d.useRef(null),h=u(t,m),g=d.useRef(0),_=g.current,v=d.useRef(0),b=v.current,x=s.open||l,S=d.useRef(x),w=d.useRef(void 0);return d.useEffect(()=>{let e=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(e)},[]),o(()=>{let e=m.current;if(e){w.current=w.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();g.current=t.height,v.current=t.width,S.current||(e.style.transitionDuration=w.current.transitionDuration,e.style.animationName=w.current.animationName),p(r)}},[s.open,r]),(0,f.jsx)(c.div,{"data-state":E(s.open),"data-disabled":s.disabled?``:void 0,id:s.contentId,hidden:!x,...a,ref:h,style:{"--radix-collapsible-content-height":_?`${_}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:x&&i})},`CollapsibleContentImpl`));function E(e){return e?`open`:`closed`}m(E,`getState`);var D=b,O=S,k=w;export{O as a,D as i,S as n,_ as o,k as r,w as t};