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D;IACJ;EAAC;AAAA,KAGL;AACO,SAASE,UAAUA,CAACC,QAAQ,EAAE;EACjCA,QAAQ,CAACC,OAAO,CAAC,UAACC,IAAI,EAAK;IACvB;IACA,IAAIA,IAAI,CAACC,QAAQ,KAAK,CAAC,EAAE;MACrB,IAAIvE,MAAM,CAACsE,IAAI,CAAC;IACpB;EACJ,CAAC,CAAC;AACN","sources":["webpack://WebpackConfig.Web/./app/src/js/responsive-nav-bar.js"],"sourcesContent":["import { ResizeObserver as Polyfill } from '@juggle/resize-observer';\r\nconst ResizeObserver = window.ResizeObserver || Polyfill;\r\n\r\nclass NavBar {\r\n constructor(el) {\r\n\r\n // store for later\r\n this.el = el;\r\n this.mask = el.querySelector('.responsive-nav-bar--ul-mask');\r\n this.content = el.querySelector('ul');\r\n this.prevBtn = el.querySelector('.responsive-nav-bar--button.previous');\r\n this.nextBtn = el.querySelector('.responsive-nav-bar--button.next');\r\n this.tabbedContent = el.classList.contains('responsive-nav-bar--tabbed-content');\r\n this.scrollMode = false;\r\n this.offsetIndex = 0;\r\n this.focusIndex = 0;\r\n this.activeIndex = 0;\r\n this.offset = 0;\r\n this.resizeRequested = false;\r\n this.resizeTimeout = null;\r\n this.touchStartX = null;\r\n this.swipeThreshold = 60;\r\n\r\n // get links in nav bar\r\n this.items = [...el.querySelectorAll('.nav-item a')];\r\n this.itemsCount = this.items.length;\r\n\r\n // loop through links / get active index\r\n for(let x= 0; x < this.itemsCount; x++) {\r\n if(this.items[x].classList.contains('active')) {\r\n this.offsetIndex = x;\r\n this.focusIndex = x;\r\n this.activeIndex = x;\r\n }\r\n this.items[x].addEventListener('click', () => {\r\n this.setActive(x);\r\n });\r\n }\r\n\r\n // buttons\r\n this.prevBtn.addEventListener('click', () => {\r\n this.offsetMove(false);\r\n });\r\n this.nextBtn.addEventListener('click', () => {\r\n this.offsetMove(true);\r\n });\r\n\r\n // keyboard nav\r\n this.el.addEventListener('keydown', (e) => {\r\n switch (e.key) {\r\n // next item (no looping)\r\n case 'Right':\r\n case 'ArrowRight':\r\n e.preventDefault();\r\n this.focusMove(true);\r\n break;\r\n // previous item (no looping)\r\n case 'Left':\r\n case 'ArrowLeft':\r\n e.preventDefault();\r\n this.focusMove(false);\r\n break;\r\n // SPACE/ENTER/RETURN to click a item\r\n case 'Spacebar':\r\n case ' ':\r\n case 'Enter':\r\n case 'Return':\r\n e.preventDefault();\r\n this.items[this.focusIndex].click();\r\n break;\r\n }\r\n });\r\n\r\n // swiping\r\n this.mask.ontouchstart = (e) => {\r\n if (e.touches.length == 1) {\r\n let touch = e.touches[0];\r\n this.touchStartX = touch.pageX;\r\n }\r\n };\r\n this.el.ontouchmove = (e) => {\r\n if (this.touchStartX != null) {\r\n e.preventDefault();\r\n let touchCurrentX = e.changedTouches[0].pageX;\r\n if ((touchCurrentX - this.touchStartX) > this.swipeThreshold) {\r\n this.touchStartX = null;\r\n this.offsetMove(false);\r\n } else if ((this.touchStartX - touchCurrentX) > this.swipeThreshold) {\r\n this.touchStartX = null;\r\n this.offsetMove(true);\r\n }\r\n }\r\n };\r\n this.el.ontouchend = () => {\r\n this.touchStartX = null;\r\n };\r\n\r\n // add resize observer\r\n this.ro = new ResizeObserver(() => {\r\n if(!this.resizeRequested) {\r\n this.resizeRequested = true;\r\n this.resizeTimeout = setTimeout(() => {\r\n this.resize();\r\n this.resizeRequested = false;\r\n this.resizeTimeout = null;\r\n }, 200);\r\n }\r\n });\r\n this.ro.observe(this.el); // Watch dimension changes wrapping element\r\n\r\n }\r\n\r\n offsetMove(mode) {\r\n let prevIndex = this.offsetIndex;\r\n if(mode && this.offsetIndex < (this.itemsCount-1)) {\r\n this.offsetIndex = this.offsetIndex + 1;\r\n } else if(!mode && this.offsetIndex > 0) {\r\n this.offsetIndex = this.offsetIndex - 1;\r\n }\r\n if(prevIndex !== this.offsetIndex) {\r\n this.updateOffset();\r\n }\r\n }\r\n\r\n focusMove(mode) {\r\n let prevIndex = this.focusIndex;\r\n if(mode && this.focusIndex < (this.itemsCount-1)) {\r\n this.focusIndex = this.focusIndex + 1;\r\n } else if(!mode && this.focusIndex > 0) {\r\n this.focusIndex = this.focusIndex - 1;\r\n }\r\n if(prevIndex !== this.focusIndex) {\r\n this.items[this.focusIndex].setAttribute('tabIndex','0');\r\n this.items[this.focusIndex].focus();\r\n this.items[prevIndex].setAttribute('tabIndex','-1');\r\n this.offsetIndex = this.focusIndex;\r\n this.updateOffset();\r\n }\r\n }\r\n\r\n setActive(newIndex) {\r\n if(newIndex != this.activeIndex) {\r\n if(!this.tabbedContent) this.items[this.activeIndex].classList.remove('active');\r\n this.items[this.activeIndex].setAttribute('tabIndex','-1');\r\n this.activeIndex = newIndex;\r\n this.focusIndex = newIndex;\r\n if(!this.tabbedContent) this.items[this.activeIndex].classList.add('active');\r\n this.items[this.activeIndex].setAttribute('tabIndex','0');\r\n }\r\n }\r\n\r\n resize() {\r\n if(this.content.offsetWidth > this.mask.offsetWidth) {\r\n if(!this.scrollMode) {\r\n this.scrollMode = true;\r\n this.el.classList.add('scroll');\r\n }\r\n this.updateOffset();\r\n } else {\r\n if(this.scrollMode) {\r\n this.scrollMode = false;\r\n this.el.classList.remove('scroll');\r\n this.offset = 0;\r\n this.content.style.transform = 'translateX(0)';\r\n }\r\n }\r\n }\r\n\r\n updateOffset() {\r\n if(this.scrollMode) {\r\n let itemLeft = this.items[this.offsetIndex].offsetLeft,\r\n maskWidth = this.mask.offsetWidth,\r\n contentWidth = this.content.offsetWidth,\r\n offsetMax = contentWidth - maskWidth;\r\n this.offset = itemLeft > offsetMax ? offsetMax : itemLeft;\r\n this.content.style.transform = 'translateX(-' + this.offset + 'px)';\r\n // update buttons status\r\n this.prevBtn.disabled = this.offsetIndex == 0;\r\n this.nextBtn.disabled = this.offset >= offsetMax;\r\n }\r\n }\r\n}\r\n\r\n// export the default function to create\r\nexport function createFrom(wrappers) {\r\n wrappers.forEach((node) => {\r\n // if node is an element\r\n if (node.nodeType === 1) {\r\n new NavBar(node);\r\n }\r\n });\r\n}"],"names":["ResizeObserver","Polyfill","window","NavBar","el","_this","_classCallCheck","mask","querySelector","content","prevBtn","nextBtn","tabbedContent","classList","contains","scrollMode","offsetIndex","focusIndex","activeIndex","offset","resizeRequested","resizeTimeout","touchStartX","swipeThreshold","items","_toConsumableArray","querySelectorAll","itemsCount","length","_loop","x","addEventListener","setActive","offsetMove","e","key","preventDefault","focusMove","click","ontouchstart","touches","touch","pageX","ontouchmove","touchCurrentX","changedTouches","ontouchend","ro","setTimeout","resize","observe","_createClass","value","mode","prevIndex","updateOffset","setAttribute","focus","newIndex","remove","add","offsetWidth","style","transform","itemLeft","offsetLeft","maskWidth","contentWidth","offsetMax","disabled","createFrom","wrappers","forEach","node","nodeType"],"sourceRoot":""}