|
1 | | -export default { |
| 1 | +import type { ModuleOptions } from '../module' |
| 2 | + |
| 3 | +export default (options: Required<ModuleOptions>) => ({ |
2 | 4 | base: 'inline-flex items-center justify-center px-1 rounded-sm font-medium font-sans', |
3 | 5 | variants: { |
| 6 | + color: { |
| 7 | + ...Object.fromEntries((options.theme.colors || []).map((color: string) => [color, ''])), |
| 8 | + neutral: '' |
| 9 | + }, |
4 | 10 | variant: { |
5 | | - solid: 'bg-inverted text-inverted', |
6 | | - outline: 'bg-default text-highlighted ring ring-inset ring-accented', |
7 | | - subtle: 'bg-elevated text-default ring ring-inset ring-accented' |
| 11 | + solid: '', |
| 12 | + outline: '', |
| 13 | + soft: '', |
| 14 | + subtle: '' |
8 | 15 | }, |
9 | 16 | size: { |
10 | 17 | sm: 'h-4 min-w-[16px] text-[10px]', |
11 | 18 | md: 'h-5 min-w-[20px] text-[11px]', |
12 | 19 | lg: 'h-6 min-w-[24px] text-[12px]' |
13 | 20 | } |
14 | 21 | }, |
| 22 | + compoundVariants: [...(options.theme.colors || []).map((color: string) => ({ |
| 23 | + color, |
| 24 | + variant: 'solid', |
| 25 | + class: `text-inverted bg-${color}` |
| 26 | + })), ...(options.theme.colors || []).map((color: string) => ({ |
| 27 | + color, |
| 28 | + variant: 'outline', |
| 29 | + class: `ring ring-inset ring-${color}/50 text-${color}` |
| 30 | + })), ...(options.theme.colors || []).map((color: string) => ({ |
| 31 | + color, |
| 32 | + variant: 'soft', |
| 33 | + class: `text-${color} bg-${color}/10` |
| 34 | + })), ...(options.theme.colors || []).map((color: string) => ({ |
| 35 | + color, |
| 36 | + variant: 'subtle', |
| 37 | + class: `text-${color} ring ring-inset ring-${color}/25 bg-${color}/10` |
| 38 | + })), { |
| 39 | + color: 'neutral', |
| 40 | + variant: 'solid', |
| 41 | + class: 'text-inverted bg-inverted' |
| 42 | + }, { |
| 43 | + color: 'neutral', |
| 44 | + variant: 'outline', |
| 45 | + class: 'ring ring-inset ring-accented text-default bg-default' |
| 46 | + }, { |
| 47 | + color: 'neutral', |
| 48 | + variant: 'soft', |
| 49 | + class: 'text-default bg-elevated' |
| 50 | + }, { |
| 51 | + color: 'neutral', |
| 52 | + variant: 'subtle', |
| 53 | + class: 'ring ring-inset ring-accented text-default bg-elevated' |
| 54 | + }], |
15 | 55 | defaultVariants: { |
16 | 56 | variant: 'outline', |
| 57 | + color: 'neutral', |
17 | 58 | size: 'md' |
18 | 59 | } |
19 | | -} |
| 60 | +}) |
0 commit comments