From b5185283b6db24195913e5d75457e824418aeba9 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Thu, 15 Jan 2026 16:33:33 +0800 Subject: [PATCH] rework activators --- next-ui/src/components/item/card/ItemCard.vue | 31 ++++++++++++++++--- .../src/components/series/card/SeriesCard.vue | 12 +++++-- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/next-ui/src/components/item/card/ItemCard.vue b/next-ui/src/components/item/card/ItemCard.vue index 9c8f1bd9..eeb53575 100644 --- a/next-ui/src/components/item/card/ItemCard.vue +++ b/next-ui/src/components/item/card/ItemCard.vue @@ -88,6 +88,7 @@ + + + + @@ -138,6 +149,7 @@ import type { ItemCardEmits, ItemCardLine, ItemCardProps, ItemCardTitle } from '@/types/ItemCard' import { vOnLongPress } from '@vueuse/components' import { usePrimaryInput } from '@/composables/device' +import { reactiveOmit, reactivePick } from '@vueuse/core' const { isTouchPrimary } = usePrimaryInput() @@ -153,8 +165,8 @@ const { preSelect = false, fabIcon, quickActionIcon, + quickActionProps = {}, menuIcon, - menuMouseEnter = () => {}, } = defineProps< ItemCardProps & { /** @@ -185,15 +197,18 @@ const { * Icon displayed in the bottom-left corner. */ quickActionIcon?: string + /** + * Props to pass to the menu icon element. + */ + quickActionProps?: Record /** * Icon displayed in the bottom-right corner. */ menuIcon?: string /** - * Callback function called when the mouse enters the menu button. - * @param event + * Props to pass to the menu icon element. */ - menuMouseEnter?: (event: Event) => void + menuProps?: object } >() @@ -222,6 +237,12 @@ const hideSelection = computed( const hideFab = computed(() => selected || isPreSelect.value || isTouchPrimary.value) const hideQuickAction = computed(() => selected || isPreSelect.value || isTouchPrimary.value) const hideMenu = computed(() => selected || isPreSelect.value || isTouchPrimary.value) + +// for the quick action button to work as a dialog activator +// when the dialog is shown, the overlay disappears, along with the activator +// we use an underlay with the same positioning, but a negative z-index, and we map the `id` to the underlay +const quickActionPropsOverlay = reactiveOmit(quickActionProps, 'id') +const quickActionPropsUnderlay = reactivePick(quickActionProps, 'id')