@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
73 lines (72 loc) • 3.5 kB
JavaScript
"use client";
import { jsx as y } from "react/jsx-runtime";
import { d as $ } from "./chunks/index.cKLI89Eg.js";
import { c as P } from "./chunks/index.DQOqod3i.js";
import { useRef as R, useEffect as j } from "react";
import { i as M } from "./chunks/Text.utils.DzlY9pJS.js";
import { g as L } from "./chunks/helpers.CexwVao7.js";
import './assets/text.BwGsYzGM.css';const C = "ds-text_root_1skzv_6", O = "ds-text_root--large_1skzv_15", V = "ds-text_root--large-bold_1skzv_26", W = "ds-text_root--medium_1skzv_38", q = "ds-text_root--medium-bold_1skzv_49", A = "ds-text_root--small_1skzv_61", F = "ds-text_root--small-bold_1skzv_72", G = "ds-text_root--x-small_1skzv_84", H = "ds-text_root--x-small-bold_1skzv_95", I = "ds-text_root--xx-small_1skzv_107", J = "ds-text_root--theme-dark_1skzv_219", o = {
root: C,
rootLarge: O,
rootLargeBold: V,
rootMedium: W,
rootMediumBold: q,
rootSmall: A,
rootSmallBold: F,
rootXSmall: G,
rootXSmallBold: H,
rootXxSmall: I,
rootThemeDark: J
}, ot = (g) => {
const t = $.c(28);
let l, r, a, m, i, n, d;
t[0] !== g ? ({
children: l,
className: r,
size: m,
tag: i,
theme: n,
weight: d,
...a
} = g, t[0] = g, t[1] = l, t[2] = r, t[3] = a, t[4] = m, t[5] = i, t[6] = n, t[7] = d) : (l = t[1], r = t[2], a = t[3], m = t[4], i = t[5], n = t[6], d = t[7]);
const e = m === void 0 ? "medium" : m, s = i === void 0 ? "p" : i, N = n === void 0 ? "light" : n, c = d === void 0 ? "normal" : d, _ = R(null);
let x, h;
t[8] !== s ? (x = () => {
if (_.current && process.env.NODE_ENV !== "production")
t: switch (s) {
case "li": {
if (!M(_.current, "ul, ol"))
throw Error(L("DSText", `The DSText component with the tag "${s}" is not within a list element (ul, ol). This may cause issues with list semantics. Please ensure the DSText component is within a list element.`));
break t;
}
case "dt":
case "dd": {
if (!M(_.current, "dl"))
throw Error(L("DSText", `The DSText component with the tag "${s}" is not within a list element (dl). This may cause issues with list semantics. Please ensure the DSText component is within a list element.`));
break t;
}
default:
return;
}
}, h = [s], t[8] = s, t[9] = x, t[10] = h) : (x = t[9], h = t[10]), j(x, h);
const f = s, k = e === "large", v = e === "large" && c === "bold", p = e == "medium", T = e === "medium" && c === "bold", w = e == "small", z = e == "small" && c === "bold", B = e == "x-small", D = e == "x-small" && c === "bold", b = e == "xx-small", X = N === "dark";
let u;
t[11] !== r || t[12] !== T || t[13] !== w || t[14] !== z || t[15] !== B || t[16] !== D || t[17] !== b || t[18] !== X || t[19] !== k || t[20] !== v || t[21] !== p ? (u = P(o.root, r, {
[]: k,
[]: v,
[]: p,
[]: T,
[]: w,
[]: z,
[]: B,
[]: D,
[]: b,
[]: X
}), t[11] = r, t[12] = T, t[13] = w, t[14] = z, t[15] = B, t[16] = D, t[17] = b, t[18] = X, t[19] = k, t[20] = v, t[21] = p, t[22] = u) : u = t[22];
const E = u;
let S;
return t[23] !== f || t[24] !== l || t[25] !== a || t[26] !== E ? (S = /* @__PURE__ */ y(f, { className: E, ref: _, ...a, children: l }), t[23] = f, t[24] = l, t[25] = a, t[26] = E, t[27] = S) : S = t[27], S;
};
export {
ot as DSText
};