SPACEBROWSER_INTERFACE/interface_base/creator-ui/dist/chunks/Button.CpTwUWVr.js
2025-08-07 20:28:59 -04:00

160 lines
4.5 KiB
JavaScript

import { jsxs as d, jsx as a, Fragment as M } from "react/jsx-runtime";
import { a as D } from "./index.CfQlFjZU.js";
import { n as s } from "./index.B0wX8xO7.js";
import { c as f } from "./index.CfM2L_w0.js";
import { S as L } from "./shared.EdGf6tcG.js";
import "react";
import { a as E } from "./ProgressActivity.DYLCzf8q.js";
const U = "creator_button_aWOc1", j = "creator_casingTitle_EAIkd", A = "creator_label_VtHm3", B = "creator_casingSentence_YzUqq", O = "creator_icon_H8vnu", R = "creator_buttonFull_pCMEG", X = "creator_variantDanger_IrFfo", k = "creator_disabled_p2f6L", z = "creator_variantPrimary_vrMNG", G = "creator_variantSecondary_uOPnT", H = "creator_variantTertiary_Wjd79", W = "creator_buttonMedium_BXe0h", q = "creator_buttonSmall_h5HiG", V = "creator_buttonXSmall_D-m4-", Y = "creator_button2xSmall_Do8jz", K = "creator_selected_AREUF", e = { button: U, casingTitle: j, label: A, casingSentence: B, icon: O, buttonFull: R, variantDanger: X, disabled: k, variantPrimary: z, variantSecondary: G, variantTertiary: H, buttonMedium: W, buttonSmall: q, buttonXSmall: V, button2xSmall: Y, selected: K };
var J = /* @__PURE__ */ ((t) => (t.LINK = "link", t.BUTTON = "button", t.SUBMIT = "submit", t.RESET = "reset", t))(J || {});
const Q = ({
semantic: t = L.PRIMARY,
size: i,
loading: m,
selected: u,
className: o,
casing: c = "title",
...l
}) => {
let n = i;
!n && l.isFullWidth && (n = "full"), !n && l.isSmall && (n = "small"), n || (n = "medium");
const r = n === "2xsmall";
return {
buttonClassName: f(
e.button,
o,
{
[e.buttonFull]: n === "full",
[e.buttonMedium]: n === "medium",
[e.buttonSmall]: n === "small",
[e.buttonXSmall]: n === "xsmall",
[e.button2xSmall]: n === "2xsmall"
},
{
[e.variantDanger]: t === "danger",
[e.variantPrimary]: t === "primary",
[e.variantSecondary]: t === "secondary",
[e.variantTertiary]: t === "tertiary"
},
{
[e.selected]: u
},
{
[e.casingTitle]: c === "title",
[e.casingSentence]: c === "sentence"
}
),
labelClassName: e.label,
iconClassName: f(e.icon, {
[e.disabled]: "disabled" in l && l.disabled
}),
showLabel: !r,
showPrefixIcon: !!l.prefixIcon,
showSuffixIcon: !!l.suffixIcon && !r,
loading: m || !1,
...l
};
}, Z = (t) => {
if (t.type === "link") {
const {
label: S,
labelClassName: I,
buttonClassName: g,
iconClassName: b,
prefixIcon: w,
suffixIcon: y,
showLabel: C,
showPrefixIcon: P,
showSuffixIcon: p,
...T
} = t, F = {
...T,
loading: void 0
};
return /* @__PURE__ */ d("a", { className: g, ...F, children: [
/* @__PURE__ */ a(
s,
{
value: P,
then: /* @__PURE__ */ a("span", { className: b, children: w })
}
),
/* @__PURE__ */ a(
s,
{
value: C,
then: /* @__PURE__ */ a("span", { className: I, children: S })
}
),
/* @__PURE__ */ a(
s,
{
value: p,
then: /* @__PURE__ */ a("span", { className: b, children: y })
}
)
] });
}
const {
label: i,
labelClassName: m,
buttonClassName: u,
iconClassName: o,
prefixIcon: c,
suffixIcon: l,
type: n = "button",
loading: r,
disabled: h,
showLabel: _,
showPrefixIcon: x,
showSuffixIcon: N,
...v
} = t;
return /* @__PURE__ */ a(
"button",
{
type: n,
className: u,
disabled: r || h,
"aria-label": i,
...v,
children: /* @__PURE__ */ a(
s,
{
value: r,
then: /* @__PURE__ */ a("span", { className: o, children: /* @__PURE__ */ a(E, {}) }),
otherwise: /* @__PURE__ */ d(M, { children: [
/* @__PURE__ */ a(
s,
{
value: x,
then: /* @__PURE__ */ a("span", { className: o, children: c })
}
),
/* @__PURE__ */ a(
s,
{
value: _,
then: /* @__PURE__ */ a("span", { className: m, children: i })
}
),
/* @__PURE__ */ a(
s,
{
value: N,
then: /* @__PURE__ */ a("span", { className: o, children: l })
}
)
] })
}
)
}
);
}, oa = D(Z, Q);
export {
oa as B,
J as a,
Z as b,
Q as u
};