refactor(shadcn): use radix-ui mono-package

This commit is contained in:
z0x 2025-05-07 08:57:45 -04:00
parent bdece0e21b
commit c0aec29131
5 changed files with 10 additions and 13 deletions

View file

@ -25,10 +25,6 @@
"@iconify-json/lucide": "^1.2.40", "@iconify-json/lucide": "^1.2.40",
"@iconify-json/simple-icons": "^1.2.33", "@iconify-json/simple-icons": "^1.2.33",
"@r4ai/remark-callout": "^0.6.2", "@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", "@tailwindcss/vite": "^4.1.5",
"@types/react": "19.0.0", "@types/react": "19.0.0",
"@types/react-dom": "19.0.0", "@types/react-dom": "19.0.0",
@ -40,6 +36,7 @@
"clsx": "^2.1.1", "clsx": "^2.1.1",
"lucide-react": "^0.469.0", "lucide-react": "^0.469.0",
"patch-package": "^8.0.0", "patch-package": "^8.0.0",
"radix-ui": "^1.4.1",
"react": "19.0.0", "react": "19.0.0",
"react-dom": "19.0.0", "react-dom": "19.0.0",
"rehype-document": "^7.0.3", "rehype-document": "^7.0.3",

View file

@ -1,6 +1,6 @@
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { ChevronRightIcon, DotsHorizontalIcon } from "@radix-ui/react-icons"; import { ChevronRight, MoreHorizontal } from "lucide-react";
import { Slot } from "@radix-ui/react-slot"; import { Slot as SlotPrimitive } from "radix-ui";
import type * as React from "react"; import type * as React from "react";
function Breadcrumb({ ...props }: React.ComponentProps<"nav">) { function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
@ -37,7 +37,7 @@ function BreadcrumbLink({
}: React.ComponentProps<"a"> & { }: React.ComponentProps<"a"> & {
asChild?: boolean; asChild?: boolean;
}) { }) {
const Comp = asChild ? Slot : "a"; const Comp = asChild ? SlotPrimitive.Root : "a";
return ( return (
<Comp <Comp
@ -74,7 +74,7 @@ function BreadcrumbSeparator({
className={cn("[&>svg]:size-3.5", className)} className={cn("[&>svg]:size-3.5", className)}
{...props} {...props}
> >
{children ?? <ChevronRightIcon />} {children ?? <ChevronRight />}
</li> </li>
); );
} }
@ -91,7 +91,7 @@ function BreadcrumbEllipsis({
className={cn("flex size-9 items-center justify-center", className)} className={cn("flex size-9 items-center justify-center", className)}
{...props} {...props}
> >
<DotsHorizontalIcon className="size-4" /> <MoreHorizontal className="size-4" />
<span className="sr-only">More</span> <span className="sr-only">More</span>
</span> </span>
); );

View file

@ -1,5 +1,5 @@
import { Slot } from "@radix-ui/react-slot";
import { type VariantProps, cva } from "class-variance-authority"; import { type VariantProps, cva } from "class-variance-authority";
import { Slot as SlotPrimitive } from "radix-ui";
import type * as React from "react"; import type * as React from "react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
@ -44,7 +44,7 @@ function Button({
VariantProps<typeof buttonVariants> & { VariantProps<typeof buttonVariants> & {
asChild?: boolean; asChild?: boolean;
}) { }) {
const Comp = asChild ? Slot : "button"; const Comp = asChild ? SlotPrimitive.Root : "button";
return ( return (
<Comp <Comp

View file

@ -1,4 +1,4 @@
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"; import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
import type * as React from "react"; import type * as React from "react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";

View file

@ -1,4 +1,4 @@
import * as SeparatorPrimitive from "@radix-ui/react-separator"; import { Separator as SeparatorPrimitive } from "radix-ui";
import type * as React from "react"; import type * as React from "react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";