PageSourceSearch

https://lenswise.app/_next/static/chunks/accordion-CB4krLXF.js

js lenswise.app collected 2026-10-08 10:35:01 UTC 7,295 bytes, 1 lines download raw bytes

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

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.