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gBACf5C,OAAOC,UAAUmC,KACnBnF,KAAK4F,YAAYT,GAAO,GACxBnF,KAAK6F,YAAYV,GAAO,GAE5B,CACF,EAEA3D,EAAgB2C,UAAU+C,QAAU,WAClClH,KAAKF,GAAGsF,UAAUiB,OAAO,kBAEzB,IAAK,IAAInB,EAAI,EAAGA,EAAIlF,KAAKqE,wBAAyBa,IAChDlF,KAAKiD,kBAAkBiC,GAAGwB,gBAAgB,iBAC1C1G,KAAKiD,kBAAkBiC,GAAGE,UAAUiB,OAAO,eAE3CrG,KAAKmD,gBAAgB+B,GAAGwB,gBAAgB,eACxC1G,KAAKmD,gBAAgB+B,GAAGE,UAAUiB,OAAO,WACzCrG,KAAKmD,gBAAgB+B,GAAGwB,gBAAgB,YAExC1G,KAAKiD,kBAAkBiC,GAAGiC,oBACxB,QACAnH,KAAKwE,eACL,GAEFxE,KAAKiD,kBAAkBiC,GAAGiC,oBACxB,UACAnH,KAAK0E,iBACL,GAEF1E,KAAKiD,kBAAkBiC,GAAGiC,oBACxB,QACAnH,KAAK4E,eACL,UAGK5E,KAAKiD,kBAAkBiC,GAAGC,KAErC,C","sources":["webpack://@hero-digital/zoom/./src/components/modules/SubNav/SubNav.js","webpack://@hero-digital/zoom/./src/js/utilities/accordion.js"],"sourcesContent":["import { AccordionWidget } from '../../../js/utilities/accordion'\r\n\r\nclass SubNav {\r\n constructor(el) {\r\n this.el = el\r\n this.domMap = {\r\n $accordionPanel: this.el.querySelector('.sub-nav__accordion-panel'),\r\n $accordionTrigger: this.el.querySelector('.sub-nav__accordion-trigger'),\r\n $triggers: this.el.querySelectorAll('.sub-nav__trigger'),\r\n $lists: this.el.querySelectorAll('.sub-nav__sub-list')\r\n }\r\n\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 } = this.domMap\r\n const $target = e.target\r\n\r\n if (\r\n !$target.closest('.sub-nav__trigger') &&\r\n !$target.closest('.sub-nav__sub-list')\r\n ) {\r\n if ($triggers) {\r\n $triggers.forEach(($trigger) =>\r\n $trigger.setAttribute('aria-expanded', false)\r\n )\r\n }\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('.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 SubNav\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":["SubNav","el","_classCallCheck","this","domMap","$accordionPanel","querySelector","$accordionTrigger","$triggers","querySelectorAll","$lists","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","$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":""}