<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.educoncepts-sdr.com" class="hidden">太阳城官方入口</a> <a href="http://www.turuntilataksit.net" class="hidden">太阳城</a> <a href="http://www.iconfuture.net" class="hidden">太阳城</a> <a href="http://www.c178.net" class="hidden">Online-betting-website-support@c178.net</a> <a href="http://www.hairstylescn.com" class="hidden">bbin-help@hairstylescn.com</a> <a href="http://www.c178.net" class="hidden">Gaming-platform-support@c178.net</a> <a href="http://www.shushijia.net" class="hidden">韦德</a> <a href="http://www.cesametal.net" class="hidden">Asian-gaming-customerservice@cesametal.net</a> <a href="http://www.braelyngenerator.net" class="hidden">太阳城</a> <a href="http://www.lyhymh.net" class="hidden">体育博彩平台</a> <a href="http://www.lyhymh.net" class="hidden">博彩平台</a> <a href="http://www.eduftp.net" class="hidden">太阳城</a> <a href="http://web-sitemap.dichvuchayquangcao.net" class="hidden">北大法律信息网 </a> <a href="http://www.c178.net" class="hidden">博彩平台</a> <a href="http://www.tdwang.net" class="hidden">Crown-Sports-sales@tdwang.net</a> <a href="http://fmgmor.yujiayan.net" class="hidden">六安人才网</a> <a href="http://www.katarre.com" class="hidden">European-Cup-buying-careers@katarre.com</a> <a href="http://www.rdsy.net" class="hidden">Crown-Sports-Betting-help@rdsy.net</a> <a href="http://www.jyycl.com" class="hidden">Crown-betting-support@jyycl.com</a> <a href="http://www.haerbinjiudian.com" class="hidden">沙巴体育官网</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️最新网址:la55.net✔️凯时kb88手机登录-维基百科" class="hidden">女生私房话情感频道</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=澳门新萄京app>>✔️最新网址:la55.net✔️手输<<" class="hidden">中国水工业网</a> <a href="https://es-la.facebook.com/public/>>✔️网址:ad11.net✔️手输<<银河游戏官方网.owg" class="hidden">小皮手游发号中心</a> <a href="https://acrmc.com/search/网赌信誉排行前十的✔️官方网址:la777.net✔️网赌信誉排行前十的✔️官方网址:la777.net✔️" class="hidden">中国商务网</a> <a href="https://es-la.facebook.com/public/✔️官方网址:la777.net✔️科普一下电竞赛事竞猜平台的百科✔️官方网址:la777.net✔️科普一下电竞赛事竞猜平台的百科.soz" class="hidden">咸阳赶集网</a> <a href="https://es-la.facebook.com/public/✔️官方网址:la777.net✔️科普一下冰球突破豪华版试玩的百科✔️官方网址:la777.net✔️科普一下冰球突破豪华版试玩的百科.nlp" class="hidden">星星动漫网</a> <a href="https://es-la.facebook.com/public/皇冠365app下载-维基百科✔️网址:ad11.net✔️" class="hidden">携程合作卡专区</a> <a href="https://es-la.facebook.com/public/✔️最新网址:la55.net✔️大阳城娱乐在线平台" class="hidden">中国▪朔州</a> <a href="https://m.facebook.com/public/亚洲十大信誉电子平台-维基百科✔️网址:la666.net✔️亚洲十大信誉电子平台-维基百科✔️网址:la666.net✔️" class="hidden">爱菲音响商城</a> <a href="https://m.facebook.com/public/✔️网址:ad11.net✔️pg电子游戏哪个平台好-pg电子游戏哪个平台好官方网站.top" class="hidden">中国商务网</a> <a href="/CN/ujowkx-505321.html" class="hidden">阿峰SEO博客</a> <a href="/html/lxvxzh-138425.html" class="hidden">搜狐出国</a> <a href="/html/mnzvgq-384992" class="hidden">金投专家</a> <a href="/cn/morrur-852329" class="hidden">易登山西分类信息网</a> <a href="/sttcs/hot-news/Algenib.html" class="hidden">新课程</a> </body></html>