<html><head></head><body>{"version":3,"file":"dropdown-Fyhlu80G.js","sources":["../../src/scripts/modules/dropdown.ts"],"sourcesContent":["import { Component } from '@verndale/core';\n\nclass Dropdown extends Component {\n customOptsList: HTMLElement[];\n optionChecked: string = '';\n optionHoveredIndex: number = -1;\n\n constructor(el: HTMLElement) {\n super(el);\n this.dom.elSelectCustom = document.querySelectorAll('.js-select-custom')[0] as HTMLElement;\n this.dom.elSelectCustomBox = this.dom.elSelectCustom.querySelector(\n '.select-custom-trigger'\n ) as HTMLElement;\n this.dom.elSelectCustomOpts = this.dom.elSelectCustom.children[1] as HTMLElement;\n this.dom.svg = this.el.querySelector<htmlelement>('.select-custom-trigger-wrapper svg');\n this.customOptsList = Array.from(this.dom.elSelectCustomOpts.children) as HTMLElement[];\n }\n\n setupDefaults() {\n this.dom = {\n el: this.el,\n elSelectNative: this.el.querySelector<htmlselectelement>('.js-select-native'),\n elSelectCustom: this.el.querySelector<htmlelement>('.js-select-custom'),\n elSelectCustomBox:\n (this.el.querySelector<htmlelement>('.js-select-custom')?.children[0] as HTMLElement) ||\n null,\n elSelectCustomOpts:\n (this.el.querySelector<htmlelement>('.js-select-custom')?.children[1] as HTMLElement) ||\n null\n };\n\n this.customOptsList = Array.from(\n (this.dom.elSelectCustomOpts as HTMLElement).children\n ) as HTMLElement[];\n this.optionHoveredIndex = this.customOptsList.length - 1;\n }\n\n addListeners() {\n (this.dom.elSelectCustomBox as HTMLElement).addEventListener(\n 'click',\n this.toggleCustomSelect.bind(this)\n );\n (this.dom.elSelectNative as HTMLInputElement).addEventListener(\n 'change',\n this.syncNativeSelect.bind(this)\n );\n\n this.customOptsList.forEach((elOption, index) => {\n (elOption as HTMLElement).addEventListener('click', e => this.optionClickHandler(e));\n (elOption as HTMLElement).addEventListener('mouseenter', () =>\n this.updateCustomSelectHovered(index)\n );\n });\n\n document.addEventListener('click', this.watchClickOutside.bind(this));\n document.addEventListener('keydown', this.supportKeyboardNavigation.bind(this));\n }\n\n toggleCustomSelect() {\n const isClosed = !(this.dom.elSelectCustom as HTMLElement).classList.contains('isActive');\n\n if (isClosed) {\n this.openSelectCustom();\n } else {\n this.closeSelectCustom();\n }\n }\n\n openSelectCustom() {\n (this.dom.elSelectCustom as HTMLElement).classList.add('isActive');\n (this.dom.elSelectCustom as HTMLElement).setAttribute('aria-hidden', 'false');\n\n if (this.optionChecked) {\n const optionCheckedIndex = this.customOptsList.findIndex(\n el => el.getAttribute('data-value') === this.optionChecked\n );\n this.updateCustomSelectHovered(optionCheckedIndex);\n }\n\n (this.dom.svg as HTMLElement).style.transform = 'rotate(180deg)';\n }\n\n closeSelectCustom(): void {\n (this.dom.elSelectCustom as HTMLElement).classList.remove('isActive');\n (this.dom.elSelectCustom as HTMLElement).setAttribute('aria-hidden', 'true');\n this.updateCustomSelectHovered(-1);\n\n (this.dom.svg as HTMLElement).style.transform = 'rotate(0deg)';\n }\n\n updateCustomSelectHovered(newIndex: number): void {\n const prevOption = (this.dom.elSelectCustomOpts as HTMLElement).children[\n this.optionHoveredIndex\n ];\n const option = (this.dom.elSelectCustomOpts as HTMLElement).children[newIndex];\n\n if (prevOption) {\n prevOption.classList.remove('isHover');\n }\n if (option) {\n option.classList.add('isHover');\n }\n\n this.optionHoveredIndex = newIndex;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n optionClickHandler(e: MouseEvent) {\n const target = e.target as HTMLElement;\n const value = target.getAttribute('data-value') || '';\n\n (this.dom.elSelectNative as HTMLInputElement).value = value;\n (this.dom.elSelectNative as HTMLInputElement).dispatchEvent(\n new Event('change', { bubbles: true })\n );\n this.updateCustomSelectChecked(value, target.textContent || '');\n this.closeSelectCustom();\n }\n\n syncNativeSelect(e: Event) {\n const target = e.target as HTMLSelectElement;\n const value = target.value;\n const elRespectiveCustomOption = (this.dom.elSelectCustomOpts as HTMLElement).querySelector(\n `[data-value=\"${value}\"]`\n ) as HTMLElement;\n\n this.updateCustomSelectChecked(value, elRespectiveCustomOption.textContent || '');\n }\n\n updateCustomSelectChecked(value: string, text: string) {\n const prevValue = this.optionChecked;\n const elPrevOption = (this.dom.elSelectCustomOpts as HTMLElement).querySelector(\n `[data-value=\"${prevValue}\"]`\n ) as HTMLElement;\n const elOption = (this.dom.elSelectCustomOpts as HTMLElement).querySelector(\n `[data-value=\"${value}\"]`\n ) as HTMLElement;\n\n if (elPrevOption) {\n elPrevOption.classList.remove('isActive');\n }\n\n if (elOption) {\n elOption.classList.add('isActive');\n }\n\n (this.dom.elSelectCustomBox as HTMLElement).dataset.state = 'slide-in';\n (this.dom.elSelectCustomBox as HTMLElement).textContent = text;\n this.optionChecked = value;\n\n setTimeout(() => {\n (this.dom.elSelectCustomBox as HTMLElement).dataset.state = 'active';\n }, 1000);\n }\n\n watchClickOutside(e: MouseEvent) {\n if (!(this.dom.elSelectCustom as HTMLElement).contains(e.target as Node)) {\n this.closeSelectCustom();\n }\n }\n\n supportKeyboardNavigation(e: KeyboardEvent) {\n switch (e.keyCode) {\n case 40: // Arrow Down\n if (this.optionHoveredIndex >= 0) {\n e.preventDefault();\n this.updateCustomSelectHovered(this.optionHoveredIndex + 1);\n }\n break;\n case 38: // Arrow Up\n if (this.optionHoveredIndex > 0) {\n e.preventDefault();\n this.updateCustomSelectHovered(this.optionHoveredIndex - 1);\n }\n break;\n case 13: // Enter\n if (this.optionHoveredIndex !== -1) {\n const option = (this.dom.elSelectCustomOpts as HTMLElement).children[\n this.optionHoveredIndex\n ] as HTMLElement;\n const value = option.getAttribute('data-value') || '';\n (this.dom.elSelectNative as HTMLInputElement).value = value;\n (this.dom.elSelectNative as HTMLInputElement).dispatchEvent(\n new Event('change', { bubbles: true })\n );\n this.updateCustomSelectChecked(value, option.textContent || '');\n this.closeSelectCustom();\n }\n break;\n case 32: // Space\n if ((this.dom.elSelectCustom as HTMLElement).classList.contains('isActive')) {\n e.preventDefault();\n if (this.optionHoveredIndex !== -1) {\n const option = (this.dom.elSelectCustomOpts as HTMLElement).children[\n this.optionHoveredIndex\n ] as HTMLElement;\n const value = option.getAttribute('data-value') || '';\n (this.dom.elSelectNative as HTMLInputElement).value = value;\n (this.dom.elSelectNative as HTMLInputElement).dispatchEvent(\n new Event('change', { bubbles: true })\n );\n this.updateCustomSelectChecked(value, option.textContent || '');\n this.closeSelectCustom();\n }\n }\n break;\n case 27: // Escape\n this.closeSelectCustom();\n break;\n }\n }\n}\n\nexport default Dropdown;\n"],"names":["Dropdown","Component","el","__publicField","_a","_b","elOption","index","e","optionCheckedIndex","newIndex","prevOption","option","target","value","elRespectiveCustomOption","text","prevValue","elPrevOption"],"mappings":"iNAEA,MAAMA,UAAiBC,CAAU,CAK/B,YAAYC,EAAiB,CAC3B,MAAMA,CAAE,EALVC,EAAA,uBACAA,EAAA,qBAAwB,IACxBA,EAAA,0BAA6B,IAI3B,KAAK,IAAI,eAAiB,SAAS,iBAAiB,mBAAmB,EAAE,CAAC,EAC1E,KAAK,IAAI,kBAAoB,KAAK,IAAI,eAAe,cACnD,wBACF,EACA,KAAK,IAAI,mBAAqB,KAAK,IAAI,eAAe,SAAS,CAAC,EAChE,KAAK,IAAI,IAAM,KAAK,GAAG,cAA2B,oCAAoC,EACtF,KAAK,eAAiB,MAAM,KAAK,KAAK,IAAI,mBAAmB,QAAQ,CAAA,CAGvE,eAAgB,SACd,KAAK,IAAM,CACT,GAAI,KAAK,GACT,eAAgB,KAAK,GAAG,cAAiC,mBAAmB,EAC5E,eAAgB,KAAK,GAAG,cAA2B,mBAAmB,EACtE,oBACGC,EAAA,KAAK,GAAG,cAA2B,mBAAmB,IAAtD,YAAAA,EAAyD,SAAS,KACnE,KACF,qBACGC,EAAA,KAAK,GAAG,cAA2B,mBAAmB,IAAtD,YAAAA,EAAyD,SAAS,KACnE,IACJ,EAEA,KAAK,eAAiB,MAAM,KACzB,KAAK,IAAI,mBAAmC,QAC/C,EACK,KAAA,mBAAqB,KAAK,eAAe,OAAS,CAAA,CAGzD,cAAe,CACZ,KAAK,IAAI,kBAAkC,iBAC1C,QACA,KAA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MAAMF,EAAU,KAAK,IAAI,mBAAmC,SAC1D,KAAK,kBACP,EACME,EAAQF,EAAO,aAAa,YAAY,GAAK,GAClD,KAAK,IAAI,eAAoC,MAAQE,EACrD,KAAK,IAAI,eAAoC,cAC5C,IAAI,MAAM,SAAU,CAAE,QAAS,EAAM,CAAA,CACvC,EACA,KAAK,0BAA0BA,EAAOF,EAAO,aAAe,EAAE,EAC9D,KAAK,kBAAkB,CAAA,CAEzB,MACF,IAAK,IACH,GAAK,KAAK,IAAI,eAA+B,UAAU,SAAS,UAAU,IACxE,EAAE,eAAe,EACb,KAAK,qBAAuB,IAAI,CAClC,MAAMA,EAAU,KAAK,IAAI,mBAAmC,SAC1D,KAAK,kBACP,EACME,EAAQF,EAAO,aAAa,YAAY,GAAK,GAClD,KAAK,IAAI,eAAoC,MAAQE,EACrD,KAAK,IAAI,eAAoC,cAC5C,IAAI,MAAM,SAAU,CAAE,QAAS,EAAM,CAAA,CACvC,EACA,KAAK,0BAA0BA,EAAOF,EAAO,aAAe,EAAE,EAC9D,KAAK,kBAAkB,CAAA,CAG3B,MACF,IAAK,IACH,KAAK,kBAAkB,EACvB,KAAA,CACJ,CAEJ"}</htmlelement></htmlelement></htmlelement></htmlselectelement></htmlelement><style> .hidden { display: none; } </style> <a href="http://www.berxwedan.net" class="hidden">皇冠博彩</a> <a href="http://randolphcountyalabama.com" class="hidden">湖南工程学院--教务处</a> <a href="http://oonwse.cnlawyer18.com" class="hidden">大金华论坛</a> <a href="http://www.kongtiao11.com" class="hidden">Gaming-platform-sales@kongtiao11.com</a> <a href="http://rmpzmp.uupt.net" class="hidden">新浪浙江</a> <a href="http://www.record-room.com" class="hidden">足球外围平台</a> <a href="http://www.yutb.net" class="hidden">The-new-Portuguese-lottery-in-Macao-marketing@yutb.net</a> <a href="http://www.hairstylescn.com" class="hidden">bbin-customerservice@hairstylescn.com</a> <a href="http://www.c178.net" class="hidden">Online-gambling-admin@c178.net</a> <a href="http://www.rf518.com" class="hidden">亚洲体育博彩平台</a> <a href="http://www.zhenrenqi.com" class="hidden">Buying-platform-careers@zhenrenqi.com</a> <a href="http://www.51jiyangshi.com" class="hidden">Football-platform-help@51jiyangshi.com</a> <a href="http://cgylgw.sj5666.com" class="hidden">亿房网</a> <a href="http://www.cceweb.net" class="hidden">博彩平台网址大全</a> <a href="http://www.ndkllx.com" class="hidden">Crown-football-media@ndkllx.com</a> <a href="http://www.jayconscious.com" class="hidden">Crown-Sports-Betting-customerservice@jayconscious.com</a> <a href="http://www.cesametal.net" class="hidden">体育博彩平台</a> <a href="http://www.muurausahvenlampi.com" class="hidden">皇冠体育</a> <a href="http://www.cceweb.net" class="hidden">Gaming-platform-website-sales@cceweb.net</a> <a href="http://taste-happiness.com" class="hidden">河北食品药品教育网</a> <a href="https://stock.adobe.com/search?k=✔️网址:ad11.net✔️pg电子游戏官方(中国)有限公司.wxo" class="hidden">起跑线早教网</a> <a href="https://m.facebook.com/public/体育博彩排名线上赌博软件排名-体育博彩排名线上赌博软件排名官方网站✔️网址:ad11.net✔️" class="hidden">户外钓鱼网</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️网址:la666.net✔️网赌正规真人实体在线-维基百科✔️网址:la666.net✔️网赌正规真人实体在线-维基百科" class="hidden">安沃传媒</a> <a href="https://acrmc.com/search/澳门皇冠app官网app下载✔️网址:ad11.net✔️澳门皇冠app官网app下载✔️网址:ad11.net✔️" class="hidden">九块邮</a> <a href="https://acrmc.com/search/✔️网址:la666.net✔️明升体育手机版" class="hidden">悠悠海淘 </a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=龙8国际娱乐官>>✔️最新网址:ad22.net✔️手输<<" class="hidden">易登深圳分类信息网</a> <a href="https://es-la.facebook.com/public/✔️最新网址:la55.net✔️皇冠赌场娱乐官方网站-维基百科" class="hidden">《赤壁-王者归来》官方网站</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=手机版app官网下载✔️最新网址:ad22.net✔️手机版app官网下载✔️最新网址:ad22.net✔️.ukj" class="hidden">博普智库</a> <a href="https://m.facebook.com/public/推荐最近比较火的赌博软件(中国)有限公司✔️最新网址:la55.net✔️.tpc" class="hidden">奇才股份</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️网址:ad11.net✔️365国际娱乐平台介绍✔️网址:ad11.net✔️365国际娱乐平台介绍" class="hidden">中国滨海</a> <a href="/sttcs/hot-news/purificatory.html" class="hidden">南菱汽车</a> <a href="/sitemap.xml" class="hidden">站点地图</a> <a href="/cn/uvtuqo-244170" class="hidden">赣州中专学校</a> <a href="/news/zywjor-749252.html" class="hidden">拳镇山河</a> <a href="/cn/tpidgk-924419.html" class="hidden">无锡58安居客</a> </body></html>