fui-fancyui
Version:
FancyUI Libary
32 lines (31 loc) • 1.33 kB
JavaScript
"use client";
import { jsxs as m, jsx as t } from "react/jsx-runtime";
import { useState as I, useEffect as g, Children as u } from "react";
import C from "../../atoms/SwitchActiveIndicator/SwitchActiveIndicator.js";
import S from "../../molecules/SideBar/SideBar.js";
import { SlotTop as B, MainItemsWrapper as v, ItemWrapper as z, ChildWrapper as w, SlotBottom as $ } from "./FancySideBar.style.js";
import { sizeSettings as c } from "../../molecules/SideBar/sizeSettings.js";
function k(l) {
const { slotContent: p, slotBottom: o, sizeC: e = "sm", slotTop: n, align: a = "left", wichItemIsActive: i, ...d } = l, [f, s] = I(i ?? 0);
return g(() => {
s(i ?? 0);
}, [i]), /* @__PURE__ */ m(S, { sizeC: e, ...d, children: [
n && /* @__PURE__ */ t(B, { $sizeC: e, children: n }),
/* @__PURE__ */ t(v, { $gap: c[e].gapBetweenItems, children: u.map(p, (h, r) => /* @__PURE__ */ m(z, { children: [
/* @__PURE__ */ t(w, { $sizeC: e, onClick: () => s(r), children: h }),
r === 0 && /* @__PURE__ */ t(
C,
{
itemNumber: f,
type: a === "right" ? "rightline" : "leftline",
direction: "vertical",
tabSpacing: c[e].gapBetweenItems
}
)
] }, r)) }),
o && /* @__PURE__ */ t($, { $sizeC: e, children: o })
] });
}
export {
k as default
};