{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/quick-access-card.js"],"names":["Module","Component","BREAKPOINTS","el","i","$trigger","e","$el","$panel","id","eventName","event","tab","controls"],"mappings":"sKAGA,MAAMA,UAAeC,WAAU,CAC7B,eAAgB,CACd,KAAK,IAAM,CACT,MAAO,KAAK,GAAG,GAAG,0BAA0B,EAC5C,QAAS,KAAK,GAAG,IAAI,2BAA2B,EAChD,UAAW,KAAK,GAAG,IAAI,6BAA6B,EACpD,mBAAoB,KAAK,GAAG,GAAG,8BAA8B,EAC7D,cAAe,KAAK,GAAG,IAAI,kCAAkC,EAC7D,iBAAkB,KAAK,GAAG,IAAI,sCAAsC,EACpE,YAAa,KAAK,GAAG,IAAI,gCAAgC,CAC3D,EAEA,KAAK,WAAa,KAAK,IAAI,MAAM,QAAQ,WACzC,KAAK,sBAAwB,OAAO,WAAW,eAAeC,KAAY,qBAAqB,EAC/F,KAAK,MAAM,EACX,KAAK,iBAAiB,CACxB,CAEA,cAAe,CACb,KAAK,IAAI,iBAAiB,IAAI,QAAS,KAAK,0BAA0B,KAAK,IAAI,CAAC,EAChF,KAAK,sBAAsB,iBAAiB,SAAU,KAAK,iBAAiB,KAAK,IAAI,CAAC,CACxF,CAEA,OAAQ,CACN,KAAK,IAAI,cAAc,QAAQ,CAACC,EAAIC,IAAM,CACxC,KAAK,IAAI,mBAAmB,OAAOD,CAAE,EACrC,MAAME,EAAWF,EAAG,GAAG,6BAA6B,EACpDE,EAAS,aAAa,OAAQ,KAAK,EACnCA,EAAS,QAAQ,MAAQD,EACzBC,EAAS,QAAQ,WAAa,KAAK,WACnC,KAAK,IAAI,QAAQD,GAAG,QAAQ,WAAa,KAAK,WAC9C,KAAK,IAAI,YAAYA,GAAG,UAAY,OAAOD,EAAG,YAAY,KAAK,QACjE,CAAC,CACH,CAEA,0BAA0BG,EAAG,CAC3B,MAAMC,EAAMD,EAAE,OACRE,EAASD,EAAI,QAAQ,2BAA2B,EAChDE,EAAKF,EAAI,QAAQ,GAEjBG,EADWF,EAAO,aAAa,aAAa,IAAM,OAC3B,cAAgB,gBACvCG,EAAQ,IAAI,YAAYD,EAAW,CAAE,OAAQ,CAAE,GAAAD,EAAI,uBAAwB,EAAK,CAAE,CAAC,EAEzF,KAAK,IAAI,MAAM,cAAcE,CAAK,CACpC,CAEA,kBAAmB,CAEjB,GADI,CAAC,KAAK,sBAAsB,SAC5B,KAAK,IAAI,UAAU,KAAKR,GAAMA,EAAG,aAAa,eAAe,IAAM,MAAM,EAAG,OAEhF,MAAMS,EAAM,KAAK,IAAI,UAAU,GAC/BA,EAAI,aAAa,gBAAiB,MAAM,EACxC,MAAMC,EAAWD,EAAI,aAAa,eAAe,EACjD,SAAS,eAAeC,CAAQ,EAAE,gBAAgB,aAAa,CACjE,CACF,CAEA,UAAeb,C","file":"Areas/SunriseSeniorLiving/Scripts/2672.6a9432a1463ad7d27463.bundle.js","sourcesContent":["import { Component } from '@verndale/core';\nimport { BREAKPOINTS } from '../constants';\n\nclass Module extends Component {\n setupDefaults() {\n this.dom = {\n $tabs: this.el._$('.quick-access-card__tabs'),\n $panels: this.el._$$('.quick-access-card__panel'),\n $triggers: this.el._$$('.quick-access-card__trigger'),\n $triggersContainer: this.el._$('.quick-access-card__triggers'),\n $triggerItems: this.el._$$('.quick-access-card__trigger-item'),\n $inPanelTriggers: this.el._$$('.quick-access-card__in-panel-trigger'),\n $cardTitles: this.el._$$('.quick-access-card__card-title')\n };\n\n this.identifier = this.dom.$tabs.dataset.identifier;\n this.tabsDisplayBreakpoint = window.matchMedia(`(min-width: ${BREAKPOINTS.TABLET_LANDSCAPE}px)`);\n this.setup();\n this.activateFirstTab();\n }\n\n addListeners() {\n this.dom.$inPanelTriggers._on('click', this.handleInPanelTriggerClick.bind(this));\n this.tabsDisplayBreakpoint.addEventListener('change', this.activateFirstTab.bind(this));\n }\n\n setup() {\n this.dom.$triggerItems.forEach((el, i) => {\n this.dom.$triggersContainer.append(el);\n const $trigger = el._$('.quick-access-card__trigger');\n $trigger.setAttribute('role', 'tab');\n $trigger.dataset.index = i;\n $trigger.dataset.identifier = this.identifier;\n this.dom.$panels[i].dataset.identifier = this.identifier;\n this.dom.$cardTitles[i].innerHTML = `

${el.textContent.trim()}

`;\n });\n }\n\n handleInPanelTriggerClick(e) {\n const $el = e.target;\n const $panel = $el.closest('.quick-access-card__panel');\n const id = $el.dataset.id;\n const isHidden = $panel.getAttribute('aria-hidden') === 'true';\n const eventName = isHidden ? 'activatetab' : 'deactivatetab';\n const event = new CustomEvent(eventName, { detail: { id, keepOtherTabsActivated: true } });\n\n this.dom.$tabs.dispatchEvent(event);\n }\n\n activateFirstTab() {\n if (!this.tabsDisplayBreakpoint.matches) return;\n if (this.dom.$triggers.find(el => el.getAttribute('aria-selected') === 'true')) return;\n\n const tab = this.dom.$triggers[0];\n tab.setAttribute('aria-selected', 'true');\n const controls = tab.getAttribute('aria-controls');\n document.getElementById(controls).removeAttribute('aria-hidden');\n }\n}\n\nexport default Module;\n"],"sourceRoot":""}