PageSourceSearch

https://thaibusinesshelp.com/assets/accordion-CYrj-yqP.js

js thaibusinesshelp.com collected 2026-10-07 20:36:46 UTC 4,568 bytes, 1 lines download raw bytes

1import{ae as l,j as n,bd as Z,aE as T,be as ee,aD as M,aF as oe,aO as re,aG as te,aJ as ne,r as P,aL as E,b3 as ae}from"./index-DKfS0dCJ.js";import{R as ce,T as se,b as ie,c as V}from"./index-DyaquHP1.js";var d="Accordion",le=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[S,de,pe]=Z(d),[g]=ne(d,[pe,V]),D=V(),H=l.forwardRef((o,a)=>{const{type:e,...t}=o,c=t,r=t;return n.jsx(S.Provider,{scope:o.__scopeAccordion,children:e==="multiple"?n.jsx(xe,{...r,ref:a}):n.jsx(me,{...c,ref:a})})});H.displayName=d;var[K,fe]=g(d),[L,ue]=g(d,{collapsible:!1}),me=l.forwardRef((o,a)=>{const{value:e,defaultValue:t,onValueChange:c=()=>{},collapsible:r=!1,...i}=o,[s,p]=T({prop:e,defaultProp:t??"",onChange:c,caller:d});return n.jsx(K,{scope:o.__scopeAccordion,value:l.useMemo(()=>s?[s]:[],[s]),onItemOpen:p,onItemClose:l.useCallback(()=>r&&p(""),[r,p]),children:n.jsx(L,{scope:o.__scopeAccordion,collapsible:r,children:n.jsx($,{...i,ref:a})})})}),xe=l.forwardRef((o,a)=>{const{value:e,defaultValue:t,onValueChange:c=()=>{},...r}=o,[i,s]=T({prop:e,defaultProp:t??[],onChange:c,caller:d}),p=l.useCallback(x=>s((u=[])=>[...u,x]),[s]),m=l.useCallback(x=>s((u=[])=>u.filter(h=>h!==x)),[s]);return n.jsx(K,{scope:o.__scopeAccordion,value:i,onItemOpen:p,onItemClose:m,children:n.jsx(L,{scope:o.__scopeAccordion,collapsible:!0,children:n.jsx($,{...r,ref:a})})})}),[ve,b]=g(d),$=l.forwardRef((o,a)=>{const{__scopeAccordion:e,disabled:t,dir:c,orientation:r="vertical",...i}=o,s=l.useRef(null),p=oe(s,a),m=de(e),u=re(c)==="ltr",h=te(o.onKeyDown,v=>{if(!le.includes(v.key))return;const W=v.target,I=m().filter(_=>!_.ref.current?.disabled),A=I.findIndex(_=>_.ref.current===W),O=I.length;if(A===-1)return;v.preventDefault();let f=A;const w=0,j=O-1,R=()=>{f=A+1,f>j&&(f=w)},N=()=>{f=A-1,f<w&&(f=j)};switch(v.key){case"Home":f=w;break;case"End":f=j;break;case"ArrowRight":r==="horizontal"&&(u?R():N());break;case"ArrowDown":r==="vertical"&&R();break;case"ArrowLeft":r==="horizontal"&&(u?N():R());break;case"ArrowUp":r==="vertical"&&N();break}const X=f%O;I[X].ref.current?.focus()});return n.jsx(ve,{scope:e,disabled:t,direction:c,orientation:r,children:n.jsx(S.Slot,{scope:e,children:n.jsx(M.div,{...i,"data-orientation":r,ref:p,onKeyDown:t?void 0:h})})})}),C="AccordionItem",[Ae,k]=g(C),G=l.forwardRef((o,a)=>{const{__scopeAccordion:e,value:t,...c}=o,r=b(C,e),i=fe(C,e),s=D(e),p=ee(),m=t&&i.value.includes(t)||!1,x=r.disabled||o.disabled;return n.jsx(Ae,{scope:e,open:m,disabled:x,triggerId:p,children:n.jsx(ce,{"data-orientation":r.orientation,"data-state":q(m),...s,...c,ref:a,disabled:x,open:m,onOpenChange:u=>{u?i.onItemOpen(t):i.onItemClose(t)}})})});G.displayName=C;var z="AccordionHeader",U=l.forwardRef((o,a)=>{const{__scopeAccordion:e,...t}=o,c=b(d,e),r=k(z,e);return n.jsx(M.h3,{"data-orientation":c.orientation,"data-state":q(r.open),"data-disabled":r.disabled?"":void 0,...t,ref:a})});U.displayName=z;var y="AccordionTrigger",F=l.forwardRef((o,a)=>{const{__scopeAccordion:e,...t}=o,c=b(d,e),r=k(y,e),i=ue(y,e),s=D(e);return n.jsx(S.ItemSlot,{scope:e,children:n.jsx(se,{"aria-disabled":r.open&&!i.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...s,...t,ref:a})})});F.displayName=y;var J="AccordionContent",Y=l.forwardRef((o,a)=>{const{__scopeAccordion:e,...t}=o,c=b(d,e),r=k(J,e),i=D(e);return n.jsx(ie,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...i,...t,ref:a,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...o.style}})});Y.displayName=J;function q(o){return o?"open":"closed"}var Ce=H,ge=G,be=U,B=F,Q=Y;const Ne=Ce,he=P.forwardRef(({className:o,...a},e)=>n.jsx(ge,{ref:e,className:E("border-b",o),...a}));he.displayName="AccordionItem";const Ie=P.forwardRef(({className:o,children:a,...e},t)=>n.jsx(be,{className:"flex",children:n.jsxs(B,{ref:t,className:E("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",o),...e,children:[a,n.jsx(ae,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Ie.displayName=B.displayName;const we=P.forwardRef(({className:o,children:a,...e},t)=>n.jsx(Q,{ref:t,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...e,children:n.jsx("div",{className:E("pb-4 pt-0",o),children:a})}));
1we.displayName=Q.displayName;export{Ne as A,he as a,Ie as b,we 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.