UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

83 lines (82 loc) 4.15 kB
"use client"; import { jsx as o, jsxs as V } from "react/jsx-runtime"; import { d as P } from "./chunks/index.D-sRdssb.js"; import { c as D } from "./chunks/index.DL9mof6u.js"; import "react"; import { D as A } from "./chunks/Button.Cn5yg7dG.js"; import { D as E } from "./chunks/Icon.CDLyB7Pv.js"; import './assets/step.BeLporJO.css';const I = "ds-stepper_step_f4kic_1", R = "ds-stepper_step-content_f4kic_5", q = "ds-stepper_step-button_f4kic_12", w = "ds-stepper_step-button--horizontal_f4kic_49", F = "ds-stepper_step-button--vertical_f4kic_58", G = "ds-stepper_step-button--current_f4kic_69", J = "ds-stepper_step-button--completed_f4kic_107", K = "ds-stepper_step-button--disabled_f4kic_135", M = "ds-stepper_step-number_f4kic_166", Q = "ds-stepper_step-label_f4kic_176", T = "ds-stepper_step-hint_f4kic_184", U = "ds-stepper_step-number--current_f4kic_212", W = "ds-stepper_step-label--current_f4kic_238", X = "ds-stepper_sr-only_f4kic_266", s = { step: I, stepContent: R, stepButton: q, 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}`, f = _ ? r("current") : p.state === "completed" ? r("completed") : ""; return [b, p.label, f].filter(Boolean).join(" - "); }, ot = (r) => { const t = P.c(41), { step: e, index: p, stepsCount: _, t: b, onStepClick: f, buttonRef: S, orientation: v } = r, n = e.state === "current", l = e.disabled || !e.state; let C; t[0] !== p || t[1] !== n || t[2] !== e || t[3] !== _ || t[4] !== b ? (C = Y(b, p, _, e, n), t[0] = p, t[1] = n, t[2] = e, t[3] = _, t[4] = b, t[5] = C) : C = t[5]; const y = C, z = v === "horizontal" ? s.stepButtonHorizontal : s.stepButtonVertical, H = e.state === "completed"; let B; t[6] !== n || t[7] !== l || t[8] !== z || t[9] !== H ? (B = D(s.stepButton, z, { [s.stepButtonCurrent]: n, [s.stepButtonCompleted]: H, [s.stepButtonDisabled]: l }), t[6] = n, t[7] = l, t[8] = z, t[9] = H, t[10] = B) : B = t[10]; const x = B; let h; t[11] === Symbol.for("react.memo_cache_sentinel") ? (h = D(s.stepContent), t[11] = h) : h = t[11]; const O = h; let k; t[12] !== n ? (k = D(s.stepNumber, { [s.stepNumberCurrent]: n }), t[12] = n, t[13] = k) : k = t[13]; const $ = k; let N; t[14] !== n ? (N = D(s.stepLabel, { [s.stepLabelCurrent]: n }), t[14] = n, t[15] = N) : N = t[15]; const g = N, j = n ? "step" : void 0; let c; t[16] !== p || t[17] !== e.state ? (c = e.state === "completed" ? /* @__PURE__ */ o(E, { name: "check", size: "medium", theme: "light" }) : p + 1, t[16] = p, t[17] = e.state, t[18] = c) : c = t[18]; let a; t[19] !== $ || t[20] !== c ? (a = /* @__PURE__ */ o("span", { className: $, "aria-hidden": "true", children: c }), t[19] = $, t[20] = c, t[21] = a) : a = 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] !== y ? (d = /* @__PURE__ */ o("span", { className: s.srOnly, children: y }), t[27] = y, t[28] = d) : d = t[28]; let m; t[29] !== a || t[30] !== i || t[31] !== u || t[32] !== d ? (m = /* @__PURE__ */ V("span", { className: O, children: [ a, i, u, d ] }), t[29] = a, t[30] = i, t[31] = u, t[32] = d, t[33] = m) : m = t[33]; let L; return t[34] !== S || t[35] !== l || t[36] !== f || t[37] !== x || t[38] !== m || t[39] !== j ? (L = /* @__PURE__ */ o("li", { className: s.step, children: /* @__PURE__ */ o(A, { type: "button", variant: "ghost", className: x, "aria-current": j, disabled: l, onClick: f, ref: S, children: m }) }), t[34] = S, t[35] = l, t[36] = f, t[37] = x, t[38] = m, t[39] = j, t[40] = L) : L = t[40], L; }; export { ot as StepperStep, ot as default };