1"use client"
2
3import * as React from "react"
4import { cn } from "@/lib/utils"
5import { Tabs as TabsPrimitive } from "radix-ui"
6
7function Tabs({
8 className,
9 orientation = "horizontal",
10 ...props
11}: React.ComponentProps<typeof TabsPrimitive.Root>) {
12 return (
13 <TabsPrimitive.Root
14 data-slot="tabs"
15 data-orientation={orientation}
16 className={cn(
17 "group/tabs flex gap-2 data-horizontal:flex-col",
18 className
19 )}
20 {...props}
21 />
22 )
23}
24
25function TabsList({
26 className,
27 ...props
28}: React.ComponentProps<typeof TabsPrimitive.List>) {
29 return (
30 <TabsPrimitive.List
31 data-slot="tabs-list"
32 className={cn(
33 "group/tabs-list inline-flex w-fit items-center justify-center gap-1 rounded-pill border-2 border-ink bg-paper p-1 data-vertical:flex-col",
34 className
35 )}
36 {...props}
37 />
38 )
39}
40
41function TabsTrigger({
42 className,
43 ...props
44}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
45 return (
46 <TabsPrimitive.Trigger
47 data-slot="tabs-trigger"
48 className={cn(
49 "relative inline-flex h-11 flex-1 items-center justify-center gap-2 rounded-pill border-2 border-ink bg-paper px-5 whitespace-nowrap select-none",
50 "font-sans font-bold text-[15px] text-ink",
51 "transition-[background-color,color] duration-[120ms] outline-none",
52 "not-data-[state=active]:hover:bg-cream",
53 "data-[state=active]:bg-ink data-[state=active]:text-paper",
54 "focus-visible:outline-3 focus-visible:outline-offset-3 focus-visible:outline-violet",
55 "disabled:pointer-events-none disabled:border-dashed disabled:bg-cream disabled:text-muted",
56 "group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start",
57 "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
58 className
59 )}
60 {...props}
61 />
62 )
63}
64
65function TabsContent({
66 className,
67 ...props
68}: React.ComponentProps<typeof TabsPrimitive.Content>) {
69 return (
70 <TabsPrimitive.Content
71 data-slot="tabs-content"
72 className={cn(
73 "flex-1 rounded-thumb text-sm focus-visible:outline-3 focus-visible:outline-offset-3 focus-visible:outline-violet",
74 className
75 )}
76 {...props}
77 />
78 )
79}
80
81export { Tabs, TabsList, TabsTrigger, TabsContent }
82