{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/testimonials.js"],"names":["Testimonials","Component","slides","Swiper","Navigation","Pagination","Keyboard","A11y","index","className","notificationSpan","message"],"mappings":"4JAGA,MAAMA,UAAqBC,WAAU,CACnC,eAAgB,CACd,KAAK,IAAM,CACT,UAAW,KAAK,GAAG,cAAc,mBAAmB,EACpD,kBAAmB,KAAK,GAAG,cAAc,2BAA2B,EACpE,WAAY,KAAK,GAAG,cAAc,oBAAoB,EACtD,KAAM,KAAK,GAAG,cAAc,qBAAqB,EACjD,KAAM,KAAK,GAAG,cAAc,qBAAqB,CACnD,EACA,KAAK,WAAW,CAClB,CAEA,YAAa,CACX,MAAMC,EAAS,KAAK,GAAG,iBAAiB,eAAe,EACpDA,EAAO,OAAS,IACjB,KAAK,QAAQ,QAAQ,GAAM,EAAI,EAC/B,KAAK,OAAS,KAEd,KAAK,OAAS,IAAIC,UAAO,KAAK,IAAI,UAAW,CAC3C,QAAS,CAACC,aAAYC,aAAYC,WAAUC,MAAI,EAChD,eAAgB,GAChB,KAAM,GACN,aAAc,GACd,cAAe,EACf,cAAe,GACf,eAAgB,CACd,WAAY,EACd,EACA,WAAY,CACV,GAAI,KAAK,IAAI,WACb,UAAW,GACX,eAAgBL,EAAO,OAAS,EAChC,aAAaM,EAAOC,EAAW,CAC7B,MAAO,kBAAoBA,wEAAkFD,2BAC/G,CACF,EACA,WAAY,CACV,OAAQ,KAAK,IAAI,KACjB,OAAQ,KAAK,IAAI,IACnB,EACA,KAAM,CACJ,iBAAkB,iBAClB,iBAAkB,aAClB,kBAAmB,gCACnB,iBAAkB,gCACpB,CACF,CAAC,GAEAN,EAAO,OAAS,GACjB,KAAK,IAAI,kBAAkB,OAAO,CAEtC,CAEA,cAAe,CACV,KAAK,QACN,KAAK,OAAO,GAAG,gBAAiB,KAAK,kBAAkB,KAAK,IAAI,CAAC,CAErE,CAEA,mBAAoB,CAClB,MAAMQ,EAAmB,KAAK,IAAI,UAAU,cAAc,sBAAsB,EAEhF,IAAIC,EADgB,KAAK,IAAI,UAAU,cAAc,sBAAsB,EACjD,UACtB,KAAK,OAAO,cAAaA,GAAW,6BACpC,KAAK,OAAO,QAAOA,GAAW,4BAC9BD,IACFA,EAAiB,YAAcC,EAGnC,CACF,CAEA,UAAeX,C","file":"scripts/706.3b76b114.js","sourcesContent":["import { Component } from '@verndale/core';\nimport Swiper, { Navigation, Pagination, Keyboard, A11y } from 'swiper'\n\nclass Testimonials extends Component {\n setupDefaults() {\n this.dom = {\n container: this.el.querySelector('.swiper-container'),\n paginationWrapper: this.el.querySelector('.testimonials__pagination'),\n pagination: this.el.querySelector('.swiper-pagination'),\n next: this.el.querySelector('.swiper-button-next'),\n prev: this.el.querySelector('.swiper-button-prev')\n };\n this.initSlider();\n }\n\n initSlider() {\n const slides = this.el.querySelectorAll(\".swiper-slide\");\n if(slides.length > 0) {\n this.slider?.destroy(true, true);\n this.slider = null;\n // eslint-disable-next-line new-cap\n this.slider = new Swiper(this.dom.container, {\n modules: [Navigation, Pagination, Keyboard, A11y],\n centeredSlides: true,\n loop: true,\n spaceBetween: 25,\n slidesPerView: 1,\n watchOverflow: true,\n hashNavigation: {\n watchState: true\n },\n pagination: {\n el: this.dom.pagination,\n clickable: true,\n dynamicBullets: slides.length > 5,\n renderBullet(index, className) {\n return ``;\n },\n },\n navigation: {\n nextEl: this.dom.next,\n prevEl: this.dom.prev\n },\n a11y: {\n prevSlideMessage: 'Previous slide',\n nextSlideMessage: 'Next slide',\n slideLabelMessage: '{{index}} of {{slidesLength}}',\n containerMessage: \"People's Testimonial Carousell\"\n }\n });\n }\n if(slides.length < 2) {\n this.dom.paginationWrapper.remove();\n }\n }\n\n addListeners() {\n if(this.slider) {\n this.slider.on('transitionEnd', this.handleSlideChange.bind(this));\n }\n }\n\n handleSlideChange() {\n const notificationSpan = this.dom.container.querySelector('.swiper-notification');\n const activeSlide = this.dom.container.querySelector('.swiper-slide-active');\n let message = activeSlide.ariaLabel;\n if (this.slider.isBeginning) message += \". This is the first Slide\"\n if (this.slider.isEnd) message += \". This is the last Slide\"\n if (notificationSpan){\n notificationSpan.textContent = message;\n }\n\n }\n}\n\nexport default Testimonials;\n"],"sourceRoot":""}