fix: tooltip popover trigger issue
This commit is contained in:
parent
0bc0dcba22
commit
e9634a9f5e
|
|
@ -1,8 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { Slider } from '@/lib/registry/default/ui/slider'
|
import { Slider } from '@/lib/registry/default/ui/slider'
|
||||||
|
|
||||||
const modelValue = [50]
|
const modelValue = ref([50])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const props = defineProps<PopoverTriggerProps>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PopoverTrigger v-bind="props">
|
<PopoverTrigger v-bind="props" class="">
|
||||||
<slot />
|
<slot />
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps<SliderRootProps>()
|
const props = defineProps<SliderRootProps>()
|
||||||
const emits = defineEmits<SliderRootEmits>()
|
const emits = defineEmits<SliderRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -13,7 +15,7 @@ const emits = defineEmits<SliderRootEmits>()
|
||||||
'relative flex w-full touch-none select-none items-center',
|
'relative flex w-full touch-none select-none items-center',
|
||||||
$attrs.class ?? '',
|
$attrs.class ?? '',
|
||||||
)"
|
)"
|
||||||
v-bind="{ ...props, ...useEmitAsProps(emits) }"
|
v-bind="{ ...props, ...emitsAsProps }"
|
||||||
>
|
>
|
||||||
<SliderTrack class="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
|
<SliderTrack class="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
|
||||||
<SliderRange class="absolute h-full bg-primary" />
|
<SliderRange class="absolute h-full bg-primary" />
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@ import { useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps<TooltipRootProps>()
|
const props = defineProps<TooltipRootProps>()
|
||||||
const emits = defineEmits<TooltipRootEmits>()
|
const emits = defineEmits<TooltipRootEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<TooltipRoot v-bind="{ ...props, ...useEmitAsProps(emits) }">
|
<TooltipRoot v-bind="{ ...props, ...emitsAsProps }">
|
||||||
<slot />
|
<slot />
|
||||||
</TooltipRoot>
|
</TooltipRoot>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { TooltipContent, type TooltipContentEmits, type TooltipContentProps } from 'radix-vue'
|
import { TooltipContent, type TooltipContentEmits, type TooltipContentProps, TooltipPortal } from 'radix-vue'
|
||||||
import { cn, useEmitAsProps } from '@/lib/utils'
|
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<TooltipContentProps>(), {
|
const props = withDefaults(defineProps<TooltipContentProps>(), {
|
||||||
sideOffset: 4,
|
sideOffset: 4,
|
||||||
})
|
})
|
||||||
const emits = defineEmits<TooltipContentEmits>()
|
const emits = defineEmits<TooltipContentEmits>()
|
||||||
|
|
||||||
|
const emitsAsProps = useEmitAsProps(emits)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<TooltipContent v-bind="{ ...props, ...useEmitAsProps(emits) }" :class="cn('z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', $attrs.class ?? '')">
|
<TooltipPortal>
|
||||||
|
<TooltipContent v-bind="{ ...props, ...emitsAsProps, ...$attrs }" :class="cn('z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', $attrs.class ?? '')">
|
||||||
<slot />
|
<slot />
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
|
</TooltipPortal>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const props = defineProps<TooltipTriggerProps>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<TooltipTrigger v-bind="props">
|
<TooltipTrigger v-bind="props" class="">
|
||||||
<slot />
|
<slot />
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { Slider } from '@/lib/registry/new-york/ui/slider'
|
import { Slider } from '@/lib/registry/new-york/ui/slider'
|
||||||
|
|
||||||
const modelValue = [50]
|
const modelValue = ref([50])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const props = defineProps<PopoverTriggerProps>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PopoverTrigger v-bind="props">
|
<PopoverTrigger v-bind="props" class="">
|
||||||
<slot />
|
<slot />
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const props = defineProps<TooltipTriggerProps>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<TooltipTrigger v-bind="props">
|
<TooltipTrigger v-bind="props" class="">
|
||||||
<slot />
|
<slot />
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user