43 lines
2.6 KiB
TypeScript
43 lines
2.6 KiB
TypeScript
|
|
import { cva, type VariantProps } from 'class-variance-authority'
|
||
|
|
|
||
|
|
export { default as Button } from './Button.vue'
|
||
|
|
|
||
|
|
export const buttonVariants = cva(
|
||
|
|
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium shadow-sm active:shadow-none active:inset-shadow-2xs active:inset-shadow-black/15 active:border-none transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=\'size-\'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||
|
|
{
|
||
|
|
variants: {
|
||
|
|
variant: {
|
||
|
|
default:
|
||
|
|
'bg-slate-100 hover:bg-slate-200 dark:bg-neutral-700 dark:hover:bg-neutral-700/66 border-b-1 border-t-1 border-t-white/75 border-b-slate-300 dark:border-t-neutral-600 dark:border-b-neutral-800',
|
||
|
|
action:
|
||
|
|
'bg-blue-600 border-b-1 border-t-1 border-t-blue-400 border-b-blue-800 active:bg-blue-700 hover:bg-blue-500 text-white',
|
||
|
|
destructive:
|
||
|
|
'bg-destructive dark:bg-red-700 text-white border-b-1 border-t-1 border-t-red-200 border-b-red-700 dark:border-t-red-400 dark:border-b-red-800 hover:bg-red-600 active:bg-red-500 active:inset-shadow-red-950 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40',
|
||
|
|
success:
|
||
|
|
'bg-success text-success-foreground border-b-1 border-t-1 border-t-lime-200 border-b-lime-500 dark:border-t-lime-400 dark:border-b-lime-800 hover:bg-lime-500 active:bg-lime-500 active:inset-shadow-lime-600 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40',
|
||
|
|
outline:
|
||
|
|
'border bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
||
|
|
secondary:
|
||
|
|
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||
|
|
ghost:
|
||
|
|
'border-none shadow-none hover:bg-slate-100 hover:text-accent-foreground dark:hover:bg-accent/50',
|
||
|
|
link: 'text-primary underline-offset-4 hover:underline',
|
||
|
|
pressed:
|
||
|
|
'bg-slate-100 dark:bg-neutral-700 shadow-none inset-shadow-2xs inset-shadow-black/15 border-none',
|
||
|
|
},
|
||
|
|
size: {
|
||
|
|
default: 'h-8 px-6 active:pt-[1px] has-[>svg]:px-3',
|
||
|
|
sm: 'h-7 px-4 rounded-md gap-1.5 has-[>svg]:px-2.5',
|
||
|
|
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
||
|
|
icon: 'size-9',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
defaultVariants: {
|
||
|
|
variant: 'default',
|
||
|
|
size: 'default',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
)
|
||
|
|
|
||
|
|
export type ButtonVariants = VariantProps<typeof buttonVariants>
|