@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
76 lines (75 loc) • 2.32 kB
JavaScript
import { jsxs as u, jsx as e } from "react/jsx-runtime";
import { c as l } from "./index-CzIeYJrm.mjs";
import { c as d } from "./index-2NvaPZWc.mjs";
import { L as p } from "./loader-circle-BWDuo1xM.mjs";
import { S as m } from "./index-Bytw4Lqn.mjs";
const g = ({
children: a,
isPending: r,
className: t,
size: o,
...n
}) => /* @__PURE__ */ u("span", { className: d("inline-flex-center relative", t), ...n, children: [
r && /* @__PURE__ */ e("div", { className: "absolute", "aria-hidden": !0, "data-testid": "ButtonPending", children: /* @__PURE__ */ e(p, { className: "animate-spin" }) }),
/* @__PURE__ */ e(
"span",
{
className: d(
"inline-flex-center",
o === "lg" ? "gap-2.5" : "gap-2",
r && "invisible"
),
children: a
}
)
] }), b = {
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"
}
}, f = l(
"inline-flex items-center justify-center whitespace-nowrap transition-colors focus-ring disabled:pointer-events-none disabled:opacity-50",
{
variants: b,
defaultVariants: {
variant: "default",
size: "default"
}
}
), j = ({
className: a,
variant: r,
size: t,
asChild: o,
type: n = "button",
isPending: i,
children: s,
...c
}) => /* @__PURE__ */ e(
o ? m : "button",
{
className: f({ variant: r, size: t, className: a }),
type: n,
"aria-label": i ? "Loading" : void 0,
...c,
children: i !== void 0 ? /* @__PURE__ */ e(g, { size: t, isPending: i, children: s }) : s
}
);
export {
j as B,
f as a,
b
};