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

29 lines
838 B
Svelte
Raw Normal View History

2024-04-29 17:03:23 +02:00
<script lang="ts">
2025-06-08 16:32:41 +02:00
import { ContextMenu as ContextMenuPrimitive, type WithoutChild } from "bits-ui";
import ChevronRight from "@lucide/svelte/icons/chevron-right";
2024-04-29 17:03:23 +02:00
import { cn } from "$lib/utils.js";
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
2024-04-29 17:03:23 +02:00
class={cn(
2025-06-08 16:32:41 +02:00
"data-[highlighted]:bg-accent data-[state=open]:bg-accent data-[highlighted]:text-accent-foreground data-[state=open]:text-accent-foreground flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
2024-04-29 17:03:23 +02:00
inset && "pl-8",
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?.()}
<ChevronRight class="ml-auto size-4" />
2024-04-29 17:03:23 +02:00
</ContextMenuPrimitive.SubTrigger>