The Coline design system: accessible React components for Coline Apps, themed live by the host workspace, and for Coline Sites in light and dark. Tailwind v4 stylesheet included. MIT.
| 5 |
| 6 | import { cn } from "../lib/utils" |
| 7 |
| 8 | function Popover({ |
| 9 | ...props |
| 10 | }: React.ComponentProps<typeof PopoverPrimitive.Root>) { |
| 11 | return <PopoverPrimitive.Root data-slot="popover" {...props} /> |
| 12 | } |
| 13 |
| 14 | function PopoverTrigger({ |
| 15 | ...props |
| 16 | }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) { |
| 17 | return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} /> |
| 18 | } |
| 19 |
| 20 | function PopoverContent({ |
| 21 | className, |
| 22 | align = "center", |
| 23 | sideOffset = 4, |
| 24 | ...props |
| 25 | }: React.ComponentProps<typeof PopoverPrimitive.Content>) { |
| 26 | return ( |
| 27 | <PopoverPrimitive.Portal> |
| 28 | <PopoverPrimitive.Content |
| 29 | data-slot="popover-content" |
| 30 | align={align} |
| 31 | sideOffset={sideOffset} |
| 32 | className={cn( |
| 33 | "z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-4 rounded-2xl bg-popover/75 dark:bg-zinc-900/75 backdrop-blur-[3px] p-4 text-sm text-popover-foreground shadow-xl shadow-black/10 dark:shadow-black/30 ring-1 ring-white/15 dark:ring-white/10 inset-ring inset-ring-white/10 dark:inset-ring-white/5 outline-hidden duration-200 ease-out data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", |
| 34 | className |
| 35 | )} |
| 36 | {...props} |
| 37 | /> |
| 38 | </PopoverPrimitive.Portal> |
| 39 | ) |
| 40 | } |
| 41 |
| 42 | function PopoverAnchor({ |
| 43 | ...props |
| 44 | }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) { |
| 45 | return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} /> |
| 46 | } |
| 47 |
| 48 | function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) { |
| 49 | return ( |
| 50 | <div |
| 51 | data-slot="popover-header" |
| 52 | className={cn("flex flex-col gap-1 text-sm", className)} |
| 53 | {...props} |
| 54 | /> |
| 55 | ) |
| 56 | } |
| 57 |
| 58 | function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) { |
| 59 | return ( |
| 60 | <div |
| 61 | data-slot="popover-title" |
| 62 | className={cn("text-base font-medium", className)} |
| 63 | {...props} |
| 64 | /> |
| 65 | ) |
| 66 | } |
| 67 |
| 68 | function PopoverDescription({ |
| 69 | className, |
| 70 | ...props |
| 71 | }: React.ComponentProps<"p">) { |
| 72 | return ( |
| 73 | <p |
| 74 | data-slot="popover-description" |
| 75 | className={cn("text-muted-foreground", className)} |
| 76 | {...props} |
| 77 | /> |
| 78 | ) |
| 79 | } |
| 80 |
| 81 | export { |
| 82 | Popover, |
| 83 | PopoverAnchor, |
| 84 | PopoverContent, |
| 85 | PopoverDescription, |
| 86 | PopoverHeader, |
| 87 | PopoverTitle, |
| 88 | PopoverTrigger, |
| 89 | } |
| 90 |