| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 1 | import * as React from "react"; |
| 2 | import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; |
| 3 | import { cn } from "@/lib/utils"; |
| 4 | import { CheckIcon } from "@radix-ui/react-icons"; |
| gio | 9b2d496 | 2025-05-07 04:59:39 +0000 | [diff] [blame] | 5 | |
| 6 | const Checkbox = React.forwardRef< |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 7 | React.ElementRef<typeof CheckboxPrimitive.Root>, |
| 8 | React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> |
| gio | 9b2d496 | 2025-05-07 04:59:39 +0000 | [diff] [blame] | 9 | >(({ className, ...props }, ref) => ( |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 10 | <CheckboxPrimitive.Root |
| 11 | ref={ref} |
| 12 | className={cn( |
| 13 | "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", |
| 14 | className, |
| 15 | )} |
| 16 | {...props} |
| 17 | > |
| 18 | <CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}> |
| 19 | <CheckIcon className="h-4 w-4" /> |
| 20 | </CheckboxPrimitive.Indicator> |
| 21 | </CheckboxPrimitive.Root> |
| 22 | )); |
| 23 | Checkbox.displayName = CheckboxPrimitive.Root.displayName; |
| gio | 9b2d496 | 2025-05-07 04:59:39 +0000 | [diff] [blame] | 24 | |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 25 | export { Checkbox }; |