<script lang="ts">
  import { cn, type WithElementRef } from '$lib/utils/cn.svelte.js';
  import type { HTMLAttributes, Snippet } from 'svelte/elements';

  let {
    ref = $bindable(null),
    class: className,
    children,
    ...restProps
  }: WithElementRef<HTMLAttributes<HTMLDivElement>> & { children?: Snippet } = $props();
</script>

<div
  bind:this={ref}
  data-slot="sidebar-rail"
  data-sidebar="rail"
  class={cn(
    'bg-sidebar-border hover:bg-sidebar-border/50 absolute inset-y-0 z-20 hidden w-px transition-[opacity]',
    'group-data-[side=left]:-right-4 group-data[side=right]:-left-4',
    'group-data-[collapsible=icon]:hidden',
    className
  )}
  {...restProps}
>
  {children}
</div>