Skip to content

Commit

Permalink
feat(BTooltip): add prop interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
xvaara authored and VividLemon committed Feb 19, 2024
1 parent c1171d9 commit f683df2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/bootstrap-vue-next/src/components/BTooltip.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<template>
<BPopover ref="popover" tooltip v-bind="$props">
<BPopover ref="popover" tooltip v-bind="computedProps">
<template v-for="(_, name) in $slots" #[name]="slotData">
<slot :name="name" v-bind="slotData" />
</template>
</BPopover>
</template>

<script setup lang="ts">
import {ref} from 'vue'
import {computed, ref} from 'vue'
import BPopover from './BPopover.vue'
import type {BPopoverProps} from '../types'
import type {BPopoverProps, BTooltipProps} from '../types'
withDefaults(defineProps<Omit<BPopoverProps, 'tooltip'>>(), {
const props = withDefaults(defineProps<BTooltipProps>(), {
click: undefined,
container: undefined,
content: undefined,
Expand All @@ -22,14 +22,15 @@ withDefaults(defineProps<Omit<BPopoverProps, 'tooltip'>>(), {
html: undefined,
id: undefined,
inline: undefined,
interactive: undefined,
manual: undefined,
modelValue: undefined,
noAutoClose: undefined,
noFade: undefined,
noFlip: undefined,
noHide: undefined,
noShift: undefined,
noninteractive: true,
noninteractive: undefined,
offset: undefined,
placement: undefined,
realtime: undefined,
Expand All @@ -40,6 +41,11 @@ withDefaults(defineProps<Omit<BPopoverProps, 'tooltip'>>(), {
variant: undefined,
})
const computedProps = computed<BPopoverProps>(() => {
const {interactive, noninteractive, ...rest} = props
return {noninteractive: noninteractive !== undefined ? noninteractive : !interactive, ...rest}
})
const popover = ref<null | InstanceType<typeof BPopover>>(null)
defineExpose({
Expand Down
4 changes: 4 additions & 0 deletions packages/bootstrap-vue-next/src/types/ComponentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ export interface BPopoverProps {
variant?: ColorVariant | null
}

export interface BTooltipProps extends Omit<BPopoverProps, 'tooltip'> {
interactive?: Booleanish
}

export interface BCardHeadFootProps extends ColorExtendables {
borderVariant?: ColorVariant | null
html?: string
Expand Down
1 change: 1 addition & 0 deletions packages/bootstrap-vue-next/src/utils/floatingUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const resolveDirectiveProps = (
: undefined,
html: true,
...(typeof binding.value === 'object' ? binding.value : {}),
...(binding.modifiers.interactive ? {noninteractive: false} : {}),
title: null,
content: null,
})
Expand Down

0 comments on commit f683df2

Please sign in to comment.