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