|
| 1 | +import { tv } from 'tailwind-variants'; |
| 2 | + |
| 3 | +export const radioVariants = tv({ |
| 4 | + defaultVariants: { |
| 5 | + color: 'primary', |
| 6 | + orientation: 'horizontal', |
| 7 | + size: 'md' |
| 8 | + }, |
| 9 | + slots: { |
| 10 | + control: [ |
| 11 | + 'peer relative shrink-0 rounded-full border shadow', |
| 12 | + 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background', |
| 13 | + 'disabled:cursor-not-allowed disabled:opacity-50' |
| 14 | + ], |
| 15 | + group: 'flex', |
| 16 | + indicator: 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-1/2 rounded-full ', |
| 17 | + label: '', |
| 18 | + root: 'flex items-center' |
| 19 | + }, |
| 20 | + variants: { |
| 21 | + color: { |
| 22 | + accent: { |
| 23 | + control: `border-accent-foreground focus-visible:ring-accent-foreground/20`, |
| 24 | + indicator: `bg-accent-foreground/60` |
| 25 | + }, |
| 26 | + carbon: { |
| 27 | + control: `border-carbon focus-visible:ring-carbon`, |
| 28 | + indicator: `bg-carbon` |
| 29 | + }, |
| 30 | + destructive: { |
| 31 | + control: `border-destructive focus-visible:ring-destructive`, |
| 32 | + indicator: `bg-destructive` |
| 33 | + }, |
| 34 | + info: { |
| 35 | + control: `border-info focus-visible:ring-info`, |
| 36 | + indicator: `bg-info` |
| 37 | + }, |
| 38 | + primary: { |
| 39 | + control: `border-primary focus-visible:ring-primary`, |
| 40 | + indicator: `bg-primary` |
| 41 | + }, |
| 42 | + secondary: { |
| 43 | + control: `border-secondary-foreground focus-visible:ring-secondary-foreground/20`, |
| 44 | + indicator: `bg-secondary-foreground/60` |
| 45 | + }, |
| 46 | + success: { |
| 47 | + control: `border-success focus-visible:ring-success`, |
| 48 | + indicator: `bg-success` |
| 49 | + }, |
| 50 | + warning: { |
| 51 | + control: `border-warning focus-visible:ring-warning`, |
| 52 | + indicator: `bg-warning` |
| 53 | + } |
| 54 | + }, |
| 55 | + orientation: { |
| 56 | + horizontal: { |
| 57 | + group: 'items-center' |
| 58 | + }, |
| 59 | + vertical: { |
| 60 | + group: 'flex-col' |
| 61 | + } |
| 62 | + }, |
| 63 | + size: { |
| 64 | + '2xl': { |
| 65 | + control: 'size-6', |
| 66 | + group: 'gap-x-4.5 gap-y-3.5', |
| 67 | + root: 'gap-3.5' |
| 68 | + }, |
| 69 | + lg: { |
| 70 | + control: 'size-4.5', |
| 71 | + group: 'gap-x-3.5 gap-y-2.5', |
| 72 | + root: 'gap-2.5' |
| 73 | + }, |
| 74 | + md: { |
| 75 | + control: 'size-4', |
| 76 | + group: 'gap-x-3 gap-y-2', |
| 77 | + root: 'gap-2' |
| 78 | + }, |
| 79 | + sm: { |
| 80 | + control: 'size-3.5', |
| 81 | + group: 'gap-x-2.5 gap-y-1.75', |
| 82 | + root: 'gap-1.75' |
| 83 | + }, |
| 84 | + xl: { |
| 85 | + control: 'size-5', |
| 86 | + group: 'gap-x-4 gap-y-3', |
| 87 | + root: 'gap-3' |
| 88 | + }, |
| 89 | + xs: { |
| 90 | + control: 'size-3', |
| 91 | + group: 'gap-x-2 gap-y-1.5', |
| 92 | + root: 'gap-1.5' |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | +}); |
| 97 | + |
| 98 | +export type RadioSlots = keyof typeof radioVariants.slots; |
0 commit comments