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