mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 23:03:51 +02:00
68 lines
1.8 KiB
Vue
68 lines
1.8 KiB
Vue
<script setup>
|
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
|
import { reactiveOmit } from '@vueuse/core';
|
|
|
|
import { useSidebar } from './utils';
|
|
|
|
import SidebarMenuButtonChild from './SidebarMenuButtonChild.vue';
|
|
|
|
defineOptions({
|
|
inheritAttrs: false
|
|
});
|
|
|
|
const props = defineProps({
|
|
as: {
|
|
type: [String, Object, Function],
|
|
default: 'button'
|
|
},
|
|
asChild: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
variant: {
|
|
type: String,
|
|
default: 'default'
|
|
},
|
|
size: {
|
|
type: String,
|
|
default: 'default'
|
|
},
|
|
isActive: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
tooltip: {
|
|
type: [String, Object, Function],
|
|
default: undefined
|
|
},
|
|
class: {
|
|
type: [String, Array, Object],
|
|
default: undefined
|
|
}
|
|
});
|
|
|
|
const { isMobile, state } = useSidebar();
|
|
|
|
const delegatedProps = reactiveOmit(props, 'tooltip');
|
|
</script>
|
|
|
|
<template>
|
|
<SidebarMenuButtonChild v-if="!tooltip" v-bind="{ ...delegatedProps, ...$attrs }">
|
|
<slot />
|
|
</SidebarMenuButtonChild>
|
|
|
|
<Tooltip v-else ignore-non-keyboard-focus>
|
|
<TooltipTrigger as-child>
|
|
<SidebarMenuButtonChild v-bind="{ ...delegatedProps, ...$attrs }">
|
|
<slot />
|
|
</SidebarMenuButtonChild>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="right" align="center" :hidden="state !== 'collapsed' || isMobile">
|
|
<template v-if="typeof tooltip === 'string'">
|
|
{{ tooltip }}
|
|
</template>
|
|
<component :is="tooltip" v-else />
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
</template>
|