UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

83 lines (82 loc) 4.17 kB
"use client"; import { jsx as o, jsxs as O } from "react/jsx-runtime"; import { d as V } from "./chunks/index.cKLI89Eg.js"; import { c as L } from "./chunks/index.DQOqod3i.js"; import "react"; import { D as P } from "./chunks/Button.CCol--xy.js"; import { D as A } from "./chunks/Icon.DYtaQgbw.js"; import './assets/step.DOAmuuEQ.css';const E = "ds-stepper_step_1x7q2_1", I = "ds-stepper_step-content_1x7q2_5", R = "ds-stepper_step-button_1x7q2_12", w = "ds-stepper_step-button--horizontal_1x7q2_49", F = "ds-stepper_step-button--vertical_1x7q2_58", G = "ds-stepper_step-button--current_1x7q2_69", J = "ds-stepper_step-button--completed_1x7q2_107", K = "ds-stepper_step-button--disabled_1x7q2_135", M = "ds-stepper_step-number_1x7q2_166", Q = "ds-stepper_step-label_1x7q2_176", T = "ds-stepper_step-hint_1x7q2_184", U = "ds-stepper_step-number--current_1x7q2_213", W = "ds-stepper_step-label--current_1x7q2_239", X = "ds-stepper_sr-only_1x7q2_268", s = { step: E, stepContent: I, stepButton: R, stepButtonHorizontal: w, stepButtonVertical: F, stepButtonCurrent: G, stepButtonCompleted: J, stepButtonDisabled: K, stepNumber: M, stepLabel: Q, stepHint: T, stepNumberCurrent: U, stepLabelCurrent: W, srOnly: X }, Y = (r, t, e, p, _) => { const b = `${r("step")} ${t + 1} ${r("of")} ${e}`, C = _ ? r("current") : p.state === "completed" ? r("completed") : ""; return [b, p.label, C].filter(Boolean).join(" - "); }, ot = (r) => { const t = V.c(41), { step: e, index: p, stepsCount: _, t: b, onStepClick: C, buttonRef: D, orientation: k } = r, n = e.state === "current", l = e.disabled || !e.state; let f; t[0] !== p || t[1] !== n || t[2] !== e || t[3] !== _ || t[4] !== b ? (f = Y(b, p, _, e, n), t[0] = p, t[1] = n, t[2] = e, t[3] = _, t[4] = b, t[5] = f) : f = t[5]; const S = f, y = k === "horizontal" ? s.stepButtonHorizontal : s.stepButtonVertical, z = e.state === "completed"; let B; t[6] !== n || t[7] !== l || t[8] !== y || t[9] !== z ? (B = L(s.stepButton, y, { [s.stepButtonCurrent]: n, [s.stepButtonCompleted]: z, [s.stepButtonDisabled]: l }), t[6] = n, t[7] = l, t[8] = y, t[9] = z, t[10] = B) : B = t[10]; const H = B; let h; t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = L(s.stepContent), t[11] = h) : h = t[11]; const v = h; let x; t[12] !== n ? (x = L(s.stepNumber, { [s.stepNumberCurrent]: n }), t[12] = n, t[13] = x) : x = t[13]; const $ = x; let N; t[14] !== n ? (N = L(s.stepLabel, { [s.stepLabelCurrent]: n }), t[14] = n, t[15] = N) : N = t[15]; const g = N, j = n ? "step" : void 0; let a; t[16] !== p || t[17] !== e.state ? (a = e.state === "completed" ? /* @__PURE__ */ o(A, { name: "check", size: "medium", theme: "light" }) : p + 1, t[16] = p, t[17] = e.state, t[18] = a) : a = t[18]; let c; t[19] !== $ || t[20] !== a ? (c = /* @__PURE__ */ o("span", { className: $, "aria-hidden": "true", children: a }), t[19] = $, t[20] = a, t[21] = c) : c = t[21]; let i; t[22] !== e.label || t[23] !== g ? (i = /* @__PURE__ */ o("span", { className: g, children: e.label }), t[22] = e.label, t[23] = g, t[24] = i) : i = t[24]; let u; t[25] !== e.hint ? (u = e.hint && /* @__PURE__ */ o("span", { className: s.stepHint, children: e.hint }), t[25] = e.hint, t[26] = u) : u = t[26]; let d; t[27] !== S ? (d = /* @__PURE__ */ o("span", { className: s.srOnly, children: S }), t[27] = S, t[28] = d) : d = t[28]; let m; t[29] !== c || t[30] !== i || t[31] !== u || t[32] !== d ? (m = /* @__PURE__ */ O("span", { className: v, children: [ c, i, u, d ] }), t[29] = c, t[30] = i, t[31] = u, t[32] = d, t[33] = m) : m = t[33]; let q; return t[34] !== D || t[35] !== l || t[36] !== C || t[37] !== H || t[38] !== m || t[39] !== j ? (q = /* @__PURE__ */ o("li", { className: s.step, children: /* @__PURE__ */ o(P, { type: "button", variant: "ghost", className: H, "aria-current": j, disabled: l, onClick: C, ref: D, children: m }) }), t[34] = D, t[35] = l, t[36] = C, t[37] = H, t[38] = m, t[39] = j, t[40] = q) : q = t[40], q; }; export { ot as StepperStep, ot as default };