{"version":3,"file":"genericCarousel-bbaKF2G4.js","sources":["../../src/scripts/modules/genericCarousel.ts"],"sourcesContent":["import { Component } from '@verndale/core';\r\nimport Swiper from 'swiper';\r\nimport { A11y, Navigation, Pagination } from 'swiper/modules';\r\nimport 'swiper/css/bundle';\r\n\r\nclass GenericCarousel extends Component {\r\n swiperInstance: Swiper | undefined = undefined;\r\n\r\n setupDefaults() {\r\n this.dom = {\r\n $swiperContainer: this.el.querySelector<HTMLElement>('.swiper-container'),\r\n $swiperNext: this.el.querySelector<HTMLElement>('.btn-next-slide'),\r\n $swiperPrevious: this.el.querySelector<HTMLElement>('.btn-previous-slide'),\r\n $swiperScroll: this.el.querySelector<HTMLElement>('.generic-carousel__pagination-container')\r\n };\r\n\r\n this.initSlider();\r\n }\r\n\r\n initSlider() {\r\n if (this.dom.$swiperContainer) {\r\n const isGenericCard = this.el.classList.contains('generic-carousel--generic-card');\r\n const isMagazineCard = this.el.classList.contains('generic-carousel--magazine-card');\r\n\r\n this.swiperInstance = new Swiper(this.dom.$swiperContainer as HTMLElement, {\r\n modules: [Navigation, Pagination, A11y],\r\n keyboard: {\r\n enabled: false\r\n },\r\n breakpoints: {\r\n 320: {\r\n slidesPerView: 1,\r\n spaceBetween: 40\r\n },\r\n 768: {\r\n slidesPerView: isGenericCard ? 2.6 : isMagazineCard ? 4 : 3,\r\n spaceBetween: 40\r\n },\r\n 1440: {\r\n slidesPerView: isGenericCard ? 2.6 : isMagazineCard ? 4 : 3.1,\r\n spaceBetween: 40\r\n },\r\n 1620: {\r\n slidesPerView: isGenericCard ? 2.6 : isMagazineCard ? 4 : 3.5,\r\n spaceBetween: 40\r\n }\r\n },\r\n a11y: {\r\n enabled: true\r\n },\r\n // Navigation arrows\r\n navigation: {\r\n nextEl: this.dom.$swiperNext as HTMLElement,\r\n prevEl: this.dom.$swiperPrevious as HTMLElement\r\n },\r\n pagination: {\r\n el: this.dom.$swiperScroll as HTMLElement,\r\n type: 'progressbar'\r\n }\r\n });\r\n }\r\n }\r\n}\r\n\r\nexport default GenericCarousel;\r\n"],"names":["GenericCarousel","Component","__publicField","isGenericCard","isMagazineCard","Swiper","Navigation","Pagination","A11y"],"mappings":"4VAKA,MAAMA,UAAwBC,CAAU,CAAxC,kCACEC,EAAA,uBAEA,eAAgB,CACd,KAAK,IAAM,CACT,iBAAkB,KAAK,GAAG,cAA2B,mBAAmB,EACxE,YAAa,KAAK,GAAG,cAA2B,iBAAiB,EACjE,gBAAiB,KAAK,GAAG,cAA2B,qBAAqB,EACzE,cAAe,KAAK,GAAG,cAA2B,yCAAyC,CAC7F,EAEA,KAAK,WAAW,CAAA,CAGlB,YAAa,CACP,GAAA,KAAK,IAAI,iBAAkB,CAC7B,MAAMC,EAAgB,KAAK,GAAG,UAAU,SAAS,gCAAgC,EAC3EC,EAAiB,KAAK,GAAG,UAAU,SAAS,iCAAiC,EAEnF,KAAK,eAAiB,IAAIC,EAAO,KAAK,IAAI,iBAAiC,CACzE,QAAS,CAACC,EAAYC,EAAYC,CAAI,EACtC,SAAU,CACR,QAAS,EACX,EACA,YAAa,CACX,IAAK,CACH,cAAe,EACf,aAAc,EAChB,EACA,IAAK,CACH,cAAeL,EAAgB,IAAMC,EAAiB,EAAI,EAC1D,aAAc,EAChB,EACA,KAAM,CACJ,cAAeD,EAAgB,IAAMC,EAAiB,EAAI,IAC1D,aAAc,EAChB,EACA,KAAM,CACJ,cAAeD,EAAgB,IAAMC,EAAiB,EAAI,IAC1D,aAAc,EAAA,CAElB,EACA,KAAM,CACJ,QAAS,EACX,EAEA,WAAY,CACV,OAAQ,KAAK,IAAI,YACjB,OAAQ,KAAK,IAAI,eACnB,EACA,WAAY,CACV,GAAI,KAAK,IAAI,cACb,KAAM,aAAA,CACR,CACD,CAAA,CACH,CAEJ"}