{"version":3,"sources":["block-package.js"],"names":["BlockPackage","constructor","container","options","this","Object","assign","swiperActive","swiperElement","swiperPagination","swiperPaginationNext","swiperPaginationPrevious","modal","modalTrigger","modalClose","document","querySelector","swiperElem","modals","querySelectorAll","modalOpenButtons","modalCloseButtons","initSlider","setEvents","forEach","trigger","addEventListener","e","stopPropagation","dataset","modalId","modalOpen","classList","add","icon","remove","Swiper","direction","loop","grabCursor","slidesPerView","centeredSlides","initialSlide","spaceBetween","pagination","el","clickable","navigation","nextEl","prevEl","breakpoints","1024","1200"],"mappings":"qBAAqBA,aACjBC,YAAYC,EAAWC,GAYnBC,KAAKD,QAAUE,OAAOC,OAAO,GAXN,CACnBC,aAAc,CAAA,EACdC,cAAe,UACfC,iBAAkB,qBAClBC,qBAAsB,sBACtBC,yBAA0B,sBAC1BC,MAAO,iBACPC,aAAc,iBACdC,WAAY,mBAChB,EAEiDX,CAAO,EAExDC,KAAKF,UAAYa,SAASC,cAAcd,CAAS,EACjDE,KAAKa,WAAab,KAAKF,UAAUc,cAAcZ,KAAKD,QAAQK,aAAa,EACzEJ,KAAKK,iBAAmBL,KAAKF,UAAUc,cAAcZ,KAAKD,QAAQM,gBAAgB,EAClFL,KAAKM,qBAAuBN,KAAKF,UAAUc,cAAcZ,KAAKD,QAAQO,oBAAoB,EAC1FN,KAAKO,yBAA2BP,KAAKF,UAAUc,cAAcZ,KAAKD,QAAQQ,wBAAwB,EAClGP,KAAKc,OAASd,KAAKF,UAAUiB,iBAAiBf,KAAKD,QAAQS,KAAK,EAChER,KAAKgB,iBAAmBhB,KAAKF,UAAUiB,iBAAiBf,KAAKD,QAAQU,YAAY,EACjFT,KAAKiB,kBAAoBjB,KAAKF,UAAUiB,iBAAiBf,KAAKD,QAAQW,UAAU,EAE7EV,KAAKD,QAAQI,cACZH,KAAKkB,WAAW,EAGpBlB,KAAKmB,UAAU,CACnB,CAEAA,YACInB,KAAKgB,iBAAiBI,QAAQC,IAC1BA,EAAQC,iBAAiB,QAASC,IAC9BA,EAAEC,gBAAgB,EAClBxB,KAAKc,OAAOM,QAAQZ,IACZA,EAAMiB,QAAQC,UAAYL,EAAQI,QAAQE,WAC1CnB,EAAMoB,UAAUC,IAAI,QAAQ,CAEpC,CAAC,CACL,CAAC,CACL,CAAC,EAED7B,KAAKiB,kBAAkBG,QAAQU,IAC3BA,EAAKR,iBAAiB,QAASC,IAC3BA,EAAEC,gBAAgB,EAClBxB,KAAKc,OAAOM,QAAQZ,IAChBA,EAAMoB,UAAUG,OAAO,QAAQ,CACnC,CAAC,CACL,CAAC,CACL,CAAC,CACL,CAEAb,aACI,IAAIc,OAAOhC,KAAKa,WAAY,CACxBoB,UAAW,aACXC,KAAM,CAAA,EACNC,WAAY,CAAA,EACZC,cAAe,KAEfC,eAAgB,CAAA,EAChBC,aAAc,EACdC,aAAc,GACdC,WAAY,CACRC,GAAIzC,KAAKK,iBACTqC,UAAW,CAAA,CACf,EACAC,WAAY,CACRC,OAAQ5C,KAAKM,qBACbuC,OAAQ7C,KAAKO,wBACjB,EACAuC,YAAa,CACTC,KAAM,CACFX,cAAe,EACfC,eAAgB,CAAA,EAChBE,aAAc,EAClB,EACAS,KAAM,CACFZ,cAAe,EACfC,eAAgB,CAAA,EAChBE,aAAc,EAClB,CACJ,CACJ,CAAC,CACL,CACJ","file":"block-package.min.js","sourcesContent":["export default class BlockPackage {\r\n constructor(container, options) {\r\n const defaultOptions = {\r\n swiperActive: false,\r\n swiperElement: '.swiper',\r\n swiperPagination: '.swiper-pagination',\r\n swiperPaginationNext: '.swiper-button-next',\r\n swiperPaginationPrevious: '.swiper-button-prev',\r\n modal: '.package-modal',\r\n modalTrigger: '.modal-trigger',\r\n modalClose: '.icon-modal-close',\r\n };\r\n \r\n this.options = Object.assign({}, defaultOptions, options);\r\n \r\n this.container = document.querySelector(container);\r\n this.swiperElem = this.container.querySelector(this.options.swiperElement);\r\n this.swiperPagination = this.container.querySelector(this.options.swiperPagination);\r\n this.swiperPaginationNext = this.container.querySelector(this.options.swiperPaginationNext);\r\n this.swiperPaginationPrevious = this.container.querySelector(this.options.swiperPaginationPrevious);\r\n this.modals = this.container.querySelectorAll(this.options.modal);\r\n this.modalOpenButtons = this.container.querySelectorAll(this.options.modalTrigger);\r\n this.modalCloseButtons = this.container.querySelectorAll(this.options.modalClose);\r\n \r\n if(this.options.swiperActive) {\r\n this.initSlider();\r\n }\r\n\r\n this.setEvents();\r\n }\r\n\r\n setEvents() {\r\n this.modalOpenButtons.forEach(trigger => {\r\n trigger.addEventListener('click', e => {\r\n e.stopPropagation()\r\n this.modals.forEach(modal => {\r\n if (modal.dataset.modalId === trigger.dataset.modalOpen) {\r\n modal.classList.add('active')\r\n }\r\n })\r\n })\r\n })\r\n\r\n this.modalCloseButtons.forEach(icon => {\r\n icon.addEventListener('click', e => {\r\n e.stopPropagation();\r\n this.modals.forEach(modal => {\r\n modal.classList.remove('active');\r\n })\r\n })\r\n }) \r\n }\r\n \r\n initSlider() {\r\n new Swiper(this.swiperElem, {\r\n direction: 'horizontal',\r\n loop: false,\r\n grabCursor: true,\r\n slidesPerView: 1.15,\r\n // centeredSlides: true,\r\n centeredSlides: false,\r\n initialSlide: 0,\r\n spaceBetween: 15,\r\n pagination: {\r\n el: this.swiperPagination,\r\n clickable: true\r\n },\r\n navigation: {\r\n nextEl: this.swiperPaginationNext,\r\n prevEl: this.swiperPaginationPrevious,\r\n },\r\n breakpoints: {\r\n 1024: {\r\n slidesPerView: 3,\r\n centeredSlides: false,\r\n spaceBetween: 30\r\n },\r\n 1200: {\r\n slidesPerView: 3,\r\n centeredSlides: false,\r\n spaceBetween: 30\r\n }\r\n }\r\n });\r\n }\r\n}"]}