From c0aec291313b1e68971561184b352ef8a048b3cb Mon Sep 17 00:00:00 2001 From: z0x Date: Wed, 7 May 2025 08:57:45 -0400 Subject: [PATCH] refactor(shadcn): use radix-ui mono-package --- package.json | 5 +---- src/components/ui/breadcrumb.tsx | 10 +++++----- src/components/ui/button.tsx | 4 ++-- src/components/ui/scroll-area.tsx | 2 +- src/components/ui/separator.tsx | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index b743cf7..50c29ac 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,6 @@ "@iconify-json/lucide": "^1.2.40", "@iconify-json/simple-icons": "^1.2.33", "@r4ai/remark-callout": "^0.6.2", - "@radix-ui/react-icons": "^1.3.2", - "@radix-ui/react-scroll-area": "^1.2.8", - "@radix-ui/react-separator": "^1.1.6", - "@radix-ui/react-slot": "^1.2.2", "@tailwindcss/vite": "^4.1.5", "@types/react": "19.0.0", "@types/react-dom": "19.0.0", @@ -40,6 +36,7 @@ "clsx": "^2.1.1", "lucide-react": "^0.469.0", "patch-package": "^8.0.0", + "radix-ui": "^1.4.1", "react": "19.0.0", "react-dom": "19.0.0", "rehype-document": "^7.0.3", diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx index 9e0bd69..582c49a 100644 --- a/src/components/ui/breadcrumb.tsx +++ b/src/components/ui/breadcrumb.tsx @@ -1,6 +1,6 @@ import { cn } from "@/lib/utils"; -import { ChevronRightIcon, DotsHorizontalIcon } from "@radix-ui/react-icons"; -import { Slot } from "@radix-ui/react-slot"; +import { ChevronRight, MoreHorizontal } from "lucide-react"; +import { Slot as SlotPrimitive } from "radix-ui"; import type * as React from "react"; function Breadcrumb({ ...props }: React.ComponentProps<"nav">) { @@ -37,7 +37,7 @@ function BreadcrumbLink({ }: React.ComponentProps<"a"> & { asChild?: boolean; }) { - const Comp = asChild ? Slot : "a"; + const Comp = asChild ? SlotPrimitive.Root : "a"; return ( svg]:size-3.5", className)} {...props} > - {children ?? } + {children ?? } ); } @@ -91,7 +91,7 @@ function BreadcrumbEllipsis({ className={cn("flex size-9 items-center justify-center", className)} {...props} > - + More ); diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 0f5a19d..9db889c 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -1,5 +1,5 @@ -import { Slot } from "@radix-ui/react-slot"; import { type VariantProps, cva } from "class-variance-authority"; +import { Slot as SlotPrimitive } from "radix-ui"; import type * as React from "react"; import { cn } from "@/lib/utils"; @@ -44,7 +44,7 @@ function Button({ VariantProps & { asChild?: boolean; }) { - const Comp = asChild ? Slot : "button"; + const Comp = asChild ? SlotPrimitive.Root : "button"; return (