Files
gpx.studio/website/src/lib/components/ui/context-menu/context-menu-radio-item.svelte

32 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 CircleIcon from "@lucide/svelte/icons/circle";
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,
children: childrenProp,
...restProps
}: WithoutChild<ContextMenuPrimitive.RadioItemProps> = $props();
2024-04-29 17:03:23 +02:00
</script>
<ContextMenuPrimitive.RadioItem
2025-06-08 16:32:41 +02:00
bind:ref
2025-06-21 21:07:36 +02:00
data-slot="context-menu-radio-item"
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 outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none 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
{#snippet children({ checked })}
2025-06-21 21:07:36 +02:00
<span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
2025-06-08 16:32:41 +02:00
{#if checked}
2025-06-21 21:07:36 +02:00
<CircleIcon class="size-2 fill-current" />
2025-06-08 16:32:41 +02:00
{/if}
</span>
{@render childrenProp?.({ checked })}
{/snippet}
2024-04-29 17:03:23 +02:00
</ContextMenuPrimitive.RadioItem>