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

30 lines
1.1 KiB
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 ChevronRightIcon from "@lucide/svelte/icons/chevron-right";
import { cn, type WithoutChild } from "$lib/utils.js";
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(
2025-06-21 21:07:36 +02:00
"data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_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>