{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/tabbed-content.js"],"names":["Module","Component","$tab","e","tab","tabPannelId","$tabPannel","tabIndex","key"],"mappings":"kJAEA,MAAMA,UAAeC,WAAU,CAC7B,eAAgB,CACd,KAAK,IAAM,CACP,YAAa,KAAK,GAAG,cAAc,+BAA+B,EAClE,MAAO,KAAK,GAAG,iBAAiB,0BAA0B,EAC1D,YAAa,KAAK,GAAG,iBAAiB,wBAAwB,CAClE,EACG,KAAK,GAAG,UAAU,SAAS,yBAAyB,GACrD,KAAK,yBAAyB,CAElC,CAEA,cAAe,CACb,KAAK,IAAI,YAAY,iBAAiB,SAAU,KAAK,sBAAsB,KAAK,IAAI,CAAC,EACrF,KAAK,IAAI,MAAM,QAAQC,GAAQ,CAC3BA,EAAK,iBAAiB,QAAS,KAAK,eAAe,KAAK,IAAI,CAAC,CACjE,CAAC,CACH,CAEA,sBAAsBC,EAAG,CACvB,KAAK,UAAU,SAAS,eAAeA,EAAE,cAAc,KAAK,CAAC,CAE/D,CAEA,eAAeA,EAAG,CAChB,MAAMD,EAAOC,EAAE,cACf,KAAK,IAAI,YAAY,MAAQD,EAAK,aAAa,IAAI,EACnD,KAAK,UAAUA,CAAI,CACrB,CAEA,UAAUE,EAAK,CACb,MAAMC,EAAcD,EAAI,aAAa,eAAe,EACpD,KAAK,IAAI,MAAM,QAASF,GAAS,CAC1BA,EAAK,aAAa,eAAe,IAAMG,GACtCH,EAAK,aAAa,gBAAiB,MAAM,EACzCA,EAAK,aAAa,gBAAiB,MAAM,IAEzCA,EAAK,aAAa,gBAAiB,OAAO,EAC1CA,EAAK,aAAa,gBAAiB,OAAO,EAElD,CAAC,EACD,KAAK,IAAI,YAAY,QAASI,GAAe,CACtCA,EAAW,aAAa,IAAI,IAAMD,EACjCC,EAAW,gBAAgB,aAAa,EAExCA,EAAW,aAAa,cAAe,MAAM,CAErD,CAAC,CACH,CAEA,0BAA2B,CACzB,MAAMC,EAAW,KAAK,oBAAoB,oBAAoB,GAAG,EAC3DH,EAAM,KAAK,IAAI,MAAMG,IAAW,KAAK,IAAI,MAAM,GACrD,KAAK,IAAI,YAAY,MAAQH,EAAI,aAAa,IAAI,EAClD,KAAK,UAAUA,CAAG,CACpB,CAEA,oBAAoBI,EAAK,CAEvB,OADkB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC3C,IAAIA,CAAG,CAC1B,CAGF,CAEA,UAAeR,C","file":"scripts/256.117f228d.js","sourcesContent":["import { Component } from '@verndale/core';\n\nclass Module extends Component {\n setupDefaults() {\n this.dom = {\n $tabsSelect: this.el.querySelector('.tabbed-content-row__dropdown'),\n $tabs: this.el.querySelectorAll('.tabbed-content-row__tab'),\n $tabPannels: this.el.querySelectorAll('.tabbed-content__panel')\n };\n if(this.el.classList.contains('leadership-listing-tabs')) {\n this.selectTabFromQueryString();\n }\n }\n\n addListeners() {\n this.dom.$tabsSelect.addEventListener('change', this.handleTabSelectChange.bind(this));\n this.dom.$tabs.forEach($tab => {\n $tab.addEventListener('click', this.handleTabClick.bind(this));\n });\n }\n\n handleTabSelectChange(e) {\n this.changeTab(document.getElementById(e.currentTarget.value));\n\n }\n\n handleTabClick(e) {\n const $tab = e.currentTarget;\n this.dom.$tabsSelect.value = $tab.getAttribute('id');\n this.changeTab($tab);\n }\n\n changeTab(tab) {\n const tabPannelId = tab.getAttribute('aria-controls');\n this.dom.$tabs.forEach(($tab) => {\n if($tab.getAttribute('aria-controls') === tabPannelId) {\n $tab.setAttribute('aria-expanded', 'true');\n $tab.setAttribute('aria-selected', 'true');\n } else {\n $tab.setAttribute('aria-expanded', 'false');\n $tab.setAttribute('aria-selected', 'false');\n }\n });\n this.dom.$tabPannels.forEach(($tabPannel) => {\n if($tabPannel.getAttribute('id') === tabPannelId) {\n $tabPannel.removeAttribute('aria-hidden');\n } else {\n $tabPannel.setAttribute('aria-hidden', 'true');\n }\n });\n }\n\n selectTabFromQueryString() {\n const tabIndex = this.getQueryStringValue('leadershipTabIndex')||0;\n const tab = this.dom.$tabs[tabIndex]||this.dom.$tabs[0];\n this.dom.$tabsSelect.value = tab.getAttribute('id');\n this.changeTab(tab);\n }\n\n getQueryStringValue(key) {\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(key);\n }\n\n \n}\n\nexport default Module;"],"sourceRoot":""}