mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-01 12:47:57 +01:00
chore(Tooltip): improve slots
This commit is contained in:
@@ -25,6 +25,8 @@ export interface TooltipEmits extends TooltipRootEmits {}
|
|||||||
export interface TooltipSlots {
|
export interface TooltipSlots {
|
||||||
default(): any
|
default(): any
|
||||||
content(): any
|
content(): any
|
||||||
|
text(): any
|
||||||
|
shortcuts(): any
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -55,10 +57,14 @@ const ui = computed(() => tv({ extend: tooltip, slots: props.ui })())
|
|||||||
<TooltipPortal :disabled="!portal">
|
<TooltipPortal :disabled="!portal">
|
||||||
<TooltipContent v-bind="contentProps" :class="ui.content({ class: props.class })">
|
<TooltipContent v-bind="contentProps" :class="ui.content({ class: props.class })">
|
||||||
<slot name="content">
|
<slot name="content">
|
||||||
<span :class="ui.text()">{{ text }}</span>
|
<span v-if="text" :class="ui.text()">
|
||||||
|
<slot name="text">{{ text }}</slot>
|
||||||
|
</span>
|
||||||
|
|
||||||
<span v-if="shortcuts?.length" :class="ui.shortcuts()">
|
<span v-if="shortcuts?.length" :class="ui.shortcuts()">
|
||||||
<UKbd v-for="(shortcut, index) in shortcuts" :key="index" size="xs" v-bind="typeof shortcut === 'string' ? { value: shortcut } : shortcut" />
|
<slot name="shortcuts">
|
||||||
|
<UKbd v-for="(shortcut, index) in shortcuts" :key="index" size="xs" v-bind="typeof shortcut === 'string' ? { value: shortcut } : shortcut" />
|
||||||
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user