@rqdhw3n/react-admin-layout 1.0.0 → 1.0.2

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,138 +1,264 @@
1
- import { jsx as n, Fragment as A, jsxs as o } from "react/jsx-runtime";
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
- 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";
5
- function ue(e) {
1
+ import { jsx as a, Fragment as $, jsxs as u } from "react/jsx-runtime";
2
+ import { useContext as Y, createContext as _, useCallback as A, useSyncExternalStore as le, useState as C, useEffect as E, useMemo as I, useRef as H } from "react";
3
+ import { useLocation as ce, NavLink as ue } from "react-router-dom";
4
+ import { ChevronDown as Z, X as me, Home as fe, ChevronRight as be, Search as he, Bell as pe, Sun as xe, Moon as ve, Settings as ye, User as ge, LogOut as we, Menu as Ne, PanelLeftOpen as ee, PanelLeftClose as re } from "lucide-react";
5
+ function G(e) {
6
6
  if (typeof window > "u") return {};
7
7
  try {
8
- const t = localStorage.getItem(e);
9
- return t ? JSON.parse(t) : {};
8
+ const r = localStorage.getItem(e), n = r ? JSON.parse(r) : null;
9
+ if (!n || typeof n != "object") return {};
10
+ const t = n;
11
+ return {
12
+ sidebarCollapsed: typeof t.sidebarCollapsed == "boolean" ? t.sidebarCollapsed : void 0,
13
+ darkMode: typeof t.darkMode == "boolean" ? t.darkMode : void 0,
14
+ mode: t.mode === "light" || t.mode === "dark" || t.mode === "system" ? t.mode : void 0
15
+ };
10
16
  } catch {
11
17
  return {};
12
18
  }
13
19
  }
14
- function be(e, t) {
20
+ function ke(e, r) {
15
21
  if (!(typeof window > "u"))
16
22
  try {
17
- localStorage.setItem(e, JSON.stringify(t));
23
+ localStorage.setItem(e, JSON.stringify(r));
18
24
  } catch {
19
25
  }
20
26
  }
21
- const Q = V(null);
22
- function he({
27
+ const te = Object.freeze({
28
+ primary: "#2563eb",
29
+ secondary: "#7c3aed",
30
+ background: "#f8fafc",
31
+ surface: "#ffffff",
32
+ text: "#0f172a",
33
+ textSecondary: "#64748b",
34
+ sidebarBackground: "#ffffff",
35
+ sidebarText: "#64748b",
36
+ headerBackground: "#ffffff",
37
+ headerText: "#0f172a",
38
+ hoverBackground: "#f1f5f9",
39
+ hoverText: "#0f172a",
40
+ activeBackground: "#2563eb",
41
+ activeText: "#ffffff",
42
+ border: "#e2e8f0",
43
+ onPrimary: "#ffffff",
44
+ danger: "#dc2626",
45
+ onDanger: "#ffffff",
46
+ overlay: "rgb(15 23 42 / 0.5)"
47
+ }), Se = Object.freeze({
48
+ ...te,
49
+ primary: "#3b82f6",
50
+ secondary: "#a78bfa",
51
+ background: "#0b1220",
52
+ surface: "#111827",
53
+ text: "#f1f5f9",
54
+ textSecondary: "#94a3b8",
55
+ sidebarBackground: "#111827",
56
+ sidebarText: "#cbd5e1",
57
+ headerBackground: "#111827",
58
+ headerText: "#f1f5f9",
59
+ hoverBackground: "#1e293b",
60
+ hoverText: "#ffffff",
61
+ activeBackground: "#3b82f6",
62
+ activeText: "#020617",
63
+ onPrimary: "#020617",
64
+ border: "#334155",
65
+ danger: "#f87171",
66
+ onDanger: "#020617",
67
+ overlay: "rgb(2 6 23 / 0.7)"
68
+ }), Xe = Object.freeze({
69
+ modern: Object.freeze({ style: "modern" }),
70
+ minimal: Object.freeze({ style: "minimal" }),
71
+ compact: Object.freeze({ style: "compact" })
72
+ }), Q = {
73
+ primary: "--ral-primary",
74
+ secondary: "--ral-secondary",
75
+ background: "--ral-background",
76
+ surface: "--ral-surface",
77
+ text: "--ral-text",
78
+ textSecondary: "--ral-text-secondary",
79
+ sidebarBackground: "--ral-sidebar-bg",
80
+ sidebarText: "--ral-sidebar-text",
81
+ headerBackground: "--ral-header-bg",
82
+ headerText: "--ral-header-text",
83
+ hoverBackground: "--ral-hover-bg",
84
+ hoverText: "--ral-hover-text",
85
+ activeBackground: "--ral-active-bg",
86
+ activeText: "--ral-active-text",
87
+ border: "--ral-border",
88
+ onPrimary: "--ral-on-primary",
89
+ danger: "--ral-danger",
90
+ onDanger: "--ral-on-danger",
91
+ overlay: "--ral-overlay"
92
+ };
93
+ function Me(e = {}, r = "light") {
94
+ const n = e.mode === "system" ? r : e.mode ?? "light", t = { ...n === "dark" ? Se : te }, o = {};
95
+ for (const s of [e.colors, e[n]])
96
+ if (s)
97
+ for (const i of Object.keys(t)) {
98
+ const d = s[i];
99
+ typeof d == "string" && d.trim() && (o[i] = d);
100
+ }
101
+ return Object.assign(t, o), o.primary && !o.activeBackground && (t.activeBackground = o.primary), { mode: n, style: e.style ?? "modern", colors: t };
102
+ }
103
+ function Ce(e) {
104
+ return Object.fromEntries(
105
+ Object.keys(Q).map(
106
+ (r) => [Q[r], e.colors[r]]
107
+ )
108
+ );
109
+ }
110
+ const ae = _(null);
111
+ function Le() {
112
+ const e = Y(ae);
113
+ if (!e) throw new Error("useAdminLayoutTheme must be used within LayoutProvider / AdminLayout");
114
+ return {
115
+ mode: e.requestedMode,
116
+ resolvedMode: e.mode,
117
+ style: e.style,
118
+ colors: e.colors,
119
+ setMode: e.setMode
120
+ };
121
+ }
122
+ const W = "(prefers-color-scheme: dark)", Be = () => "light";
123
+ function je(e) {
124
+ const r = A((t) => {
125
+ if (!e || typeof window > "u" || !window.matchMedia) return () => {
126
+ };
127
+ const o = window.matchMedia(W);
128
+ return o.addEventListener ? (o.addEventListener("change", t), () => o.removeEventListener("change", t)) : (o.addListener(t), () => o.removeListener(t));
129
+ }, [e]), n = A(
130
+ () => {
131
+ var t;
132
+ return e && typeof window < "u" && ((t = window.matchMedia) != null && t.call(window, W).matches) ? "dark" : "light";
133
+ },
134
+ [e]
135
+ );
136
+ return le(r, n, Be);
137
+ }
138
+ const ne = _(null);
139
+ function Ae({
23
140
  children: e,
24
- storageKey: t = "rqdhw3n-admin-layout",
25
- defaultCollapsed: a = !1,
26
- permissions: r = {},
27
- initialBreadcrumbs: s = [],
28
- initialActivePath: l = "/",
29
- initialDarkMode: i
141
+ storageKey: r = "rqdhw3n-admin-layout",
142
+ defaultCollapsed: n = !1,
143
+ permissions: t = {},
144
+ initialBreadcrumbs: o = [],
145
+ initialActivePath: s = "/",
146
+ initialDarkMode: i,
147
+ theme: d,
148
+ onThemeModeChange: l
30
149
  }) {
31
- const d = ue(t), [c, b] = w(
32
- d.sidebarCollapsed ?? a
33
- ), [f, v] = w(!1), [h, m] = w(
34
- d.darkMode ?? i ?? !1
35
- ), [p, N] = w(s), [C, x] = w(l);
36
- M(() => {
37
- be(t, { sidebarCollapsed: c, darkMode: h });
38
- }, [t, c, h]), M(() => {
39
- const y = document.documentElement;
40
- h ? y.classList.add("dark") : y.classList.remove("dark");
41
- }, [h]);
42
- const S = L(() => b((y) => !y), []), g = L(() => v((y) => !y), []), P = L(() => m((y) => !y), []), B = U(
150
+ const [c, x] = C(n), [w, y] = C(!1), [m, p] = C(i ? "dark" : "light"), [N, S] = C(null), v = (d == null ? void 0 : d.mode) ?? m, f = je(v === "system"), D = Me({ ...d, mode: v }, f), k = D.mode === "dark", P = A((h) => {
151
+ (d == null ? void 0 : d.mode) === void 0 && p(h), l == null || l(h);
152
+ }, [d == null ? void 0 : d.mode, l]), L = A((h) => P(h ? "dark" : "light"), [P]), [T, g] = C(o), [M, B] = C(s);
153
+ E(() => {
154
+ const h = G(r);
155
+ x(h.sidebarCollapsed ?? n), p(h.mode ?? (h.darkMode ?? i ? "dark" : "light")), S(r);
156
+ }, [r]), E(() => {
157
+ if (N !== r) return;
158
+ const h = G(r);
159
+ ke(r, (d == null ? void 0 : d.mode) === void 0 ? { sidebarCollapsed: c, darkMode: k, mode: v } : { ...h, sidebarCollapsed: c });
160
+ }, [r, c, k, v, d == null ? void 0 : d.mode, N]), E(() => {
161
+ if (d !== void 0) return;
162
+ const h = document.documentElement, z = h.classList.contains("dark");
163
+ return k ? h.classList.add("dark") : h.classList.remove("dark"), () => {
164
+ h.classList.toggle("dark", z);
165
+ };
166
+ }, [k, d]);
167
+ const j = A(() => x((h) => !h), []), R = A(() => y((h) => !h), []), q = A(() => L(!k), [L, k]), U = I(
43
168
  () => ({
44
169
  sidebarCollapsed: c,
45
- mobileOpen: f,
46
- darkMode: h,
47
- toggleSidebar: S,
48
- setSidebarCollapsed: b,
49
- toggleMobile: g,
50
- setMobileOpen: v,
51
- toggleDarkMode: P,
52
- setDarkMode: m,
53
- permissions: r,
54
- breadcrumbs: p,
55
- setBreadcrumbs: N,
56
- activePath: C,
57
- setActivePath: x
170
+ mobileOpen: w,
171
+ darkMode: k,
172
+ toggleSidebar: j,
173
+ setSidebarCollapsed: x,
174
+ toggleMobile: R,
175
+ setMobileOpen: y,
176
+ toggleDarkMode: q,
177
+ setDarkMode: L,
178
+ permissions: t,
179
+ breadcrumbs: T,
180
+ setBreadcrumbs: g,
181
+ activePath: M,
182
+ setActivePath: B
58
183
  }),
59
184
  [
60
185
  c,
61
- f,
62
- h,
63
- S,
64
- g,
65
- P,
66
- r,
67
- p,
68
- C
186
+ w,
187
+ k,
188
+ j,
189
+ R,
190
+ q,
191
+ L,
192
+ t,
193
+ T,
194
+ M
69
195
  ]
70
196
  );
71
- return /* @__PURE__ */ n(Q.Provider, { value: B, children: e });
197
+ return /* @__PURE__ */ a(ne.Provider, { value: U, children: /* @__PURE__ */ a(ae.Provider, { value: { ...D, requestedMode: v, setMode: P }, children: e }) });
72
198
  }
73
- function k() {
74
- const e = Z(Q);
199
+ function O() {
200
+ const e = Y(ne);
75
201
  if (!e)
76
202
  throw new Error("useLayoutContext must be used within LayoutProvider / AdminLayout");
77
203
  return e;
78
204
  }
79
- function O() {
205
+ function F() {
80
206
  const {
81
207
  sidebarCollapsed: e,
82
- mobileOpen: t,
83
- toggleSidebar: a,
84
- setSidebarCollapsed: r,
85
- toggleMobile: s,
86
- setMobileOpen: l
87
- } = k();
208
+ mobileOpen: r,
209
+ toggleSidebar: n,
210
+ setSidebarCollapsed: t,
211
+ toggleMobile: o,
212
+ setMobileOpen: s
213
+ } = O(), i = A(() => s(!1), [s]);
88
214
  return {
89
215
  collapsed: e,
90
- mobileOpen: t,
91
- toggle: a,
92
- setCollapsed: r,
93
- toggleMobile: s,
94
- setMobileOpen: l,
95
- closeMobile: () => l(!1)
216
+ mobileOpen: r,
217
+ toggle: n,
218
+ setCollapsed: t,
219
+ toggleMobile: o,
220
+ setMobileOpen: s,
221
+ closeMobile: i
96
222
  };
97
223
  }
98
- function E(e) {
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 };
224
+ function J(e) {
225
+ const r = e.split("/").filter(Boolean);
226
+ return r.length ? r.map((n, t) => {
227
+ const o = "/" + r.slice(0, t + 1).join("/");
228
+ return { label: n.replace(/-/g, " ").replace(/\b\w/g, (i) => i.toUpperCase()), path: t < r.length - 1 ? o : void 0 };
103
229
  }) : [{ label: "Home", path: "/" }];
104
230
  }
105
- function W(e) {
106
- var t, a, r = "";
107
- if (typeof e == "string" || typeof e == "number") r += e;
231
+ function ie(e) {
232
+ var r, n, t = "";
233
+ if (typeof e == "string" || typeof e == "number") t += e;
108
234
  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;
113
- }
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;
117
- }
118
- function u(...e) {
119
- return fe(e);
120
- }
121
- function pe({ children: e }) {
122
- const { pathname: t } = I(), { setActivePath: a, setBreadcrumbs: r, breadcrumbs: s } = k();
123
- return M(() => {
124
- a(t), s.length || r(E(t));
125
- }, [t, a, r, s.length]), /* @__PURE__ */ n(A, { children: e });
126
- }
127
- function xe({ children: e, className: t }) {
128
- return /* @__PURE__ */ n(
235
+ var o = e.length;
236
+ for (r = 0; r < o; r++) e[r] && (n = ie(e[r])) && (t && (t += " "), t += n);
237
+ } else for (n in e) e[n] && (t && (t += " "), t += n);
238
+ return t;
239
+ }
240
+ function Ee() {
241
+ for (var e, r, n = 0, t = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (r = ie(e)) && (t && (t += " "), t += r);
242
+ return t;
243
+ }
244
+ function b(...e) {
245
+ return Ee(e);
246
+ }
247
+ function Pe({ children: e }) {
248
+ const { pathname: r } = ce(), { setActivePath: n, setBreadcrumbs: t, breadcrumbs: o } = O();
249
+ return E(() => {
250
+ n(r), o.length || t(J(r));
251
+ }, [r, n, t, o.length]), /* @__PURE__ */ a($, { children: e });
252
+ }
253
+ function Oe({ children: e, className: r }) {
254
+ return /* @__PURE__ */ a(
129
255
  "footer",
130
256
  {
131
- className: u(
257
+ className: b(
132
258
  "mt-auto border-t border-admin-border bg-admin-surface px-6 py-4 text-sm text-admin-muted",
133
- t
259
+ r
134
260
  ),
135
- children: e ?? /* @__PURE__ */ o("p", { className: "text-center", children: [
261
+ children: e ?? /* @__PURE__ */ u("p", { className: "text-center", children: [
136
262
  "© ",
137
263
  (/* @__PURE__ */ new Date()).getFullYear(),
138
264
  " Admin Layout · Built with @rqdhw3n/react-admin-layout"
@@ -140,281 +266,322 @@ function xe({ children: e, className: t }) {
140
266
  }
141
267
  );
142
268
  }
143
- function ge(e) {
144
- const t = e.indexOf(".");
145
- return t === -1 ? { resource: e, action: "view" } : {
146
- resource: e.slice(0, t),
147
- action: e.slice(t + 1)
269
+ function De(e) {
270
+ const r = e.indexOf(".");
271
+ return r === -1 ? { resource: e, action: "view" } : {
272
+ resource: e.slice(0, r),
273
+ action: e.slice(r + 1)
148
274
  };
149
275
  }
150
- function ve(e, t) {
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;
154
- }
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;
276
+ function Te(e, r) {
277
+ if (!r) return !0;
278
+ const { resource: n, action: t } = De(r), o = e[n];
279
+ return o != null && o.length ? o.includes(t) || o.includes("*") : !1;
280
+ }
281
+ function K(e, r) {
282
+ return e.filter((n) => Te(r, n.permission)).map((n) => ({
283
+ ...n,
284
+ children: n.children ? K(n.children, r) : void 0
285
+ })).filter((n) => {
286
+ var t;
287
+ return !((t = n.children) != null && t.length) || n.children.length > 0 || n.path;
162
288
  });
163
289
  }
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 }),
167
- /* @__PURE__ */ n("ul", { className: "space-y-0.5", children: t })
290
+ function oe({ label: e, children: r, collapsed: n, className: t }) {
291
+ return /* @__PURE__ */ u("div", { className: b("ral-sidebar-group mb-4", t), children: [
292
+ e && !n && /* @__PURE__ */ a("p", { className: "ral-sidebar-brand mb-2 px-3 text-[11px] font-semibold uppercase tracking-wider", children: e }),
293
+ /* @__PURE__ */ a("ul", { className: "space-y-0.5", children: r })
168
294
  ] });
169
295
  }
170
- function z(e, t) {
171
- return e ? t === e || t.startsWith(`${e}/`) : !1;
296
+ function de(e, r) {
297
+ return e ? r === e || r.startsWith(`${e}/`) : !1;
298
+ }
299
+ function se(e, r) {
300
+ var n;
301
+ return !!((n = e.children) != null && n.some((t) => de(t.path, r) || se(t, r)));
172
302
  }
173
- function R({
303
+ function V({
174
304
  item: e,
175
- collapsed: t = !1,
176
- depth: a = 0,
177
- activePath: r = "/",
178
- onNavigate: s,
179
- LinkComponent: l,
305
+ collapsed: r = !1,
306
+ depth: n = 0,
307
+ activePath: t = "/",
308
+ onNavigate: o,
309
+ LinkComponent: s,
180
310
  onItemClick: i
181
311
  }) {
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(
184
- "group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200",
312
+ var v;
313
+ const d = !!((v = e.children) != null && v.length), l = e.path ? de(e.path, t) : !1, c = se(e, t), [x, w] = C(l || c);
314
+ E(() => {
315
+ c && w(!0);
316
+ }, [t, c]);
317
+ const y = e.icon, m = b(
318
+ "ral-nav-item group flex w-full items-center gap-3 px-3 text-sm font-medium",
185
319
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-admin-primary",
186
- c || b ? "bg-admin-primary text-white shadow-sm" : "text-admin-muted hover:bg-admin-bg hover:text-admin-text",
187
320
  e.disabled && "pointer-events-none opacity-50",
188
- a > 0 && "text-[13px] py-2"
189
- ), p = /* @__PURE__ */ o(A, { children: [
190
- h && /* @__PURE__ */ n(
191
- h,
321
+ n > 0 && "text-[13px]",
322
+ r && "justify-center",
323
+ (l || c) && "ral-nav-active"
324
+ ), p = /* @__PURE__ */ u($, { children: [
325
+ y && /* @__PURE__ */ a(
326
+ y,
192
327
  {
193
- className: u("h-[18px] w-[18px] shrink-0", c || b ? "text-white" : ""),
328
+ className: "h-[18px] w-[18px] shrink-0",
194
329
  "aria-hidden": !0
195
330
  }
196
331
  ),
197
- !t && /* @__PURE__ */ o(A, { children: [
198
- /* @__PURE__ */ n("span", { className: "flex-1 truncate text-left", children: e.label }),
199
- e.badge != null && /* @__PURE__ */ n(
332
+ r && !y && /* @__PURE__ */ a("span", { "aria-hidden": !0, children: e.label.charAt(0) }),
333
+ r && /* @__PURE__ */ a("span", { className: "sr-only", children: e.label }),
334
+ !r && /* @__PURE__ */ u($, { children: [
335
+ /* @__PURE__ */ a("span", { className: "flex-1 truncate text-left", children: e.label }),
336
+ e.badge != null && /* @__PURE__ */ a(
200
337
  "span",
201
338
  {
202
- className: u(
203
- "rounded-full px-2 py-0.5 text-[11px] font-semibold",
204
- c ? "bg-white/20 text-white" : "bg-admin-primary/10 text-admin-primary"
339
+ className: b(
340
+ "ral-nav-badge rounded-full px-2 py-0.5 text-[11px] font-semibold"
205
341
  ),
206
342
  children: e.badge
207
343
  }
208
344
  ),
209
- d && /* @__PURE__ */ n(
210
- H,
345
+ d && /* @__PURE__ */ a(
346
+ Z,
211
347
  {
212
- className: u("h-4 w-4 shrink-0 transition-transform", f && "rotate-180"),
348
+ className: b("h-4 w-4 shrink-0 transition-transform", x && "rotate-180"),
213
349
  "aria-hidden": !0
214
350
  }
215
351
  )
216
352
  ] })
217
353
  ] }), N = () => {
218
- if (d) {
219
- v((g) => !g);
220
- return;
354
+ if (!e.disabled) {
355
+ if (d) {
356
+ w((f) => !f);
357
+ return;
358
+ }
359
+ e.path && (o == null || o(e.path), i == null || i());
221
360
  }
222
- e.path && (s == null || s(e.path), i == null || i());
223
- }, C = e.path && !d && l ? /* @__PURE__ */ n(
224
- l,
361
+ }, S = e.path && !d && s && !e.disabled ? /* @__PURE__ */ a(
362
+ s,
225
363
  {
226
364
  to: e.path,
227
365
  className: m,
228
- onClick: () => {
229
- i == null || i();
230
- },
366
+ onClick: N,
231
367
  children: p
232
368
  }
233
- ) : /* @__PURE__ */ n("button", { type: "button", className: m, onClick: N, disabled: e.disabled, children: p });
234
- return /* @__PURE__ */ o("li", { children: [
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(
237
- R,
369
+ ) : /* @__PURE__ */ a(
370
+ "button",
371
+ {
372
+ type: "button",
373
+ className: m,
374
+ onClick: N,
375
+ disabled: e.disabled,
376
+ "data-active": l || c,
377
+ "aria-label": r ? e.label : void 0,
378
+ title: r ? e.label : void 0,
379
+ "aria-expanded": d ? !!x : void 0,
380
+ "aria-current": l && !d ? "page" : void 0,
381
+ children: p
382
+ }
383
+ );
384
+ return /* @__PURE__ */ u("li", { "data-active": l || c, "aria-label": r ? e.label : void 0, children: [
385
+ S,
386
+ d && x && /* @__PURE__ */ a("ul", { className: b("mt-1 space-y-0.5", !r && "border-l border-admin-border ml-5 pl-2"), children: e.children.map((f) => /* @__PURE__ */ a(
387
+ V,
238
388
  {
239
- item: g,
240
- collapsed: t,
241
- depth: a + 1,
242
- activePath: r,
243
- onNavigate: s,
244
- LinkComponent: l,
389
+ item: f,
390
+ collapsed: r,
391
+ depth: n + 1,
392
+ activePath: t,
393
+ onNavigate: o,
394
+ LinkComponent: s,
245
395
  onItemClick: i
246
396
  },
247
- g.label + (g.path ?? "")
397
+ f.label + (f.path ?? "")
248
398
  )) })
249
399
  ] });
250
400
  }
251
- function ye({
401
+ function qe({
252
402
  items: e,
253
- appName: t = "Admin",
254
- appLogo: a,
255
- onNavigate: r,
256
- activePath: s,
257
- LinkComponent: l
403
+ appName: r = "Admin",
404
+ appLogo: n,
405
+ onNavigate: t,
406
+ activePath: o,
407
+ LinkComponent: s
258
408
  }) {
259
- const { mobileOpen: i, closeMobile: d } = O(), { permissions: c, activePath: b } = k(), f = s ?? b, v = D(e, c);
260
- if (M(() => {
409
+ const { mobileOpen: i, closeMobile: d } = F(), { permissions: l, activePath: c } = O(), x = o ?? c, w = K(e, l), y = H(null);
410
+ if (E(() => {
411
+ var k, P, L, T;
261
412
  if (!i) return;
262
- const m = (p) => {
263
- p.key === "Escape" && d();
413
+ const p = document.activeElement, N = document.body.style.overflow, S = () => {
414
+ var g;
415
+ return Array.from(((g = y.current) == null ? void 0 : g.querySelectorAll(
416
+ 'button:not(:disabled), a[href], input, [tabindex="0"]'
417
+ )) ?? []).filter((M) => M.getClientRects().length > 0);
418
+ };
419
+ (P = (k = y.current) == null ? void 0 : k.querySelector('[aria-label="Close sidebar"]')) == null || P.focus();
420
+ const v = (g) => {
421
+ if (g.key === "Escape" && d(), g.key === "Tab") {
422
+ const M = S(), B = M[0], j = M[M.length - 1];
423
+ g.shiftKey && document.activeElement === B ? (g.preventDefault(), j == null || j.focus()) : !g.shiftKey && document.activeElement === j && (g.preventDefault(), B == null || B.focus());
424
+ }
425
+ }, f = (L = window.matchMedia) == null ? void 0 : L.call(window, "(min-width: 1024px)"), D = () => {
426
+ f != null && f.matches && d();
264
427
  };
265
- return document.addEventListener("keydown", m), document.body.style.overflow = "hidden", () => {
266
- document.removeEventListener("keydown", m), document.body.style.overflow = "";
428
+ return (T = f == null ? void 0 : f.addEventListener) == null || T.call(f, "change", D), document.addEventListener("keydown", v), document.body.style.overflow = "hidden", () => {
429
+ var g;
430
+ document.removeEventListener("keydown", v), (g = f == null ? void 0 : f.removeEventListener) == null || g.call(f, "change", D), document.body.style.overflow = N, p == null || p.focus();
267
431
  };
268
432
  }, [i, d]), !i) return null;
269
- const h = (m) => {
270
- r == null || r(m), d();
433
+ const m = (p) => {
434
+ t == null || t(p), d();
271
435
  };
272
- return /* @__PURE__ */ o("div", { className: "fixed inset-0 z-50 lg:hidden", role: "dialog", "aria-modal": "true", children: [
273
- /* @__PURE__ */ n(
436
+ return /* @__PURE__ */ u("div", { ref: y, className: "fixed inset-0 z-50 lg:hidden", role: "dialog", "aria-modal": "true", "aria-label": "Navigation menu", children: [
437
+ /* @__PURE__ */ a(
274
438
  "button",
275
439
  {
276
440
  type: "button",
277
- className: "absolute inset-0 bg-slate-900/50 backdrop-blur-sm animate-fade-in",
441
+ className: "ral-overlay absolute inset-0 backdrop-blur-sm animate-fade-in",
278
442
  "aria-label": "Close menu",
279
443
  onClick: d
280
444
  }
281
445
  ),
282
- /* @__PURE__ */ o(
446
+ /* @__PURE__ */ u(
283
447
  "aside",
284
448
  {
285
- className: u(
286
- "absolute left-0 top-0 flex h-full w-[min(280px,85vw)] flex-col",
287
- "border-r border-admin-border bg-admin-surface shadow-admin-lg animate-slide-in"
449
+ className: b(
450
+ "ral-sidebar absolute left-0 top-0 flex h-full w-[min(var(--ral-sidebar-width),85vw)] flex-col",
451
+ "border-r border-admin-border shadow-admin-lg animate-slide-in"
288
452
  ),
289
453
  children: [
290
- /* @__PURE__ */ o("div", { className: "flex h-16 items-center justify-between border-b border-admin-border px-4", children: [
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) }),
293
- /* @__PURE__ */ n("span", { className: "font-semibold text-admin-text", children: t })
454
+ /* @__PURE__ */ u("div", { className: "ral-sidebar-top flex items-center justify-between border-b border-admin-border px-4", children: [
455
+ /* @__PURE__ */ u("div", { className: "flex items-center gap-3", children: [
456
+ n ?? /* @__PURE__ */ a("div", { className: "flex h-9 w-9 items-center justify-center rounded-admin bg-admin-primary text-sm font-bold text-admin-on-primary", children: r.charAt(0) }),
457
+ /* @__PURE__ */ a("span", { className: "ral-sidebar-brand font-semibold", children: r })
294
458
  ] }),
295
- /* @__PURE__ */ n(
459
+ /* @__PURE__ */ a(
296
460
  "button",
297
461
  {
298
462
  type: "button",
299
463
  onClick: d,
300
- className: "rounded-lg p-2 text-admin-muted hover:bg-admin-bg",
464
+ className: "rounded-admin p-2 text-admin-muted hover:bg-admin-hover",
301
465
  "aria-label": "Close sidebar",
302
- children: /* @__PURE__ */ n(te, { className: "h-5 w-5" })
466
+ children: /* @__PURE__ */ a(me, { className: "h-5 w-5" })
303
467
  }
304
468
  )
305
469
  ] }),
306
- /* @__PURE__ */ n("nav", { className: "flex-1 overflow-y-auto p-3", children: /* @__PURE__ */ n(X, { children: v.map((m) => /* @__PURE__ */ n(
307
- R,
470
+ /* @__PURE__ */ a("nav", { className: "flex-1 overflow-y-auto p-3", children: /* @__PURE__ */ a(oe, { children: w.map((p) => /* @__PURE__ */ a(
471
+ V,
308
472
  {
309
- item: m,
310
- activePath: f,
311
- onNavigate: h,
312
- LinkComponent: l,
473
+ item: p,
474
+ activePath: x,
475
+ onNavigate: m,
476
+ LinkComponent: s,
313
477
  onItemClick: d
314
478
  },
315
- m.label + (m.path ?? "")
479
+ p.label + (p.path ?? "")
316
480
  )) }) })
317
481
  ]
318
482
  }
319
483
  )
320
484
  ] });
321
485
  }
322
- function we({
486
+ function ze({
323
487
  items: e,
324
- className: t,
325
- LinkComponent: a,
326
- onNavigate: r
488
+ className: r,
489
+ LinkComponent: n,
490
+ onNavigate: t
327
491
  }) {
328
492
  if (!e.length) return null;
329
- const s = (l, i) => {
330
- const d = u(
493
+ const o = (s, i) => {
494
+ const d = b(
331
495
  "text-sm transition-colors",
332
- i ? "font-medium text-admin-text" : "text-admin-muted hover:text-admin-text"
496
+ i ? "font-medium text-admin-text" : "text-admin-muted hover:text-admin-hover-text"
333
497
  );
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 });
498
+ return !s.path || i ? /* @__PURE__ */ a("span", { className: d, children: s.label }) : n ? /* @__PURE__ */ a(n, { to: s.path, className: d, children: s.label }) : /* @__PURE__ */ a("button", { type: "button", className: d, onClick: () => t == null ? void 0 : t(s.path), children: s.label });
335
499
  };
336
- return /* @__PURE__ */ o("nav", { "aria-label": "Breadcrumb", className: u("flex items-center gap-1.5", t), children: [
337
- /* @__PURE__ */ n(ne, { className: "h-4 w-4 text-admin-muted shrink-0", "aria-hidden": !0 }),
338
- e.map((l, i) => {
500
+ return /* @__PURE__ */ u("nav", { "aria-label": "Breadcrumb", className: b("flex items-center gap-1.5", r), children: [
501
+ /* @__PURE__ */ a(fe, { className: "h-4 w-4 text-admin-muted shrink-0", "aria-hidden": !0 }),
502
+ e.map((s, i) => {
339
503
  const d = i === e.length - 1;
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}`);
504
+ return /* @__PURE__ */ u("span", { className: "flex items-center gap-1.5", children: [
505
+ /* @__PURE__ */ a(be, { className: "h-3.5 w-3.5 text-admin-muted", "aria-hidden": !0 }),
506
+ o(s, d)
507
+ ] }, `${s.label}-${i}`);
344
508
  })
345
509
  ] });
346
510
  }
347
- function Ne({
511
+ function Re({
348
512
  placeholder: e = "Search...",
349
- onSearch: t,
350
- className: a
513
+ onSearch: r,
514
+ className: n
351
515
  }) {
352
- const [r, s] = w("");
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: [
356
- /* @__PURE__ */ n(
357
- re,
516
+ const [t, o] = C("");
517
+ return /* @__PURE__ */ u("form", { onSubmit: (i) => {
518
+ i.preventDefault(), r == null || r(t.trim());
519
+ }, className: b("relative w-full max-w-md", n), children: [
520
+ /* @__PURE__ */ a(
521
+ he,
358
522
  {
359
523
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-admin-muted",
360
524
  "aria-hidden": !0
361
525
  }
362
526
  ),
363
- /* @__PURE__ */ n(
527
+ /* @__PURE__ */ a(
364
528
  "input",
365
529
  {
366
530
  type: "search",
367
- value: r,
368
- onChange: (i) => s(i.target.value),
531
+ value: t,
532
+ onChange: (i) => o(i.target.value),
369
533
  placeholder: e,
370
- className: u(
371
- "h-10 w-full rounded-xl border border-admin-border bg-admin-bg pl-10 pr-4 text-sm text-admin-text",
372
- "placeholder:text-admin-muted focus:border-admin-primary focus:outline-none focus:ring-2 focus:ring-admin-primary/20"
534
+ className: b(
535
+ "h-10 w-full rounded-admin border border-admin-border bg-admin-bg pl-10 pr-4 text-sm text-admin-text",
536
+ "placeholder:text-admin-muted focus:border-admin-primary focus:outline-none focus:ring-2 focus:ring-admin-primary"
373
537
  ),
374
538
  "aria-label": "Search"
375
539
  }
376
540
  )
377
541
  ] });
378
542
  }
379
- function ke({ notifications: e = [], className: t }) {
380
- const [a, r] = w(!1), s = T(null), l = e.filter((i) => !i.read).length;
381
- return M(() => {
543
+ function Ue({ notifications: e = [], className: r }) {
544
+ const [n, t] = C(!1), o = H(null), s = e.filter((i) => !i.read).length;
545
+ return E(() => {
382
546
  const i = (d) => {
383
- s.current && !s.current.contains(d.target) && r(!1);
547
+ o.current && !o.current.contains(d.target) && t(!1);
384
548
  };
385
549
  return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
386
- }, []), /* @__PURE__ */ o("div", { ref: s, className: u("relative", t), children: [
387
- /* @__PURE__ */ o(
550
+ }, []), /* @__PURE__ */ u("div", { ref: o, className: b("relative", r), onKeyDown: (i) => {
551
+ var d, l;
552
+ i.key === "Escape" && (t(!1), (l = (d = o.current) == null ? void 0 : d.querySelector("button")) == null || l.focus());
553
+ }, children: [
554
+ /* @__PURE__ */ u(
388
555
  "button",
389
556
  {
390
557
  type: "button",
391
- onClick: () => r((i) => !i),
392
- className: u(
393
- "relative inline-flex h-9 w-9 items-center justify-center rounded-lg border border-admin-border",
394
- "bg-admin-surface text-admin-muted transition-colors hover:bg-admin-bg hover:text-admin-text",
558
+ onClick: () => t((i) => !i),
559
+ className: b(
560
+ "relative inline-flex h-9 w-9 items-center justify-center rounded-admin border border-admin-border",
561
+ "bg-admin-surface text-admin-muted transition-colors hover:bg-admin-hover hover:text-admin-hover-text",
395
562
  "focus-visible:ring-2 focus-visible:ring-admin-primary"
396
563
  ),
397
- "aria-label": `Notifications${l ? `, ${l} unread` : ""}`,
398
- "aria-expanded": a,
564
+ "aria-label": `Notifications${s ? `, ${s} unread` : ""}`,
565
+ "aria-expanded": n,
399
566
  children: [
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 })
567
+ /* @__PURE__ */ a(pe, { className: "h-4 w-4", "aria-hidden": !0 }),
568
+ s > 0 && /* @__PURE__ */ a("span", { className: "absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-admin-danger px-1 text-[10px] font-bold text-admin-on-danger", children: s > 9 ? "9+" : s })
402
569
  ]
403
570
  }
404
571
  ),
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: [
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
- /* @__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(
572
+ n && /* @__PURE__ */ u("div", { className: "absolute right-0 top-full z-50 mt-2 w-80 max-w-[calc(100vw-6rem)] rounded-admin border border-admin-border bg-admin-surface shadow-admin-lg animate-fade-in", children: [
573
+ /* @__PURE__ */ a("div", { className: "border-b border-admin-border px-4 py-3", children: /* @__PURE__ */ a("p", { className: "text-sm font-semibold text-admin-text", children: "Notifications" }) }),
574
+ /* @__PURE__ */ a("ul", { className: "max-h-72 overflow-y-auto p-2", children: e.length === 0 ? /* @__PURE__ */ a("li", { className: "px-3 py-6 text-center text-sm text-admin-muted", children: "No notifications" }) : e.map((i) => /* @__PURE__ */ u(
408
575
  "li",
409
576
  {
410
- className: u(
411
- "rounded-lg px-3 py-2.5 transition-colors hover:bg-admin-bg",
412
- !i.read && "bg-admin-primary/5"
577
+ className: b(
578
+ "rounded-admin px-3 py-2.5 transition-colors hover:bg-admin-hover",
579
+ !i.read && "ral-unread"
413
580
  ),
414
581
  children: [
415
- /* @__PURE__ */ n("p", { className: "text-sm font-medium text-admin-text", children: i.title }),
416
- i.description && /* @__PURE__ */ n("p", { className: "mt-0.5 text-xs text-admin-muted line-clamp-2", children: i.description }),
417
- i.time && /* @__PURE__ */ n("p", { className: "mt-1 text-[11px] text-admin-muted", children: i.time })
582
+ /* @__PURE__ */ a("p", { className: "text-sm font-medium text-admin-text", children: i.title }),
583
+ i.description && /* @__PURE__ */ a("p", { className: "mt-0.5 text-xs text-admin-muted line-clamp-2", children: i.description }),
584
+ i.time && /* @__PURE__ */ a("p", { className: "mt-1 text-[11px] text-admin-muted", children: i.time })
418
585
  ]
419
586
  },
420
587
  i.id
@@ -422,108 +589,123 @@ function ke({ notifications: e = [], className: t }) {
422
589
  ] })
423
590
  ] });
424
591
  }
425
- function Ce() {
426
- const { darkMode: e, toggleDarkMode: t, setDarkMode: a } = k();
592
+ function $e() {
593
+ const { darkMode: e, toggleDarkMode: r, setDarkMode: n } = O();
427
594
  return {
428
595
  isDark: e,
429
- toggle: t,
430
- setDarkMode: a
596
+ toggle: r,
597
+ setDarkMode: n
431
598
  };
432
599
  }
433
- function Se({ className: e }) {
434
- const { isDark: t, toggle: a } = Ce();
435
- return /* @__PURE__ */ n(
600
+ function He({ className: e }) {
601
+ const { isDark: r, toggle: n } = $e();
602
+ return /* @__PURE__ */ a(
436
603
  "button",
437
604
  {
438
605
  type: "button",
439
- onClick: a,
440
- className: u(
441
- "inline-flex h-9 w-9 items-center justify-center rounded-lg border border-admin-border",
442
- "bg-admin-surface text-admin-muted transition-colors hover:bg-admin-bg hover:text-admin-text",
606
+ onClick: n,
607
+ className: b(
608
+ "inline-flex h-9 w-9 items-center justify-center rounded-admin border border-admin-border",
609
+ "bg-admin-surface text-admin-muted transition-colors hover:bg-admin-hover hover:text-admin-hover-text",
443
610
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-admin-primary focus-visible:ring-offset-2",
444
611
  e
445
612
  ),
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 })
613
+ "aria-label": r ? "Switch to light mode" : "Switch to dark mode",
614
+ children: r ? /* @__PURE__ */ a(xe, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ a(ve, { className: "h-4 w-4", "aria-hidden": !0 })
448
615
  }
449
616
  );
450
617
  }
451
- function Me({ user: e, onLogout: t, onSettings: a, className: r }) {
452
- const [s, l] = w(!1), i = T(null);
453
- M(() => {
454
- const c = (b) => {
455
- i.current && !i.current.contains(b.target) && l(!1);
618
+ function Fe({ user: e, onLogout: r, onSettings: n, className: t }) {
619
+ const [o, s] = C(!1), i = H(null);
620
+ E(() => {
621
+ const l = (c) => {
622
+ i.current && !i.current.contains(c.target) && s(!1);
456
623
  };
457
- return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
458
- }, []);
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: [
461
- /* @__PURE__ */ o(
624
+ return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
625
+ }, []), E(() => {
626
+ var l, c;
627
+ o && ((c = (l = i.current) == null ? void 0 : l.querySelector('[role="menuitem"]')) == null || c.focus());
628
+ }, [o]);
629
+ const d = e.name.split(" ").map((l) => l[0]).join("").slice(0, 2).toUpperCase();
630
+ return /* @__PURE__ */ u("div", { ref: i, className: b("relative", t), onKeyDown: (l) => {
631
+ var x, w, y;
632
+ const c = (x = i.current) == null ? void 0 : x.querySelector("[aria-haspopup]");
633
+ if (l.key === "Escape" && o && (l.preventDefault(), s(!1), c == null || c.focus()), l.key === "Tab" && s(!1), ["ArrowDown", "ArrowUp", "Home", "End"].includes(l.key)) {
634
+ if (l.preventDefault(), !o) {
635
+ s(!0);
636
+ return;
637
+ }
638
+ const m = Array.from(((w = i.current) == null ? void 0 : w.querySelectorAll('[role="menuitem"]')) ?? []), p = m.indexOf(document.activeElement), N = l.key === "Home" ? 0 : l.key === "End" ? m.length - 1 : (p + (l.key === "ArrowDown" ? 1 : -1) + m.length) % m.length;
639
+ (y = m[N]) == null || y.focus();
640
+ }
641
+ }, children: [
642
+ /* @__PURE__ */ u(
462
643
  "button",
463
644
  {
464
645
  type: "button",
465
- onClick: () => l((c) => !c),
466
- className: u(
467
- "flex items-center gap-2 rounded-xl border border-admin-border bg-admin-surface px-2 py-1.5",
468
- "transition-colors hover:bg-admin-bg focus-visible:ring-2 focus-visible:ring-admin-primary"
646
+ onClick: () => s((l) => !l),
647
+ className: b(
648
+ "flex items-center gap-2 rounded-admin border border-admin-border bg-admin-surface px-2 py-1.5",
649
+ "transition-colors hover:bg-admin-hover focus-visible:ring-2 focus-visible:ring-admin-primary"
469
650
  ),
470
- "aria-expanded": s,
651
+ "aria-expanded": o,
471
652
  "aria-haspopup": "menu",
653
+ "aria-label": `User menu for ${e.name}`,
472
654
  children: [
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 }),
474
- /* @__PURE__ */ o("div", { className: "hidden text-left sm:block", children: [
475
- /* @__PURE__ */ n("p", { className: "text-sm font-medium text-admin-text leading-tight", children: e.name }),
476
- /* @__PURE__ */ n("p", { className: "text-xs text-admin-muted leading-tight", children: e.email })
655
+ e.avatar ? /* @__PURE__ */ a("img", { src: e.avatar, alt: "", className: "h-8 w-8 rounded-admin object-cover" }) : /* @__PURE__ */ a("div", { className: "flex h-8 w-8 items-center justify-center rounded-admin bg-admin-primary text-xs font-semibold text-admin-on-primary", children: d }),
656
+ /* @__PURE__ */ u("div", { className: "hidden text-left sm:block", children: [
657
+ /* @__PURE__ */ a("p", { className: "text-sm font-medium text-admin-text leading-tight", children: e.name }),
658
+ /* @__PURE__ */ a("p", { className: "text-xs text-admin-muted leading-tight", children: e.email })
477
659
  ] }),
478
- /* @__PURE__ */ n(H, { className: "hidden h-4 w-4 text-admin-muted sm:block", "aria-hidden": !0 })
660
+ /* @__PURE__ */ a(Z, { className: "hidden h-4 w-4 text-admin-muted sm:block", "aria-hidden": !0 })
479
661
  ]
480
662
  }
481
663
  ),
482
- s && /* @__PURE__ */ o(
664
+ o && /* @__PURE__ */ u(
483
665
  "div",
484
666
  {
485
667
  role: "menu",
486
- className: "absolute right-0 top-full z-50 mt-2 w-56 rounded-xl border border-admin-border bg-admin-surface p-1.5 shadow-admin-lg animate-fade-in",
668
+ className: "absolute right-0 top-full z-50 mt-2 w-56 rounded-admin border border-admin-border bg-admin-surface p-1.5 shadow-admin-lg animate-fade-in",
487
669
  children: [
488
- /* @__PURE__ */ o(
670
+ /* @__PURE__ */ u(
489
671
  "button",
490
672
  {
491
673
  type: "button",
492
674
  role: "menuitem",
493
- className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-admin-text hover:bg-admin-bg",
675
+ className: "flex w-full items-center gap-2 rounded-admin px-3 py-2 text-sm text-admin-text hover:bg-admin-hover",
494
676
  onClick: () => {
495
- a == null || a(), l(!1);
677
+ n == null || n(), s(!1);
496
678
  },
497
679
  children: [
498
- /* @__PURE__ */ n(de, { className: "h-4 w-4 text-admin-muted" }),
680
+ /* @__PURE__ */ a(ye, { className: "h-4 w-4 text-admin-muted" }),
499
681
  "Settings"
500
682
  ]
501
683
  }
502
684
  ),
503
- /* @__PURE__ */ o(
685
+ /* @__PURE__ */ u(
504
686
  "button",
505
687
  {
506
688
  type: "button",
507
689
  role: "menuitem",
508
- className: "flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-admin-text hover:bg-admin-bg",
690
+ className: "flex w-full items-center gap-2 rounded-admin px-3 py-2 text-sm text-admin-text hover:bg-admin-hover",
509
691
  children: [
510
- /* @__PURE__ */ n(oe, { className: "h-4 w-4 text-admin-muted" }),
692
+ /* @__PURE__ */ a(ge, { className: "h-4 w-4 text-admin-muted" }),
511
693
  "Profile"
512
694
  ]
513
695
  }
514
696
  ),
515
- /* @__PURE__ */ n("hr", { className: "my-1 border-admin-border" }),
516
- /* @__PURE__ */ o(
697
+ /* @__PURE__ */ a("hr", { className: "my-1 border-admin-border" }),
698
+ /* @__PURE__ */ u(
517
699
  "button",
518
700
  {
519
701
  type: "button",
520
702
  role: "menuitem",
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",
703
+ className: "flex w-full items-center gap-2 rounded-admin px-3 py-2 text-sm ral-danger",
522
704
  onClick: () => {
523
- t == null || t(), l(!1);
705
+ r == null || r(), s(!1);
524
706
  },
525
707
  children: [
526
- /* @__PURE__ */ n(ce, { className: "h-4 w-4" }),
708
+ /* @__PURE__ */ a(we, { className: "h-4 w-4" }),
527
709
  "Log out"
528
710
  ]
529
711
  }
@@ -533,272 +715,292 @@ function Me({ user: e, onLogout: t, onSettings: a, className: r }) {
533
715
  )
534
716
  ] });
535
717
  }
536
- function Pe({
718
+ function Je({
537
719
  user: e,
538
- notifications: t = [],
539
- onSearch: a,
540
- searchPlaceholder: r = "Search...",
541
- showSearch: s = !0,
542
- className: l,
720
+ notifications: r = [],
721
+ onSearch: n,
722
+ searchPlaceholder: t = "Search...",
723
+ showSearch: o = !0,
724
+ className: s,
543
725
  breadcrumbs: i = [],
544
726
  onMenuClick: d,
545
- sidebarCollapsed: c,
546
- onToggleSidebar: b
727
+ sidebarCollapsed: l,
728
+ onToggleSidebar: c
547
729
  }) {
548
- return /* @__PURE__ */ o(
730
+ return /* @__PURE__ */ u(
549
731
  "header",
550
732
  {
551
- className: u(
552
- "sticky top-0 z-40 flex h-16 shrink-0 items-center gap-4 border-b border-admin-border",
553
- "admin-glass bg-admin-surface px-4 lg:px-6",
554
- l
733
+ className: b(
734
+ "ral-header sticky top-0 z-40 flex shrink-0 items-center gap-4 border-b border-admin-border",
735
+ s
555
736
  ),
556
737
  children: [
557
- /* @__PURE__ */ n(
738
+ /* @__PURE__ */ a(
558
739
  "button",
559
740
  {
560
741
  type: "button",
561
- className: "rounded-lg p-2 text-admin-muted hover:bg-admin-bg lg:hidden",
742
+ className: "rounded-admin p-2 text-admin-muted hover:bg-admin-hover lg:hidden",
562
743
  onClick: d,
563
744
  "aria-label": "Open menu",
564
- children: /* @__PURE__ */ n(me, { className: "h-5 w-5" })
745
+ children: /* @__PURE__ */ a(Ne, { className: "h-5 w-5" })
565
746
  }
566
747
  ),
567
- /* @__PURE__ */ n(
748
+ /* @__PURE__ */ a(
568
749
  "button",
569
750
  {
570
751
  type: "button",
571
- className: "hidden rounded-lg p-2 text-admin-muted hover:bg-admin-bg lg:inline-flex",
572
- onClick: b,
573
- "aria-label": c ? "Expand sidebar" : "Collapse sidebar",
574
- children: c ? /* @__PURE__ */ n(J, { className: "h-5 w-5" }) : /* @__PURE__ */ n(G, { className: "h-5 w-5" })
752
+ className: "hidden rounded-admin p-2 text-admin-muted hover:bg-admin-hover lg:inline-flex",
753
+ onClick: c,
754
+ "aria-label": l ? "Expand sidebar" : "Collapse sidebar",
755
+ children: l ? /* @__PURE__ */ a(ee, { className: "h-5 w-5" }) : /* @__PURE__ */ a(re, { className: "h-5 w-5" })
575
756
  }
576
757
  ),
577
- /* @__PURE__ */ n("div", { className: "hidden min-w-0 flex-1 md:block", children: /* @__PURE__ */ n(we, { items: i }) }),
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 }) }),
580
- /* @__PURE__ */ n(Se, {}),
581
- /* @__PURE__ */ n(ke, { notifications: t }),
582
- e && /* @__PURE__ */ n(Me, { user: e })
758
+ /* @__PURE__ */ a("div", { className: "hidden min-w-0 flex-1 md:block", children: /* @__PURE__ */ a(ze, { items: i }) }),
759
+ /* @__PURE__ */ u("div", { className: "flex flex-1 items-center justify-end gap-2 sm:gap-3", children: [
760
+ o && /* @__PURE__ */ a("div", { className: "hidden flex-1 sm:flex sm:max-w-md", children: /* @__PURE__ */ a(Re, { placeholder: t, onSearch: n }) }),
761
+ /* @__PURE__ */ a(He, {}),
762
+ /* @__PURE__ */ a(Ue, { notifications: r }),
763
+ e && /* @__PURE__ */ a(Fe, { user: e })
583
764
  ] })
584
765
  ]
585
766
  }
586
767
  );
587
768
  }
588
- function Le({
769
+ function Ke({
589
770
  items: e,
590
- collapsed: t,
591
- appName: a = "Admin",
592
- appLogo: r,
593
- className: s,
594
- onNavigate: l,
771
+ collapsed: r,
772
+ appName: n = "Admin",
773
+ appLogo: t,
774
+ className: o,
775
+ onNavigate: s,
595
776
  activePath: i,
596
777
  LinkComponent: d
597
778
  }) {
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();
779
+ const { collapsed: l, toggle: c, closeMobile: x } = F(), { permissions: w, activePath: y } = O(), m = r ?? l, p = i ?? y, N = K(e, w), S = (v) => {
780
+ s == null || s(v), x();
600
781
  };
601
- return /* @__PURE__ */ o(
782
+ return /* @__PURE__ */ u(
602
783
  "aside",
603
784
  {
604
- className: u(
605
- "hidden lg:flex flex-col border-r border-admin-border bg-admin-surface transition-all duration-300 ease-in-out",
785
+ className: b(
786
+ "ral-sidebar hidden lg:flex shrink-0 flex-col border-r border-admin-border",
787
+ "h-screen sticky top-0 transition-[width] duration-300 ease-in-out",
606
788
  m ? "w-[var(--admin-sidebar-collapsed)]" : "w-[var(--admin-sidebar-width)]",
607
- s
789
+ o
608
790
  ),
609
791
  "aria-label": "Sidebar navigation",
610
792
  children: [
611
- /* @__PURE__ */ o(
793
+ /* @__PURE__ */ u(
612
794
  "div",
613
795
  {
614
- className: u(
615
- "flex h-16 items-center border-b border-admin-border px-4",
796
+ className: b(
797
+ "ral-sidebar-top flex items-center border-b border-admin-border px-4",
616
798
  m ? "justify-center" : "justify-between gap-2"
617
799
  ),
618
800
  children: [
619
- /* @__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 })
801
+ /* @__PURE__ */ u("div", { className: b("flex items-center gap-3 min-w-0", m && "justify-center"), children: [
802
+ t ?? /* @__PURE__ */ a("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-admin bg-admin-primary text-sm font-bold text-admin-on-primary shadow-admin", children: n.charAt(0) }),
803
+ !m && /* @__PURE__ */ a("span", { className: "ral-sidebar-brand truncate text-base font-semibold", children: n })
622
804
  ] }),
623
- !m && /* @__PURE__ */ n(
805
+ !m && /* @__PURE__ */ a(
624
806
  "button",
625
807
  {
626
808
  type: "button",
627
- onClick: b,
628
- className: "rounded-lg p-2 text-admin-muted hover:bg-admin-bg hover:text-admin-text focus-visible:ring-2 focus-visible:ring-admin-primary",
809
+ onClick: c,
810
+ className: "rounded-admin p-2 text-admin-muted hover:bg-admin-hover hover:text-admin-hover-text focus-visible:ring-2 focus-visible:ring-admin-primary",
629
811
  "aria-label": "Collapse sidebar",
630
- children: /* @__PURE__ */ n(G, { className: "h-4 w-4" })
812
+ children: /* @__PURE__ */ a(re, { className: "h-4 w-4" })
631
813
  }
632
814
  )
633
815
  ]
634
816
  }
635
817
  ),
636
- m && /* @__PURE__ */ n("div", { className: "flex justify-center py-2 border-b border-admin-border", children: /* @__PURE__ */ n(
818
+ m && /* @__PURE__ */ a("div", { className: "flex justify-center py-2 border-b border-admin-border", children: /* @__PURE__ */ a(
637
819
  "button",
638
820
  {
639
821
  type: "button",
640
- onClick: b,
641
- className: "rounded-lg p-2 text-admin-muted hover:bg-admin-bg",
822
+ onClick: c,
823
+ className: "rounded-admin p-2 text-admin-muted hover:bg-admin-hover",
642
824
  "aria-label": "Expand sidebar",
643
- children: /* @__PURE__ */ n(J, { className: "h-4 w-4" })
825
+ children: /* @__PURE__ */ a(ee, { className: "h-4 w-4" })
644
826
  }
645
827
  ) }),
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
- R,
828
+ /* @__PURE__ */ a("nav", { className: "flex-1 overflow-y-auto p-3", children: /* @__PURE__ */ a(oe, { collapsed: m, children: N.map((v) => /* @__PURE__ */ a(
829
+ V,
648
830
  {
649
- item: x,
831
+ item: v,
650
832
  collapsed: m,
651
833
  activePath: p,
652
- onNavigate: C,
834
+ onNavigate: S,
653
835
  LinkComponent: d
654
836
  },
655
- x.label + (x.path ?? "")
837
+ v.label + (v.path ?? "")
656
838
  )) }) })
657
839
  ]
658
840
  }
659
841
  );
660
842
  }
661
- function F({
843
+ function X({
662
844
  children: e,
663
- sidebarItems: t,
664
- appName: a = "Admin",
665
- appLogo: r,
666
- user: s,
667
- notifications: l = [],
845
+ sidebarItems: r,
846
+ appName: n = "Admin",
847
+ appLogo: t,
848
+ user: o,
849
+ notifications: s = [],
668
850
  footer: i,
669
851
  showFooter: d = !0,
670
- showSearch: c = !0,
671
- searchPlaceholder: b,
672
- onSearch: f,
673
- breadcrumbs: v,
674
- contentClassName: h,
675
- activePath: m,
676
- onNavigate: p,
677
- LinkComponent: N,
678
- enableRouter: C = !1
852
+ showSearch: l = !0,
853
+ searchPlaceholder: c,
854
+ onSearch: x,
855
+ breadcrumbs: w,
856
+ contentClassName: y,
857
+ className: m,
858
+ activePath: p,
859
+ onNavigate: N,
860
+ LinkComponent: S,
861
+ enableRouter: v = !1
679
862
  }) {
680
863
  const {
681
- sidebarCollapsed: x,
682
- toggleSidebar: S,
683
- toggleMobile: g,
864
+ sidebarCollapsed: f,
865
+ toggleSidebar: D,
866
+ toggleMobile: k,
684
867
  breadcrumbs: P,
685
- setBreadcrumbs: B,
686
- activePath: y,
687
- setActivePath: Y
688
- } = k(), { closeMobile: _ } = O(), $ = m ?? y, K = v ?? P, q = (j) => {
689
- Y(j), v || B(E(j)), p == null || p(j), _();
868
+ setBreadcrumbs: L,
869
+ activePath: T,
870
+ setActivePath: g
871
+ } = O(), { closeMobile: M } = F(), { resolvedMode: B, style: j, colors: R } = Le(), q = p ?? T, U = w ?? P, h = (z) => {
872
+ g(z), w || L(J(z)), N == null || N(z), M();
690
873
  };
691
- 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
- /* @__PURE__ */ n(
704
- ye,
705
- {
706
- items: t,
707
- appName: a,
708
- appLogo: r,
709
- activePath: $,
710
- onNavigate: q,
711
- LinkComponent: N
712
- }
713
- ),
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: [
715
- /* @__PURE__ */ n(
716
- Pe,
717
- {
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
727
- }
728
- ),
729
- /* @__PURE__ */ n("main", { className: u("flex-1 p-4 lg:p-6", h), children: e }),
730
- d && /* @__PURE__ */ n(xe, { children: i })
731
- ] })
732
- ] });
874
+ return /* @__PURE__ */ u(
875
+ "div",
876
+ {
877
+ className: b("ral-layout admin-layout-root min-h-screen bg-admin-bg text-admin-text", B === "dark" && "dark", m),
878
+ "data-theme": B,
879
+ "data-style": j,
880
+ style: Ce({ colors: R }),
881
+ children: [
882
+ /* @__PURE__ */ a(
883
+ qe,
884
+ {
885
+ items: r,
886
+ appName: n,
887
+ appLogo: t,
888
+ activePath: q,
889
+ onNavigate: h,
890
+ LinkComponent: S
891
+ }
892
+ ),
893
+ /* @__PURE__ */ u("div", { className: "flex min-h-screen w-full", children: [
894
+ /* @__PURE__ */ a(
895
+ Ke,
896
+ {
897
+ items: r,
898
+ appName: n,
899
+ appLogo: t,
900
+ activePath: q,
901
+ onNavigate: h,
902
+ LinkComponent: S
903
+ }
904
+ ),
905
+ /* @__PURE__ */ u("div", { className: "flex min-h-screen min-w-0 flex-1 flex-col", children: [
906
+ /* @__PURE__ */ a(
907
+ Je,
908
+ {
909
+ user: o,
910
+ notifications: s,
911
+ onSearch: x,
912
+ searchPlaceholder: c,
913
+ showSearch: l,
914
+ breadcrumbs: U,
915
+ onMenuClick: k,
916
+ sidebarCollapsed: f,
917
+ onToggleSidebar: D
918
+ }
919
+ ),
920
+ /* @__PURE__ */ a("main", { className: b("ral-content flex-1", y), children: e }),
921
+ d && /* @__PURE__ */ a(Oe, { children: i })
922
+ ] })
923
+ ] })
924
+ ]
925
+ }
926
+ );
733
927
  }
734
- function De(e) {
928
+ function Ye(e) {
735
929
  const {
736
- storageKey: t = "rqdhw3n-admin-layout",
737
- defaultCollapsed: a = !1,
738
- initialDarkMode: r = !1,
739
- permissions: s = {},
740
- breadcrumbs: l = [],
930
+ storageKey: r = "rqdhw3n-admin-layout",
931
+ defaultCollapsed: n = !1,
932
+ initialDarkMode: t = !1,
933
+ permissions: o = {},
934
+ breadcrumbs: s = [],
741
935
  activePath: i = "/",
742
936
  enableRouter: d = !1,
743
- children: c,
744
- ...b
745
- } = e, f = U(
746
- () => l.length ? l : E(i),
747
- [l, i]
937
+ children: l,
938
+ ...c
939
+ } = e, x = I(
940
+ () => s.length ? s : J(i),
941
+ [s, i]
748
942
  );
749
- return /* @__PURE__ */ n(
750
- he,
943
+ return /* @__PURE__ */ a(
944
+ Ae,
751
945
  {
752
- storageKey: t,
753
- defaultCollapsed: a,
754
- permissions: s,
755
- initialBreadcrumbs: f,
946
+ storageKey: r,
947
+ defaultCollapsed: n,
948
+ permissions: o,
949
+ initialBreadcrumbs: x,
756
950
  initialActivePath: i,
757
- initialDarkMode: r,
758
- children: d ? /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(F, { ...b, enableRouter: d, children: c }) }) : /* @__PURE__ */ n(F, { ...b, enableRouter: d, children: c })
951
+ initialDarkMode: t,
952
+ theme: e.theme,
953
+ onThemeModeChange: e.onThemeModeChange,
954
+ children: d ? /* @__PURE__ */ a(Pe, { children: /* @__PURE__ */ a(X, { ...c, enableRouter: d, children: l }) }) : /* @__PURE__ */ a(X, { ...c, enableRouter: d, children: l })
759
955
  }
760
956
  );
761
957
  }
762
- function Re({ to: e, className: t, children: a, onClick: r }) {
763
- return /* @__PURE__ */ n(ee, { to: e, className: t, onClick: r, children: a });
958
+ function _e({ to: e, className: r, children: n, onClick: t }) {
959
+ return /* @__PURE__ */ a(ue, { to: e, className: r, onClick: t, children: n });
764
960
  }
765
- function $e() {
766
- return k();
961
+ function Ie() {
962
+ return O();
767
963
  }
768
- function qe() {
769
- const { breadcrumbs: e, setBreadcrumbs: t } = k(), a = L(
770
- (r) => t(r),
771
- [t]
964
+ function Ze() {
965
+ const { breadcrumbs: e, setBreadcrumbs: r } = O(), n = A(
966
+ (t) => r(t),
967
+ [r]
772
968
  );
773
969
  return {
774
970
  items: e,
775
- setBreadcrumbs: a
971
+ setBreadcrumbs: n
776
972
  };
777
973
  }
778
974
  export {
779
- De as AdminLayout,
780
- pe as AdminLayoutRouterSync,
781
- we as Breadcrumbs,
782
- xe as Footer,
783
- he as LayoutProvider,
784
- ye as MobileSidebar,
785
- Pe as Navbar,
786
- Ne as NavbarSearch,
787
- ke as NotificationMenu,
788
- Re as RouterLink,
789
- Le as Sidebar,
790
- X as SidebarGroup,
791
- R as SidebarItem,
792
- Se as ThemeToggle,
793
- Me as UserMenu,
794
- u as cn,
795
- D as filterSidebarByPermissions,
796
- E as generateBreadcrumbsFromPath,
797
- ve as hasPermission,
798
- qe as useBreadcrumbs,
799
- Ce as useDarkMode,
800
- k as useLayoutContext,
801
- $e as useLayoutState,
802
- O as useSidebar
975
+ Ye as AdminLayout,
976
+ Pe as AdminLayoutRouterSync,
977
+ ze as Breadcrumbs,
978
+ Oe as Footer,
979
+ Ae as LayoutProvider,
980
+ qe as MobileSidebar,
981
+ Je as Navbar,
982
+ Re as NavbarSearch,
983
+ Ue as NotificationMenu,
984
+ _e as RouterLink,
985
+ Ke as Sidebar,
986
+ oe as SidebarGroup,
987
+ V as SidebarItem,
988
+ He as ThemeToggle,
989
+ Fe as UserMenu,
990
+ Xe as adminLayoutPresets,
991
+ b as cn,
992
+ Se as darkThemeColors,
993
+ K as filterSidebarByPermissions,
994
+ J as generateBreadcrumbsFromPath,
995
+ Te as hasPermission,
996
+ te as lightThemeColors,
997
+ Me as resolveTheme,
998
+ Ce as themeToCSSVariables,
999
+ Le as useAdminLayoutTheme,
1000
+ Ze as useBreadcrumbs,
1001
+ $e as useDarkMode,
1002
+ O as useLayoutContext,
1003
+ Ie as useLayoutState,
1004
+ F as useSidebar
803
1005
  };
804
1006
  //# sourceMappingURL=index.js.map