UNPKG

@loke/design-system

Version:

A design system with individually importable components

2 lines (1 loc) 2.25 kB
import{cn}from"@loke/design-system/cn";import{createSlot}from"@loke/ui/slot";import{cva}from"class-variance-authority";import{forwardRef}from"react";import{jsx}from"react/jsx-runtime";var buttonVariants=cva(cn("inline-flex items-center justify-center shrink-0 whitespace-nowrap rounded-lg border border-transparent bg-clip-padding text-sm font-medium outline-none transition-all select-none group/button","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3","aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:ring-3","dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50","disabled:pointer-events-none disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"),{defaultVariants:{justify:"center",size:"default",variant:"default"},variants:{justify:{between:"justify-between",center:"justify-center",end:"justify-end",start:"justify-start"},size:{default:"h-10 px-4 py-2",icon:"size-8","icon-lg":"size-9","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",lg:"h-11 rounded-md px-8",sm:"h-9 rounded-md px-3"},variant:{default:"bg-primary text-primary-foreground hover:bg-brand-900 dark:hover:bg-brand-100",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"hover:bg-accent hover:text-accent-foreground aria-expanded:bg-accent aria-expanded:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground aria-expanded:bg-muted aria-expanded:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/60 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground"},width:{fit:"w-fit",full:"w-full"}}}),ButtonSlot=createSlot("Button"),Button=forwardRef(({className,variant,size,width,justify,asChild=!1,...props},ref)=>{return jsx(asChild?ButtonSlot:"button",{className:cn(buttonVariants({className,justify,size,variant,width})),ref,...props})});export{buttonVariants,Button};