@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
102 lines (101 loc) • 4.54 kB
JavaScript
"use client";
import { jsxs as K, jsx as D } from "react/jsx-runtime";
import { d as P } from "./chunks/index.cKLI89Eg.js";
import { c as $ } from "./chunks/index.DQOqod3i.js";
import { D as Q } from "./chunks/Icon.DYtaQgbw.js";
import { DSSpinner as U } from "./spinner.DtLnsqVV.js";
import { Tooltip as G } from "./tooltip.BFQG-7VR.js";
import { forwardRef as V } from "react";
import './assets/buttonround.syTU1QSI.css';const W = "ds-button-round_root_8kwqz_1", X = "ds-button-round_root--highlight_8kwqz_76", Y = "ds-button-round_root--dark-highlight_8kwqz_76", Z = "ds-button-round_root--filled_8kwqz_152", tt = "ds-button-round_loader_8kwqz_408", ot = "ds-button-round_root--dark-filled_8kwqz_513", et = "ds-button-round_root--size-small_8kwqz_900", lt = "ds-button-round_root--size-medium_8kwqz_906", it = "ds-button-round_icon--hidden_8kwqz_913", nt = "ds-button-round_label--hidden_8kwqz_917", st = "ds-button-round_label--loading_8kwqz_929", e = {
root: W,
rootHighlight: X,
rootDarkHighlight: Y,
rootFilled: Z,
loader: tt,
rootDarkFilled: ot,
rootSizeSmall: et,
rootSizeMedium: lt,
iconHidden: it,
labelHidden: nt,
labelLoading: st
}, rt = V((R, T) => {
const t = P.c(55);
let d, a, c, i, n, m, g, b, k, z, p, S, s;
t[0] !== R ? ({
children: a,
aria: d,
className: c,
disabled: g,
iconName: b,
iconSource: i,
loading: k,
size: z,
theme: p,
tooltip: s,
variant: S,
onClick: n,
...m
} = R, t[0] = R, t[1] = d, t[2] = a, t[3] = c, t[4] = i, t[5] = n, t[6] = m, t[7] = g, t[8] = b, t[9] = k, t[10] = z, t[11] = p, t[12] = S, t[13] = s) : (d = t[1], a = t[2], c = t[3], i = t[4], n = t[5], m = t[6], g = t[7], b = t[8], k = t[9], z = t[10], p = t[11], S = t[12], s = t[13]);
const w = g === void 0 ? !1 : g, H = b === void 0 ? "placeholder" : b, o = k === void 0 ? !1 : k, q = z === void 0 ? "small" : z, J = p === void 0 ? "light" : p, r = S === void 0 ? "filled" : S, N = J === "dark";
let v;
t[14] !== c || t[15] !== N || t[16] !== q || t[17] !== r ? (v = $(e.root, {
[e.rootSizeMedium]: q === "medium",
[e.rootSizeSmall]: q === "small"
}, c, {
[e.rootFilled]: r === "filled",
[e.rootHighlight]: r === "highlight",
[e.rootDarkFilled]: N && r === "filled",
[e.rootDarkHighlight]: N && r === "highlight"
}), t[14] = c, t[15] = N, t[16] = q, t[17] = r, t[18] = v) : v = t[18];
const j = v;
let C;
t[19] !== o ? (C = $(e.label, e.labelHidden, {
[e.labelLoading]: o
}), t[19] = o, t[20] = C) : C = t[20];
const B = C;
let F;
t[21] !== o ? (F = $(e.icon, {
[e.iconHidden]: o
}), t[21] = o, t[22] = F) : F = t[22];
const E = F, O = J === "light" && r === "filled" ? "dark" : "light";
let x;
t[23] !== w || t[24] !== o || t[25] !== n ? (x = (l) => {
if (w || o) {
l.preventDefault();
return;
}
n && n(l);
}, t[23] = w, t[24] = o, t[25] = n, t[26] = x) : x = t[26];
const A = x, I = w || o;
let h;
t[27] !== o ? (h = o && /* @__PURE__ */ D(U, { className: e.loader, aria: {
"aria-label": "Loading state"
} }), t[27] = o, t[28] = h) : h = t[28];
let u;
t[29] !== a || t[30] !== B ? (u = /* @__PURE__ */ D("span", { className: B, children: a }), t[29] = a, t[30] = B, t[31] = u) : u = t[31];
let f;
t[32] !== E || t[33] !== H || t[34] !== i || t[35] !== O ? (f = (H || i) && /* @__PURE__ */ D(Q, { name: H, theme: O, source: i, className: E, "aria-hidden": "true" }), t[32] = E, t[33] = H, t[34] = i, t[35] = O, t[36] = f) : f = t[36];
let y;
t[37] !== d || t[38] !== A || t[39] !== o || t[40] !== T || t[41] !== m || t[42] !== j || t[43] !== I || t[44] !== h || t[45] !== u || t[46] !== f ? (y = /* @__PURE__ */ K("button", { className: j, type: "button", onClick: A, ...d, ...m, "aria-disabled": I, "aria-busy": o, ref: T, children: [
h,
u,
f
] }), t[37] = d, t[38] = A, t[39] = o, t[40] = T, t[41] = m, t[42] = j, t[43] = I, t[44] = h, t[45] = u, t[46] = f, t[47] = y) : y = t[47];
const L = y;
if (s) {
let l;
t[48] !== L ? (l = /* @__PURE__ */ D(G.Anchor, { children: L }), t[48] = L, t[49] = l) : l = t[49];
let _;
t[50] !== s ? (_ = /* @__PURE__ */ D(G.Content, { children: s }), t[50] = s, t[51] = _) : _ = t[51];
let M;
return t[52] !== l || t[53] !== _ ? (M = /* @__PURE__ */ K(G, { placement: "top", tooltipOffset: 6, children: [
l,
_
] }), t[52] = l, t[53] = _, t[54] = M) : M = t[54], M;
}
return L;
});
rt.displayName = "DSButtonRound";
export {
rt as DSButtonRound
};