Line data Source code
1 : import type { VariantProps } from 'cva'
2 : import { cva } from 'cva'
3 :
4 2355 : export const tagVariants = cva({
5 : base: 'inline-flex h-6 max-w-full shrink-0 items-center justify-center gap-1 text-xs ring-offset-background backdrop-blur-sm data-[selected=true]:ring-2 data-[selected=true]:ring-foreground data-[selected=true]:ring-offset-1 data-[state=active]:ring-2 data-[state=active]:ring-foreground data-[state=active]:ring-offset-1 [&.ProseMirror-selectednode]:ring-2 [&.ProseMirror-selectednode]:ring-foreground [&.ProseMirror-selectednode]:ring-offset-1',
6 : variants: {
7 : shape: {
8 : square: 'rounded-sm bg-muted',
9 : rounded: 'rounded-full bg-secondary',
10 : overlay: 'rounded-sm bg-zinc-500/40 text-white/90'
11 : },
12 : state: {
13 : default: 'text-foreground',
14 : unselected: 'text-muted-foreground opacity-70',
15 : selected: 'text-foreground'
16 : },
17 : removable: {
18 : true: 'py-1 pr-1 pl-2',
19 : false: 'px-2 py-1'
20 : },
21 : interactive: {
22 : true: 'cursor-pointer transition-colors focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none aria-disabled:cursor-not-allowed aria-disabled:opacity-50',
23 : false: ''
24 : }
25 : },
26 : defaultVariants: {
27 : shape: 'square',
28 : state: 'default',
29 : removable: false,
30 : interactive: false
31 : }
32 : })
33 :
34 2355 : export const tagRemoveButtonVariants = cva({
35 : base: 'w-4 overflow-hidden transition-[opacity,width] duration-150 hover:bg-transparent hover:opacity-100 data-disabled:pointer-events-none data-disabled:w-0 data-disabled:opacity-0'
36 : })
37 :
38 : export type TagVariants = VariantProps<typeof tagVariants>
|