import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{ht as r,t as i}from"./dist-DtfJeYQK.js";import{t as a}from"./jsx-runtime-C2wGStra.js";import{n as o,t as s}from"./TokyoUIChevronDown-CS0lTt7n.js";import{n as c,t as l}from"./dist-Cc1j9Pjk.js";import{n as u,t as d}from"./Icon-0Ag8a3l4.js";import{n as f,t as p}from"./Text-DO3xXyuu.js";import{n as m,t as h}from"./useMergeRefs-BZP37fIn.js";var g,_,v=t((()=>{g=`accordion__OKb-C`,_={accordion:g}}));function y({ref:e,onOpenChange:t}){let n=(0,b.useRef)(null),r=m(n,e);return(0,b.useEffect)(()=>{if(!n.current)return;let e=n.current,r=()=>{t?.(e.open)};return e&&e.addEventListener(`toggle`,r),()=>{e&&e.removeEventListener(`toggle`,r)}},[t]),{mergedRef:t||e?r:null}}var b,x=t((()=>{b=e(n(),1),h()})),S,C,w,T,E,D,O=t((()=>{S=e(n(),1),i(),o(),l(),u(),f(),v(),x(),C=a(),w=({dataset:e,children:t,"aria-label":n})=>(0,C.jsx)(`div`,{className:_.accordion,"aria-label":n,...r(e),"data-preply-ds-component":c.Accordion,children:t}),T=(0,S.forwardRef)(function({open:e,name:t,dataset:n,children:i,onOpenChange:a},o){let{mergedRef:s}=y({ref:o,onOpenChange:a});return(0,C.jsx)(`details`,{ref:s,name:t,open:e,...r(n),children:i})}),E=(0,S.forwardRef)(function({dataset:e,children:t,onClick:n},i){return(0,C.jsxs)(`summary`,{ref:i,...r(e),onClick:n,children:[(0,C.jsx)(p,{variant:`default-semibold`,children:t}),(0,C.jsx)(d,{svg:s})]})}),D=(0,S.forwardRef)(function({dataset:e,children:t},n){return(0,C.jsx)(p,{tag:`div`,variant:`small-regular`,ref:n,...r(e),children:t})});try{w.displayName=`Accordion`,w.__docgenInfo={description:`An Accordion container.

Add \`AccordionItem\` children to render a list of disclosable contents.`,displayName:`Accordion`,props:{dataset:{defaultValue:null,description:`Sets data attributes on the DOM element.
@example <Accordion dataset={{ 'qa-id': 'benefits' }} /> // will add data-qa-id="benefits" to the HTML element.`,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}try{T.displayName=`AccordionItem`,T.__docgenInfo={description:"A single `Accordion` item, the wrapper of AccordionHeader and AccordionContent.",displayName:`AccordionItem`,props:{onOpenChange:{defaultValue:null,description:"Called whenever the users open/close the Accordion item (mapped to the internal HTML Details's\n`toggle` event).",name:`onOpenChange`,required:!1,type:{name:`enum`,value:[{value:`(open: boolean) => void`}]}},name:{defaultValue:null,description:`Allows to create exclusive Accordions. Just pass the same \`name\` to all the AccordionItem
instances to make the whole Accordion exclusive.
@example <Accordion>
    <AccordionItem name="choose-subscription-duration">
        <AccordionHeader>
            Two-week subscription
        </AccordionHeader>
        <AccordionContent>We will charge you every two weeks.</AccordionContent>
    </AccordionItem>
    <AccordionItem name="choose-subscription-duration">
        <AccordionHeader>
            Four-week subscription
        </AccordionHeader>
        <AccordionContent>We will charge you every four weeks.</AccordionContent>
    </AccordionItem>
</Accordion>`,name:`name`,required:!1,type:{name:`enum`,value:[{value:`string`}]}},dataset:{defaultValue:null,description:`Sets data attributes on the DOM element.
@example <AccordionItem dataset={{ 'qa-id': 'best-tutor-platform' }} /> // will add data-qa-id="best-tutor-platform" to the HTML element.`,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}try{E.displayName=`AccordionHeader`,E.__docgenInfo={description:"The header of a single `Accordion` item, to be used in conjunction with AccordionItem and wrapped inside AccordionContent.",displayName:`AccordionHeader`,props:{dataset:{defaultValue:null,description:``,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}try{D.displayName=`AccordionContent`,D.__docgenInfo={description:"The content of a single `Accordion` item, to be used in conjunction with AccordionHeader wrapped inside AccordionContent.",displayName:`AccordionContent`,props:{dataset:{defaultValue:null,description:`Sets data attributes on the DOM element.
@example <AccordionItem dataset={{ 'qa-id': 'best-tutor-platform' }} /> // will add data-qa-id="best-tutor-platform" to the HTML element.`,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}}));export{O as a,T as i,D as n,E as r,w as t};