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GAAG3G,KAAKmD,gBAAgBgC,GAAI,CAAEyB,OAAQ,EAAGC,SAAU,KAExD7G,KAAKiD,kBAAkBkC,GAAG2B,cAAcxF,UAAU8E,OAAO,aACzDpG,KAAKsG,iBAAiBtG,KAAKmD,gBAAgBgC,KAK3CqB,EAAaxG,KAAKF,GAAGwB,UAAU8D,IAAI,mBAClCpF,KAAKF,GAAGwB,UAAU8E,OAAO,mBAC9BpG,KAAKwG,YAAcA,CACrB,EAEApF,EAAgBgD,UAAUwB,OAAS,WAEjC5F,KAAK+G,MAAQ,WACX/G,KAAK0F,aAAa,GAClB1F,KAAK2F,aAAa,EACpB,EAEA3F,KAAKgH,SAAW,WACd,IAAMjF,EAAQ/B,KAAKyF,gBACf1C,OAAOC,UAAUjB,KACnB/B,KAAK0F,YAAY3D,GAAO,GACxB/B,KAAK2F,YAAY5D,GAAO,GAE5B,CACF,EAEAX,EAAgBgD,UAAU6C,QAAU,WAClCjH,KAAKF,GAAGwB,UAAU8E,OAAO,kBAEzB,IAAK,IAAIjB,EAAI,EAAGA,EAAInF,KAAKsE,wBAAyBa,IAChDnF,KAAKiD,kBAAkBkC,GAAGsB,gBAAgB,iBAC1CzG,KAAKiD,kBAAkBkC,GAAG7D,UAAU8E,OAAO,eAE3CpG,KAAKmD,gBAAgBgC,GAAGsB,gBAAgB,eACxCzG,KAAKmD,gBAAgBgC,GAAG7D,UAAU8E,OAAO,WACzCpG,KAAKmD,gBAAgBgC,GAAGsB,gBAAgB,YAExCzG,KAAKiD,kBAAkBkC,GAAG+B,oBACxB,QACAlH,KAAKyE,eACL,GAEFzE,KAAKiD,kBAAkBkC,GAAG+B,oBACxB,UACAlH,KAAK2E,iBACL,GAEF3E,KAAKiD,kBAAkBkC,GAAG+B,oBACxB,QACAlH,KAAK6E,eACL,UAGK7E,KAAKiD,kBAAkBkC,GAAGpD,KAErC,C","sources":["webpack://@hero-digital/zoom/./src/components/foundation/Accordion/Accordion.js","webpack://@hero-digital/zoom/./src/js/utilities/accordion.js"],"sourcesContent":["import { AccordionWidget } from '../../../js/utilities/accordion'\r\n\r\nclass Accordion {\r\n constructor(el) {\r\n this.el = el\r\n this.maxItems = 5\r\n this.domMap = {\r\n $showMore: this.el.querySelector('.accordion__show'),\r\n $showLess: this.el.querySelector('.accordion__show--less')\r\n }\r\n this.disableShowmoreButton = true\r\n if(this.el.hasAttribute(\"data-disableshowmore\")) {\r\n if(this.el.getAttribute('data-disableshowmore') == 1) {\r\n this.disableShowmoreButton = false\r\n this.domMap.$showMore.hidden = true\r\n }\r\n }\r\n this.initAccordion()\r\n this.countItems()\r\n if(this.disableShowmoreButton===true) {\r\n this.addListeners()\r\n }\r\n }\r\n\r\n addListeners() {\r\n const { $showMore, $showLess } = this.domMap\r\n\r\n if($showMore) $showMore.addEventListener('click', this.showMore.bind(this))\r\n if($showLess) $showLess.addEventListener('click', this.showLess.bind(this))\r\n }\r\n\r\n initAccordion() {\r\n new AccordionWidget(this.el)\r\n }\r\n\r\n countItems() {\r\n const isDouble = this.el.classList.contains('accordion--double')\r\n\r\n if (isDouble) {\r\n const $columns = this.el.querySelectorAll('.accordion__content-column')\r\n $columns.forEach((column) => {\r\n const $items = column.querySelectorAll(\r\n '.accordion__item, .accordion__category'\r\n )\r\n if(this.disableShowmoreButton) this.hideItems($items)\r\n })\r\n } else {\r\n const $items = this.el.querySelectorAll(\r\n '.accordion__item, .accordion__category'\r\n )\r\n if(this.disableShowmoreButton) this.hideItems($items)\r\n }\r\n }\r\n\r\n hideItems($items) {\r\n const { $showMore } = this.domMap\r\n\r\n $items.forEach((item, index) => {\r\n if (index >= this.maxItems) {\r\n item.hidden = true\r\n }\r\n })\r\n\r\n if ($items.length > this.maxItems) {\r\n if($showMore) $showMore.hidden = false\r\n } else {\r\n if($showMore) $showMore.hidden = true\r\n }\r\n }\r\n\r\n showMore() {\r\n const { $showMore, $showLess } = this.domMap\r\n const isDouble = this.el.classList.contains('accordion--double')\r\n\r\n if (isDouble) {\r\n const $columns = this.el.querySelectorAll('.accordion__content-column')\r\n $columns.forEach((column) => {\r\n const $items = column.querySelectorAll(\r\n '.accordion__item, .accordion__category'\r\n )\r\n $items.forEach((item) => (item.hidden = false))\r\n })\r\n } else {\r\n const $items = this.el.querySelectorAll(\r\n '.accordion__item, .accordion__category'\r\n )\r\n $items.forEach((item) => (item.hidden = false))\r\n }\r\n\r\n $showMore.hidden = true\r\n $showLess.hidden = false\r\n }\r\n\r\n showLess() {\r\n const { $showMore, $showLess } = this.domMap\r\n const isDouble = this.el.classList.contains('accordion--double')\r\n\r\n if (isDouble) {\r\n const $columns = this.el.querySelectorAll('.accordion__content-column')\r\n $columns.forEach((column) => {\r\n const $items = column.querySelectorAll(\r\n '.accordion__item, .accordion__category'\r\n )\r\n this.hideItems($items)\r\n })\r\n } else {\r\n const $items = this.el.querySelectorAll(\r\n '.accordion__item, .accordion__category'\r\n )\r\n this.hideItems($items)\r\n }\r\n\r\n $showMore.hidden = false\r\n $showLess.hidden = true\r\n }\r\n}\r\n\r\nexport default Accordion\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":["Accordion","el","_classCallCheck","this","maxItems","domMap","$showMore","querySelector","$showLess","disableShowmoreButton","hasAttribute","getAttribute","hidden","initAccordion","countItems","addListeners","key","value","_this$domMap","addEventListener","showMore","bind","showLess","AccordionWidget","_this","classList","contains","querySelectorAll","forEach","column","$items","hideItems","_this2","item","index","length","_this$domMap2","_this3","_this$domMap3","props","arguments","undefined","triggerClass","panelClass","id","selectedIndex","expandFirst","dataset","firstexpanded","multiSelectable","Number","isInteger","accordionTriggers","getElementsByClassName","accordionPanels","openPanels","_step","panelArr","_iterator","_createForOfIteratorHelper","split","s","n","done","panel","parseInt","push","err","e","f","_init","prototype","initialSelectedIndex","accordionTriggersLength","expandedAccordions","Array","clickListener","_clickEvent","keydownListener","_keydownEvent","focusListener","_focusEvent","keys","prev","next","space","i","add","isNaN","isArray","includes","lastIndexOf","initialSetIndex","setSelected","setExpanded","setAPI","preventDefault","target","targetIndex","keyCode","click","userInvoked","focus","remove","setAttribute","hidePanelContent","setTimeout","hasExpanded","removeAttribute","gsap","to","height","duration","parentElement","close","openInit","destroy","removeEventListener"],"sourceRoot":""}