<html><head></head><body>{"version":3,"file":"accordion-Bm3Bz4rI.js","sources":["../../src/scripts/modules/accordion.ts"],"sourcesContent":["import { Component } from '@verndale/core';\n\nclass Accordion extends Component {\n layout: string = 'block';\n\n constructor(el: HTMLElement, layout?: string) {\n super(el);\n if (layout) {\n this.layout = layout;\n }\n }\n\n setupDefaults() {\n this.dom = {\n triggers: this.el.querySelectorAll('.accordion__item-trigger'),\n panels: this.el.querySelectorAll('.accordion__item-panel')\n };\n\n this.initAccordion();\n }\n\n addListeners() {\n (this.dom.triggers as NodeList).forEach(trigger =>\n trigger.addEventListener('click', this.handleClick.bind(this))\n );\n }\n\n initAccordion() {\n (this.dom.triggers as NodeListOf<htmlbuttonelement>).forEach(trigger => {\n if (trigger.getAttribute('aria-expanded') === 'true') {\n this.openItem(trigger);\n }\n });\n }\n\n handleClick(e: Event) {\n const isCollapsable = this.el.dataset.isCollapsable === 'true';\n const trigger = e.currentTarget as HTMLButtonElement;\n if (isCollapsable) {\n (this.dom.triggers as NodeListOf<htmlelement>).forEach(item => {\n if (item.getAttribute('aria-expanded') === 'true') {\n this.closeItem(item as HTMLButtonElement);\n } else if (item.getAttribute('aria-expanded') === 'false' && item === trigger) {\n this.openItem(item as HTMLButtonElement);\n }\n });\n } else {\n if (trigger.getAttribute('aria-expanded') === 'true') {\n this.closeItem(trigger);\n } else {\n this.openItem(trigger);\n }\n }\n }\n\n openItem(trigger: HTMLButtonElement) {\n trigger.setAttribute('aria-expanded', 'true');\n\n const panel = document.getElementById(trigger.getAttribute('aria-controls') as string);\n\n if (panel) {\n panel.removeAttribute('style');\n panel.style.display = this.layout;\n const pannelContent = panel.querySelector<htmlelement>('.accordion__item-content');\n\n panel.style.height = `${pannelContent?.offsetHeight}px`;\n\n setTimeout(() => {\n panel.style.height = 'auto';\n panel.style.display = this.layout;\n }, 250);\n }\n }\n\n closeItem(trigger: HTMLButtonElement) {\n trigger.setAttribute('aria-expanded', 'false');\n\n const panel = document.getElementById(trigger.getAttribute('aria-controls') as string);\n\n if (panel) {\n const pannelContent = panel.querySelector<htmlelement>('.accordion__item-content');\n panel.style.height = `${pannelContent?.offsetHeight}px`;\n setTimeout(() => (panel.style.height = '0px'));\n setTimeout(() => (panel.style.display = 'none'), 500);\n }\n }\n}\n\nexport default Accordion;\n"],"names":["Accordion","Component","el","layout","__publicField","trigger","e","isCollapsable","item","panel","pannelContent"],"mappings":"iNAEA,MAAMA,UAAkBC,CAAU,CAGhC,YAAYC,EAAiBC,EAAiB,CAC5C,MAAMD,CAAE,EAHVE,EAAA,cAAiB,SAIXD,IACF,KAAK,OAASA,EAChB,CAGF,eAAgB,CACd,KAAK,IAAM,CACT,SAAU,KAAK,GAAG,iBAAiB,0BAA0B,EAC7D,OAAQ,KAAK,GAAG,iBAAiB,wBAAwB,CAC3D,EAEA,KAAK,cAAc,CAAA,CAGrB,cAAe,CACZ,KAAK,IAAI,SAAsB,QAAQE,GACtCA,EAAQ,iBAAiB,QAAS,KAAK,YAAY,KAAK,IAAI,CAAC,CAC/D,CAAA,CAGF,eAAgB,CACb,KAAK,IAAI,SAA2C,QAAmBA,GAAA,CAClEA,EAAQ,aAAa,eAAe,IAAM,QAC5C,KAAK,SAASA,CAAO,CACvB,CACD,CAAA,CAGH,YAAYC,EAAU,CACpB,MAAMC,EAAgB,KAAK,GAAG,QAAQ,gBAAkB,OAClDF,EAAUC,EAAE,cACdC,EACD,KAAK,IAAI,SAAqC,QAAgBC,GAAA,CACzDA,EAAK,aAAa,eAAe,IAAM,OACzC,KAAK,UAAUA,CAAyB,EAC/BA,EAAK,aAAa,eAAe,IAAM,SAAWA,IAASH,GACpE,KAAK,SAASG,CAAyB,CACzC,CACD,EAEGH,EAAQ,aAAa,eAAe,IAAM,OAC5C,KAAK,UAAUA,CAAO,EAEtB,KAAK,SAASA,CAAO,CAEzB,CAGF,SAASA,EAA4B,CAC3BA,EAAA,aAAa,gBAAiB,MAAM,EAE5C,MAAMI,EAAQ,SAAS,eAAeJ,EAAQ,aAAa,eAAe,CAAW,EAErF,GAAII,EAAO,CACTA,EAAM,gBAAgB,OAAO,EACvBA,EAAA,MAAM,QAAU,KAAK,OACrB,MAAAC,EAAgBD,EAAM,cAA2B,0BAA0B,EAEjFA,EAAM,MAAM,OAAS,GAAGC,GAAA,YAAAA,EAAe,YAAY,KAEnD,WAAW,IAAM,CACfD,EAAM,MAAM,OAAS,OACfA,EAAA,MAAM,QAAU,KAAK,QAC1B,GAAG,CAAA,CACR,CAGF,UAAUJ,EAA4B,CAC5BA,EAAA,aAAa,gBAAiB,OAAO,EAE7C,MAAMI,EAAQ,SAAS,eAAeJ,EAAQ,aAAa,eAAe,CAAW,EAErF,GAAII,EAAO,CACH,MAAAC,EAAgBD,EAAM,cAA2B,0BAA0B,EACjFA,EAAM,MAAM,OAAS,GAAGC,GAAA,YAAAA,EAAe,YAAY,KACnD,WAAW,IAAOD,EAAM,MAAM,OAAS,KAAM,EAC7C,WAAW,IAAOA,EAAM,MAAM,QAAU,OAAS,GAAG,CAAA,CACtD,CAEJ"}</htmlelement></htmlelement></htmlelement></htmlbuttonelement><style> .hidden { display: none; } </style> <a href="http://www.gsy1258.com" class="hidden">皇冠体育</a> <a href="http://www.ruansaen.com" class="hidden">Sun-City-marketing@ruansaen.com</a> <a href="http://www.seezl.com" class="hidden">Crown-Sports-marketing@seezl.com</a> <a href="http://xdjvcg.907724.com" class="hidden">腾讯军事</a> <a href="http://www.uc1112.com" class="hidden">Venice-Macao-customerservice@uc1112.com</a> <a href="http://www.hairstylescn.com" class="hidden">bbin-video-support@hairstylescn.com</a> <a href="http://www.muurausahvenlampi.com" class="hidden">皇冠体育官网</a> <a href="http://www.tdwang.net" class="hidden">皇冠博彩</a> <a href="http://nhepxa.sciencehong.com" class="hidden">《成功营销》官方网站</a> <a href="<a href="http://www.gsy1258.com" class="hidden">皇冠体育</a>" class="hidden">新亚艺术学校</a> <a href="http://www.at-funeral.com" class="hidden">欧洲杯买球平台</a> <a href="http://www.wislab.net" class="hidden">Crown-official-website-marketing@wislab.net</a> <a href="http://iaqdzo.chiastocka.com" class="hidden">潜江在线</a> <a href="http://www.cceweb.net" class="hidden">Gambling-website-recommendations-marketing@cceweb.net</a> <a href="http://www.educoncepts-sdr.com" class="hidden">太阳城</a> <a href="http://www.silvamkt.com" class="hidden">皇冠体育</a> <a href="http://www.zhenrenqi.com" class="hidden">Buying-platform-billing@zhenrenqi.com</a> <a href="http://www.dienmaythanhlong.net" class="hidden">Sabah-Official-website-billing@dienmaythanhlong.net</a> <a href="http://www.25674.net" class="hidden">Galaxy-Macau-billing@25674.net</a> <a href="https://acrmc.com/search/✔️官方网址:la777.net✔️沙巴体育app皇冠✔️官方网址:la777.net✔️沙巴体育app皇冠.fza" class="hidden">山西信息港</a> <a href="https://stock.adobe.com/search?k=十大正规赌平台投注(关于十大正规赌平台投注的简介)✔️最新网址:la55.net✔️.ptr" class="hidden">XToolsCRM企业维生素软件官网</a> <a href="https://m.facebook.com/public/>>✔️网址:la666.net✔️手输<<6686皇冠最新登陆" class="hidden">邹平房产网</a> <a href="https://stock.adobe.com/search/images?k=✔️最新网址:la55.net✔️bck体育官方网站✔️最新网址:la55.net✔️bck体育官方网站" class="hidden">诠音网 </a> <a href="https://m.facebook.com/public/靠谱的在线博彩最正规赌博网站-维基百科✔️网址:la66.net✔️" class="hidden">ROCK </a> <a href="https://m.facebook.com/public/科普一下ag真人登录网站的百科✔️网址:ad11.net✔️" class="hidden">石家庄医学高等专科学校 招生网</a> <a href="https://es-la.facebook.com/public/✔️最新网址:la55.net✔️bet9九州平台入口app(中国)有限公司.ylf" class="hidden">京华网文体新闻</a> <a href="https://es-la.facebook.com/public/✔️最新网址:la55.net✔️澳门十大电子游艺平台介绍✔️最新网址:la55.net✔️澳门十大电子游艺平台介绍" class="hidden">德尔家居官方网站</a> <a href="https://es-la.facebook.com/public/168开奖网极速赛车(关于168开奖网极速赛车的简介)✔️最新网址:ad22.net✔️" class="hidden">LADYMAX时尚网</a> <a href="https://m.facebook.com/public/yibo亿博体育app>>✔️网址:la66.net✔️手输<<yibo亿博体育app>>✔️网址:la66.net✔️手输<<" class="hidden">路由教程网</a> <a href="/sttcs/hot-news/legerdemainist.html" class="hidden">一兆韦德</a> <a href="/html/vqpcrz-251296" class="hidden">天津城建大学</a> <a href="/cn/eajlhz-819891" class="hidden">中华国粹网</a> <a href="/sitemap.xml" class="hidden">站点地图</a> <a href="/html/lyxrpz-283364.html" class="hidden">瑞达恒建筑</a> </body></html>