UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

97 lines (96 loc) 4.4 kB
"use client"; import { jsxs as P, jsx as H } from "react/jsx-runtime"; import { d as Q } from "./chunks/index.D-sRdssb.js"; import { c as K } from "./chunks/index.DL9mof6u.js"; import { D as U } from "./chunks/Icon.CDLyB7Pv.js"; import { DSSpinner as V } from "./spinner.C9qCeq0R.js"; import { Tooltip as M } from "./tooltip.Cj3AvYgB.js"; import { forwardRef as W } from "react"; import './assets/buttonround.DBpMesfr.css';const X = "ds-button-round_root_1sl51_1", Y = "ds-button-round_root--highlight_1sl51_75", Z = "ds-button-round_root--dark-highlight_1sl51_75", tt = "ds-button-round_root--filled_1sl51_151", ot = "ds-button-round_root--dark-filled_1sl51_399", lt = "ds-button-round_root--icon-only-small_1sl51_656", et = "ds-button-round_icon--hidden_1sl51_673", it = "ds-button-round_label--hidden_1sl51_677", nt = "ds-button-round_label--loading_1sl51_689", st = "ds-button-round_loader_1sl51_693", l = { root: X, rootHighlight: Y, rootDarkHighlight: Z, rootFilled: tt, rootDarkFilled: ot, rootIconOnlySmall: lt, iconHidden: et, labelHidden: it, labelLoading: nt, loader: st }, rt = W((L, R) => { const t = Q.c(55); let r, d, a, i, n, c, g, _, b, p, k, s; t[0] !== L ? ({ children: d, aria: r, className: a, disabled: g, iconName: _, iconSource: i, loading: b, theme: p, tooltip: s, variant: k, onClick: n, ...c } = L, t[0] = L, t[1] = r, t[2] = d, t[3] = a, t[4] = i, t[5] = n, t[6] = c, t[7] = g, t[8] = _, t[9] = b, t[10] = p, t[11] = k, t[12] = s) : (r = t[1], d = t[2], a = t[3], i = t[4], n = t[5], c = t[6], g = t[7], _ = t[8], b = t[9], p = t[10], k = t[11], s = t[12]); const N = g === void 0 ? !1 : g, S = _ === void 0 ? "placeholder" : _, o = b === void 0 ? !1 : b, j = p === void 0 ? "light" : p, D = k === void 0 ? "filled" : k, B = D === "filled", E = D === "highlight", T = j === "dark" && D === "filled", w = j === "dark" && D === "highlight"; let y; t[13] !== a || t[14] !== B || t[15] !== E || t[16] !== T || t[17] !== w ? (y = K(l.root, l.rootIconOnlySmall, a, { [l.rootFilled]: B, [l.rootHighlight]: E, [l.rootDarkFilled]: T, [l.rootDarkHighlight]: w }), t[13] = a, t[14] = B, t[15] = E, t[16] = T, t[17] = w, t[18] = y) : y = t[18]; const A = y; let v; t[19] !== o ? (v = K(l.label, l.labelHidden, { [l.labelLoading]: o }), t[19] = o, t[20] = v) : v = t[20]; const $ = v; let C; t[21] !== o ? (C = K(l.icon, { [l.iconHidden]: o }), t[21] = o, t[22] = C) : C = t[22]; const q = C, z = j === "light" && D === "filled" ? "dark" : "light"; let F; t[23] !== N || t[24] !== o || t[25] !== n ? (F = (e) => { if (N || o) { e.preventDefault(); return; } n && n(e); }, t[23] = N, t[24] = o, t[25] = n, t[26] = F) : F = t[26]; const G = F, J = N || o; let h; t[27] !== o ? (h = o && /* @__PURE__ */ H(V, { className: l.loader, aria: { "aria-label": "Loading state" } }), t[27] = o, t[28] = h) : h = t[28]; let u; t[29] !== d || t[30] !== $ ? (u = /* @__PURE__ */ H("span", { className: $, children: d }), t[29] = d, t[30] = $, t[31] = u) : u = t[31]; let m; t[32] !== q || t[33] !== S || t[34] !== i || t[35] !== z ? (m = (S || i) && /* @__PURE__ */ H(U, { name: S, theme: z, source: i, className: q, "aria-hidden": "true" }), t[32] = q, t[33] = S, t[34] = i, t[35] = z, t[36] = m) : m = t[36]; let O; t[37] !== r || t[38] !== G || t[39] !== o || t[40] !== R || t[41] !== c || t[42] !== A || t[43] !== J || t[44] !== h || t[45] !== u || t[46] !== m ? (O = /* @__PURE__ */ P("button", { className: A, type: "button", onClick: G, ...r, ...c, "aria-disabled": J, "aria-busy": o, ref: R, children: [ h, u, m ] }), t[37] = r, t[38] = G, t[39] = o, t[40] = R, t[41] = c, t[42] = A, t[43] = J, t[44] = h, t[45] = u, t[46] = m, t[47] = O) : O = t[47]; const x = O; if (s) { let e; t[48] !== x ? (e = /* @__PURE__ */ H(M.Anchor, { children: x }), t[48] = x, t[49] = e) : e = t[49]; let f; t[50] !== s ? (f = /* @__PURE__ */ H(M.Content, { children: s }), t[50] = s, t[51] = f) : f = t[51]; let I; return t[52] !== e || t[53] !== f ? (I = /* @__PURE__ */ P(M, { placement: "top", tooltipOffset: 6, children: [ e, f ] }), t[52] = e, t[53] = f, t[54] = I) : I = t[54], I; } return x; }); rt.displayName = "DSButtonRound"; export { rt as DSButtonRound };