@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
83 lines (82 loc) • 4.12 kB
JavaScript
"use client";
import { jsx as k } from "react/jsx-runtime";
import { d as M } from "./index.D-sRdssb.js";
import { c as X } from "./index.DL9mof6u.js";
import { useRef as N, useEffect as P } from "react";
import { g } from "./helpers.CexwVao7.js";
import { i as B } from "./Text.utils.B4MiHAK_.js";
import '../assets/TextUtility.BsMYk5lH.css';const Y = "ds-text-utility_root_1hq5u_6", $ = "ds-text-utility_root--large_1hq5u_15", z = "ds-text-utility_root--large-bold_1hq5u_26", G = "ds-text-utility_root--medium_1hq5u_37", R = "ds-text-utility_root--medium-bold_1hq5u_48", W = "ds-text-utility_root--small_1hq5u_59", j = "ds-text-utility_root--small-bold_1hq5u_70", A = "ds-text-utility_root--small-demi_1hq5u_81", C = "ds-text-utility_root--x-small-demi_1hq5u_92", H = "ds-text-utility_root--theme-dark_1hq5u_186", l = {
root: Y,
rootLarge: $,
rootLargeBold: z,
rootMedium: G,
rootMediumBold: R,
rootSmall: W,
rootSmallBold: j,
rootSmallDemi: A,
rootXSmallDemi: C,
rootThemeDark: H
}, tt = ["address", "blockquote", "cite", "div", "dd", "dfn", "dt", "figcaption", "legend", "li", "p", "span", "time"], ot = ["large", "medium", "small", "x-small"], et = ["bold", "demi", "normal"], O = ({
size: i,
weight: t
}) => {
t === "demi" && i !== "small" && i !== "x-small" && console.warn(g("DSTextUtility", 'Invalid prop combination: weight "demi" is only supported on sizes "small" and "x-small".')), i === "x-small" && t !== "demi" && console.warn(g("DSTextUtility", 'Invalid prop combination: size "x-small" only supports weight "demi".'));
}, lt = (i) => {
const t = M.c(29);
let r, a, m, n, d, c, u;
t[0] !== i ? ({
children: r,
className: a,
size: n,
tag: d,
theme: c,
weight: u,
...m
} = i, t[0] = i, t[1] = r, t[2] = a, t[3] = m, t[4] = n, t[5] = d, t[6] = c, t[7] = u) : (r = t[1], a = t[2], m = t[3], n = t[4], d = t[5], c = t[6], u = t[7]);
const o = n === void 0 ? "medium" : n, s = d === void 0 ? "p" : d, L = c === void 0 ? "light" : c, e = u === void 0 ? "normal" : u, _ = N(null);
let h, T;
t[8] !== o || t[9] !== s || t[10] !== e ? (h = () => {
if (process.env.NODE_ENV !== "production" && (O({
size: o,
weight: e
}), _.current))
t: switch (s) {
case "li": {
if (!B(_.current, "ul, ol"))
throw Error(g("DSTextUtility", `The DSTextUtility component with the tag "${s}" is not within a list element (ul, ol). Please ensure it's placed correctly.`));
break t;
}
case "dt":
case "dd": {
if (!B(_.current, "dl"))
throw Error(g("DSTextUtility", `The DSTextUtility component with the tag "${s}" is not within a description list element (dl). Please ensure it's placed correctly.`));
break t;
}
default:
return;
}
}, T = [s, o, e], t[8] = o, t[9] = s, t[10] = e, t[11] = h, t[12] = T) : (h = t[11], T = t[12]), P(h, T);
const f = s, y = o === "large" && e === "normal", S = o === "large" && e === "bold", D = o === "medium" && e === "normal", b = o === "medium" && e === "bold", w = o === "small" && e === "normal", E = o === "small" && e === "bold", q = o === "small" && e === "demi", U = o === "x-small" && e === "demi", v = L === "dark";
let p;
t[13] !== a || t[14] !== b || t[15] !== w || t[16] !== E || t[17] !== q || t[18] !== U || t[19] !== v || t[20] !== y || t[21] !== S || t[22] !== D ? (p = X(l.root, a, {
[l.rootLarge]: y,
[l.rootLargeBold]: S,
[l.rootMedium]: D,
[l.rootMediumBold]: b,
[l.rootSmall]: w,
[l.rootSmallBold]: E,
[l.rootSmallDemi]: q,
[l.rootXSmallDemi]: U,
[l.rootThemeDark]: v
}), t[13] = a, t[14] = b, t[15] = w, t[16] = E, t[17] = q, t[18] = U, t[19] = v, t[20] = y, t[21] = S, t[22] = D, t[23] = p) : p = t[23];
const I = p;
let x;
return t[24] !== f || t[25] !== r || t[26] !== m || t[27] !== I ? (x = /* @__PURE__ */ k(f, { className: I, ref: _, ...m, children: r }), t[24] = f, t[25] = r, t[26] = m, t[27] = I, t[28] = x) : x = t[28], x;
};
export {
lt as D,
tt as T,
ot as a,
et as b,
O as v
};