From 66668d85d603c5841d755a6023aa1925559fc6d4 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Wed, 25 Feb 2026 01:32:51 +0800 Subject: chore(workspace): replace legacy codes --- packages/ui-new/src/components/ui/avatar.tsx | 107 -------- packages/ui-new/src/components/ui/badge.tsx | 52 ---- packages/ui-new/src/components/ui/button.tsx | 56 ----- packages/ui-new/src/components/ui/card.tsx | 103 -------- packages/ui-new/src/components/ui/checkbox.tsx | 27 --- packages/ui-new/src/components/ui/dialog.tsx | 155 ------------ .../ui-new/src/components/ui/dropdown-menu.tsx | 269 --------------------- packages/ui-new/src/components/ui/field.tsx | 238 ------------------ packages/ui-new/src/components/ui/input.tsx | 20 -- packages/ui-new/src/components/ui/label.tsx | 19 -- packages/ui-new/src/components/ui/scroll-area.tsx | 53 ---- packages/ui-new/src/components/ui/select.tsx | 199 --------------- packages/ui-new/src/components/ui/separator.tsx | 25 -- packages/ui-new/src/components/ui/sonner.tsx | 43 ---- packages/ui-new/src/components/ui/spinner.tsx | 10 - packages/ui-new/src/components/ui/switch.tsx | 32 --- packages/ui-new/src/components/ui/tabs.tsx | 80 ------ packages/ui-new/src/components/ui/textarea.tsx | 18 -- 18 files changed, 1506 deletions(-) delete mode 100644 packages/ui-new/src/components/ui/avatar.tsx delete mode 100644 packages/ui-new/src/components/ui/badge.tsx delete mode 100644 packages/ui-new/src/components/ui/button.tsx delete mode 100644 packages/ui-new/src/components/ui/card.tsx delete mode 100644 packages/ui-new/src/components/ui/checkbox.tsx delete mode 100644 packages/ui-new/src/components/ui/dialog.tsx delete mode 100644 packages/ui-new/src/components/ui/dropdown-menu.tsx delete mode 100644 packages/ui-new/src/components/ui/field.tsx delete mode 100644 packages/ui-new/src/components/ui/input.tsx delete mode 100644 packages/ui-new/src/components/ui/label.tsx delete mode 100644 packages/ui-new/src/components/ui/scroll-area.tsx delete mode 100644 packages/ui-new/src/components/ui/select.tsx delete mode 100644 packages/ui-new/src/components/ui/separator.tsx delete mode 100644 packages/ui-new/src/components/ui/sonner.tsx delete mode 100644 packages/ui-new/src/components/ui/spinner.tsx delete mode 100644 packages/ui-new/src/components/ui/switch.tsx delete mode 100644 packages/ui-new/src/components/ui/tabs.tsx delete mode 100644 packages/ui-new/src/components/ui/textarea.tsx (limited to 'packages/ui-new/src/components/ui') diff --git a/packages/ui-new/src/components/ui/avatar.tsx b/packages/ui-new/src/components/ui/avatar.tsx deleted file mode 100644 index 9fd72a2..0000000 --- a/packages/ui-new/src/components/ui/avatar.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar"; -import type * as React from "react"; - -import { cn } from "@/lib/utils"; - -function Avatar({ - className, - size = "default", - ...props -}: AvatarPrimitive.Root.Props & { - size?: "default" | "sm" | "lg"; -}) { - return ( - - ); -} - -function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) { - return ( - - ); -} - -function AvatarFallback({ - className, - ...props -}: AvatarPrimitive.Fallback.Props) { - return ( - - ); -} - -function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) { - return ( - svg]:hidden", - "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", - "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", - className, - )} - {...props} - /> - ); -} - -function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function AvatarGroupCount({ - className, - ...props -}: React.ComponentProps<"div">) { - return ( -
svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3 ring-background relative flex shrink-0 items-center justify-center ring-2", - className, - )} - {...props} - /> - ); -} - -export { - Avatar, - AvatarImage, - AvatarFallback, - AvatarGroup, - AvatarGroupCount, - AvatarBadge, -}; diff --git a/packages/ui-new/src/components/ui/badge.tsx b/packages/ui-new/src/components/ui/badge.tsx deleted file mode 100644 index 425ab9e..0000000 --- a/packages/ui-new/src/components/ui/badge.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { mergeProps } from "@base-ui/react/merge-props"; -import { useRender } from "@base-ui/react/use-render"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/lib/utils"; - -const badgeVariants = cva( - "h-5 gap-1 rounded-none border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge", - { - variants: { - variant: { - default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", - secondary: - "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80", - destructive: - "bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20", - outline: - "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground", - ghost: - "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50", - link: "text-primary underline-offset-4 hover:underline", - }, - }, - defaultVariants: { - variant: "default", - }, - }, -); - -function Badge({ - className, - variant = "default", - render, - ...props -}: useRender.ComponentProps<"span"> & VariantProps) { - return useRender({ - defaultTagName: "span", - props: mergeProps<"span">( - { - className: cn(badgeVariants({ variant }), className), - }, - props, - ), - render, - state: { - slot: "badge", - variant, - }, - }); -} - -export { Badge, badgeVariants }; diff --git a/packages/ui-new/src/components/ui/button.tsx b/packages/ui-new/src/components/ui/button.tsx deleted file mode 100644 index 7dee494..0000000 --- a/packages/ui-new/src/components/ui/button.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Button as ButtonPrimitive } from "@base-ui/react/button"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/lib/utils"; - -const buttonVariants = cva( - "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-none border border-transparent bg-clip-padding text-xs font-medium focus-visible:ring-1 aria-invalid:ring-1 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none", - { - variants: { - variant: { - default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", - outline: - "border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground", - ghost: - "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground", - destructive: - "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30", - link: "text-primary underline-offset-4 hover:underline", - }, - size: { - default: - "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", - xs: "h-6 gap-1 rounded-none px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", - sm: "h-7 gap-1 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5", - lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3", - icon: "size-8", - "icon-xs": "size-6 rounded-none [&_svg:not([class*='size-'])]:size-3", - "icon-sm": "size-7 rounded-none", - "icon-lg": "size-9", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - -function Button({ - className, - variant = "default", - size = "default", - ...props -}: ButtonPrimitive.Props & VariantProps) { - return ( - - ); -} - -export { Button, buttonVariants }; diff --git a/packages/ui-new/src/components/ui/card.tsx b/packages/ui-new/src/components/ui/card.tsx deleted file mode 100644 index b7084a0..0000000 --- a/packages/ui-new/src/components/ui/card.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import type * as React from "react"; - -import { cn } from "@/lib/utils"; - -function Card({ - className, - size = "default", - ...props -}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) { - return ( -
img:first-child]:pt-0 data-[size=sm]:gap-2 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-none *:[img:last-child]:rounded-none group/card flex flex-col", - className, - )} - {...props} - /> - ); -} - -function CardHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function CardTitle({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function CardDescription({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function CardAction({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function CardContent({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function CardFooter({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -export { - Card, - CardHeader, - CardFooter, - CardTitle, - CardAction, - CardDescription, - CardContent, -}; diff --git a/packages/ui-new/src/components/ui/checkbox.tsx b/packages/ui-new/src/components/ui/checkbox.tsx deleted file mode 100644 index 9f22cea..0000000 --- a/packages/ui-new/src/components/ui/checkbox.tsx +++ /dev/null @@ -1,27 +0,0 @@ -"use client"; - -import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"; -import { CheckIcon } from "lucide-react"; -import { cn } from "@/lib/utils"; - -function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) { - return ( - - - - - - ); -} - -export { Checkbox }; diff --git a/packages/ui-new/src/components/ui/dialog.tsx b/packages/ui-new/src/components/ui/dialog.tsx deleted file mode 100644 index 033b47c..0000000 --- a/packages/ui-new/src/components/ui/dialog.tsx +++ /dev/null @@ -1,155 +0,0 @@ -"use client"; - -import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"; -import { XIcon } from "lucide-react"; -import type * as React from "react"; -import { Button } from "@/components/ui/button"; -import { cn } from "@/lib/utils"; - -function Dialog({ ...props }: DialogPrimitive.Root.Props) { - return ; -} - -function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) { - return ; -} - -function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) { - return ; -} - -function DialogClose({ ...props }: DialogPrimitive.Close.Props) { - return ; -} - -function DialogOverlay({ - className, - ...props -}: DialogPrimitive.Backdrop.Props) { - return ( - - ); -} - -function DialogContent({ - className, - children, - showCloseButton = true, - ...props -}: DialogPrimitive.Popup.Props & { - showCloseButton?: boolean; -}) { - return ( - - - - {children} - {showCloseButton && ( - - } - > - - Close - - )} - - - ); -} - -function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function DialogFooter({ - className, - showCloseButton = false, - children, - ...props -}: React.ComponentProps<"div"> & { - showCloseButton?: boolean; -}) { - return ( -
- {children} - {showCloseButton && ( - }> - Close - - )} -
- ); -} - -function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) { - return ( - - ); -} - -function DialogDescription({ - className, - ...props -}: DialogPrimitive.Description.Props) { - return ( - - ); -} - -export { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogOverlay, - DialogPortal, - DialogTitle, - DialogTrigger, -}; diff --git a/packages/ui-new/src/components/ui/dropdown-menu.tsx b/packages/ui-new/src/components/ui/dropdown-menu.tsx deleted file mode 100644 index ee97374..0000000 --- a/packages/ui-new/src/components/ui/dropdown-menu.tsx +++ /dev/null @@ -1,269 +0,0 @@ -import { Menu as MenuPrimitive } from "@base-ui/react/menu"; -import { CheckIcon, ChevronRightIcon } from "lucide-react"; -import type * as React from "react"; -import { cn } from "@/lib/utils"; - -function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) { - return ; -} - -function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) { - return ; -} - -function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) { - return ; -} - -function DropdownMenuContent({ - align = "start", - alignOffset = 0, - side = "bottom", - sideOffset = 4, - className, - ...props -}: MenuPrimitive.Popup.Props & - Pick< - MenuPrimitive.Positioner.Props, - "align" | "alignOffset" | "side" | "sideOffset" - >) { - return ( - - - - - - ); -} - -function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) { - return ; -} - -function DropdownMenuLabel({ - className, - inset, - ...props -}: MenuPrimitive.GroupLabel.Props & { - inset?: boolean; -}) { - return ( - - ); -} - -function DropdownMenuItem({ - className, - inset, - variant = "default", - ...props -}: MenuPrimitive.Item.Props & { - inset?: boolean; - variant?: "default" | "destructive"; -}) { - return ( - - ); -} - -function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) { - return ; -} - -function DropdownMenuSubTrigger({ - className, - inset, - children, - ...props -}: MenuPrimitive.SubmenuTrigger.Props & { - inset?: boolean; -}) { - return ( - - {children} - - - ); -} - -function DropdownMenuSubContent({ - align = "start", - alignOffset = -3, - side = "right", - sideOffset = 0, - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function DropdownMenuCheckboxItem({ - className, - children, - checked, - inset, - ...props -}: MenuPrimitive.CheckboxItem.Props & { - inset?: boolean; -}) { - return ( - - - - - - - {children} - - ); -} - -function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) { - return ( - - ); -} - -function DropdownMenuRadioItem({ - className, - children, - inset, - ...props -}: MenuPrimitive.RadioItem.Props & { - inset?: boolean; -}) { - return ( - - - - - - - {children} - - ); -} - -function DropdownMenuSeparator({ - className, - ...props -}: MenuPrimitive.Separator.Props) { - return ( - - ); -} - -function DropdownMenuShortcut({ - className, - ...props -}: React.ComponentProps<"span">) { - return ( - - ); -} - -export { - DropdownMenu, - DropdownMenuPortal, - DropdownMenuTrigger, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuLabel, - DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioGroup, - DropdownMenuRadioItem, - DropdownMenuSeparator, - DropdownMenuShortcut, - DropdownMenuSub, - DropdownMenuSubTrigger, - DropdownMenuSubContent, -}; diff --git a/packages/ui-new/src/components/ui/field.tsx b/packages/ui-new/src/components/ui/field.tsx deleted file mode 100644 index ab9fb71..0000000 --- a/packages/ui-new/src/components/ui/field.tsx +++ /dev/null @@ -1,238 +0,0 @@ -import { cva, type VariantProps } from "class-variance-authority"; -import { useMemo } from "react"; -import { Label } from "@/components/ui/label"; -import { Separator } from "@/components/ui/separator"; -import { cn } from "@/lib/utils"; - -function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) { - return ( -
[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 flex flex-col", - className, - )} - {...props} - /> - ); -} - -function FieldLegend({ - className, - variant = "legend", - ...props -}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) { - return ( - - ); -} - -function FieldGroup({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -const fieldVariants = cva( - "data-[invalid=true]:text-destructive gap-2 group/field flex w-full", - { - variants: { - orientation: { - vertical: "flex-col *:w-full [&>.sr-only]:w-auto", - horizontal: - "flex-row items-center *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px", - responsive: - "flex-col *:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:*:data-[slot=field-label]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px", - }, - }, - defaultVariants: { - orientation: "vertical", - }, - }, -); - -function Field({ - className, - orientation = "vertical", - ...props -}: React.ComponentProps<"div"> & VariantProps) { - return ( -
- ); -} - -function FieldContent({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function FieldLabel({ - className, - ...props -}: React.ComponentProps) { - return ( -