"use client";
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
import { cn } from "@/lib/utils";
/**
* Layered panels switched by a recessed rail of triggers. The active tab
* rises out of the rail like a key sitting proud in a milled slot.
*
* @example
* <Tabs defaultValue="cli">
* <TabsList>
* <TabsTrigger value="cli">CLI</TabsTrigger>
* <TabsTrigger value="manual">Manual</TabsTrigger>
* </TabsList>
* <TabsContent value="cli">…</TabsContent>
* <TabsContent value="manual">…</TabsContent>
* </Tabs>
*/
function Tabs({
className,
...props
}: React.ComponentProps<typeof BaseTabs.Root>) {
return (
<BaseTabs.Root
data-slot="tabs"
className={cn("flex flex-col gap-3", className)}
{...props}
/>
);
}
function TabsList({
className,
...props
}: React.ComponentProps<typeof BaseTabs.List>) {
return (
<BaseTabs.List
data-slot="tabs-list"
activateOnFocus
className={cn(
"inline-flex w-fit items-center gap-1 rounded-md bg-well p-1 shadow-deboss-1",
className,
)}
{...props}
/>
);
}
function TabsTrigger({
className,
...props
}: React.ComponentProps<typeof BaseTabs.Tab>) {
return (
<BaseTabs.Tab
data-slot="tabs-trigger"
className={cn(
"inline-flex h-7 cursor-pointer items-center justify-center rounded-sm px-3 text-sm font-medium whitespace-nowrap text-ink-muted focus-ring transition-[box-shadow,background-color,color] duration-(--duration-settle) ease-(--ease-settle) hover:text-ink data-active:bg-surface-2 data-active:text-ink data-active:shadow-emboss-1 data-disabled:pointer-events-none data-disabled:opacity-50",
className,
)}
{...props}
/>
);
}
function TabsContent({
className,
...props
}: React.ComponentProps<typeof BaseTabs.Panel>) {
return (
<BaseTabs.Panel
data-slot="tabs-content"
className={cn("flex-1 outline-none", className)}
{...props}
/>
);
}
export { Tabs, TabsList, TabsTrigger, TabsContent };