| 1 | "use client"; |
| 2 | |
| 3 | import { Tabs as TabsPrimitive |
| 4 | import { cn } |
| 5 | import * as React |
| 6 | |
| 7 | type TabsVariant |
| 8 | |
| 9 | const TabsVariantContext = React |
| 10 | |
| 11 | const Tabs = TabsPrimitive |
| 12 | |
| 13 | function TabsList({ |
| 14 | className, |
| 15 | variant = "default" |
| 16 | ...props |
| 17 | }: TabsPrimitive. |
| 18 | return ( |
| 19 | <TabsVariantContext.Provider value={ |
| 20 | <TabsPrimitive.List |
| 21 | data-slot="tabs-list" |
| 22 | className={cn( |
| 23 | "flex items-center", |
| 24 | variant === "default" |
| 25 | variant === "underline" |
| 26 | className, |
| 27 | )} |
| 28 | {...props} |
| 29 | /> |
| 30 | </TabsVariantContext.Provider> |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | function TabsTab({ |
| 35 | className, |
| 36 | ...props |
| 37 | }: TabsPrimitive. |
| 38 | const variant = |
| 39 | return ( |
| 40 | <TabsPrimitive.Tab |
| 41 | data-slot="tabs-tab" |
| 42 | className={cn( |
| 43 | "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors outline-none", |
| 44 | "focus-visible:ring-2 focus-visible:ring-ring", |
| 45 | "disabled:pointer-events-none disabled:opacity-50", |
| 46 | "[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", |
| 47 | variant === "default" |
| 48 | "rounded-lg px-3 py-1.5 text-muted-foreground", |
| 49 | "data-[active]:bg-background data-[active]:text-foreground data-[active]:shadow-sm", |
| 50 | ], |
| 51 | variant === "underline" |
| 52 | "-mb-px border-b-2 border-transparent px-4 py-2 text-muted-foreground", |
| 53 | "data-[active]:border-foreground data-[active]:text-foreground", |
| 54 | "hover:text-foreground", |
| 55 | ], |
| 56 | className, |
| 57 | )} |
| 58 | {...props} |
| 59 | /> |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | function TabsPanel({ |
| 64 | className, |
| 65 | ...props |
| 66 | }: TabsPrimitive. |
| 67 | return ( |
| 68 | <TabsPrimitive.Panel |
| 69 | data-slot="tabs-panel" |
| 70 | className={cn(" |
| 71 | {...props} |
| 72 | /> |
| 73 | ); |
| 74 | } |
| 75 | |
| 76 | export { Tabs, TabsList |