1<script lang="ts">
 2	import { Switch as SwitchPrimitive } from 'bits-ui';
 3	import { cn, type WithoutChildrenOrChild } from '$lib/components/ui/utils.js';
 4
 5	let {
 6		ref = $bindable(null),
 7		class: className,
 8		checked = $bindable(false),
 9		...restProps
10	}: WithoutChildrenOrChild<SwitchPrimitive.RootProps> = $props();
11</script>
12
13<SwitchPrimitive.Root
14	bind:ref
15	bind:checked
16	data-slot="switch"
17	class={cn(
18		'peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80',
19		className
20	)}
21	{...restProps}
22>
23	<SwitchPrimitive.Thumb
24		data-slot="switch-thumb"
25		class={cn(
26			'pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground'
27		)}
28	/>
29</SwitchPrimitive.Root>