UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

2 lines (1 loc) 2.04 kB
"use strict";const e=require("react/jsx-runtime"),b=require("./index-DTLvoP6e.js"),d=require("./index-DwV9MiDB.js"),p=require("./loader-circle-7pftiR7S.js"),x=require("./index-CajSSBH7.js"),v=({children:n,isPending:t,className:r,size:a,...o})=>e.jsxs("span",{"data-slot":"button-pending",className:d.cn("inline-flex-center relative",r),...o,children:[t&&e.jsx("div",{className:"absolute","aria-hidden":!0,"data-testid":"buttonPendingLoader",children:e.jsx(p.default,{className:"animate-spin"})}),e.jsx("span",{className:d.cn("inline-flex-center",a==="lg"?"gap-2.5":"gap-2",t&&"invisible"),children:n})]}),u={variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/70",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",ghost:"hover:bg-accent hover:text-accent-foreground",ghostPrimary:"text-primary hover:bg-primary/10",success:"bg-success text-success-foreground hover:bg-success/80",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",sm:"h-9 rounded-md px-3 gap-2",default:"h-10 px-4 py-2 rounded-md gap-2",lg:"h-11 rounded-md px-8 gap-2.5",round:"rounded-full"}},c=b.cva("inline-flex items-center justify-center whitespace-nowrap transition focus-ring disabled:pointer-events-none disabled:opacity-50",{variants:u,defaultVariants:{variant:"default",size:"default"}}),f=({className:n,variant:t="default",size:r="default",asChild:a,type:o="button",isPending:s,children:i,...l})=>{const g=a?x.Slot:"button";return e.jsx(g,{"data-slot":"button","data-variant":t,"data-size":r,className:c({variant:t,size:r,className:n}),type:o,"aria-label":s?"Loading":void 0,...l,children:s!==void 0?e.jsx(v,{size:r,isPending:s,children:i}):i})};exports.Button=f;exports.buttonVariance=c;exports.buttonVariants=u;