PageSourceSearch

https://doctorpile.com/assets/accordion-CBjthA7M.js

js doctorpile.com collected 2026-09-28 12:12:22 UTC 6,576 bytes, 1 lines download raw bytes

1import{r as d,l as T,j as a,m as R,n as K,o as F,p as pe,q,v as z,w as ue,x as f,k,y as fe}from"./index-xiHmsbwW.js";import{c as me,u as ve}from"./index-DD7tlXLP.js";var _="Collapsible",[xe,B]=q(_),[Ce,M]=xe(_),U=d.forwardRef((e,r)=>{const{__scopeCollapsible:o,open:t,defaultOpen:s,disabled:n,onOpenChange:c,...l}=e,[p,u]=T({prop:t,defaultProp:s??!1,onChange:c,caller:_});return a.jsx(Ce,{scope:o,disabled:n,contentId:K(),open:p,onOpenToggle:d.useCallback(()=>u(m=>!m),[u]),children:a.jsx(R.div,{"data-state":V(p),"data-disabled":n?"":void 0,...l,ref:r})})});U.displayName=_;var Y="CollapsibleTrigger",J=d.forwardRef((e,r)=>{const{__scopeCollapsible:o,...t}=e,s=M(Y,o);return a.jsx(R.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":V(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...t,ref:r,onClick:F(e.onClick,s.onOpenToggle)})});J.displayName=Y;var $="CollapsibleContent",Q=d.forwardRef((e,r)=>{const{forceMount:o,...t}=e,s=M($,e.__scopeCollapsible);return a.jsx(pe,{present:o||s.open,children:({present:n})=>a.jsx(be,{...t,ref:r,present:n})})});Q.displayName=$;var be=d.forwardRef((e,r)=>{const{__scopeCollapsible:o,present:t,children:s,...n}=e,c=M($,o),[l,p]=d.useState(t),u=d.useRef(null),m=z(r,u),v=d.useRef(0),h=v.current,C=d.useRef(0),w=C.current,b=c.open||l,g=d.useRef(b),A=d.useRef(void 0);return d.useEffect(()=>{const i=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(i)},[]),ue(()=>{const i=u.current;if(i){A.current=A.current||{transitionDuration:i.style.transitionDuration,animationName:i.style.animationName},i.style.transitionDuration="0s",i.style.animationName="none";const I=i.getBoundingClientRect();v.current=I.height,C.current=I.width,g.current||(i.style.transitionDuration=A.current.transitionDuration,i.style.animationName=A.current.animationName),p(t)}},[c.open,t]),a.jsx(R.div,{"data-state":V(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!b,...n,ref:m,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:b&&s})});function V(e){return e?"open":"closed"}var ge=U,Ae=J,he=Q,x="Accordion",Ie=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[H,Re,we]=me(x),[y]=q(x,[we,B]),L=B(),W=f.forwardRef((e,r)=>{const{type:o,...t}=e,s=t,n=t;return a.jsx(H.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?a.jsx(je,{...n,ref:r}):a.jsx(ye,{...s,ref:r})})});W.displayName=x;var[X,Ne]=y(x),[Z,_e]=y(x,{collapsible:!1}),ye=f.forwardRef((e,r)=>{const{value:o,defaultValue:t,onValueChange:s=()=>{},collapsible:n=!1,...c}=e,[l,p]=T({prop:o,defaultProp:t??"",onChange:s,caller:x});return a.jsx(X,{scope:e.__scopeAccordion,value:f.useMemo(()=>l?[l]:[],[l]),onItemOpen:p,onItemClose:f.useCallback(()=>n&&p(""),[n,p]),children:a.jsx(Z,{scope:e.__scopeAccordion,collapsible:n,children:a.jsx(ee,{...c,ref:r})})})}),je=f.forwardRef((e,r)=>{const{value:o,defaultValue:t,onValueChange:s=()=>{},...n}=e,[c,l]=T({prop:o,defaultProp:t??[],onChange:s,caller:x}),p=f.useCallback(m=>l((v=[])=>[...v,m]),[l]),u=f.useCallback(m=>l((v=[])=>v.filter(h=>h!==m)),[l]);return a.jsx(X,{scope:e.__scopeAccordion,value:c,onItemOpen:p,onItemClose:u,children:a.jsx(Z,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(ee,{...n,ref:r})})})}),[Pe,j]=y(x),ee=f.forwardRef((e,r)=>{const{__scopeAccordion:o,disabled:t,dir:s,orientation:n="vertical",...c}=e,l=f.useRef(null),p=z(l,r),u=Re(o),v=ve(s)==="ltr",h=F(e.onKeyDown,C=>{if(!Ie.includes(C.key))return;const w=C.target,b=u().filter(S=>!S.ref.current?.disabled),g=b.findIndex(S=>S.ref.current===w),A=b.length;if(g===-1)return;C.preventDefault();let i=g;const I=0,P=A-1,E=()=>{i=g+1,i>P&&(i=I)},O=()=>{i=g-1,i<I&&(i=P)};switch(C.key){case"Home":i=I;break;case"End":i=P;break;case"ArrowRight":n==="horizontal"&&(v?E():O());break;case"ArrowDown":n==="vertical"&&E();break;case"ArrowLeft":n==="horizontal"&&(v?O():E());break;case"ArrowUp":n==="vertical"&&O();break}const de=i%A;b[de].ref.current?.focus()});return a.jsx(Pe,{scope:o,disabled:t,direction:s,orientation:n,children:a.jsx(H.Slot,{scope:o,children:a.jsx(R.div,{...c,"data-orientation":n,ref:p,onKeyDown:t?void 0:h})})})}),N="AccordionItem",[Ee,G]=y(N),oe=f.forwardRef((e,r)=>{const{__scopeAccordion:o,value:t,...s}=e,n=j(N,o),c=Ne(N,o),l=L(o),p=K(),u=t&&c.value.includes(t)||!1,m=n.disabled||e.disabled;return a.jsx(Ee,{scope:o,open:u,disabled:m,triggerId:p,children:a.jsx(ge,{"data-orientation":n.orientation,"data-state":ce(u),...l,...s,ref:r,disabled:m,open:u,onOpenChange:v=>{v?c.onItemOpen(t):c.onItemClose(t)}})})});oe.displayName=N;var te="AccordionHeader",ne=f.forwardRef((e,r)=>{const{__scopeAccordion:o,...t}=e,s=j(x,o),n=G(te,o);return a.jsx(R.h3,{"data-orientation":s.orientation,"data-state":ce(n.open
1),"data-disabled":n.disabled?"":void 0,...t,ref:r})});ne.displayName=te;var D="AccordionTrigger",re=f.forwardRef((e,r)=>{const{__scopeAccordion:o,...t}=e,s=j(x,o),n=G(D,o),c=_e(D,o),l=L(o);return a.jsx(H.ItemSlot,{scope:o,children:a.jsx(Ae,{"aria-disabled":n.open&&!c.collapsible||void 0,"data-orientation":s.orientation,id:n.triggerId,...l,...t,ref:r})})});re.displayName=D;var ae="AccordionContent",se=f.forwardRef((e,r)=>{const{__scopeAccordion:o,...t}=e,s=j(x,o),n=G(ae,o),c=L(o);return a.jsx(he,{role:"region","aria-labelledby":n.triggerId,"data-orientation":s.orientation,...c,...t,ref:r,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});se.displayName=ae;function ce(e){return e?"open":"closed"}var Oe=W,Se=oe,De=ne,ie=re,le=se;const He=Oe,Te=d.forwardRef(({className:e,...r},o)=>a.jsx(Se,{ref:o,className:k("border-b",e),...r}));Te.displayName="AccordionItem";const ke=d.forwardRef(({className:e,children:r,...o},t)=>a.jsx(De,{className:"flex",children:a.jsxs(ie,{ref:t,className:k("flex flex-1 items-center justify-between py-4 text-sm font-medium cursor-pointer transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",e),...o,children:[r,a.jsx(fe,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));ke.displayName=ie.displayName;const Me=d.forwardRef(({className:e,children:r,...o},t)=>a.jsx(le,{ref:t,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...o,children:a.jsx("div",{className:k("pb-4 pt-0",e),children:r})}));Me.displayName=le.displayName;export{He as A,Te as a,ke as b,Me as c};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.