bootstrap-vue-next
Version:
Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development
1 lines • 34.2 kB
Source Map (JSON)
{"version":3,"file":"BCarousel-D9Yei1Q4.mjs","names":[],"sources":["../src/utils/getSlotElements.ts","../src/components/BCarousel/BCarousel.vue","../src/components/BCarousel/BCarousel.vue","../src/components/BCarousel/BCarouselSlide.vue","../src/components/BCarousel/BCarouselSlide.vue"],"sourcesContent":["import type {Slot, VNode} from 'vue'\n\nexport const getSlotElements = (slot: Slot | undefined, filterBy: string): VNode[] =>\n (slot?.() ?? [])\n .reduce((arr: VNode[], slot: VNode) => {\n if (typeof slot.type === 'symbol') {\n arr = arr.concat(slot.children as unknown as VNode)\n } else {\n arr.push(slot)\n }\n return arr\n }, [])\n .filter((child) => (child.type as {__name: string} | undefined)?.__name === filterBy)\n","<template>\n <div\n :id=\"computedId\"\n ref=\"_element\"\n class=\"carousel slide pointer-event\"\n :class=\"computedClasses\"\n >\n <div\n v-if=\"props.indicators\"\n class=\"carousel-indicators\"\n :aria-label=\"props.labelIndicators\"\n :aria-owns=\"buttonOwnership\"\n >\n <!-- :data-bs-target=\"`#${computedId}`\" is required since the classes target elems with that attr -->\n <button\n v-for=\"(_, i) in slides.length\"\n :key=\"i\"\n type=\"button\"\n data-bs-target=\"\"\n :class=\"i === modelValue ? 'active' : ''\"\n :aria-current=\"i === modelValue ? true : undefined\"\n :aria-label=\"`${props.indicatorsButtonLabel} ${i}`\"\n :aria-controls=\"buttonOwnership\"\n :aria-describedby=\"slideValues?.[i]?._id\"\n @click=\"slideTo(i)\"\n />\n </div>\n\n <div ref=\"_relatedTarget\" class=\"carousel-inner\">\n <TransitionGroup v-bind=\"transitionGroupProps\">\n <component\n :is=\"slide\"\n v-for=\"(slide, i) in slides\"\n v-show=\"i === modelValue\"\n :key=\"i\"\n ref=\"_slideValues\"\n :class=\"{active: i === modelValue && isTransitioning === false}\"\n :style=\"props.noAnimation && {transition: 'none'}\"\n />\n </TransitionGroup>\n </div>\n\n <template v-if=\"props.controls\">\n <button class=\"carousel-control-prev\" type=\"button\" @click=\"onClickPrev\">\n <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\" />\n <span class=\"visually-hidden\">{{ props.controlsPrevText }}</span>\n </button>\n <button class=\"carousel-control-next\" type=\"button\" @click=\"onClickNext\">\n <span class=\"carousel-control-next-icon\" aria-hidden=\"true\" />\n <span class=\"visually-hidden\">{{ props.controlsNextText }}</span>\n </button>\n </template>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvCarouselEvent} from '../../utils'\nimport {computed, onMounted, provide, ref, toRef, useTemplateRef, watch} from 'vue'\nimport {useId} from '../../composables/useId'\nimport {onKeyStroke, useElementHover, useIntervalFn, useSwipe, useToNumber} from '@vueuse/core'\nimport type BCarouselSlide from './BCarouselSlide.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {Numberish} from '../../types/CommonTypes'\nimport {getSlotElements} from '../../utils/getSlotElements'\nimport {carouselInjectionKey} from '../../utils/keys'\nimport type {BCarouselEmits, BCarouselProps, BCarouselSlots} from '../../types'\n\nconst _props = withDefaults(defineProps<Omit<BCarouselProps, 'modelValue'>>(), {\n background: undefined,\n controls: false,\n controlsNextText: 'Next',\n controlsPrevText: 'Previous',\n fade: false,\n id: undefined,\n imgHeight: undefined,\n imgWidth: undefined,\n indicators: false,\n indicatorsButtonLabel: 'Slide',\n interval: 5000,\n labelIndicators: 'Select a slide to display',\n keyboard: true,\n noAnimation: false,\n noHoverPause: false,\n noTouch: false,\n noWrap: false,\n ride: false,\n rideReverse: false,\n touchThreshold: 50,\n})\nconst props = useDefaults(_props, 'BCarousel')\nconst emit = defineEmits<BCarouselEmits>()\nconst slots = defineSlots<BCarouselSlots>()\n\nconst computedId = useId(() => props.id, 'carousel')\nconst buttonOwnership = useId(undefined, 'carousel-button-ownership')\n\nconst modelValue = defineModel<Exclude<BCarouselProps['modelValue'], undefined>>({default: 0})\n\nconst slideValues = useTemplateRef<InstanceType<typeof BCarouselSlide>[]>('_slideValues')\n\nconst touchThresholdNumber = useToNumber(() => props.touchThreshold)\nconst slideInterval = ref<Numberish | null>(null)\nonMounted(() => {\n slideInterval.value =\n slideValues.value?.find((slid) => slid.$el.style.display !== 'none')?._interval ?? null\n})\nconst intervalNumber = useToNumber(() => slideInterval.value ?? props.interval)\n\nconst isTransitioning = ref(false)\nconst rideStarted = ref(false)\nconst direction = ref<'start' | 'end'>('start')\nconst relatedTarget = useTemplateRef('_relatedTarget')\nconst element = useTemplateRef('_element')\n\nlet previousModelValue = modelValue.value\nlet isInternalChange = false\n\nconst isHovering = useElementHover(element)\n\nconst {pause, resume} = useIntervalFn(\n () => {\n if (props.rideReverse) {\n prev()\n return\n }\n next()\n },\n intervalNumber,\n {immediate: props.ride === 'carousel'}\n)\n\nconst isRiding = computed(\n () => (props.ride === true && rideStarted.value === true) || props.ride === 'carousel'\n)\nconst slides = computed(() => getSlotElements(slots.default, 'BCarouselSlide'))\nconst computedClasses = computed(() => ({'carousel-fade': props.fade}))\n\nconst buildBvCarouselEvent = (event: 'slid' | 'slide') =>\n new BvCarouselEvent(event, {\n componentId: computedId.value,\n cancelable: false,\n target: element.value,\n direction: direction.value === 'start' ? 'right' : 'left',\n from: previousModelValue,\n to: modelValue.value,\n relatedTarget: relatedTarget.value?.children[modelValue.value] ?? null,\n })\n\nwatch(modelValue, (newValue, oldValue) => {\n if (!isInternalChange) {\n // External v-model change: determine direction from the new/old values\n const lastIndex = slides.value.length - 1\n const wrappedForward = oldValue === lastIndex && newValue === 0\n const wrappedBackward = oldValue === 0 && newValue === lastIndex\n if (wrappedForward) {\n direction.value = 'start'\n } else if (wrappedBackward) {\n direction.value = 'end'\n } else {\n direction.value = newValue > oldValue ? 'start' : 'end'\n }\n }\n isInternalChange = false\n // If one ever thinks to change the transitions dependence on modelValue and thinks it is appropriate to remove this isTransitioning line, be careful\n // This directly effects how transitions are applied. The watch is for if you have an external change to modelValue, and doesn't directly call slideTo\n isTransitioning.value = true\n})\nconst slideTo = (value: number): void => {\n if (isTransitioning.value === true) return\n\n if (props.ride === true) {\n rideStarted.value = true\n }\n if (isRiding.value === true) {\n resume()\n }\n let nextValue = value\n if (nextValue >= slides.value.length) {\n if (props.noWrap) return\n nextValue = 0\n }\n if (nextValue < 0) {\n if (props.noWrap) return\n nextValue = slides.value.length - 1\n }\n if (nextValue === modelValue.value) return\n // Set direction based on the original requested value (before wrapping) so that\n // next() always animates forward and prev() always animates backward, regardless\n // of how many slides there are. This fixes the 2-slide case where wrap-detection\n // heuristics in the watcher would otherwise produce the wrong direction.\n // Note: `value` is the raw index passed by the caller (e.g. modelValue+1 for next()),\n // while `nextValue` is the resolved/wrapped index that becomes the new modelValue.\n direction.value = value > modelValue.value ? 'start' : 'end'\n // Mark as internal so the modelValue watcher skips its direction heuristics.\n // A race condition here is not possible because the isTransitioning guard above\n // ensures slideTo cannot be called again until the current transition completes.\n isInternalChange = true\n isTransitioning.value = true\n previousModelValue = modelValue.value\n modelValue.value = nextValue\n}\n\nconst prev = (): void => {\n slideTo(modelValue.value - 1)\n}\nconst next = (): void => {\n slideTo(modelValue.value + 1)\n}\n\nconst {lengthX} = useSwipe(element, {\n passive: true,\n onSwipeStart() {\n if (props.noTouch) return\n pause()\n },\n onSwipeEnd() {\n if (props.noTouch) return\n const resumeRiding = () => {\n if (isRiding.value === false) return\n resume()\n }\n if (lengthX.value >= touchThresholdNumber.value) {\n next()\n resumeRiding()\n return\n }\n if (lengthX.value <= -touchThresholdNumber.value) {\n prev()\n resumeRiding()\n }\n },\n})\n\nconst onClickPrev = (event: MouseEvent) => {\n emit('prev-click', event)\n if (event.defaultPrevented) return\n prev()\n}\nconst onClickNext = (event: MouseEvent) => {\n emit('next-click', event)\n if (event.defaultPrevented) return\n next()\n}\n\nconst onMouseEnter = () => {\n if (props.noHoverPause) return\n pause()\n}\nconst onMouseLeave = () => {\n if (!isRiding.value) return\n resume()\n}\nwatch(isHovering, (newValue) => {\n if (newValue) {\n onMouseEnter()\n return\n }\n onMouseLeave()\n})\nonKeyStroke(\n ['ArrowLeft', 'ArrowRight'],\n (event) => {\n if (!props.keyboard) return\n if (event.key === 'ArrowLeft') {\n prev()\n } else {\n next()\n }\n },\n {target: element, passive: true}\n)\n\nwatch(\n () => props.ride,\n () => {\n rideStarted.value = false\n }\n)\n\nconst enterDirectionClass = computed(\n () => `carousel-item-${direction.value === 'start' ? 'next' : 'prev'}`\n)\nconst orderDirectionClass = computed(() => `carousel-item-${direction.value}`)\nconst transitionGroupProps = computed(() => ({\n enterFromClass: `carousel-item ${enterDirectionClass.value}`,\n enterActiveClass: `carousel-item ${enterDirectionClass.value}`,\n enterToClass: `carousel-item ${enterDirectionClass.value} ${orderDirectionClass.value}`,\n leaveFromClass: 'carousel-item active',\n leaveActiveClass: 'carousel-item active',\n leaveToClass: `carousel-item active ${orderDirectionClass.value}`,\n onBeforeLeave: () => {\n emit('slide', buildBvCarouselEvent('slide'))\n },\n onAfterLeave: () => {\n emit('slid', buildBvCarouselEvent('slid'))\n isTransitioning.value = false\n },\n // carousel-item class is removed from the slide during the transition,\n // as is included within enter classes.\n // The first slide recovers carousel-item class,\n onAfterEnter: (el: Readonly<Element>) => {\n if (modelValue.value !== 0) {\n el.classList.add('carousel-item')\n }\n },\n onEnter: (el: Readonly<Element>) => {\n slideInterval.value = slideValues.value?.find((slid) => slid.$el === el)?._interval ?? null\n },\n}))\n\ndefineExpose({\n resume,\n pause,\n next,\n prev,\n slideTo,\n})\n\nprovide(carouselInjectionKey, {\n background: toRef(() => props.background),\n width: toRef(() => props.imgWidth),\n height: toRef(() => props.imgHeight),\n})\n</script>\n","<template>\n <div\n :id=\"computedId\"\n ref=\"_element\"\n class=\"carousel slide pointer-event\"\n :class=\"computedClasses\"\n >\n <div\n v-if=\"props.indicators\"\n class=\"carousel-indicators\"\n :aria-label=\"props.labelIndicators\"\n :aria-owns=\"buttonOwnership\"\n >\n <!-- :data-bs-target=\"`#${computedId}`\" is required since the classes target elems with that attr -->\n <button\n v-for=\"(_, i) in slides.length\"\n :key=\"i\"\n type=\"button\"\n data-bs-target=\"\"\n :class=\"i === modelValue ? 'active' : ''\"\n :aria-current=\"i === modelValue ? true : undefined\"\n :aria-label=\"`${props.indicatorsButtonLabel} ${i}`\"\n :aria-controls=\"buttonOwnership\"\n :aria-describedby=\"slideValues?.[i]?._id\"\n @click=\"slideTo(i)\"\n />\n </div>\n\n <div ref=\"_relatedTarget\" class=\"carousel-inner\">\n <TransitionGroup v-bind=\"transitionGroupProps\">\n <component\n :is=\"slide\"\n v-for=\"(slide, i) in slides\"\n v-show=\"i === modelValue\"\n :key=\"i\"\n ref=\"_slideValues\"\n :class=\"{active: i === modelValue && isTransitioning === false}\"\n :style=\"props.noAnimation && {transition: 'none'}\"\n />\n </TransitionGroup>\n </div>\n\n <template v-if=\"props.controls\">\n <button class=\"carousel-control-prev\" type=\"button\" @click=\"onClickPrev\">\n <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\" />\n <span class=\"visually-hidden\">{{ props.controlsPrevText }}</span>\n </button>\n <button class=\"carousel-control-next\" type=\"button\" @click=\"onClickNext\">\n <span class=\"carousel-control-next-icon\" aria-hidden=\"true\" />\n <span class=\"visually-hidden\">{{ props.controlsNextText }}</span>\n </button>\n </template>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvCarouselEvent} from '../../utils'\nimport {computed, onMounted, provide, ref, toRef, useTemplateRef, watch} from 'vue'\nimport {useId} from '../../composables/useId'\nimport {onKeyStroke, useElementHover, useIntervalFn, useSwipe, useToNumber} from '@vueuse/core'\nimport type BCarouselSlide from './BCarouselSlide.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {Numberish} from '../../types/CommonTypes'\nimport {getSlotElements} from '../../utils/getSlotElements'\nimport {carouselInjectionKey} from '../../utils/keys'\nimport type {BCarouselEmits, BCarouselProps, BCarouselSlots} from '../../types'\n\nconst _props = withDefaults(defineProps<Omit<BCarouselProps, 'modelValue'>>(), {\n background: undefined,\n controls: false,\n controlsNextText: 'Next',\n controlsPrevText: 'Previous',\n fade: false,\n id: undefined,\n imgHeight: undefined,\n imgWidth: undefined,\n indicators: false,\n indicatorsButtonLabel: 'Slide',\n interval: 5000,\n labelIndicators: 'Select a slide to display',\n keyboard: true,\n noAnimation: false,\n noHoverPause: false,\n noTouch: false,\n noWrap: false,\n ride: false,\n rideReverse: false,\n touchThreshold: 50,\n})\nconst props = useDefaults(_props, 'BCarousel')\nconst emit = defineEmits<BCarouselEmits>()\nconst slots = defineSlots<BCarouselSlots>()\n\nconst computedId = useId(() => props.id, 'carousel')\nconst buttonOwnership = useId(undefined, 'carousel-button-ownership')\n\nconst modelValue = defineModel<Exclude<BCarouselProps['modelValue'], undefined>>({default: 0})\n\nconst slideValues = useTemplateRef<InstanceType<typeof BCarouselSlide>[]>('_slideValues')\n\nconst touchThresholdNumber = useToNumber(() => props.touchThreshold)\nconst slideInterval = ref<Numberish | null>(null)\nonMounted(() => {\n slideInterval.value =\n slideValues.value?.find((slid) => slid.$el.style.display !== 'none')?._interval ?? null\n})\nconst intervalNumber = useToNumber(() => slideInterval.value ?? props.interval)\n\nconst isTransitioning = ref(false)\nconst rideStarted = ref(false)\nconst direction = ref<'start' | 'end'>('start')\nconst relatedTarget = useTemplateRef('_relatedTarget')\nconst element = useTemplateRef('_element')\n\nlet previousModelValue = modelValue.value\nlet isInternalChange = false\n\nconst isHovering = useElementHover(element)\n\nconst {pause, resume} = useIntervalFn(\n () => {\n if (props.rideReverse) {\n prev()\n return\n }\n next()\n },\n intervalNumber,\n {immediate: props.ride === 'carousel'}\n)\n\nconst isRiding = computed(\n () => (props.ride === true && rideStarted.value === true) || props.ride === 'carousel'\n)\nconst slides = computed(() => getSlotElements(slots.default, 'BCarouselSlide'))\nconst computedClasses = computed(() => ({'carousel-fade': props.fade}))\n\nconst buildBvCarouselEvent = (event: 'slid' | 'slide') =>\n new BvCarouselEvent(event, {\n componentId: computedId.value,\n cancelable: false,\n target: element.value,\n direction: direction.value === 'start' ? 'right' : 'left',\n from: previousModelValue,\n to: modelValue.value,\n relatedTarget: relatedTarget.value?.children[modelValue.value] ?? null,\n })\n\nwatch(modelValue, (newValue, oldValue) => {\n if (!isInternalChange) {\n // External v-model change: determine direction from the new/old values\n const lastIndex = slides.value.length - 1\n const wrappedForward = oldValue === lastIndex && newValue === 0\n const wrappedBackward = oldValue === 0 && newValue === lastIndex\n if (wrappedForward) {\n direction.value = 'start'\n } else if (wrappedBackward) {\n direction.value = 'end'\n } else {\n direction.value = newValue > oldValue ? 'start' : 'end'\n }\n }\n isInternalChange = false\n // If one ever thinks to change the transitions dependence on modelValue and thinks it is appropriate to remove this isTransitioning line, be careful\n // This directly effects how transitions are applied. The watch is for if you have an external change to modelValue, and doesn't directly call slideTo\n isTransitioning.value = true\n})\nconst slideTo = (value: number): void => {\n if (isTransitioning.value === true) return\n\n if (props.ride === true) {\n rideStarted.value = true\n }\n if (isRiding.value === true) {\n resume()\n }\n let nextValue = value\n if (nextValue >= slides.value.length) {\n if (props.noWrap) return\n nextValue = 0\n }\n if (nextValue < 0) {\n if (props.noWrap) return\n nextValue = slides.value.length - 1\n }\n if (nextValue === modelValue.value) return\n // Set direction based on the original requested value (before wrapping) so that\n // next() always animates forward and prev() always animates backward, regardless\n // of how many slides there are. This fixes the 2-slide case where wrap-detection\n // heuristics in the watcher would otherwise produce the wrong direction.\n // Note: `value` is the raw index passed by the caller (e.g. modelValue+1 for next()),\n // while `nextValue` is the resolved/wrapped index that becomes the new modelValue.\n direction.value = value > modelValue.value ? 'start' : 'end'\n // Mark as internal so the modelValue watcher skips its direction heuristics.\n // A race condition here is not possible because the isTransitioning guard above\n // ensures slideTo cannot be called again until the current transition completes.\n isInternalChange = true\n isTransitioning.value = true\n previousModelValue = modelValue.value\n modelValue.value = nextValue\n}\n\nconst prev = (): void => {\n slideTo(modelValue.value - 1)\n}\nconst next = (): void => {\n slideTo(modelValue.value + 1)\n}\n\nconst {lengthX} = useSwipe(element, {\n passive: true,\n onSwipeStart() {\n if (props.noTouch) return\n pause()\n },\n onSwipeEnd() {\n if (props.noTouch) return\n const resumeRiding = () => {\n if (isRiding.value === false) return\n resume()\n }\n if (lengthX.value >= touchThresholdNumber.value) {\n next()\n resumeRiding()\n return\n }\n if (lengthX.value <= -touchThresholdNumber.value) {\n prev()\n resumeRiding()\n }\n },\n})\n\nconst onClickPrev = (event: MouseEvent) => {\n emit('prev-click', event)\n if (event.defaultPrevented) return\n prev()\n}\nconst onClickNext = (event: MouseEvent) => {\n emit('next-click', event)\n if (event.defaultPrevented) return\n next()\n}\n\nconst onMouseEnter = () => {\n if (props.noHoverPause) return\n pause()\n}\nconst onMouseLeave = () => {\n if (!isRiding.value) return\n resume()\n}\nwatch(isHovering, (newValue) => {\n if (newValue) {\n onMouseEnter()\n return\n }\n onMouseLeave()\n})\nonKeyStroke(\n ['ArrowLeft', 'ArrowRight'],\n (event) => {\n if (!props.keyboard) return\n if (event.key === 'ArrowLeft') {\n prev()\n } else {\n next()\n }\n },\n {target: element, passive: true}\n)\n\nwatch(\n () => props.ride,\n () => {\n rideStarted.value = false\n }\n)\n\nconst enterDirectionClass = computed(\n () => `carousel-item-${direction.value === 'start' ? 'next' : 'prev'}`\n)\nconst orderDirectionClass = computed(() => `carousel-item-${direction.value}`)\nconst transitionGroupProps = computed(() => ({\n enterFromClass: `carousel-item ${enterDirectionClass.value}`,\n enterActiveClass: `carousel-item ${enterDirectionClass.value}`,\n enterToClass: `carousel-item ${enterDirectionClass.value} ${orderDirectionClass.value}`,\n leaveFromClass: 'carousel-item active',\n leaveActiveClass: 'carousel-item active',\n leaveToClass: `carousel-item active ${orderDirectionClass.value}`,\n onBeforeLeave: () => {\n emit('slide', buildBvCarouselEvent('slide'))\n },\n onAfterLeave: () => {\n emit('slid', buildBvCarouselEvent('slid'))\n isTransitioning.value = false\n },\n // carousel-item class is removed from the slide during the transition,\n // as is included within enter classes.\n // The first slide recovers carousel-item class,\n onAfterEnter: (el: Readonly<Element>) => {\n if (modelValue.value !== 0) {\n el.classList.add('carousel-item')\n }\n },\n onEnter: (el: Readonly<Element>) => {\n slideInterval.value = slideValues.value?.find((slid) => slid.$el === el)?._interval ?? null\n },\n}))\n\ndefineExpose({\n resume,\n pause,\n next,\n prev,\n slideTo,\n})\n\nprovide(carouselInjectionKey, {\n background: toRef(() => props.background),\n width: toRef(() => props.imgWidth),\n height: toRef(() => props.imgHeight),\n})\n</script>\n","<template>\n <div :id=\"computedId\" class=\"carousel-item\" :style=\"computedStyle\">\n <slot name=\"img\">\n <BImg\n class=\"d-block w-100\"\n :alt=\"props.imgAlt\"\n :srcset=\"props.imgSrcset\"\n :src=\"props.imgSrc\"\n :width=\"props.imgWidth || parentData?.width.value\"\n :height=\"props.imgHeight || parentData?.height.value\"\n :blank=\"props.imgBlank\"\n :blank-color=\"props.imgBlankColor\"\n />\n </slot>\n <component\n :is=\"props.contentTag\"\n v-if=\"hasContent\"\n class=\"carousel-caption\"\n :class=\"computedContentClasses\"\n >\n <component :is=\"props.captionTag\" v-if=\"hasCaption\">\n <slot name=\"caption\">\n <span>{{ props.caption }}</span>\n </slot>\n </component>\n <component :is=\"props.textTag\" v-if=\"hasText\">\n <slot name=\"text\">\n <span>{{ props.text }}</span>\n </slot>\n </component>\n <slot />\n </component>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, type CSSProperties, inject, toRef} from 'vue'\nimport type {BCarouselSlideProps} from '../../types/ComponentProps'\nimport {carouselInjectionKey} from '../../utils/keys'\nimport BImg from '../BImg/BImg.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {isEmptySlot} from '../../utils/dom'\nimport {useId} from '../../composables/useId'\nimport type {BCarouselSlideSlots} from '../../types/ComponentSlots'\n\nconst _props = withDefaults(defineProps<BCarouselSlideProps>(), {\n background: undefined,\n caption: undefined,\n captionTag: 'h3',\n contentTag: 'div',\n contentVisibleUp: undefined,\n id: undefined,\n imgAlt: undefined,\n imgBlank: false,\n imgBlankColor: 'transparent',\n imgHeight: undefined,\n imgSrc: undefined,\n imgSrcset: undefined,\n imgWidth: undefined,\n interval: undefined,\n text: undefined,\n textTag: 'p',\n})\nconst props = useDefaults(_props, 'BCarouselSlide')\nconst slots = defineSlots<BCarouselSlideSlots>()\n\nconst computedId = useId(() => props.id, 'carousel-slide')\nconst parentData = inject(carouselInjectionKey, null)\n\nconst hasText = computed(() => props.text || !isEmptySlot(slots.text))\nconst hasCaption = computed(() => props.caption || !isEmptySlot(slots.caption))\nconst hasContent = computed(() => hasText.value || hasCaption.value || !isEmptySlot(slots.default))\n\nconst computedStyle = computed<CSSProperties>(() => ({\n background: `${\n props.background || parentData?.background.value || 'rgb(171, 171, 171)'\n } none repeat scroll 0% 0%`,\n}))\n\nconst computedContentClasses = computed(() => ({\n 'd-none': props.contentVisibleUp !== undefined,\n [`d-${props.contentVisibleUp}-block`]: props.contentVisibleUp !== undefined,\n}))\n\ndefineExpose({\n _interval: toRef(() => props.interval),\n _id: computedId,\n})\n</script>\n","<template>\n <div :id=\"computedId\" class=\"carousel-item\" :style=\"computedStyle\">\n <slot name=\"img\">\n <BImg\n class=\"d-block w-100\"\n :alt=\"props.imgAlt\"\n :srcset=\"props.imgSrcset\"\n :src=\"props.imgSrc\"\n :width=\"props.imgWidth || parentData?.width.value\"\n :height=\"props.imgHeight || parentData?.height.value\"\n :blank=\"props.imgBlank\"\n :blank-color=\"props.imgBlankColor\"\n />\n </slot>\n <component\n :is=\"props.contentTag\"\n v-if=\"hasContent\"\n class=\"carousel-caption\"\n :class=\"computedContentClasses\"\n >\n <component :is=\"props.captionTag\" v-if=\"hasCaption\">\n <slot name=\"caption\">\n <span>{{ props.caption }}</span>\n </slot>\n </component>\n <component :is=\"props.textTag\" v-if=\"hasText\">\n <slot name=\"text\">\n <span>{{ props.text }}</span>\n </slot>\n </component>\n <slot />\n </component>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, type CSSProperties, inject, toRef} from 'vue'\nimport type {BCarouselSlideProps} from '../../types/ComponentProps'\nimport {carouselInjectionKey} from '../../utils/keys'\nimport BImg from '../BImg/BImg.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {isEmptySlot} from '../../utils/dom'\nimport {useId} from '../../composables/useId'\nimport type {BCarouselSlideSlots} from '../../types/ComponentSlots'\n\nconst _props = withDefaults(defineProps<BCarouselSlideProps>(), {\n background: undefined,\n caption: undefined,\n captionTag: 'h3',\n contentTag: 'div',\n contentVisibleUp: undefined,\n id: undefined,\n imgAlt: undefined,\n imgBlank: false,\n imgBlankColor: 'transparent',\n imgHeight: undefined,\n imgSrc: undefined,\n imgSrcset: undefined,\n imgWidth: undefined,\n interval: undefined,\n text: undefined,\n textTag: 'p',\n})\nconst props = useDefaults(_props, 'BCarouselSlide')\nconst slots = defineSlots<BCarouselSlideSlots>()\n\nconst computedId = useId(() => props.id, 'carousel-slide')\nconst parentData = inject(carouselInjectionKey, null)\n\nconst hasText = computed(() => props.text || !isEmptySlot(slots.text))\nconst hasCaption = computed(() => props.caption || !isEmptySlot(slots.caption))\nconst hasContent = computed(() => hasText.value || hasCaption.value || !isEmptySlot(slots.default))\n\nconst computedStyle = computed<CSSProperties>(() => ({\n background: `${\n props.background || parentData?.background.value || 'rgb(171, 171, 171)'\n } none repeat scroll 0% 0%`,\n}))\n\nconst computedContentClasses = computed(() => ({\n 'd-none': props.contentVisibleUp !== undefined,\n [`d-${props.contentVisibleUp}-block`]: props.contentVisibleUp !== undefined,\n}))\n\ndefineExpose({\n _interval: toRef(() => props.interval),\n _id: computedId,\n})\n</script>\n"],"mappings":";;;;;;;;;AAEA,IAAa,mBAAmB,MAAwB,cACrD,QAAQ,IAAI,EAAE,EACZ,QAAQ,KAAc,SAAgB;AACrC,KAAI,OAAO,KAAK,SAAS,SACvB,OAAM,IAAI,OAAO,KAAK,SAA6B;KAEnD,KAAI,KAAK,KAAK;AAEhB,QAAO;GACN,EAAE,CAAC,CACL,QAAQ,UAAW,MAAM,MAAuC,WAAW,SAAS;;;;;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