{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/modal-trigger.js"],"names":["Module","Component","modalId"],"mappings":"kJAEA,MAAMA,UAAeC,WAAU,CAC7B,eAAgB,CACd,MAAMC,EAAU,KAAK,GAAG,aAAa,YAAY,EAEjD,KAAK,IAAM,CACT,IAAK,KAAK,GACV,OAAQ,SAAS,cAAc,GAAGA,GAAS,EAC3C,UAAW,SAAS,cAAc,GAAGA,0BAAgC,EACrE,cAAe,SAAS,cACtB,GAAGA,4BACL,CACF,CACF,CAEA,cAAe,CACb,KAAK,IAAI,IAAI,iBAAiB,QAAS,KAAK,UAAU,KAAK,IAAI,CAAC,EAChE,KAAK,IAAI,UAAU,iBAAiB,QAAS,KAAK,WAAW,KAAK,IAAI,CAAC,EACvE,KAAK,IAAI,cAAc,iBACrB,QACA,KAAK,wBAAwB,KAAK,IAAI,CACxC,EACA,SAAS,iBAAiB,UAAW,KAAK,cAAc,KAAK,IAAI,CAAC,CACpE,CAEA,UAAU,EAAG,CACX,EAAE,eAAe,EACjB,EAAE,gBAAgB,EAClB,KAAK,IAAI,OAAO,UAAU,IAAI,sBAAsB,CACtD,CAEA,WAAW,EAAG,CACZ,EAAE,eAAe,EACjB,EAAE,gBAAgB,EAClB,KAAK,IAAI,OAAO,UAAU,OAAO,sBAAsB,CACzD,CAEA,wBAAwB,EAAG,CACrB,EAAE,OAAO,UAAU,SAAS,yBAAyB,GACvD,KAAK,WAAW,CAAC,CAErB,CAEA,cAAc,EAAG,CACX,EAAE,UAAY,IAChB,KAAK,WAAW,CAAC,CAErB,CACF,CAEA,UAAeF,C","file":"scripts/816.989c84b9.js","sourcesContent":["import { Component } from '@verndale/core';\n\nclass Module extends Component {\n setupDefaults() {\n const modalId = this.el.getAttribute('data-modal');\n\n this.dom = {\n $el: this.el,\n $modal: document.querySelector(`${modalId}`),\n $closeBtn: document.querySelector(`${modalId} .featured-modal__close`),\n $modalWrapper: document.querySelector(\n `${modalId} .featured-modal__wrapper`\n )\n };\n }\n\n addListeners() {\n this.dom.$el.addEventListener('click', this.openModal.bind(this));\n this.dom.$closeBtn.addEventListener('click', this.closeModal.bind(this));\n this.dom.$modalWrapper.addEventListener(\n 'click',\n this.handleOutsideModalClick.bind(this)\n );\n document.addEventListener('keydown', this.handleKeyDown.bind(this));\n }\n\n openModal(e) {\n e.preventDefault();\n e.stopPropagation();\n this.dom.$modal.classList.add('featured-modal__open');\n }\n\n closeModal(e) {\n e.preventDefault();\n e.stopPropagation();\n this.dom.$modal.classList.remove('featured-modal__open');\n }\n\n handleOutsideModalClick(e) {\n if (e.target.classList.contains('featured-modal__wrapper')) {\n this.closeModal(e);\n }\n }\n\n handleKeyDown(e) {\n if (e.keyCode === 27) {\n this.closeModal(e);\n }\n }\n}\n\nexport default Module;\n"],"sourceRoot":""}