Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 04f3ca2

Browse files
committed
fix: BTooltip BPopover, directives, don't show item when both content and title are empty
docs: write vBColorMode docs
1 parent 4a646d5 commit 04f3ca2

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

apps/docs/.vitepress/theme/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export default {
1515
opencollectiveUrl: 'https://opencollective.com/bootstrap-vue-next',
1616
})
1717
},
18-
} as Theme
18+
} satisfies Theme

apps/docs/src/docs/directives/BColorMode.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,44 @@
1616

1717
## Demo
1818

19-
Docs to be made
19+
<HighlightCard>
20+
<BCard v-b-color-mode="currentColor">
21+
<BButton @click="changeColor">
22+
Current color: {{ currentColor }}
23+
</BButton>
24+
</BCard>
25+
<template #html>
26+
27+
```vue
28+
<template>
29+
<BCard v-b-color-mode="currentColor">
30+
<BButton @click="changeColor"> Current color: {{ currentColor }} </BButton>
31+
</BCard>
32+
</template>
33+
34+
<script setup lang="ts">
35+
import {vBColorMode} from 'bootstrap-vue-next'
36+
37+
const currentColor = ref<'light' | 'dark'>('dark')
38+
39+
const changeColor = () => {
40+
currentColor.value = currentColor.value === 'dark' ? 'light' : 'dark'
41+
}
42+
</script>
43+
```
44+
45+
</template>
46+
47+
</HighlightCard>
48+
49+
<script setup lang="ts">
50+
import {ref} from 'vue'
51+
import {vBColorMode, BButton, BCard} from 'bootstrap-vue-next'
52+
import HighlightCard from '../../components/HighlightCard.vue'
53+
54+
const currentColor = ref<'light' | 'dark'>('dark')
55+
56+
const changeColor = () => {
57+
currentColor.value = currentColor.value === 'dark' ? 'light' : 'dark'
58+
}
59+
</script>

packages/bootstrap-vue-next/src/directives/BPopover.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export default {
1515

1616
const text = resolveContent(binding.value, el)
1717

18+
if (!text.content && !text.title) return
19+
1820
el.$__state = ref({
1921
...resolveDirectiveProps(binding, el),
2022
...text,
@@ -27,6 +29,8 @@ export default {
2729

2830
const text = resolveContent(binding.value, el)
2931

32+
if (!text.content && !text.title) return
33+
3034
if (!el.$__state) return
3135
el.$__state.value = {
3236
...resolveDirectiveProps(binding, el),
@@ -36,4 +40,4 @@ export default {
3640
beforeUnmount(el) {
3741
unbind(el)
3842
},
39-
} as Directive<ElementWithPopper>
43+
} satisfies Directive<ElementWithPopper>

packages/bootstrap-vue-next/src/directives/BTooltip.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export default {
1515

1616
const text = resolveContent(binding.value, el)
1717

18+
if (!text.content && !text.title) return
19+
1820
el.$__state = ref({
1921
...resolveDirectiveProps(binding, el),
2022
title: text.title ?? text.content ?? '',
@@ -27,6 +29,9 @@ export default {
2729
if (!isActive) return
2830

2931
const text = resolveContent(binding.value, el)
32+
33+
if (!text.content && !text.title) return
34+
3035
if (!el.$__state) return
3136
el.$__state.value = {
3237
...resolveDirectiveProps(binding, el),
@@ -37,4 +42,4 @@ export default {
3742
beforeUnmount(el) {
3843
unbind(el)
3944
},
40-
} as Directive<ElementWithPopper>
45+
} satisfies Directive<ElementWithPopper>

0 commit comments

Comments
 (0)