@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
69 lines (68 loc) • 2.48 kB
JavaScript
"use client";
import { jsxs as B, Fragment as I, jsx as d } from "react/jsx-runtime";
import { d as k } from "./index.cKLI89Eg.js";
import { isValidElement as w, cloneElement as R } from "react";
import { D as W } from "./Icon.DYtaQgbw.js";
import { NumberIndicator as v } from "../numberindicator.DsK65Bj3.js";
import '../assets/NavigationTabList.D5VV0C7Y.css';const D = "ds-tabs_tabs-wrapper_45tya_1", E = "ds-tabs_scroll-wrapper_45tya_6", L = "ds-tabs_scroller_45tya_17", T = "ds-tabs_scroller--centered_45tya_28", j = "ds-tabs_tab_45tya_1", x = "ds-tabs_scroll-button_45tya_106", H = "ds-tabs_scroll-button--hidden_45tya_111", K = "ds-tabs_scroll-button--right_45tya_115", S = "ds-tabs_indicator_45tya_127", V = {
tabsWrapper: D,
scrollWrapper: E,
scroller: L,
scrollerCentered: T,
tab: j,
scrollButton: x,
scrollButtonHidden: H,
scrollButtonRight: K,
indicator: S
}, G = (h) => {
const t = k.c(15), {
tabs: b,
tabRefs: e,
scrollerClass: p,
scrollerRef: _,
selectedTabIndex: r,
handleNavigationKeydown: o,
setSelectedTab: l
} = h;
let s;
if (t[0] !== o || t[1] !== r || t[2] !== l || t[3] !== e || t[4] !== b) {
let i;
t[6] !== o || t[7] !== r || t[8] !== l || t[9] !== e ? (i = (g, a) => {
const {
id: u,
linkComponent: n,
iconName: f,
numberIndicatorValue: y,
numberIndicatorAriaLabel: C
} = g;
if (!w(n))
return null;
const N = R(n, {
"aria-current": r === a ? "page" : void 0,
children: /* @__PURE__ */ B(I, { children: [
f && /* @__PURE__ */ d(W, { name: f, "aria-hidden": "true" }),
n.props.children,
y && /* @__PURE__ */ d(v, { "aria-label": C, label: y })
] }),
className: V.tab,
id: u,
tabIndex: r === a ? 0 : -1,
onKeyDown: (m) => o(m, a),
onClick: () => {
n.props.onClick && n.props.onClick(), l(a);
},
ref: (m) => {
e.current[a] = m;
}
});
return /* @__PURE__ */ d("li", { children: N }, u);
}, t[6] = o, t[7] = r, t[8] = l, t[9] = e, t[10] = i) : i = t[10], s = b.map(i), t[0] = o, t[1] = r, t[2] = l, t[3] = e, t[4] = b, t[5] = s;
} else
s = t[5];
let c;
return t[11] !== p || t[12] !== _ || t[13] !== s ? (c = /* @__PURE__ */ d("ul", { className: p, ref: _, children: s }), t[11] = p, t[12] = _, t[13] = s, t[14] = c) : c = t[14], c;
};
export {
G as N,
V as s
};