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

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

<tr
	bind:this={ref}
	data-slot="table-row"
	{...restProps}
	tabindex={inTabOrder ? 0 : -1}
	class={cn(
		"hover:[&,&>svelte-css-wrapper]:[&>th,td]:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
		"focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
		className
	)}
>
	{@render children?.()}
</tr>
