UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

2 lines (1 loc) 1.88 kB
"use strict";const e=require("react/jsx-runtime"),p=require("./index-BhHud2F8.js"),d=require("./index-DwV9MiDB.js"),x=require("./loader-circle-DSFWIz51.js"),b=require("./index-UhBwhhTY.js"),v=({children:n,isPending:t,className:r,size:a,...o})=>e.jsxs("span",{className:d.cn("inline-flex-center relative",r),...o,children:[t&&e.jsx("div",{className:"absolute","aria-hidden":!0,"data-testid":"ButtonPending",children:e.jsx(x.LoaderCircle,{className:"animate-spin"})}),e.jsx("span",{className:d.cn("inline-flex-center",a==="lg"?"gap-2.5":"gap-2",t&&"invisible"),children:n})]}),c={variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border border-input hover:bg-accent hover:text-accent-foreground",outlineBg:"border border-input bg-surface-primary hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground",ghostPrimary:"text-primary hover:bg-primary/10",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/80",link:"text-primary underline-offset-4 hover:underline"},size:{xs:"h-6 text-xs px-2 py-1 rounded-md gap-1",default:"h-10 px-4 py-2 rounded-md gap-2",sm:"h-9 rounded-md px-3 gap-2",lg:"h-11 rounded-md px-8 gap-2.5",round:"rounded-full"}},u=p.cva("inline-flex items-center justify-center whitespace-nowrap transition-colors focus-ring disabled:pointer-events-none disabled:opacity-50",{variants:c,defaultVariants:{variant:"default",size:"default"}}),m=({className:n,variant:t,size:r,asChild:a,type:o="button",isPending:i,children:s,...l})=>{const g=a?b.Slot:"button";return e.jsx(g,{className:u({variant:t,size:r,className:n}),type:o,"aria-label":i?"Loading":void 0,...l,children:i!==void 0?e.jsx(v,{size:r,isPending:i,children:s}):s})};exports.Button=m;exports.buttonVariance=u;exports.buttonVariants=c;