UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

139 lines (138 loc) 7.65 kB
"use client"; import { jsxs as rt, jsx as w, Fragment as at } from "react/jsx-runtime"; import { d as st } from "./index.CgTHIF3K.js"; import { c as y } from "./index.CEyLAtio.js"; import { D as lt } from "./Icon.DGTYCv63.js"; import { forwardRef as pt } from "react"; import { NumberIndicator as ct } from "../numberindicator.Ddf3ESi7.js"; import { g as W } from "./helpers.BbWkXTr3.js"; import '../assets/ActionLink.BdPEvuGm.css';const dt = "ds-action-link_root_14712_1", ht = "ds-action-link_root--indent-level-1_14712_72", _t = "ds-action-link_root--active_14712_75", vt = "ds-action-link_root--active--with-marker_14712_78", mt = "ds-action-link_root--icon--top_14712_81", ft = "ds-action-link_root--stretched_14712_106", kt = "ds-action-link_active-marker_14712_111", bt = "ds-action-link_active-marker--with-indent_14712_123", It = "ds-action-link_icon-wrapper_14712_127", Nt = "ds-action-link_icon-wrapper--x-large_14712_130", At = "ds-action-link_icon-wrapper--with-number-indicator_14712_133", gt = "ds-action-link_icon-wrapper--with-number-indicator--with-value_14712_141", ut = "ds-action-link_label_14712_145", wt = "ds-action-link_label--bold_14712_156", Wt = "ds-action-link_label--active_14712_167", Lt = "ds-action-link_label--icon-top_14712_178", St = "ds-action-link_number-indicator_14712_201", o = { root: dt, rootIndentLevel1: ht, rootActive: _t, rootActiveWithMarker: vt, rootIconTop: mt, rootStretched: ft, activeMarker: kt, activeMarkerWithIndent: bt, iconWrapper: It, iconWrapperXLarge: Nt, iconWrapperWithNumberIndicator: At, iconWrapperWithNumberIndicatorWithValue: gt, label: ut, labelBold: wt, labelActive: Wt, labelIconTop: Lt, numberIndicator: St }, Kt = ["left", "top"], Vt = ["large", "x-large"], yt = [0, 1], Bt = ["normal", "bold"], Pt = ({ iconName: _, iconSize: v, iconSource: t, iconPosition: a, indentLevel: s, stretched: l, weight: p }) => { if (_ && !t && v === "x-large" && console.warn(W("DSActionLink", 'An "iconSize" prop set to "x-large" has no effect when "iconName" is set. Please remove the "iconSize" prop or provide a custom icon via the "iconSource" prop.')), a === "top") { if (!_ && !t) throw new Error(W("DSActionLink", 'The "iconPosition" prop should not be set to "top", when no "iconName" or "iconSource" prop was provided. Please either remove the "iconPosition" prop or set a valid icon via the "iconName" or "iconSource" prop.')); v === "x-large" && console.warn(W("DSActionLink", 'An "iconSize" prop set to "x-large" has no effect when "iconPosition" is set to "top". Please remove the "iconSize" prop.')), p === "bold" && console.warn(W("DSActionLink", 'A "weight" prop set to "bold" with "iconPosition" set to "top" has no effect. Please remove the "weight" prop.')), s === 1 && console.warn(W("DSActionLink", 'An "indentLevel" prop set to "1" with "iconPosition" set to "top" has no effect. Please remove the "indentLevel" prop.')), l && console.warn(W("DSActionLink", 'A "stretched" prop set to "true" with "iconPosition" set to "top" has no effect. Please remove the "stretched" prop.')); } }, Dt = pt((_, v) => { const t = st.c(73); let a, s, l, p, h, n, r, i, m, f, k, L, S, P, D, T, x, M; t[0] !== _ ? ({ children: s, aria: a, className: l, download: p, href: h, iconName: n, iconPosition: L, iconSize: S, iconSource: r, indentLevel: P, isActive: D, numberIndicatorValue: i, referrerPolicy: m, rel: f, stretched: T, target: x, weight: M, ...k } = _, t[0] = _, t[1] = a, t[2] = s, t[3] = l, t[4] = p, t[5] = h, t[6] = n, t[7] = r, t[8] = i, t[9] = m, t[10] = f, t[11] = k, t[12] = L, t[13] = S, t[14] = P, t[15] = D, t[16] = T, t[17] = x, t[18] = M) : (a = t[1], s = t[2], l = t[3], p = t[4], h = t[5], n = t[6], r = t[7], i = t[8], m = t[9], f = t[10], k = t[11], L = t[12], S = t[13], P = t[14], D = t[15], T = t[16], x = t[17], M = t[18]); const e = L === void 0 ? "left" : L, C = S === void 0 ? "large" : S, B = P === void 0 ? 0 : P, d = D === void 0 ? !1 : D, it = T === void 0 ? !1 : T, X = x === void 0 ? "_self" : x, nt = M === void 0 ? "normal" : M; process.env.NODE_ENV !== "production" && Pt({ iconName: n, iconSize: C, iconSource: r, iconPosition: e, indentLevel: B, stretched: it, weight: nt }); const c = (i == null ? void 0 : i.trim()) === "", j = e === "top", H = B === 1, F = d && e === "left", G = it === !0 && e === "left"; let E; t[19] !== l || t[20] !== d || t[21] !== F || t[22] !== G || t[23] !== j || t[24] !== H ? (E = y(o.root, l, { [o.rootIconTop]: j, [o.rootIndentLevel1]: H, [o.rootActive]: d, [o.rootActiveWithMarker]: F, [o.rootStretched]: G }), t[19] = l, t[20] = d, t[21] = F, t[22] = G, t[23] = j, t[24] = H, t[25] = E) : E = t[25]; const R = E, Z = B === 1; let O; t[26] !== Z ? (O = y(o.activeMarker, { [o.activeMarkerWithIndent]: Z }), t[26] = Z, t[27] = O) : O = t[27]; const $ = O, q = d && e === "left", J = nt === "bold", Q = e === "top"; let z; t[28] !== q || t[29] !== J || t[30] !== Q ? (z = y(o.label, { [o.labelActive]: q, [o.labelBold]: J, [o.labelIconTop]: Q }), t[28] = q, t[29] = J, t[30] = Q, t[31] = z) : z = t[31]; const U = z, Y = C === "x-large", tt = (n || r) && (i || c), et = (n || r) && !c; let K; t[32] !== Y || t[33] !== tt || t[34] !== et ? (K = y(o.iconWrapper, { [o.iconWrapperXLarge]: Y, [o.iconWrapperWithNumberIndicator]: tt, [o.iconWrapperWithNumberIndicatorWithValue]: et }), t[32] = Y, t[33] = tt, t[34] = et, t[35] = K) : K = t[35]; const ot = K, b = h === void 0 ? "span" : "a"; let I; t[36] !== b || t[37] !== p || t[38] !== h || t[39] !== m || t[40] !== f || t[41] !== X ? (I = b === "a" && { href: h, target: X, rel: f, referrerPolicy: m, download: p }, t[36] = b, t[37] = p, t[38] = h, t[39] = m, t[40] = f, t[41] = X, t[42] = I) : I = t[42]; let N; t[43] !== $ || t[44] !== e || t[45] !== d ? (N = d && e === "left" && /* @__PURE__ */ w("div", { className: $ }), t[43] = $, t[44] = e, t[45] = d, t[46] = N) : N = t[46]; let A; t[47] !== n || t[48] !== e || t[49] !== C || t[50] !== r || t[51] !== ot || t[52] !== c || t[53] !== i ? (A = (n || r) && /* @__PURE__ */ w(at, { children: /* @__PURE__ */ rt("span", { className: ot, children: [ /* @__PURE__ */ w(lt, { name: n, theme: "light", source: r, "aria-hidden": "true", size: n || e === "top" ? "large" : C }), (e === "left" && c || e === "top" && (i || c)) && /* @__PURE__ */ w(ct, { variant: "highlight", label: i }) ] }) }), t[47] = n, t[48] = e, t[49] = C, t[50] = r, t[51] = ot, t[52] = c, t[53] = i, t[54] = A) : A = t[54]; let g; t[55] !== s || t[56] !== U ? (g = /* @__PURE__ */ w("span", { className: U, children: s }), t[55] = s, t[56] = U, t[57] = g) : g = t[57]; let u; t[58] !== e || t[59] !== c || t[60] !== i ? (u = e === "left" && i && !c && /* @__PURE__ */ w(ct, { variant: "default", label: i, className: o.numberIndicator }), t[58] = e, t[59] = c, t[60] = i, t[61] = u) : u = t[61]; let V; return t[62] !== b || t[63] !== a || t[64] !== v || t[65] !== k || t[66] !== R || t[67] !== I || t[68] !== N || t[69] !== A || t[70] !== g || t[71] !== u ? (V = /* @__PURE__ */ rt(b, { className: R, ...I, ...a, ...k, ref: v, children: [ N, A, g, u ] }), t[62] = b, t[63] = a, t[64] = v, t[65] = k, t[66] = R, t[67] = I, t[68] = N, t[69] = A, t[70] = g, t[71] = u, t[72] = V) : V = t[72], V; }); Dt.displayName = "DSActionLink"; export { Kt as A, Dt as D, Vt as a, yt as b, Bt as c, Pt as v };