geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
117 lines (116 loc) • 4.02 kB
JavaScript
import e from "react";
import { cn as i } from "./index.es85.js";
import { Button as E } from "./index.es9.js";
import { ArrowRight as S, ArrowLeft as g } from "lucide-react";
import { Typography as f } from "./index.es19.js";
const R = e.forwardRef(
({
children: t,
defaultCollapsed: a = !1,
collapsed: r,
onCollapsedChange: s,
width: n = "256px",
collapsedWidth: o = "64px",
className: m,
showToggle: c = !0,
togglePosition: l = { top: "20px", right: "0" },
toggleClassName: d,
collapseIcon: u,
expandIcon: b
}, v) => {
const [y, h] = e.useState(a), p = r !== void 0 ? r : y, N = () => {
const x = !p;
h(x), s?.(x);
}, w = {
top: l.top,
right: l.right,
left: l.left,
bottom: l.bottom
};
return /* @__PURE__ */ e.createElement(
"aside",
{
ref: v,
className: i(
"relative flex flex-col border-r border-neutral-1 bg-dark-2 transition-all duration-300 ease-in-out",
m
),
style: {
width: p ? o : n
}
},
c && /* @__PURE__ */ e.createElement("div", { className: "absolute z-10", style: w }, /* @__PURE__ */ e.createElement(
E,
{
onClick: N,
size: "sm",
variant: "secondary",
className: d
},
p ? b || /* @__PURE__ */ e.createElement(S, { className: "w-4 h-4" }) : u || /* @__PURE__ */ e.createElement(g, { className: "w-4 h-4" })
)),
/* @__PURE__ */ e.createElement("div", { className: "flex-1 w-full overflow-x-hidden overflow-y-auto whitespace-nowrap" }, t)
);
}
);
R.displayName = "SidebarRoot";
const k = e.forwardRef(({ logo: t, title: a, collapsed: r, className: s, children: n }, o) => /* @__PURE__ */ e.createElement(
"div",
{
ref: o,
className: i(
"flex min-w-max items-center gap-3 px-4 py-4 transition-opacity duration-200 ease-in-out",
r ? "pointer-events-none opacity-0" : "opacity-100",
s
)
},
n || /* @__PURE__ */ e.createElement(e.Fragment, null, t && /* @__PURE__ */ e.createElement("div", { className: "flex-shrink-0" }, t), a && /* @__PURE__ */ e.createElement(f, { variant: "h3", className: "truncate" }, a))
));
k.displayName = "SidebarHeader";
const C = e.forwardRef(({ title: t, children: a, className: r, collapsed: s }, n) => /* @__PURE__ */ e.createElement("div", { ref: n, className: i("mb-4", r) }, t && !s && /* @__PURE__ */ e.createElement(
f,
{
variant: "body4",
className: "px-3 mt-4 mb-2 uppercase text-dark-1"
},
t
), /* @__PURE__ */ e.createElement("div", { className: "px-4 space-y-1" }, a)));
C.displayName = "SidebarSection";
const F = e.forwardRef(({ icon: t, label: a, onClick: r, active: s, className: n, collapsed: o, href: m }, c) => {
const l = /* @__PURE__ */ e.createElement(e.Fragment, null, t && /* @__PURE__ */ e.createElement("span", { className: "flex items-center justify-center flex-shrink-0 w-5 h-5" }, t), !o && /* @__PURE__ */ e.createElement(f, { variant: "body4" }, a)), d = i(
"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-sm transition-colors",
s ? "text-dark-1 hover:bg-light-4 hover:text-light-1" : "text-dark-1 hover:bg-light-4 hover:text-light-1",
o && "justify-center px-2",
n
);
return m ? /* @__PURE__ */ e.createElement(
"a",
{
href: m,
className: d,
title: o ? a : void 0,
ref: c
},
l
) : /* @__PURE__ */ e.createElement(
"button",
{
onClick: r,
className: d,
title: o ? a : void 0,
ref: c
},
l
);
});
F.displayName = "SidebarItem";
const I = e.forwardRef(({ children: t, className: a, collapsed: r }, s) => /* @__PURE__ */ e.createElement("div", { ref: s, className: i("p-4", r && "px-2", a) }, t));
I.displayName = "SidebarFooter";
export {
I as SidebarFooter,
k as SidebarHeader,
F as SidebarItem,
R as SidebarRoot,
C as SidebarSection
};
//# sourceMappingURL=index.es83.js.map