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AO,mBAC9BxG,KAAK4G,YAAcA,CACrB,EAEAlF,EAAgB4C,UAAU2B,OAAS,WAEjCjG,KAAKmH,MAAQ,WACXnH,KAAK+F,aAAa,GAClB/F,KAAKgG,aAAa,EACpB,EAEAhG,KAAKoH,SAAW,WACd,IAAM9B,EAAQtF,KAAK8F,gBACf5C,OAAOC,UAAUmC,KACnBtF,KAAK+F,YAAYT,GAAO,GACxBtF,KAAKgG,YAAYV,GAAO,GAE5B,CACF,EAEA5D,EAAgB4C,UAAU+C,QAAU,WAClCrH,KAAKF,GAAGyF,UAAUiB,OAAO,kBAEzB,IAAK,IAAInB,EAAI,EAAGA,EAAIrF,KAAKwE,wBAAyBa,IAChDrF,KAAKoD,kBAAkBiC,GAAGwB,gBAAgB,iBAC1C7G,KAAKoD,kBAAkBiC,GAAGE,UAAUiB,OAAO,eAE3CxG,KAAKsD,gBAAgB+B,GAAGwB,gBAAgB,eACxC7G,KAAKsD,gBAAgB+B,GAAGE,UAAUiB,OAAO,WACzCxG,KAAKsD,gBAAgB+B,GAAGwB,gBAAgB,YAExC7G,KAAKoD,kBAAkBiC,GAAGiC,oBACxB,QACAtH,KAAK2E,eACL,GAEF3E,KAAKoD,kBAAkBiC,GAAGiC,oBACxB,UACAtH,KAAK6E,iBACL,GAEF7E,KAAKoD,kBAAkBiC,GAAGiC,oBACxB,QACAtH,KAAK+E,eACL,UAGK/E,KAAKoD,kBAAkBiC,GAAGC,KAErC,C","sources":["webpack://@hero-digital/zoom/./src/components/modules/BlogSubNav/BlogSubNav.js","webpack://@hero-digital/zoom/./src/js/utilities/accordion.js"],"sourcesContent":["import { AccordionWidget } from '../../../js/utilities/accordion'\r\n\r\nclass BlogSubNav {\r\n constructor(el) {\r\n this.el = el\r\n this.domMap = {\r\n $accordionPanel: this.el.querySelector('.blog-sub-nav__accordion-panel'),\r\n $accordionTrigger: this.el.querySelector('.blog-sub-nav__accordion-trigger'),\r\n $triggers: this.el.querySelectorAll('.blog-sub-nav__trigger'),\r\n $lists: this.el.querySelectorAll('.blog-sub-nav__sub-list')\r\n }\r\n console.log('blog sub nav')\r\n this.initAccordion()\r\n this.addListeners()\r\n }\r\n\r\n addListeners() {\r\n const { $accordionTrigger, $triggers, $lists } = this.domMap\r\n\r\n $accordionTrigger.addEventListener('click', this.toggleAccordion.bind(this))\r\n $triggers.forEach(($trigger) =>\r\n $trigger.addEventListener('click', this.toggleMenu.bind(this))\r\n )\r\n $lists.forEach(($list) =>\r\n $list.addEventListener('focusout', this.handleListFocusout.bind(this))\r\n )\r\n window.addEventListener('click', this.handleWindowClick.bind(this))\r\n }\r\n\r\n initAccordion() {\r\n const { $accordionPanel } = this.domMap\r\n\r\n if ($accordionPanel) {\r\n new AccordionWidget($accordionPanel)\r\n }\r\n }\r\n\r\n toggleAccordion() {\r\n const { $accordionPanel, $accordionTrigger } = this.domMap\r\n const isOpen = $accordionPanel.getAttribute('aria-hidden') === 'false'\r\n\r\n $accordionPanel.setAttribute('aria-hidden', isOpen)\r\n $accordionTrigger.setAttribute('aria-expanded', !isOpen)\r\n }\r\n\r\n toggleMenu(e) {\r\n const { $triggers } = this.domMap\r\n const $trigger = e.target\r\n const isOpen = $trigger.getAttribute('aria-expanded') === 'true'\r\n\r\n $trigger.setAttribute('aria-expanded', !isOpen)\r\n $triggers.forEach(($trigger) => {\r\n if ($trigger !== e.target) {\r\n $trigger.setAttribute('aria-expanded', false)\r\n }\r\n })\r\n }\r\n\r\n handleWindowClick(e) {\r\n const { $triggers, $accordionPanel, $accordionTrigger } = this.domMap\r\n const $target = e.target\r\n if (\r\n !$target.closest('.blog-sub-nav__accordion-trigger') &&\r\n !$target.closest('.blog-sub-nav__accordion-panel')\r\n ) {\r\n\r\n if ($triggers) {\r\n $triggers.forEach(($trigger) =>\r\n $trigger.setAttribute('aria-expanded', false)\r\n )\r\n }\r\n const isOpen = $accordionPanel.getAttribute('aria-hidden') === 'false'\r\n // close blog subnav when click outside\r\n $accordionPanel.setAttribute('aria-hidden', true)\r\n $accordionTrigger.setAttribute('aria-expanded', false)\r\n }\r\n }\r\n\r\n handleListFocusout(e) {\r\n const { $triggers } = this.domMap\r\n const $target = e.relatedTarget\r\n\r\n if (!$target.closest('.blog-sub-nav__sub-list')) {\r\n $triggers.forEach(($trigger) =>\r\n $trigger.setAttribute('aria-expanded', false)\r\n )\r\n }\r\n }\r\n}\r\n\r\nexport default BlogSubNav\r\n","/* ACCESSIBLE ACCORDION COMPONENT\r\n Code modified taken from here: https://codepen.io/stowball/pen/eZKwRv\r\n Options (add to parent element that has class \"accordion-interface\"):\r\n Multiselect: aria-multiselectable=\"true\"\r\n Always expand first item: data-firstexpanded=\"true\"\r\n To have selected panel(s) expanded at start use data-open-panels attribute with panel numbers separated by commas.\r\n Example: data-open-panels=\"1,2\"\r\n To keep panels always open at tablet breakpoints and above add to class list: accordion-interface__open-panels__md\r\n and for desktop only: accordion-interface__open-panels__lg\r\n*/\r\nimport gsap from 'gsap'\r\n\r\nfunction AccordionWidget(el, props = {}) {\r\n if (!el) return\r\n this.el = el\r\n\r\n let triggerClass = 'js-accordion-trigger'\r\n let panelClass = 'js-accordion-panel'\r\n if (props.id) {\r\n triggerClass += props.id\r\n panelClass += props.id\r\n }\r\n const expandFirst = el.dataset.firstexpanded === 'true'\r\n this.multiSelectable = this.el.hasAttribute('aria-multiselectable')\r\n\r\n let selectedIndex\r\n if (Number.isInteger(props.selectedIndex)) selectedIndex = props.selectedIndex\r\n else if (expandFirst) selectedIndex = 0\r\n\r\n this.accordionTriggers = this.el.getElementsByClassName(triggerClass)\r\n this.accordionPanels = this.el.getElementsByClassName(panelClass)\r\n\r\n if (\r\n this.accordionTriggers.length === 0 ||\r\n this.accordionTriggers.length !== this.accordionPanels.length\r\n ) {\r\n return\r\n }\r\n\r\n // if we do not already have a selected index see if we have the open panels attribute\r\n if (selectedIndex === undefined && el.dataset.openPanels) {\r\n let openPanels = el.dataset.openPanels\r\n openPanels = openPanels.split(',')\r\n const panelArr = []\r\n for (const panel of openPanels) {\r\n const n = parseInt(panel)\r\n // quick test to make sure we have a positive value\r\n if ((n | 0) > 0 && n % 1 === 0 && n <= this.accordionTriggers.length) {\r\n panelArr.push(n - 1)\r\n // if this is not multiselectable then stop after first validated value\r\n if (!this.multiSelectable) break\r\n }\r\n }\r\n if (panelArr.length) selectedIndex = panelArr\r\n }\r\n\r\n this._init(selectedIndex)\r\n}\r\n\r\nAccordionWidget.prototype._init = function (selectedIndex) {\r\n this.accordionTriggersLength = this.accordionTriggers.length\r\n this.expandedAccordions = new Array(this.accordionTriggersLength)\r\n this.clickListener = this._clickEvent.bind(this)\r\n this.keydownListener = this._keydownEvent.bind(this)\r\n this.focusListener = this._focusEvent.bind(this)\r\n this.keys = {\r\n prev: 38,\r\n next: 40,\r\n space: 32\r\n }\r\n\r\n let initialSelectedIndex\r\n\r\n for (let i = 0; i < this.accordionTriggersLength; i++) {\r\n this.accordionTriggers[i].index = i\r\n this.accordionTriggers[i].addEventListener(\r\n 'click',\r\n this.clickListener,\r\n false\r\n )\r\n this.accordionTriggers[i].addEventListener(\r\n 'keydown',\r\n this.keydownListener,\r\n false\r\n )\r\n this.accordionTriggers[i].addEventListener(\r\n 'focus',\r\n this.focusListener,\r\n false\r\n )\r\n this.accordionTriggers[i].classList.add('is-accordion-trigger')\r\n\r\n if (this.accordionTriggers[i].classList.contains('is-selected')) {\r\n this.expandedAccordions[i] = true\r\n }\r\n }\r\n\r\n for (let i = 0; i < this.accordionPanels.length; i++) {\r\n this.accordionPanels[i].classList.add('is-accordion-panel')\r\n }\r\n\r\n // determine which panels need to be open\r\n if (!isNaN(selectedIndex)) {\r\n initialSelectedIndex = selectedIndex\r\n this.expandedAccordions = new Array(this.accordionTriggersLength)\r\n this.expandedAccordions[initialSelectedIndex] = true\r\n } else if (Array.isArray(selectedIndex)) {\r\n initialSelectedIndex = selectedIndex\r\n this.expandedAccordions = new Array(this.accordionTriggersLength)\r\n for (let i = 0; i < this.accordionTriggersLength; i++) {\r\n if (selectedIndex.includes(i)) this.expandedAccordions[i] = true\r\n }\r\n } else {\r\n initialSelectedIndex = this.expandedAccordions.lastIndexOf(true)\r\n\r\n if (!this.multiSelectable) {\r\n this.expandedAccordions = new Array(this.accordionTriggersLength)\r\n this.expandedAccordions[initialSelectedIndex] = true\r\n }\r\n }\r\n\r\n this.initialSetIndex = selectedIndex\r\n this.setSelected(initialSelectedIndex)\r\n this.setExpanded()\r\n this.setAPI()\r\n this.el.classList.add('is-accordion')\r\n this.el.classList.add('is-initialized')\r\n}\r\n\r\nAccordionWidget.prototype._clickEvent = function (e) {\r\n e.preventDefault()\r\n this.setSelected(e.target.index, true)\r\n this.setExpanded(e.target.index, true)\r\n}\r\n\r\nAccordionWidget.prototype._keydownEvent = function (e) {\r\n let targetIndex\r\n\r\n switch (e.keyCode) {\r\n case this.keys.space:\r\n case this.keys.prev:\r\n case this.keys.next:\r\n e.preventDefault()\r\n break\r\n default:\r\n return\r\n }\r\n\r\n if (e.keyCode === this.keys.space) {\r\n // this.setExpanded(e.target.index, true);\r\n e.target.click()\r\n\r\n return\r\n } else if (e.keyCode === this.keys.prev && e.target.index > 0) {\r\n targetIndex = e.target.index - 1\r\n } else if (\r\n e.keyCode === this.keys.next &&\r\n e.target.index < this.accordionTriggersLength - 1\r\n ) {\r\n targetIndex = e.target.index + 1\r\n } else {\r\n return\r\n }\r\n\r\n this.setSelected(targetIndex, true)\r\n}\r\n\r\nAccordionWidget.prototype._focusEvent = function () {\r\n if (this.accordionTriggersLength === 1) {\r\n this.setSelected(0)\r\n }\r\n}\r\n\r\nAccordionWidget.prototype.setSelected = function (index, userInvoked) {\r\n if (index === -1) {\r\n this.accordionTriggers[0].setAttribute('tabindex', 0)\r\n\r\n return\r\n }\r\n\r\n if (Array.isArray(index)) index = index[0]\r\n for (let i = 0; i < this.accordionTriggersLength; i++) {\r\n if (i === index) {\r\n this.accordionTriggers[i].classList.add('is-selected')\r\n // this.accordionTriggers[i].setAttribute('tabindex', 0);\r\n\r\n if (userInvoked) {\r\n this.accordionTriggers[i].focus()\r\n }\r\n } else {\r\n this.accordionTriggers[i].classList.remove('is-selected')\r\n\r\n // this.accordionTriggers[i].setAttribute('tabindex', -1);\r\n }\r\n }\r\n}\r\n\r\nAccordionWidget.prototype.setExpanded = function (index, userInvoked) {\r\n let i\r\n\r\n // special case to close all\r\n if (index === -1) this.expandedAccordions = []\r\n\r\n if (userInvoked) {\r\n if (this.multiSelectable) {\r\n this.expandedAccordions[index] = !this.expandedAccordions[index]\r\n } else {\r\n for (i = 0; i < this.accordionTriggersLength; i++) {\r\n if (i === index) {\r\n this.expandedAccordions[i] = !this.expandedAccordions[i]\r\n } else {\r\n this.expandedAccordions[i] = false\r\n }\r\n }\r\n }\r\n }\r\n\r\n AccordionWidget.prototype.hidePanelContent = function (item) {\r\n //allows animation to finish before hiding inner content from assistive technology\r\n setTimeout(() => {\r\n item.setAttribute('aria-hidden', true)\r\n item.setAttribute('hidden', true)\r\n }, 325)\r\n }\r\n\r\n let hasExpanded = false\r\n for (i = 0; i < this.accordionTriggersLength; i++) {\r\n if (this.expandedAccordions[i]) {\r\n this.accordionPanels[i].setAttribute('aria-hidden', false)\r\n this.accordionPanels[i].removeAttribute('hidden')\r\n\r\n this.accordionTriggers[i].setAttribute('aria-expanded', true)\r\n this.accordionTriggers[i].classList.add('is-expanded')\r\n\r\n this.accordionPanels[i].classList.add('is-open')\r\n gsap.to(this.accordionPanels[i], { height: 'auto', duration: 0.3 })\r\n\r\n this.accordionTriggers[i].parentElement.classList.add('is-active')\r\n\r\n hasExpanded = true\r\n } else {\r\n this.accordionTriggers[i].setAttribute('aria-expanded', false)\r\n this.accordionTriggers[i].classList.remove('is-expanded')\r\n\r\n this.accordionPanels[i].classList.remove('is-open')\r\n gsap.to(this.accordionPanels[i], { height: 0, duration: 0.3 })\r\n\r\n this.accordionTriggers[i].parentElement.classList.remove('is-active')\r\n this.hidePanelContent(this.accordionPanels[i])\r\n }\r\n }\r\n\r\n // add close to parent to indicate there is an open element\r\n if (hasExpanded) this.el.classList.add('has-expanded-el')\r\n else this.el.classList.remove('has-expanded-el')\r\n this.hasExpanded = hasExpanded\r\n}\r\n\r\nAccordionWidget.prototype.setAPI = function () {\r\n // add API functionality here\r\n this.close = function () {\r\n this.setSelected(-1)\r\n this.setExpanded(-1)\r\n }\r\n // open initial index\r\n this.openInit = function () {\r\n const index = this.initialSetIndex\r\n if (Number.isInteger(index)) {\r\n this.setSelected(index, true)\r\n this.setExpanded(index, true)\r\n }\r\n }\r\n}\r\n\r\nAccordionWidget.prototype.destroy = function () {\r\n this.el.classList.remove('is-initialized')\r\n\r\n for (let i = 0; i < this.accordionTriggersLength; i++) {\r\n this.accordionTriggers[i].removeAttribute('aria-expanded')\r\n this.accordionTriggers[i].classList.remove('is-expanded')\r\n\r\n this.accordionPanels[i].removeAttribute('aria-hidden')\r\n this.accordionPanels[i].classList.remove('is-open')\r\n this.accordionPanels[i].removeAttribute('tabindex')\r\n\r\n this.accordionTriggers[i].removeEventListener(\r\n 'click',\r\n this.clickListener,\r\n false\r\n )\r\n this.accordionTriggers[i].removeEventListener(\r\n 'keydown',\r\n this.keydownListener,\r\n false\r\n )\r\n this.accordionTriggers[i].removeEventListener(\r\n 'focus',\r\n this.focusListener,\r\n false\r\n )\r\n\r\n delete this.accordionTriggers[i].index\r\n }\r\n}\r\n\r\nexport { AccordionWidget }\r\n"],"names":["BlogSubNav","el","_classCallCheck","this","domMap","$accordionPanel","querySelector","$accordionTrigger","$triggers","querySelectorAll","$lists","console","log","initAccordion","addListeners","key","value","_this","_this$domMap","addEventListener","toggleAccordion","bind","forEach","$trigger","toggleMenu","$list","handleListFocusout","window","handleWindowClick","AccordionWidget","_this$domMap2","isOpen","getAttribute","setAttribute","e","target","_this$domMap3","$target","closest","relatedTarget","props","arguments","length","undefined","triggerClass","panelClass","id","selectedIndex","expandFirst","dataset","firstexpanded","multiSelectable","hasAttribute","Number","isInteger","accordionTriggers","getElementsByClassName","accordionPanels","openPanels","_step","panelArr","_iterator","_createForOfIteratorHelper","split","s","n","done","panel","parseInt","push","err","f","_init","prototype","initialSelectedIndex","accordionTriggersLength","expandedAccordions","Array","clickListener","_clickEvent","keydownListener","_keydownEvent","focusListener","_focusEvent","keys","prev","next","space","i","index","classList","add","contains","isNaN","isArray","includes","lastIndexOf","initialSetIndex","setSelected","setExpanded","setAPI","preventDefault","targetIndex","keyCode","click","userInvoked","focus","remove","hidePanelContent","item","setTimeout","hasExpanded","removeAttribute","gsap","to","height","duration","parentElement","close","openInit","destroy","removeEventListener"],"sourceRoot":""}