2024-10-13 16:18:54 -04:00
|
|
|
"use client"
|
|
|
|
|
|
|
|
import * as React from "react"
|
|
|
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
|
|
|
import { Circle } from "lucide-react"
|
|
|
|
|
2025-01-01 21:41:31 -05:00
|
|
|
import { cn } from "@app/lib/cn"
|
2024-10-13 16:18:54 -04:00
|
|
|
|
2025-04-12 12:40:52 -04:00
|
|
|
const RadioGroup = (
|
|
|
|
{
|
|
|
|
ref,
|
|
|
|
className,
|
|
|
|
...props
|
|
|
|
}: React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> & {
|
|
|
|
ref: React.RefObject<React.ElementRef<typeof RadioGroupPrimitive.Root>>;
|
|
|
|
}
|
|
|
|
) => {
|
2024-10-13 16:18:54 -04:00
|
|
|
return (
|
|
|
|
<RadioGroupPrimitive.Root
|
|
|
|
className={cn("grid gap-2", className)}
|
|
|
|
{...props}
|
|
|
|
ref={ref}
|
|
|
|
/>
|
|
|
|
)
|
2025-04-12 12:40:52 -04:00
|
|
|
}
|
2024-10-13 16:18:54 -04:00
|
|
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
|
|
|
|
|
2025-04-12 12:40:52 -04:00
|
|
|
const RadioGroupItem = (
|
|
|
|
{
|
|
|
|
ref,
|
|
|
|
className,
|
|
|
|
...props
|
|
|
|
}: React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {
|
|
|
|
ref: React.RefObject<React.ElementRef<typeof RadioGroupPrimitive.Item>>;
|
|
|
|
}
|
|
|
|
) => {
|
2024-10-13 16:18:54 -04:00
|
|
|
return (
|
|
|
|
<RadioGroupPrimitive.Item
|
|
|
|
ref={ref}
|
|
|
|
className={cn(
|
2025-04-12 19:50:30 -04:00
|
|
|
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
2024-10-13 16:18:54 -04:00
|
|
|
className
|
|
|
|
)}
|
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
|
|
<Circle className="h-2.5 w-2.5 fill-current text-current" />
|
|
|
|
</RadioGroupPrimitive.Indicator>
|
|
|
|
</RadioGroupPrimitive.Item>
|
|
|
|
)
|
2025-04-12 12:40:52 -04:00
|
|
|
}
|
2024-10-13 16:18:54 -04:00
|
|
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
|
|
|
|
|
|
|
|
export { RadioGroup, RadioGroupItem }
|