|
| 1 | +import { tv } from 'tailwind-variants'; |
| 2 | + |
| 3 | +export const checkboxVariants = tv({ |
| 4 | + defaultVariants: { |
| 5 | + color: 'primary', |
| 6 | + orientation: 'horizontal', |
| 7 | + size: 'md' |
| 8 | + }, |
| 9 | + slots: { |
| 10 | + control: [ |
| 11 | + 'peer shrink-0 rounded-sm 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 | + groupRoot: 'flex', |
| 16 | + indicator: 'size-full flex items-center justify-center text-current', |
| 17 | + label: '', |
| 18 | + root: 'flex items-center' |
| 19 | + }, |
| 20 | + variants: { |
| 21 | + color: { |
| 22 | + accent: { |
| 23 | + control: `border-accent-foreground/50 focus-visible:ring-accent-foreground/20 data-[state=checked]:bg-accent-foreground/5 data-[state=checked]:text-accent-foreground data-[state=indeterminate]:bg-accent-foreground/5 data-[state=indeterminate]:text-accent-foreground` |
| 24 | + }, |
| 25 | + carbon: { |
| 26 | + control: `border-carbon focus-visible:ring-carbon data-[state=checked]:bg-carbon data-[state=checked]:text-carbon-foreground data-[state=indeterminate]:bg-carbon data-[state=indeterminate]:text-carbon-foreground` |
| 27 | + }, |
| 28 | + destructive: { |
| 29 | + control: `border-destructive focus-visible:ring-destructive data-[state=checked]:bg-destructive data-[state=checked]:text-destructive-foreground data-[state=indeterminate]:bg-destructive data-[state=indeterminate]:text-destructive-foreground` |
| 30 | + }, |
| 31 | + info: { |
| 32 | + control: `border-info focus-visible:ring-info data-[state=checked]:bg-info data-[state=checked]:text-info-foreground data-[state=indeterminate]:bg-info data-[state=indeterminate]:text-info-foreground` |
| 33 | + }, |
| 34 | + primary: { |
| 35 | + control: `border-primary focus-visible:ring-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground` |
| 36 | + }, |
| 37 | + secondary: { |
| 38 | + control: `border-secondary-foreground/50 focus-visible:ring-secondary-foreground/20 data-[state=checked]:bg-secondary-foreground/5 data-[state=checked]:text-secondary-foreground data-[state=indeterminate]:bg-secondary-foreground/5 data-[state=indeterminate]:text-secondary-foreground` |
| 39 | + }, |
| 40 | + success: { |
| 41 | + control: `border-success focus-visible:ring-success data-[state=checked]:bg-success data-[state=checked]:text-success-foreground data-[state=indeterminate]:bg-success data-[state=indeterminate]:text-success-foreground` |
| 42 | + }, |
| 43 | + warning: { |
| 44 | + control: `border-warning focus-visible:ring-warning data-[state=checked]:bg-warning data-[state=checked]:text-warning-foreground data-[state=indeterminate]:bg-warning data-[state=indeterminate]:text-warning-foreground` |
| 45 | + } |
| 46 | + }, |
| 47 | + orientation: { |
| 48 | + horizontal: { |
| 49 | + groupRoot: 'items-center' |
| 50 | + }, |
| 51 | + vertical: { |
| 52 | + groupRoot: 'flex-col' |
| 53 | + } |
| 54 | + }, |
| 55 | + size: { |
| 56 | + '2xl': { |
| 57 | + control: 'size-6', |
| 58 | + groupRoot: 'gap-x-4.5 gap-y-3.5', |
| 59 | + root: 'gap-3.5' |
| 60 | + }, |
| 61 | + lg: { |
| 62 | + control: 'size-4.5', |
| 63 | + groupRoot: 'gap-x-3.5 gap-y-2.5', |
| 64 | + root: 'gap-2.5' |
| 65 | + }, |
| 66 | + md: { |
| 67 | + control: 'size-4', |
| 68 | + groupRoot: 'gap-x-3 gap-y-2', |
| 69 | + root: 'gap-2' |
| 70 | + }, |
| 71 | + sm: { |
| 72 | + control: 'size-3.5', |
| 73 | + groupRoot: 'gap-x-2.5 gap-y-1.75', |
| 74 | + root: 'gap-1.75' |
| 75 | + }, |
| 76 | + xl: { |
| 77 | + control: 'size-5', |
| 78 | + groupRoot: 'gap-x-4 gap-y-3', |
| 79 | + root: 'gap-3' |
| 80 | + }, |
| 81 | + xs: { |
| 82 | + control: 'size-3', |
| 83 | + groupRoot: 'gap-x-2 gap-y-1.5', |
| 84 | + root: 'gap-1.5' |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | +}); |
| 89 | + |
| 90 | +export type CheckboxSlots = keyof typeof checkboxVariants.slots; |
0 commit comments