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/dialog.tsx | 80 ++++++++++++++++------------ 1 file changed, 47 insertions(+), 33 deletions(-) (limited to 'packages/ui-new/src/components/ui/dialog.tsx') diff --git a/packages/ui-new/src/components/ui/dialog.tsx b/packages/ui-new/src/components/ui/dialog.tsx index fc2261a..033b47c 100644 --- a/packages/ui-new/src/components/ui/dialog.tsx +++ b/packages/ui-new/src/components/ui/dialog.tsx @@ -1,42 +1,36 @@ -import * as DialogPrimitive from "@radix-ui/react-dialog"; +"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 -}: React.ComponentProps) { +function Dialog({ ...props }: DialogPrimitive.Root.Props) { return ; } -function DialogTrigger({ - ...props -}: React.ComponentProps) { +function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) { return ; } -function DialogPortal({ - ...props -}: React.ComponentProps) { +function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) { return ; } -function DialogClose({ - ...props -}: React.ComponentProps) { +function DialogClose({ ...props }: DialogPrimitive.Close.Props) { return ; } function DialogOverlay({ className, ...props -}: React.ComponentProps) { +}: DialogPrimitive.Backdrop.Props) { return ( - & { +}: DialogPrimitive.Popup.Props & { showCloseButton?: boolean; }) { return ( - + - + } > Close )} - + ); } @@ -82,13 +82,20 @@ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { return (
); } -function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { +function DialogFooter({ + className, + showCloseButton = false, + children, + ...props +}: React.ComponentProps<"div"> & { + showCloseButton?: boolean; +}) { return (
) { className, )} {...props} - /> + > + {children} + {showCloseButton && ( + }> + Close + + )} +
); } -function DialogTitle({ - className, - ...props -}: React.ComponentProps) { +function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) { return ( ); @@ -117,11 +128,14 @@ function DialogTitle({ function DialogDescription({ className, ...props -}: React.ComponentProps) { +}: DialogPrimitive.Description.Props) { return ( ); -- cgit v1.2.3-70-g09d2