1
1
<!-- eslint-disable vue/block-tag-newline -->
2
2
<script lang="ts">
3
3
import type { VariantProps } from 'tailwind-variants'
4
- import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps } from 'reka-ui'
4
+ import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps, ContextMenuContentEmits } from 'reka-ui'
5
5
import type { AppConfig } from '@nuxt/schema'
6
6
import _appConfig from '#build/app.config'
7
7
import theme from '#build/ui/context-menu'
8
8
import { tv } from '../utils/tv'
9
9
import type { AvatarProps, KbdProps, LinkProps } from '../types'
10
- import type { DynamicSlots, PartialString } from '../types/utils'
10
+ import type { DynamicSlots, PartialString, EmitsToProps } from '../types/utils'
11
11
12
12
const appConfigContextMenu = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
13
13
@@ -23,7 +23,7 @@ export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custo
23
23
icon?: string
24
24
color?: ContextMenuVariants['color']
25
25
avatar?: AvatarProps
26
- content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
26
+ content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ContextMenuContentEmits>>
27
27
kbds?: KbdProps['value'][] | KbdProps[]
28
28
/**
29
29
* The item type.
@@ -67,7 +67,7 @@ export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'> {
67
67
*/
68
68
externalIcon?: boolean | string
69
69
/** The content of the menu. */
70
- content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
70
+ content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ContextMenuContentEmits>>
71
71
/**
72
72
* Render the menu in a portal.
73
73
* @defaultValue true
@@ -114,7 +114,7 @@ const emits = defineEmits<ContextMenuEmits>()
114
114
const slots = defineSlots<ContextMenuSlots<T>>()
115
115
116
116
const rootProps = useForwardPropsEmits(reactivePick(props, 'modal'), emits)
117
- const contentProps = toRef(() => props.content as ContextMenuContentProps )
117
+ const contentProps = toRef(() => props.content)
118
118
const proxySlots = omit(slots, ['default']) as Record<string, ContextMenuSlots<T>[string]>
119
119
120
120
const ui = computed(() => contextMenu({
0 commit comments