| 1 | import { cva, type VariantProps } from "class-variance-authority"; |
| 2 | import { cn } |
| 3 | |
| 4 | function Empty({ className |
| 5 | return ( |
| 6 | <div |
| 7 | data-slot="empty" |
| 8 | className={cn( |
| 9 | "flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance", |
| 10 | className, |
| 11 | )} |
| 12 | {...props} |
| 13 | /> |
| 14 | ); |
| 15 | } |
| 16 | |
| 17 | function EmptyHeader({ className |
| 18 | return ( |
| 19 | <div |
| 20 | data-slot="empty-header" |
| 21 | className={cn(" |
| 22 | {...props} |
| 23 | /> |
| 24 | ); |
| 25 | } |
| 26 | |
| 27 | const emptyMediaVariants = cva |
| 28 | "mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", |
| 29 | { |
| 30 | variants: { |
| 31 | variant: { |
| 32 | default: "bg-transparent", |
| 33 | icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4", |
| 34 | }, |
| 35 | }, |
| 36 | defaultVariants: { |
| 37 | variant: "default", |
| 38 | }, |
| 39 | }, |
| 40 | ); |
| 41 | |
| 42 | function EmptyMedia({ |
| 43 | className, |
| 44 | variant = "default" |
| 45 | ...props |
| 46 | }: React. |
| 47 | return ( |
| 48 | <div |
| 49 | data-slot="empty-icon" |
| 50 | data-variant={variant} |
| 51 | className={cn(emptyMediaVariants |
| 52 | {...props} |
| 53 | /> |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | function EmptyTitle({ className |
| 58 | return ( |
| 59 | <div |
| 60 | data-slot="empty-title" |
| 61 | className={cn( |
| 62 | "font-heading text-sm font-medium tracking-tight", |
| 63 | className, |
| 64 | )} |
| 65 | {...props} |
| 66 | /> |
| 67 | ); |
| 68 | } |
| 69 | |
| 70 | function EmptyDescription({ className |
| 71 | return ( |
| 72 | <div |
| 73 | data-slot="empty-description" |
| 74 | className={cn( |
| 75 | "text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", |
| 76 | className, |
| 77 | )} |
| 78 | {...props} |
| 79 | /> |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | function EmptyContent({ className |
| 84 | return ( |
| 85 | <div |
| 86 | data-slot="empty-content" |
| 87 | className={cn( |
| 88 | "flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance", |
| 89 | className, |
| 90 | )} |
| 91 | {...props} |
| 92 | /> |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | export { |
| 97 | Empty, |
| 98 | EmptyHeader, |
| 99 | EmptyTitle, |
| 100 | EmptyDescription, |
| 101 | EmptyContent, |
| 102 | EmptyMedia, |
| 103 | }; |