{"version":3,"file":"slidingCardContainer-BSEot-Gj.js","sources":["../../src/scripts/modules/slidingCardContainer.ts"],"sourcesContent":["import { Component } from '@verndale/core';\nimport Swiper from 'swiper';\nimport { Navigation, Keyboard, Pagination, Controller } from 'swiper/modules';\nimport { isSmallDesktop } from '../helpers';\nimport { eventBus } from '../helpers/resize';\nimport 'swiper/css/bundle';\n\nclass slidingCardContainer extends Component {\n public slidingCardContainer: { destroy?: () => void | undefined };\n\n constructor(el: HTMLElement) {\n super(el);\n this.slidingCardContainer = {};\n }\n\n setupDefaults() {\n this.dom = {\n el: this.el,\n swiperContainer: this.el.querySelector('.swiper'),\n swiperWrapper: this.el.querySelector('.swiper-wrapper'),\n swiperItems: this.el.querySelectorAll('.swiper-slide'),\n pagination: this.el.querySelector('.sliding-card__slider-pagination'),\n prevButton: this.el.querySelector('.btn-previous-slide'),\n nextButton: this.el.querySelector('.btn-next-slide')\n };\n\n if (!isSmallDesktop()) {\n this.initSwiper();\n } else {\n (this.dom.swiperItems as NodeList).forEach(item => {\n (item as HTMLElement).classList.remove('swiper-slide');\n });\n }\n }\n\n addListeners() {\n eventBus.subscribe('breakpointChange', (breakpoint: string) => {\n this.manageSwiper(breakpoint);\n });\n }\n\n manageSwiper(breakpoint: string) {\n if (\n breakpoint === 'tablet' ||\n breakpoint === 'mobile' ||\n breakpoint === 'tabletLandscape' ||\n breakpoint === 'smallDesktop'\n ) {\n (this.dom.swiperItems as NodeList).forEach(item => {\n (item as HTMLElement).classList.add('swiper-slide');\n });\n this.initSwiper();\n } else {\n if (this.slidingCardContainer) {\n if (this.slidingCardContainer.destroy) {\n this.slidingCardContainer.destroy();\n }\n }\n (this.dom.swiperItems as NodeList).forEach(item => {\n (item as HTMLElement).classList.remove('swiper-slide');\n });\n }\n }\n\n initSwiper() {\n Swiper.use([Navigation, Keyboard, Pagination, Controller]);\n\n this.slidingCardContainer = new Swiper(this.dom.swiperContainer as HTMLElement, {\n pagination: {\n el: this.dom.pagination as HTMLElement,\n type: 'progressbar'\n },\n navigation: {\n nextEl: this.dom.nextButton as HTMLElement,\n prevEl: this.dom.prevButton as HTMLElement\n },\n slidesPerView: 1.22,\n autoHeight: false,\n loop: true\n });\n }\n}\n\nexport default slidingCardContainer;\n"],"names":["slidingCardContainer","Component","el","__publicField","isSmallDesktop","item","eventBus","breakpoint","Swiper","Navigation","Keyboard","Pagination","Controller"],"mappings":"sbAOA,MAAMA,UAA6BC,CAAU,CAG3C,YAAYC,EAAiB,CAC3B,MAAMA,CAAE,EAHHC,EAAA,6BAIL,KAAK,qBAAuB,EAC9B,CAEA,eAAgB,CACd,KAAK,IAAM,CACT,GAAI,KAAK,GACT,gBAAiB,KAAK,GAAG,cAA2B,SAAS,EAC7D,cAAe,KAAK,GAAG,cAA2B,iBAAiB,EACnE,YAAa,KAAK,GAAG,iBAA8B,eAAe,EAClE,WAAY,KAAK,GAAG,cAA2B,kCAAkC,EACjF,WAAY,KAAK,GAAG,cAA2B,qBAAqB,EACpE,WAAY,KAAK,GAAG,cAA2B,iBAAiB,CAAA,EAG7DC,IAGF,KAAK,IAAI,YAAyB,QAAgBC,GAAA,CAChDA,EAAqB,UAAU,OAAO,cAAc,CAAA,CACtD,EAJD,KAAK,WAAW,CAMpB,CAEA,cAAe,CACJC,EAAA,UAAU,mBAAqBC,GAAuB,CAC7D,KAAK,aAAaA,CAAU,CAAA,CAC7B,CACH,CAEA,aAAaA,EAAoB,CAE7BA,IAAe,UACfA,IAAe,UACfA,IAAe,mBACfA,IAAe,gBAEd,KAAK,IAAI,YAAyB,QAAgBF,GAAA,CAChDA,EAAqB,UAAU,IAAI,cAAc,CAAA,CACnD,EACD,KAAK,WAAW,IAEZ,KAAK,sBACH,KAAK,qBAAqB,SAC5B,KAAK,qBAAqB,UAG7B,KAAK,IAAI,YAAyB,QAAgBA,GAAA,CAChDA,EAAqB,UAAU,OAAO,cAAc,CAAA,CACtD,EAEL,CAEA,YAAa,CACXG,EAAO,IAAI,CAACC,EAAYC,EAAUC,EAAYC,CAAU,CAAC,EAEzD,KAAK,qBAAuB,IAAIJ,EAAO,KAAK,IAAI,gBAAgC,CAC9E,WAAY,CACV,GAAI,KAAK,IAAI,WACb,KAAM,aACR,EACA,WAAY,CACV,OAAQ,KAAK,IAAI,WACjB,OAAQ,KAAK,IAAI,UACnB,EACA,cAAe,KACf,WAAY,GACZ,KAAM,EAAA,CACP,CACH,CACF"}