@rqdhw3n/react-admin-layout 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as n, Fragment as A, jsxs as o } from "react/jsx-runtime";
2
2
  import { createContext as V, useState as w, useEffect as M, useCallback as L, useMemo as U, useContext as Z, useRef as T } from "react";
3
3
  import { useLocation as I, NavLink as ee } from "react-router-dom";
4
- import { ChevronDown as H, X as te, Home as ne, ChevronRight as ae, Search as re, Bell as ie, Sun as le, Moon as se, Settings as de, User as oe, LogOut as ce, Menu as me, PanelLeftOpen as J, PanelLeftClose as G } from "lucide-react";
4
+ import { ChevronDown as H, X as te, Home as ne, ChevronRight as re, Search as ae, Bell as ie, Sun as se, Moon as le, Settings as de, User as oe, LogOut as ce, Menu as me, PanelLeftOpen as J, PanelLeftClose as G } from "lucide-react";
5
5
  function ue(e) {
6
6
  if (typeof window > "u") return {};
7
7
  try {
@@ -22,48 +22,48 @@ const Q = V(null);
22
22
  function he({
23
23
  children: e,
24
24
  storageKey: t = "rqdhw3n-admin-layout",
25
- defaultCollapsed: a = !1,
26
- permissions: r = {},
27
- initialBreadcrumbs: s = [],
28
- initialActivePath: l = "/",
25
+ defaultCollapsed: r = !1,
26
+ permissions: a = {},
27
+ initialBreadcrumbs: l = [],
28
+ initialActivePath: s = "/",
29
29
  initialDarkMode: i
30
30
  }) {
31
31
  const d = ue(t), [c, b] = w(
32
- d.sidebarCollapsed ?? a
32
+ d.sidebarCollapsed ?? r
33
33
  ), [f, v] = w(!1), [h, m] = w(
34
34
  d.darkMode ?? i ?? !1
35
- ), [p, N] = w(s), [C, x] = w(l);
35
+ ), [p, N] = w(l), [C, g] = w(s);
36
36
  M(() => {
37
37
  be(t, { sidebarCollapsed: c, darkMode: h });
38
38
  }, [t, c, h]), M(() => {
39
39
  const y = document.documentElement;
40
40
  h ? y.classList.add("dark") : y.classList.remove("dark");
41
41
  }, [h]);
42
- const S = L(() => b((y) => !y), []), g = L(() => v((y) => !y), []), P = L(() => m((y) => !y), []), B = U(
42
+ const S = L(() => b((y) => !y), []), x = L(() => v((y) => !y), []), P = L(() => m((y) => !y), []), B = U(
43
43
  () => ({
44
44
  sidebarCollapsed: c,
45
45
  mobileOpen: f,
46
46
  darkMode: h,
47
47
  toggleSidebar: S,
48
48
  setSidebarCollapsed: b,
49
- toggleMobile: g,
49
+ toggleMobile: x,
50
50
  setMobileOpen: v,
51
51
  toggleDarkMode: P,
52
52
  setDarkMode: m,
53
- permissions: r,
53
+ permissions: a,
54
54
  breadcrumbs: p,
55
55
  setBreadcrumbs: N,
56
56
  activePath: C,
57
- setActivePath: x
57
+ setActivePath: g
58
58
  }),
59
59
  [
60
60
  c,
61
61
  f,
62
62
  h,
63
63
  S,
64
- g,
64
+ x,
65
65
  P,
66
- r,
66
+ a,
67
67
  p,
68
68
  C
69
69
  ]
@@ -80,49 +80,49 @@ function O() {
80
80
  const {
81
81
  sidebarCollapsed: e,
82
82
  mobileOpen: t,
83
- toggleSidebar: a,
84
- setSidebarCollapsed: r,
85
- toggleMobile: s,
86
- setMobileOpen: l
83
+ toggleSidebar: r,
84
+ setSidebarCollapsed: a,
85
+ toggleMobile: l,
86
+ setMobileOpen: s
87
87
  } = k();
88
88
  return {
89
89
  collapsed: e,
90
90
  mobileOpen: t,
91
- toggle: a,
92
- setCollapsed: r,
93
- toggleMobile: s,
94
- setMobileOpen: l,
95
- closeMobile: () => l(!1)
91
+ toggle: r,
92
+ setCollapsed: a,
93
+ toggleMobile: l,
94
+ setMobileOpen: s,
95
+ closeMobile: () => s(!1)
96
96
  };
97
97
  }
98
98
  function E(e) {
99
99
  const t = e.split("/").filter(Boolean);
100
- return t.length ? t.map((a, r) => {
101
- const s = "/" + t.slice(0, r + 1).join("/");
102
- return { label: a.replace(/-/g, " ").replace(/\b\w/g, (i) => i.toUpperCase()), path: r < t.length - 1 ? s : void 0 };
100
+ return t.length ? t.map((r, a) => {
101
+ const l = "/" + t.slice(0, a + 1).join("/");
102
+ return { label: r.replace(/-/g, " ").replace(/\b\w/g, (i) => i.toUpperCase()), path: a < t.length - 1 ? l : void 0 };
103
103
  }) : [{ label: "Home", path: "/" }];
104
104
  }
105
105
  function W(e) {
106
- var t, a, r = "";
107
- if (typeof e == "string" || typeof e == "number") r += e;
106
+ var t, r, a = "";
107
+ if (typeof e == "string" || typeof e == "number") a += e;
108
108
  else if (typeof e == "object") if (Array.isArray(e)) {
109
- var s = e.length;
110
- for (t = 0; t < s; t++) e[t] && (a = W(e[t])) && (r && (r += " "), r += a);
111
- } else for (a in e) e[a] && (r && (r += " "), r += a);
112
- return r;
109
+ var l = e.length;
110
+ for (t = 0; t < l; t++) e[t] && (r = W(e[t])) && (a && (a += " "), a += r);
111
+ } else for (r in e) e[r] && (a && (a += " "), a += r);
112
+ return a;
113
113
  }
114
114
  function fe() {
115
- for (var e, t, a = 0, r = "", s = arguments.length; a < s; a++) (e = arguments[a]) && (t = W(e)) && (r && (r += " "), r += t);
116
- return r;
115
+ for (var e, t, r = 0, a = "", l = arguments.length; r < l; r++) (e = arguments[r]) && (t = W(e)) && (a && (a += " "), a += t);
116
+ return a;
117
117
  }
118
118
  function u(...e) {
119
119
  return fe(e);
120
120
  }
121
121
  function pe({ children: e }) {
122
- const { pathname: t } = I(), { setActivePath: a, setBreadcrumbs: r, breadcrumbs: s } = k();
122
+ const { pathname: t } = I(), { setActivePath: r, setBreadcrumbs: a, breadcrumbs: l } = k();
123
123
  return M(() => {
124
- a(t), s.length || r(E(t));
125
- }, [t, a, r, s.length]), /* @__PURE__ */ n(A, { children: e });
124
+ r(t), l.length || a(E(t));
125
+ }, [t, r, a, l.length]), /* @__PURE__ */ n(A, { children: e });
126
126
  }
127
127
  function xe({ children: e, className: t }) {
128
128
  return /* @__PURE__ */ n(
@@ -149,21 +149,21 @@ function ge(e) {
149
149
  }
150
150
  function ve(e, t) {
151
151
  if (!t) return !0;
152
- const { resource: a, action: r } = ge(t), s = e[a];
153
- return s != null && s.length ? s.includes(r) || s.includes("*") : !1;
152
+ const { resource: r, action: a } = ge(t), l = e[r];
153
+ return l != null && l.length ? l.includes(a) || l.includes("*") : !1;
154
154
  }
155
155
  function D(e, t) {
156
- return e.filter((a) => ve(t, a.permission)).map((a) => ({
157
- ...a,
158
- children: a.children ? D(a.children, t) : void 0
159
- })).filter((a) => {
160
- var r;
161
- return !((r = a.children) != null && r.length) || a.children.length > 0 || a.path;
156
+ return e.filter((r) => ve(t, r.permission)).map((r) => ({
157
+ ...r,
158
+ children: r.children ? D(r.children, t) : void 0
159
+ })).filter((r) => {
160
+ var a;
161
+ return !((a = r.children) != null && a.length) || r.children.length > 0 || r.path;
162
162
  });
163
163
  }
164
- function X({ label: e, children: t, collapsed: a, className: r }) {
165
- return /* @__PURE__ */ o("div", { className: u("mb-4", r), children: [
166
- e && !a && /* @__PURE__ */ n("p", { className: "mb-2 px-3 text-[11px] font-semibold uppercase tracking-wider text-admin-muted", children: e }),
164
+ function X({ label: e, children: t, collapsed: r, className: a }) {
165
+ return /* @__PURE__ */ o("div", { className: u("mb-4", a), children: [
166
+ e && !r && /* @__PURE__ */ n("p", { className: "mb-2 px-3 text-[11px] font-semibold uppercase tracking-wider text-admin-muted", children: e }),
167
167
  /* @__PURE__ */ n("ul", { className: "space-y-0.5", children: t })
168
168
  ] });
169
169
  }
@@ -173,19 +173,19 @@ function z(e, t) {
173
173
  function R({
174
174
  item: e,
175
175
  collapsed: t = !1,
176
- depth: a = 0,
177
- activePath: r = "/",
178
- onNavigate: s,
179
- LinkComponent: l,
176
+ depth: r = 0,
177
+ activePath: a = "/",
178
+ onNavigate: l,
179
+ LinkComponent: s,
180
180
  onItemClick: i
181
181
  }) {
182
- var x, S;
183
- const d = !!((x = e.children) != null && x.length), c = e.path ? z(e.path, r) : !1, b = (S = e.children) == null ? void 0 : S.some((g) => g.path && z(g.path, r)), [f, v] = w(c || b), h = e.icon, m = u(
182
+ var g, S;
183
+ const d = !!((g = e.children) != null && g.length), c = e.path ? z(e.path, a) : !1, b = (S = e.children) == null ? void 0 : S.some((x) => x.path && z(x.path, a)), [f, v] = w(c || b), h = e.icon, m = u(
184
184
  "group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200",
185
185
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-admin-primary",
186
186
  c || b ? "bg-admin-primary text-white shadow-sm" : "text-admin-muted hover:bg-admin-bg hover:text-admin-text",
187
187
  e.disabled && "pointer-events-none opacity-50",
188
- a > 0 && "text-[13px] py-2"
188
+ r > 0 && "text-[13px] py-2"
189
189
  ), p = /* @__PURE__ */ o(A, { children: [
190
190
  h && /* @__PURE__ */ n(
191
191
  h,
@@ -216,12 +216,12 @@ function R({
216
216
  ] })
217
217
  ] }), N = () => {
218
218
  if (d) {
219
- v((g) => !g);
219
+ v((x) => !x);
220
220
  return;
221
221
  }
222
- e.path && (s == null || s(e.path), i == null || i());
223
- }, C = e.path && !d && l ? /* @__PURE__ */ n(
224
- l,
222
+ e.path && (l == null || l(e.path), i == null || i());
223
+ }, C = e.path && !d && s ? /* @__PURE__ */ n(
224
+ s,
225
225
  {
226
226
  to: e.path,
227
227
  className: m,
@@ -233,30 +233,30 @@ function R({
233
233
  ) : /* @__PURE__ */ n("button", { type: "button", className: m, onClick: N, disabled: e.disabled, children: p });
234
234
  return /* @__PURE__ */ o("li", { children: [
235
235
  C,
236
- d && f && !t && /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 border-l border-admin-border ml-5 pl-2", children: e.children.map((g) => /* @__PURE__ */ n(
236
+ d && f && !t && /* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5 border-l border-admin-border ml-5 pl-2", children: e.children.map((x) => /* @__PURE__ */ n(
237
237
  R,
238
238
  {
239
- item: g,
239
+ item: x,
240
240
  collapsed: t,
241
- depth: a + 1,
242
- activePath: r,
243
- onNavigate: s,
244
- LinkComponent: l,
241
+ depth: r + 1,
242
+ activePath: a,
243
+ onNavigate: l,
244
+ LinkComponent: s,
245
245
  onItemClick: i
246
246
  },
247
- g.label + (g.path ?? "")
247
+ x.label + (x.path ?? "")
248
248
  )) })
249
249
  ] });
250
250
  }
251
251
  function ye({
252
252
  items: e,
253
253
  appName: t = "Admin",
254
- appLogo: a,
255
- onNavigate: r,
256
- activePath: s,
257
- LinkComponent: l
254
+ appLogo: r,
255
+ onNavigate: a,
256
+ activePath: l,
257
+ LinkComponent: s
258
258
  }) {
259
- const { mobileOpen: i, closeMobile: d } = O(), { permissions: c, activePath: b } = k(), f = s ?? b, v = D(e, c);
259
+ const { mobileOpen: i, closeMobile: d } = O(), { permissions: c, activePath: b } = k(), f = l ?? b, v = D(e, c);
260
260
  if (M(() => {
261
261
  if (!i) return;
262
262
  const m = (p) => {
@@ -267,7 +267,7 @@ function ye({
267
267
  };
268
268
  }, [i, d]), !i) return null;
269
269
  const h = (m) => {
270
- r == null || r(m), d();
270
+ a == null || a(m), d();
271
271
  };
272
272
  return /* @__PURE__ */ o("div", { className: "fixed inset-0 z-50 lg:hidden", role: "dialog", "aria-modal": "true", children: [
273
273
  /* @__PURE__ */ n(
@@ -289,7 +289,7 @@ function ye({
289
289
  children: [
290
290
  /* @__PURE__ */ o("div", { className: "flex h-16 items-center justify-between border-b border-admin-border px-4", children: [
291
291
  /* @__PURE__ */ o("div", { className: "flex items-center gap-3", children: [
292
- a ?? /* @__PURE__ */ n("div", { className: "flex h-9 w-9 items-center justify-center rounded-xl bg-admin-primary text-sm font-bold text-white", children: t.charAt(0) }),
292
+ r ?? /* @__PURE__ */ n("div", { className: "flex h-9 w-9 items-center justify-center rounded-xl bg-admin-primary text-sm font-bold text-white", children: t.charAt(0) }),
293
293
  /* @__PURE__ */ n("span", { className: "font-semibold text-admin-text", children: t })
294
294
  ] }),
295
295
  /* @__PURE__ */ n(
@@ -309,7 +309,7 @@ function ye({
309
309
  item: m,
310
310
  activePath: f,
311
311
  onNavigate: h,
312
- LinkComponent: l,
312
+ LinkComponent: s,
313
313
  onItemClick: d
314
314
  },
315
315
  m.label + (m.path ?? "")
@@ -322,39 +322,39 @@ function ye({
322
322
  function we({
323
323
  items: e,
324
324
  className: t,
325
- LinkComponent: a,
326
- onNavigate: r
325
+ LinkComponent: r,
326
+ onNavigate: a
327
327
  }) {
328
328
  if (!e.length) return null;
329
- const s = (l, i) => {
329
+ const l = (s, i) => {
330
330
  const d = u(
331
331
  "text-sm transition-colors",
332
332
  i ? "font-medium text-admin-text" : "text-admin-muted hover:text-admin-text"
333
333
  );
334
- return !l.path || i ? /* @__PURE__ */ n("span", { className: d, children: l.label }) : a ? /* @__PURE__ */ n(a, { to: l.path, className: d, children: l.label }) : /* @__PURE__ */ n("button", { type: "button", className: d, onClick: () => r == null ? void 0 : r(l.path), children: l.label });
334
+ return !s.path || i ? /* @__PURE__ */ n("span", { className: d, children: s.label }) : r ? /* @__PURE__ */ n(r, { to: s.path, className: d, children: s.label }) : /* @__PURE__ */ n("button", { type: "button", className: d, onClick: () => a == null ? void 0 : a(s.path), children: s.label });
335
335
  };
336
336
  return /* @__PURE__ */ o("nav", { "aria-label": "Breadcrumb", className: u("flex items-center gap-1.5", t), children: [
337
337
  /* @__PURE__ */ n(ne, { className: "h-4 w-4 text-admin-muted shrink-0", "aria-hidden": !0 }),
338
- e.map((l, i) => {
338
+ e.map((s, i) => {
339
339
  const d = i === e.length - 1;
340
340
  return /* @__PURE__ */ o("span", { className: "flex items-center gap-1.5", children: [
341
- /* @__PURE__ */ n(ae, { className: "h-3.5 w-3.5 text-admin-muted", "aria-hidden": !0 }),
342
- s(l, d)
343
- ] }, `${l.label}-${i}`);
341
+ /* @__PURE__ */ n(re, { className: "h-3.5 w-3.5 text-admin-muted", "aria-hidden": !0 }),
342
+ l(s, d)
343
+ ] }, `${s.label}-${i}`);
344
344
  })
345
345
  ] });
346
346
  }
347
347
  function Ne({
348
348
  placeholder: e = "Search...",
349
349
  onSearch: t,
350
- className: a
350
+ className: r
351
351
  }) {
352
- const [r, s] = w("");
352
+ const [a, l] = w("");
353
353
  return /* @__PURE__ */ o("form", { onSubmit: (i) => {
354
- i.preventDefault(), t == null || t(r.trim());
355
- }, className: u("relative w-full max-w-md", a), children: [
354
+ i.preventDefault(), t == null || t(a.trim());
355
+ }, className: u("relative w-full max-w-md", r), children: [
356
356
  /* @__PURE__ */ n(
357
- re,
357
+ ae,
358
358
  {
359
359
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-admin-muted",
360
360
  "aria-hidden": !0
@@ -364,8 +364,8 @@ function Ne({
364
364
  "input",
365
365
  {
366
366
  type: "search",
367
- value: r,
368
- onChange: (i) => s(i.target.value),
367
+ value: a,
368
+ onChange: (i) => l(i.target.value),
369
369
  placeholder: e,
370
370
  className: u(
371
371
  "h-10 w-full rounded-xl border border-admin-border bg-admin-bg pl-10 pr-4 text-sm text-admin-text",
@@ -377,32 +377,32 @@ function Ne({
377
377
  ] });
378
378
  }
379
379
  function ke({ notifications: e = [], className: t }) {
380
- const [a, r] = w(!1), s = T(null), l = e.filter((i) => !i.read).length;
380
+ const [r, a] = w(!1), l = T(null), s = e.filter((i) => !i.read).length;
381
381
  return M(() => {
382
382
  const i = (d) => {
383
- s.current && !s.current.contains(d.target) && r(!1);
383
+ l.current && !l.current.contains(d.target) && a(!1);
384
384
  };
385
385
  return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
386
- }, []), /* @__PURE__ */ o("div", { ref: s, className: u("relative", t), children: [
386
+ }, []), /* @__PURE__ */ o("div", { ref: l, className: u("relative", t), children: [
387
387
  /* @__PURE__ */ o(
388
388
  "button",
389
389
  {
390
390
  type: "button",
391
- onClick: () => r((i) => !i),
391
+ onClick: () => a((i) => !i),
392
392
  className: u(
393
393
  "relative inline-flex h-9 w-9 items-center justify-center rounded-lg border border-admin-border",
394
394
  "bg-admin-surface text-admin-muted transition-colors hover:bg-admin-bg hover:text-admin-text",
395
395
  "focus-visible:ring-2 focus-visible:ring-admin-primary"
396
396
  ),
397
- "aria-label": `Notifications${l ? `, ${l} unread` : ""}`,
398
- "aria-expanded": a,
397
+ "aria-label": `Notifications${s ? `, ${s} unread` : ""}`,
398
+ "aria-expanded": r,
399
399
  children: [
400
400
  /* @__PURE__ */ n(ie, { className: "h-4 w-4", "aria-hidden": !0 }),
401
- l > 0 && /* @__PURE__ */ n("span", { className: "absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white", children: l > 9 ? "9+" : l })
401
+ s > 0 && /* @__PURE__ */ n("span", { className: "absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white", children: s > 9 ? "9+" : s })
402
402
  ]
403
403
  }
404
404
  ),
405
- a && /* @__PURE__ */ o("div", { className: "absolute right-0 top-full z-50 mt-2 w-80 rounded-xl border border-admin-border bg-admin-surface shadow-admin-lg animate-fade-in", children: [
405
+ r && /* @__PURE__ */ o("div", { className: "absolute right-0 top-full z-50 mt-2 w-80 rounded-xl border border-admin-border bg-admin-surface shadow-admin-lg animate-fade-in", children: [
406
406
  /* @__PURE__ */ n("div", { className: "border-b border-admin-border px-4 py-3", children: /* @__PURE__ */ n("p", { className: "text-sm font-semibold text-admin-text", children: "Notifications" }) }),
407
407
  /* @__PURE__ */ n("ul", { className: "max-h-72 overflow-y-auto p-2", children: e.length === 0 ? /* @__PURE__ */ n("li", { className: "px-3 py-6 text-center text-sm text-admin-muted", children: "No notifications" }) : e.map((i) => /* @__PURE__ */ o(
408
408
  "li",
@@ -423,20 +423,20 @@ function ke({ notifications: e = [], className: t }) {
423
423
  ] });
424
424
  }
425
425
  function Ce() {
426
- const { darkMode: e, toggleDarkMode: t, setDarkMode: a } = k();
426
+ const { darkMode: e, toggleDarkMode: t, setDarkMode: r } = k();
427
427
  return {
428
428
  isDark: e,
429
429
  toggle: t,
430
- setDarkMode: a
430
+ setDarkMode: r
431
431
  };
432
432
  }
433
433
  function Se({ className: e }) {
434
- const { isDark: t, toggle: a } = Ce();
434
+ const { isDark: t, toggle: r } = Ce();
435
435
  return /* @__PURE__ */ n(
436
436
  "button",
437
437
  {
438
438
  type: "button",
439
- onClick: a,
439
+ onClick: r,
440
440
  className: u(
441
441
  "inline-flex h-9 w-9 items-center justify-center rounded-lg border border-admin-border",
442
442
  "bg-admin-surface text-admin-muted transition-colors hover:bg-admin-bg hover:text-admin-text",
@@ -444,30 +444,30 @@ function Se({ className: e }) {
444
444
  e
445
445
  ),
446
446
  "aria-label": t ? "Switch to light mode" : "Switch to dark mode",
447
- children: t ? /* @__PURE__ */ n(le, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ n(se, { className: "h-4 w-4", "aria-hidden": !0 })
447
+ children: t ? /* @__PURE__ */ n(se, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ n(le, { className: "h-4 w-4", "aria-hidden": !0 })
448
448
  }
449
449
  );
450
450
  }
451
- function Me({ user: e, onLogout: t, onSettings: a, className: r }) {
452
- const [s, l] = w(!1), i = T(null);
451
+ function Me({ user: e, onLogout: t, onSettings: r, className: a }) {
452
+ const [l, s] = w(!1), i = T(null);
453
453
  M(() => {
454
454
  const c = (b) => {
455
- i.current && !i.current.contains(b.target) && l(!1);
455
+ i.current && !i.current.contains(b.target) && s(!1);
456
456
  };
457
457
  return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
458
458
  }, []);
459
459
  const d = e.name.split(" ").map((c) => c[0]).join("").slice(0, 2).toUpperCase();
460
- return /* @__PURE__ */ o("div", { ref: i, className: u("relative", r), children: [
460
+ return /* @__PURE__ */ o("div", { ref: i, className: u("relative", a), children: [
461
461
  /* @__PURE__ */ o(
462
462
  "button",
463
463
  {
464
464
  type: "button",
465
- onClick: () => l((c) => !c),
465
+ onClick: () => s((c) => !c),
466
466
  className: u(
467
467
  "flex items-center gap-2 rounded-xl border border-admin-border bg-admin-surface px-2 py-1.5",
468
468
  "transition-colors hover:bg-admin-bg focus-visible:ring-2 focus-visible:ring-admin-primary"
469
469
  ),
470
- "aria-expanded": s,
470
+ "aria-expanded": l,
471
471
  "aria-haspopup": "menu",
472
472
  children: [
473
473
  e.avatar ? /* @__PURE__ */ n("img", { src: e.avatar, alt: "", className: "h-8 w-8 rounded-lg object-cover" }) : /* @__PURE__ */ n("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-admin-primary text-xs font-semibold text-white", children: d }),
@@ -479,7 +479,7 @@ function Me({ user: e, onLogout: t, onSettings: a, className: r }) {
479
479
  ]
480
480
  }
481
481
  ),
482
- s && /* @__PURE__ */ o(
482
+ l && /* @__PURE__ */ o(
483
483
  "div",
484
484
  {
485
485
  role: "menu",
@@ -492,7 +492,7 @@ function Me({ user: e, onLogout: t, onSettings: a, className: r }) {
492
492
  role: "menuitem",
493
493
  className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-admin-text hover:bg-admin-bg",
494
494
  onClick: () => {
495
- a == null || a(), l(!1);
495
+ r == null || r(), s(!1);
496
496
  },
497
497
  children: [
498
498
  /* @__PURE__ */ n(de, { className: "h-4 w-4 text-admin-muted" }),
@@ -520,7 +520,7 @@ function Me({ user: e, onLogout: t, onSettings: a, className: r }) {
520
520
  role: "menuitem",
521
521
  className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-950/30",
522
522
  onClick: () => {
523
- t == null || t(), l(!1);
523
+ t == null || t(), s(!1);
524
524
  },
525
525
  children: [
526
526
  /* @__PURE__ */ n(ce, { className: "h-4 w-4" }),
@@ -536,10 +536,10 @@ function Me({ user: e, onLogout: t, onSettings: a, className: r }) {
536
536
  function Pe({
537
537
  user: e,
538
538
  notifications: t = [],
539
- onSearch: a,
540
- searchPlaceholder: r = "Search...",
541
- showSearch: s = !0,
542
- className: l,
539
+ onSearch: r,
540
+ searchPlaceholder: a = "Search...",
541
+ showSearch: l = !0,
542
+ className: s,
543
543
  breadcrumbs: i = [],
544
544
  onMenuClick: d,
545
545
  sidebarCollapsed: c,
@@ -551,7 +551,7 @@ function Pe({
551
551
  className: u(
552
552
  "sticky top-0 z-40 flex h-16 shrink-0 items-center gap-4 border-b border-admin-border",
553
553
  "admin-glass bg-admin-surface px-4 lg:px-6",
554
- l
554
+ s
555
555
  ),
556
556
  children: [
557
557
  /* @__PURE__ */ n(
@@ -576,7 +576,7 @@ function Pe({
576
576
  ),
577
577
  /* @__PURE__ */ n("div", { className: "hidden min-w-0 flex-1 md:block", children: /* @__PURE__ */ n(we, { items: i }) }),
578
578
  /* @__PURE__ */ o("div", { className: "flex flex-1 items-center justify-end gap-2 sm:gap-3", children: [
579
- s && /* @__PURE__ */ n("div", { className: "hidden flex-1 sm:flex sm:max-w-md", children: /* @__PURE__ */ n(Ne, { placeholder: r, onSearch: a }) }),
579
+ l && /* @__PURE__ */ n("div", { className: "hidden flex-1 sm:flex sm:max-w-md", children: /* @__PURE__ */ n(Ne, { placeholder: a, onSearch: r }) }),
580
580
  /* @__PURE__ */ n(Se, {}),
581
581
  /* @__PURE__ */ n(ke, { notifications: t }),
582
582
  e && /* @__PURE__ */ n(Me, { user: e })
@@ -588,23 +588,24 @@ function Pe({
588
588
  function Le({
589
589
  items: e,
590
590
  collapsed: t,
591
- appName: a = "Admin",
592
- appLogo: r,
593
- className: s,
594
- onNavigate: l,
591
+ appName: r = "Admin",
592
+ appLogo: a,
593
+ className: l,
594
+ onNavigate: s,
595
595
  activePath: i,
596
596
  LinkComponent: d
597
597
  }) {
598
- const { collapsed: c, toggle: b, closeMobile: f } = O(), { permissions: v, activePath: h } = k(), m = t ?? c, p = i ?? h, N = D(e, v), C = (x) => {
599
- l == null || l(x), f();
598
+ const { collapsed: c, toggle: b, closeMobile: f } = O(), { permissions: v, activePath: h } = k(), m = t ?? c, p = i ?? h, N = D(e, v), C = (g) => {
599
+ s == null || s(g), f();
600
600
  };
601
601
  return /* @__PURE__ */ o(
602
602
  "aside",
603
603
  {
604
604
  className: u(
605
- "hidden lg:flex flex-col border-r border-admin-border bg-admin-surface transition-all duration-300 ease-in-out",
605
+ "hidden lg:flex shrink-0 flex-col border-r border-admin-border bg-admin-surface",
606
+ "h-screen sticky top-0 transition-[width] duration-300 ease-in-out",
606
607
  m ? "w-[var(--admin-sidebar-collapsed)]" : "w-[var(--admin-sidebar-width)]",
607
- s
608
+ l
608
609
  ),
609
610
  "aria-label": "Sidebar navigation",
610
611
  children: [
@@ -617,8 +618,8 @@ function Le({
617
618
  ),
618
619
  children: [
619
620
  /* @__PURE__ */ o("div", { className: u("flex items-center gap-3 min-w-0", m && "justify-center"), children: [
620
- r ?? /* @__PURE__ */ n("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-admin-primary text-sm font-bold text-white shadow-admin", children: a.charAt(0) }),
621
- !m && /* @__PURE__ */ n("span", { className: "truncate text-base font-semibold text-admin-text", children: a })
621
+ a ?? /* @__PURE__ */ n("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-admin-primary text-sm font-bold text-white shadow-admin", children: r.charAt(0) }),
622
+ !m && /* @__PURE__ */ n("span", { className: "truncate text-base font-semibold text-admin-text", children: r })
622
623
  ] }),
623
624
  !m && /* @__PURE__ */ n(
624
625
  "button",
@@ -643,16 +644,16 @@ function Le({
643
644
  children: /* @__PURE__ */ n(J, { className: "h-4 w-4" })
644
645
  }
645
646
  ) }),
646
- /* @__PURE__ */ n("nav", { className: "flex-1 overflow-y-auto p-3", children: /* @__PURE__ */ n(X, { collapsed: m, children: N.map((x) => /* @__PURE__ */ n(
647
+ /* @__PURE__ */ n("nav", { className: "flex-1 overflow-y-auto p-3", children: /* @__PURE__ */ n(X, { collapsed: m, children: N.map((g) => /* @__PURE__ */ n(
647
648
  R,
648
649
  {
649
- item: x,
650
+ item: g,
650
651
  collapsed: m,
651
652
  activePath: p,
652
653
  onNavigate: C,
653
654
  LinkComponent: d
654
655
  },
655
- x.label + (x.path ?? "")
656
+ g.label + (g.path ?? "")
656
657
  )) }) })
657
658
  ]
658
659
  }
@@ -661,10 +662,10 @@ function Le({
661
662
  function F({
662
663
  children: e,
663
664
  sidebarItems: t,
664
- appName: a = "Admin",
665
- appLogo: r,
666
- user: s,
667
- notifications: l = [],
665
+ appName: r = "Admin",
666
+ appLogo: a,
667
+ user: l,
668
+ notifications: s = [],
668
669
  footer: i,
669
670
  showFooter: d = !0,
670
671
  showSearch: c = !0,
@@ -678,9 +679,9 @@ function F({
678
679
  enableRouter: C = !1
679
680
  }) {
680
681
  const {
681
- sidebarCollapsed: x,
682
+ sidebarCollapsed: g,
682
683
  toggleSidebar: S,
683
- toggleMobile: g,
684
+ toggleMobile: x,
684
685
  breadcrumbs: P,
685
686
  setBreadcrumbs: B,
686
687
  activePath: y,
@@ -689,94 +690,96 @@ function F({
689
690
  Y(j), v || B(E(j)), p == null || p(j), _();
690
691
  };
691
692
  return /* @__PURE__ */ o("div", { className: "admin-layout-root min-h-screen bg-admin-bg text-admin-text", children: [
692
- /* @__PURE__ */ n(
693
- Le,
694
- {
695
- items: t,
696
- appName: a,
697
- appLogo: r,
698
- activePath: $,
699
- onNavigate: q,
700
- LinkComponent: N
701
- }
702
- ),
703
693
  /* @__PURE__ */ n(
704
694
  ye,
705
695
  {
706
696
  items: t,
707
- appName: a,
708
- appLogo: r,
697
+ appName: r,
698
+ appLogo: a,
709
699
  activePath: $,
710
700
  onNavigate: q,
711
701
  LinkComponent: N
712
702
  }
713
703
  ),
714
- /* @__PURE__ */ o("div", { className: u("flex min-h-screen flex-col transition-all duration-300", x ? "lg:pl-[var(--admin-sidebar-collapsed)]" : "lg:pl-[var(--admin-sidebar-width)]"), children: [
704
+ /* @__PURE__ */ o("div", { className: "flex min-h-screen w-full", children: [
715
705
  /* @__PURE__ */ n(
716
- Pe,
706
+ Le,
717
707
  {
718
- user: s,
719
- notifications: l,
720
- onSearch: f,
721
- searchPlaceholder: b,
722
- showSearch: c,
723
- breadcrumbs: K,
724
- onMenuClick: g,
725
- sidebarCollapsed: x,
726
- onToggleSidebar: S
708
+ items: t,
709
+ appName: r,
710
+ appLogo: a,
711
+ activePath: $,
712
+ onNavigate: q,
713
+ LinkComponent: N
727
714
  }
728
715
  ),
729
- /* @__PURE__ */ n("main", { className: u("flex-1 p-4 lg:p-6", h), children: e }),
730
- d && /* @__PURE__ */ n(xe, { children: i })
716
+ /* @__PURE__ */ o("div", { className: "flex min-h-screen min-w-0 flex-1 flex-col", children: [
717
+ /* @__PURE__ */ n(
718
+ Pe,
719
+ {
720
+ user: l,
721
+ notifications: s,
722
+ onSearch: f,
723
+ searchPlaceholder: b,
724
+ showSearch: c,
725
+ breadcrumbs: K,
726
+ onMenuClick: x,
727
+ sidebarCollapsed: g,
728
+ onToggleSidebar: S
729
+ }
730
+ ),
731
+ /* @__PURE__ */ n("main", { className: u("flex-1 p-4 lg:p-6", h), children: e }),
732
+ d && /* @__PURE__ */ n(xe, { children: i })
733
+ ] })
731
734
  ] })
732
735
  ] });
733
736
  }
734
- function De(e) {
737
+ function Ee(e) {
735
738
  const {
736
739
  storageKey: t = "rqdhw3n-admin-layout",
737
- defaultCollapsed: a = !1,
738
- initialDarkMode: r = !1,
739
- permissions: s = {},
740
- breadcrumbs: l = [],
740
+ defaultCollapsed: r = !1,
741
+ initialDarkMode: a = !1,
742
+ permissions: l = {},
743
+ breadcrumbs: s = [],
741
744
  activePath: i = "/",
742
745
  enableRouter: d = !1,
743
746
  children: c,
744
747
  ...b
745
748
  } = e, f = U(
746
- () => l.length ? l : E(i),
747
- [l, i]
749
+ () => s.length ? s : E(i),
750
+ [s, i]
748
751
  );
749
752
  return /* @__PURE__ */ n(
750
753
  he,
751
754
  {
752
755
  storageKey: t,
753
- defaultCollapsed: a,
754
- permissions: s,
756
+ defaultCollapsed: r,
757
+ permissions: l,
755
758
  initialBreadcrumbs: f,
756
759
  initialActivePath: i,
757
- initialDarkMode: r,
760
+ initialDarkMode: a,
758
761
  children: d ? /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(F, { ...b, enableRouter: d, children: c }) }) : /* @__PURE__ */ n(F, { ...b, enableRouter: d, children: c })
759
762
  }
760
763
  );
761
764
  }
762
- function Re({ to: e, className: t, children: a, onClick: r }) {
763
- return /* @__PURE__ */ n(ee, { to: e, className: t, onClick: r, children: a });
765
+ function De({ to: e, className: t, children: r, onClick: a }) {
766
+ return /* @__PURE__ */ n(ee, { to: e, className: t, onClick: a, children: r });
764
767
  }
765
- function $e() {
768
+ function Re() {
766
769
  return k();
767
770
  }
768
- function qe() {
769
- const { breadcrumbs: e, setBreadcrumbs: t } = k(), a = L(
770
- (r) => t(r),
771
+ function $e() {
772
+ const { breadcrumbs: e, setBreadcrumbs: t } = k(), r = L(
773
+ (a) => t(a),
771
774
  [t]
772
775
  );
773
776
  return {
774
777
  items: e,
775
- setBreadcrumbs: a
778
+ setBreadcrumbs: r
776
779
  };
777
780
  }
778
781
  export {
779
- De as AdminLayout,
782
+ Ee as AdminLayout,
780
783
  pe as AdminLayoutRouterSync,
781
784
  we as Breadcrumbs,
782
785
  xe as Footer,
@@ -785,7 +788,7 @@ export {
785
788
  Pe as Navbar,
786
789
  Ne as NavbarSearch,
787
790
  ke as NotificationMenu,
788
- Re as RouterLink,
791
+ De as RouterLink,
789
792
  Le as Sidebar,
790
793
  X as SidebarGroup,
791
794
  R as SidebarItem,
@@ -795,10 +798,10 @@ export {
795
798
  D as filterSidebarByPermissions,
796
799
  E as generateBreadcrumbsFromPath,
797
800
  ve as hasPermission,
798
- qe as useBreadcrumbs,
801
+ $e as useBreadcrumbs,
799
802
  Ce as useDarkMode,
800
803
  k as useLayoutContext,
801
- $e as useLayoutState,
804
+ Re as useLayoutState,
802
805
  O as useSidebar
803
806
  };
804
807
  //# sourceMappingURL=index.js.map