UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

83 lines (82 loc) 4.12 kB
"use client"; import { jsx as M } from "react/jsx-runtime"; import { d as X } from "./index.cKLI89Eg.js"; import { c as N } from "./index.DQOqod3i.js"; import { useRef as P, useEffect as Y } from "react"; import { i as L } from "./Text.utils.DzlY9pJS.js"; import { g as x } from "./helpers.CexwVao7.js"; import '../assets/TextUtility.BThulfyl.css';const $ = "ds-text-utility_root_5fggr_6", z = "ds-text-utility_root--large_5fggr_15", G = "ds-text-utility_root--large-bold_5fggr_26", R = "ds-text-utility_root--medium_5fggr_38", W = "ds-text-utility_root--medium-bold_5fggr_49", j = "ds-text-utility_root--small_5fggr_61", q = "ds-text-utility_root--small-bold_5fggr_72", A = "ds-text-utility_root--small-demi_5fggr_84", C = "ds-text-utility_root--x-small-demi_5fggr_94", H = "ds-text-utility_root--theme-dark_5fggr_205", l = { root: $, rootLarge: z, rootLargeBold: G, rootMedium: R, rootMediumBold: W, rootSmall: j, rootSmallBold: q, 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: r, weight: t }) => { t === "demi" && r !== "small" && r !== "x-small" && console.warn(x("DSTextUtility", 'Invalid prop combination: weight "demi" is only supported on sizes "small" and "x-small".')), r === "x-small" && t !== "demi" && console.warn(x("DSTextUtility", 'Invalid prop combination: size "x-small" only supports weight "demi".')); }, lt = (r) => { const t = X.c(29); let s, a, m, n, d, c, g; t[0] !== r ? ({ children: s, className: a, size: n, tag: d, theme: c, weight: g, ...m } = r, t[0] = r, t[1] = s, t[2] = a, t[3] = m, t[4] = n, t[5] = d, t[6] = c, t[7] = g) : (s = t[1], a = t[2], m = t[3], n = t[4], d = t[5], c = t[6], g = t[7]); const o = n === void 0 ? "medium" : n, i = d === void 0 ? "p" : d, k = c === void 0 ? "light" : c, e = g === void 0 ? "normal" : g, u = P(null); let _, f; t[8] !== o || t[9] !== i || t[10] !== e ? (_ = () => { if (process.env.NODE_ENV !== "production" && (O({ size: o, weight: e }), u.current)) t: switch (i) { case "li": { if (!L(u.current, "ul, ol")) throw Error(x("DSTextUtility", `The DSTextUtility component with the tag "${i}" is not within a list element (ul, ol). Please ensure it's placed correctly.`)); break t; } case "dt": case "dd": { if (!L(u.current, "dl")) throw Error(x("DSTextUtility", `The DSTextUtility component with the tag "${i}" is not within a description list element (dl). Please ensure it's placed correctly.`)); break t; } default: return; } }, f = [i, o, e], t[8] = o, t[9] = i, t[10] = e, t[11] = _, t[12] = f) : (_ = t[11], f = t[12]), Y(_, f); const h = i, 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", U = o === "small" && e === "demi", v = o === "x-small" && e === "demi", I = k === "dark"; let T; t[13] !== a || t[14] !== b || t[15] !== w || t[16] !== E || t[17] !== U || t[18] !== v || t[19] !== I || t[20] !== y || t[21] !== S || t[22] !== D ? (T = N(l.root, a, { [l.rootLarge]: y, [l.rootLargeBold]: S, [l.rootMedium]: D, [l.rootMediumBold]: b, [l.rootSmall]: w, [l.rootSmallBold]: E, [l.rootSmallDemi]: U, [l.rootXSmallDemi]: v, [l.rootThemeDark]: I }), t[13] = a, t[14] = b, t[15] = w, t[16] = E, t[17] = U, t[18] = v, t[19] = I, t[20] = y, t[21] = S, t[22] = D, t[23] = T) : T = t[23]; const B = T; let p; return t[24] !== h || t[25] !== s || t[26] !== m || t[27] !== B ? (p = /* @__PURE__ */ M(h, { className: B, ref: u, ...m, children: s }), t[24] = h, t[25] = s, t[26] = m, t[27] = B, t[28] = p) : p = t[28], p; }; export { lt as D, ot as T, tt as a, et as b, O as v };