UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

73 lines (72 loc) 3.5 kB
"use client"; import { jsx as $ } from "react/jsx-runtime"; import { d as z } from "./chunks/index.D-sRdssb.js"; import { c as P } from "./chunks/index.DL9mof6u.js"; import { useRef as R, useEffect as j } from "react"; import { g as v } from "./chunks/helpers.CexwVao7.js"; import { i as N } from "./chunks/Text.utils.B4MiHAK_.js"; import './assets/text.ZCpNYmwU.css';const C = "ds-text_root_1x9it_6", O = "ds-text_root--large_1x9it_15", V = "ds-text_root--large-bold_1x9it_26", W = "ds-text_root--medium_1x9it_37", q = "ds-text_root--medium-bold_1x9it_48", A = "ds-text_root--small_1x9it_59", F = "ds-text_root--small-bold_1x9it_70", G = "ds-text_root--x-small_1x9it_81", H = "ds-text_root--x-small-bold_1x9it_92", I = "ds-text_root--xx-small_1x9it_103", J = "ds-text_root--theme-dark_1x9it_197", 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 = z.c(28); let s, r, i, a, m, n, d; t[0] !== g ? ({ children: s, className: r, size: a, tag: m, theme: n, weight: d, ...i } = g, t[0] = g, t[1] = s, t[2] = r, t[3] = i, t[4] = a, t[5] = m, t[6] = n, t[7] = d) : (s = t[1], r = t[2], i = t[3], a = t[4], m = t[5], n = t[6], d = t[7]); const e = a === void 0 ? "medium" : a, l = m === void 0 ? "p" : m, y = n === void 0 ? "light" : n, c = d === void 0 ? "normal" : d, x = R(null); let _, h; t[8] !== l ? (_ = () => { if (x.current && process.env.NODE_ENV !== "production") t: switch (l) { case "li": { if (!N(x.current, "ul, ol")) throw Error(v("DSText", `The DSText component with the tag "${l}" 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(v("DSText", `The DSText component with the tag "${l}" 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 = [l], t[8] = l, t[9] = _, t[10] = h) : (_ = t[9], h = t[10]), j(_, h); const f = l, p = e === "large", T = e === "large" && c === "bold", w = e == "medium", B = e === "medium" && c === "bold", D = e == "small", b = e == "small" && c === "bold", X = e == "x-small", k = e == "x-small" && c === "bold", E = e == "xx-small", M = y === "dark"; let u; t[11] !== r || t[12] !== B || t[13] !== D || t[14] !== b || t[15] !== X || t[16] !== k || t[17] !== E || t[18] !== M || t[19] !== p || t[20] !== T || t[21] !== w ? (u = P(o.root, r, { [o.rootLarge]: p, [o.rootLargeBold]: T, [o.rootMedium]: w, [o.rootMediumBold]: B, [o.rootSmall]: D, [o.rootSmallBold]: b, [o.rootXSmall]: X, [o.rootXSmallBold]: k, [o.rootXxSmall]: E, [o.rootThemeDark]: M }), t[11] = r, t[12] = B, t[13] = D, t[14] = b, t[15] = X, t[16] = k, t[17] = E, t[18] = M, t[19] = p, t[20] = T, t[21] = w, t[22] = u) : u = t[22]; const L = u; let S; return t[23] !== f || t[24] !== s || t[25] !== i || t[26] !== L ? (S = /* @__PURE__ */ $(f, { className: L, ref: x, ...i, children: s }), t[23] = f, t[24] = s, t[25] = i, t[26] = L, t[27] = S) : S = t[27], S; }; export { ot as DSText };