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webpack://frontend-build-tools/./src/feature/accordion/accordion.js"],"sourcesContent":["import BaseFeature from 'foundation/base/base';\r\n\r\nclass Accordion extends BaseFeature {\r\n constructor(element) {\r\n super(element);\r\n this.element = element;\r\n this.selector = this.settings.selector ?\r\n element.querySelector(this.settings.selector) :\r\n element.querySelector(['[data-ref=\"accordion-click-handler\"]']);\r\n this.target = this.settings.target ? element.querySelector(this.settings.target) : this.element;\r\n this.toggleClass = this.settings.toggleClass ?? 'is-collapsed';\r\n this.isOpen = this.settings.isOpen ?? false;\r\n this.contentContainer = element.querySelector(['[data-ref=\"accordion-content\"]']);\r\n this.contentHeight = this.contentContainer.clientHeight;\r\n this.id = element.getAttribute('id') ?? null;\r\n\r\n this.init();\r\n }\r\n\r\n init() {\r\n if (!this.selector || !this.target) {\r\n return;\r\n }\r\n\r\n if (window.location.hash.length && decodeURIComponent(window.location.hash).includes(this.id)) {\r\n this.isOpen = true;\r\n this.target.classList.remove(this.toggleClass);\r\n } else if (!this.isOpen) {\r\n this.target.classList.add(this.toggleClass);\r\n }\r\n\r\n this.setContentHeight(this.isOpen);\r\n\r\n this.selector.addEventListener('click', (ev) => {\r\n this.clickListener(ev);\r\n }, false);\r\n }\r\n\r\n clickListener(ev) {\r\n ev.preventDefault();\r\n ev.stopPropagation();\r\n\r\n this.isOpen = !this.isOpen;\r\n this.setContentHeight(this.isOpen);\r\n this.target.classList.toggle(this.toggleClass);\r\n }\r\n\r\n // We do this in JS instead of CSS to have nice transition states betweeen collapsed and open\r\n setContentHeight(isOpen) {\r\n if (!this.contentContainer) {\r\n return;\r\n }\r\n\r\n let maxHeight = 0;\r\n\r\n if (isOpen) {\r\n maxHeight = this.contentHeight;\r\n }\r\n\r\n this.contentContainer.style.maxHeight = maxHeight + 'px';\r\n }\r\n}\r\n\r\nexport default Accordion;\r\n"],"names":["Accordion","BaseFeature","constructor","element","super","this","selector","settings","querySelector","target","toggleClass","isOpen","contentContainer","contentHeight","clientHeight","id","getAttribute","init","window","location","hash","length","decodeURIComponent","includes","classList","remove","add","setContentHeight","addEventListener","ev","clickListener","preventDefault","stopPropagation","toggle","maxHeight","style"],"sourceRoot":""}