| 1 |
1eb203e |
Mrdn |
2y ago |
import * as React from "react" |
| 2 |
1eb203e |
Mrdn |
2y ago |
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group" |
| 3 |
1eb203e |
Mrdn |
2y ago |
import { Circle } from "lucide-react" |
| 4 |
1eb203e |
Mrdn |
2y ago |
|
| 5 |
d636f3f |
Dawsh |
2y ago |
import { cn } from "@marzneshin/common/utils" |
| 6 |
1eb203e |
Mrdn |
2y ago |
|
| 7 |
1eb203e |
Mrdn |
2y ago |
const RadioGroup = React.forwardRef< |
| 8 |
d636f3f |
Dawsh |
2y ago |
React.ElementRef<typeof RadioGroupPrimitive.Root>, |
| 9 |
d636f3f |
Dawsh |
2y ago |
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> |
| 10 |
1eb203e |
Mrdn |
2y ago |
>(({ className, ...props }, ref) => { |
| 11 |
d636f3f |
Dawsh |
2y ago |
return ( |
| 12 |
d636f3f |
Dawsh |
2y ago |
<RadioGroupPrimitive.Root |
| 13 |
d636f3f |
Dawsh |
2y ago |
className={cn("grid gap-2", className)} |
| 14 |
d636f3f |
Dawsh |
2y ago |
{...props} |
| 15 |
d636f3f |
Dawsh |
2y ago |
ref={ref} |
| 16 |
d636f3f |
Dawsh |
2y ago |
/> |
| 17 |
d636f3f |
Dawsh |
2y ago |
) |
| 18 |
1eb203e |
Mrdn |
2y ago |
}) |
| 19 |
1eb203e |
Mrdn |
2y ago |
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName |
| 20 |
1eb203e |
Mrdn |
2y ago |
|
| 21 |
1eb203e |
Mrdn |
2y ago |
const RadioGroupItem = React.forwardRef< |
| 22 |
d636f3f |
Dawsh |
2y ago |
React.ElementRef<typeof RadioGroupPrimitive.Item>, |
| 23 |
d636f3f |
Dawsh |
2y ago |
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> |
| 24 |
1eb203e |
Mrdn |
2y ago |
>(({ className, ...props }, ref) => { |
| 25 |
d636f3f |
Dawsh |
2y ago |
return ( |
| 26 |
d636f3f |
Dawsh |
2y ago |
<RadioGroupPrimitive.Item |
| 27 |
d636f3f |
Dawsh |
2y ago |
ref={ref} |
| 28 |
d636f3f |
Dawsh |
2y ago |
className={cn( |
| 29 |
d636f3f |
Dawsh |
2y ago |
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", |
| 30 |
d636f3f |
Dawsh |
2y ago |
className |
| 31 |
d636f3f |
Dawsh |
2y ago |
)} |
| 32 |
d636f3f |
Dawsh |
2y ago |
{...props} |
| 33 |
d636f3f |
Dawsh |
2y ago |
> |
| 34 |
d636f3f |
Dawsh |
2y ago |
<RadioGroupPrimitive.Indicator className="flex items-center justify-center"> |
| 35 |
d636f3f |
Dawsh |
2y ago |
<Circle className="h-2.5 w-2.5 fill-current text-current" /> |
| 36 |
d636f3f |
Dawsh |
2y ago |
</RadioGroupPrimitive.Indicator> |
| 37 |
d636f3f |
Dawsh |
2y ago |
</RadioGroupPrimitive.Item> |
| 38 |
d636f3f |
Dawsh |
2y ago |
) |
| 39 |
1eb203e |
Mrdn |
2y ago |
}) |
| 40 |
1eb203e |
Mrdn |
2y ago |
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName |
| 41 |
1eb203e |
Mrdn |
2y ago |
|
| 42 |
1eb203e |
Mrdn |
2y ago |
export { RadioGroup, RadioGroupItem } |