mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 19:57:55 +01:00
fix(ContextMenu): remove arrow prop
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tv } from 'tailwind-variants'
|
import { tv } from 'tailwind-variants'
|
||||||
import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps, ContextMenuArrowProps, ContextMenuTriggerProps, ContextMenuItemProps } from 'radix-vue'
|
import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps, ContextMenuTriggerProps, ContextMenuItemProps } from 'radix-vue'
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import _appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/context-menu'
|
import theme from '#build/ui/context-menu'
|
||||||
@@ -32,7 +32,6 @@ export interface ContextMenuItem extends Omit<LinkProps, 'type'>, Pick<ContextMe
|
|||||||
export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'>, Pick<ContextMenuTriggerProps, 'disabled'> {
|
export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'>, Pick<ContextMenuTriggerProps, 'disabled'> {
|
||||||
items?: T[] | T[][]
|
items?: T[] | T[][]
|
||||||
content?: Omit<ContextMenuContentProps, 'asChild' | 'forceMount'>
|
content?: Omit<ContextMenuContentProps, 'asChild' | 'forceMount'>
|
||||||
arrow?: boolean | Omit<ContextMenuArrowProps, 'asChild'>
|
|
||||||
portal?: boolean
|
portal?: boolean
|
||||||
class?: any
|
class?: any
|
||||||
ui?: Partial<typeof contextMenu.slots>
|
ui?: Partial<typeof contextMenu.slots>
|
||||||
@@ -53,7 +52,7 @@ export type ContextMenuSlots<T extends { slot?: string }> = {
|
|||||||
|
|
||||||
<script setup lang="ts" generic="T extends ContextMenuItem">
|
<script setup lang="ts" generic="T extends ContextMenuItem">
|
||||||
import { computed, toRef } from 'vue'
|
import { computed, toRef } from 'vue'
|
||||||
import { ContextMenuRoot, ContextMenuTrigger, ContextMenuArrow, useForwardPropsEmits } from 'radix-vue'
|
import { ContextMenuRoot, ContextMenuTrigger, useForwardPropsEmits } from 'radix-vue'
|
||||||
import { reactivePick } from '@vueuse/core'
|
import { reactivePick } from '@vueuse/core'
|
||||||
import { UContextMenuContent } from '#components'
|
import { UContextMenuContent } from '#components'
|
||||||
import { omit } from '#ui/utils'
|
import { omit } from '#ui/utils'
|
||||||
@@ -67,7 +66,6 @@ const slots = defineSlots<ContextMenuSlots<T>>()
|
|||||||
|
|
||||||
const rootProps = useForwardPropsEmits(reactivePick(props, 'modal'), emits)
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'modal'), emits)
|
||||||
const contentProps = toRef(() => props.content as ContextMenuContentProps)
|
const contentProps = toRef(() => props.content as ContextMenuContentProps)
|
||||||
const arrowProps = toRef(() => props.arrow as ContextMenuArrowProps)
|
|
||||||
const proxySlots = omit(slots, ['default']) as Record<string, ContextMenuSlots<T>[string]>
|
const proxySlots = omit(slots, ['default']) as Record<string, ContextMenuSlots<T>[string]>
|
||||||
|
|
||||||
const ui = computed(() => tv({ extend: contextMenu, slots: props.ui })())
|
const ui = computed(() => tv({ extend: contextMenu, slots: props.ui })())
|
||||||
@@ -83,8 +81,6 @@ const ui = computed(() => tv({ extend: contextMenu, slots: props.ui })())
|
|||||||
<template v-for="(_, name) in proxySlots" #[name]="slotData: any">
|
<template v-for="(_, name) in proxySlots" #[name]="slotData: any">
|
||||||
<slot :name="name" v-bind="slotData" />
|
<slot :name="name" v-bind="slotData" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<ContextMenuArrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow()" />
|
|
||||||
</UContextMenuContent>
|
</UContextMenuContent>
|
||||||
</ContextMenuRoot>
|
</ContextMenuRoot>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
slots: {
|
slots: {
|
||||||
content: 'min-w-32 bg-white dark:bg-gray-900 shadow-lg rounded-md ring ring-gray-200 dark:ring-gray-800 divide-y divide-gray-200 dark:divide-gray-800 overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]',
|
content: 'min-w-32 bg-white dark:bg-gray-900 shadow-lg rounded-md ring ring-gray-200 dark:ring-gray-800 divide-y divide-gray-200 dark:divide-gray-800 overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]',
|
||||||
arrow: 'fill-gray-200 dark:fill-gray-800',
|
|
||||||
group: 'p-1 isolate',
|
group: 'p-1 isolate',
|
||||||
label: 'w-full flex items-center gap-1.5 p-1.5 text-sm font-medium select-none',
|
label: 'w-full flex items-center gap-1.5 p-1.5 text-sm font-medium select-none',
|
||||||
separator: '-mx-1 my-1 h-px bg-gray-200 dark:bg-gray-800',
|
separator: '-mx-1 my-1 h-px bg-gray-200 dark:bg-gray-800',
|
||||||
|
|||||||
Reference in New Issue
Block a user