1/* eslint-disable */ 2this.BX = this.BX || {}; 3(function (exports,ui_vue3) { 4 'use strict'; 5 6 /** 7 * Vue 3 Carousel 0.3.3 8 * (c) 2024 9 * @license MIT 10 */ 11 12 // origin-start 13 var defaultConfigs = { 14 itemsToShow: 1, 15 itemsToScroll: 1, 16 modelValue: 0, 17 transition: 300, 18 autoplay: 0, 19 snapAlign: 'center', 20 wrapAround: false, 21 throttle: 16, 22 pauseAutoplayOnHover: false, 23 mouseDrag: true, 24 touchDrag: true, 25 dir: 'ltr', 26 breakpoints: undefined, 27 i18n: { 28 ariaNextSlide: 'Navigate to next slide', 29 ariaPreviousSlide: 'Navigate to previous slide', 30 ariaNavigateToSlide: 'Navigate to slide {slideNumber}', 31 ariaGallery: 'Gallery', 32 itemXofY: 'Item {currentSlide} of {slidesCount}', 33 iconArrowUp: 'Arrow pointing upwards', 34 iconArrowDown: 'Arrow pointing downwards', 35 iconArrowRight: 'Arrow pointing to the right', 36 iconArrowLeft: 'Arrow pointing to the left' 37 } 38 }; 39 var carouselProps = { 40 // count of items to showed per view 41 itemsToShow: { 42 "default": defaultConfigs.itemsToShow, 43 type: Number 44 }, 45 // count of items to be scrolled 46 itemsToScroll: { 47 "default": defaultConfigs.itemsToScroll, 48 type: Number 49 }, 50 // control infinite scrolling mode 51 wrapAround: { 52 "default": defaultConfigs.wrapAround, 53 type: Boolean 54 }, 55 // control max drag 56 throttle: { 57 "default": defaultConfigs.throttle, 58 type: Number 59 }, 60 // control snap position alignment 61 snapAlign: { 62 "default": defaultConfigs.snapAlign, 63 validator: function validator(value) { 64 // The value must match one of these strings 65 return ['start', 'end', 'center', 'center-even', 'center-odd'].includes(value); 66 } 67 }, 68 // sliding transition time in ms 69 transition: { 70 "default": defaultConfigs.transition, 71 type: Number 72 }, 73 // an object to store breakpoints 74 breakpoints: { 75 "default": defaultConfigs.breakpoints, 76 type: Object 77 }, 78 // time to auto advance slides in ms 79 autoplay: { 80 "default": defaultConfigs.autoplay, 81 type: Number 82 }, 83 // pause autoplay when mouse hover over the carousel 84 pauseAutoplayOnHover: { 85 "default": defaultConfigs.pauseAutoplayOnHover, 86 type: Boolean 87 }, 88 // slide number number of initial slide 89 modelValue: { 90 "default": undefined, 91 type: Number 92 }, 93 // toggle mouse dragging. 94 mouseDrag: { 95 "default": defaultConfigs.mouseDrag, 96 type: Boolean 97 }, 98 // toggle mouse dragging. 99 touchDrag: { 100 "default": defaultConfigs.touchDrag, 101 type: Boolean 102 }, 103 // control snap position alignment 104 dir: { 105 "default": defaultConfigs.dir, 106 validator: function validator(value) { 107 // The value must match one of these strings 108 return ['rtl', 'ltr'].includes(value); 109 } 110 }, 111 // aria-labels and additional text labels 112 i18n: { 113 "default": defaultConfigs.i18n, 114 type: Object 115 }, 116 // an object to pass all settings 117 settings: { 118 "default": function _default() { 119 return {}; 120 }, 121 type: Object 122 } 123 }; 124 function getMaxSlideIndex(_ref) { 125 var config = _ref.config, 126 slidesCount = _ref.slidesCount; 127 var snapAlign = config.snapAlign, 128 wrapAround = config.wrapAround, 129 _config$itemsToShow = config.itemsToShow, 130 itemsToShow = _config$itemsToShow === void 0 ? 1 : _config$itemsToShow; 131 if (wrapAround) { 132 return Math.max(slidesCount - 1, 0); 133 } 134 var output; 135 switch (snapAlign) { 136 case 'start': 137 output = slidesCount - itemsToShow; 138 break; 139 case 'end': 140 output = slidesCount - 1; 141 break; 142 case 'center': 143 case 'center-odd': 144 output = slidesCount - Math.ceil((itemsToShow - 0.5) / 2); 145 break; 146 case 'center-even': 147 output = slidesCount - Math.ceil(itemsToShow / 2); 148 break; 149 default: 150 output = 0; 151 break; 152 } 153 return Math.max(output, 0); 154 } 155 function getMinSlideIndex(_ref2) { 156 var config = _ref2.config, 157 slidesCount = _ref2.slidesCount; 158 var wrapAround = config.wrapAround, 159 snapAlign = config.snapAlign, 160 _config$itemsToShow2 = config.itemsToShow,
161 itemsToShow = _config$itemsToShow2 === void 0 ? 1 : _config$itemsToShow2; 162 var output = 0; 163 if (wrapAround || itemsToShow > slidesCount) { 164 return output; 165 } 166 switch (snapAlign) { 167 case 'start': 168 output = 0; 169 break; 170 case 'end': 171 output = itemsToShow - 1; 172 break; 173 case 'center': 174 case 'center-odd': 175 output = Math.floor((itemsToShow - 1) / 2); 176 break; 177 case 'center-even': 178 output = Math.floor((itemsToShow - 2) / 2); 179 break; 180 default: 181 output = 0; 182 break; 183 } 184 return output; 185 } 186 function getNumberInRange(_ref3) { 187 var val = _ref3.val, 188 max = _ref3.max, 189 min = _ref3.min; 190 if (max < min) { 191 return val; 192 } 193 return Math.min(Math.max(val, min), max); 194 } 195 function getSlidesToScroll(_ref4) { 196 var config = _ref4.config, 197 currentSlide = _ref4.currentSlide, 198 slidesCount = _ref4.slidesCount; 199 var snapAlign = config.snapAlign, 200 wrapAround = config.wrapAround, 201 _config$itemsToShow3 = config.itemsToShow, 202 itemsToShow = _config$itemsToShow3 === void 0 ? 1 : _config$itemsToShow3; 203 var output = currentSlide; 204 switch (snapAlign) { 205 case 'center': 206 case 'center-odd': 207 output -= (itemsToShow - 1) / 2; 208 break; 209 case 'center-even': 210 output -= (itemsToShow - 2) / 2; 211 break; 212 case 'end': 213 output -= itemsToShow - 1; 214 break; 215 } 216 if (wrapAround) { 217 return output; 218 } 219 return getNumberInRange({ 220 val: output, 221 max: slidesCount - itemsToShow, 222 min: 0 223 }); 224 } 225 function getSlidesVNodes(vNode) { 226 if (!vNode) return []; 227 return vNode.reduce(function (acc, node) { 228 var _a; 229 if (node.type === ui_vue3.Fragment) { 230 return [].concat(babelHelpers.toConsumableArray(acc), babelHelpers.toConsumableArray(getSlidesVNodes(node.children))); 231 } 232 if (((_a = node.type) === null || _a === void 0 ? void 0 : _a.name) === 'CarouselSlide') { 233 return [].concat(babelHelpers.toConsumableArray(acc), [node]); 234 } 235 return acc; 236 }, []); 237 } 238 function mapNumberToRange(_ref5) { 239 var val = _ref5.val, 240 max = _ref5.max, 241 _ref5$min = _ref5.min, 242 min = _ref5$min === void 0 ? 0 : _ref5$min; 243 if (val > max) { 244 return mapNumberToRange({ 245 val: val - (max + 1), 246 max: max, 247 min: min 248 }); 249 } 250 if (val < min) { 251 return mapNumberToRange({ 252 val: val + (max + 1), 253 max: max, 254 min: min 255 }); 256 } 257 return val; 258 } 259 260 /** 261 * return a throttle version of the function 262 * Throttling 263 * 264 */ 265 // eslint-disable-next-line no-unused-vars 266 function throttle(fn, limit) { 267 var inThrottle; 268 if (!limit) { 269 return fn; 270 } 271 return function () { 272 var self = this; 273 if (!inThrottle) { 274 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 275 args[_key] = arguments[_key]; 276 } 277 fn.apply(self, args); 278 inThrottle = true; 279 setTimeout(function () { 280 return inThrottle = false; 281 }, limit); 282 } 283 }; 284 } 285 286 /** 287 * return a debounced version of the function 288 * @param fn 289 * @param delay 290 */ 291 // eslint-disable-next-line no-unused-vars 292 function debounce(fn, delay) { 293 var timerId; 294 return function () { 295 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 296 args[_key2] = arguments[_key2]; 297 } 298 if (timerId) { 299 clearTimeout(timerId); 300 } 301 timerId = setTimeout(function () { 302 fn.apply(void 0, args); 303 timerId = null; 304 }, delay); 305 }; 306 } 307 function i18nFormatter() { 308 var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 309 var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 310 return Object.entries(values).reduce(function (acc, _ref6) { 311 var _ref7 = babelHelpers.slicedToArray(_ref6, 2), 312 key = _ref7[0], 313 value = _ref7[1]; 314 return acc.replace("{".concat(key, "}"), String(value)); 315 }, string); 316 } 317 var ARIAComponent = ui_vue3.defineComponent({ 318 name: 'ARIA', 319 setup: function setup() { 320 var config = ui_vue3.inject('config', ui_vue3.reactive(Object.assign({}, defaultConfigs))); 321 var currentSlide = ui_vue3.inject('currentSlide', ui_vue3.ref(0)); 322 var slidesCount = ui_vue3.inject('slidesCount', ui_vue3.ref(0)); 323 return function () { 324 return ui_vue3.h('div', { 325 "class": ['carousel__liveregion', 'carousel__sr-only'], 326 'aria-live': 'polite', 327 'aria-atomic': 'true' 328 }, i18nFormatter(config.i18n['itemXofY'], { 329 currentSlide: currentSlide.value + 1, 330 slidesCount: slidesCount.value 331 })); 332 }; 333 } 334 });
335 var Carousel = ui_vue3.defineComponent({ 336 name: 'Carousel', 337 props: carouselProps, 338 setup: function setup(props, _ref8) { 339 var slots = _ref8.slots, 340 emit = _ref8.emit, 341 expose = _ref8.expose; 342 var _a; 343 var root = ui_vue3.ref(null); 344 var slides = ui_vue3.ref([]); 345 var slideWidth = ui_vue3.ref(0); 346 var slidesCount = ui_vue3.ref(0); 347 // current config 348 var config = ui_vue3.reactive(Object.assign({}, defaultConfigs)); 349 // default carousel configs 350 var __defaultConfig = Object.assign({}, defaultConfigs); 351 // breakpoints configs 352 var breakpoints; 353 // slides 354 var currentSlideIndex = ui_vue3.ref((_a = props.modelValue) !== null && _a !== void 0 ? _a : 0); 355 var prevSlideIndex = ui_vue3.ref(0); 356 var middleSlideIndex = ui_vue3.ref(0); 357 var maxSlideIndex = ui_vue3.ref(0); 358 var minSlideIndex = ui_vue3.ref(0); 359 var autoplayTimer; 360 var transitionTimer; 361 ui_vue3.provide('config', config); 362 ui_vue3.provide('slidesCount', slidesCount); 363 ui_vue3.provide('currentSlide', currentSlideIndex); 364 ui_vue3.provide('maxSlide', maxSlideIndex); 365 ui_vue3.provide('minSlide', minSlideIndex); 366 ui_vue3.provide('slideWidth', slideWidth); 367 /** 368 * Configs 369 */ 370 function initDefaultConfigs() { 371 breakpoints = Object.assign({}, props.breakpoints); 372 __defaultConfig = Object.assign(Object.assign(Object.assign({}, __defaultConfig), props), { 373 i18n: Object.assign(Object.assign({}, __defaultConfig.i18n), props.i18n), 374 breakpoints: undefined 375 }); 376 bindConfigs(__defaultConfig); 377 } 378 function updateBreakpointsConfigs() { 379 if (!breakpoints || !Object.keys(breakpoints).length) return; 380 var breakpointsArray = Object.keys(breakpoints).map(function (key) { 381 return Number(key); 382 }).sort(function (a, b) { 383 return +b - +a; 384 }); 385 var newConfig = Object.assign({}, __defaultConfig); 386 breakpointsArray.some(function (breakpoint) { 387 var isMatched = window.matchMedia("(min-width: ".concat(breakpoint, "px)")).matches; 388 if (isMatched) { 389 newConfig = Object.assign(Object.assign({}, newConfig), breakpoints[breakpoint]); 390 } 391 return isMatched; 392 }); 393 bindConfigs(newConfig); 394 } 395 function bindConfigs(newConfig) { 396 // eslint-disable-next-line @typescript-eslint/ban-ts-comment 397 //@ts-ignore 398 Object.entries(newConfig).forEach(function (_ref9) { 399 var _ref10 = babelHelpers.slicedToArray(_ref9, 2), 400 key = _ref10[0], 401 val = _ref10[1]; 402 return config[key] = val; 403 }); 404 } 405 var handleWindowResize = debounce(function () { 406 updateBreakpointsConfigs(); 407 updateSlidesData(); 408 updateSlideWidth(); 409 }, 16); 410 /** 411 * Setup functions 412 */ 413 function updateSlideWidth() { 414 if (!root.value) return; 415 var rect = root.value.getBoundingClientRect(); 416 slideWidth.value = rect.width / config.itemsToShow; 417 } 418 function updateSlidesData() { 419 if (slidesCount.value <= 0) return; 420 middleSlideIndex.value = Math.ceil((slidesCount.value - 1) / 2); 421 maxSlideIndex.value = getMaxSlideIndex({ 422 config: config, 423 slidesCount: slidesCount.value 424 }); 425 minSlideIndex.value = getMinSlideIndex({ 426 config: config, 427 slidesCount: slidesCount.value 428 }); 429 if (!config.wrapAround) { 430 currentSlideIndex.value = getNumberInRange({ 431 val: currentSlideIndex.value, 432 max: maxSlideIndex.value, 433 min: minSlideIndex.value 434 }); 435 } 436 } 437 ui_vue3.onMounted(function () { 438 ui_vue3.nextTick(function () { 439 return updateSlideWidth(); 440 }); 441 // Overcome some edge cases 442 setTimeout(function () { 443 return updateSlideWidth(); 444 }, 1000); 445 updateBreakpointsConfigs(); 446 initAutoplay(); 447 window.addEventListener('resize', handleWindowResize, { 448 passive: true 449 }); 450 emit('init'); 451 }); 452 ui_vue3.onUnmounted(function () { 453 if (transitionTimer) { 454 clearTimeout(transitionTimer); 455 } 456 if (autoplayTimer) { 457 clearInterval(autoplayTimer); 458 } 459 window.removeEventListener('resize', handleWindowResize, { 460 passive: true 461 }); 462 }); 463 /** 464 * Carousel Event listeners 465 */ 466 var isTouch = false;
467 var startPosition = { 468 x: 0, 469 y: 0 470 }; 471 var endPosition = { 472 x: 0, 473 y: 0 474 }; 475 var dragged = ui_vue3.reactive({ 476 x: 0, 477 y: 0 478 }); 479 var isHover = ui_vue3.ref(false); 480 var isDragging = ui_vue3.ref(false); 481 var handleMouseEnter = function handleMouseEnter() { 482 isHover.value = true; 483 }; 484 var handleMouseLeave = function handleMouseLeave() { 485 isHover.value = false; 486 }; 487 function handleDragStart(event) { 488 if (['INPUT', 'TEXTAREA', 'SELECT'].includes(event.target.tagName)) { 489 return; 490 } 491 isTouch = event.type === 'touchstart'; 492 if (!isTouch) { 493 event.preventDefault(); 494 } 495 if (!isTouch && event.button !== 0 || isSliding.value) { 496 return; 497 } 498 startPosition.x = isTouch ? event.touches[0].clientX : event.clientX; 499 startPosition.y = isTouch ? event.touches[0].clientY : event.clientY; 500 document.addEventListener(isTouch ? 'touchmove' : 'mousemove', handleDragging, true); 501 document.addEventListener(isTouch ? 'touchend' : 'mouseup', handleDragEnd, true); 502 } 503 var handleDragging = throttle(function (event) { 504 isDragging.value = true; 505 endPosition.x = isTouch ? event.touches[0].clientX : event.clientX; 506 endPosition.y = isTouch ? event.touches[0].clientY : event.clientY; 507 var deltaX = endPosition.x - startPosition.x; 508 var deltaY = endPosition.y - startPosition.y; 509 dragged.y = deltaY; 510 dragged.x = deltaX; 511 }, config.throttle); 512 function handleDragEnd() { 513 var direction = config.dir === 'rtl' ? -1 : 1; 514 var tolerance = Math.sign(dragged.x) * 0.4; 515 var draggedSlides = Math.round(dragged.x / slideWidth.value + tolerance) * direction; 516 // Prevent clicking if there is clicked slides 517 if (draggedSlides && !isTouch) { 518 var captureClick = function captureClick(e) { 519 window.removeEventListener('click', captureClick, true); 520 }; 521 window.addEventListener('click', captureClick, true); 522 } 523 slideTo(currentSlideIndex.value - draggedSlides); 524 dragged.x = 0; 525 dragged.y = 0; 526 isDragging.value = false; 527 document.removeEventListener(isTouch ? 'touchmove' : 'mousemove', handleDragging, true); 528 document.removeEventListener(isTouch ? 'touchend' : 'mouseup', handleDragEnd, true); 529 } 530 /** 531 * Autoplay 532 */ 533 function initAutoplay() { 534 if (!config.autoplay || config.autoplay <= 0) { 535 return; 536 } 537 autoplayTimer = setInterval(function () { 538 if (config.pauseAutoplayOnHover && isHover.value) { 539 return; 540 } 541 next(); 542 }, config.autoplay); 543 } 544 function resetAutoplay() { 545 if (autoplayTimer) { 546 clearInterval(autoplayTimer); 547 autoplayTimer = null; 548 } 549 initAutoplay(); 550 } 551 /** 552 * Navigation function 553 */ 554 var isSliding = ui_vue3.ref(false); 555 function slideTo(slideIndex) { 556 var currentVal = config.wrapAround ? slideIndex : getNumberInRange({ 557 val: slideIndex, 558 max: maxSlideIndex.value, 559 min: minSlideIndex.value 560 }); 561 if (currentSlideIndex.value === currentVal || isSliding.value) { 562 return; 563 } 564 emit('slide-start', { 565 slidingToIndex: slideIndex, 566 currentSlideIndex: currentSlideIndex.value, 567 prevSlideIndex: prevSlideIndex.value, 568 slidesCount: slidesCount.value 569 }); 570 isSliding.value = true; 571 prevSlideIndex.value = currentSlideIndex.value; 572 currentSlideIndex.value = currentVal; 573 transitionTimer = setTimeout(function () { 574 if (config.wrapAround) { 575 var mappedNumber = mapNumberToRange({ 576 val: currentVal, 577 max: maxSlideIndex.value, 578 min: 0 579 }); 580 if (mappedNumber !== currentSlideIndex.value) { 581 currentSlideIndex.value = mappedNumber; 582 emit('loop', { 583 currentSlideIndex: currentSlideIndex.value, 584 slidingToIndex: slideIndex 585 }); 586 } 587 } 588 emit('update:modelValue', currentSlideIndex.value); 589 emit('slide-end', { 590 currentSlideIndex: currentSlideIndex.value, 591 prevSlideIndex: prevSlideIndex.value, 592 slidesCount: slidesCount.value 593 });
594 isSliding.value = false; 595 resetAutoplay(); 596 }, config.transition); 597 } 598 function next() { 599 slideTo(currentSlideIndex.value + config.itemsToScroll); 600 } 601 function prev() { 602 slideTo(currentSlideIndex.value - config.itemsToScroll); 603 } 604 var nav = { 605 slideTo: slideTo, 606 next: next, 607 prev: prev 608 }; 609 ui_vue3.provide('nav', nav); 610 ui_vue3.provide('isSliding', isSliding); 611 /** 612 * Track style 613 */ 614 var slidesToScroll = ui_vue3.computed(function () { 615 return getSlidesToScroll({ 616 config: config, 617 currentSlide: currentSlideIndex.value, 618 slidesCount: slidesCount.value 619 }); 620 }); 621 ui_vue3.provide('slidesToScroll', slidesToScroll); 622 var trackStyle = ui_vue3.computed(function () { 623 var direction = config.dir === 'rtl' ? -1 : 1; 624 var xScroll = slidesToScroll.value * slideWidth.value * direction; 625 return { 626 transform: "translateX(".concat(dragged.x - xScroll, "px)"), 627 transition: "".concat(isSliding.value ? config.transition : 0, "ms"), 628 margin: config.wrapAround ? "0 -".concat(slidesCount.value * slideWidth.value, "px") : '', 629 width: "100%" 630 }; 631 }); 632 function restartCarousel() { 633 initDefaultConfigs(); 634 updateBreakpointsConfigs(); 635 updateSlidesData(); 636 updateSlideWidth(); 637 resetAutoplay(); 638 } 639 // Update the carousel on props change 640 Object.keys(carouselProps).forEach(function (prop) { 641 if (['modelValue'].includes(prop)) return; 642 ui_vue3.watch(function () { 643 return props[prop]; 644 }, restartCarousel); 645 }); 646 // Handle changing v-model value 647 ui_vue3.watch(function () { 648 return props['modelValue']; 649 }, function (val) { 650 if (val === currentSlideIndex.value) { 651 return; 652 } 653 slideTo(Number(val)); 654 }); 655 // Handel when slides added/removed 656 ui_vue3.watch(slidesCount, updateSlidesData); 657 // Init carousel 658 emit('before-init'); 659 initDefaultConfigs(); 660 var data = { 661 config: config, 662 slidesCount: slidesCount, 663 slideWidth: slideWidth, 664 next: next, 665 prev: prev, 666 slideTo: slideTo, 667 currentSlide: currentSlideIndex, 668 maxSlide: maxSlideIndex, 669 minSlide: minSlideIndex, 670 middleSlide: middleSlideIndex 671 }; 672 expose({ 673 updateBreakpointsConfigs: updateBreakpointsConfigs, 674 updateSlidesData: updateSlidesData, 675 updateSlideWidth: updateSlideWidth, 676 initDefaultConfigs: initDefaultConfigs, 677 restartCarousel: restartCarousel, 678 slideTo: slideTo, 679 next: next, 680 prev: prev, 681 nav: nav, 682 data: data 683 }); 684 var slotSlides = slots["default"] || slots.slides; 685 var slotAddons = slots.addons; 686 var slotsProps = ui_vue3.reactive(data); 687 return function () { 688 var slidesElements = getSlidesVNodes(slotSlides === null || slotSlides === void 0 ? void 0 : slotSlides(slotsProps)); 689 var addonsElements = (slotAddons === null || slotAddons === void 0 ? void 0 : slotAddons(slotsProps)) || []; 690 slidesElements.forEach(function (el, index) { 691 return el.props.index = index; 692 }); 693 var output = slidesElements; 694 if (config.wrapAround) { 695 var slidesBefore = slidesElements.map(function (el, index) { 696 return ui_vue3.cloneVNode(el, { 697 index: -slidesElements.length + index, 698 isClone: true, 699 key: "clone-before-".concat(index) 700 }); 701 }); 702 var slidesAfter = slidesElements.map(function (el, index) { 703 return ui_vue3.cloneVNode(el, { 704 index: slidesElements.length + index, 705 isClone: true, 706 key: "clone-after-".concat(index) 707 }); 708 }); 709 output = [].concat(babelHelpers.toConsumableArray(slidesBefore), babelHelpers.toConsumableArray(slidesElements), babelHelpers.toConsumableArray(slidesAfter)); 710 } 711 slides.value = slidesElements; 712 slidesCount.value = Math.max(slidesElements.length, 1); 713 var trackEl = ui_vue3.h('ol', { 714 "class": 'carousel__track', 715 style: trackStyle.value, 716 onMousedownCapture: config.mouseDrag ? handleDragStart : null, 717 onTouchstartPassiveCapture: config.touchDrag ? handleDragStart : null 718 }, output); 719 var viewPortEl = ui_vue3.h('div', { 720 "class": 'carousel__viewport' 721 }, trackEl); 722 return ui_vue3.h('section', { 723 ref: root, 724 "class": { 725 carousel: true,
726 'is-sliding': isSliding.value, 727 'is-dragging': isDragging.value, 728 'is-hover': isHover.value, 729 'carousel--rtl': config.dir === 'rtl' 730 }, 731 dir: config.dir, 732 'aria-label': config.i18n['ariaGallery'], 733 tabindex: '0', 734 onMouseenter: handleMouseEnter, 735 onMouseleave: handleMouseLeave 736 }, [viewPortEl, addonsElements, ui_vue3.h(ARIAComponent)]); 737 }; 738 } 739 }); 740 var IconName; 741 (function (IconName) { 742 IconName["arrowUp"] = "arrowUp"; 743 IconName["arrowDown"] = "arrowDown"; 744 IconName["arrowRight"] = "arrowRight"; 745 IconName["arrowLeft"] = "arrowLeft"; 746 })(IconName || (IconName = {})); 747 var icons = { 748 arrowUp: 'M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z', 749 arrowDown: 'M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z', 750 arrowRight: 'M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z', 751 arrowLeft: 'M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z' 752 }; 753 function isIconName(candidate) { 754 return candidate in IconName; 755 } 756 var Icon = function Icon(props) { 757 var config = ui_vue3.inject('config', ui_vue3.reactive(Object.assign({}, defaultConfigs))); 758 var iconName = String(props.name); 759 var iconI18n = "icon".concat(iconName.charAt(0).toUpperCase() + iconName.slice(1)); 760 if (!iconName || typeof iconName !== 'string' || !isIconName(iconName)) { 761 return; 762 } 763 var path = icons[iconName]; 764 var pathEl = ui_vue3.h('path', { 765 d: path 766 }); 767 var iconTitle = config.i18n[iconI18n] || props.title || iconName; 768 var titleEl = ui_vue3.h('title', iconTitle); 769 return ui_vue3.h('svg', { 770 "class": 'carousel__icon', 771 viewBox: '0 0 24 24', 772 role: 'img', 773 'aria-label': iconTitle 774 }, [titleEl, pathEl]); 775 }; 776 Icon.props = { 777 name: String, 778 title: String 779 }; 780 var Navigation = function Navigation(props, _ref11) { 781 var slots = _ref11.slots, 782 attrs = _ref11.attrs; 783 var _ref12 = slots || {}, 784 slotNext = _ref12.next, 785 slotPrev = _ref12.prev; 786 var config = ui_vue3.inject('config', ui_vue3.reactive(Object.assign({}, defaultConfigs))); 787 var maxSlide = ui_vue3.inject('maxSlide', ui_vue3.ref(1)); 788 var minSlide = ui_vue3.inject('minSlide', ui_vue3.ref(1)); 789 var currentSlide = ui_vue3.inject('currentSlide', ui_vue3.ref(1)); 790 var nav = ui_vue3.inject('nav', {}); 791 var dir = config.dir, 792 wrapAround = config.wrapAround, 793 i18n = config.i18n; 794 var isRTL = dir === 'rtl'; 795 var prevButton = ui_vue3.h('button', { 796 type: 'button', 797 "class": ['carousel__prev', !wrapAround && currentSlide.value <= minSlide.value && 'carousel__prev--disabled', attrs === null || attrs === void 0 ? void 0 : attrs["class"]], 798 'aria-label': i18n['ariaPreviousSlide'], 799 onClick: nav.prev 800 }, (slotPrev === null || slotPrev === void 0 ? void 0 : slotPrev()) || ui_vue3.h(Icon, { 801 name: isRTL ? 'arrowRight' : 'arrowLeft' 802 })); 803 var nextButton = ui_vue3.h('button', { 804 type: 'button', 805 "class": ['carousel__next', !wrapAround && currentSlide.value >= maxSlide.value && 'carousel__next--disabled', attrs === null || attrs === void 0 ? void 0 : attrs["class"]], 806 'aria-label': i18n['ariaNextSlide'], 807 onClick: nav.next 808 }, (slotNext === null || slotNext === void 0 ? void 0 : slotNext()) || ui_vue3.h(Icon, { 809 name: isRTL ? 'arrowLeft' : 'arrowRight' 810 })); 811 return [prevButton, nextButton]; 812 }; 813 var Pagination = function Pagination() { 814 var config = ui_vue3.inject('config', ui_vue3.reactive(Object.assign({}, defaultConfigs))); 815 var maxSlide = ui_vue3.inject('maxSlide', ui_vue3.ref(1)); 816 var minSlide = ui_vue3.inject('minSlide', ui_vue3.ref(1)); 817 var currentSlide = ui_vue3.inject('currentSlide', ui_vue3.ref(1)); 818 var nav = ui_vue3.inject('nav', {}); 819 var isActive = function isActive(slide) { 820 return mapNumberToRange({ 821 val: currentSlide.value, 822 max: maxSlide.value, 823 min: 0 824 }) === slide; 825 }; 826 var children = []; 827 var _loop = function _loop(slide) { 828 var button = ui_vue3.h('button', { 829 type: 'button', 830 "class": { 831 'carousel__pagination-button': true, 832 'carousel__pagination-button--active': isActive(slide) 833 }, 834 'aria-label': i18nFormatter(config.i18n['ariaNavigateToSli
834de'], { 835 slideNumber: slide + 1 836 }), 837 onClick: function onClick() { 838 return nav.slideTo(slide); 839 } 840 }); 841 var item = ui_vue3.h('li', { 842 "class": 'carousel__pagination-item', 843 key: slide 844 }, button); 845 children.push(item); 846 }; 847 for (var slide = minSlide.value; slide < maxSlide.value + 1; slide++) { 848 _loop(slide); 849 } 850 return ui_vue3.h('ol', { 851 "class": 'carousel__pagination' 852 }, children); 853 }; 854 var Slide = ui_vue3.defineComponent({ 855 name: 'CarouselSlide', 856 props: { 857 index: { 858 type: Number, 859 "default": 1 860 }, 861 isClone: { 862 type: Boolean, 863 "default": false 864 } 865 }, 866 setup: function setup(props, _ref13) { 867 var slots = _ref13.slots; 868 var config = ui_vue3.inject('config', ui_vue3.reactive(Object.assign({}, defaultConfigs))); 869 var currentSlide = ui_vue3.inject('currentSlide', ui_vue3.ref(0)); 870 var slidesToScroll = ui_vue3.inject('slidesToScroll', ui_vue3.ref(0)); 871 var isSliding = ui_vue3.inject('isSliding', ui_vue3.ref(false)); 872 var isActive = ui_vue3.computed(function () { 873 return props.index === currentSlide.value; 874 }); 875 var isPrev = ui_vue3.computed(function () { 876 return props.index === currentSlide.value - 1; 877 }); 878 var isNext = ui_vue3.computed(function () { 879 return props.index === currentSlide.value + 1; 880 }); 881 var isVisible = ui_vue3.computed(function () { 882 var min = Math.floor(slidesToScroll.value); 883 var max = Math.ceil(slidesToScroll.value + config.itemsToShow - 1); 884 return props.index >= min && props.index <= max; 885 }); 886 return function () { 887 var _a; 888 return ui_vue3.h('li', { 889 style: { 890 width: "".concat(100 / config.itemsToShow, "%") 891 }, 892 "class": { 893 carousel__slide: true, 894 'carousel__slide--clone': props.isClone, 895 'carousel__slide--visible': isVisible.value, 896 'carousel__slide--active': isActive.value, 897 'carousel__slide--prev': isPrev.value, 898 'carousel__slide--next': isNext.value, 899 'carousel__slide--sliding': isSliding.value 900 }, 901 'aria-hidden': !isVisible.value 902 }, (_a = slots["default"]) === null || _a === void 0 ? void 0 : _a.call(slots, { 903 isActive: isActive.value, 904 isClone: props.isClone, 905 isPrev: isPrev.value, 906 isNext: isNext.value, 907 isSliding: isSliding.value, 908 isVisible: isVisible.value 909 })); 910 }; 911 } 912 }); 913 914 exports.Carousel = Carousel; 915 exports.Icon = Icon; 916 exports.Navigation = Navigation; 917 exports.Pagination = Pagination; 918 exports.Slide = Slide; 919 920}((this.BX.Sol42 = this.BX.Sol42 || {}),BX.Vue3));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.