Files
gpx.studio/website/src/lib/components/ui/context-menu/context-menu-sub-trigger.svelte

30 lines
960 B
Svelte
Raw Normal View History

2024-04-29 17:03:23 +02:00
<script lang="ts">
2025-06-21 21:07:36 +02:00
import { ContextMenu as ContextMenuPrimitive } from "bits-ui";
import { cn, type WithoutChild } from "$lib/utils.js";
2026-04-06 18:22:01 +02:00
import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
2024-04-29 17:03:23 +02:00
2025-06-08 16:32:41 +02:00
let {
ref = $bindable(null),
class: className,
inset,
children,
...restProps
}: WithoutChild<ContextMenuPrimitive.SubTriggerProps> & {
2024-04-29 17:03:23 +02:00
inset?: boolean;
2025-06-08 16:32:41 +02:00
} = $props();
2024-04-29 17:03:23 +02:00
</script>
<ContextMenuPrimitive.SubTrigger
2025-06-08 16:32:41 +02:00
bind:ref
2025-06-21 21:07:36 +02:00
data-slot="context-menu-sub-trigger"
data-inset={inset}
2024-04-29 17:03:23 +02:00
class={cn(
2026-04-06 18:22:01 +02:00
"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none data-inset:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
2024-04-29 17:03:23 +02:00
className
)}
2025-06-08 16:32:41 +02:00
{...restProps}
2024-04-29 17:03:23 +02:00
>
2025-06-08 16:32:41 +02:00
{@render children?.()}
2025-06-21 21:07:36 +02:00
<ChevronRightIcon class="ml-auto" />
2024-04-29 17:03:23 +02:00
</ContextMenuPrimitive.SubTrigger>