bootstrap-vue-next 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BAccordion-FuQ6sMFy.js → BAccordion-nQptHiXD.js} +2 -2
- package/dist/{BAccordion-FuQ6sMFy.js.map → BAccordion-nQptHiXD.js.map} +1 -1
- package/dist/{BAlert-C9Mi4RDx.js → BAlert-Bl3TOay3.js} +2 -2
- package/dist/{BAlert-C9Mi4RDx.js.map → BAlert-Bl3TOay3.js.map} +1 -1
- package/dist/{BCarousel-DQgfW4DN.js → BCarousel-BV2EiQRM.js} +2 -2
- package/dist/{BCarousel-DQgfW4DN.js.map → BCarousel-BV2EiQRM.js.map} +1 -1
- package/dist/{BCollapse-B9fnWSzA.js → BCollapse-B2q9Ya2S.js} +2 -2
- package/dist/{BCollapse-B9fnWSzA.js.map → BCollapse-B2q9Ya2S.js.map} +1 -1
- package/dist/{BDropdown-CnxUzs42.js → BDropdown-D4gLdtmX.js} +3 -3
- package/dist/{BDropdown-CnxUzs42.js.map → BDropdown-D4gLdtmX.js.map} +1 -1
- package/dist/{BModal-NPsCBNo7.js → BModal-BjmeVZen.js} +2 -2
- package/dist/{BModal-NPsCBNo7.js.map → BModal-BjmeVZen.js.map} +1 -1
- package/dist/{BNav-CjXS9tQ5.js → BNav-B2PlMEMD.js} +2 -2
- package/dist/{BNav-CjXS9tQ5.js.map → BNav-B2PlMEMD.js.map} +1 -1
- package/dist/{BOffcanvas-BndaBJoP.js → BOffcanvas-DfR32-ZP.js} +2 -2
- package/dist/{BOffcanvas-BndaBJoP.js.map → BOffcanvas-DfR32-ZP.js.map} +1 -1
- package/dist/{BPagination-D_Hfk6OF.js → BPagination-CfrsVgDp.js} +2 -2
- package/dist/{BPagination-D_Hfk6OF.js.map → BPagination-CfrsVgDp.js.map} +1 -1
- package/dist/{BTabs-BKmkVWrZ.js → BTabs-Zp8CvCL_.js} +2 -2
- package/dist/{BTabs-BKmkVWrZ.js.map → BTabs-Zp8CvCL_.js.map} +1 -1
- package/dist/{BToast-Di9HwBOV.js → BToast-CqE2VMW2.js} +2 -2
- package/dist/{BToast-Di9HwBOV.js.map → BToast-CqE2VMW2.js.map} +1 -1
- package/dist/{BTooltip-BxaUtV4m.js → BTooltip-BHFBLXnr.js} +2 -2
- package/dist/{BTooltip-BxaUtV4m.js.map → BTooltip-BHFBLXnr.js.map} +1 -1
- package/dist/bootstrap-vue-next.mjs +15 -15
- package/dist/{floatingUi-BlKoACvc.js → floatingUi-Stb1SUvw.js} +2 -2
- package/dist/{floatingUi-BlKoACvc.js.map → floatingUi-Stb1SUvw.js.map} +1 -1
- package/dist/src/components/BAccordion/index.mjs +1 -1
- package/dist/src/components/BAlert/index.mjs +1 -1
- package/dist/src/components/BCarousel/index.mjs +1 -1
- package/dist/src/components/BCollapse/index.mjs +1 -1
- package/dist/src/components/BDropdown/index.mjs +1 -1
- package/dist/src/components/BModal/index.mjs +1 -1
- package/dist/src/components/BNav/index.mjs +1 -1
- package/dist/src/components/BOffcanvas/index.mjs +1 -1
- package/dist/src/components/BPagination/index.mjs +1 -1
- package/dist/src/components/BPopover/index.mjs +1 -1
- package/dist/src/components/BTabs/index.mjs +1 -1
- package/dist/src/components/BToast/index.mjs +1 -1
- package/dist/src/components/BTooltip/index.mjs +1 -1
- package/dist/src/components/index.mjs +13 -13
- package/dist/src/composables/orchestratorShared/index.mjs +33 -5
- package/dist/src/composables/orchestratorShared/index.mjs.map +1 -1
- package/dist/src/composables/useModal/index.mjs +1 -1
- package/dist/src/composables/usePopover/index.mjs +2 -2
- package/dist/src/composables/useToast/index.mjs +1 -1
- package/dist/src/directives/BPopover/index.mjs +2 -2
- package/dist/src/directives/BScrollspy/index.mjs +1 -1
- package/dist/src/directives/BToggle/index.mjs +1 -1
- package/dist/src/directives/BTooltip/index.mjs +2 -2
- package/dist/{useShowHide-C95Y9EKL.js → useShowHide-B6RQbFDt.js} +2 -2
- package/dist/{useShowHide-C95Y9EKL.js.map → useShowHide-B6RQbFDt.js.map} +1 -1
- package/dist/{utils-nRGGHA_i.js → utils-CK56zzsO.js} +2 -2
- package/dist/{utils-nRGGHA_i.js.map → utils-CK56zzsO.js.map} +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { c as sortSlotElementsByPosition } from "./dom-BdUQrX99.js";
|
|
|
4
4
|
import { t as useDefaults } from "./useDefaults-BzP4qZBu.js";
|
|
5
5
|
import { t as useId$1 } from "./useId-Fh-Arhb7.js";
|
|
6
6
|
import { t as flattenFragments } from "./flattenFragments-B15oMVs-.js";
|
|
7
|
-
import { t as BCollapse_default } from "./BCollapse-
|
|
7
|
+
import { t as BCollapse_default } from "./BCollapse-B2q9Ya2S.js";
|
|
8
8
|
import { r as isReadOnlyArray } from "./object-C7YmCGEm.js";
|
|
9
9
|
import { computed, createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, nextTick, normalizeClass, onMounted, onUnmounted, openBlock, provide, readonly, ref, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, unref, useAttrs, useModel, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
10
10
|
//#region src/components/BAccordion/BAccordionItem.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -347,4 +347,4 @@ var BAccordion_default = /* @__PURE__ */ defineComponent({
|
|
|
347
347
|
//#endregion
|
|
348
348
|
export { BAccordionItem_default as n, BAccordion_default as t };
|
|
349
349
|
|
|
350
|
-
//# sourceMappingURL=BAccordion-
|
|
350
|
+
//# sourceMappingURL=BAccordion-nQptHiXD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BAccordion-FuQ6sMFy.js","names":[],"sources":["../src/components/BAccordion/BAccordionItem.vue","../src/components/BAccordion/BAccordionItem.vue","../src/components/BAccordion/BAccordion.vue","../src/components/BAccordion/BAccordion.vue"],"sourcesContent":["<template>\n <div\n ref=\"_el\"\n class=\"accordion-item\"\n v-bind=\"props.wrapperAttrs\"\n :class=\"processedAttrs.wrapperClass\"\n >\n <BCollapse\n :id=\"computedId\"\n v-model=\"modelValue\"\n class=\"accordion-collapse\"\n :class=\"props.collapseClass\"\n :aria-labelledby=\"`${computedId}-heading`\"\n v-bind=\"processedAttrs.collapseAttrs\"\n :tag=\"props.tag\"\n :show=\"props.show\"\n :horizontal=\"props.horizontal\"\n :visible=\"props.visible\"\n :is-nav=\"props.isNav\"\n :lazy=\"props.lazy || parentData?.lazy.value\"\n :unmount-lazy=\"props.unmountLazy || parentData?.unmountLazy.value\"\n @show=\"emit('show', $event)\"\n @shown=\"emit('shown', $event)\"\n @hide=\"emit('hide', $event)\"\n @hidden=\"emit('hidden', $event)\"\n @hide-prevented=\"emit('hide-prevented', $event)\"\n @show-prevented=\"emit('show-prevented', $event)\"\n @toggle-prevented=\"emit('toggle-prevented', $event)\"\n @toggle=\"emit('toggle', $event)\"\n >\n <template #header=\"{visible: toggleVisible, toggle: slotToggle}\">\n <component\n :is=\"props.headerTag\"\n :id=\"`${computedId}-heading`\"\n class=\"accordion-header\"\n :class=\"props.headerClass\"\n v-bind=\"props.headerAttrs\"\n >\n <button\n class=\"accordion-button\"\n v-bind=\"props.buttonAttrs\"\n :class=\"[{collapsed: !toggleVisible}, props.buttonClass]\"\n type=\"button\"\n :aria-expanded=\"toggleVisible ? 'true' : 'false'\"\n :aria-controls=\"computedId\"\n @click=\"slotToggle\"\n >\n <slot name=\"title\"> {{ props.title }} </slot>\n </button>\n </component>\n </template>\n <div class=\"accordion-body\" v-bind=\"props.bodyAttrs\" :class=\"props.bodyClass\">\n <slot />\n </div>\n </BCollapse>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n inject,\n nextTick,\n onMounted,\n onUnmounted,\n useAttrs,\n useTemplateRef,\n watch,\n} from 'vue'\nimport BCollapse from '../BCollapse/BCollapse.vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport type {BAccordionItemEmits, BAccordionItemProps, BAccordionItemSlots} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BAccordionItemProps, 'modelValue'>>(), {\n bodyAttrs: undefined,\n bodyClass: undefined,\n buttonAttrs: undefined,\n buttonClass: undefined,\n collapseClass: undefined,\n headerAttrs: undefined,\n headerClass: undefined,\n headerTag: 'h2',\n horizontal: undefined,\n id: undefined,\n isNav: undefined,\n lazy: false,\n unmountLazy: false,\n tag: undefined,\n title: undefined,\n show: undefined,\n visible: false,\n wrapperAttrs: undefined,\n})\nconst props = useDefaults(_props, 'BAccordionItem')\nconst emit = defineEmits<BAccordionItemEmits>()\ndefineSlots<BAccordionItemSlots>()\nconst attrs = useAttrs()\n\nconst processedAttrs = computed(() => {\n const {class: wrapperClass, ...collapseAttrs} = attrs\n return {wrapperClass, collapseAttrs}\n})\n\nconst parentData = inject(accordionInjectionKey, null)\n\nconst computedId = useId(() => props.id, 'accordion_item')\n\nconst modelValue = defineModel<Exclude<BAccordionItemProps['modelValue'], undefined>>({\n default: false,\n})\n\nif (modelValue.value) {\n parentData?.setOpenItem(computedId.value)\n} else {\n modelValue.value =\n (isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value) && !parentData?.initialAnimation.value\n}\n\nconst el = useTemplateRef('_el')\nparentData?.registerAccordionItem(computedId.value, el)\n\nonUnmounted(() => {\n parentData?.unregisterAccordionItem(computedId.value)\n})\n\nonMounted(() => {\n if (!modelValue.value && parentData?.openItem.value === computedId.value) {\n nextTick(() => {\n modelValue.value = true\n })\n }\n})\n\nconst openInParent = computed(() =>\n isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value\n)\n\nwatch(\n () => parentData?.openItem.value,\n () => (modelValue.value = openInParent.value)\n)\nwatch(modelValue, () => {\n if (modelValue.value && !openInParent.value) {\n parentData?.setOpenItem(computedId.value)\n } else if (!modelValue.value && openInParent.value) {\n parentData?.setCloseItem(computedId.value)\n }\n})\n</script>\n","<template>\n <div\n ref=\"_el\"\n class=\"accordion-item\"\n v-bind=\"props.wrapperAttrs\"\n :class=\"processedAttrs.wrapperClass\"\n >\n <BCollapse\n :id=\"computedId\"\n v-model=\"modelValue\"\n class=\"accordion-collapse\"\n :class=\"props.collapseClass\"\n :aria-labelledby=\"`${computedId}-heading`\"\n v-bind=\"processedAttrs.collapseAttrs\"\n :tag=\"props.tag\"\n :show=\"props.show\"\n :horizontal=\"props.horizontal\"\n :visible=\"props.visible\"\n :is-nav=\"props.isNav\"\n :lazy=\"props.lazy || parentData?.lazy.value\"\n :unmount-lazy=\"props.unmountLazy || parentData?.unmountLazy.value\"\n @show=\"emit('show', $event)\"\n @shown=\"emit('shown', $event)\"\n @hide=\"emit('hide', $event)\"\n @hidden=\"emit('hidden', $event)\"\n @hide-prevented=\"emit('hide-prevented', $event)\"\n @show-prevented=\"emit('show-prevented', $event)\"\n @toggle-prevented=\"emit('toggle-prevented', $event)\"\n @toggle=\"emit('toggle', $event)\"\n >\n <template #header=\"{visible: toggleVisible, toggle: slotToggle}\">\n <component\n :is=\"props.headerTag\"\n :id=\"`${computedId}-heading`\"\n class=\"accordion-header\"\n :class=\"props.headerClass\"\n v-bind=\"props.headerAttrs\"\n >\n <button\n class=\"accordion-button\"\n v-bind=\"props.buttonAttrs\"\n :class=\"[{collapsed: !toggleVisible}, props.buttonClass]\"\n type=\"button\"\n :aria-expanded=\"toggleVisible ? 'true' : 'false'\"\n :aria-controls=\"computedId\"\n @click=\"slotToggle\"\n >\n <slot name=\"title\"> {{ props.title }} </slot>\n </button>\n </component>\n </template>\n <div class=\"accordion-body\" v-bind=\"props.bodyAttrs\" :class=\"props.bodyClass\">\n <slot />\n </div>\n </BCollapse>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n inject,\n nextTick,\n onMounted,\n onUnmounted,\n useAttrs,\n useTemplateRef,\n watch,\n} from 'vue'\nimport BCollapse from '../BCollapse/BCollapse.vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport type {BAccordionItemEmits, BAccordionItemProps, BAccordionItemSlots} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BAccordionItemProps, 'modelValue'>>(), {\n bodyAttrs: undefined,\n bodyClass: undefined,\n buttonAttrs: undefined,\n buttonClass: undefined,\n collapseClass: undefined,\n headerAttrs: undefined,\n headerClass: undefined,\n headerTag: 'h2',\n horizontal: undefined,\n id: undefined,\n isNav: undefined,\n lazy: false,\n unmountLazy: false,\n tag: undefined,\n title: undefined,\n show: undefined,\n visible: false,\n wrapperAttrs: undefined,\n})\nconst props = useDefaults(_props, 'BAccordionItem')\nconst emit = defineEmits<BAccordionItemEmits>()\ndefineSlots<BAccordionItemSlots>()\nconst attrs = useAttrs()\n\nconst processedAttrs = computed(() => {\n const {class: wrapperClass, ...collapseAttrs} = attrs\n return {wrapperClass, collapseAttrs}\n})\n\nconst parentData = inject(accordionInjectionKey, null)\n\nconst computedId = useId(() => props.id, 'accordion_item')\n\nconst modelValue = defineModel<Exclude<BAccordionItemProps['modelValue'], undefined>>({\n default: false,\n})\n\nif (modelValue.value) {\n parentData?.setOpenItem(computedId.value)\n} else {\n modelValue.value =\n (isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value) && !parentData?.initialAnimation.value\n}\n\nconst el = useTemplateRef('_el')\nparentData?.registerAccordionItem(computedId.value, el)\n\nonUnmounted(() => {\n parentData?.unregisterAccordionItem(computedId.value)\n})\n\nonMounted(() => {\n if (!modelValue.value && parentData?.openItem.value === computedId.value) {\n nextTick(() => {\n modelValue.value = true\n })\n }\n})\n\nconst openInParent = computed(() =>\n isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value\n)\n\nwatch(\n () => parentData?.openItem.value,\n () => (modelValue.value = openInParent.value)\n)\nwatch(modelValue, () => {\n if (modelValue.value && !openInParent.value) {\n parentData?.setOpenItem(computedId.value)\n } else if (!modelValue.value && openInParent.value) {\n parentData?.setCloseItem(computedId.value)\n }\n})\n</script>\n","<template>\n <div :id=\"computedId\" class=\"accordion\" :class=\"computedClasses\">\n <slot />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n provide,\n readonly,\n ref,\n type ShallowRef,\n shallowRef,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport {warn} from '../../utils/console'\nimport BAccordionItem from './BAccordionItem.vue'\nimport {sortSlotElementsByPosition} from '../../utils/dom'\nimport type {BAccordionSlots, BAccordionProps} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\nconst _props = withDefaults(defineProps<Omit<BAccordionProps, 'modelValue' | 'index'>>(), {\n flush: false,\n free: false,\n initialAnimation: false,\n id: undefined,\n lazy: false,\n unmountLazy: false,\n})\nconst props = useDefaults(_props, 'BAccordion')\nconst slots = defineSlots<BAccordionSlots>()\n\nconst modelValue = defineModel<BAccordionProps['modelValue']>({\n default: undefined,\n})\n\nconst index = defineModel<BAccordionProps['index']>('index', {\n default: undefined,\n})\n\nconst itemElementsArray = ref<VNode[]>([])\n\nconst updateItemElementsArray = () => {\n const itemElements = flattenFragments(slots.default?.({}) ?? [])\n itemElementsArray.value = (Array.isArray(itemElements) ? itemElements : [itemElements]).filter(\n (item) => item.type === BAccordionItem\n )\n}\nupdateItemElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateItemElementsArray()\n nextTick(() => {\n sortAccordionItems()\n })\n }\n)\n\ninterface AccordionItem {\n id: string\n el: Readonly<ShallowRef<HTMLElement | null>>\n}\n\nconst accordionItems = shallowRef<AccordionItem[]>([])\n\nconst sortAccordionItems = () => {\n accordionItems.value = [...accordionItems.value].sort((a, b) =>\n sortSlotElementsByPosition(unref(a.el), unref(b.el))\n )\n if (modelValue.value) {\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value\n .map((id) => accordionItems.value.findIndex((item) => item.id === id))\n .filter((i) => i !== -1)\n\n if (next.length !== modelValue.value.length) {\n warn('BAccordion', 'Unknown item id in v-model:', modelValue.value)\n }\n index.value = next\n } else {\n const idx = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (idx !== -1) index.value = idx\n }\n } else if (index.value !== undefined) {\n modelValue.value = isReadOnlyArray(index.value)\n ? index.value.map((idx) => accordionItems.value[idx]?.id).filter((el) => el !== undefined)\n : accordionItems.value[index.value]?.id\n }\n}\n\nconst computedId = useId(() => props.id, 'accordion')\n\nconst computedClasses = computed(() => ({\n 'accordion-flush': props.flush,\n}))\n\nconst areEqual = (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((item, index) => item === b[index])\n }\n return a === b\n}\n\nwatch(index, (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (index.value === undefined) {\n modelValue.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = !isReadOnlyArray(index.value) ? index.value : index.value?.[0]\n if (idx !== undefined && accordionItems.value[idx]?.id) {\n if (modelValue.value !== accordionItems.value[idx]?.id) {\n modelValue.value = accordionItems.value[idx]?.id\n }\n } else {\n nextTick(() => {\n index.value = undefined\n })\n }\n } else {\n // free mode\n if (isReadOnlyArray(index.value)) {\n const newValue = index.value\n .map((item) => accordionItems.value[item]?.id)\n .filter((el) => el !== undefined)\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n } else {\n const newValue = accordionItems.value[index.value]?.id\n if (newValue === undefined) {\n nextTick(() => {\n index.value = undefined\n })\n return\n }\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n }\n }\n})\n\nwatch(\n modelValue,\n (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (modelValue.value === undefined) {\n index.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = accordionItems.value.findIndex(\n (item) =>\n item.id ===\n (!isReadOnlyArray(modelValue.value) ? modelValue.value : modelValue.value?.[0])\n )\n\n if (idx !== -1) {\n if (index.value !== idx) {\n index.value = idx\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else if (props.free) {\n if (isReadOnlyArray(modelValue.value)) {\n const idxes = modelValue.value\n .map((value) => accordionItems.value.findIndex((item) => item.id === value))\n .filter((index) => index !== -1)\n if (idxes.length > 0) {\n if (!areEqual(idxes, index.value)) {\n index.value = idxes\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else {\n const newValue = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (!areEqual(newValue, index.value)) {\n index.value = newValue\n }\n }\n }\n },\n {deep: true}\n)\n\nwatch(\n () => props.free,\n (free) => {\n if (modelValue.value) {\n if (!free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = modelValue.value[0]\n } else if (free && !isReadOnlyArray(modelValue.value)) {\n modelValue.value = [modelValue.value]\n }\n }\n }\n)\n\nprovide(accordionInjectionKey, {\n openItem: readonly(modelValue),\n free: toRef(() => props.free),\n initialAnimation: toRef(() => props.initialAnimation),\n lazy: toRef(() => props.lazy),\n unmountLazy: toRef(() => props.unmountLazy),\n setOpenItem: (id: string) => {\n if (props.free && !isReadOnlyArray(modelValue.value)) {\n if (modelValue.value !== undefined) {\n modelValue.value = [modelValue.value, id]\n } else {\n modelValue.value = [id]\n }\n return\n }\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = id\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n if (!modelValue.value.includes(id)) {\n modelValue.value = [...modelValue.value, id]\n }\n } else {\n modelValue.value = id\n }\n },\n setCloseItem: (id: string) => {\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = undefined\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value.filter((item) => item !== id)\n modelValue.value = next.length ? next : undefined\n } else {\n if (modelValue.value === id) {\n modelValue.value = undefined\n }\n }\n },\n registerAccordionItem: (id: string, el: Readonly<ShallowRef<HTMLElement | null>>) => {\n accordionItems.value = [...accordionItems.value, {id, el}]\n if (accordionItems.value.length === itemElementsArray.value.length) {\n sortAccordionItems()\n }\n },\n unregisterAccordionItem: (id: string) => {\n accordionItems.value = accordionItems.value.filter((item) => item.id !== id)\n },\n})\n</script>\n","<template>\n <div :id=\"computedId\" class=\"accordion\" :class=\"computedClasses\">\n <slot />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n provide,\n readonly,\n ref,\n type ShallowRef,\n shallowRef,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport {warn} from '../../utils/console'\nimport BAccordionItem from './BAccordionItem.vue'\nimport {sortSlotElementsByPosition} from '../../utils/dom'\nimport type {BAccordionSlots, BAccordionProps} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\nconst _props = withDefaults(defineProps<Omit<BAccordionProps, 'modelValue' | 'index'>>(), {\n flush: false,\n free: false,\n initialAnimation: false,\n id: undefined,\n lazy: false,\n unmountLazy: false,\n})\nconst props = useDefaults(_props, 'BAccordion')\nconst slots = defineSlots<BAccordionSlots>()\n\nconst modelValue = defineModel<BAccordionProps['modelValue']>({\n default: undefined,\n})\n\nconst index = defineModel<BAccordionProps['index']>('index', {\n default: undefined,\n})\n\nconst itemElementsArray = ref<VNode[]>([])\n\nconst updateItemElementsArray = () => {\n const itemElements = flattenFragments(slots.default?.({}) ?? [])\n itemElementsArray.value = (Array.isArray(itemElements) ? itemElements : [itemElements]).filter(\n (item) => item.type === BAccordionItem\n )\n}\nupdateItemElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateItemElementsArray()\n nextTick(() => {\n sortAccordionItems()\n })\n }\n)\n\ninterface AccordionItem {\n id: string\n el: Readonly<ShallowRef<HTMLElement | null>>\n}\n\nconst accordionItems = shallowRef<AccordionItem[]>([])\n\nconst sortAccordionItems = () => {\n accordionItems.value = [...accordionItems.value].sort((a, b) =>\n sortSlotElementsByPosition(unref(a.el), unref(b.el))\n )\n if (modelValue.value) {\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value\n .map((id) => accordionItems.value.findIndex((item) => item.id === id))\n .filter((i) => i !== -1)\n\n if (next.length !== modelValue.value.length) {\n warn('BAccordion', 'Unknown item id in v-model:', modelValue.value)\n }\n index.value = next\n } else {\n const idx = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (idx !== -1) index.value = idx\n }\n } else if (index.value !== undefined) {\n modelValue.value = isReadOnlyArray(index.value)\n ? index.value.map((idx) => accordionItems.value[idx]?.id).filter((el) => el !== undefined)\n : accordionItems.value[index.value]?.id\n }\n}\n\nconst computedId = useId(() => props.id, 'accordion')\n\nconst computedClasses = computed(() => ({\n 'accordion-flush': props.flush,\n}))\n\nconst areEqual = (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((item, index) => item === b[index])\n }\n return a === b\n}\n\nwatch(index, (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (index.value === undefined) {\n modelValue.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = !isReadOnlyArray(index.value) ? index.value : index.value?.[0]\n if (idx !== undefined && accordionItems.value[idx]?.id) {\n if (modelValue.value !== accordionItems.value[idx]?.id) {\n modelValue.value = accordionItems.value[idx]?.id\n }\n } else {\n nextTick(() => {\n index.value = undefined\n })\n }\n } else {\n // free mode\n if (isReadOnlyArray(index.value)) {\n const newValue = index.value\n .map((item) => accordionItems.value[item]?.id)\n .filter((el) => el !== undefined)\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n } else {\n const newValue = accordionItems.value[index.value]?.id\n if (newValue === undefined) {\n nextTick(() => {\n index.value = undefined\n })\n return\n }\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n }\n }\n})\n\nwatch(\n modelValue,\n (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (modelValue.value === undefined) {\n index.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = accordionItems.value.findIndex(\n (item) =>\n item.id ===\n (!isReadOnlyArray(modelValue.value) ? modelValue.value : modelValue.value?.[0])\n )\n\n if (idx !== -1) {\n if (index.value !== idx) {\n index.value = idx\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else if (props.free) {\n if (isReadOnlyArray(modelValue.value)) {\n const idxes = modelValue.value\n .map((value) => accordionItems.value.findIndex((item) => item.id === value))\n .filter((index) => index !== -1)\n if (idxes.length > 0) {\n if (!areEqual(idxes, index.value)) {\n index.value = idxes\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else {\n const newValue = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (!areEqual(newValue, index.value)) {\n index.value = newValue\n }\n }\n }\n },\n {deep: true}\n)\n\nwatch(\n () => props.free,\n (free) => {\n if (modelValue.value) {\n if (!free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = modelValue.value[0]\n } else if (free && !isReadOnlyArray(modelValue.value)) {\n modelValue.value = [modelValue.value]\n }\n }\n }\n)\n\nprovide(accordionInjectionKey, {\n openItem: readonly(modelValue),\n free: toRef(() => props.free),\n initialAnimation: toRef(() => props.initialAnimation),\n lazy: toRef(() => props.lazy),\n unmountLazy: toRef(() => props.unmountLazy),\n setOpenItem: (id: string) => {\n if (props.free && !isReadOnlyArray(modelValue.value)) {\n if (modelValue.value !== undefined) {\n modelValue.value = [modelValue.value, id]\n } else {\n modelValue.value = [id]\n }\n return\n }\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = id\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n if (!modelValue.value.includes(id)) {\n modelValue.value = [...modelValue.value, id]\n }\n } else {\n modelValue.value = id\n }\n },\n setCloseItem: (id: string) => {\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = undefined\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value.filter((item) => item !== id)\n modelValue.value = next.length ? next : undefined\n } else {\n if (modelValue.value === id) {\n modelValue.value = undefined\n }\n }\n },\n registerAccordionItem: (id: string, el: Readonly<ShallowRef<HTMLElement | null>>) => {\n accordionItems.value = [...accordionItems.value, {id, el}]\n if (accordionItems.value.length === itemElementsArray.value.length) {\n sortAccordionItems()\n }\n },\n unregisterAccordionItem: (id: string) => {\n accordionItems.value = accordionItems.value.filter((item) => item.id !== id)\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoGA,MAAM,QAAQ,YAAY,SAAQ,gBAAgB;EAClD,MAAM,OAAO;EAEb,MAAM,QAAQ,SAAS;EAEvB,MAAM,iBAAiB,eAAe;GACpC,MAAM,EAAC,OAAO,cAAc,GAAG,kBAAiB;GAChD,OAAO;IAAC;IAAc;GAAa;EACrC,CAAC;EAED,MAAM,aAAa,OAAO,uBAAuB,IAAI;EAErD,MAAM,aAAa,cAAY,MAAM,IAAI,gBAAgB;EAEzD,MAAM,aAAa,SAAkE,SAAA,YAEpF;EAED,IAAI,WAAW,OACb,YAAY,YAAY,WAAW,KAAK;OAExC,WAAW,SACR,gBAAgB,YAAY,SAAS,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M,QAAQ,SAAS,SAAS,EAAE;KAC1D,WAAW,QAAQ,KAAK,SAAS,OAAO,KAAA;IAC1C,OACE,IAAI,WAAW,UAAU,IACvB,WAAW,QAAQ,KAAA;GAGzB;GACA,wBAAwB,IAAY,OAAiD;IACnF,eAAe,QAAQ,CAAC,GAAG,eAAe,OAAO;KAAC;KAAI;IAAE,CAAC;IACzD,IAAI,eAAe,MAAM,WAAW,kBAAkB,MAAM,QAC1D,mBAAmB;GAEvB;GACA,0BAA0B,OAAe;IACvC,eAAe,QAAQ,eAAe,MAAM,QAAQ,SAAS,KAAK,OAAO,EAAE;GAC7E;EACF,CAAC;;GA5QC,OAAA,UAAA,GAAA,mBAEM,OAAA;IAFA,IAAI,MAAA,UAAA;IAAY,OAAK,eAAA,CAAC,aAAoB,gBAAA,KAAe,CAAA;GAC7D,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,IAAA,UAAA"}
|
|
1
|
+
{"version":3,"file":"BAccordion-nQptHiXD.js","names":[],"sources":["../src/components/BAccordion/BAccordionItem.vue","../src/components/BAccordion/BAccordionItem.vue","../src/components/BAccordion/BAccordion.vue","../src/components/BAccordion/BAccordion.vue"],"sourcesContent":["<template>\n <div\n ref=\"_el\"\n class=\"accordion-item\"\n v-bind=\"props.wrapperAttrs\"\n :class=\"processedAttrs.wrapperClass\"\n >\n <BCollapse\n :id=\"computedId\"\n v-model=\"modelValue\"\n class=\"accordion-collapse\"\n :class=\"props.collapseClass\"\n :aria-labelledby=\"`${computedId}-heading`\"\n v-bind=\"processedAttrs.collapseAttrs\"\n :tag=\"props.tag\"\n :show=\"props.show\"\n :horizontal=\"props.horizontal\"\n :visible=\"props.visible\"\n :is-nav=\"props.isNav\"\n :lazy=\"props.lazy || parentData?.lazy.value\"\n :unmount-lazy=\"props.unmountLazy || parentData?.unmountLazy.value\"\n @show=\"emit('show', $event)\"\n @shown=\"emit('shown', $event)\"\n @hide=\"emit('hide', $event)\"\n @hidden=\"emit('hidden', $event)\"\n @hide-prevented=\"emit('hide-prevented', $event)\"\n @show-prevented=\"emit('show-prevented', $event)\"\n @toggle-prevented=\"emit('toggle-prevented', $event)\"\n @toggle=\"emit('toggle', $event)\"\n >\n <template #header=\"{visible: toggleVisible, toggle: slotToggle}\">\n <component\n :is=\"props.headerTag\"\n :id=\"`${computedId}-heading`\"\n class=\"accordion-header\"\n :class=\"props.headerClass\"\n v-bind=\"props.headerAttrs\"\n >\n <button\n class=\"accordion-button\"\n v-bind=\"props.buttonAttrs\"\n :class=\"[{collapsed: !toggleVisible}, props.buttonClass]\"\n type=\"button\"\n :aria-expanded=\"toggleVisible ? 'true' : 'false'\"\n :aria-controls=\"computedId\"\n @click=\"slotToggle\"\n >\n <slot name=\"title\"> {{ props.title }} </slot>\n </button>\n </component>\n </template>\n <div class=\"accordion-body\" v-bind=\"props.bodyAttrs\" :class=\"props.bodyClass\">\n <slot />\n </div>\n </BCollapse>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n inject,\n nextTick,\n onMounted,\n onUnmounted,\n useAttrs,\n useTemplateRef,\n watch,\n} from 'vue'\nimport BCollapse from '../BCollapse/BCollapse.vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport type {BAccordionItemEmits, BAccordionItemProps, BAccordionItemSlots} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BAccordionItemProps, 'modelValue'>>(), {\n bodyAttrs: undefined,\n bodyClass: undefined,\n buttonAttrs: undefined,\n buttonClass: undefined,\n collapseClass: undefined,\n headerAttrs: undefined,\n headerClass: undefined,\n headerTag: 'h2',\n horizontal: undefined,\n id: undefined,\n isNav: undefined,\n lazy: false,\n unmountLazy: false,\n tag: undefined,\n title: undefined,\n show: undefined,\n visible: false,\n wrapperAttrs: undefined,\n})\nconst props = useDefaults(_props, 'BAccordionItem')\nconst emit = defineEmits<BAccordionItemEmits>()\ndefineSlots<BAccordionItemSlots>()\nconst attrs = useAttrs()\n\nconst processedAttrs = computed(() => {\n const {class: wrapperClass, ...collapseAttrs} = attrs\n return {wrapperClass, collapseAttrs}\n})\n\nconst parentData = inject(accordionInjectionKey, null)\n\nconst computedId = useId(() => props.id, 'accordion_item')\n\nconst modelValue = defineModel<Exclude<BAccordionItemProps['modelValue'], undefined>>({\n default: false,\n})\n\nif (modelValue.value) {\n parentData?.setOpenItem(computedId.value)\n} else {\n modelValue.value =\n (isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value) && !parentData?.initialAnimation.value\n}\n\nconst el = useTemplateRef('_el')\nparentData?.registerAccordionItem(computedId.value, el)\n\nonUnmounted(() => {\n parentData?.unregisterAccordionItem(computedId.value)\n})\n\nonMounted(() => {\n if (!modelValue.value && parentData?.openItem.value === computedId.value) {\n nextTick(() => {\n modelValue.value = true\n })\n }\n})\n\nconst openInParent = computed(() =>\n isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value\n)\n\nwatch(\n () => parentData?.openItem.value,\n () => (modelValue.value = openInParent.value)\n)\nwatch(modelValue, () => {\n if (modelValue.value && !openInParent.value) {\n parentData?.setOpenItem(computedId.value)\n } else if (!modelValue.value && openInParent.value) {\n parentData?.setCloseItem(computedId.value)\n }\n})\n</script>\n","<template>\n <div\n ref=\"_el\"\n class=\"accordion-item\"\n v-bind=\"props.wrapperAttrs\"\n :class=\"processedAttrs.wrapperClass\"\n >\n <BCollapse\n :id=\"computedId\"\n v-model=\"modelValue\"\n class=\"accordion-collapse\"\n :class=\"props.collapseClass\"\n :aria-labelledby=\"`${computedId}-heading`\"\n v-bind=\"processedAttrs.collapseAttrs\"\n :tag=\"props.tag\"\n :show=\"props.show\"\n :horizontal=\"props.horizontal\"\n :visible=\"props.visible\"\n :is-nav=\"props.isNav\"\n :lazy=\"props.lazy || parentData?.lazy.value\"\n :unmount-lazy=\"props.unmountLazy || parentData?.unmountLazy.value\"\n @show=\"emit('show', $event)\"\n @shown=\"emit('shown', $event)\"\n @hide=\"emit('hide', $event)\"\n @hidden=\"emit('hidden', $event)\"\n @hide-prevented=\"emit('hide-prevented', $event)\"\n @show-prevented=\"emit('show-prevented', $event)\"\n @toggle-prevented=\"emit('toggle-prevented', $event)\"\n @toggle=\"emit('toggle', $event)\"\n >\n <template #header=\"{visible: toggleVisible, toggle: slotToggle}\">\n <component\n :is=\"props.headerTag\"\n :id=\"`${computedId}-heading`\"\n class=\"accordion-header\"\n :class=\"props.headerClass\"\n v-bind=\"props.headerAttrs\"\n >\n <button\n class=\"accordion-button\"\n v-bind=\"props.buttonAttrs\"\n :class=\"[{collapsed: !toggleVisible}, props.buttonClass]\"\n type=\"button\"\n :aria-expanded=\"toggleVisible ? 'true' : 'false'\"\n :aria-controls=\"computedId\"\n @click=\"slotToggle\"\n >\n <slot name=\"title\"> {{ props.title }} </slot>\n </button>\n </component>\n </template>\n <div class=\"accordion-body\" v-bind=\"props.bodyAttrs\" :class=\"props.bodyClass\">\n <slot />\n </div>\n </BCollapse>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n inject,\n nextTick,\n onMounted,\n onUnmounted,\n useAttrs,\n useTemplateRef,\n watch,\n} from 'vue'\nimport BCollapse from '../BCollapse/BCollapse.vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport type {BAccordionItemEmits, BAccordionItemProps, BAccordionItemSlots} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BAccordionItemProps, 'modelValue'>>(), {\n bodyAttrs: undefined,\n bodyClass: undefined,\n buttonAttrs: undefined,\n buttonClass: undefined,\n collapseClass: undefined,\n headerAttrs: undefined,\n headerClass: undefined,\n headerTag: 'h2',\n horizontal: undefined,\n id: undefined,\n isNav: undefined,\n lazy: false,\n unmountLazy: false,\n tag: undefined,\n title: undefined,\n show: undefined,\n visible: false,\n wrapperAttrs: undefined,\n})\nconst props = useDefaults(_props, 'BAccordionItem')\nconst emit = defineEmits<BAccordionItemEmits>()\ndefineSlots<BAccordionItemSlots>()\nconst attrs = useAttrs()\n\nconst processedAttrs = computed(() => {\n const {class: wrapperClass, ...collapseAttrs} = attrs\n return {wrapperClass, collapseAttrs}\n})\n\nconst parentData = inject(accordionInjectionKey, null)\n\nconst computedId = useId(() => props.id, 'accordion_item')\n\nconst modelValue = defineModel<Exclude<BAccordionItemProps['modelValue'], undefined>>({\n default: false,\n})\n\nif (modelValue.value) {\n parentData?.setOpenItem(computedId.value)\n} else {\n modelValue.value =\n (isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value) && !parentData?.initialAnimation.value\n}\n\nconst el = useTemplateRef('_el')\nparentData?.registerAccordionItem(computedId.value, el)\n\nonUnmounted(() => {\n parentData?.unregisterAccordionItem(computedId.value)\n})\n\nonMounted(() => {\n if (!modelValue.value && parentData?.openItem.value === computedId.value) {\n nextTick(() => {\n modelValue.value = true\n })\n }\n})\n\nconst openInParent = computed(() =>\n isReadOnlyArray(parentData?.openItem.value)\n ? parentData?.openItem.value.includes(computedId.value)\n : parentData?.openItem.value === computedId.value\n)\n\nwatch(\n () => parentData?.openItem.value,\n () => (modelValue.value = openInParent.value)\n)\nwatch(modelValue, () => {\n if (modelValue.value && !openInParent.value) {\n parentData?.setOpenItem(computedId.value)\n } else if (!modelValue.value && openInParent.value) {\n parentData?.setCloseItem(computedId.value)\n }\n})\n</script>\n","<template>\n <div :id=\"computedId\" class=\"accordion\" :class=\"computedClasses\">\n <slot />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n provide,\n readonly,\n ref,\n type ShallowRef,\n shallowRef,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport {warn} from '../../utils/console'\nimport BAccordionItem from './BAccordionItem.vue'\nimport {sortSlotElementsByPosition} from '../../utils/dom'\nimport type {BAccordionSlots, BAccordionProps} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\nconst _props = withDefaults(defineProps<Omit<BAccordionProps, 'modelValue' | 'index'>>(), {\n flush: false,\n free: false,\n initialAnimation: false,\n id: undefined,\n lazy: false,\n unmountLazy: false,\n})\nconst props = useDefaults(_props, 'BAccordion')\nconst slots = defineSlots<BAccordionSlots>()\n\nconst modelValue = defineModel<BAccordionProps['modelValue']>({\n default: undefined,\n})\n\nconst index = defineModel<BAccordionProps['index']>('index', {\n default: undefined,\n})\n\nconst itemElementsArray = ref<VNode[]>([])\n\nconst updateItemElementsArray = () => {\n const itemElements = flattenFragments(slots.default?.({}) ?? [])\n itemElementsArray.value = (Array.isArray(itemElements) ? itemElements : [itemElements]).filter(\n (item) => item.type === BAccordionItem\n )\n}\nupdateItemElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateItemElementsArray()\n nextTick(() => {\n sortAccordionItems()\n })\n }\n)\n\ninterface AccordionItem {\n id: string\n el: Readonly<ShallowRef<HTMLElement | null>>\n}\n\nconst accordionItems = shallowRef<AccordionItem[]>([])\n\nconst sortAccordionItems = () => {\n accordionItems.value = [...accordionItems.value].sort((a, b) =>\n sortSlotElementsByPosition(unref(a.el), unref(b.el))\n )\n if (modelValue.value) {\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value\n .map((id) => accordionItems.value.findIndex((item) => item.id === id))\n .filter((i) => i !== -1)\n\n if (next.length !== modelValue.value.length) {\n warn('BAccordion', 'Unknown item id in v-model:', modelValue.value)\n }\n index.value = next\n } else {\n const idx = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (idx !== -1) index.value = idx\n }\n } else if (index.value !== undefined) {\n modelValue.value = isReadOnlyArray(index.value)\n ? index.value.map((idx) => accordionItems.value[idx]?.id).filter((el) => el !== undefined)\n : accordionItems.value[index.value]?.id\n }\n}\n\nconst computedId = useId(() => props.id, 'accordion')\n\nconst computedClasses = computed(() => ({\n 'accordion-flush': props.flush,\n}))\n\nconst areEqual = (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((item, index) => item === b[index])\n }\n return a === b\n}\n\nwatch(index, (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (index.value === undefined) {\n modelValue.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = !isReadOnlyArray(index.value) ? index.value : index.value?.[0]\n if (idx !== undefined && accordionItems.value[idx]?.id) {\n if (modelValue.value !== accordionItems.value[idx]?.id) {\n modelValue.value = accordionItems.value[idx]?.id\n }\n } else {\n nextTick(() => {\n index.value = undefined\n })\n }\n } else {\n // free mode\n if (isReadOnlyArray(index.value)) {\n const newValue = index.value\n .map((item) => accordionItems.value[item]?.id)\n .filter((el) => el !== undefined)\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n } else {\n const newValue = accordionItems.value[index.value]?.id\n if (newValue === undefined) {\n nextTick(() => {\n index.value = undefined\n })\n return\n }\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n }\n }\n})\n\nwatch(\n modelValue,\n (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (modelValue.value === undefined) {\n index.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = accordionItems.value.findIndex(\n (item) =>\n item.id ===\n (!isReadOnlyArray(modelValue.value) ? modelValue.value : modelValue.value?.[0])\n )\n\n if (idx !== -1) {\n if (index.value !== idx) {\n index.value = idx\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else if (props.free) {\n if (isReadOnlyArray(modelValue.value)) {\n const idxes = modelValue.value\n .map((value) => accordionItems.value.findIndex((item) => item.id === value))\n .filter((index) => index !== -1)\n if (idxes.length > 0) {\n if (!areEqual(idxes, index.value)) {\n index.value = idxes\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else {\n const newValue = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (!areEqual(newValue, index.value)) {\n index.value = newValue\n }\n }\n }\n },\n {deep: true}\n)\n\nwatch(\n () => props.free,\n (free) => {\n if (modelValue.value) {\n if (!free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = modelValue.value[0]\n } else if (free && !isReadOnlyArray(modelValue.value)) {\n modelValue.value = [modelValue.value]\n }\n }\n }\n)\n\nprovide(accordionInjectionKey, {\n openItem: readonly(modelValue),\n free: toRef(() => props.free),\n initialAnimation: toRef(() => props.initialAnimation),\n lazy: toRef(() => props.lazy),\n unmountLazy: toRef(() => props.unmountLazy),\n setOpenItem: (id: string) => {\n if (props.free && !isReadOnlyArray(modelValue.value)) {\n if (modelValue.value !== undefined) {\n modelValue.value = [modelValue.value, id]\n } else {\n modelValue.value = [id]\n }\n return\n }\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = id\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n if (!modelValue.value.includes(id)) {\n modelValue.value = [...modelValue.value, id]\n }\n } else {\n modelValue.value = id\n }\n },\n setCloseItem: (id: string) => {\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = undefined\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value.filter((item) => item !== id)\n modelValue.value = next.length ? next : undefined\n } else {\n if (modelValue.value === id) {\n modelValue.value = undefined\n }\n }\n },\n registerAccordionItem: (id: string, el: Readonly<ShallowRef<HTMLElement | null>>) => {\n accordionItems.value = [...accordionItems.value, {id, el}]\n if (accordionItems.value.length === itemElementsArray.value.length) {\n sortAccordionItems()\n }\n },\n unregisterAccordionItem: (id: string) => {\n accordionItems.value = accordionItems.value.filter((item) => item.id !== id)\n },\n})\n</script>\n","<template>\n <div :id=\"computedId\" class=\"accordion\" :class=\"computedClasses\">\n <slot />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n provide,\n readonly,\n ref,\n type ShallowRef,\n shallowRef,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {accordionInjectionKey} from '../../utils/keys'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport {warn} from '../../utils/console'\nimport BAccordionItem from './BAccordionItem.vue'\nimport {sortSlotElementsByPosition} from '../../utils/dom'\nimport type {BAccordionSlots, BAccordionProps} from '../../types'\nimport {isReadOnlyArray} from '../../utils/object'\n\nconst _props = withDefaults(defineProps<Omit<BAccordionProps, 'modelValue' | 'index'>>(), {\n flush: false,\n free: false,\n initialAnimation: false,\n id: undefined,\n lazy: false,\n unmountLazy: false,\n})\nconst props = useDefaults(_props, 'BAccordion')\nconst slots = defineSlots<BAccordionSlots>()\n\nconst modelValue = defineModel<BAccordionProps['modelValue']>({\n default: undefined,\n})\n\nconst index = defineModel<BAccordionProps['index']>('index', {\n default: undefined,\n})\n\nconst itemElementsArray = ref<VNode[]>([])\n\nconst updateItemElementsArray = () => {\n const itemElements = flattenFragments(slots.default?.({}) ?? [])\n itemElementsArray.value = (Array.isArray(itemElements) ? itemElements : [itemElements]).filter(\n (item) => item.type === BAccordionItem\n )\n}\nupdateItemElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateItemElementsArray()\n nextTick(() => {\n sortAccordionItems()\n })\n }\n)\n\ninterface AccordionItem {\n id: string\n el: Readonly<ShallowRef<HTMLElement | null>>\n}\n\nconst accordionItems = shallowRef<AccordionItem[]>([])\n\nconst sortAccordionItems = () => {\n accordionItems.value = [...accordionItems.value].sort((a, b) =>\n sortSlotElementsByPosition(unref(a.el), unref(b.el))\n )\n if (modelValue.value) {\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value\n .map((id) => accordionItems.value.findIndex((item) => item.id === id))\n .filter((i) => i !== -1)\n\n if (next.length !== modelValue.value.length) {\n warn('BAccordion', 'Unknown item id in v-model:', modelValue.value)\n }\n index.value = next\n } else {\n const idx = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (idx !== -1) index.value = idx\n }\n } else if (index.value !== undefined) {\n modelValue.value = isReadOnlyArray(index.value)\n ? index.value.map((idx) => accordionItems.value[idx]?.id).filter((el) => el !== undefined)\n : accordionItems.value[index.value]?.id\n }\n}\n\nconst computedId = useId(() => props.id, 'accordion')\n\nconst computedClasses = computed(() => ({\n 'accordion-flush': props.flush,\n}))\n\nconst areEqual = (a: unknown, b: unknown) => {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((item, index) => item === b[index])\n }\n return a === b\n}\n\nwatch(index, (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (index.value === undefined) {\n modelValue.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = !isReadOnlyArray(index.value) ? index.value : index.value?.[0]\n if (idx !== undefined && accordionItems.value[idx]?.id) {\n if (modelValue.value !== accordionItems.value[idx]?.id) {\n modelValue.value = accordionItems.value[idx]?.id\n }\n } else {\n nextTick(() => {\n index.value = undefined\n })\n }\n } else {\n // free mode\n if (isReadOnlyArray(index.value)) {\n const newValue = index.value\n .map((item) => accordionItems.value[item]?.id)\n .filter((el) => el !== undefined)\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n } else {\n const newValue = accordionItems.value[index.value]?.id\n if (newValue === undefined) {\n nextTick(() => {\n index.value = undefined\n })\n return\n }\n if (!areEqual(newValue, modelValue.value)) {\n modelValue.value = newValue\n }\n }\n }\n})\n\nwatch(\n modelValue,\n (newValue, oldValue) => {\n if (areEqual(newValue, oldValue)) return\n if (modelValue.value === undefined) {\n index.value = undefined\n return\n }\n\n if (!props.free) {\n const idx = accordionItems.value.findIndex(\n (item) =>\n item.id ===\n (!isReadOnlyArray(modelValue.value) ? modelValue.value : modelValue.value?.[0])\n )\n\n if (idx !== -1) {\n if (index.value !== idx) {\n index.value = idx\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else if (props.free) {\n if (isReadOnlyArray(modelValue.value)) {\n const idxes = modelValue.value\n .map((value) => accordionItems.value.findIndex((item) => item.id === value))\n .filter((index) => index !== -1)\n if (idxes.length > 0) {\n if (!areEqual(idxes, index.value)) {\n index.value = idxes\n }\n } else {\n nextTick(() => {\n modelValue.value = undefined\n })\n }\n } else {\n const newValue = accordionItems.value.findIndex((item) => item.id === modelValue.value)\n if (!areEqual(newValue, index.value)) {\n index.value = newValue\n }\n }\n }\n },\n {deep: true}\n)\n\nwatch(\n () => props.free,\n (free) => {\n if (modelValue.value) {\n if (!free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = modelValue.value[0]\n } else if (free && !isReadOnlyArray(modelValue.value)) {\n modelValue.value = [modelValue.value]\n }\n }\n }\n)\n\nprovide(accordionInjectionKey, {\n openItem: readonly(modelValue),\n free: toRef(() => props.free),\n initialAnimation: toRef(() => props.initialAnimation),\n lazy: toRef(() => props.lazy),\n unmountLazy: toRef(() => props.unmountLazy),\n setOpenItem: (id: string) => {\n if (props.free && !isReadOnlyArray(modelValue.value)) {\n if (modelValue.value !== undefined) {\n modelValue.value = [modelValue.value, id]\n } else {\n modelValue.value = [id]\n }\n return\n }\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = id\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n if (!modelValue.value.includes(id)) {\n modelValue.value = [...modelValue.value, id]\n }\n } else {\n modelValue.value = id\n }\n },\n setCloseItem: (id: string) => {\n if (!props.free && isReadOnlyArray(modelValue.value)) {\n modelValue.value = undefined\n return\n }\n if (isReadOnlyArray(modelValue.value)) {\n const next = modelValue.value.filter((item) => item !== id)\n modelValue.value = next.length ? next : undefined\n } else {\n if (modelValue.value === id) {\n modelValue.value = undefined\n }\n }\n },\n registerAccordionItem: (id: string, el: Readonly<ShallowRef<HTMLElement | null>>) => {\n accordionItems.value = [...accordionItems.value, {id, el}]\n if (accordionItems.value.length === itemElementsArray.value.length) {\n sortAccordionItems()\n }\n },\n unregisterAccordionItem: (id: string) => {\n accordionItems.value = accordionItems.value.filter((item) => item.id !== id)\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoGA,MAAM,QAAQ,YAAY,SAAQ,gBAAgB;EAClD,MAAM,OAAO;EAEb,MAAM,QAAQ,SAAS;EAEvB,MAAM,iBAAiB,eAAe;GACpC,MAAM,EAAC,OAAO,cAAc,GAAG,kBAAiB;GAChD,OAAO;IAAC;IAAc;GAAa;EACrC,CAAC;EAED,MAAM,aAAa,OAAO,uBAAuB,IAAI;EAErD,MAAM,aAAa,cAAY,MAAM,IAAI,gBAAgB;EAEzD,MAAM,aAAa,SAAkE,SAAA,YAEpF;EAED,IAAI,WAAW,OACb,YAAY,YAAY,WAAW,KAAK;OAExC,WAAW,SACR,gBAAgB,YAAY,SAAS,KAAK,IACvC,YAAY,SAAS,MAAM,SAAS,WAAW,KAAK,IACpD,YAAY,SAAS,UAAU,WAAW,UAAU,CAAC,YAAY,iBAAiB;EAG1F,MAAM,KAAK,eAAe,KAAK;EAC/B,YAAY,sBAAsB,WAAW,OAAO,EAAE;EAEtD,kBAAkB;GAChB,YAAY,wBAAwB,WAAW,KAAK;EACtD,CAAC;EAED,gBAAgB;GACd,IAAI,CAAC,WAAW,SAAS,YAAY,SAAS,UAAU,WAAW,OACjE,eAAe;IACb,WAAW,QAAQ;GACrB,CAAC;EAEL,CAAC;EAED,MAAM,eAAe,eACnB,gBAAgB,YAAY,SAAS,KAAK,IACtC,YAAY,SAAS,MAAM,SAAS,WAAW,KAAK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,MAAA,UAAA;IAAY,OAAK,eAAA,CAAC,aAAoB,gBAAA,KAAe,CAAA;GAC7D,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,IAAA,UAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as useDefaults } from "./useDefaults-BzP4qZBu.js";
|
|
2
2
|
import { t as useId$1 } from "./useId-Fh-Arhb7.js";
|
|
3
|
-
import { t as useShowHide } from "./useShowHide-
|
|
3
|
+
import { t as useShowHide } from "./useShowHide-B6RQbFDt.js";
|
|
4
4
|
import { r as useBLinkHelper, t as BLink_default } from "./BLink-mdwZsC7b.js";
|
|
5
5
|
import { t as BCloseButton_default } from "./BCloseButton-B3-IdpNp.js";
|
|
6
6
|
import { t as BProgress_default } from "./BProgress-BNxYppi-.js";
|
|
@@ -295,4 +295,4 @@ var BAlert_default = /* @__PURE__ */ defineComponent({
|
|
|
295
295
|
//#endregion
|
|
296
296
|
export { BAlert_default as t };
|
|
297
297
|
|
|
298
|
-
//# sourceMappingURL=BAlert-
|
|
298
|
+
//# sourceMappingURL=BAlert-Bl3TOay3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BAlert-C9Mi4RDx.js","names":[],"sources":["../src/components/BAlert/BAlert.vue","../src/components/BAlert/BAlert.vue"],"sourcesContent":["<template>\n <Transition\n v-if=\"renderRef || contentShowing\"\n v-bind=\"transitionProps\"\n :appear=\"!!modelValue || props.visible\"\n >\n <div\n v-show=\"isAlertVisible\"\n :id=\"props.id\"\n ref=\"_element\"\n class=\"alert\"\n :class=\"[props.alertClass, computedClasses]\"\n tabindex=\"0\"\n :role=\"!isAlertVisible ? undefined : props.isStatus ? 'status' : 'alert'\"\n :aria-live=\"!isAlertVisible ? undefined : props.isStatus ? 'polite' : 'assertive'\"\n :aria-atomic=\"!isAlertVisible ? undefined : true\"\n >\n <component\n :is=\"props.headerTag\"\n v-if=\"contentShowing && (slots.title || props.title)\"\n class=\"alert-heading d-flex gap-2\"\n :class=\"props.headerClass\"\n >\n <slot name=\"title\" v-bind=\"sharedSlots\">\n <span>\n {{ props.title }}\n </span>\n </slot>\n <template v-if=\"props.dismissible\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto ps-1 btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </component>\n <template v-if=\"contentShowing && (slots.default || props.body)\">\n <div class=\"d-flex gap-2\">\n <component\n :is=\"computedTag\"\n class=\"alert-body\"\n :class=\"props.bodyClass\"\n v-bind=\"computedLinkProps\"\n @click=\"computedLink && props.dismissible ? hide() : () => {}\"\n >\n <slot v-bind=\"sharedSlots\">\n {{ props.body }}\n </slot>\n </component>\n\n <template v-if=\"props.dismissible && !(slots.title || props.title)\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </div>\n </template>\n <BProgress\n v-if=\"typeof modelValue === 'number' && props.progressProps !== undefined\"\n :animated=\"props.progressProps.animated\"\n :precision=\"props.progressProps.precision\"\n :show-progress=\"props.progressProps.showProgress\"\n :show-value=\"props.progressProps.showValue\"\n :striped=\"props.progressProps.striped\"\n :variant=\"props.progressProps.variant\"\n :max=\"modelValue\"\n :value=\"remainingMs\"\n height=\"4px\"\n />\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, type EmitFn, useTemplateRef, watch, watchEffect} from 'vue'\nimport {useBLinkHelper} from '../../composables/useBLinkHelper'\nimport type {BAlertEmits, BAlertProps, BAlertSlots, ShowHideSlotsData} from '../../types'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BLink from '../BLink/BLink.vue'\nimport BProgress from '../BProgress/BProgress.vue'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\nimport {useId} from '../../composables/useId'\nimport {useShowHide} from '../../composables/useShowHide'\nimport BButton from '../BButton/BButton.vue'\n\nconst _props = withDefaults(defineProps<Omit<BAlertProps, 'modelValue'>>(), {\n bgVariant: null,\n body: undefined,\n bodyClass: undefined,\n closeClass: undefined,\n closeContent: undefined,\n closeLabel: 'Close',\n closeVariant: 'secondary',\n dismissible: false,\n headerClass: undefined,\n headerTag: 'div',\n id: undefined,\n initialAnimation: false,\n interval: 'requestAnimationFrame',\n isStatus: false,\n lazy: false,\n noFade: false,\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n progressProps: undefined,\n unmountLazy: false,\n showOnPause: true,\n show: false,\n solid: false,\n textVariant: null,\n title: undefined,\n alertClass: undefined,\n transProps: undefined,\n visible: false,\n // Link props\n // All others use defaults\n noRel: undefined,\n active: undefined,\n activeClass: undefined,\n disabled: undefined,\n exactActiveClass: undefined,\n href: undefined,\n icon: undefined,\n opacity: undefined,\n opacityHover: undefined,\n stretched: false,\n rel: undefined,\n replace: undefined,\n routerComponentName: undefined,\n target: undefined,\n to: undefined,\n underlineOffset: undefined,\n underlineOffsetHover: undefined,\n underlineOpacity: undefined,\n underlineOpacityHover: undefined,\n underlineVariant: undefined,\n // End link props\n variant: 'info',\n})\nconst props = useDefaults(_props, 'BAlert')\nconst emit = defineEmits<BAlertEmits>()\nconst slots = defineSlots<BAlertSlots>()\n\nconst element = useTemplateRef('_element')\n\nconst modelValue = defineModel<Exclude<BAlertProps['modelValue'], undefined>>({default: false})\nconst {computedLink, computedLinkProps} = useBLinkHelper(props)\n\nconst computedId = useId(() => props.id, 'alert')\n\nconst {\n showRef,\n renderRef,\n hide,\n toggle,\n show,\n buildTriggerableEvent,\n computedNoAnimation,\n isVisible,\n transitionProps,\n contentShowing,\n} = useShowHide({modelValue, props, emit: emit as EmitFn, element, id: computedId})\n\n// TODO solid is never used\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst {\n isActive,\n pause,\n restart,\n resume,\n stop,\n isPaused,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number' && !!modelValue.value,\n})\nuseCountdownHover(\n element,\n {\n noHoverPause: () => props.noHoverPause || typeof modelValue.value !== 'number',\n noResumeOnHoverLeave: () => props.noResumeOnHoverLeave || typeof modelValue.value !== 'number',\n modelValueIgnoresHover: () => typeof modelValue.value === 'boolean',\n },\n {pause, resume}\n)\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst computedTag = computed(() => (computedLink.value ? BLink : 'div'))\n\nconst isAlertVisible = computed(\n () => showRef.value || isActive.value || (props.showOnPause && isPaused.value)\n)\n\n// const colorClasses = useColorVariantClasses(props)\nconst computedClasses = computed(() => [\n // colorClasses.value,\n {\n [`alert-${props.variant}`]: props.variant !== null,\n 'alert-dismissible': props.dismissible && !(slots.close || props.closeContent),\n 'show': isVisible.value,\n 'fade': !computedNoAnimation.value,\n },\n])\n\nwatch(modelValue, (newValue) => {\n if (typeof newValue === 'number') {\n const event = buildTriggerableEvent('show', {cancelable: true, trigger: 'model'})\n emit('show', event)\n if (event.defaultPrevented) {\n emit('show-prevented', buildTriggerableEvent('show-prevented'))\n } else {\n restart()\n }\n }\n})\n\n// isActive in the composable will cause the alert to hide when the countdown is done\nwatch(isActive, (newValue) => {\n if (newValue === false && isPaused.value === false) {\n hide()\n modelValue.value = 0\n stop()\n }\n})\nconst sharedSlots = computed<ShowHideSlotsData>(() => ({\n toggle,\n show,\n hide,\n id: computedId.value,\n visible: showRef.value,\n active: isActive.value,\n}))\n\ndefineExpose({\n show,\n hide,\n toggle,\n pause,\n restart,\n resume,\n stop,\n})\n</script>\n","<template>\n <Transition\n v-if=\"renderRef || contentShowing\"\n v-bind=\"transitionProps\"\n :appear=\"!!modelValue || props.visible\"\n >\n <div\n v-show=\"isAlertVisible\"\n :id=\"props.id\"\n ref=\"_element\"\n class=\"alert\"\n :class=\"[props.alertClass, computedClasses]\"\n tabindex=\"0\"\n :role=\"!isAlertVisible ? undefined : props.isStatus ? 'status' : 'alert'\"\n :aria-live=\"!isAlertVisible ? undefined : props.isStatus ? 'polite' : 'assertive'\"\n :aria-atomic=\"!isAlertVisible ? undefined : true\"\n >\n <component\n :is=\"props.headerTag\"\n v-if=\"contentShowing && (slots.title || props.title)\"\n class=\"alert-heading d-flex gap-2\"\n :class=\"props.headerClass\"\n >\n <slot name=\"title\" v-bind=\"sharedSlots\">\n <span>\n {{ props.title }}\n </span>\n </slot>\n <template v-if=\"props.dismissible\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto ps-1 btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </component>\n <template v-if=\"contentShowing && (slots.default || props.body)\">\n <div class=\"d-flex gap-2\">\n <component\n :is=\"computedTag\"\n class=\"alert-body\"\n :class=\"props.bodyClass\"\n v-bind=\"computedLinkProps\"\n @click=\"computedLink && props.dismissible ? hide() : () => {}\"\n >\n <slot v-bind=\"sharedSlots\">\n {{ props.body }}\n </slot>\n </component>\n\n <template v-if=\"props.dismissible && !(slots.title || props.title)\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </div>\n </template>\n <BProgress\n v-if=\"typeof modelValue === 'number' && props.progressProps !== undefined\"\n :animated=\"props.progressProps.animated\"\n :precision=\"props.progressProps.precision\"\n :show-progress=\"props.progressProps.showProgress\"\n :show-value=\"props.progressProps.showValue\"\n :striped=\"props.progressProps.striped\"\n :variant=\"props.progressProps.variant\"\n :max=\"modelValue\"\n :value=\"remainingMs\"\n height=\"4px\"\n />\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, type EmitFn, useTemplateRef, watch, watchEffect} from 'vue'\nimport {useBLinkHelper} from '../../composables/useBLinkHelper'\nimport type {BAlertEmits, BAlertProps, BAlertSlots, ShowHideSlotsData} from '../../types'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BLink from '../BLink/BLink.vue'\nimport BProgress from '../BProgress/BProgress.vue'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\nimport {useId} from '../../composables/useId'\nimport {useShowHide} from '../../composables/useShowHide'\nimport BButton from '../BButton/BButton.vue'\n\nconst _props = withDefaults(defineProps<Omit<BAlertProps, 'modelValue'>>(), {\n bgVariant: null,\n body: undefined,\n bodyClass: undefined,\n closeClass: undefined,\n closeContent: undefined,\n closeLabel: 'Close',\n closeVariant: 'secondary',\n dismissible: false,\n headerClass: undefined,\n headerTag: 'div',\n id: undefined,\n initialAnimation: false,\n interval: 'requestAnimationFrame',\n isStatus: false,\n lazy: false,\n noFade: false,\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n progressProps: undefined,\n unmountLazy: false,\n showOnPause: true,\n show: false,\n solid: false,\n textVariant: null,\n title: undefined,\n alertClass: undefined,\n transProps: undefined,\n visible: false,\n // Link props\n // All others use defaults\n noRel: undefined,\n active: undefined,\n activeClass: undefined,\n disabled: undefined,\n exactActiveClass: undefined,\n href: undefined,\n icon: undefined,\n opacity: undefined,\n opacityHover: undefined,\n stretched: false,\n rel: undefined,\n replace: undefined,\n routerComponentName: undefined,\n target: undefined,\n to: undefined,\n underlineOffset: undefined,\n underlineOffsetHover: undefined,\n underlineOpacity: undefined,\n underlineOpacityHover: undefined,\n underlineVariant: undefined,\n // End link props\n variant: 'info',\n})\nconst props = useDefaults(_props, 'BAlert')\nconst emit = defineEmits<BAlertEmits>()\nconst slots = defineSlots<BAlertSlots>()\n\nconst element = useTemplateRef('_element')\n\nconst modelValue = defineModel<Exclude<BAlertProps['modelValue'], undefined>>({default: false})\nconst {computedLink, computedLinkProps} = useBLinkHelper(props)\n\nconst computedId = useId(() => props.id, 'alert')\n\nconst {\n showRef,\n renderRef,\n hide,\n toggle,\n show,\n buildTriggerableEvent,\n computedNoAnimation,\n isVisible,\n transitionProps,\n contentShowing,\n} = useShowHide({modelValue, props, emit: emit as EmitFn, element, id: computedId})\n\n// TODO solid is never used\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst {\n isActive,\n pause,\n restart,\n resume,\n stop,\n isPaused,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number' && !!modelValue.value,\n})\nuseCountdownHover(\n element,\n {\n noHoverPause: () => props.noHoverPause || typeof modelValue.value !== 'number',\n noResumeOnHoverLeave: () => props.noResumeOnHoverLeave || typeof modelValue.value !== 'number',\n modelValueIgnoresHover: () => typeof modelValue.value === 'boolean',\n },\n {pause, resume}\n)\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst computedTag = computed(() => (computedLink.value ? BLink : 'div'))\n\nconst isAlertVisible = computed(\n () => showRef.value || isActive.value || (props.showOnPause && isPaused.value)\n)\n\n// const colorClasses = useColorVariantClasses(props)\nconst computedClasses = computed(() => [\n // colorClasses.value,\n {\n [`alert-${props.variant}`]: props.variant !== null,\n 'alert-dismissible': props.dismissible && !(slots.close || props.closeContent),\n 'show': isVisible.value,\n 'fade': !computedNoAnimation.value,\n },\n])\n\nwatch(modelValue, (newValue) => {\n if (typeof newValue === 'number') {\n const event = buildTriggerableEvent('show', {cancelable: true, trigger: 'model'})\n emit('show', event)\n if (event.defaultPrevented) {\n emit('show-prevented', buildTriggerableEvent('show-prevented'))\n } else {\n restart()\n }\n }\n})\n\n// isActive in the composable will cause the alert to hide when the countdown is done\nwatch(isActive, (newValue) => {\n if (newValue === false && isPaused.value === false) {\n hide()\n modelValue.value = 0\n stop()\n }\n})\nconst sharedSlots = computed<ShowHideSlotsData>(() => ({\n toggle,\n show,\n hide,\n id: computedId.value,\n visible: showRef.value,\n active: isActive.value,\n}))\n\ndefineExpose({\n show,\n hide,\n toggle,\n pause,\n restart,\n resume,\n stop,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuKA,MAAM,QAAQ,YAAY,SAAQ,QAAQ;EAC1C,MAAM,OAAO;EACb,MAAM,QAAQ,SAAA;EAEd,MAAM,UAAU,eAAe,UAAU;EAEzC,MAAM,aAAa,SAA0D,SAAA,YAAiB;EAC9F,MAAM,EAAC,cAAc,sBAAqB,eAAe,KAAK;EAE9D,MAAM,aAAa,cAAY,MAAM,IAAI,OAAO;EAEhD,MAAM,EACJ,SACA,WACA,MACA,QACA,MACA,uBACA,qBACA,WACA,iBACA,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Ac;MACnC,cAAY,MAAA,KAAA,CAAK,CAAC,cAAc;MAChC,SAAS,MAAA,KAAA,CAAK,CAAC,cAAc;MAC7B,SAAS,MAAA,KAAA,CAAK,CAAC,cAAc;MAC7B,KAAK,WAAA;MACL,OAAO,MAAA,WAAA;MACR,QAAO;;;;;;;;;;;IAtFD,GAAA,IAAA,UAAA,GAAA,CAAA,CAAA,OAAA,eAAA,KAAc,CAAA,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"BAlert-Bl3TOay3.js","names":[],"sources":["../src/components/BAlert/BAlert.vue","../src/components/BAlert/BAlert.vue"],"sourcesContent":["<template>\n <Transition\n v-if=\"renderRef || contentShowing\"\n v-bind=\"transitionProps\"\n :appear=\"!!modelValue || props.visible\"\n >\n <div\n v-show=\"isAlertVisible\"\n :id=\"props.id\"\n ref=\"_element\"\n class=\"alert\"\n :class=\"[props.alertClass, computedClasses]\"\n tabindex=\"0\"\n :role=\"!isAlertVisible ? undefined : props.isStatus ? 'status' : 'alert'\"\n :aria-live=\"!isAlertVisible ? undefined : props.isStatus ? 'polite' : 'assertive'\"\n :aria-atomic=\"!isAlertVisible ? undefined : true\"\n >\n <component\n :is=\"props.headerTag\"\n v-if=\"contentShowing && (slots.title || props.title)\"\n class=\"alert-heading d-flex gap-2\"\n :class=\"props.headerClass\"\n >\n <slot name=\"title\" v-bind=\"sharedSlots\">\n <span>\n {{ props.title }}\n </span>\n </slot>\n <template v-if=\"props.dismissible\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto ps-1 btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </component>\n <template v-if=\"contentShowing && (slots.default || props.body)\">\n <div class=\"d-flex gap-2\">\n <component\n :is=\"computedTag\"\n class=\"alert-body\"\n :class=\"props.bodyClass\"\n v-bind=\"computedLinkProps\"\n @click=\"computedLink && props.dismissible ? hide() : () => {}\"\n >\n <slot v-bind=\"sharedSlots\">\n {{ props.body }}\n </slot>\n </component>\n\n <template v-if=\"props.dismissible && !(slots.title || props.title)\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </div>\n </template>\n <BProgress\n v-if=\"typeof modelValue === 'number' && props.progressProps !== undefined\"\n :animated=\"props.progressProps.animated\"\n :precision=\"props.progressProps.precision\"\n :show-progress=\"props.progressProps.showProgress\"\n :show-value=\"props.progressProps.showValue\"\n :striped=\"props.progressProps.striped\"\n :variant=\"props.progressProps.variant\"\n :max=\"modelValue\"\n :value=\"remainingMs\"\n height=\"4px\"\n />\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, type EmitFn, useTemplateRef, watch, watchEffect} from 'vue'\nimport {useBLinkHelper} from '../../composables/useBLinkHelper'\nimport type {BAlertEmits, BAlertProps, BAlertSlots, ShowHideSlotsData} from '../../types'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BLink from '../BLink/BLink.vue'\nimport BProgress from '../BProgress/BProgress.vue'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\nimport {useId} from '../../composables/useId'\nimport {useShowHide} from '../../composables/useShowHide'\nimport BButton from '../BButton/BButton.vue'\n\nconst _props = withDefaults(defineProps<Omit<BAlertProps, 'modelValue'>>(), {\n bgVariant: null,\n body: undefined,\n bodyClass: undefined,\n closeClass: undefined,\n closeContent: undefined,\n closeLabel: 'Close',\n closeVariant: 'secondary',\n dismissible: false,\n headerClass: undefined,\n headerTag: 'div',\n id: undefined,\n initialAnimation: false,\n interval: 'requestAnimationFrame',\n isStatus: false,\n lazy: false,\n noFade: false,\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n progressProps: undefined,\n unmountLazy: false,\n showOnPause: true,\n show: false,\n solid: false,\n textVariant: null,\n title: undefined,\n alertClass: undefined,\n transProps: undefined,\n visible: false,\n // Link props\n // All others use defaults\n noRel: undefined,\n active: undefined,\n activeClass: undefined,\n disabled: undefined,\n exactActiveClass: undefined,\n href: undefined,\n icon: undefined,\n opacity: undefined,\n opacityHover: undefined,\n stretched: false,\n rel: undefined,\n replace: undefined,\n routerComponentName: undefined,\n target: undefined,\n to: undefined,\n underlineOffset: undefined,\n underlineOffsetHover: undefined,\n underlineOpacity: undefined,\n underlineOpacityHover: undefined,\n underlineVariant: undefined,\n // End link props\n variant: 'info',\n})\nconst props = useDefaults(_props, 'BAlert')\nconst emit = defineEmits<BAlertEmits>()\nconst slots = defineSlots<BAlertSlots>()\n\nconst element = useTemplateRef('_element')\n\nconst modelValue = defineModel<Exclude<BAlertProps['modelValue'], undefined>>({default: false})\nconst {computedLink, computedLinkProps} = useBLinkHelper(props)\n\nconst computedId = useId(() => props.id, 'alert')\n\nconst {\n showRef,\n renderRef,\n hide,\n toggle,\n show,\n buildTriggerableEvent,\n computedNoAnimation,\n isVisible,\n transitionProps,\n contentShowing,\n} = useShowHide({modelValue, props, emit: emit as EmitFn, element, id: computedId})\n\n// TODO solid is never used\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst {\n isActive,\n pause,\n restart,\n resume,\n stop,\n isPaused,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number' && !!modelValue.value,\n})\nuseCountdownHover(\n element,\n {\n noHoverPause: () => props.noHoverPause || typeof modelValue.value !== 'number',\n noResumeOnHoverLeave: () => props.noResumeOnHoverLeave || typeof modelValue.value !== 'number',\n modelValueIgnoresHover: () => typeof modelValue.value === 'boolean',\n },\n {pause, resume}\n)\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst computedTag = computed(() => (computedLink.value ? BLink : 'div'))\n\nconst isAlertVisible = computed(\n () => showRef.value || isActive.value || (props.showOnPause && isPaused.value)\n)\n\n// const colorClasses = useColorVariantClasses(props)\nconst computedClasses = computed(() => [\n // colorClasses.value,\n {\n [`alert-${props.variant}`]: props.variant !== null,\n 'alert-dismissible': props.dismissible && !(slots.close || props.closeContent),\n 'show': isVisible.value,\n 'fade': !computedNoAnimation.value,\n },\n])\n\nwatch(modelValue, (newValue) => {\n if (typeof newValue === 'number') {\n const event = buildTriggerableEvent('show', {cancelable: true, trigger: 'model'})\n emit('show', event)\n if (event.defaultPrevented) {\n emit('show-prevented', buildTriggerableEvent('show-prevented'))\n } else {\n restart()\n }\n }\n})\n\n// isActive in the composable will cause the alert to hide when the countdown is done\nwatch(isActive, (newValue) => {\n if (newValue === false && isPaused.value === false) {\n hide()\n modelValue.value = 0\n stop()\n }\n})\nconst sharedSlots = computed<ShowHideSlotsData>(() => ({\n toggle,\n show,\n hide,\n id: computedId.value,\n visible: showRef.value,\n active: isActive.value,\n}))\n\ndefineExpose({\n show,\n hide,\n toggle,\n pause,\n restart,\n resume,\n stop,\n})\n</script>\n","<template>\n <Transition\n v-if=\"renderRef || contentShowing\"\n v-bind=\"transitionProps\"\n :appear=\"!!modelValue || props.visible\"\n >\n <div\n v-show=\"isAlertVisible\"\n :id=\"props.id\"\n ref=\"_element\"\n class=\"alert\"\n :class=\"[props.alertClass, computedClasses]\"\n tabindex=\"0\"\n :role=\"!isAlertVisible ? undefined : props.isStatus ? 'status' : 'alert'\"\n :aria-live=\"!isAlertVisible ? undefined : props.isStatus ? 'polite' : 'assertive'\"\n :aria-atomic=\"!isAlertVisible ? undefined : true\"\n >\n <component\n :is=\"props.headerTag\"\n v-if=\"contentShowing && (slots.title || props.title)\"\n class=\"alert-heading d-flex gap-2\"\n :class=\"props.headerClass\"\n >\n <slot name=\"title\" v-bind=\"sharedSlots\">\n <span>\n {{ props.title }}\n </span>\n </slot>\n <template v-if=\"props.dismissible\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto ps-1 btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </component>\n <template v-if=\"contentShowing && (slots.default || props.body)\">\n <div class=\"d-flex gap-2\">\n <component\n :is=\"computedTag\"\n class=\"alert-body\"\n :class=\"props.bodyClass\"\n v-bind=\"computedLinkProps\"\n @click=\"computedLink && props.dismissible ? hide() : () => {}\"\n >\n <slot v-bind=\"sharedSlots\">\n {{ props.body }}\n </slot>\n </component>\n\n <template v-if=\"props.dismissible && !(slots.title || props.title)\">\n <BButton\n v-if=\"slots.close || props.closeContent\"\n :class=\"[props.closeClass]\"\n class=\"ms-auto btn-close-custom\"\n :variant=\"props.closeVariant\"\n @click.stop.prevent=\"hide('close')\"\n >\n <slot name=\"close\" v-bind=\"sharedSlots\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton\n v-else\n :aria-label=\"props.closeLabel\"\n :class=\"[props.closeClass]\"\n @click.stop.prevent=\"hide('close')\"\n />\n </template>\n </div>\n </template>\n <BProgress\n v-if=\"typeof modelValue === 'number' && props.progressProps !== undefined\"\n :animated=\"props.progressProps.animated\"\n :precision=\"props.progressProps.precision\"\n :show-progress=\"props.progressProps.showProgress\"\n :show-value=\"props.progressProps.showValue\"\n :striped=\"props.progressProps.striped\"\n :variant=\"props.progressProps.variant\"\n :max=\"modelValue\"\n :value=\"remainingMs\"\n height=\"4px\"\n />\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, type EmitFn, useTemplateRef, watch, watchEffect} from 'vue'\nimport {useBLinkHelper} from '../../composables/useBLinkHelper'\nimport type {BAlertEmits, BAlertProps, BAlertSlots, ShowHideSlotsData} from '../../types'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BLink from '../BLink/BLink.vue'\nimport BProgress from '../BProgress/BProgress.vue'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\nimport {useId} from '../../composables/useId'\nimport {useShowHide} from '../../composables/useShowHide'\nimport BButton from '../BButton/BButton.vue'\n\nconst _props = withDefaults(defineProps<Omit<BAlertProps, 'modelValue'>>(), {\n bgVariant: null,\n body: undefined,\n bodyClass: undefined,\n closeClass: undefined,\n closeContent: undefined,\n closeLabel: 'Close',\n closeVariant: 'secondary',\n dismissible: false,\n headerClass: undefined,\n headerTag: 'div',\n id: undefined,\n initialAnimation: false,\n interval: 'requestAnimationFrame',\n isStatus: false,\n lazy: false,\n noFade: false,\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n progressProps: undefined,\n unmountLazy: false,\n showOnPause: true,\n show: false,\n solid: false,\n textVariant: null,\n title: undefined,\n alertClass: undefined,\n transProps: undefined,\n visible: false,\n // Link props\n // All others use defaults\n noRel: undefined,\n active: undefined,\n activeClass: undefined,\n disabled: undefined,\n exactActiveClass: undefined,\n href: undefined,\n icon: undefined,\n opacity: undefined,\n opacityHover: undefined,\n stretched: false,\n rel: undefined,\n replace: undefined,\n routerComponentName: undefined,\n target: undefined,\n to: undefined,\n underlineOffset: undefined,\n underlineOffsetHover: undefined,\n underlineOpacity: undefined,\n underlineOpacityHover: undefined,\n underlineVariant: undefined,\n // End link props\n variant: 'info',\n})\nconst props = useDefaults(_props, 'BAlert')\nconst emit = defineEmits<BAlertEmits>()\nconst slots = defineSlots<BAlertSlots>()\n\nconst element = useTemplateRef('_element')\n\nconst modelValue = defineModel<Exclude<BAlertProps['modelValue'], undefined>>({default: false})\nconst {computedLink, computedLinkProps} = useBLinkHelper(props)\n\nconst computedId = useId(() => props.id, 'alert')\n\nconst {\n showRef,\n renderRef,\n hide,\n toggle,\n show,\n buildTriggerableEvent,\n computedNoAnimation,\n isVisible,\n transitionProps,\n contentShowing,\n} = useShowHide({modelValue, props, emit: emit as EmitFn, element, id: computedId})\n\n// TODO solid is never used\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst {\n isActive,\n pause,\n restart,\n resume,\n stop,\n isPaused,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number' && !!modelValue.value,\n})\nuseCountdownHover(\n element,\n {\n noHoverPause: () => props.noHoverPause || typeof modelValue.value !== 'number',\n noResumeOnHoverLeave: () => props.noResumeOnHoverLeave || typeof modelValue.value !== 'number',\n modelValueIgnoresHover: () => typeof modelValue.value === 'boolean',\n },\n {pause, resume}\n)\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst computedTag = computed(() => (computedLink.value ? BLink : 'div'))\n\nconst isAlertVisible = computed(\n () => showRef.value || isActive.value || (props.showOnPause && isPaused.value)\n)\n\n// const colorClasses = useColorVariantClasses(props)\nconst computedClasses = computed(() => [\n // colorClasses.value,\n {\n [`alert-${props.variant}`]: props.variant !== null,\n 'alert-dismissible': props.dismissible && !(slots.close || props.closeContent),\n 'show': isVisible.value,\n 'fade': !computedNoAnimation.value,\n },\n])\n\nwatch(modelValue, (newValue) => {\n if (typeof newValue === 'number') {\n const event = buildTriggerableEvent('show', {cancelable: true, trigger: 'model'})\n emit('show', event)\n if (event.defaultPrevented) {\n emit('show-prevented', buildTriggerableEvent('show-prevented'))\n } else {\n restart()\n }\n }\n})\n\n// isActive in the composable will cause the alert to hide when the countdown is done\nwatch(isActive, (newValue) => {\n if (newValue === false && isPaused.value === false) {\n hide()\n modelValue.value = 0\n stop()\n }\n})\nconst sharedSlots = computed<ShowHideSlotsData>(() => ({\n toggle,\n show,\n hide,\n id: computedId.value,\n visible: showRef.value,\n active: isActive.value,\n}))\n\ndefineExpose({\n show,\n hide,\n toggle,\n pause,\n restart,\n resume,\n stop,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuKA,MAAM,QAAQ,YAAY,SAAQ,QAAQ;EAC1C,MAAM,OAAO;EACb,MAAM,QAAQ,SAAA;EAEd,MAAM,UAAU,eAAe,UAAU;EAEzC,MAAM,aAAa,SAA0D,SAAA,YAAiB;EAC9F,MAAM,EAAC,cAAc,sBAAqB,eAAe,KAAK;EAE9D,MAAM,aAAa,cAAY,MAAM,IAAI,OAAO;EAEhD,MAAM,EACJ,SACA,WACA,MACA,QACA,MACA,uBACA,qBACA,WACA,iBACA,mBACE,YAAY;GAAC;GAAY;GAAa;GAAgB;GAAS,IAAI;EAAU,CAAC;EAGlF,MAAM,kBAAkB,eACtB,OAAO,WAAW,UAAU,YAAY,IAAI,WAAW,KACzD;EAEA,MAAM,EACJ,UACA,OACA,SACA,QACA,MACA,UACA,OAAO,gBACL,aAAa,iBAAiB,MAAM,UAAU,EAChD,WAAW,OAAO,WAAW,UAAU,YAAY,CAAC,CAAC,WAAW,MAClE,CAAC;EACD,kBACE,SACA;GACE,oBAAoB,MAAM,gBAAgB,OAAO,WAAW,UAAU;GACtE,4BAA4B,MAAM,wBAAwB,OAAO,WAAW,UAAU;GACtF,8BAA8B,OAAO,WAAW,UAAU;EAC5D,GACA;GAA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IntervalFn } from "./dist-DKc2ivHS.js";
|
|
3
4
|
import { a as onKeyStroke, b as useSwipe, d as useElementHover } from "./dist-9-XTMhb-.js";
|
|
4
5
|
import { o as isEmptySlot } from "./dom-BdUQrX99.js";
|
|
5
6
|
import { t as useDefaults } from "./useDefaults-BzP4qZBu.js";
|
|
6
7
|
import { t as useId$1 } from "./useId-Fh-Arhb7.js";
|
|
7
|
-
import { t as BvCarouselEvent } from "./classes-BEWWGbj5.js";
|
|
8
8
|
import { t as BImg_default } from "./BImg-knz2UZQE.js";
|
|
9
9
|
import { Fragment, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, mergeModels, normalizeClass, normalizeProps, normalizeStyle, onMounted, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toRef, unref, useModel, useSlots, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
|
|
10
10
|
//#region src/utils/getSlotElements.ts
|
|
@@ -413,4 +413,4 @@ var BCarouselSlide_default = /* @__PURE__ */ defineComponent({
|
|
|
413
413
|
//#endregion
|
|
414
414
|
export { BCarousel_default as n, BCarouselSlide_default as t };
|
|
415
415
|
|
|
416
|
-
//# sourceMappingURL=BCarousel-
|
|
416
|
+
//# sourceMappingURL=BCarousel-BV2EiQRM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BCarousel-DQgfW4DN.js","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 {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 {BCarouselSlideProps, BCarouselSlideSlots} from '../../types'\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 {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 {BCarouselSlideProps, BCarouselSlideSlots} from '../../types'\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,OAAO,KAAK,CAAC,EAAA,CACX,QAAQ,KAAc,SAAgB;CACrC,IAAI,OAAO,KAAK,SAAS,UACvB,MAAM,IAAI,OAAO,KAAK,QAA4B;MAElD,IAAI,KAAK,IAAI;CAEf,OAAO;AACT,GAAG,CAAC,CAAC,CAAC,CACL,QAAQ,UAAW,MAAM,MAAuC,WAAW,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EC6ExF,MAAM,QAAQ,YAAY,SAAQ,WAAW;EAC7C,MAAM,OAAO;EACb,MAAM,QAAQ,SAAA;EAEd,MAAM,aAAa,cAAY,MAAM,IAAI,UAAU;EACnD,MAAM,kBAAkB,QAAM,KAAA,GAAW,2BAA2B;EAEpE,MAAM,aAAa,SAA6D,SAAA,YAAa;EAE7F,MAAM,cAAc,eAAsD,cAAc;EAExF,MAAM,uBAAuB,kBAAkB,MAAM,cAAc;EACnE,MAAM,gBAAgB,IAAsB,IAAI;EAChD,gBAAgB;GACd,cAAc,QACZ,YAAY,OAAO,MAAM,SAAS,KAAK,IAAI,MAAM,YAAY,MAAM,CAAC,EAAE,aAAa;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}
|
|
1
|
+
{"version":3,"file":"BCarousel-BV2EiQRM.js","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 {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 {BCarouselSlideProps, BCarouselSlideSlots} from '../../types'\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 {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 {BCarouselSlideProps, BCarouselSlideSlots} from '../../types'\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,OAAO,KAAK,CAAC,EAAA,CACX,QAAQ,KAAc,SAAgB;CACrC,IAAI,OAAO,KAAK,SAAS,UACvB,MAAM,IAAI,OAAO,KAAK,QAA4B;MAElD,IAAI,KAAK,IAAI;CAEf,OAAO;AACT,GAAG,CAAC,CAAC,CAAC,CACL,QAAQ,UAAW,MAAM,MAAuC,WAAW,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EC6ExF,MAAM,QAAQ,YAAY,SAAQ,WA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AA,MAAA,gBAAvB,MAAA,KAAA,CAAK,CAAC,OAAO,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;KAGW,QAAA,SAArC,UAAA,GAAA,YAIY,wBAJI,MAAA,KAAA,CAAK,CAAC,OAAO,GAAA,EAAA,KAAA,EAAA,GAAA;MAC3B,SAAA,cAEO,CAFP,WAEO,KAAA,QAAA,QAAA,CAAA,SAAA,CADL,mBAA6B,QAAA,MAAA,gBAApB,MAAA,KAAA,CAAK,CAAC,IAAI,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;KAGvB,WAAQ,KAAA,QAAA,SAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as collapseInjectionKey } from "./keys-BgLwJbLV.js";
|
|
2
2
|
import { t as useDefaults } from "./useDefaults-BzP4qZBu.js";
|
|
3
3
|
import { t as useId$1 } from "./useId-Fh-Arhb7.js";
|
|
4
|
-
import { t as useShowHide } from "./useShowHide-
|
|
4
|
+
import { t as useShowHide } from "./useShowHide-B6RQbFDt.js";
|
|
5
5
|
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, openBlock, provide, readonly, renderSlot, resolveDynamicComponent, toRef, unref, useModel, useTemplateRef, vShow, withCtx, withDirectives } from "vue";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/BCollapse/BCollapse.vue
|
|
@@ -180,4 +180,4 @@ var BCollapse_default = /* @__PURE__ */ defineComponent({
|
|
|
180
180
|
//#endregion
|
|
181
181
|
export { BCollapse_default as t };
|
|
182
182
|
|
|
183
|
-
//# sourceMappingURL=BCollapse-
|
|
183
|
+
//# sourceMappingURL=BCollapse-B2q9Ya2S.js.map
|