From 01b546cc816c4fb6b7389e5122b7802d7e724a2b Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Sun, 22 Feb 2026 19:47:13 +0800 Subject: refactor(shadcn): use base lyra instead --- packages/ui-new/src/components/ui/tabs.tsx | 62 ++++++++++++++++++------------ 1 file changed, 38 insertions(+), 24 deletions(-) (limited to 'packages/ui-new/src/components/ui/tabs.tsx') diff --git a/packages/ui-new/src/components/ui/tabs.tsx b/packages/ui-new/src/components/ui/tabs.tsx index 2da77f2..6349f40 100644 --- a/packages/ui-new/src/components/ui/tabs.tsx +++ b/packages/ui-new/src/components/ui/tabs.tsx @@ -1,48 +1,65 @@ -"use client"; - -import * as TabsPrimitive from "@radix-ui/react-tabs"; -import type * as React from "react"; +import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"; +import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; function Tabs({ className, + orientation = "horizontal", ...props -}: React.ComponentProps) { +}: TabsPrimitive.Root.Props) { return ( ); } +const tabsListVariants = cva( + "rounded-none p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col", + { + variants: { + variant: { + default: "bg-muted", + line: "gap-1 bg-transparent", + }, + }, + defaultVariants: { + variant: "default", + }, + }, +); + function TabsList({ className, + variant = "default", ...props -}: React.ComponentProps) { +}: TabsPrimitive.List.Props & VariantProps) { return ( ); } -function TabsTrigger({ - className, - ...props -}: React.ComponentProps) { +function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) { return ( - ) { +function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) { return ( - ); } -export { Tabs, TabsList, TabsTrigger, TabsContent }; +export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }; -- cgit v1.2.3-70-g09d2