{"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,iBAAuB,EAC5D,cAAe,SAAS,cACtB,GAAGA,mBACL,EACA,qBAAsB,SAAS,cAC7B,GAAGA,2BACL,CACF,EAEA,KAAK,aAAe,KAAK,IAAI,qBAAqB,SACpD,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,CACF,CAEA,UAAU,EAAG,CACX,EAAE,eAAe,EACjB,EAAE,gBAAgB,EAClB,KAAK,IAAI,OAAO,UAAU,IAAI,aAAa,CAC7C,CAEA,WAAW,EAAG,CACZ,EAAE,eAAe,EACjB,EAAE,gBAAgB,EAClB,KAAK,IAAI,OAAO,UAAU,OAAO,aAAa,EAC9C,KAAK,IAAI,qBAAqB,UAAY,KAAK,YAGjD,CAEA,wBAAwB,EAAG,CACrB,EAAE,OAAO,UAAU,SAAS,gBAAgB,GAC9C,KAAK,WAAW,CAAC,CAErB,CACF,CAEA,UAAeF,C","file":"scripts/816.a15cf9fc.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} .modal__close`),\n $modalWrapper: document.querySelector(\n `${modalId} .modal__wrapper`\n ),\n $modalContentWrapper: document.querySelector(\n `${modalId} .modal__content-wrapper`\n )\n };\n\n this.modalContent = this.dom.$modalContentWrapper.innerHTML\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 }\n\n openModal(e) {\n e.preventDefault();\n e.stopPropagation();\n this.dom.$modal.classList.add('modal__open');\n }\n\n closeModal(e) {\n e.preventDefault();\n e.stopPropagation();\n this.dom.$modal.classList.remove('modal__open');\n this.dom.$modalContentWrapper.innerHTML = this.modalContent; \n\n\n }\n\n handleOutsideModalClick(e) {\n if (e.target.classList.contains('modal__wrapper')) {\n this.closeModal(e);\n }\n }\n}\n\nexport default Module;\n"],"sourceRoot":""}