bootstrap-vue-next 1.2.3 → 1.2.4

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.
Files changed (73) hide show
  1. package/dist/{BAccordion-nQptHiXD.js → BAccordion-ByAMZCS9.js} +2 -2
  2. package/dist/{BAccordion-nQptHiXD.js.map → BAccordion-ByAMZCS9.js.map} +1 -1
  3. package/dist/{BAlert-Bl3TOay3.js → BAlert-DdfFcjWF.js} +2 -2
  4. package/dist/{BAlert-Bl3TOay3.js.map → BAlert-DdfFcjWF.js.map} +1 -1
  5. package/dist/{BApp-Bg5xEz8H.js → BApp-DZ9AITOm.js} +22 -3
  6. package/dist/BApp-DZ9AITOm.js.map +1 -0
  7. package/dist/{BCarousel-BV2EiQRM.js → BCarousel-qHGRSVFe.js} +2 -2
  8. package/dist/{BCarousel-BV2EiQRM.js.map → BCarousel-qHGRSVFe.js.map} +1 -1
  9. package/dist/{BCollapse-B2q9Ya2S.js → BCollapse-DtuJwN7B.js} +2 -2
  10. package/dist/{BCollapse-B2q9Ya2S.js.map → BCollapse-DtuJwN7B.js.map} +1 -1
  11. package/dist/{BDropdown-D4gLdtmX.js → BDropdown-BY-E0SHv.js} +3 -3
  12. package/dist/{BDropdown-D4gLdtmX.js.map → BDropdown-BY-E0SHv.js.map} +1 -1
  13. package/dist/{BModal-BjmeVZen.js → BModal-DtQlIFNn.js} +2 -2
  14. package/dist/{BModal-BjmeVZen.js.map → BModal-DtQlIFNn.js.map} +1 -1
  15. package/dist/{BNav-B2PlMEMD.js → BNav-BMWNXoNo.js} +2 -2
  16. package/dist/{BNav-B2PlMEMD.js.map → BNav-BMWNXoNo.js.map} +1 -1
  17. package/dist/{BOffcanvas-DfR32-ZP.js → BOffcanvas-BtvIDgH7.js} +2 -2
  18. package/dist/{BOffcanvas-DfR32-ZP.js.map → BOffcanvas-BtvIDgH7.js.map} +1 -1
  19. package/dist/{BPagination-CfrsVgDp.js → BPagination-C85wHRgS.js} +2 -2
  20. package/dist/{BPagination-CfrsVgDp.js.map → BPagination-C85wHRgS.js.map} +1 -1
  21. package/dist/{BTabs-Zp8CvCL_.js → BTabs-Cfe8HOGE.js} +2 -2
  22. package/dist/{BTabs-Zp8CvCL_.js.map → BTabs-Cfe8HOGE.js.map} +1 -1
  23. package/dist/{BToast-CqE2VMW2.js → BToast-Cm7TZlZq.js} +2 -2
  24. package/dist/{BToast-CqE2VMW2.js.map → BToast-Cm7TZlZq.js.map} +1 -1
  25. package/dist/{BTooltip-BHFBLXnr.js → BTooltip-CAgQ77tS.js} +5 -11
  26. package/dist/BTooltip-CAgQ77tS.js.map +1 -0
  27. package/dist/bootstrap-vue-next.mjs +15 -15
  28. package/dist/{classes-BEWWGbj5.js → classes-DCjKFM2E.js} +12 -2
  29. package/dist/classes-DCjKFM2E.js.map +1 -0
  30. package/dist/components/BTooltip/BTooltip.vue.d.mts +3 -3
  31. package/dist/components/BTooltip/BTooltip.vue.d.ts +3 -3
  32. package/dist/composables/usePopover/index.d.mts +9 -9
  33. package/dist/composables/usePopover/index.d.ts +9 -9
  34. package/dist/{floatingUi-Stb1SUvw.js → floatingUi-CSJCHfOw.js} +2 -2
  35. package/dist/{floatingUi-Stb1SUvw.js.map → floatingUi-CSJCHfOw.js.map} +1 -1
  36. package/dist/src/components/BAccordion/index.mjs +1 -1
  37. package/dist/src/components/BAlert/index.mjs +1 -1
  38. package/dist/src/components/BApp/index.mjs +1 -1
  39. package/dist/src/components/BCarousel/index.mjs +1 -1
  40. package/dist/src/components/BCollapse/index.mjs +1 -1
  41. package/dist/src/components/BDropdown/index.mjs +1 -1
  42. package/dist/src/components/BModal/index.mjs +1 -1
  43. package/dist/src/components/BNav/index.mjs +1 -1
  44. package/dist/src/components/BOffcanvas/index.mjs +1 -1
  45. package/dist/src/components/BPagination/index.mjs +1 -1
  46. package/dist/src/components/BPopover/index.mjs +1 -1
  47. package/dist/src/components/BTabs/index.mjs +1 -1
  48. package/dist/src/components/BToast/index.mjs +1 -1
  49. package/dist/src/components/BTooltip/index.mjs +1 -1
  50. package/dist/src/components/index.mjs +14 -14
  51. package/dist/src/composables/orchestratorShared/index.mjs +145 -27
  52. package/dist/src/composables/orchestratorShared/index.mjs.map +1 -1
  53. package/dist/src/composables/useModal/index.mjs +1 -1
  54. package/dist/src/composables/usePopover/index.mjs +2 -2
  55. package/dist/src/composables/useToast/index.mjs +1 -1
  56. package/dist/src/directives/BPopover/index.mjs +2 -2
  57. package/dist/src/directives/BScrollspy/index.mjs +1 -1
  58. package/dist/src/directives/BToggle/index.mjs +1 -1
  59. package/dist/src/directives/BTooltip/index.mjs +2 -2
  60. package/dist/src/utils/index.mjs +1 -1
  61. package/dist/types/ComponentOrchestratorTypes.d.mts +8 -1
  62. package/dist/types/ComponentOrchestratorTypes.d.ts +8 -1
  63. package/dist/{useShowHide-B6RQbFDt.js → useShowHide-Dpld86ys.js} +124 -54
  64. package/dist/useShowHide-Dpld86ys.js.map +1 -0
  65. package/dist/utils/classes.d.mts +10 -0
  66. package/dist/utils/classes.d.ts +10 -0
  67. package/dist/{utils-CK56zzsO.js → utils-DYdkCKBf.js} +2 -2
  68. package/dist/{utils-CK56zzsO.js.map → utils-DYdkCKBf.js.map} +1 -1
  69. package/package.json +1 -1
  70. package/dist/BApp-Bg5xEz8H.js.map +0 -1
  71. package/dist/BTooltip-BHFBLXnr.js.map +0 -1
  72. package/dist/classes-BEWWGbj5.js.map +0 -1
  73. package/dist/useShowHide-B6RQbFDt.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BPagination-CfrsVgDp.js","names":[],"sources":["../src/components/BPagination/BPagination.vue","../src/components/BPagination/BPagination.vue"],"sourcesContent":["<template>\n <ul\n class=\"pagination\"\n :class=\"computedWrapperClasses\"\n role=\"menubar\"\n :aria-disabled=\"props.disabled\"\n :aria-label=\"props.ariaLabel || undefined\"\n @keydown=\"handleKeyNav\"\n >\n <li\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page.id}`\"\n v-bind=\"page.li\"\n ref=\"_pageElements\"\n :[dataDisplayNameCustomAttribute]=\"index\"\n >\n <span\n v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n v-bind=\"ellipsisProps.span\"\n >\n <slot name=\"ellipsis-text\">\n {{ props.ellipsisText || '...' }}\n </slot>\n </span>\n <component\n v-bind=\"page.button\"\n :is=\"page.button.is\"\n v-else-if=\"'button' in page\"\n @click=\"page.clickHandler\"\n >\n <slot\n :name=\"page.text.name\"\n :disabled=\"page.text.disabled\"\n :page=\"page.text.page\"\n :index=\"page.text.index\"\n :active=\"page.text.active ?? false\"\n :content=\"page.text.value\"\n >\n {{ page.text.value }}\n </slot>\n </component>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, nextTick, useTemplateRef, watch} from 'vue'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\nimport {CODE_DOWN, CODE_LEFT, CODE_RIGHT, CODE_UP} from '../../utils/constants'\nimport {getActiveElement} from '../../utils/dom'\nimport {type BPaginationEmits, type BPaginationProps, type BPaginationSlots} from '../../types'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\nconst dataDisplayNameCustomAttribute = 'data-display-name'\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n align: 'start',\n ariaControls: undefined,\n ariaLabel: 'Pagination',\n disabled: false,\n ellipsisClass: undefined,\n ellipsisText: '\\u2026',\n firstClass: undefined,\n firstNumber: false,\n firstText: '\\u00AB',\n noEllipsis: false,\n noGotoEndButtons: false,\n labelFirstPage: 'Go to first page',\n labelLastPage: 'Go to last page',\n labelNextPage: 'Go to next page',\n labelPage: 'Go to page',\n labelPrevPage: 'Go to previous page',\n lastClass: undefined,\n lastNumber: false,\n lastText: '\\u00BB',\n limit: 5,\n nextClass: undefined,\n nextText: '\\u203A',\n pageClass: undefined,\n perPage: DEFAULT_PER_PAGE,\n pills: false,\n prevClass: undefined,\n prevText: '\\u2039',\n size: undefined,\n totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\nconst emit = defineEmits<BPaginationEmits>()\ndefineSlots<BPaginationSlots>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({\n default: 1,\n})\n\nconst pageElements = useTemplateRef('_pageElements')\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === computedModelValue.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n props.disabled ||\n isActivePage(num) ||\n computedModelValue.value < 1 ||\n // Check if the number is out of bounds\n num < 1 ||\n num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(computedModelValue.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(computedModelValue.value + 1))\n\nconst getBaseButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n tabIndex,\n label,\n position,\n isActive,\n hidden,\n isSmHidden,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n tabIndex?: string\n label?: string\n position?: number\n isActive?: boolean\n hidden?: boolean\n isSmHidden?: boolean\n}) => ({\n li: {\n 'class': [\n 'page-item',\n {\n 'active': isActive,\n disabled,\n 'bv-d-sm-down-none': isSmHidden,\n 'flex-fill': computedFill.value,\n 'd-flex': computedFill.value && !disabled,\n },\n classVal,\n ],\n 'role': 'presentation',\n 'aria-hidden': hidden,\n },\n button: {\n 'is': disabled ? 'span' : 'button',\n 'class': ['page-link', 'text-center', {'flex-grow-1': !disabled && computedFill.value}],\n 'aria-label': label,\n 'aria-controls': props.ariaControls || undefined,\n 'aria-disabled': disabled ? true : undefined,\n 'aria-posinset': position,\n 'aria-setsize': position ? numberOfPages.value : undefined,\n 'role': 'menuitem',\n 'type': disabled ? undefined : 'button',\n 'tabindex': disabled ? undefined : tabIndex,\n },\n text: {\n name: slotName,\n active: isActive,\n value: textValue ?? page,\n page,\n disabled,\n index: page - 1,\n content: textValue ? undefined : String(page),\n },\n clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n label,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n label: string\n}) => getBaseButtonProps({page, classVal, disabled, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n getBaseButtonProps({\n page,\n disabled: props.disabled,\n classVal: props.pageClass,\n slotName: 'page',\n label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n tabIndex: getTabIndex(page) ?? undefined,\n position: page,\n isActive: isActivePage(page),\n isSmHidden,\n })\n\nconst firstButtonProps = computed(() =>\n getButtonProps({\n page: 1,\n disabled: firstDisabled.value,\n classVal: props.firstClass,\n slotName: 'first-text',\n textValue: props.firstText,\n label: props.labelFirstPage,\n })\n)\nconst prevButtonProps = computed(() =>\n getButtonProps({\n page: Math.max(computedModelValue.value - 1, 1),\n disabled: prevDisabled.value,\n classVal: props.prevClass,\n slotName: 'prev-text',\n textValue: props.prevText,\n label: props.labelPrevPage,\n })\n)\nconst nextButtonProps = computed(() =>\n getButtonProps({\n page: Math.min(computedModelValue.value + 1, numberOfPages.value),\n disabled: nextDisabled.value,\n classVal: props.nextClass,\n slotName: 'next-text',\n textValue: props.nextText,\n label: props.labelNextPage,\n })\n)\nconst lastButtonProps = computed(() =>\n getButtonProps({\n page: numberOfPages.value,\n disabled: lastDisabled.value,\n classVal: props.lastClass,\n slotName: 'last-text',\n textValue: props.lastText,\n label: props.labelLastPage,\n })\n)\n\nconst ellipsisProps = computed(() => ({\n li: {\n class: [\n 'page-item',\n 'disabled',\n 'text-center',\n 'bv-d-sm-down-none',\n computedFill.value ? 'flex-fill' : '',\n props.ellipsisClass,\n ],\n role: 'separator',\n },\n span: {\n class: ['page-link'],\n },\n}))\n\nconst computedWrapperClasses = computed(() => [\n alignment.value,\n {\n [`pagination-${props.size}`]: props.size !== undefined,\n 'b-pagination-pills': props.pills,\n },\n])\n\nconst pagination = computed(() => ({\n pageSize: perPageSanitized.value,\n totalRows: totalRowsNumber.value,\n numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n if (pageNumber === computedModelValue.value) return\n const clickEvent = new BvEvent('page-click', {\n cancelable: true,\n target: event.target,\n })\n emit('page-click', clickEvent, pageNumber)\n\n if (clickEvent.defaultPrevented) return\n\n modelValue.value = pageNumber\n\n nextTick(() => {\n if (pageNumber === 1) {\n focusFirst()\n } else if (pageNumber === pagination.value.numberOfPages) {\n focusLast()\n }\n })\n // nextTick(() => {\n // if (isVisible(target) && un_element.contains(target)) {\n // attemptFocus(target)\n //} else {\n //this.focusCurrent()\n //}\n // })\n}\n\nconst isDisabled = (el: HTMLButtonElement) => {\n const isElement = el && el.nodeType === Node.ELEMENT_NODE\n const hasAttr = isElement ? el.hasAttribute('disabled') : null\n const hasClass = isElement && el.classList ? el.classList.contains('disabled') : false\n\n return !isElement || el.disabled || hasAttr || hasClass\n}\n\nconst getButtons = (): HTMLButtonElement[] =>\n [...(pageElements.value ?? [])]\n .sort(\n (a, b) =>\n Number.parseInt(a.getAttribute(dataDisplayNameCustomAttribute) || '0') -\n Number.parseInt(b.getAttribute(dataDisplayNameCustomAttribute) || '0')\n )\n .map((page) => page.children[0])\n .filter((el) => {\n if (el?.getAttribute('display') === 'none' || el?.tagName.toUpperCase() !== 'BUTTON') {\n return false\n }\n\n const bcr = el?.getBoundingClientRect()\n\n return !!(bcr && bcr.height > 0 && bcr.width > 0)\n })\n .map((el) => el as HTMLButtonElement)\n\nconst focusFirst = () => {\n nextTick(() => {\n const btn = getButtons().find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusPrev = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n\n const button = buttons[index - 1]\n if (index > 0 && button !== undefined && !isDisabled(button)) {\n buttons[index - 1]?.focus()\n }\n })\n}\n\nconst focusLast = () => {\n nextTick(() => {\n const btn = getButtons()\n .reverse()\n .find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusNext = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n const button = buttons[index + 1]\n if (index < buttons.length - 1 && button !== undefined && !isDisabled(button)) {\n buttons[index + 1]?.focus()\n }\n })\n}\n\nconst handleKeyNav = (event: KeyboardEvent) => {\n const {code, shiftKey} = event\n if (code === CODE_LEFT || code === CODE_UP) {\n event.preventDefault()\n if (shiftKey) {\n focusFirst()\n } else {\n focusPrev()\n }\n } else if (code === CODE_RIGHT || code === CODE_DOWN) {\n event.preventDefault()\n if (shiftKey) {\n focusLast()\n } else {\n focusNext()\n }\n }\n}\n\nconst computedModelValue = computed(() => {\n const page = modelValueNumber.value || 1\n return page > numberOfPages.value ? numberOfPages.value : page < 1 ? 1 : page\n})\n\nwatch(pagination, (oldValue, newValue) => {\n if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n // If the page size changes, reset to page 1\n modelValue.value = 1\n }\n})\n\nconst noFirstButton = computed(() => (props.noGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst noLastButton = computed(() => (props.noGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (noFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (noLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n const {value} = computedModelValue\n\n const els = elements.value.map((p) => {\n switch (p) {\n case FIRST_BUTTON:\n return {id: p, ...firstButtonProps.value}\n case PREV_BUTTON:\n return {id: p, ...prevButtonProps.value}\n case NEXT_BUTTON:\n return {id: p, ...nextButtonProps.value}\n case LAST_BUTTON:\n return {id: p, ...lastButtonProps.value}\n case FIRST_ELLIPSIS:\n case LAST_ELLIPSIS:\n return {id: p, ...ellipsisProps.value}\n default:\n return {id: p, ...getPageButtonProps(p)}\n }\n })\n\n if (numberOfPages.value > 3) {\n if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n const idx = 2 + showFirstButton.value\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n\n if (value <= halfLimit.value + firstPage.value) {\n const idx = els.length - (3 + showLastButton.value)\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n }\n\n return els\n})\n\nconst elements = computed(() => {\n // The idea here is to create an array of all the buttons on the page control.\n // This way we can keep the invariants in one place and the template code just\n // iterates over the array.\n\n const pages = numberOfPages.value\n const {value} = computedModelValue\n const limit = limitNumber.value\n const noEllipsis = props.noEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n // The first case is when all the page buttons fit on the control, this is\n // the simplest case and the only one that will create an array smaller than\n // Limit + 4 - noEndButtons * 2 (the [first, last,] prev, next buttons)\n\n if (pages < limit + firstPage.value + lastPage.value) {\n return [\n !firstPage.value && !noFirstButton.value ? FIRST_BUTTON : null,\n PREV_BUTTON,\n ...Array.from({length: pages}, (_, index) => index + 1),\n NEXT_BUTTON,\n !lastPage.value && !noLastButton.value ? LAST_BUTTON : null,\n ].filter((x) => x !== null) as number[]\n }\n\n // All the remaining cases result in an array that is exactly limit + 4 - noEndButtons * 2 in length, so create\n // the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n const buttons = Array.from({length: limit + 4 - (noFirstButton.value + noLastButton.value)})\n if (!noFirstButton.value) {\n if (!firstPage.value) {\n buttons[0] = FIRST_BUTTON\n buttons[1] = PREV_BUTTON\n } else {\n buttons[0] = PREV_BUTTON\n buttons[1] = 1\n }\n } else {\n buttons[0] = PREV_BUTTON\n }\n\n if (!noLastButton.value) {\n if (!lastPage.value) {\n buttons[buttons.length - 1] = LAST_BUTTON\n buttons[buttons.length - 2] = NEXT_BUTTON\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n buttons[buttons.length - 2] = pages\n }\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n }\n\n // The next case is where the page buttons start at the beginning, with\n // no ellipsis at the beginning, but one at the end\n\n if (value <= halfLimit.value + firstPage.value) {\n for (let index = 1; index <= limit; index++) {\n buttons[index + 1 - noFirstButton.value] = index + firstPage.value\n }\n\n if (!noEllipsis) {\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n // And then we have the case where the page buttons go up to the end, with no\n // ellipsis at the end, but one at the beginning\n\n if (value > pages - halfLimit.value - lastPage.value) {\n const start = pages - (limit - 1) - lastPage.value\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n }\n }\n\n // Finally we have the case where we have ellipsis at both ends\n if (!buttons[2]) {\n // Is there a more elegant way to check that we're in the final case?\n const start = value - Math.floor(limit / 2)\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n //Enable sanity check for debugging purposes\n // for (let i = 0; i < buttons.length; i++) {\n // if (!buttons[i]) {\n // // eslint-disable-next-line no-console\n // console.log(\n // `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n // )\n // }\n // }\n\n return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n","<template>\n <ul\n class=\"pagination\"\n :class=\"computedWrapperClasses\"\n role=\"menubar\"\n :aria-disabled=\"props.disabled\"\n :aria-label=\"props.ariaLabel || undefined\"\n @keydown=\"handleKeyNav\"\n >\n <li\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page.id}`\"\n v-bind=\"page.li\"\n ref=\"_pageElements\"\n :[dataDisplayNameCustomAttribute]=\"index\"\n >\n <span\n v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n v-bind=\"ellipsisProps.span\"\n >\n <slot name=\"ellipsis-text\">\n {{ props.ellipsisText || '...' }}\n </slot>\n </span>\n <component\n v-bind=\"page.button\"\n :is=\"page.button.is\"\n v-else-if=\"'button' in page\"\n @click=\"page.clickHandler\"\n >\n <slot\n :name=\"page.text.name\"\n :disabled=\"page.text.disabled\"\n :page=\"page.text.page\"\n :index=\"page.text.index\"\n :active=\"page.text.active ?? false\"\n :content=\"page.text.value\"\n >\n {{ page.text.value }}\n </slot>\n </component>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, nextTick, useTemplateRef, watch} from 'vue'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\nimport {CODE_DOWN, CODE_LEFT, CODE_RIGHT, CODE_UP} from '../../utils/constants'\nimport {getActiveElement} from '../../utils/dom'\nimport {type BPaginationEmits, type BPaginationProps, type BPaginationSlots} from '../../types'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\nconst dataDisplayNameCustomAttribute = 'data-display-name'\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n align: 'start',\n ariaControls: undefined,\n ariaLabel: 'Pagination',\n disabled: false,\n ellipsisClass: undefined,\n ellipsisText: '\\u2026',\n firstClass: undefined,\n firstNumber: false,\n firstText: '\\u00AB',\n noEllipsis: false,\n noGotoEndButtons: false,\n labelFirstPage: 'Go to first page',\n labelLastPage: 'Go to last page',\n labelNextPage: 'Go to next page',\n labelPage: 'Go to page',\n labelPrevPage: 'Go to previous page',\n lastClass: undefined,\n lastNumber: false,\n lastText: '\\u00BB',\n limit: 5,\n nextClass: undefined,\n nextText: '\\u203A',\n pageClass: undefined,\n perPage: DEFAULT_PER_PAGE,\n pills: false,\n prevClass: undefined,\n prevText: '\\u2039',\n size: undefined,\n totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\nconst emit = defineEmits<BPaginationEmits>()\ndefineSlots<BPaginationSlots>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({\n default: 1,\n})\n\nconst pageElements = useTemplateRef('_pageElements')\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === computedModelValue.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n props.disabled ||\n isActivePage(num) ||\n computedModelValue.value < 1 ||\n // Check if the number is out of bounds\n num < 1 ||\n num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(computedModelValue.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(computedModelValue.value + 1))\n\nconst getBaseButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n tabIndex,\n label,\n position,\n isActive,\n hidden,\n isSmHidden,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n tabIndex?: string\n label?: string\n position?: number\n isActive?: boolean\n hidden?: boolean\n isSmHidden?: boolean\n}) => ({\n li: {\n 'class': [\n 'page-item',\n {\n 'active': isActive,\n disabled,\n 'bv-d-sm-down-none': isSmHidden,\n 'flex-fill': computedFill.value,\n 'd-flex': computedFill.value && !disabled,\n },\n classVal,\n ],\n 'role': 'presentation',\n 'aria-hidden': hidden,\n },\n button: {\n 'is': disabled ? 'span' : 'button',\n 'class': ['page-link', 'text-center', {'flex-grow-1': !disabled && computedFill.value}],\n 'aria-label': label,\n 'aria-controls': props.ariaControls || undefined,\n 'aria-disabled': disabled ? true : undefined,\n 'aria-posinset': position,\n 'aria-setsize': position ? numberOfPages.value : undefined,\n 'role': 'menuitem',\n 'type': disabled ? undefined : 'button',\n 'tabindex': disabled ? undefined : tabIndex,\n },\n text: {\n name: slotName,\n active: isActive,\n value: textValue ?? page,\n page,\n disabled,\n index: page - 1,\n content: textValue ? undefined : String(page),\n },\n clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n label,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n label: string\n}) => getBaseButtonProps({page, classVal, disabled, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n getBaseButtonProps({\n page,\n disabled: props.disabled,\n classVal: props.pageClass,\n slotName: 'page',\n label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n tabIndex: getTabIndex(page) ?? undefined,\n position: page,\n isActive: isActivePage(page),\n isSmHidden,\n })\n\nconst firstButtonProps = computed(() =>\n getButtonProps({\n page: 1,\n disabled: firstDisabled.value,\n classVal: props.firstClass,\n slotName: 'first-text',\n textValue: props.firstText,\n label: props.labelFirstPage,\n })\n)\nconst prevButtonProps = computed(() =>\n getButtonProps({\n page: Math.max(computedModelValue.value - 1, 1),\n disabled: prevDisabled.value,\n classVal: props.prevClass,\n slotName: 'prev-text',\n textValue: props.prevText,\n label: props.labelPrevPage,\n })\n)\nconst nextButtonProps = computed(() =>\n getButtonProps({\n page: Math.min(computedModelValue.value + 1, numberOfPages.value),\n disabled: nextDisabled.value,\n classVal: props.nextClass,\n slotName: 'next-text',\n textValue: props.nextText,\n label: props.labelNextPage,\n })\n)\nconst lastButtonProps = computed(() =>\n getButtonProps({\n page: numberOfPages.value,\n disabled: lastDisabled.value,\n classVal: props.lastClass,\n slotName: 'last-text',\n textValue: props.lastText,\n label: props.labelLastPage,\n })\n)\n\nconst ellipsisProps = computed(() => ({\n li: {\n class: [\n 'page-item',\n 'disabled',\n 'text-center',\n 'bv-d-sm-down-none',\n computedFill.value ? 'flex-fill' : '',\n props.ellipsisClass,\n ],\n role: 'separator',\n },\n span: {\n class: ['page-link'],\n },\n}))\n\nconst computedWrapperClasses = computed(() => [\n alignment.value,\n {\n [`pagination-${props.size}`]: props.size !== undefined,\n 'b-pagination-pills': props.pills,\n },\n])\n\nconst pagination = computed(() => ({\n pageSize: perPageSanitized.value,\n totalRows: totalRowsNumber.value,\n numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n if (pageNumber === computedModelValue.value) return\n const clickEvent = new BvEvent('page-click', {\n cancelable: true,\n target: event.target,\n })\n emit('page-click', clickEvent, pageNumber)\n\n if (clickEvent.defaultPrevented) return\n\n modelValue.value = pageNumber\n\n nextTick(() => {\n if (pageNumber === 1) {\n focusFirst()\n } else if (pageNumber === pagination.value.numberOfPages) {\n focusLast()\n }\n })\n // nextTick(() => {\n // if (isVisible(target) && un_element.contains(target)) {\n // attemptFocus(target)\n //} else {\n //this.focusCurrent()\n //}\n // })\n}\n\nconst isDisabled = (el: HTMLButtonElement) => {\n const isElement = el && el.nodeType === Node.ELEMENT_NODE\n const hasAttr = isElement ? el.hasAttribute('disabled') : null\n const hasClass = isElement && el.classList ? el.classList.contains('disabled') : false\n\n return !isElement || el.disabled || hasAttr || hasClass\n}\n\nconst getButtons = (): HTMLButtonElement[] =>\n [...(pageElements.value ?? [])]\n .sort(\n (a, b) =>\n Number.parseInt(a.getAttribute(dataDisplayNameCustomAttribute) || '0') -\n Number.parseInt(b.getAttribute(dataDisplayNameCustomAttribute) || '0')\n )\n .map((page) => page.children[0])\n .filter((el) => {\n if (el?.getAttribute('display') === 'none' || el?.tagName.toUpperCase() !== 'BUTTON') {\n return false\n }\n\n const bcr = el?.getBoundingClientRect()\n\n return !!(bcr && bcr.height > 0 && bcr.width > 0)\n })\n .map((el) => el as HTMLButtonElement)\n\nconst focusFirst = () => {\n nextTick(() => {\n const btn = getButtons().find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusPrev = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n\n const button = buttons[index - 1]\n if (index > 0 && button !== undefined && !isDisabled(button)) {\n buttons[index - 1]?.focus()\n }\n })\n}\n\nconst focusLast = () => {\n nextTick(() => {\n const btn = getButtons()\n .reverse()\n .find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusNext = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n const button = buttons[index + 1]\n if (index < buttons.length - 1 && button !== undefined && !isDisabled(button)) {\n buttons[index + 1]?.focus()\n }\n })\n}\n\nconst handleKeyNav = (event: KeyboardEvent) => {\n const {code, shiftKey} = event\n if (code === CODE_LEFT || code === CODE_UP) {\n event.preventDefault()\n if (shiftKey) {\n focusFirst()\n } else {\n focusPrev()\n }\n } else if (code === CODE_RIGHT || code === CODE_DOWN) {\n event.preventDefault()\n if (shiftKey) {\n focusLast()\n } else {\n focusNext()\n }\n }\n}\n\nconst computedModelValue = computed(() => {\n const page = modelValueNumber.value || 1\n return page > numberOfPages.value ? numberOfPages.value : page < 1 ? 1 : page\n})\n\nwatch(pagination, (oldValue, newValue) => {\n if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n // If the page size changes, reset to page 1\n modelValue.value = 1\n }\n})\n\nconst noFirstButton = computed(() => (props.noGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst noLastButton = computed(() => (props.noGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (noFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (noLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n const {value} = computedModelValue\n\n const els = elements.value.map((p) => {\n switch (p) {\n case FIRST_BUTTON:\n return {id: p, ...firstButtonProps.value}\n case PREV_BUTTON:\n return {id: p, ...prevButtonProps.value}\n case NEXT_BUTTON:\n return {id: p, ...nextButtonProps.value}\n case LAST_BUTTON:\n return {id: p, ...lastButtonProps.value}\n case FIRST_ELLIPSIS:\n case LAST_ELLIPSIS:\n return {id: p, ...ellipsisProps.value}\n default:\n return {id: p, ...getPageButtonProps(p)}\n }\n })\n\n if (numberOfPages.value > 3) {\n if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n const idx = 2 + showFirstButton.value\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n\n if (value <= halfLimit.value + firstPage.value) {\n const idx = els.length - (3 + showLastButton.value)\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n }\n\n return els\n})\n\nconst elements = computed(() => {\n // The idea here is to create an array of all the buttons on the page control.\n // This way we can keep the invariants in one place and the template code just\n // iterates over the array.\n\n const pages = numberOfPages.value\n const {value} = computedModelValue\n const limit = limitNumber.value\n const noEllipsis = props.noEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n // The first case is when all the page buttons fit on the control, this is\n // the simplest case and the only one that will create an array smaller than\n // Limit + 4 - noEndButtons * 2 (the [first, last,] prev, next buttons)\n\n if (pages < limit + firstPage.value + lastPage.value) {\n return [\n !firstPage.value && !noFirstButton.value ? FIRST_BUTTON : null,\n PREV_BUTTON,\n ...Array.from({length: pages}, (_, index) => index + 1),\n NEXT_BUTTON,\n !lastPage.value && !noLastButton.value ? LAST_BUTTON : null,\n ].filter((x) => x !== null) as number[]\n }\n\n // All the remaining cases result in an array that is exactly limit + 4 - noEndButtons * 2 in length, so create\n // the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n const buttons = Array.from({length: limit + 4 - (noFirstButton.value + noLastButton.value)})\n if (!noFirstButton.value) {\n if (!firstPage.value) {\n buttons[0] = FIRST_BUTTON\n buttons[1] = PREV_BUTTON\n } else {\n buttons[0] = PREV_BUTTON\n buttons[1] = 1\n }\n } else {\n buttons[0] = PREV_BUTTON\n }\n\n if (!noLastButton.value) {\n if (!lastPage.value) {\n buttons[buttons.length - 1] = LAST_BUTTON\n buttons[buttons.length - 2] = NEXT_BUTTON\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n buttons[buttons.length - 2] = pages\n }\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n }\n\n // The next case is where the page buttons start at the beginning, with\n // no ellipsis at the beginning, but one at the end\n\n if (value <= halfLimit.value + firstPage.value) {\n for (let index = 1; index <= limit; index++) {\n buttons[index + 1 - noFirstButton.value] = index + firstPage.value\n }\n\n if (!noEllipsis) {\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n // And then we have the case where the page buttons go up to the end, with no\n // ellipsis at the end, but one at the beginning\n\n if (value > pages - halfLimit.value - lastPage.value) {\n const start = pages - (limit - 1) - lastPage.value\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n }\n }\n\n // Finally we have the case where we have ellipsis at both ends\n if (!buttons[2]) {\n // Is there a more elegant way to check that we're in the final case?\n const start = value - Math.floor(limit / 2)\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n //Enable sanity check for debugging purposes\n // for (let i = 0; i < buttons.length; i++) {\n // if (!buttons[i]) {\n // // eslint-disable-next-line no-console\n // console.log(\n // `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n // )\n // }\n // }\n\n return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n"],"mappings":";;;;;;;;;AA4kBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAphB3B,MAAM,qBAAqB;EAE3B,MAAM,eAAe;EACrB,MAAM,cAAc;EACpB,MAAM,cAAc;EACpB,MAAM,cAAc;EACpB,MAAM,iBAAiB;EACvB,MAAM,gBAAgB;EAEtB,MAAM,iCAAiC;EAiCvC,MAAM,QAAQ,YAAY,SAAQ,aAAa;EAC/C,MAAM,OAAO;EAGb,MAAM,aAAa,SAA+D,SAAA,YAEjF;EAED,MAAM,eAAe,eAAe,eAAe;E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CAAA,CAAA"}
1
+ {"version":3,"file":"BPagination-C85wHRgS.js","names":[],"sources":["../src/components/BPagination/BPagination.vue","../src/components/BPagination/BPagination.vue"],"sourcesContent":["<template>\n <ul\n class=\"pagination\"\n :class=\"computedWrapperClasses\"\n role=\"menubar\"\n :aria-disabled=\"props.disabled\"\n :aria-label=\"props.ariaLabel || undefined\"\n @keydown=\"handleKeyNav\"\n >\n <li\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page.id}`\"\n v-bind=\"page.li\"\n ref=\"_pageElements\"\n :[dataDisplayNameCustomAttribute]=\"index\"\n >\n <span\n v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n v-bind=\"ellipsisProps.span\"\n >\n <slot name=\"ellipsis-text\">\n {{ props.ellipsisText || '...' }}\n </slot>\n </span>\n <component\n v-bind=\"page.button\"\n :is=\"page.button.is\"\n v-else-if=\"'button' in page\"\n @click=\"page.clickHandler\"\n >\n <slot\n :name=\"page.text.name\"\n :disabled=\"page.text.disabled\"\n :page=\"page.text.page\"\n :index=\"page.text.index\"\n :active=\"page.text.active ?? false\"\n :content=\"page.text.value\"\n >\n {{ page.text.value }}\n </slot>\n </component>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, nextTick, useTemplateRef, watch} from 'vue'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\nimport {CODE_DOWN, CODE_LEFT, CODE_RIGHT, CODE_UP} from '../../utils/constants'\nimport {getActiveElement} from '../../utils/dom'\nimport {type BPaginationEmits, type BPaginationProps, type BPaginationSlots} from '../../types'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\nconst dataDisplayNameCustomAttribute = 'data-display-name'\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n align: 'start',\n ariaControls: undefined,\n ariaLabel: 'Pagination',\n disabled: false,\n ellipsisClass: undefined,\n ellipsisText: '\\u2026',\n firstClass: undefined,\n firstNumber: false,\n firstText: '\\u00AB',\n noEllipsis: false,\n noGotoEndButtons: false,\n labelFirstPage: 'Go to first page',\n labelLastPage: 'Go to last page',\n labelNextPage: 'Go to next page',\n labelPage: 'Go to page',\n labelPrevPage: 'Go to previous page',\n lastClass: undefined,\n lastNumber: false,\n lastText: '\\u00BB',\n limit: 5,\n nextClass: undefined,\n nextText: '\\u203A',\n pageClass: undefined,\n perPage: DEFAULT_PER_PAGE,\n pills: false,\n prevClass: undefined,\n prevText: '\\u2039',\n size: undefined,\n totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\nconst emit = defineEmits<BPaginationEmits>()\ndefineSlots<BPaginationSlots>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({\n default: 1,\n})\n\nconst pageElements = useTemplateRef('_pageElements')\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === computedModelValue.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n props.disabled ||\n isActivePage(num) ||\n computedModelValue.value < 1 ||\n // Check if the number is out of bounds\n num < 1 ||\n num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(computedModelValue.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(computedModelValue.value + 1))\n\nconst getBaseButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n tabIndex,\n label,\n position,\n isActive,\n hidden,\n isSmHidden,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n tabIndex?: string\n label?: string\n position?: number\n isActive?: boolean\n hidden?: boolean\n isSmHidden?: boolean\n}) => ({\n li: {\n 'class': [\n 'page-item',\n {\n 'active': isActive,\n disabled,\n 'bv-d-sm-down-none': isSmHidden,\n 'flex-fill': computedFill.value,\n 'd-flex': computedFill.value && !disabled,\n },\n classVal,\n ],\n 'role': 'presentation',\n 'aria-hidden': hidden,\n },\n button: {\n 'is': disabled ? 'span' : 'button',\n 'class': ['page-link', 'text-center', {'flex-grow-1': !disabled && computedFill.value}],\n 'aria-label': label,\n 'aria-controls': props.ariaControls || undefined,\n 'aria-disabled': disabled ? true : undefined,\n 'aria-posinset': position,\n 'aria-setsize': position ? numberOfPages.value : undefined,\n 'role': 'menuitem',\n 'type': disabled ? undefined : 'button',\n 'tabindex': disabled ? undefined : tabIndex,\n },\n text: {\n name: slotName,\n active: isActive,\n value: textValue ?? page,\n page,\n disabled,\n index: page - 1,\n content: textValue ? undefined : String(page),\n },\n clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n label,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n label: string\n}) => getBaseButtonProps({page, classVal, disabled, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n getBaseButtonProps({\n page,\n disabled: props.disabled,\n classVal: props.pageClass,\n slotName: 'page',\n label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n tabIndex: getTabIndex(page) ?? undefined,\n position: page,\n isActive: isActivePage(page),\n isSmHidden,\n })\n\nconst firstButtonProps = computed(() =>\n getButtonProps({\n page: 1,\n disabled: firstDisabled.value,\n classVal: props.firstClass,\n slotName: 'first-text',\n textValue: props.firstText,\n label: props.labelFirstPage,\n })\n)\nconst prevButtonProps = computed(() =>\n getButtonProps({\n page: Math.max(computedModelValue.value - 1, 1),\n disabled: prevDisabled.value,\n classVal: props.prevClass,\n slotName: 'prev-text',\n textValue: props.prevText,\n label: props.labelPrevPage,\n })\n)\nconst nextButtonProps = computed(() =>\n getButtonProps({\n page: Math.min(computedModelValue.value + 1, numberOfPages.value),\n disabled: nextDisabled.value,\n classVal: props.nextClass,\n slotName: 'next-text',\n textValue: props.nextText,\n label: props.labelNextPage,\n })\n)\nconst lastButtonProps = computed(() =>\n getButtonProps({\n page: numberOfPages.value,\n disabled: lastDisabled.value,\n classVal: props.lastClass,\n slotName: 'last-text',\n textValue: props.lastText,\n label: props.labelLastPage,\n })\n)\n\nconst ellipsisProps = computed(() => ({\n li: {\n class: [\n 'page-item',\n 'disabled',\n 'text-center',\n 'bv-d-sm-down-none',\n computedFill.value ? 'flex-fill' : '',\n props.ellipsisClass,\n ],\n role: 'separator',\n },\n span: {\n class: ['page-link'],\n },\n}))\n\nconst computedWrapperClasses = computed(() => [\n alignment.value,\n {\n [`pagination-${props.size}`]: props.size !== undefined,\n 'b-pagination-pills': props.pills,\n },\n])\n\nconst pagination = computed(() => ({\n pageSize: perPageSanitized.value,\n totalRows: totalRowsNumber.value,\n numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n if (pageNumber === computedModelValue.value) return\n const clickEvent = new BvEvent('page-click', {\n cancelable: true,\n target: event.target,\n })\n emit('page-click', clickEvent, pageNumber)\n\n if (clickEvent.defaultPrevented) return\n\n modelValue.value = pageNumber\n\n nextTick(() => {\n if (pageNumber === 1) {\n focusFirst()\n } else if (pageNumber === pagination.value.numberOfPages) {\n focusLast()\n }\n })\n // nextTick(() => {\n // if (isVisible(target) && un_element.contains(target)) {\n // attemptFocus(target)\n //} else {\n //this.focusCurrent()\n //}\n // })\n}\n\nconst isDisabled = (el: HTMLButtonElement) => {\n const isElement = el && el.nodeType === Node.ELEMENT_NODE\n const hasAttr = isElement ? el.hasAttribute('disabled') : null\n const hasClass = isElement && el.classList ? el.classList.contains('disabled') : false\n\n return !isElement || el.disabled || hasAttr || hasClass\n}\n\nconst getButtons = (): HTMLButtonElement[] =>\n [...(pageElements.value ?? [])]\n .sort(\n (a, b) =>\n Number.parseInt(a.getAttribute(dataDisplayNameCustomAttribute) || '0') -\n Number.parseInt(b.getAttribute(dataDisplayNameCustomAttribute) || '0')\n )\n .map((page) => page.children[0])\n .filter((el) => {\n if (el?.getAttribute('display') === 'none' || el?.tagName.toUpperCase() !== 'BUTTON') {\n return false\n }\n\n const bcr = el?.getBoundingClientRect()\n\n return !!(bcr && bcr.height > 0 && bcr.width > 0)\n })\n .map((el) => el as HTMLButtonElement)\n\nconst focusFirst = () => {\n nextTick(() => {\n const btn = getButtons().find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusPrev = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n\n const button = buttons[index - 1]\n if (index > 0 && button !== undefined && !isDisabled(button)) {\n buttons[index - 1]?.focus()\n }\n })\n}\n\nconst focusLast = () => {\n nextTick(() => {\n const btn = getButtons()\n .reverse()\n .find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusNext = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n const button = buttons[index + 1]\n if (index < buttons.length - 1 && button !== undefined && !isDisabled(button)) {\n buttons[index + 1]?.focus()\n }\n })\n}\n\nconst handleKeyNav = (event: KeyboardEvent) => {\n const {code, shiftKey} = event\n if (code === CODE_LEFT || code === CODE_UP) {\n event.preventDefault()\n if (shiftKey) {\n focusFirst()\n } else {\n focusPrev()\n }\n } else if (code === CODE_RIGHT || code === CODE_DOWN) {\n event.preventDefault()\n if (shiftKey) {\n focusLast()\n } else {\n focusNext()\n }\n }\n}\n\nconst computedModelValue = computed(() => {\n const page = modelValueNumber.value || 1\n return page > numberOfPages.value ? numberOfPages.value : page < 1 ? 1 : page\n})\n\nwatch(pagination, (oldValue, newValue) => {\n if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n // If the page size changes, reset to page 1\n modelValue.value = 1\n }\n})\n\nconst noFirstButton = computed(() => (props.noGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst noLastButton = computed(() => (props.noGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (noFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (noLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n const {value} = computedModelValue\n\n const els = elements.value.map((p) => {\n switch (p) {\n case FIRST_BUTTON:\n return {id: p, ...firstButtonProps.value}\n case PREV_BUTTON:\n return {id: p, ...prevButtonProps.value}\n case NEXT_BUTTON:\n return {id: p, ...nextButtonProps.value}\n case LAST_BUTTON:\n return {id: p, ...lastButtonProps.value}\n case FIRST_ELLIPSIS:\n case LAST_ELLIPSIS:\n return {id: p, ...ellipsisProps.value}\n default:\n return {id: p, ...getPageButtonProps(p)}\n }\n })\n\n if (numberOfPages.value > 3) {\n if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n const idx = 2 + showFirstButton.value\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n\n if (value <= halfLimit.value + firstPage.value) {\n const idx = els.length - (3 + showLastButton.value)\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n }\n\n return els\n})\n\nconst elements = computed(() => {\n // The idea here is to create an array of all the buttons on the page control.\n // This way we can keep the invariants in one place and the template code just\n // iterates over the array.\n\n const pages = numberOfPages.value\n const {value} = computedModelValue\n const limit = limitNumber.value\n const noEllipsis = props.noEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n // The first case is when all the page buttons fit on the control, this is\n // the simplest case and the only one that will create an array smaller than\n // Limit + 4 - noEndButtons * 2 (the [first, last,] prev, next buttons)\n\n if (pages < limit + firstPage.value + lastPage.value) {\n return [\n !firstPage.value && !noFirstButton.value ? FIRST_BUTTON : null,\n PREV_BUTTON,\n ...Array.from({length: pages}, (_, index) => index + 1),\n NEXT_BUTTON,\n !lastPage.value && !noLastButton.value ? LAST_BUTTON : null,\n ].filter((x) => x !== null) as number[]\n }\n\n // All the remaining cases result in an array that is exactly limit + 4 - noEndButtons * 2 in length, so create\n // the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n const buttons = Array.from({length: limit + 4 - (noFirstButton.value + noLastButton.value)})\n if (!noFirstButton.value) {\n if (!firstPage.value) {\n buttons[0] = FIRST_BUTTON\n buttons[1] = PREV_BUTTON\n } else {\n buttons[0] = PREV_BUTTON\n buttons[1] = 1\n }\n } else {\n buttons[0] = PREV_BUTTON\n }\n\n if (!noLastButton.value) {\n if (!lastPage.value) {\n buttons[buttons.length - 1] = LAST_BUTTON\n buttons[buttons.length - 2] = NEXT_BUTTON\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n buttons[buttons.length - 2] = pages\n }\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n }\n\n // The next case is where the page buttons start at the beginning, with\n // no ellipsis at the beginning, but one at the end\n\n if (value <= halfLimit.value + firstPage.value) {\n for (let index = 1; index <= limit; index++) {\n buttons[index + 1 - noFirstButton.value] = index + firstPage.value\n }\n\n if (!noEllipsis) {\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n // And then we have the case where the page buttons go up to the end, with no\n // ellipsis at the end, but one at the beginning\n\n if (value > pages - halfLimit.value - lastPage.value) {\n const start = pages - (limit - 1) - lastPage.value\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n }\n }\n\n // Finally we have the case where we have ellipsis at both ends\n if (!buttons[2]) {\n // Is there a more elegant way to check that we're in the final case?\n const start = value - Math.floor(limit / 2)\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n //Enable sanity check for debugging purposes\n // for (let i = 0; i < buttons.length; i++) {\n // if (!buttons[i]) {\n // // eslint-disable-next-line no-console\n // console.log(\n // `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n // )\n // }\n // }\n\n return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n","<template>\n <ul\n class=\"pagination\"\n :class=\"computedWrapperClasses\"\n role=\"menubar\"\n :aria-disabled=\"props.disabled\"\n :aria-label=\"props.ariaLabel || undefined\"\n @keydown=\"handleKeyNav\"\n >\n <li\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page.id}`\"\n v-bind=\"page.li\"\n ref=\"_pageElements\"\n :[dataDisplayNameCustomAttribute]=\"index\"\n >\n <span\n v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n v-bind=\"ellipsisProps.span\"\n >\n <slot name=\"ellipsis-text\">\n {{ props.ellipsisText || '...' }}\n </slot>\n </span>\n <component\n v-bind=\"page.button\"\n :is=\"page.button.is\"\n v-else-if=\"'button' in page\"\n @click=\"page.clickHandler\"\n >\n <slot\n :name=\"page.text.name\"\n :disabled=\"page.text.disabled\"\n :page=\"page.text.page\"\n :index=\"page.text.index\"\n :active=\"page.text.active ?? false\"\n :content=\"page.text.value\"\n >\n {{ page.text.value }}\n </slot>\n </component>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, nextTick, useTemplateRef, watch} from 'vue'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\nimport {CODE_DOWN, CODE_LEFT, CODE_RIGHT, CODE_UP} from '../../utils/constants'\nimport {getActiveElement} from '../../utils/dom'\nimport {type BPaginationEmits, type BPaginationProps, type BPaginationSlots} from '../../types'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\nconst dataDisplayNameCustomAttribute = 'data-display-name'\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n align: 'start',\n ariaControls: undefined,\n ariaLabel: 'Pagination',\n disabled: false,\n ellipsisClass: undefined,\n ellipsisText: '\\u2026',\n firstClass: undefined,\n firstNumber: false,\n firstText: '\\u00AB',\n noEllipsis: false,\n noGotoEndButtons: false,\n labelFirstPage: 'Go to first page',\n labelLastPage: 'Go to last page',\n labelNextPage: 'Go to next page',\n labelPage: 'Go to page',\n labelPrevPage: 'Go to previous page',\n lastClass: undefined,\n lastNumber: false,\n lastText: '\\u00BB',\n limit: 5,\n nextClass: undefined,\n nextText: '\\u203A',\n pageClass: undefined,\n perPage: DEFAULT_PER_PAGE,\n pills: false,\n prevClass: undefined,\n prevText: '\\u2039',\n size: undefined,\n totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\nconst emit = defineEmits<BPaginationEmits>()\ndefineSlots<BPaginationSlots>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({\n default: 1,\n})\n\nconst pageElements = useTemplateRef('_pageElements')\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === computedModelValue.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n props.disabled ||\n isActivePage(num) ||\n computedModelValue.value < 1 ||\n // Check if the number is out of bounds\n num < 1 ||\n num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(computedModelValue.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(computedModelValue.value + 1))\n\nconst getBaseButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n tabIndex,\n label,\n position,\n isActive,\n hidden,\n isSmHidden,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n tabIndex?: string\n label?: string\n position?: number\n isActive?: boolean\n hidden?: boolean\n isSmHidden?: boolean\n}) => ({\n li: {\n 'class': [\n 'page-item',\n {\n 'active': isActive,\n disabled,\n 'bv-d-sm-down-none': isSmHidden,\n 'flex-fill': computedFill.value,\n 'd-flex': computedFill.value && !disabled,\n },\n classVal,\n ],\n 'role': 'presentation',\n 'aria-hidden': hidden,\n },\n button: {\n 'is': disabled ? 'span' : 'button',\n 'class': ['page-link', 'text-center', {'flex-grow-1': !disabled && computedFill.value}],\n 'aria-label': label,\n 'aria-controls': props.ariaControls || undefined,\n 'aria-disabled': disabled ? true : undefined,\n 'aria-posinset': position,\n 'aria-setsize': position ? numberOfPages.value : undefined,\n 'role': 'menuitem',\n 'type': disabled ? undefined : 'button',\n 'tabindex': disabled ? undefined : tabIndex,\n },\n text: {\n name: slotName,\n active: isActive,\n value: textValue ?? page,\n page,\n disabled,\n index: page - 1,\n content: textValue ? undefined : String(page),\n },\n clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n page,\n classVal,\n disabled,\n slotName,\n textValue,\n label,\n}: {\n page: number\n disabled: boolean\n classVal: ClassValue\n slotName: 'first-text' | 'prev-text' | 'next-text' | 'last-text' | 'page'\n textValue?: string\n label: string\n}) => getBaseButtonProps({page, classVal, disabled, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n getBaseButtonProps({\n page,\n disabled: props.disabled,\n classVal: props.pageClass,\n slotName: 'page',\n label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n tabIndex: getTabIndex(page) ?? undefined,\n position: page,\n isActive: isActivePage(page),\n isSmHidden,\n })\n\nconst firstButtonProps = computed(() =>\n getButtonProps({\n page: 1,\n disabled: firstDisabled.value,\n classVal: props.firstClass,\n slotName: 'first-text',\n textValue: props.firstText,\n label: props.labelFirstPage,\n })\n)\nconst prevButtonProps = computed(() =>\n getButtonProps({\n page: Math.max(computedModelValue.value - 1, 1),\n disabled: prevDisabled.value,\n classVal: props.prevClass,\n slotName: 'prev-text',\n textValue: props.prevText,\n label: props.labelPrevPage,\n })\n)\nconst nextButtonProps = computed(() =>\n getButtonProps({\n page: Math.min(computedModelValue.value + 1, numberOfPages.value),\n disabled: nextDisabled.value,\n classVal: props.nextClass,\n slotName: 'next-text',\n textValue: props.nextText,\n label: props.labelNextPage,\n })\n)\nconst lastButtonProps = computed(() =>\n getButtonProps({\n page: numberOfPages.value,\n disabled: lastDisabled.value,\n classVal: props.lastClass,\n slotName: 'last-text',\n textValue: props.lastText,\n label: props.labelLastPage,\n })\n)\n\nconst ellipsisProps = computed(() => ({\n li: {\n class: [\n 'page-item',\n 'disabled',\n 'text-center',\n 'bv-d-sm-down-none',\n computedFill.value ? 'flex-fill' : '',\n props.ellipsisClass,\n ],\n role: 'separator',\n },\n span: {\n class: ['page-link'],\n },\n}))\n\nconst computedWrapperClasses = computed(() => [\n alignment.value,\n {\n [`pagination-${props.size}`]: props.size !== undefined,\n 'b-pagination-pills': props.pills,\n },\n])\n\nconst pagination = computed(() => ({\n pageSize: perPageSanitized.value,\n totalRows: totalRowsNumber.value,\n numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n if (pageNumber === computedModelValue.value) return\n const clickEvent = new BvEvent('page-click', {\n cancelable: true,\n target: event.target,\n })\n emit('page-click', clickEvent, pageNumber)\n\n if (clickEvent.defaultPrevented) return\n\n modelValue.value = pageNumber\n\n nextTick(() => {\n if (pageNumber === 1) {\n focusFirst()\n } else if (pageNumber === pagination.value.numberOfPages) {\n focusLast()\n }\n })\n // nextTick(() => {\n // if (isVisible(target) && un_element.contains(target)) {\n // attemptFocus(target)\n //} else {\n //this.focusCurrent()\n //}\n // })\n}\n\nconst isDisabled = (el: HTMLButtonElement) => {\n const isElement = el && el.nodeType === Node.ELEMENT_NODE\n const hasAttr = isElement ? el.hasAttribute('disabled') : null\n const hasClass = isElement && el.classList ? el.classList.contains('disabled') : false\n\n return !isElement || el.disabled || hasAttr || hasClass\n}\n\nconst getButtons = (): HTMLButtonElement[] =>\n [...(pageElements.value ?? [])]\n .sort(\n (a, b) =>\n Number.parseInt(a.getAttribute(dataDisplayNameCustomAttribute) || '0') -\n Number.parseInt(b.getAttribute(dataDisplayNameCustomAttribute) || '0')\n )\n .map((page) => page.children[0])\n .filter((el) => {\n if (el?.getAttribute('display') === 'none' || el?.tagName.toUpperCase() !== 'BUTTON') {\n return false\n }\n\n const bcr = el?.getBoundingClientRect()\n\n return !!(bcr && bcr.height > 0 && bcr.width > 0)\n })\n .map((el) => el as HTMLButtonElement)\n\nconst focusFirst = () => {\n nextTick(() => {\n const btn = getButtons().find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusPrev = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n\n const button = buttons[index - 1]\n if (index > 0 && button !== undefined && !isDisabled(button)) {\n buttons[index - 1]?.focus()\n }\n })\n}\n\nconst focusLast = () => {\n nextTick(() => {\n const btn = getButtons()\n .reverse()\n .find((el) => !isDisabled(el))\n btn?.focus()\n })\n}\n\nconst focusNext = () => {\n nextTick(() => {\n const buttons = getButtons()\n const index = buttons.indexOf(getActiveElement() as HTMLButtonElement)\n const button = buttons[index + 1]\n if (index < buttons.length - 1 && button !== undefined && !isDisabled(button)) {\n buttons[index + 1]?.focus()\n }\n })\n}\n\nconst handleKeyNav = (event: KeyboardEvent) => {\n const {code, shiftKey} = event\n if (code === CODE_LEFT || code === CODE_UP) {\n event.preventDefault()\n if (shiftKey) {\n focusFirst()\n } else {\n focusPrev()\n }\n } else if (code === CODE_RIGHT || code === CODE_DOWN) {\n event.preventDefault()\n if (shiftKey) {\n focusLast()\n } else {\n focusNext()\n }\n }\n}\n\nconst computedModelValue = computed(() => {\n const page = modelValueNumber.value || 1\n return page > numberOfPages.value ? numberOfPages.value : page < 1 ? 1 : page\n})\n\nwatch(pagination, (oldValue, newValue) => {\n if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n // If the page size changes, reset to page 1\n modelValue.value = 1\n }\n})\n\nconst noFirstButton = computed(() => (props.noGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst noLastButton = computed(() => (props.noGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (noFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (noLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n const {value} = computedModelValue\n\n const els = elements.value.map((p) => {\n switch (p) {\n case FIRST_BUTTON:\n return {id: p, ...firstButtonProps.value}\n case PREV_BUTTON:\n return {id: p, ...prevButtonProps.value}\n case NEXT_BUTTON:\n return {id: p, ...nextButtonProps.value}\n case LAST_BUTTON:\n return {id: p, ...lastButtonProps.value}\n case FIRST_ELLIPSIS:\n case LAST_ELLIPSIS:\n return {id: p, ...ellipsisProps.value}\n default:\n return {id: p, ...getPageButtonProps(p)}\n }\n })\n\n if (numberOfPages.value > 3) {\n if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n const idx = 2 + showFirstButton.value\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n\n if (value <= halfLimit.value + firstPage.value) {\n const idx = els.length - (3 + showLastButton.value)\n const el = els[idx]\n if (el !== undefined) {\n els[idx] = {id: el.id, ...getPageButtonProps(el.id, true)}\n }\n }\n }\n\n return els\n})\n\nconst elements = computed(() => {\n // The idea here is to create an array of all the buttons on the page control.\n // This way we can keep the invariants in one place and the template code just\n // iterates over the array.\n\n const pages = numberOfPages.value\n const {value} = computedModelValue\n const limit = limitNumber.value\n const noEllipsis = props.noEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n // The first case is when all the page buttons fit on the control, this is\n // the simplest case and the only one that will create an array smaller than\n // Limit + 4 - noEndButtons * 2 (the [first, last,] prev, next buttons)\n\n if (pages < limit + firstPage.value + lastPage.value) {\n return [\n !firstPage.value && !noFirstButton.value ? FIRST_BUTTON : null,\n PREV_BUTTON,\n ...Array.from({length: pages}, (_, index) => index + 1),\n NEXT_BUTTON,\n !lastPage.value && !noLastButton.value ? LAST_BUTTON : null,\n ].filter((x) => x !== null) as number[]\n }\n\n // All the remaining cases result in an array that is exactly limit + 4 - noEndButtons * 2 in length, so create\n // the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n const buttons = Array.from({length: limit + 4 - (noFirstButton.value + noLastButton.value)})\n if (!noFirstButton.value) {\n if (!firstPage.value) {\n buttons[0] = FIRST_BUTTON\n buttons[1] = PREV_BUTTON\n } else {\n buttons[0] = PREV_BUTTON\n buttons[1] = 1\n }\n } else {\n buttons[0] = PREV_BUTTON\n }\n\n if (!noLastButton.value) {\n if (!lastPage.value) {\n buttons[buttons.length - 1] = LAST_BUTTON\n buttons[buttons.length - 2] = NEXT_BUTTON\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n buttons[buttons.length - 2] = pages\n }\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n }\n\n // The next case is where the page buttons start at the beginning, with\n // no ellipsis at the beginning, but one at the end\n\n if (value <= halfLimit.value + firstPage.value) {\n for (let index = 1; index <= limit; index++) {\n buttons[index + 1 - noFirstButton.value] = index + firstPage.value\n }\n\n if (!noEllipsis) {\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n // And then we have the case where the page buttons go up to the end, with no\n // ellipsis at the end, but one at the beginning\n\n if (value > pages - halfLimit.value - lastPage.value) {\n const start = pages - (limit - 1) - lastPage.value\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n }\n }\n\n // Finally we have the case where we have ellipsis at both ends\n if (!buttons[2]) {\n // Is there a more elegant way to check that we're in the final case?\n const start = value - Math.floor(limit / 2)\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - noFirstButton.value] = start + index\n }\n\n if (!noEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n //Enable sanity check for debugging purposes\n // for (let i = 0; i < buttons.length; i++) {\n // if (!buttons[i]) {\n // // eslint-disable-next-line no-console\n // console.log(\n // `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n // )\n // }\n // }\n\n return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n"],"mappings":";;;;;;;;;AA4kBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK,QAAM,EAGlB,SAAO,KAAK,aAAA,CAAA,GAAA;KAEb,SAAA,cASO,CATP,WASO,KAAA,QARE,KAAK,KAAK,MAAI;MACpB,UAAU,KAAK,KAAK;MACpB,MAAM,KAAK,KAAK;MAChB,OAAO,KAAK,KAAK;MACjB,QAAQ,KAAK,KAAK,UAAM;MACxB,SAAS,KAAK,KAAK;KANtB,SASO,CADF,gBAAA,gBAAA,KAAK,KAAK,KAAK,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import { n as BvEvent } from "./classes-BEWWGbj5.js";
1
+ import { n as BvEvent } from "./classes-DCjKFM2E.js";
2
2
  import { C as tabsInjectionKey } from "./keys-BgLwJbLV.js";
3
3
  import { c as sortSlotElementsByPosition, i as getSafeDocument } from "./dom-BdUQrX99.js";
4
4
  import { t as useDefaults } from "./useDefaults-BzP4qZBu.js";
@@ -594,4 +594,4 @@ var BTabs_default = /* @__PURE__ */ defineComponent({
594
594
  //#endregion
595
595
  export { BTab_default as n, BTabs_default as t };
596
596
 
597
- //# sourceMappingURL=BTabs-Zp8CvCL_.js.map
597
+ //# sourceMappingURL=BTabs-Cfe8HOGE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BTabs-Zp8CvCL_.js","names":[],"sources":["../src/components/BTabs/BTab.vue","../src/components/BTabs/BTab.vue","../src/components/BTabsTabContent.vue","../src/components/BTabsTabContent.vue","../src/components/BTabs/BTabs.vue","../src/components/BTabs/BTabs.vue"],"sourcesContent":["<template>\n <component\n :is=\"props.tag\"\n :id=\"computedId\"\n ref=\"_el\"\n class=\"tab-pane\"\n :class=\"computedClasses\"\n role=\"tabpanel\"\n :aria-labelledby=\"computedButtonId\"\n v-bind=\"processedAttrs\"\n >\n <slot v-if=\"showSlot\" />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, inject, onUnmounted, ref, useAttrs, useTemplateRef, watch} from 'vue'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {TabType} from '../../types/Tab'\nimport type {BTabProps} from '../../types/ComponentProps'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport type {BTabSlots} from '../../types/ComponentSlots'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BTabProps, 'active'>>(), {\n buttonId: undefined,\n disabled: false,\n id: undefined,\n lazy: undefined,\n unmountLazy: undefined,\n noBody: false,\n tag: 'div',\n title: undefined,\n titleItemClass: undefined,\n titleLinkAttrs: undefined,\n titleLinkClass: undefined,\n})\nconst props = useDefaults(_props, 'BTab')\nconst slots = defineSlots<BTabSlots>()\nconst attrs = useAttrs()\n\nconst activeModel = defineModel<Exclude<BTabProps['active'], undefined>>('active', {\n default: false,\n})\n\nconst parentData = inject(tabsInjectionKey, null)\n\nconst localId = ref(props.id)\nconst internalId = useId('', 'tabpane')\nconst computedId = computed(() => props.id ?? localId.value ?? internalId.value)\nconst computedButtonId = useId(() => props.buttonId, 'tab')\n\nconst lazyRenderCompleted = ref(false)\nconst el = useTemplateRef('_el')\n\nconst processedAttrs = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {onClick: _, ...tabAttrs} = attrs\n return tabAttrs\n})\n\nfunction updateTab() {\n if (!parentData) return\n const newId = parentData.registerTab(\n computed(\n () =>\n ({\n internalId: internalId.value,\n id: computedId.value,\n active: activeModel.value,\n buttonId: computedButtonId.value,\n disabled: props.disabled,\n title: props.title,\n titleComponent: slots.title,\n titleItemClass: props.titleItemClass,\n titleLinkAttrs: props.titleLinkAttrs,\n titleLinkClass: props.titleLinkClass,\n onClick: attrs.onClick,\n el,\n }) as TabType\n )\n )\n if (newId !== localId.value) {\n localId.value = newId\n }\n}\n\nif (parentData) {\n updateTab()\n if (activeModel.value) {\n parentData.activateTab(internalId.value)\n }\n}\n\nonUnmounted(() => {\n if (!parentData) return\n parentData.unregisterTab(internalId.value)\n})\n\nconst isActive = computed(() => parentData?.activeId.value === computedId.value)\nconst show = ref(isActive.value)\n\nconst computedLazy = computed(() => !!(parentData?.lazy.value || props.lazy))\n\nconst computedActive = computed(() => isActive.value && !props.disabled)\nconst showSlot = computed(\n () =>\n computedActive.value ||\n !computedLazy.value ||\n (computedLazy.value && !props.unmountLazy && lazyRenderCompleted.value)\n)\n\nwatch(showSlot, (shown) => {\n if (shown && !lazyRenderCompleted.value) lazyRenderCompleted.value = true\n})\n\nwatch(isActive, (active) => {\n if (active) {\n activeModel.value = true\n setTimeout(() => {\n show.value = true\n }, 0)\n return\n }\n show.value = false\n activeModel.value = false\n})\n\nwatch(activeModel, (active) => {\n if (props.disabled) {\n activeModel.value = false\n return\n }\n if (!parentData) return\n if (!active) {\n if (isActive.value) {\n parentData.activateTab(undefined)\n }\n return\n }\n if (!isActive.value) {\n parentData.activateTab(internalId.value)\n }\n})\n\nconst computedClasses = computed(() => [\n {\n 'active': isActive.value,\n 'show': show.value,\n 'card-body': parentData?.card.value && props.noBody === false,\n 'fade': !parentData?.noFade.value,\n },\n show.value ? parentData?.activeTabClass.value : parentData?.inactiveTabClass.value,\n parentData?.tabClass.value,\n])\n\ndefineExpose({\n activate: () => {\n activeModel.value = true\n },\n deactivate: () => {\n activeModel.value = false\n },\n})\n</script>\n","<template>\n <component\n :is=\"props.tag\"\n :id=\"computedId\"\n ref=\"_el\"\n class=\"tab-pane\"\n :class=\"computedClasses\"\n role=\"tabpanel\"\n :aria-labelledby=\"computedButtonId\"\n v-bind=\"processedAttrs\"\n >\n <slot v-if=\"showSlot\" />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, inject, onUnmounted, ref, useAttrs, useTemplateRef, watch} from 'vue'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {TabType} from '../../types/Tab'\nimport type {BTabProps} from '../../types/ComponentProps'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport type {BTabSlots} from '../../types/ComponentSlots'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BTabProps, 'active'>>(), {\n buttonId: undefined,\n disabled: false,\n id: undefined,\n lazy: undefined,\n unmountLazy: undefined,\n noBody: false,\n tag: 'div',\n title: undefined,\n titleItemClass: undefined,\n titleLinkAttrs: undefined,\n titleLinkClass: undefined,\n})\nconst props = useDefaults(_props, 'BTab')\nconst slots = defineSlots<BTabSlots>()\nconst attrs = useAttrs()\n\nconst activeModel = defineModel<Exclude<BTabProps['active'], undefined>>('active', {\n default: false,\n})\n\nconst parentData = inject(tabsInjectionKey, null)\n\nconst localId = ref(props.id)\nconst internalId = useId('', 'tabpane')\nconst computedId = computed(() => props.id ?? localId.value ?? internalId.value)\nconst computedButtonId = useId(() => props.buttonId, 'tab')\n\nconst lazyRenderCompleted = ref(false)\nconst el = useTemplateRef('_el')\n\nconst processedAttrs = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {onClick: _, ...tabAttrs} = attrs\n return tabAttrs\n})\n\nfunction updateTab() {\n if (!parentData) return\n const newId = parentData.registerTab(\n computed(\n () =>\n ({\n internalId: internalId.value,\n id: computedId.value,\n active: activeModel.value,\n buttonId: computedButtonId.value,\n disabled: props.disabled,\n title: props.title,\n titleComponent: slots.title,\n titleItemClass: props.titleItemClass,\n titleLinkAttrs: props.titleLinkAttrs,\n titleLinkClass: props.titleLinkClass,\n onClick: attrs.onClick,\n el,\n }) as TabType\n )\n )\n if (newId !== localId.value) {\n localId.value = newId\n }\n}\n\nif (parentData) {\n updateTab()\n if (activeModel.value) {\n parentData.activateTab(internalId.value)\n }\n}\n\nonUnmounted(() => {\n if (!parentData) return\n parentData.unregisterTab(internalId.value)\n})\n\nconst isActive = computed(() => parentData?.activeId.value === computedId.value)\nconst show = ref(isActive.value)\n\nconst computedLazy = computed(() => !!(parentData?.lazy.value || props.lazy))\n\nconst computedActive = computed(() => isActive.value && !props.disabled)\nconst showSlot = computed(\n () =>\n computedActive.value ||\n !computedLazy.value ||\n (computedLazy.value && !props.unmountLazy && lazyRenderCompleted.value)\n)\n\nwatch(showSlot, (shown) => {\n if (shown && !lazyRenderCompleted.value) lazyRenderCompleted.value = true\n})\n\nwatch(isActive, (active) => {\n if (active) {\n activeModel.value = true\n setTimeout(() => {\n show.value = true\n }, 0)\n return\n }\n show.value = false\n activeModel.value = false\n})\n\nwatch(activeModel, (active) => {\n if (props.disabled) {\n activeModel.value = false\n return\n }\n if (!parentData) return\n if (!active) {\n if (isActive.value) {\n parentData.activateTab(undefined)\n }\n return\n }\n if (!isActive.value) {\n parentData.activateTab(internalId.value)\n }\n})\n\nconst computedClasses = computed(() => [\n {\n 'active': isActive.value,\n 'show': show.value,\n 'card-body': parentData?.card.value && props.noBody === false,\n 'fade': !parentData?.noFade.value,\n },\n show.value ? parentData?.activeTabClass.value : parentData?.inactiveTabClass.value,\n parentData?.tabClass.value,\n])\n\ndefineExpose({\n activate: () => {\n activeModel.value = true\n },\n deactivate: () => {\n activeModel.value = false\n },\n})\n</script>\n","<template>\n <div class=\"tab-content\" :class=\"contentClass\">\n <slot />\n <div v-if=\"showEmpty\" key=\"bv-empty-tab\" class=\"tab-pane active\" :class=\"{'card-body': card}\">\n <slot name=\"empty\" />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport type {ClassValue} from '../types/AnyValuedAttributes'\n\ndefineProps<{\n contentClass: ClassValue | undefined\n showEmpty: boolean\n card: boolean\n}>()\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\ndefineSlots<{\n default?: (props: Record<string, never>) => any\n empty?: (props: Record<string, never>) => any\n}>()\n/* eslint-enable @typescript-eslint/no-explicit-any */\n</script>\n","<template>\n <div class=\"tab-content\" :class=\"contentClass\">\n <slot />\n <div v-if=\"showEmpty\" key=\"bv-empty-tab\" class=\"tab-pane active\" :class=\"{'card-body': card}\">\n <slot name=\"empty\" />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport type {ClassValue} from '../types/AnyValuedAttributes'\n\ndefineProps<{\n contentClass: ClassValue | undefined\n showEmpty: boolean\n card: boolean\n}>()\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\ndefineSlots<{\n default?: (props: Record<string, never>) => any\n empty?: (props: Record<string, never>) => any\n}>()\n/* eslint-enable @typescript-eslint/no-explicit-any */\n</script>\n","<template>\n <component :is=\"props.tag\" :id=\"props.id\" class=\"tabs\" :class=\"computedClasses\">\n <BTabsTabContent v-if=\"props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n <div\n :class=\"[\n props.navWrapperClass,\n {'card-header': props.card, 'ms-auto': vertical && props.end},\n ]\"\n >\n <ul\n class=\"nav\"\n :class=\"[navTabsClasses, props.navClass]\"\n role=\"tablist\"\n :aria-orientation=\"props.vertical ? 'vertical' : 'horizontal'\"\n >\n <slot name=\"tabs-start\" />\n <li\n v-for=\"(tab, idx) in tabs\"\n :key=\"tab.id ?? tab.internalId\"\n class=\"nav-item\"\n :class=\"tab.titleItemClass\"\n role=\"presentation\"\n >\n <button\n :id=\"tab.buttonId\"\n class=\"nav-link\"\n :class=\"[tab.navItemClasses, tab.titleLinkClass, tab.active ? props.activeNavLinkClass : props.inactiveNavLinkClass]\"\n role=\"tab\"\n :aria-controls=\"tab.id\"\n :aria-selected=\"tab.active\"\n :disabled=\"tab.disabled\"\n :tabindex=\"props.noKeyNav ? undefined : tab.active ? undefined : -1\"\n type=\"button\"\n v-bind=\"tab.titleLinkAttrs\"\n @keydown.left.exact=\"!props.vertical && keynav($event, -1)\"\n @keydown.left.shift=\"!props.vertical && keynav($event, -999)\"\n @keydown.up.exact=\"props.vertical && keynav($event, -1)\"\n @keydown.up.shift=\"props.vertical && keynav($event, -999)\"\n @keydown.right.exact=\"!props.vertical && keynav($event, 1)\"\n @keydown.right.shift=\"!props.vertical && keynav($event, 999)\"\n @keydown.down.exact=\"props.vertical && keynav($event, 1)\"\n @keydown.down.shift=\"props.vertical && keynav($event, 999)\"\n @keydown.page-up=\"keynav($event, -999)\"\n @keydown.page-down=\"keynav($event, 999)\"\n @keydown.home=\"keynav($event, -999)\"\n @keydown.end=\"keynav($event, 999)\"\n @click.stop=\"(e) => handleClick(e, idx)\"\n >\n <component :is=\"tab.titleComponent\" v-if=\"tab.titleComponent\" />\n <template v-else>\n {{ tab.title }}\n </template>\n </button>\n </li>\n <slot name=\"tabs-end\" />\n </ul>\n </div>\n <BTabsTabContent v-if=\"!props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n type Ref,\n ref,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {BvEvent} from '../../utils/classes'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useId} from '../../composables/useId'\nimport type {TabType, BTabsProps, BTabsEmits, BTabsSlots} from '../../types'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {getSafeDocument, sortSlotElementsByPosition} from '../../utils/dom'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport BTab from './BTab.vue'\nimport BTabsTabContent from '../BTabsTabContent.vue'\n\nconst _props = withDefaults(defineProps<Omit<BTabsProps, 'modelValue' | 'activeIndex'>>(), {\n activeNavItemClass: undefined,\n activeNavLinkClass: undefined,\n activeTabClass: undefined,\n align: undefined,\n card: false,\n contentClass: undefined,\n end: false,\n fill: false,\n id: undefined,\n inactiveNavItemClass: undefined,\n inactiveNavLinkClass: undefined,\n inactiveTabClass: undefined,\n justified: false,\n lazy: false,\n navClass: undefined,\n navItemClass: undefined,\n navWrapperClass: undefined,\n noFade: false,\n noKeyNav: false,\n noNavStyle: false,\n pills: false,\n small: false,\n tag: 'div',\n tabClass: undefined,\n underline: false,\n vertical: false,\n})\nconst props = useDefaults(_props, 'BTabs')\nconst emit = defineEmits<BTabsEmits>()\nconst slots = defineSlots<BTabsSlots>()\n\nconst activeIndex = defineModel<Exclude<BTabsProps['index'], undefined>>('index', {\n default: -1,\n})\nconst activeId = defineModel<BTabsProps['modelValue']>({\n default: undefined,\n})\n\nconst tabsInternal = ref<Ref<TabType>[]>([])\n\nconst tabElementsArray = ref<VNode[]>([])\n\nconst isChildActive = ref(false)\nconst initialIds = ref<string[]>([])\nconst selectedTabHasExplicitId = ref(false)\n\nconst updateTabElementsArray = () => {\n const tabElements = flattenFragments(slots.default?.({}) ?? [])\n tabElementsArray.value = (Array.isArray(tabElements) ? tabElements : [tabElements]).filter(\n (tab) => tab.type === BTab\n )\n // only get the ids once in setup context\n if (initialIds.value.length === 0) {\n // we need to get the ids of the tabs before they are registered. After that we use the internalId for the tabpane\n initialIds.value = tabElementsArray.value.map((tab) =>\n unref(useId(() => tab.props?.id, 'tabpane'))\n )\n // Whether the *initially selected* tab carries an explicit ID.\n //\n // Only that tab matters. The delayed-selection path below exists because\n // a generated ID is not final until the child registers; an explicit ID\n // is final immediately. Asking `.some()` across every tab got this wrong\n // for a mixed list — a single ID-bearing sibling made an ID-less target\n // look safe, so the ID was read pre-mount, failed to match after\n // registration, and the selection fell back to the first tab (#2773).\n selectedTabHasExplicitId.value =\n activeIndex.value > -1 && tabElementsArray.value[activeIndex.value]?.props?.id !== undefined\n }\n isChildActive.value = tabElementsArray.value.some(\n (tab) => tab.props?.active !== undefined && tab.props?.active !== false\n )\n}\nupdateTabElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateTabElementsArray()\n nextTick(() => {\n sortTabs()\n })\n }\n)\n\nconst tabs = computed(() => {\n if (tabsInternal.value.length === 0) {\n // fail back on the slot elements, the children haven't been registered yet\n const _activeIndex = tabElementsArray.value.findIndex(\n (tab) =>\n (tab.props?.active !== undefined &&\n (tab.props.disabled === false || tab.props.disabled === undefined)) ||\n (activeId.value && tab.props?.id === activeId.value)\n )\n return tabElementsArray.value.map((tab, index) => {\n const active =\n _activeIndex !== -1\n ? index === _activeIndex\n : activeIndex.value > -1\n ? index === activeIndex.value\n : index === 0\n return {\n id: tab.props?.id ?? initialIds.value[index],\n internalId: `premount-${index}`, // temporary id for the tab\n buttonId: tab.props?.buttonId,\n disabled: tab.props?.disabled,\n title: tab.props?.title,\n titleComponent: (tab.children as {title: unknown})?.title,\n titleItemClass: tab.props?.titleItemClass,\n titleLinkAttrs: tab.props?.titleLinkAttrs,\n titleLinkClass: tab.props?.titleLinkClass,\n onClick: tab.props?.onClick,\n active,\n navItemClasses: [\n {\n active,\n disabled: !(tab.props?.disabled === false || tab.props?.disabled === undefined),\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n }\n return tabsInternal.value.map((_tab) => {\n const tab = unref(_tab)\n const active = tab.id === activeId.value\n\n return {\n ...tab,\n active,\n navItemClasses: [\n {\n active,\n disabled: tab.disabled,\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n})\n\nlet initialized = false\nlet updateInitialActiveIndex = false\nlet updateInitialActiveId = false\nlet delayedTabSelection = false\n\n// Check if we need to delay tab selection:\n// - We have v-model:index (activeIndex) but no v-model (activeId)\n// - AND the selected tab has no explicit ID (so it will use a generated one)\n// - AND we have tabs to select from\nconst needsDelayedSelection =\n activeIndex.value > -1 &&\n !activeId.value &&\n !selectedTabHasExplicitId.value &&\n tabElementsArray.value.length > 0\n\nif (needsDelayedSelection) {\n // Delay tab selection until children register with their generated IDs\n delayedTabSelection = true\n updateInitialActiveId = true\n} else if (activeIndex.value === -1 && activeId.value) {\n if (tabs.value.findIndex((t) => t.id === activeId.value) !== -1) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n } else {\n updateInitialActiveIndex = true\n }\n} else if (activeIndex.value > -1 && !activeId.value) {\n if (tabs.value[activeIndex.value]?.id) {\n activeId.value = tabs.value[activeIndex.value]?.id\n } else {\n updateInitialActiveId = true\n }\n} else if (activeIndex.value === -1 && !activeId.value && !isChildActive.value) {\n activeIndex.value = tabs.value.findIndex((t) => t.disabled === undefined || t.disabled === false)\n activeId.value = tabs.value[activeIndex.value]?.id\n} else if (activeIndex.value === -1 && !activeId.value && isChildActive.value) {\n activeIndex.value = tabs.value.findIndex(\n (t) =>\n t.active !== undefined &&\n t.active !== false &&\n (t.disabled === undefined || t.disabled === false)\n )\n activeId.value = tabs.value[activeIndex.value]?.id\n}\n\nfunction updateInitialIndexAndId() {\n // we get the computedIds after registering the tabs\n if (updateInitialActiveIndex) {\n const index = tabs.value.findIndex((t) => t.id === activeId.value)\n if (index !== -1) {\n nextTick(() => {\n activeIndex.value = index\n updateInitialActiveIndex = false\n })\n }\n }\n if (updateInitialActiveId) {\n // Wait for tabs to be registered if we're doing delayed selection\n if (delayedTabSelection && tabsInternal.value.length === 0) {\n // Children haven't registered yet, wait\n return\n }\n if (activeIndex.value > -1 && tabs.value[activeIndex.value]?.id) {\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n updateInitialActiveId = false\n delayedTabSelection = false\n })\n }\n }\n}\n\nupdateInitialIndexAndId()\n\nconst showEmpty = computed(() => !(tabs?.value && tabs.value.length > 0))\n\nconst tabContentProps = computed(() => ({\n contentClass: props.contentClass,\n showEmpty: showEmpty.value,\n card: props.card,\n}))\n\nconst computedClasses = computed(() => ({\n 'd-flex': props.vertical,\n 'align-items-start': props.vertical,\n}))\n\nconst alignment = useAlignment(() => props.align)\n\nconst navTabsClasses = computed(() => ({\n 'nav-pills': props.pills,\n 'nav-underline': props.underline,\n 'flex-column me-3': props.vertical,\n [alignment.value]: props.align !== undefined,\n 'nav-fill': props.fill,\n 'card-header-tabs': props.card && !props.pills && !props.underline,\n 'card-header-pills': props.card && props.pills,\n 'nav-justified': props.justified,\n 'nav-tabs': !props.noNavStyle && !props.pills && !props.underline,\n 'small': props.small,\n}))\n\nconst handleClick = (event: Readonly<MouseEvent>, index: number) => {\n if (\n index >= 0 &&\n !tabs.value[index]?.disabled &&\n tabs.value[index]?.onClick &&\n typeof tabs.value[index].onClick === 'function'\n ) {\n tabs.value[index].onClick?.(event)\n if (event.defaultPrevented) {\n getSafeDocument()?.getElementById(tabs.value[index].buttonId)?.blur()\n return\n }\n }\n activeIndex.value = index\n}\n\nconst keynav = (e: Event, direction: number) => {\n if (tabs.value.length <= 0 || props.noKeyNav) return\n e.preventDefault()\n e.stopPropagation()\n activeIndex.value = nextIndex(activeIndex.value + direction, direction)\n nextTick(() => {\n if (activeIndex.value >= 0) {\n getSafeDocument()?.getElementById(tabs.value[activeIndex.value]?.buttonId)?.focus()\n }\n })\n}\n\nconst nextIndex = (start: number, direction: number) => {\n let index = start\n let minIdx = -1\n let maxIdx = -1\n\n for (let i = 0; i < tabs.value.length; i++) {\n if (!tabs.value[i]?.disabled) {\n if (minIdx === -1) minIdx = i\n maxIdx = i\n }\n }\n\n while (index >= minIdx && index <= maxIdx && tabs.value[index]?.disabled) {\n index += direction\n }\n\n if (index < minIdx) index = minIdx\n if (index > maxIdx) index = maxIdx\n\n return index\n}\n\nlet previousIndex: number | undefined\nlet isReverting = false\nwatch(activeIndex, (newValue, oldValue) => {\n // Early exit if there are no tabs or all tabs are disabled\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n\n // If we're reverting due to a prevented event, don't process further\n if (isReverting) {\n isReverting = false\n return\n }\n // Calculate the next valid index\n const index = nextIndex(newValue, newValue > oldValue ? 1 : -1)\n if (index !== newValue) {\n // If the index is not the same as the new value, set the previous index to the old value\n // this is to prevent the event from being emitted twice\n previousIndex = oldValue\n activeIndex.value = index\n return\n }\n // Emit the activate-tab event\n const tabEvent = new BvEvent('activate-tab', {cancelable: true})\n emit('activate-tab', {\n newTabId: tabs.value[index]?.id,\n prevTabId: tabs.value[previousIndex ?? oldValue]?.id,\n newTabIndex: index,\n prevTabIndex: previousIndex ?? oldValue,\n event: tabEvent,\n })\n // If the event is prevented, revert to the previous index\n if (tabEvent.defaultPrevented) {\n isReverting = true\n const prev = previousIndex ?? oldValue ?? nextIndex(0, 1)\n previousIndex = undefined\n // Update the active id this will also trigger the activeId watch which will update the activeIndex\n // this is to make sure we handle case that starts with id change.\n if (activeId.value !== tabs.value[prev]?.id) {\n activeId.value = tabs.value[prev]?.id\n }\n nextTick(() => {\n if (prev >= 0) {\n getSafeDocument()?.getElementById(tabs.value[prev]?.buttonId)?.focus()\n }\n })\n return\n }\n\n // Update the active id\n if (activeId.value !== tabs.value[index]?.id) {\n activeId.value = tabs.value[index]?.id\n }\n previousIndex = undefined\n})\n\nwatch(activeId, (newValue, oldValue) => {\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n const index = tabs.value.findIndex((t) => t.id === newValue)\n // If the new tab is the same as the current tab, do nothing\n if (index === activeIndex.value) return\n const oldIndex = tabs.value.findIndex((t) => t.id === oldValue)\n // If the new tab is disabled, find the next enabled tab\n if (tabs.value[index]?.disabled) {\n // activeIndex watcher will update the activeId to the next enabled tab\n activeIndex.value = nextIndex(index, index > oldIndex ? 1 : -1)\n return\n }\n // If the new tab is not found, find the first enabled tab\n if (index === -1) {\n // activeIndex watcher will update the activeId to the first enabled tab\n activeIndex.value = nextIndex(0, 1)\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n })\n return\n }\n // change to the next tab\n activeIndex.value = index\n})\n\nconst registerTab = (tab: Ref<TabType>) => {\n const idx = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n if (idx === -1) {\n tabsInternal.value.push(tab)\n if (initialized) {\n nextTick(() => {\n sortTabs()\n })\n } else {\n // If we're doing delayed tab selection, try to update now that a tab has registered\n if (delayedTabSelection) {\n nextTick(() => {\n updateInitialIndexAndId()\n })\n }\n }\n } else {\n tabsInternal.value[idx] = tab\n if (initialized) {\n // sort just in case the tab was moved\n sortTabs()\n }\n }\n const idx2 = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n return tab.value.id ?? (!initialized ? initialIds.value[idx2] : tab.value.internalId)\n}\n\nonMounted(() => {\n updateInitialIndexAndId()\n sortTabs()\n initialized = true\n})\n\nconst sortTabs = () => {\n tabsInternal.value.sort((a, b) => sortSlotElementsByPosition(a.value.el.value, b.value.el.value))\n if (\n activeId.value &&\n activeIndex.value !== tabs.value.findIndex((t) => t.id === activeId.value)\n ) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n }\n}\n\nconst unregisterTab = (id: string) => {\n tabsInternal.value = tabsInternal.value.filter((t) => t.value.internalId !== id)\n}\n\nprovide(tabsInjectionKey, {\n lazy: toRef(() => props.lazy),\n card: toRef(() => props.card),\n noFade: toRef(() => props.noFade),\n activeTabClass: toRef(() => props.activeTabClass),\n inactiveTabClass: toRef(() => props.inactiveTabClass),\n tabClass: toRef(() => props.tabClass),\n registerTab,\n unregisterTab,\n activeId,\n activateTab: (internalId) => {\n const idx = tabs.value.findIndex((t) => t.internalId === internalId)\n if (internalId === undefined || idx === -1) {\n activeIndex.value = nextIndex(0, 1)\n return\n }\n activeIndex.value = idx\n },\n})\n</script>\n","<template>\n <component :is=\"props.tag\" :id=\"props.id\" class=\"tabs\" :class=\"computedClasses\">\n <BTabsTabContent v-if=\"props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n <div\n :class=\"[\n props.navWrapperClass,\n {'card-header': props.card, 'ms-auto': vertical && props.end},\n ]\"\n >\n <ul\n class=\"nav\"\n :class=\"[navTabsClasses, props.navClass]\"\n role=\"tablist\"\n :aria-orientation=\"props.vertical ? 'vertical' : 'horizontal'\"\n >\n <slot name=\"tabs-start\" />\n <li\n v-for=\"(tab, idx) in tabs\"\n :key=\"tab.id ?? tab.internalId\"\n class=\"nav-item\"\n :class=\"tab.titleItemClass\"\n role=\"presentation\"\n >\n <button\n :id=\"tab.buttonId\"\n class=\"nav-link\"\n :class=\"[tab.navItemClasses, tab.titleLinkClass, tab.active ? props.activeNavLinkClass : props.inactiveNavLinkClass]\"\n role=\"tab\"\n :aria-controls=\"tab.id\"\n :aria-selected=\"tab.active\"\n :disabled=\"tab.disabled\"\n :tabindex=\"props.noKeyNav ? undefined : tab.active ? undefined : -1\"\n type=\"button\"\n v-bind=\"tab.titleLinkAttrs\"\n @keydown.left.exact=\"!props.vertical && keynav($event, -1)\"\n @keydown.left.shift=\"!props.vertical && keynav($event, -999)\"\n @keydown.up.exact=\"props.vertical && keynav($event, -1)\"\n @keydown.up.shift=\"props.vertical && keynav($event, -999)\"\n @keydown.right.exact=\"!props.vertical && keynav($event, 1)\"\n @keydown.right.shift=\"!props.vertical && keynav($event, 999)\"\n @keydown.down.exact=\"props.vertical && keynav($event, 1)\"\n @keydown.down.shift=\"props.vertical && keynav($event, 999)\"\n @keydown.page-up=\"keynav($event, -999)\"\n @keydown.page-down=\"keynav($event, 999)\"\n @keydown.home=\"keynav($event, -999)\"\n @keydown.end=\"keynav($event, 999)\"\n @click.stop=\"(e) => handleClick(e, idx)\"\n >\n <component :is=\"tab.titleComponent\" v-if=\"tab.titleComponent\" />\n <template v-else>\n {{ tab.title }}\n </template>\n </button>\n </li>\n <slot name=\"tabs-end\" />\n </ul>\n </div>\n <BTabsTabContent v-if=\"!props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n type Ref,\n ref,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {BvEvent} from '../../utils/classes'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useId} from '../../composables/useId'\nimport type {TabType, BTabsProps, BTabsEmits, BTabsSlots} from '../../types'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {getSafeDocument, sortSlotElementsByPosition} from '../../utils/dom'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport BTab from './BTab.vue'\nimport BTabsTabContent from '../BTabsTabContent.vue'\n\nconst _props = withDefaults(defineProps<Omit<BTabsProps, 'modelValue' | 'activeIndex'>>(), {\n activeNavItemClass: undefined,\n activeNavLinkClass: undefined,\n activeTabClass: undefined,\n align: undefined,\n card: false,\n contentClass: undefined,\n end: false,\n fill: false,\n id: undefined,\n inactiveNavItemClass: undefined,\n inactiveNavLinkClass: undefined,\n inactiveTabClass: undefined,\n justified: false,\n lazy: false,\n navClass: undefined,\n navItemClass: undefined,\n navWrapperClass: undefined,\n noFade: false,\n noKeyNav: false,\n noNavStyle: false,\n pills: false,\n small: false,\n tag: 'div',\n tabClass: undefined,\n underline: false,\n vertical: false,\n})\nconst props = useDefaults(_props, 'BTabs')\nconst emit = defineEmits<BTabsEmits>()\nconst slots = defineSlots<BTabsSlots>()\n\nconst activeIndex = defineModel<Exclude<BTabsProps['index'], undefined>>('index', {\n default: -1,\n})\nconst activeId = defineModel<BTabsProps['modelValue']>({\n default: undefined,\n})\n\nconst tabsInternal = ref<Ref<TabType>[]>([])\n\nconst tabElementsArray = ref<VNode[]>([])\n\nconst isChildActive = ref(false)\nconst initialIds = ref<string[]>([])\nconst selectedTabHasExplicitId = ref(false)\n\nconst updateTabElementsArray = () => {\n const tabElements = flattenFragments(slots.default?.({}) ?? [])\n tabElementsArray.value = (Array.isArray(tabElements) ? tabElements : [tabElements]).filter(\n (tab) => tab.type === BTab\n )\n // only get the ids once in setup context\n if (initialIds.value.length === 0) {\n // we need to get the ids of the tabs before they are registered. After that we use the internalId for the tabpane\n initialIds.value = tabElementsArray.value.map((tab) =>\n unref(useId(() => tab.props?.id, 'tabpane'))\n )\n // Whether the *initially selected* tab carries an explicit ID.\n //\n // Only that tab matters. The delayed-selection path below exists because\n // a generated ID is not final until the child registers; an explicit ID\n // is final immediately. Asking `.some()` across every tab got this wrong\n // for a mixed list — a single ID-bearing sibling made an ID-less target\n // look safe, so the ID was read pre-mount, failed to match after\n // registration, and the selection fell back to the first tab (#2773).\n selectedTabHasExplicitId.value =\n activeIndex.value > -1 && tabElementsArray.value[activeIndex.value]?.props?.id !== undefined\n }\n isChildActive.value = tabElementsArray.value.some(\n (tab) => tab.props?.active !== undefined && tab.props?.active !== false\n )\n}\nupdateTabElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateTabElementsArray()\n nextTick(() => {\n sortTabs()\n })\n }\n)\n\nconst tabs = computed(() => {\n if (tabsInternal.value.length === 0) {\n // fail back on the slot elements, the children haven't been registered yet\n const _activeIndex = tabElementsArray.value.findIndex(\n (tab) =>\n (tab.props?.active !== undefined &&\n (tab.props.disabled === false || tab.props.disabled === undefined)) ||\n (activeId.value && tab.props?.id === activeId.value)\n )\n return tabElementsArray.value.map((tab, index) => {\n const active =\n _activeIndex !== -1\n ? index === _activeIndex\n : activeIndex.value > -1\n ? index === activeIndex.value\n : index === 0\n return {\n id: tab.props?.id ?? initialIds.value[index],\n internalId: `premount-${index}`, // temporary id for the tab\n buttonId: tab.props?.buttonId,\n disabled: tab.props?.disabled,\n title: tab.props?.title,\n titleComponent: (tab.children as {title: unknown})?.title,\n titleItemClass: tab.props?.titleItemClass,\n titleLinkAttrs: tab.props?.titleLinkAttrs,\n titleLinkClass: tab.props?.titleLinkClass,\n onClick: tab.props?.onClick,\n active,\n navItemClasses: [\n {\n active,\n disabled: !(tab.props?.disabled === false || tab.props?.disabled === undefined),\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n }\n return tabsInternal.value.map((_tab) => {\n const tab = unref(_tab)\n const active = tab.id === activeId.value\n\n return {\n ...tab,\n active,\n navItemClasses: [\n {\n active,\n disabled: tab.disabled,\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n})\n\nlet initialized = false\nlet updateInitialActiveIndex = false\nlet updateInitialActiveId = false\nlet delayedTabSelection = false\n\n// Check if we need to delay tab selection:\n// - We have v-model:index (activeIndex) but no v-model (activeId)\n// - AND the selected tab has no explicit ID (so it will use a generated one)\n// - AND we have tabs to select from\nconst needsDelayedSelection =\n activeIndex.value > -1 &&\n !activeId.value &&\n !selectedTabHasExplicitId.value &&\n tabElementsArray.value.length > 0\n\nif (needsDelayedSelection) {\n // Delay tab selection until children register with their generated IDs\n delayedTabSelection = true\n updateInitialActiveId = true\n} else if (activeIndex.value === -1 && activeId.value) {\n if (tabs.value.findIndex((t) => t.id === activeId.value) !== -1) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n } else {\n updateInitialActiveIndex = true\n }\n} else if (activeIndex.value > -1 && !activeId.value) {\n if (tabs.value[activeIndex.value]?.id) {\n activeId.value = tabs.value[activeIndex.value]?.id\n } else {\n updateInitialActiveId = true\n }\n} else if (activeIndex.value === -1 && !activeId.value && !isChildActive.value) {\n activeIndex.value = tabs.value.findIndex((t) => t.disabled === undefined || t.disabled === false)\n activeId.value = tabs.value[activeIndex.value]?.id\n} else if (activeIndex.value === -1 && !activeId.value && isChildActive.value) {\n activeIndex.value = tabs.value.findIndex(\n (t) =>\n t.active !== undefined &&\n t.active !== false &&\n (t.disabled === undefined || t.disabled === false)\n )\n activeId.value = tabs.value[activeIndex.value]?.id\n}\n\nfunction updateInitialIndexAndId() {\n // we get the computedIds after registering the tabs\n if (updateInitialActiveIndex) {\n const index = tabs.value.findIndex((t) => t.id === activeId.value)\n if (index !== -1) {\n nextTick(() => {\n activeIndex.value = index\n updateInitialActiveIndex = false\n })\n }\n }\n if (updateInitialActiveId) {\n // Wait for tabs to be registered if we're doing delayed selection\n if (delayedTabSelection && tabsInternal.value.length === 0) {\n // Children haven't registered yet, wait\n return\n }\n if (activeIndex.value > -1 && tabs.value[activeIndex.value]?.id) {\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n updateInitialActiveId = false\n delayedTabSelection = false\n })\n }\n }\n}\n\nupdateInitialIndexAndId()\n\nconst showEmpty = computed(() => !(tabs?.value && tabs.value.length > 0))\n\nconst tabContentProps = computed(() => ({\n contentClass: props.contentClass,\n showEmpty: showEmpty.value,\n card: props.card,\n}))\n\nconst computedClasses = computed(() => ({\n 'd-flex': props.vertical,\n 'align-items-start': props.vertical,\n}))\n\nconst alignment = useAlignment(() => props.align)\n\nconst navTabsClasses = computed(() => ({\n 'nav-pills': props.pills,\n 'nav-underline': props.underline,\n 'flex-column me-3': props.vertical,\n [alignment.value]: props.align !== undefined,\n 'nav-fill': props.fill,\n 'card-header-tabs': props.card && !props.pills && !props.underline,\n 'card-header-pills': props.card && props.pills,\n 'nav-justified': props.justified,\n 'nav-tabs': !props.noNavStyle && !props.pills && !props.underline,\n 'small': props.small,\n}))\n\nconst handleClick = (event: Readonly<MouseEvent>, index: number) => {\n if (\n index >= 0 &&\n !tabs.value[index]?.disabled &&\n tabs.value[index]?.onClick &&\n typeof tabs.value[index].onClick === 'function'\n ) {\n tabs.value[index].onClick?.(event)\n if (event.defaultPrevented) {\n getSafeDocument()?.getElementById(tabs.value[index].buttonId)?.blur()\n return\n }\n }\n activeIndex.value = index\n}\n\nconst keynav = (e: Event, direction: number) => {\n if (tabs.value.length <= 0 || props.noKeyNav) return\n e.preventDefault()\n e.stopPropagation()\n activeIndex.value = nextIndex(activeIndex.value + direction, direction)\n nextTick(() => {\n if (activeIndex.value >= 0) {\n getSafeDocument()?.getElementById(tabs.value[activeIndex.value]?.buttonId)?.focus()\n }\n })\n}\n\nconst nextIndex = (start: number, direction: number) => {\n let index = start\n let minIdx = -1\n let maxIdx = -1\n\n for (let i = 0; i < tabs.value.length; i++) {\n if (!tabs.value[i]?.disabled) {\n if (minIdx === -1) minIdx = i\n maxIdx = i\n }\n }\n\n while (index >= minIdx && index <= maxIdx && tabs.value[index]?.disabled) {\n index += direction\n }\n\n if (index < minIdx) index = minIdx\n if (index > maxIdx) index = maxIdx\n\n return index\n}\n\nlet previousIndex: number | undefined\nlet isReverting = false\nwatch(activeIndex, (newValue, oldValue) => {\n // Early exit if there are no tabs or all tabs are disabled\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n\n // If we're reverting due to a prevented event, don't process further\n if (isReverting) {\n isReverting = false\n return\n }\n // Calculate the next valid index\n const index = nextIndex(newValue, newValue > oldValue ? 1 : -1)\n if (index !== newValue) {\n // If the index is not the same as the new value, set the previous index to the old value\n // this is to prevent the event from being emitted twice\n previousIndex = oldValue\n activeIndex.value = index\n return\n }\n // Emit the activate-tab event\n const tabEvent = new BvEvent('activate-tab', {cancelable: true})\n emit('activate-tab', {\n newTabId: tabs.value[index]?.id,\n prevTabId: tabs.value[previousIndex ?? oldValue]?.id,\n newTabIndex: index,\n prevTabIndex: previousIndex ?? oldValue,\n event: tabEvent,\n })\n // If the event is prevented, revert to the previous index\n if (tabEvent.defaultPrevented) {\n isReverting = true\n const prev = previousIndex ?? oldValue ?? nextIndex(0, 1)\n previousIndex = undefined\n // Update the active id this will also trigger the activeId watch which will update the activeIndex\n // this is to make sure we handle case that starts with id change.\n if (activeId.value !== tabs.value[prev]?.id) {\n activeId.value = tabs.value[prev]?.id\n }\n nextTick(() => {\n if (prev >= 0) {\n getSafeDocument()?.getElementById(tabs.value[prev]?.buttonId)?.focus()\n }\n })\n return\n }\n\n // Update the active id\n if (activeId.value !== tabs.value[index]?.id) {\n activeId.value = tabs.value[index]?.id\n }\n previousIndex = undefined\n})\n\nwatch(activeId, (newValue, oldValue) => {\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n const index = tabs.value.findIndex((t) => t.id === newValue)\n // If the new tab is the same as the current tab, do nothing\n if (index === activeIndex.value) return\n const oldIndex = tabs.value.findIndex((t) => t.id === oldValue)\n // If the new tab is disabled, find the next enabled tab\n if (tabs.value[index]?.disabled) {\n // activeIndex watcher will update the activeId to the next enabled tab\n activeIndex.value = nextIndex(index, index > oldIndex ? 1 : -1)\n return\n }\n // If the new tab is not found, find the first enabled tab\n if (index === -1) {\n // activeIndex watcher will update the activeId to the first enabled tab\n activeIndex.value = nextIndex(0, 1)\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n })\n return\n }\n // change to the next tab\n activeIndex.value = index\n})\n\nconst registerTab = (tab: Ref<TabType>) => {\n const idx = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n if (idx === -1) {\n tabsInternal.value.push(tab)\n if (initialized) {\n nextTick(() => {\n sortTabs()\n })\n } else {\n // If we're doing delayed tab selection, try to update now that a tab has registered\n if (delayedTabSelection) {\n nextTick(() => {\n updateInitialIndexAndId()\n })\n }\n }\n } else {\n tabsInternal.value[idx] = tab\n if (initialized) {\n // sort just in case the tab was moved\n sortTabs()\n }\n }\n const idx2 = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n return tab.value.id ?? (!initialized ? initialIds.value[idx2] : tab.value.internalId)\n}\n\nonMounted(() => {\n updateInitialIndexAndId()\n sortTabs()\n initialized = true\n})\n\nconst sortTabs = () => {\n tabsInternal.value.sort((a, b) => sortSlotElementsByPosition(a.value.el.value, b.value.el.value))\n if (\n activeId.value &&\n activeIndex.value !== tabs.value.findIndex((t) => t.id === activeId.value)\n ) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n }\n}\n\nconst unregisterTab = (id: string) => {\n tabsInternal.value = tabsInternal.value.filter((t) => t.value.internalId !== id)\n}\n\nprovide(tabsInjectionKey, {\n lazy: toRef(() => props.lazy),\n card: toRef(() => props.card),\n noFade: toRef(() => props.noFade),\n activeTabClass: toRef(() => props.activeTabClass),\n inactiveTabClass: toRef(() => props.inactiveTabClass),\n tabClass: toRef(() => props.tabClass),\n registerTab,\n unregisterTab,\n activeId,\n activateTab: (internalId) => {\n const idx = tabs.value.findIndex((t) => t.internalId === internalId)\n if (internalId === undefined || idx === -1) {\n activeIndex.value = nextIndex(0, 1)\n return\n }\n activeIndex.value = idx\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,QAAA,SAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"BTabs-Cfe8HOGE.js","names":[],"sources":["../src/components/BTabs/BTab.vue","../src/components/BTabs/BTab.vue","../src/components/BTabsTabContent.vue","../src/components/BTabsTabContent.vue","../src/components/BTabs/BTabs.vue","../src/components/BTabs/BTabs.vue"],"sourcesContent":["<template>\n <component\n :is=\"props.tag\"\n :id=\"computedId\"\n ref=\"_el\"\n class=\"tab-pane\"\n :class=\"computedClasses\"\n role=\"tabpanel\"\n :aria-labelledby=\"computedButtonId\"\n v-bind=\"processedAttrs\"\n >\n <slot v-if=\"showSlot\" />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, inject, onUnmounted, ref, useAttrs, useTemplateRef, watch} from 'vue'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {TabType} from '../../types/Tab'\nimport type {BTabProps} from '../../types/ComponentProps'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport type {BTabSlots} from '../../types/ComponentSlots'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BTabProps, 'active'>>(), {\n buttonId: undefined,\n disabled: false,\n id: undefined,\n lazy: undefined,\n unmountLazy: undefined,\n noBody: false,\n tag: 'div',\n title: undefined,\n titleItemClass: undefined,\n titleLinkAttrs: undefined,\n titleLinkClass: undefined,\n})\nconst props = useDefaults(_props, 'BTab')\nconst slots = defineSlots<BTabSlots>()\nconst attrs = useAttrs()\n\nconst activeModel = defineModel<Exclude<BTabProps['active'], undefined>>('active', {\n default: false,\n})\n\nconst parentData = inject(tabsInjectionKey, null)\n\nconst localId = ref(props.id)\nconst internalId = useId('', 'tabpane')\nconst computedId = computed(() => props.id ?? localId.value ?? internalId.value)\nconst computedButtonId = useId(() => props.buttonId, 'tab')\n\nconst lazyRenderCompleted = ref(false)\nconst el = useTemplateRef('_el')\n\nconst processedAttrs = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {onClick: _, ...tabAttrs} = attrs\n return tabAttrs\n})\n\nfunction updateTab() {\n if (!parentData) return\n const newId = parentData.registerTab(\n computed(\n () =>\n ({\n internalId: internalId.value,\n id: computedId.value,\n active: activeModel.value,\n buttonId: computedButtonId.value,\n disabled: props.disabled,\n title: props.title,\n titleComponent: slots.title,\n titleItemClass: props.titleItemClass,\n titleLinkAttrs: props.titleLinkAttrs,\n titleLinkClass: props.titleLinkClass,\n onClick: attrs.onClick,\n el,\n }) as TabType\n )\n )\n if (newId !== localId.value) {\n localId.value = newId\n }\n}\n\nif (parentData) {\n updateTab()\n if (activeModel.value) {\n parentData.activateTab(internalId.value)\n }\n}\n\nonUnmounted(() => {\n if (!parentData) return\n parentData.unregisterTab(internalId.value)\n})\n\nconst isActive = computed(() => parentData?.activeId.value === computedId.value)\nconst show = ref(isActive.value)\n\nconst computedLazy = computed(() => !!(parentData?.lazy.value || props.lazy))\n\nconst computedActive = computed(() => isActive.value && !props.disabled)\nconst showSlot = computed(\n () =>\n computedActive.value ||\n !computedLazy.value ||\n (computedLazy.value && !props.unmountLazy && lazyRenderCompleted.value)\n)\n\nwatch(showSlot, (shown) => {\n if (shown && !lazyRenderCompleted.value) lazyRenderCompleted.value = true\n})\n\nwatch(isActive, (active) => {\n if (active) {\n activeModel.value = true\n setTimeout(() => {\n show.value = true\n }, 0)\n return\n }\n show.value = false\n activeModel.value = false\n})\n\nwatch(activeModel, (active) => {\n if (props.disabled) {\n activeModel.value = false\n return\n }\n if (!parentData) return\n if (!active) {\n if (isActive.value) {\n parentData.activateTab(undefined)\n }\n return\n }\n if (!isActive.value) {\n parentData.activateTab(internalId.value)\n }\n})\n\nconst computedClasses = computed(() => [\n {\n 'active': isActive.value,\n 'show': show.value,\n 'card-body': parentData?.card.value && props.noBody === false,\n 'fade': !parentData?.noFade.value,\n },\n show.value ? parentData?.activeTabClass.value : parentData?.inactiveTabClass.value,\n parentData?.tabClass.value,\n])\n\ndefineExpose({\n activate: () => {\n activeModel.value = true\n },\n deactivate: () => {\n activeModel.value = false\n },\n})\n</script>\n","<template>\n <component\n :is=\"props.tag\"\n :id=\"computedId\"\n ref=\"_el\"\n class=\"tab-pane\"\n :class=\"computedClasses\"\n role=\"tabpanel\"\n :aria-labelledby=\"computedButtonId\"\n v-bind=\"processedAttrs\"\n >\n <slot v-if=\"showSlot\" />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, inject, onUnmounted, ref, useAttrs, useTemplateRef, watch} from 'vue'\nimport {useId} from '../../composables/useId'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {TabType} from '../../types/Tab'\nimport type {BTabProps} from '../../types/ComponentProps'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport type {BTabSlots} from '../../types/ComponentSlots'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<Omit<BTabProps, 'active'>>(), {\n buttonId: undefined,\n disabled: false,\n id: undefined,\n lazy: undefined,\n unmountLazy: undefined,\n noBody: false,\n tag: 'div',\n title: undefined,\n titleItemClass: undefined,\n titleLinkAttrs: undefined,\n titleLinkClass: undefined,\n})\nconst props = useDefaults(_props, 'BTab')\nconst slots = defineSlots<BTabSlots>()\nconst attrs = useAttrs()\n\nconst activeModel = defineModel<Exclude<BTabProps['active'], undefined>>('active', {\n default: false,\n})\n\nconst parentData = inject(tabsInjectionKey, null)\n\nconst localId = ref(props.id)\nconst internalId = useId('', 'tabpane')\nconst computedId = computed(() => props.id ?? localId.value ?? internalId.value)\nconst computedButtonId = useId(() => props.buttonId, 'tab')\n\nconst lazyRenderCompleted = ref(false)\nconst el = useTemplateRef('_el')\n\nconst processedAttrs = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {onClick: _, ...tabAttrs} = attrs\n return tabAttrs\n})\n\nfunction updateTab() {\n if (!parentData) return\n const newId = parentData.registerTab(\n computed(\n () =>\n ({\n internalId: internalId.value,\n id: computedId.value,\n active: activeModel.value,\n buttonId: computedButtonId.value,\n disabled: props.disabled,\n title: props.title,\n titleComponent: slots.title,\n titleItemClass: props.titleItemClass,\n titleLinkAttrs: props.titleLinkAttrs,\n titleLinkClass: props.titleLinkClass,\n onClick: attrs.onClick,\n el,\n }) as TabType\n )\n )\n if (newId !== localId.value) {\n localId.value = newId\n }\n}\n\nif (parentData) {\n updateTab()\n if (activeModel.value) {\n parentData.activateTab(internalId.value)\n }\n}\n\nonUnmounted(() => {\n if (!parentData) return\n parentData.unregisterTab(internalId.value)\n})\n\nconst isActive = computed(() => parentData?.activeId.value === computedId.value)\nconst show = ref(isActive.value)\n\nconst computedLazy = computed(() => !!(parentData?.lazy.value || props.lazy))\n\nconst computedActive = computed(() => isActive.value && !props.disabled)\nconst showSlot = computed(\n () =>\n computedActive.value ||\n !computedLazy.value ||\n (computedLazy.value && !props.unmountLazy && lazyRenderCompleted.value)\n)\n\nwatch(showSlot, (shown) => {\n if (shown && !lazyRenderCompleted.value) lazyRenderCompleted.value = true\n})\n\nwatch(isActive, (active) => {\n if (active) {\n activeModel.value = true\n setTimeout(() => {\n show.value = true\n }, 0)\n return\n }\n show.value = false\n activeModel.value = false\n})\n\nwatch(activeModel, (active) => {\n if (props.disabled) {\n activeModel.value = false\n return\n }\n if (!parentData) return\n if (!active) {\n if (isActive.value) {\n parentData.activateTab(undefined)\n }\n return\n }\n if (!isActive.value) {\n parentData.activateTab(internalId.value)\n }\n})\n\nconst computedClasses = computed(() => [\n {\n 'active': isActive.value,\n 'show': show.value,\n 'card-body': parentData?.card.value && props.noBody === false,\n 'fade': !parentData?.noFade.value,\n },\n show.value ? parentData?.activeTabClass.value : parentData?.inactiveTabClass.value,\n parentData?.tabClass.value,\n])\n\ndefineExpose({\n activate: () => {\n activeModel.value = true\n },\n deactivate: () => {\n activeModel.value = false\n },\n})\n</script>\n","<template>\n <div class=\"tab-content\" :class=\"contentClass\">\n <slot />\n <div v-if=\"showEmpty\" key=\"bv-empty-tab\" class=\"tab-pane active\" :class=\"{'card-body': card}\">\n <slot name=\"empty\" />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport type {ClassValue} from '../types/AnyValuedAttributes'\n\ndefineProps<{\n contentClass: ClassValue | undefined\n showEmpty: boolean\n card: boolean\n}>()\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\ndefineSlots<{\n default?: (props: Record<string, never>) => any\n empty?: (props: Record<string, never>) => any\n}>()\n/* eslint-enable @typescript-eslint/no-explicit-any */\n</script>\n","<template>\n <div class=\"tab-content\" :class=\"contentClass\">\n <slot />\n <div v-if=\"showEmpty\" key=\"bv-empty-tab\" class=\"tab-pane active\" :class=\"{'card-body': card}\">\n <slot name=\"empty\" />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport type {ClassValue} from '../types/AnyValuedAttributes'\n\ndefineProps<{\n contentClass: ClassValue | undefined\n showEmpty: boolean\n card: boolean\n}>()\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\ndefineSlots<{\n default?: (props: Record<string, never>) => any\n empty?: (props: Record<string, never>) => any\n}>()\n/* eslint-enable @typescript-eslint/no-explicit-any */\n</script>\n","<template>\n <component :is=\"props.tag\" :id=\"props.id\" class=\"tabs\" :class=\"computedClasses\">\n <BTabsTabContent v-if=\"props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n <div\n :class=\"[\n props.navWrapperClass,\n {'card-header': props.card, 'ms-auto': vertical && props.end},\n ]\"\n >\n <ul\n class=\"nav\"\n :class=\"[navTabsClasses, props.navClass]\"\n role=\"tablist\"\n :aria-orientation=\"props.vertical ? 'vertical' : 'horizontal'\"\n >\n <slot name=\"tabs-start\" />\n <li\n v-for=\"(tab, idx) in tabs\"\n :key=\"tab.id ?? tab.internalId\"\n class=\"nav-item\"\n :class=\"tab.titleItemClass\"\n role=\"presentation\"\n >\n <button\n :id=\"tab.buttonId\"\n class=\"nav-link\"\n :class=\"[tab.navItemClasses, tab.titleLinkClass, tab.active ? props.activeNavLinkClass : props.inactiveNavLinkClass]\"\n role=\"tab\"\n :aria-controls=\"tab.id\"\n :aria-selected=\"tab.active\"\n :disabled=\"tab.disabled\"\n :tabindex=\"props.noKeyNav ? undefined : tab.active ? undefined : -1\"\n type=\"button\"\n v-bind=\"tab.titleLinkAttrs\"\n @keydown.left.exact=\"!props.vertical && keynav($event, -1)\"\n @keydown.left.shift=\"!props.vertical && keynav($event, -999)\"\n @keydown.up.exact=\"props.vertical && keynav($event, -1)\"\n @keydown.up.shift=\"props.vertical && keynav($event, -999)\"\n @keydown.right.exact=\"!props.vertical && keynav($event, 1)\"\n @keydown.right.shift=\"!props.vertical && keynav($event, 999)\"\n @keydown.down.exact=\"props.vertical && keynav($event, 1)\"\n @keydown.down.shift=\"props.vertical && keynav($event, 999)\"\n @keydown.page-up=\"keynav($event, -999)\"\n @keydown.page-down=\"keynav($event, 999)\"\n @keydown.home=\"keynav($event, -999)\"\n @keydown.end=\"keynav($event, 999)\"\n @click.stop=\"(e) => handleClick(e, idx)\"\n >\n <component :is=\"tab.titleComponent\" v-if=\"tab.titleComponent\" />\n <template v-else>\n {{ tab.title }}\n </template>\n </button>\n </li>\n <slot name=\"tabs-end\" />\n </ul>\n </div>\n <BTabsTabContent v-if=\"!props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n type Ref,\n ref,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {BvEvent} from '../../utils/classes'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useId} from '../../composables/useId'\nimport type {TabType, BTabsProps, BTabsEmits, BTabsSlots} from '../../types'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {getSafeDocument, sortSlotElementsByPosition} from '../../utils/dom'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport BTab from './BTab.vue'\nimport BTabsTabContent from '../BTabsTabContent.vue'\n\nconst _props = withDefaults(defineProps<Omit<BTabsProps, 'modelValue' | 'activeIndex'>>(), {\n activeNavItemClass: undefined,\n activeNavLinkClass: undefined,\n activeTabClass: undefined,\n align: undefined,\n card: false,\n contentClass: undefined,\n end: false,\n fill: false,\n id: undefined,\n inactiveNavItemClass: undefined,\n inactiveNavLinkClass: undefined,\n inactiveTabClass: undefined,\n justified: false,\n lazy: false,\n navClass: undefined,\n navItemClass: undefined,\n navWrapperClass: undefined,\n noFade: false,\n noKeyNav: false,\n noNavStyle: false,\n pills: false,\n small: false,\n tag: 'div',\n tabClass: undefined,\n underline: false,\n vertical: false,\n})\nconst props = useDefaults(_props, 'BTabs')\nconst emit = defineEmits<BTabsEmits>()\nconst slots = defineSlots<BTabsSlots>()\n\nconst activeIndex = defineModel<Exclude<BTabsProps['index'], undefined>>('index', {\n default: -1,\n})\nconst activeId = defineModel<BTabsProps['modelValue']>({\n default: undefined,\n})\n\nconst tabsInternal = ref<Ref<TabType>[]>([])\n\nconst tabElementsArray = ref<VNode[]>([])\n\nconst isChildActive = ref(false)\nconst initialIds = ref<string[]>([])\nconst selectedTabHasExplicitId = ref(false)\n\nconst updateTabElementsArray = () => {\n const tabElements = flattenFragments(slots.default?.({}) ?? [])\n tabElementsArray.value = (Array.isArray(tabElements) ? tabElements : [tabElements]).filter(\n (tab) => tab.type === BTab\n )\n // only get the ids once in setup context\n if (initialIds.value.length === 0) {\n // we need to get the ids of the tabs before they are registered. After that we use the internalId for the tabpane\n initialIds.value = tabElementsArray.value.map((tab) =>\n unref(useId(() => tab.props?.id, 'tabpane'))\n )\n // Whether the *initially selected* tab carries an explicit ID.\n //\n // Only that tab matters. The delayed-selection path below exists because\n // a generated ID is not final until the child registers; an explicit ID\n // is final immediately. Asking `.some()` across every tab got this wrong\n // for a mixed list — a single ID-bearing sibling made an ID-less target\n // look safe, so the ID was read pre-mount, failed to match after\n // registration, and the selection fell back to the first tab (#2773).\n selectedTabHasExplicitId.value =\n activeIndex.value > -1 && tabElementsArray.value[activeIndex.value]?.props?.id !== undefined\n }\n isChildActive.value = tabElementsArray.value.some(\n (tab) => tab.props?.active !== undefined && tab.props?.active !== false\n )\n}\nupdateTabElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateTabElementsArray()\n nextTick(() => {\n sortTabs()\n })\n }\n)\n\nconst tabs = computed(() => {\n if (tabsInternal.value.length === 0) {\n // fail back on the slot elements, the children haven't been registered yet\n const _activeIndex = tabElementsArray.value.findIndex(\n (tab) =>\n (tab.props?.active !== undefined &&\n (tab.props.disabled === false || tab.props.disabled === undefined)) ||\n (activeId.value && tab.props?.id === activeId.value)\n )\n return tabElementsArray.value.map((tab, index) => {\n const active =\n _activeIndex !== -1\n ? index === _activeIndex\n : activeIndex.value > -1\n ? index === activeIndex.value\n : index === 0\n return {\n id: tab.props?.id ?? initialIds.value[index],\n internalId: `premount-${index}`, // temporary id for the tab\n buttonId: tab.props?.buttonId,\n disabled: tab.props?.disabled,\n title: tab.props?.title,\n titleComponent: (tab.children as {title: unknown})?.title,\n titleItemClass: tab.props?.titleItemClass,\n titleLinkAttrs: tab.props?.titleLinkAttrs,\n titleLinkClass: tab.props?.titleLinkClass,\n onClick: tab.props?.onClick,\n active,\n navItemClasses: [\n {\n active,\n disabled: !(tab.props?.disabled === false || tab.props?.disabled === undefined),\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n }\n return tabsInternal.value.map((_tab) => {\n const tab = unref(_tab)\n const active = tab.id === activeId.value\n\n return {\n ...tab,\n active,\n navItemClasses: [\n {\n active,\n disabled: tab.disabled,\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n})\n\nlet initialized = false\nlet updateInitialActiveIndex = false\nlet updateInitialActiveId = false\nlet delayedTabSelection = false\n\n// Check if we need to delay tab selection:\n// - We have v-model:index (activeIndex) but no v-model (activeId)\n// - AND the selected tab has no explicit ID (so it will use a generated one)\n// - AND we have tabs to select from\nconst needsDelayedSelection =\n activeIndex.value > -1 &&\n !activeId.value &&\n !selectedTabHasExplicitId.value &&\n tabElementsArray.value.length > 0\n\nif (needsDelayedSelection) {\n // Delay tab selection until children register with their generated IDs\n delayedTabSelection = true\n updateInitialActiveId = true\n} else if (activeIndex.value === -1 && activeId.value) {\n if (tabs.value.findIndex((t) => t.id === activeId.value) !== -1) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n } else {\n updateInitialActiveIndex = true\n }\n} else if (activeIndex.value > -1 && !activeId.value) {\n if (tabs.value[activeIndex.value]?.id) {\n activeId.value = tabs.value[activeIndex.value]?.id\n } else {\n updateInitialActiveId = true\n }\n} else if (activeIndex.value === -1 && !activeId.value && !isChildActive.value) {\n activeIndex.value = tabs.value.findIndex((t) => t.disabled === undefined || t.disabled === false)\n activeId.value = tabs.value[activeIndex.value]?.id\n} else if (activeIndex.value === -1 && !activeId.value && isChildActive.value) {\n activeIndex.value = tabs.value.findIndex(\n (t) =>\n t.active !== undefined &&\n t.active !== false &&\n (t.disabled === undefined || t.disabled === false)\n )\n activeId.value = tabs.value[activeIndex.value]?.id\n}\n\nfunction updateInitialIndexAndId() {\n // we get the computedIds after registering the tabs\n if (updateInitialActiveIndex) {\n const index = tabs.value.findIndex((t) => t.id === activeId.value)\n if (index !== -1) {\n nextTick(() => {\n activeIndex.value = index\n updateInitialActiveIndex = false\n })\n }\n }\n if (updateInitialActiveId) {\n // Wait for tabs to be registered if we're doing delayed selection\n if (delayedTabSelection && tabsInternal.value.length === 0) {\n // Children haven't registered yet, wait\n return\n }\n if (activeIndex.value > -1 && tabs.value[activeIndex.value]?.id) {\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n updateInitialActiveId = false\n delayedTabSelection = false\n })\n }\n }\n}\n\nupdateInitialIndexAndId()\n\nconst showEmpty = computed(() => !(tabs?.value && tabs.value.length > 0))\n\nconst tabContentProps = computed(() => ({\n contentClass: props.contentClass,\n showEmpty: showEmpty.value,\n card: props.card,\n}))\n\nconst computedClasses = computed(() => ({\n 'd-flex': props.vertical,\n 'align-items-start': props.vertical,\n}))\n\nconst alignment = useAlignment(() => props.align)\n\nconst navTabsClasses = computed(() => ({\n 'nav-pills': props.pills,\n 'nav-underline': props.underline,\n 'flex-column me-3': props.vertical,\n [alignment.value]: props.align !== undefined,\n 'nav-fill': props.fill,\n 'card-header-tabs': props.card && !props.pills && !props.underline,\n 'card-header-pills': props.card && props.pills,\n 'nav-justified': props.justified,\n 'nav-tabs': !props.noNavStyle && !props.pills && !props.underline,\n 'small': props.small,\n}))\n\nconst handleClick = (event: Readonly<MouseEvent>, index: number) => {\n if (\n index >= 0 &&\n !tabs.value[index]?.disabled &&\n tabs.value[index]?.onClick &&\n typeof tabs.value[index].onClick === 'function'\n ) {\n tabs.value[index].onClick?.(event)\n if (event.defaultPrevented) {\n getSafeDocument()?.getElementById(tabs.value[index].buttonId)?.blur()\n return\n }\n }\n activeIndex.value = index\n}\n\nconst keynav = (e: Event, direction: number) => {\n if (tabs.value.length <= 0 || props.noKeyNav) return\n e.preventDefault()\n e.stopPropagation()\n activeIndex.value = nextIndex(activeIndex.value + direction, direction)\n nextTick(() => {\n if (activeIndex.value >= 0) {\n getSafeDocument()?.getElementById(tabs.value[activeIndex.value]?.buttonId)?.focus()\n }\n })\n}\n\nconst nextIndex = (start: number, direction: number) => {\n let index = start\n let minIdx = -1\n let maxIdx = -1\n\n for (let i = 0; i < tabs.value.length; i++) {\n if (!tabs.value[i]?.disabled) {\n if (minIdx === -1) minIdx = i\n maxIdx = i\n }\n }\n\n while (index >= minIdx && index <= maxIdx && tabs.value[index]?.disabled) {\n index += direction\n }\n\n if (index < minIdx) index = minIdx\n if (index > maxIdx) index = maxIdx\n\n return index\n}\n\nlet previousIndex: number | undefined\nlet isReverting = false\nwatch(activeIndex, (newValue, oldValue) => {\n // Early exit if there are no tabs or all tabs are disabled\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n\n // If we're reverting due to a prevented event, don't process further\n if (isReverting) {\n isReverting = false\n return\n }\n // Calculate the next valid index\n const index = nextIndex(newValue, newValue > oldValue ? 1 : -1)\n if (index !== newValue) {\n // If the index is not the same as the new value, set the previous index to the old value\n // this is to prevent the event from being emitted twice\n previousIndex = oldValue\n activeIndex.value = index\n return\n }\n // Emit the activate-tab event\n const tabEvent = new BvEvent('activate-tab', {cancelable: true})\n emit('activate-tab', {\n newTabId: tabs.value[index]?.id,\n prevTabId: tabs.value[previousIndex ?? oldValue]?.id,\n newTabIndex: index,\n prevTabIndex: previousIndex ?? oldValue,\n event: tabEvent,\n })\n // If the event is prevented, revert to the previous index\n if (tabEvent.defaultPrevented) {\n isReverting = true\n const prev = previousIndex ?? oldValue ?? nextIndex(0, 1)\n previousIndex = undefined\n // Update the active id this will also trigger the activeId watch which will update the activeIndex\n // this is to make sure we handle case that starts with id change.\n if (activeId.value !== tabs.value[prev]?.id) {\n activeId.value = tabs.value[prev]?.id\n }\n nextTick(() => {\n if (prev >= 0) {\n getSafeDocument()?.getElementById(tabs.value[prev]?.buttonId)?.focus()\n }\n })\n return\n }\n\n // Update the active id\n if (activeId.value !== tabs.value[index]?.id) {\n activeId.value = tabs.value[index]?.id\n }\n previousIndex = undefined\n})\n\nwatch(activeId, (newValue, oldValue) => {\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n const index = tabs.value.findIndex((t) => t.id === newValue)\n // If the new tab is the same as the current tab, do nothing\n if (index === activeIndex.value) return\n const oldIndex = tabs.value.findIndex((t) => t.id === oldValue)\n // If the new tab is disabled, find the next enabled tab\n if (tabs.value[index]?.disabled) {\n // activeIndex watcher will update the activeId to the next enabled tab\n activeIndex.value = nextIndex(index, index > oldIndex ? 1 : -1)\n return\n }\n // If the new tab is not found, find the first enabled tab\n if (index === -1) {\n // activeIndex watcher will update the activeId to the first enabled tab\n activeIndex.value = nextIndex(0, 1)\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n })\n return\n }\n // change to the next tab\n activeIndex.value = index\n})\n\nconst registerTab = (tab: Ref<TabType>) => {\n const idx = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n if (idx === -1) {\n tabsInternal.value.push(tab)\n if (initialized) {\n nextTick(() => {\n sortTabs()\n })\n } else {\n // If we're doing delayed tab selection, try to update now that a tab has registered\n if (delayedTabSelection) {\n nextTick(() => {\n updateInitialIndexAndId()\n })\n }\n }\n } else {\n tabsInternal.value[idx] = tab\n if (initialized) {\n // sort just in case the tab was moved\n sortTabs()\n }\n }\n const idx2 = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n return tab.value.id ?? (!initialized ? initialIds.value[idx2] : tab.value.internalId)\n}\n\nonMounted(() => {\n updateInitialIndexAndId()\n sortTabs()\n initialized = true\n})\n\nconst sortTabs = () => {\n tabsInternal.value.sort((a, b) => sortSlotElementsByPosition(a.value.el.value, b.value.el.value))\n if (\n activeId.value &&\n activeIndex.value !== tabs.value.findIndex((t) => t.id === activeId.value)\n ) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n }\n}\n\nconst unregisterTab = (id: string) => {\n tabsInternal.value = tabsInternal.value.filter((t) => t.value.internalId !== id)\n}\n\nprovide(tabsInjectionKey, {\n lazy: toRef(() => props.lazy),\n card: toRef(() => props.card),\n noFade: toRef(() => props.noFade),\n activeTabClass: toRef(() => props.activeTabClass),\n inactiveTabClass: toRef(() => props.inactiveTabClass),\n tabClass: toRef(() => props.tabClass),\n registerTab,\n unregisterTab,\n activeId,\n activateTab: (internalId) => {\n const idx = tabs.value.findIndex((t) => t.internalId === internalId)\n if (internalId === undefined || idx === -1) {\n activeIndex.value = nextIndex(0, 1)\n return\n }\n activeIndex.value = idx\n },\n})\n</script>\n","<template>\n <component :is=\"props.tag\" :id=\"props.id\" class=\"tabs\" :class=\"computedClasses\">\n <BTabsTabContent v-if=\"props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n <div\n :class=\"[\n props.navWrapperClass,\n {'card-header': props.card, 'ms-auto': vertical && props.end},\n ]\"\n >\n <ul\n class=\"nav\"\n :class=\"[navTabsClasses, props.navClass]\"\n role=\"tablist\"\n :aria-orientation=\"props.vertical ? 'vertical' : 'horizontal'\"\n >\n <slot name=\"tabs-start\" />\n <li\n v-for=\"(tab, idx) in tabs\"\n :key=\"tab.id ?? tab.internalId\"\n class=\"nav-item\"\n :class=\"tab.titleItemClass\"\n role=\"presentation\"\n >\n <button\n :id=\"tab.buttonId\"\n class=\"nav-link\"\n :class=\"[tab.navItemClasses, tab.titleLinkClass, tab.active ? props.activeNavLinkClass : props.inactiveNavLinkClass]\"\n role=\"tab\"\n :aria-controls=\"tab.id\"\n :aria-selected=\"tab.active\"\n :disabled=\"tab.disabled\"\n :tabindex=\"props.noKeyNav ? undefined : tab.active ? undefined : -1\"\n type=\"button\"\n v-bind=\"tab.titleLinkAttrs\"\n @keydown.left.exact=\"!props.vertical && keynav($event, -1)\"\n @keydown.left.shift=\"!props.vertical && keynav($event, -999)\"\n @keydown.up.exact=\"props.vertical && keynav($event, -1)\"\n @keydown.up.shift=\"props.vertical && keynav($event, -999)\"\n @keydown.right.exact=\"!props.vertical && keynav($event, 1)\"\n @keydown.right.shift=\"!props.vertical && keynav($event, 999)\"\n @keydown.down.exact=\"props.vertical && keynav($event, 1)\"\n @keydown.down.shift=\"props.vertical && keynav($event, 999)\"\n @keydown.page-up=\"keynav($event, -999)\"\n @keydown.page-down=\"keynav($event, 999)\"\n @keydown.home=\"keynav($event, -999)\"\n @keydown.end=\"keynav($event, 999)\"\n @click.stop=\"(e) => handleClick(e, idx)\"\n >\n <component :is=\"tab.titleComponent\" v-if=\"tab.titleComponent\" />\n <template v-else>\n {{ tab.title }}\n </template>\n </button>\n </li>\n <slot name=\"tabs-end\" />\n </ul>\n </div>\n <BTabsTabContent v-if=\"!props.end\" v-bind=\"tabContentProps\">\n <slot />\n <template #empty>\n <slot name=\"empty\" />\n </template>\n </BTabsTabContent>\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onMounted,\n provide,\n type Ref,\n ref,\n toRef,\n unref,\n type VNode,\n watch,\n} from 'vue'\nimport {BvEvent} from '../../utils/classes'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useId} from '../../composables/useId'\nimport type {TabType, BTabsProps, BTabsEmits, BTabsSlots} from '../../types'\nimport {tabsInjectionKey} from '../../utils/keys'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {getSafeDocument, sortSlotElementsByPosition} from '../../utils/dom'\nimport {flattenFragments} from '../../utils/flattenFragments'\nimport BTab from './BTab.vue'\nimport BTabsTabContent from '../BTabsTabContent.vue'\n\nconst _props = withDefaults(defineProps<Omit<BTabsProps, 'modelValue' | 'activeIndex'>>(), {\n activeNavItemClass: undefined,\n activeNavLinkClass: undefined,\n activeTabClass: undefined,\n align: undefined,\n card: false,\n contentClass: undefined,\n end: false,\n fill: false,\n id: undefined,\n inactiveNavItemClass: undefined,\n inactiveNavLinkClass: undefined,\n inactiveTabClass: undefined,\n justified: false,\n lazy: false,\n navClass: undefined,\n navItemClass: undefined,\n navWrapperClass: undefined,\n noFade: false,\n noKeyNav: false,\n noNavStyle: false,\n pills: false,\n small: false,\n tag: 'div',\n tabClass: undefined,\n underline: false,\n vertical: false,\n})\nconst props = useDefaults(_props, 'BTabs')\nconst emit = defineEmits<BTabsEmits>()\nconst slots = defineSlots<BTabsSlots>()\n\nconst activeIndex = defineModel<Exclude<BTabsProps['index'], undefined>>('index', {\n default: -1,\n})\nconst activeId = defineModel<BTabsProps['modelValue']>({\n default: undefined,\n})\n\nconst tabsInternal = ref<Ref<TabType>[]>([])\n\nconst tabElementsArray = ref<VNode[]>([])\n\nconst isChildActive = ref(false)\nconst initialIds = ref<string[]>([])\nconst selectedTabHasExplicitId = ref(false)\n\nconst updateTabElementsArray = () => {\n const tabElements = flattenFragments(slots.default?.({}) ?? [])\n tabElementsArray.value = (Array.isArray(tabElements) ? tabElements : [tabElements]).filter(\n (tab) => tab.type === BTab\n )\n // only get the ids once in setup context\n if (initialIds.value.length === 0) {\n // we need to get the ids of the tabs before they are registered. After that we use the internalId for the tabpane\n initialIds.value = tabElementsArray.value.map((tab) =>\n unref(useId(() => tab.props?.id, 'tabpane'))\n )\n // Whether the *initially selected* tab carries an explicit ID.\n //\n // Only that tab matters. The delayed-selection path below exists because\n // a generated ID is not final until the child registers; an explicit ID\n // is final immediately. Asking `.some()` across every tab got this wrong\n // for a mixed list — a single ID-bearing sibling made an ID-less target\n // look safe, so the ID was read pre-mount, failed to match after\n // registration, and the selection fell back to the first tab (#2773).\n selectedTabHasExplicitId.value =\n activeIndex.value > -1 && tabElementsArray.value[activeIndex.value]?.props?.id !== undefined\n }\n isChildActive.value = tabElementsArray.value.some(\n (tab) => tab.props?.active !== undefined && tab.props?.active !== false\n )\n}\nupdateTabElementsArray()\n\nwatch(\n () => slots.default?.({}),\n () => {\n updateTabElementsArray()\n nextTick(() => {\n sortTabs()\n })\n }\n)\n\nconst tabs = computed(() => {\n if (tabsInternal.value.length === 0) {\n // fail back on the slot elements, the children haven't been registered yet\n const _activeIndex = tabElementsArray.value.findIndex(\n (tab) =>\n (tab.props?.active !== undefined &&\n (tab.props.disabled === false || tab.props.disabled === undefined)) ||\n (activeId.value && tab.props?.id === activeId.value)\n )\n return tabElementsArray.value.map((tab, index) => {\n const active =\n _activeIndex !== -1\n ? index === _activeIndex\n : activeIndex.value > -1\n ? index === activeIndex.value\n : index === 0\n return {\n id: tab.props?.id ?? initialIds.value[index],\n internalId: `premount-${index}`, // temporary id for the tab\n buttonId: tab.props?.buttonId,\n disabled: tab.props?.disabled,\n title: tab.props?.title,\n titleComponent: (tab.children as {title: unknown})?.title,\n titleItemClass: tab.props?.titleItemClass,\n titleLinkAttrs: tab.props?.titleLinkAttrs,\n titleLinkClass: tab.props?.titleLinkClass,\n onClick: tab.props?.onClick,\n active,\n navItemClasses: [\n {\n active,\n disabled: !(tab.props?.disabled === false || tab.props?.disabled === undefined),\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n }\n return tabsInternal.value.map((_tab) => {\n const tab = unref(_tab)\n const active = tab.id === activeId.value\n\n return {\n ...tab,\n active,\n navItemClasses: [\n {\n active,\n disabled: tab.disabled,\n },\n active ? props.activeNavItemClass : props.inactiveNavItemClass,\n props.navItemClass,\n ],\n }\n })\n})\n\nlet initialized = false\nlet updateInitialActiveIndex = false\nlet updateInitialActiveId = false\nlet delayedTabSelection = false\n\n// Check if we need to delay tab selection:\n// - We have v-model:index (activeIndex) but no v-model (activeId)\n// - AND the selected tab has no explicit ID (so it will use a generated one)\n// - AND we have tabs to select from\nconst needsDelayedSelection =\n activeIndex.value > -1 &&\n !activeId.value &&\n !selectedTabHasExplicitId.value &&\n tabElementsArray.value.length > 0\n\nif (needsDelayedSelection) {\n // Delay tab selection until children register with their generated IDs\n delayedTabSelection = true\n updateInitialActiveId = true\n} else if (activeIndex.value === -1 && activeId.value) {\n if (tabs.value.findIndex((t) => t.id === activeId.value) !== -1) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n } else {\n updateInitialActiveIndex = true\n }\n} else if (activeIndex.value > -1 && !activeId.value) {\n if (tabs.value[activeIndex.value]?.id) {\n activeId.value = tabs.value[activeIndex.value]?.id\n } else {\n updateInitialActiveId = true\n }\n} else if (activeIndex.value === -1 && !activeId.value && !isChildActive.value) {\n activeIndex.value = tabs.value.findIndex((t) => t.disabled === undefined || t.disabled === false)\n activeId.value = tabs.value[activeIndex.value]?.id\n} else if (activeIndex.value === -1 && !activeId.value && isChildActive.value) {\n activeIndex.value = tabs.value.findIndex(\n (t) =>\n t.active !== undefined &&\n t.active !== false &&\n (t.disabled === undefined || t.disabled === false)\n )\n activeId.value = tabs.value[activeIndex.value]?.id\n}\n\nfunction updateInitialIndexAndId() {\n // we get the computedIds after registering the tabs\n if (updateInitialActiveIndex) {\n const index = tabs.value.findIndex((t) => t.id === activeId.value)\n if (index !== -1) {\n nextTick(() => {\n activeIndex.value = index\n updateInitialActiveIndex = false\n })\n }\n }\n if (updateInitialActiveId) {\n // Wait for tabs to be registered if we're doing delayed selection\n if (delayedTabSelection && tabsInternal.value.length === 0) {\n // Children haven't registered yet, wait\n return\n }\n if (activeIndex.value > -1 && tabs.value[activeIndex.value]?.id) {\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n updateInitialActiveId = false\n delayedTabSelection = false\n })\n }\n }\n}\n\nupdateInitialIndexAndId()\n\nconst showEmpty = computed(() => !(tabs?.value && tabs.value.length > 0))\n\nconst tabContentProps = computed(() => ({\n contentClass: props.contentClass,\n showEmpty: showEmpty.value,\n card: props.card,\n}))\n\nconst computedClasses = computed(() => ({\n 'd-flex': props.vertical,\n 'align-items-start': props.vertical,\n}))\n\nconst alignment = useAlignment(() => props.align)\n\nconst navTabsClasses = computed(() => ({\n 'nav-pills': props.pills,\n 'nav-underline': props.underline,\n 'flex-column me-3': props.vertical,\n [alignment.value]: props.align !== undefined,\n 'nav-fill': props.fill,\n 'card-header-tabs': props.card && !props.pills && !props.underline,\n 'card-header-pills': props.card && props.pills,\n 'nav-justified': props.justified,\n 'nav-tabs': !props.noNavStyle && !props.pills && !props.underline,\n 'small': props.small,\n}))\n\nconst handleClick = (event: Readonly<MouseEvent>, index: number) => {\n if (\n index >= 0 &&\n !tabs.value[index]?.disabled &&\n tabs.value[index]?.onClick &&\n typeof tabs.value[index].onClick === 'function'\n ) {\n tabs.value[index].onClick?.(event)\n if (event.defaultPrevented) {\n getSafeDocument()?.getElementById(tabs.value[index].buttonId)?.blur()\n return\n }\n }\n activeIndex.value = index\n}\n\nconst keynav = (e: Event, direction: number) => {\n if (tabs.value.length <= 0 || props.noKeyNav) return\n e.preventDefault()\n e.stopPropagation()\n activeIndex.value = nextIndex(activeIndex.value + direction, direction)\n nextTick(() => {\n if (activeIndex.value >= 0) {\n getSafeDocument()?.getElementById(tabs.value[activeIndex.value]?.buttonId)?.focus()\n }\n })\n}\n\nconst nextIndex = (start: number, direction: number) => {\n let index = start\n let minIdx = -1\n let maxIdx = -1\n\n for (let i = 0; i < tabs.value.length; i++) {\n if (!tabs.value[i]?.disabled) {\n if (minIdx === -1) minIdx = i\n maxIdx = i\n }\n }\n\n while (index >= minIdx && index <= maxIdx && tabs.value[index]?.disabled) {\n index += direction\n }\n\n if (index < minIdx) index = minIdx\n if (index > maxIdx) index = maxIdx\n\n return index\n}\n\nlet previousIndex: number | undefined\nlet isReverting = false\nwatch(activeIndex, (newValue, oldValue) => {\n // Early exit if there are no tabs or all tabs are disabled\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n\n // If we're reverting due to a prevented event, don't process further\n if (isReverting) {\n isReverting = false\n return\n }\n // Calculate the next valid index\n const index = nextIndex(newValue, newValue > oldValue ? 1 : -1)\n if (index !== newValue) {\n // If the index is not the same as the new value, set the previous index to the old value\n // this is to prevent the event from being emitted twice\n previousIndex = oldValue\n activeIndex.value = index\n return\n }\n // Emit the activate-tab event\n const tabEvent = new BvEvent('activate-tab', {cancelable: true})\n emit('activate-tab', {\n newTabId: tabs.value[index]?.id,\n prevTabId: tabs.value[previousIndex ?? oldValue]?.id,\n newTabIndex: index,\n prevTabIndex: previousIndex ?? oldValue,\n event: tabEvent,\n })\n // If the event is prevented, revert to the previous index\n if (tabEvent.defaultPrevented) {\n isReverting = true\n const prev = previousIndex ?? oldValue ?? nextIndex(0, 1)\n previousIndex = undefined\n // Update the active id this will also trigger the activeId watch which will update the activeIndex\n // this is to make sure we handle case that starts with id change.\n if (activeId.value !== tabs.value[prev]?.id) {\n activeId.value = tabs.value[prev]?.id\n }\n nextTick(() => {\n if (prev >= 0) {\n getSafeDocument()?.getElementById(tabs.value[prev]?.buttonId)?.focus()\n }\n })\n return\n }\n\n // Update the active id\n if (activeId.value !== tabs.value[index]?.id) {\n activeId.value = tabs.value[index]?.id\n }\n previousIndex = undefined\n})\n\nwatch(activeId, (newValue, oldValue) => {\n if (tabs.value.length <= 0 || tabs.value.filter((t) => !t.disabled).length <= 0) {\n return\n }\n const index = tabs.value.findIndex((t) => t.id === newValue)\n // If the new tab is the same as the current tab, do nothing\n if (index === activeIndex.value) return\n const oldIndex = tabs.value.findIndex((t) => t.id === oldValue)\n // If the new tab is disabled, find the next enabled tab\n if (tabs.value[index]?.disabled) {\n // activeIndex watcher will update the activeId to the next enabled tab\n activeIndex.value = nextIndex(index, index > oldIndex ? 1 : -1)\n return\n }\n // If the new tab is not found, find the first enabled tab\n if (index === -1) {\n // activeIndex watcher will update the activeId to the first enabled tab\n activeIndex.value = nextIndex(0, 1)\n nextTick(() => {\n activeId.value = tabs.value[activeIndex.value]?.id\n })\n return\n }\n // change to the next tab\n activeIndex.value = index\n})\n\nconst registerTab = (tab: Ref<TabType>) => {\n const idx = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n if (idx === -1) {\n tabsInternal.value.push(tab)\n if (initialized) {\n nextTick(() => {\n sortTabs()\n })\n } else {\n // If we're doing delayed tab selection, try to update now that a tab has registered\n if (delayedTabSelection) {\n nextTick(() => {\n updateInitialIndexAndId()\n })\n }\n }\n } else {\n tabsInternal.value[idx] = tab\n if (initialized) {\n // sort just in case the tab was moved\n sortTabs()\n }\n }\n const idx2 = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)\n return tab.value.id ?? (!initialized ? initialIds.value[idx2] : tab.value.internalId)\n}\n\nonMounted(() => {\n updateInitialIndexAndId()\n sortTabs()\n initialized = true\n})\n\nconst sortTabs = () => {\n tabsInternal.value.sort((a, b) => sortSlotElementsByPosition(a.value.el.value, b.value.el.value))\n if (\n activeId.value &&\n activeIndex.value !== tabs.value.findIndex((t) => t.id === activeId.value)\n ) {\n activeIndex.value = tabs.value.findIndex((t) => t.id === activeId.value)\n }\n}\n\nconst unregisterTab = (id: string) => {\n tabsInternal.value = tabsInternal.value.filter((t) => t.value.internalId !== id)\n}\n\nprovide(tabsInjectionKey, {\n lazy: toRef(() => props.lazy),\n card: toRef(() => props.card),\n noFade: toRef(() => props.noFade),\n activeTabClass: toRef(() => props.activeTabClass),\n inactiveTabClass: toRef(() => props.inactiveTabClass),\n tabClass: toRef(() => props.tabClass),\n registerTab,\n unregisterTab,\n activeId,\n activateTab: (internalId) => {\n const idx = tabs.value.findIndex((t) => t.internalId === internalId)\n if (internalId === undefined || idx === -1) {\n activeIndex.value = nextIndex(0, 1)\n return\n }\n activeIndex.value = idx\n },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCA,MAAM,QAAQ,YAAY,SAAQ,MAAM;EACxC,MAAM,QAAQ,SAAA;EACd,MAAM,QAAQ,SAAS;EAEvB,MAAM,cAAc,SAAoD,SAAC,QAExE;EAED,MAAM,aAAa,OAAO,kBAAkB,IAAI;EAEhD,MAAM,UAAU,IAAI,MAAM,EAAE;EAC5B,MAAM,aAAa,QAAM,IAAI,SAAS;EACtC,MAAM,aAAa,eAAe,MAAM,MAAM,QAAQ,SAAS,WAAW,KAAK;EAC/E,MAAM,mBAAmB,cAAY,MAAM,UAAU,KAAK;EAE1D,MAAM,sBAAsB,IAAI,KAAK;EACrC,MAAM,KAAK,eAAe,KAAK;EAE/B,MAAM,iBAAiB,eAAe;GAEpC,MAAM,EAAC,SAAS,GAAG,GAAG,aAAY;GAClC,OAAO;EACT,CAAC;EAED,SAAS,YAAY;GACnB,IAAI,CAAC,YAAY;GACjB,MAAM,QAAQ,WAAW,YACvB,gBAEK;IACC,YAAY,WAAW;IACvB,IAAI,WAAW;IACf,QAAQ,YAAY;IACpB,UAAU,iBAAiB;IAC3B,UAAU,MAAM;IAChB,OAAO,MAAM;IACb,gBAAgB,MAA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,kBAA9C,UAAA,GAAA,YAAgE,wBAAhD,IAAI,cAAc,GAAA,EAAA,KAAA,EAAA,CAAA,MAClC,UAAA,GAAA,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CADN,gBAAA,gBAAA,IAAI,KAAK,GAAA,CAAA,CAAA,GAAA,EAAA,EAAA,GAAA,IAAA,UAAA,CAAA,GAAA,CAAA;;MAIlB,WAAwB,KAAA,QAAA,UAAA;;KAGJ,CAAA,MAAA,KAAA,CAAK,CAAC,OAA9B,UAAA,GAAA,YAKkB,yBAAA,eAAA,WAAA,EAAA,KAAA,EAAA,GALyB,gBAAA,KAAe,CAAA,GAAA;MAE7C,OAAK,cACO,CAArB,WAAqB,KAAA,QAAA,OAAA,CAAA,CAAA;MAFvB,SAAA,cAAQ,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -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-B6RQbFDt.js";
3
+ import { t as useShowHide } from "./useShowHide-Dpld86ys.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 useColorVariantClasses } from "./useColorVariantClasses-DHQvLjek.js";
@@ -306,4 +306,4 @@ var BToast_default = /* @__PURE__ */ defineComponent({
306
306
  //#endregion
307
307
  export { BToast_default as t };
308
308
 
309
- //# sourceMappingURL=BToast-CqE2VMW2.js.map
309
+ //# sourceMappingURL=BToast-Cm7TZlZq.js.map