@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
76 lines (75 loc) • 3.74 kB
JavaScript
"use client";
import { jsx as $ } from "react/jsx-runtime";
import { d as z } from "./index.D-sRdssb.js";
import { c as C } from "./index.DL9mof6u.js";
import { useRef as G, useEffect as H } from "react";
import { a as v, g as y } from "./helpers.CexwVao7.js";
import '../assets/Text.Dgpj61UP.css';const I = "ds-text_root_1mo26_6", P = "ds-text_root--large_1mo26_15", R = "ds-text_root--large-bold_1mo26_26", W = "ds-text_root--medium_1mo26_37", j = "ds-text_root--medium-bold_1mo26_48", q = "ds-text_root--small_1mo26_59", O = "ds-text_root--small-bold_1mo26_70", V = "ds-text_root--x-small_1mo26_81", Z = "ds-text_root--x-small-bold_1mo26_92", F = "ds-text_root--xx-small_1mo26_103", J = "ds-text_root--theme-dark_1mo26_197", o = {
root: I,
rootLarge: P,
rootLargeBold: R,
rootMedium: W,
rootMediumBold: j,
rootSmall: q,
rootSmallBold: O,
rootXSmall: V,
rootXSmallBold: Z,
rootXxSmall: F,
rootThemeDark: J
}, ot = ["address", "blockquote", "cite", "div", "dd", "dfn", "dt", "figcaption", "legend", "li", "p", "span", "time"], et = ["large", "medium", "small", "x-small", "xx-small"], lt = ["bold", "normal"], N = (r, t) => Array.isArray(t) ? t.some((l) => !!v(r, l)) : !!v(r, t), st = (r) => {
const t = z.c(28);
let l, a, m, i, n, d, c;
t[0] !== r ? ({
children: l,
className: a,
size: i,
tag: n,
theme: d,
weight: c,
...m
} = r, t[0] = r, t[1] = l, t[2] = a, t[3] = m, t[4] = i, t[5] = n, t[6] = d, t[7] = c) : (l = t[1], a = t[2], m = t[3], i = t[4], n = t[5], d = t[6], c = t[7]);
const e = i === void 0 ? "medium" : i, s = n === void 0 ? "p" : n, A = d === void 0 ? "light" : d, _ = c === void 0 ? "normal" : c, x = G(null);
let u, h;
t[8] !== s ? (u = () => {
if (x.current && process.env.NODE_ENV !== "production")
t: switch (s) {
case "li": {
if (!N(x.current, "ul, ol"))
throw Error(y("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 (!N(x.current, "dl"))
throw Error(y("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] = u, t[10] = h) : (u = t[9], h = t[10]), H(u, h);
const S = s, f = e === "large", p = e === "large" && _ === "bold", b = e == "medium", w = e === "medium" && _ === "bold", D = e == "small", E = e == "small" && _ === "bold", B = e == "x-small", X = e == "x-small" && _ === "bold", k = e == "xx-small", M = A === "dark";
let g;
t[11] !== a || t[12] !== w || t[13] !== D || t[14] !== E || t[15] !== B || t[16] !== X || t[17] !== k || t[18] !== M || t[19] !== f || t[20] !== p || t[21] !== b ? (g = C(o.root, a, {
[]: f,
[]: p,
[]: b,
[]: w,
[]: D,
[]: E,
[]: B,
[]: X,
[]: k,
[]: M
}), t[11] = a, t[12] = w, t[13] = D, t[14] = E, t[15] = B, t[16] = X, t[17] = k, t[18] = M, t[19] = f, t[20] = p, t[21] = b, t[22] = g) : g = t[22];
const L = g;
let T;
return t[23] !== S || t[24] !== l || t[25] !== m || t[26] !== L ? (T = /* @__PURE__ */ $(S, { className: L, ref: x, ...m, children: l }), t[23] = S, t[24] = l, t[25] = m, t[26] = L, t[27] = T) : T = t[27], T;
};
export {
st as D,
ot as T,
et as a,
lt as b,
N as i
};