@transkripid/flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS - Transkrip.id fork
72 lines (71 loc) • 3.56 kB
JavaScript
import { jsx as s, jsxs as E, Fragment as G } from "react/jsx-runtime";
import { c as J } from "react/compiler-runtime";
import { useId as K, useState as L, useEffect as Q } from "react";
import { HiChevronDown as R } from "react-icons/hi";
import { twMerge as F } from "tailwind-merge";
import { mergeDeep as U } from "../../helpers/merge-deep.mjs";
import { useSidebarContext as V } from "./SidebarContext.mjs";
import { SidebarItemContext as X } from "./SidebarItemContext.mjs";
import { Tooltip as Y } from "../Tooltip/Tooltip.mjs";
const Z = (g) => {
const e = J(41);
let p, n, C, t, r, f, b, h, i;
e[0] !== g ? ({
children: n,
className: C,
icon: p,
label: t,
chevronIcon: b,
renderChevronIcon: f,
open: h,
theme: i,
...r
} = g, e[0] = g, e[1] = p, e[2] = n, e[3] = C, e[4] = t, e[5] = r, e[6] = f, e[7] = b, e[8] = h, e[9] = i) : (p = e[1], n = e[2], C = e[3], t = e[4], r = e[5], f = e[6], b = e[7], h = e[8], i = e[9]);
const W = b === void 0 ? R : b, u = h === void 0 ? !1 : h;
let v;
e[10] !== i ? (v = i === void 0 ? {} : i, e[10] = i, e[11] = v) : v = e[11];
const q = v, H = K(), [l, M] = L(u), {
theme: z,
isCollapsed: N
} = V(), o = U(z.collapse, q);
let I, w;
e[12] !== u ? (I = () => M(u), w = [u], e[12] = u, e[13] = I, e[14] = w) : (I = e[13], w = e[14]), Q(I, w);
let S;
e[15] !== N || e[16] !== l || e[17] !== t ? (S = (B) => {
const {
children: P
} = B;
return /* @__PURE__ */ s("li", { children: N && !l ? /* @__PURE__ */ s(Y, { content: t, placement: "right", children: P }) : P });
}, e[15] = N, e[16] = l, e[17] = t, e[18] = S) : S = e[18];
const T = S, _ = `flowbite-sidebar-collapse-${H}`;
let a;
e[19] !== l ? (a = () => M(!l), e[19] = l, e[20] = a) : a = e[20];
const A = "button", $ = F(o.button, C), j = p && /* @__PURE__ */ s(p, { "aria-hidden": !0, "data-testid": "flowbite-sidebar-collapse-icon", className: F(o.icon.base, o.icon.open[l ? "on" : "off"]) }), D = N ? /* @__PURE__ */ s("span", { className: "sr-only", children: t }) : /* @__PURE__ */ E(G, { children: [
/* @__PURE__ */ s("span", { "data-testid": "flowbite-sidebar-collapse-label", className: o.label.base, children: t }),
f ? f(o, l) : /* @__PURE__ */ s(W, { "aria-hidden": !0, className: F(o.label.icon.base, o.label.icon.open[l ? "on" : "off"]) })
] });
let c;
e[21] !== t || e[22] !== r || e[23] !== $ || e[24] !== j || e[25] !== D || e[26] !== _ || e[27] !== a ? (c = /* @__PURE__ */ E("button", { id: _, onClick: a, title: t, type: A, className: $, ...r, children: [
j,
D
] }), e[21] = t, e[22] = r, e[23] = $, e[24] = j, e[25] = D, e[26] = _, e[27] = a, e[28] = c) : c = e[28];
const O = `flowbite-sidebar-collapse-${H}`, k = !l;
let x;
e[29] === Symbol.for("react.memo_cache_sentinel") ? (x = {
isInsideCollapse: !0
}, e[29] = x) : x = e[29];
let d;
e[30] !== n ? (d = /* @__PURE__ */ s(X.Provider, { value: x, children: n }), e[30] = n, e[31] = d) : d = e[31];
let m;
e[32] !== O || e[33] !== k || e[34] !== d || e[35] !== o.list ? (m = /* @__PURE__ */ s("ul", { "aria-labelledby": O, hidden: k, className: o.list, children: d }), e[32] = O, e[33] = k, e[34] = d, e[35] = o.list, e[36] = m) : m = e[36];
let y;
return e[37] !== T || e[38] !== c || e[39] !== m ? (y = /* @__PURE__ */ E(T, { children: [
c,
m
] }), e[37] = T, e[38] = c, e[39] = m, e[40] = y) : y = e[40], y;
};
Z.displayName = "Sidebar.Collapse";
export {
Z as SidebarCollapse
};
//# sourceMappingURL=SidebarCollapse.mjs.map