Upload frontend/src/components/ui/dialog.tsx with huggingface_hub
Browse files
frontend/src/components/ui/dialog.tsx
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import * as React from "react";
|
| 4 |
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
| 5 |
+
import { X } from "lucide-react";
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils";
|
| 8 |
+
|
| 9 |
+
const Dialog = DialogPrimitive.Root;
|
| 10 |
+
|
| 11 |
+
const DialogTrigger = DialogPrimitive.Trigger;
|
| 12 |
+
|
| 13 |
+
const DialogPortal = DialogPrimitive.Portal;
|
| 14 |
+
|
| 15 |
+
const DialogClose = DialogPrimitive.Close;
|
| 16 |
+
|
| 17 |
+
const DialogOverlay = React.forwardRef<
|
| 18 |
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
| 19 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
| 20 |
+
>(({ className, ...props }, ref) => (
|
| 21 |
+
<DialogPrimitive.Overlay
|
| 22 |
+
ref={ref}
|
| 23 |
+
className={cn(
|
| 24 |
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
| 25 |
+
className,
|
| 26 |
+
)}
|
| 27 |
+
{...props}
|
| 28 |
+
/>
|
| 29 |
+
));
|
| 30 |
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
| 31 |
+
|
| 32 |
+
const DialogContent = React.forwardRef<
|
| 33 |
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
| 34 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
| 35 |
+
>(({ className, children, ...props }, ref) => (
|
| 36 |
+
<DialogPortal>
|
| 37 |
+
<DialogOverlay />
|
| 38 |
+
<DialogPrimitive.Content
|
| 39 |
+
ref={ref}
|
| 40 |
+
className={cn(
|
| 41 |
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",
|
| 42 |
+
className,
|
| 43 |
+
)}
|
| 44 |
+
{...props}
|
| 45 |
+
>
|
| 46 |
+
{children}
|
| 47 |
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
| 48 |
+
<X className="h-4 w-4" />
|
| 49 |
+
<span className="sr-only">Close</span>
|
| 50 |
+
</DialogPrimitive.Close>
|
| 51 |
+
</DialogPrimitive.Content>
|
| 52 |
+
</DialogPortal>
|
| 53 |
+
));
|
| 54 |
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
| 55 |
+
|
| 56 |
+
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
| 57 |
+
<div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />
|
| 58 |
+
);
|
| 59 |
+
DialogHeader.displayName = "DialogHeader";
|
| 60 |
+
|
| 61 |
+
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
| 62 |
+
<div
|
| 63 |
+
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
| 64 |
+
{...props}
|
| 65 |
+
/>
|
| 66 |
+
);
|
| 67 |
+
DialogFooter.displayName = "DialogFooter";
|
| 68 |
+
|
| 69 |
+
const DialogTitle = React.forwardRef<
|
| 70 |
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
| 71 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
| 72 |
+
>(({ className, ...props }, ref) => (
|
| 73 |
+
<DialogPrimitive.Title
|
| 74 |
+
ref={ref}
|
| 75 |
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
| 76 |
+
{...props}
|
| 77 |
+
/>
|
| 78 |
+
));
|
| 79 |
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
| 80 |
+
|
| 81 |
+
const DialogDescription = React.forwardRef<
|
| 82 |
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
| 83 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
| 84 |
+
>(({ className, ...props }, ref) => (
|
| 85 |
+
<DialogPrimitive.Description
|
| 86 |
+
ref={ref}
|
| 87 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 88 |
+
{...props}
|
| 89 |
+
/>
|
| 90 |
+
));
|
| 91 |
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
| 92 |
+
|
| 93 |
+
export {
|
| 94 |
+
Dialog,
|
| 95 |
+
DialogPortal,
|
| 96 |
+
DialogOverlay,
|
| 97 |
+
DialogTrigger,
|
| 98 |
+
DialogClose,
|
| 99 |
+
DialogContent,
|
| 100 |
+
DialogHeader,
|
| 101 |
+
DialogFooter,
|
| 102 |
+
DialogTitle,
|
| 103 |
+
DialogDescription,
|
| 104 |
+
};
|