PageSourceSearch

https://olivierjacob.com/assets/AccessibleFAQ-0sEF2BBw.js

js olivierjacob.com collected 2026-10-07 20:01:40 UTC 9,649 bytes, 6 lines download raw bytes

1import{r as s,e as de,j as o}from"./react-vendor-DiyUMUSL.js";import{e as U,c as pe,a as J,P as y,d as Y,f as ue,u as W,g as M,a3 as fe}from"./app-DJLb4cTQ.js";import{u as k,c as me}from"./index-Gzcn_Nnl.js";var xe=Object.defineProperty,ge=(t,e)=>xe(t,"name",{value:e,configurable:!0}),ve=de[" useId ".trim().toString()]||(()=>{}),be=0;function V(t){const[e,a]=s.useState(ve());return U(()=>{t||a(n=>n??String(be++))},[t]),t||(e?`radix-${e}`:"")}ge(V,"useId");/**
2 * @license lucide-react v0.544.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ce=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],he=pe("circle-question-mark",Ce);var Ae=Object.defineProperty,j=(t,e)=>Ae(t,"name",{value:e,configurable:!0}),H="Collapsible",[Ie,X]=J(H),[_e,L]=Ie(H),ye=s.forwardRef(j(function(e,a){const{__scopeCollapsible:n,open:i,defaultOpen:c,disabled:r,onOpenChange:l,...u}=e,[m,x]=k({prop:i,defaultProp:c??!1,onChange:l,caller:H});return o.jsx(_e,{scope:n,disabled:r,contentId:V(),open:m,onOpenToggle:s.useCallback(()=>x(d=>!d),[x]),children:o.jsx(y.div,{"data-state":w(m),"data-disabled":r?"":void 0,...u,ref:a})})},"Collapsible")),je="CollapsibleTrigger",Ne=s.forwardRef(j(function(e,a){const{__scopeCollapsible:n,...i}
6=e,c=L(je,n);return o.jsx(y.button,{type:"button","aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open||!1,"data-state":w(c.open),"data-disabled":c.disabled?"":void 0,disabled:c.disabled,...i,ref:a,onClick:Y(e.onClick,c.onOpenToggle)})},"CollapsibleTrigger")),Z="CollapsibleContent",we=s.forwardRef(j(function(e,a){const{forceMount:n,...i}=e,c=L(Z,e.__scopeCollapsible);return o.jsx(ue,{present:n||c.open,children:({present:r})=>o.jsx(Pe,{...i,ref:a,present:r})})},"CollapsibleContent")),Pe=s.forwardRef(j(function(e,a){const{__scopeCollapsible:n,present:i,children:c,...r}=e,l=L(Z,n),[u,m]=s.useState(i),x=s.useRef(null),d=W(a,x),p=s.useRef(0),I=p.current,b=s.useRef(0),N=b.current,C=l.open||u,h=s.useRef(C),A=s.useRef(void 0);return s.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),U(()=>{const f=x.current;if(f){A.current=A.current||{transitionDuration:f.style.transitionDuration,animationName:f.style.animationName},f.style.transitionDuration="0s",f.style.animationName="none";const _=f.getBoundingClientRect();p.current=_.height,b.current=_.width,h.current||(f.style.transitionDuration=A.current.transitionDuration,f.style.animationName=A.current.animationName),m(i)}},[l.open,i]),o.jsx(y.div,{"data-state":w(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!C,...r,ref:d,style:{"--radix-collapsible-content-height":I?`${I}px`:void 0,"--radix-collapsible-content-width":N?`${N}px`:void 0,...e.style},children:C&&c})},"CollapsibleContentImpl"));function w(t){return t?"open":"closed"}j(w,"getState");var Re=ye,Se=Ne,Ee=we,Oe=Object.defineProperty,Te=(t,e)=>Oe(t,"name",{value:e,configurable:!0}),$e=s.createContext(void 0);function ee(t){const e=s.useContext($e);return t||e||"ltr"}Te(ee,"useDirection");var De=Object.defineProperty,g=(t,e)=>De(t,"name",{value:e,configurable:!0}),v="Accordion",Me=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[q,ke,Ve]=me(v),[P,ro]=J(v,[Ve,X]),F=X(),He=s.forwardRef(g(function(e,a){const{type:n,...i}=e,c=i,r=i;return o.jsx(q.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?o.jsx(Ge,{...r,ref:a}):o.jsx(Fe,{...c,ref:a})})},"Accordion")),[oe,Le]=P(v),[ne,qe]=P(v,{collapsible:!1}),Fe=s.forwardRef(g(function(e,a){const{value:n,defaultValue:i,onValueChange:c=g(()=>{},"onValueChange"),collapsible:r=!1,...l}=e,[u,m]=k({prop:n,defaultProp:i??"",onChange:c,caller:v});return o.jsx(oe,{scope:e.__scopeAccordion,value:s.useMemo(()=>u?[u]:[],[u]),onItemOpen:m,onItemClose:s.useCallback(()=>r&&m(""),[r,m]),children:o.jsx(ne,{scope:e.__scopeAccordion,collapsible:r,children:o.jsx(te,{...l,ref:a})})})},"AccordionImplSingle")),Ge=s.forwardRef(g(function(e,a){const{value:n,defaultValue:i,onValueChange:c=g(()=>{},"onValueChange"),...r}=e,[l,u]=k({prop:n,defaultProp:i??[],onChange:c,caller:v}),m=s.useCallback(d=>u((p=[])=>[...p,d]),[u]),x=s.useCallback(d=>u((p=[])=>p.filter(I=>I!==d)),[u]);return o.jsx(oe,{scope:e.__scopeAccordion,value:l,onItemOpen:m,onItemClose:x,children:o.jsx(ne,{scope:e.__scopeAccordion,collapsible:!0,children:o.jsx(te,{...r,ref:a})})})},"AccordionImplMultiple")),[Ke,R]=P(v),te=s.forwardRef(g(function(e,a){const{__scopeAccordion:n,disabled:i,dir:c,orientation:r="vertical",...l}=e,u=s.useRef(null),m=W(u,a),x=ke(n),p=ee(c)==="ltr",I=Y(e.onKeyDown,b=>{var Q;if(!Me.includes(b.key))return;const N=b.target,C=x().filter(T=>{var z;return!((z=T.ref.current)!=null&&z.disabled)}),h=C.findIndex(T=>T.ref.current===N),A=C.length;if(h===-1)return;b.preventDefault();let f=h;const _=0,S=A-1,E=g(()=>{f=h+1,f>S&&(f=_)},"moveNext"),O=g(()=>{f=h-1,f<_&&(f=S)},"movePrev");switch(b.key){case"Home":f=_;break;case"End":f=S;break;case"ArrowRight":r==="horizontal"&&(p?E():O());break;case"ArrowDown":r==="vertical"&&E();break;case"ArrowLeft":r==="horizontal"&&(p?O():E());break;case"ArrowUp":r==="vertical"&&O();break}const le=f%A;(Q=C[le].ref.current)==null||Q.focus()});return o.jsx(Ke,{scope:n,disabled:i,direction:c,orientation:r,children:o.jsx(q.Slot,{scope:n,children:o.jsx(y.div,{...l,"data-orientation":r,ref:m,onKeyDown:i?void 0:I})})})},"AccordionImpl")),D="AccordionItem",[Qe,G]=P(D),ze=s.forwardRef(g(function(e,a){const{__scopeAccordion:n,value:i,...c}=e,r=R(D,n),l=Le(D,n),u=F(n),m=V(),x=i&&l.value.includes(i)||!1,d=r.disabled||e.disabled;return o.jsx(Qe,{scope:n,open:x,disabled:d,triggerId:m,children:o.jsx(Re,{"data-orientation":r.orientation,"data-state":K(x),...u,...c,ref:a,disabled:d,open:x,onOpenChange:p=>{p?l.onItemOpen(i):l.onItemClose(i)}})})},"AccordionItem")),Be="AccordionHeader",Ue=s.forwardRef(g(function(e,a){const{__scopeAccordion:n,...i}=e,c=R(v,n),r=G(Be,n);return o.jsx(y.h3,{"data-orientation":c.orientation,"data-state":K(r.open),"data-disabled":r.disabled?"":void 0,...i,ref:a})},"AccordionHeader")),B="AccordionTrigger",Je=s.forwardRef(g(function(e,a){const{__scopeAccordion:n,...i}=e,c=R(v,n),r=G(B,n),l=qe(B,n),u=F(n);return o.jsx(q.ItemSlot,{scope:n,children:o.jsx(Se,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...u,...i,ref:a})})},"AccordionTrigger")),Ye="AccordionContent",We=s.forwardRef(g(function(e,a){const{__scopeAccordion:n,...i}=e,c=R(v,n),r=G(Ye,n),l=F(n);return o.jsx(Ee,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...l,...i,ref:a,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})},"AccordionContent"));function K(t){return t?"open":"closed"}g(K,"getState");var Xe=He,Ze=ze,eo=Ue,re=Je,ae=We;const $=Xe,ce=s.forwardRef(({className:t,...e},a)=>o.jsx(Ze,{ref:a,className:M("border-b",t),...e}));ce.displayName="AccordionItem";const ie=s.forwardRef(({className:t,children:e,...a},n)=>o.jsx(eo,{className:"flex",children:o.jsxs(re,{ref:n,className:M("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[e,o.jsx(fe,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));
6ie.displayName=re.displayName;const se=s.forwardRef(({className:t,children:e,...a},n)=>o.jsx(ae,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:o.jsx("div",{className:M("pb-4 pt-0",t),children:e})}));se.displayName=ae.displayName;const ao=({title:t,items:e,lang:a="de",twoColumn:n=!1,maxWidthClass:i="max-w-4xl",defaultOpenFirst:c=!0})=>{const r={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map((d,p)=>({"@type":"Question",name:d.question,acceptedAnswer:{"@type":"Answer",text:d.answer}}))},l=(d,p)=>o.jsxs(ce,{value:`item-${p}`,className:"border border-border rounded-lg px-6 py-2 hover:bg-muted/50 transition-colors",children:[o.jsx(ie,{className:"text-left hover:no-underline py-4","aria-describedby":`faq-answer-${p}`,children:o.jsx("span",{className:"font-medium text-lg pr-4",children:d.question})}),o.jsx(se,{id:`faq-answer-${p}`,className:"text-muted-foreground pb-4 pt-2 leading-relaxed",children:d.answer})]},p),u=Math.ceil(e.length/2),m=e.slice(0,u),x=e.slice(u);return o.jsxs("section",{className:"py-16","aria-labelledby":"faq-heading",children:[o.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(r)}}),o.jsxs("div",{className:`container ${i} mx-auto px-4`,children:[o.jsx("div",{className:"text-center mb-12",children:o.jsxs("div",{className:"flex items-center justify-center mb-4",children:[o.jsx(he,{className:"w-8 h-8 text-primary mr-3","aria-hidden":"true"}),o.jsx("h2",{id:"faq-heading",className:"text-3xl font-bold",children:t})]})}),n?o.jsxs("div",{className:"grid lg:grid-cols-2 gap-4 lg:gap-6 items-start",children:[o.jsx($,{type:"single",collapsible:!0,className:"space-y-4","aria-label":`${t} (1)`,defaultValue:c?"item-0":void 0,children:m.map((d,p)=>l(d,p))}),o.jsx($,{type:"single",collapsible:!0,className:"space-y-4","aria-label":`${t} (2)`,children:x.map((d,p)=>l(d,p+u))})]}):o.jsx($,{type:"single",collapsible:!0,className:"space-y-4","aria-label":t,defaultValue:c?"item-0":void 0,children:e.map((d,p)=>l(d,p))})]})]})};export{ao as A,V as a,ee as u};

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.