@techzyapp/ui-library 1.0.16 → 1.0.17
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/{AdminRoot-DUjVN8lu.cjs → AdminRoot-D866Bc0e.cjs} +2 -2
- package/dist/{AdminRoot-DUjVN8lu.cjs.map → AdminRoot-D866Bc0e.cjs.map} +1 -1
- package/dist/{AdminRoot-CyBIrszf.js → AdminRoot-uVDhWjN8.js} +2 -2
- package/dist/{AdminRoot-CyBIrszf.js.map → AdminRoot-uVDhWjN8.js.map} +1 -1
- package/dist/{Breadcrumbs-DsKwFBH5.js → Breadcrumbs-C1crufqj.js} +2 -2
- package/dist/{Breadcrumbs-DsKwFBH5.js.map → Breadcrumbs-C1crufqj.js.map} +1 -1
- package/dist/{Breadcrumbs-jVOE_Pg8.cjs → Breadcrumbs-s90MO0PD.cjs} +2 -2
- package/dist/{Breadcrumbs-jVOE_Pg8.cjs.map → Breadcrumbs-s90MO0PD.cjs.map} +1 -1
- package/dist/{PageNotFound-BxABP8Nj.cjs → PageNotFound-D3ZjMKYD.cjs} +2 -2
- package/dist/{PageNotFound-BxABP8Nj.cjs.map → PageNotFound-D3ZjMKYD.cjs.map} +1 -1
- package/dist/{PageNotFound-CvWgniQM.js → PageNotFound-DVh_Tyqf.js} +2 -2
- package/dist/{PageNotFound-CvWgniQM.js.map → PageNotFound-DVh_Tyqf.js.map} +1 -1
- package/dist/{RootLayout-ILyExULV.js → RootLayout-BEOofnxb.js} +3 -3
- package/dist/{RootLayout-ILyExULV.js.map → RootLayout-BEOofnxb.js.map} +1 -1
- package/dist/{RootLayout-C4suUXSJ.cjs → RootLayout-DGYOCwOK.cjs} +2 -2
- package/dist/{RootLayout-C4suUXSJ.cjs.map → RootLayout-DGYOCwOK.cjs.map} +1 -1
- package/dist/Sidebar-BYqUTa8D.cjs +2 -0
- package/dist/Sidebar-BYqUTa8D.cjs.map +1 -0
- package/dist/{Sidebar-DTqvtqAI.js → Sidebar-D2RZH5m5.js} +69 -62
- package/dist/Sidebar-D2RZH5m5.js.map +1 -0
- package/dist/components/Breadcrumbs/index.cjs +1 -1
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/PageNotFound/index.cjs +1 -1
- package/dist/components/PageNotFound/index.js +1 -1
- package/dist/components/RootLayout/index.cjs +1 -1
- package/dist/components/RootLayout/index.js +1 -1
- package/dist/components/Sidebar/Sidebar.d.cts +11 -6
- package/dist/components/Sidebar/Sidebar.d.ts +11 -6
- package/dist/components/Sidebar/index.cjs +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/entries/app.cjs +1 -1
- package/dist/entries/app.js +1 -1
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/dist/Sidebar-DQov7G-T.cjs +0 -2
- package/dist/Sidebar-DQov7G-T.cjs.map +0 -1
- package/dist/Sidebar-DTqvtqAI.js.map +0 -1
|
@@ -3,12 +3,12 @@ import { useMemo as w, useState as D, useRef as V, useEffect as T } from "react"
|
|
|
3
3
|
import { Navigate as Y, useRouterState as S, Link as C, useNavigate as U, useRouter as E } from "@tanstack/react-router";
|
|
4
4
|
import { clsx as W } from "clsx";
|
|
5
5
|
import { I as A } from "./Icon-CophpkHo.js";
|
|
6
|
-
import { L } from "./List-LqbfF6gU.js";
|
|
6
|
+
import { L as y } from "./List-LqbfF6gU.js";
|
|
7
7
|
import { L as B } from "./ListItem-B4Upc0Hy.js";
|
|
8
8
|
import { T as q } from "./TextField-Bg4TwkVD.js";
|
|
9
9
|
import { u as H, h as G } from "./access-Db4knwyR.js";
|
|
10
10
|
import { a as Q } from "./ConfigProvider-BYruQYHC.js";
|
|
11
|
-
const X = "_nav_a1zzi_4", J = "_module_a1zzi_17", Z = "_search_a1zzi_25", ee = "_searchPanel_a1zzi_31", te = "_moduleLabel_a1zzi_46", oe = "_leaves_a1zzi_61", ne = "_navBadge_a1zzi_66", ae = "_navDot_a1zzi_78", se = "_leafDot_a1zzi_86", le = "_collapsible_a1zzi_95", ce = "_collapsibleClosed_a1zzi_100", re = "_collapsibleInner_a1zzi_103", ie = "_chevron_a1zzi_109", ue = "_chevronButton_a1zzi_119",
|
|
11
|
+
const X = "_nav_a1zzi_4", J = "_module_a1zzi_17", Z = "_search_a1zzi_25", ee = "_searchPanel_a1zzi_31", te = "_moduleLabel_a1zzi_46", oe = "_leaves_a1zzi_61", ne = "_navBadge_a1zzi_66", ae = "_navDot_a1zzi_78", se = "_leafDot_a1zzi_86", le = "_collapsible_a1zzi_95", ce = "_collapsibleClosed_a1zzi_100", re = "_collapsibleInner_a1zzi_103", ie = "_chevron_a1zzi_109", ue = "_chevronButton_a1zzi_119", h = {
|
|
12
12
|
nav: X,
|
|
13
13
|
module: J,
|
|
14
14
|
search: Z,
|
|
@@ -23,7 +23,7 @@ const X = "_nav_a1zzi_4", J = "_module_a1zzi_17", Z = "_search_a1zzi_25", ee = "
|
|
|
23
23
|
collapsibleInner: re,
|
|
24
24
|
chevron: ie,
|
|
25
25
|
chevronButton: ue
|
|
26
|
-
}, k = B, de = (e) => e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" "), F = (e) => e.replace(/^\/+|\/+$/g, ""),
|
|
26
|
+
}, k = B, de = (e) => e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" "), F = (e) => e.replace(/^\/+|\/+$/g, ""), L = (e) => e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, P = (e, n) => e.order - n.order || e.label.localeCompare(n.label);
|
|
27
27
|
function fe(e) {
|
|
28
28
|
const n = [];
|
|
29
29
|
for (const a of e) {
|
|
@@ -33,7 +33,7 @@ function fe(e) {
|
|
|
33
33
|
const o = new Map(n.map((a) => [a.path, a])), t = n.map((a) => a.path), l = (a) => t.some((c) => {
|
|
34
34
|
var s;
|
|
35
35
|
return c !== a && c.startsWith(`${a}/`) && !((s = o.get(c)) != null && s.sd.hidden);
|
|
36
|
-
}), u = new Set(e.map((a) => a.fullPath)), b = (a) => u.has(`/${a}/`),
|
|
36
|
+
}), u = new Set(e.map((a) => a.fullPath)), b = (a) => u.has(`/${a}/`), m = (a, c) => {
|
|
37
37
|
const s = o.get(a);
|
|
38
38
|
return {
|
|
39
39
|
label: (s == null ? void 0 : s.name) ?? de(c),
|
|
@@ -45,7 +45,7 @@ function fe(e) {
|
|
|
45
45
|
}, p = /* @__PURE__ */ new Map(), f = (a) => {
|
|
46
46
|
let c = p.get(a);
|
|
47
47
|
if (!c) {
|
|
48
|
-
const s =
|
|
48
|
+
const s = m(a, a);
|
|
49
49
|
c = { label: s.label, icon: s.icon, order: s.order, groups: /* @__PURE__ */ new Map() }, p.set(a, c);
|
|
50
50
|
}
|
|
51
51
|
return c;
|
|
@@ -80,7 +80,7 @@ function fe(e) {
|
|
|
80
80
|
const d = _.slice(0, 2).join("/");
|
|
81
81
|
let v = r.groups.get(d);
|
|
82
82
|
if (!v) {
|
|
83
|
-
const N =
|
|
83
|
+
const N = m(d, _[1]);
|
|
84
84
|
v = {
|
|
85
85
|
label: N.label,
|
|
86
86
|
icon: N.icon,
|
|
@@ -156,16 +156,16 @@ function O(e) {
|
|
|
156
156
|
if (l) return l.to;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function me() {
|
|
160
160
|
return O($());
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function he(e) {
|
|
163
163
|
var o;
|
|
164
164
|
const n = /* @__PURE__ */ new Map();
|
|
165
165
|
for (const t of e) {
|
|
166
166
|
const l = (o = t.staticData) == null ? void 0 : o.name;
|
|
167
167
|
if (!l) continue;
|
|
168
|
-
const u =
|
|
168
|
+
const u = L(t.fullPath);
|
|
169
169
|
n.has(u) || n.set(u, l);
|
|
170
170
|
}
|
|
171
171
|
return n;
|
|
@@ -183,7 +183,7 @@ function R(e, n) {
|
|
|
183
183
|
function j() {
|
|
184
184
|
const e = E();
|
|
185
185
|
return w(
|
|
186
|
-
() =>
|
|
186
|
+
() => he(
|
|
187
187
|
Object.values(e.looseRoutesById).map((n) => {
|
|
188
188
|
var o;
|
|
189
189
|
return {
|
|
@@ -195,21 +195,28 @@ function j() {
|
|
|
195
195
|
[e]
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
|
+
function be(e, n) {
|
|
199
|
+
if (e != null)
|
|
200
|
+
return typeof e == "function" ? e(n) : e;
|
|
201
|
+
}
|
|
198
202
|
function K() {
|
|
199
203
|
var n;
|
|
200
204
|
const e = S({ select: (o) => o.matches });
|
|
201
205
|
for (let o = e.length - 1; o >= 0; o--) {
|
|
202
|
-
const t = (
|
|
206
|
+
const t = be(
|
|
207
|
+
(n = e[o].staticData) == null ? void 0 : n.title,
|
|
208
|
+
e[o].params ?? {}
|
|
209
|
+
);
|
|
203
210
|
if (t) return t;
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
|
-
function
|
|
213
|
+
function Be() {
|
|
207
214
|
const e = K(), n = j(), o = S({ select: (l) => l.location.pathname });
|
|
208
|
-
if (e) return e;
|
|
215
|
+
if (e != null) return e;
|
|
209
216
|
const t = R(o, n);
|
|
210
217
|
return t.length > 0 ? t[t.length - 1].name : void 0;
|
|
211
218
|
}
|
|
212
|
-
function
|
|
219
|
+
function pe(e) {
|
|
213
220
|
const n = /* @__PURE__ */ new Set();
|
|
214
221
|
for (const o of e.links) n.add(o.to);
|
|
215
222
|
for (const o of e.modules)
|
|
@@ -219,29 +226,29 @@ function be(e) {
|
|
|
219
226
|
}
|
|
220
227
|
return n;
|
|
221
228
|
}
|
|
222
|
-
function
|
|
223
|
-
const { leafPath: o, leafTitle: t, navigable: l } = n, u = e.map(({ name: b, to:
|
|
229
|
+
function ve(e, n) {
|
|
230
|
+
const { leafPath: o, leafTitle: t, navigable: l } = n, u = e.map(({ name: b, to: m }) => ({
|
|
224
231
|
label: b,
|
|
225
|
-
to:
|
|
232
|
+
to: m !== o && l.has(m) ? m : void 0
|
|
226
233
|
}));
|
|
227
234
|
return t && (e.length > 0 && e[e.length - 1].to === o ? u[u.length - 1] = { label: t } : u.push({ label: t })), u;
|
|
228
235
|
}
|
|
229
|
-
function
|
|
230
|
-
const e = $(), n = j(), o = S({ select: (b) => b.location.pathname }), t = K(), l = O(e), u =
|
|
231
|
-
leafPath:
|
|
236
|
+
function Me() {
|
|
237
|
+
const e = $(), n = j(), o = S({ select: (b) => b.location.pathname }), t = K(), l = O(e), u = ve(R(o, n), {
|
|
238
|
+
leafPath: L(o),
|
|
232
239
|
leafTitle: t,
|
|
233
|
-
navigable:
|
|
240
|
+
navigable: pe(e)
|
|
234
241
|
});
|
|
235
242
|
return { homeTo: l, items: u };
|
|
236
243
|
}
|
|
237
|
-
function
|
|
238
|
-
const e =
|
|
244
|
+
function Ee() {
|
|
245
|
+
const e = me();
|
|
239
246
|
return e ? /* @__PURE__ */ i(Y, { to: e }) : null;
|
|
240
247
|
}
|
|
241
|
-
function
|
|
248
|
+
function Ae() {
|
|
242
249
|
const { links: e, modules: n } = $(), o = S({ select: (t) => t.location.pathname });
|
|
243
|
-
return /* @__PURE__ */ I("nav", { className:
|
|
244
|
-
e.length > 0 ? /* @__PURE__ */ i(
|
|
250
|
+
return /* @__PURE__ */ I("nav", { className: h.nav, children: [
|
|
251
|
+
e.length > 0 ? /* @__PURE__ */ i(y, { children: e.map((t) => /* @__PURE__ */ i(
|
|
245
252
|
k,
|
|
246
253
|
{
|
|
247
254
|
as: C,
|
|
@@ -254,13 +261,13 @@ function Ee() {
|
|
|
254
261
|
},
|
|
255
262
|
t.to
|
|
256
263
|
)) }) : null,
|
|
257
|
-
n.map((t) => /* @__PURE__ */ I("div", { className:
|
|
258
|
-
/* @__PURE__ */ i("div", { className:
|
|
259
|
-
/* @__PURE__ */ i(
|
|
264
|
+
n.map((t) => /* @__PURE__ */ I("div", { className: h.module, children: [
|
|
265
|
+
/* @__PURE__ */ i("div", { className: h.moduleLabel, children: t.module }),
|
|
266
|
+
/* @__PURE__ */ i(y, { children: t.groups.map((l) => /* @__PURE__ */ i(Pe, { group: l, pathname: o }, l.label)) })
|
|
260
267
|
] }, t.module))
|
|
261
268
|
] });
|
|
262
269
|
}
|
|
263
|
-
function
|
|
270
|
+
function ge(e) {
|
|
264
271
|
const n = [];
|
|
265
272
|
for (const o of e.links) n.push({ label: o.label, to: o.to });
|
|
266
273
|
for (const o of e.modules)
|
|
@@ -275,28 +282,28 @@ function ve(e) {
|
|
|
275
282
|
}
|
|
276
283
|
return n;
|
|
277
284
|
}
|
|
278
|
-
const
|
|
279
|
-
function
|
|
280
|
-
const e = Q(), n = $(), o = U(), t = w(() =>
|
|
285
|
+
const _e = 8;
|
|
286
|
+
function Fe() {
|
|
287
|
+
const e = Q(), n = $(), o = U(), t = w(() => ge(n), [n]), [l, u] = D(""), [b, m] = D(!1), [p, f] = D(0), g = V(null), a = w(() => {
|
|
281
288
|
const r = l.trim().toLowerCase();
|
|
282
289
|
return r ? t.filter(
|
|
283
290
|
(d) => {
|
|
284
291
|
var v;
|
|
285
292
|
return d.label.toLowerCase().includes(r) || (((v = d.context) == null ? void 0 : v.toLowerCase().includes(r)) ?? !1);
|
|
286
293
|
}
|
|
287
|
-
).slice(0,
|
|
294
|
+
).slice(0, _e) : [];
|
|
288
295
|
}, [t, l]), c = b && a.length > 0;
|
|
289
296
|
T(() => f(0), [l]), T(() => {
|
|
290
297
|
f((r) => r > a.length - 1 ? Math.max(0, a.length - 1) : r);
|
|
291
298
|
}, [a.length]), T(() => {
|
|
292
299
|
if (!b) return;
|
|
293
300
|
const r = (d) => {
|
|
294
|
-
g.current && !g.current.contains(d.target) &&
|
|
301
|
+
g.current && !g.current.contains(d.target) && m(!1);
|
|
295
302
|
};
|
|
296
303
|
return document.addEventListener("pointerdown", r), () => document.removeEventListener("pointerdown", r);
|
|
297
304
|
}, [b]);
|
|
298
305
|
const s = (r) => {
|
|
299
|
-
o({ to: r }), u(""),
|
|
306
|
+
o({ to: r }), u(""), m(!1);
|
|
300
307
|
}, _ = (r) => {
|
|
301
308
|
if (c)
|
|
302
309
|
if (r.key === "ArrowDown")
|
|
@@ -307,13 +314,13 @@ function Ae() {
|
|
|
307
314
|
r.preventDefault();
|
|
308
315
|
const d = a[p];
|
|
309
316
|
d && s(d.to);
|
|
310
|
-
} else r.key === "Escape" &&
|
|
317
|
+
} else r.key === "Escape" && m(!1);
|
|
311
318
|
};
|
|
312
319
|
return /* @__PURE__ */ I(
|
|
313
320
|
"div",
|
|
314
321
|
{
|
|
315
322
|
ref: g,
|
|
316
|
-
className:
|
|
323
|
+
className: h.search,
|
|
317
324
|
role: "combobox",
|
|
318
325
|
"aria-expanded": c,
|
|
319
326
|
"aria-haspopup": "listbox",
|
|
@@ -323,9 +330,9 @@ function Ae() {
|
|
|
323
330
|
{
|
|
324
331
|
value: l,
|
|
325
332
|
onChange: (r) => {
|
|
326
|
-
u(r.target.value),
|
|
333
|
+
u(r.target.value), m(!0);
|
|
327
334
|
},
|
|
328
|
-
onFocus: () =>
|
|
335
|
+
onFocus: () => m(!0),
|
|
329
336
|
onKeyDown: _,
|
|
330
337
|
adornment: /* @__PURE__ */ i(A, { name: "SearchNormal" }),
|
|
331
338
|
placeholder: e("sidebar.searchPages"),
|
|
@@ -333,7 +340,7 @@ function Ae() {
|
|
|
333
340
|
autoComplete: "off"
|
|
334
341
|
}
|
|
335
342
|
),
|
|
336
|
-
c ? /* @__PURE__ */ i("div", { className:
|
|
343
|
+
c ? /* @__PURE__ */ i("div", { className: h.searchPanel, children: /* @__PURE__ */ i(y, { role: "listbox", children: a.map((r, d) => /* @__PURE__ */ i(
|
|
337
344
|
B,
|
|
338
345
|
{
|
|
339
346
|
description: r.context,
|
|
@@ -351,30 +358,30 @@ function Ae() {
|
|
|
351
358
|
);
|
|
352
359
|
}
|
|
353
360
|
function x(e, n) {
|
|
354
|
-
const o =
|
|
361
|
+
const o = L(e), t = L(n);
|
|
355
362
|
return t === "/" ? o === "/" : o === t || o.startsWith(t + "/");
|
|
356
363
|
}
|
|
357
|
-
function
|
|
364
|
+
function Ne(e, n) {
|
|
358
365
|
var o;
|
|
359
366
|
return e.to && x(n, e.to) ? !0 : ((o = e.children) == null ? void 0 : o.some((t) => x(n, t.to))) ?? !1;
|
|
360
367
|
}
|
|
361
|
-
function Ne(e) {
|
|
362
|
-
return e ? /* @__PURE__ */ i("span", { className: m.navBadge, children: e }) : null;
|
|
363
|
-
}
|
|
364
368
|
function ze(e) {
|
|
365
|
-
return e ? /* @__PURE__ */ i("span", { className:
|
|
369
|
+
return e ? /* @__PURE__ */ i("span", { className: h.navBadge, children: e }) : null;
|
|
370
|
+
}
|
|
371
|
+
function Ie(e) {
|
|
372
|
+
return e ? /* @__PURE__ */ i("span", { className: h.navDot, style: { background: `var(--tz-color-${e})` } }) : null;
|
|
366
373
|
}
|
|
367
374
|
function z(e, n, o) {
|
|
368
375
|
if (!(e == null && n == null && o == null))
|
|
369
376
|
return /* @__PURE__ */ I(M, { children: [
|
|
370
|
-
|
|
371
|
-
|
|
377
|
+
ze(e),
|
|
378
|
+
Ie(n),
|
|
372
379
|
o
|
|
373
380
|
] });
|
|
374
381
|
}
|
|
375
|
-
function
|
|
376
|
-
var
|
|
377
|
-
const o =
|
|
382
|
+
function Pe({ group: e, pathname: n }) {
|
|
383
|
+
var m, p;
|
|
384
|
+
const o = Ne(e, n), t = !!((m = e.children) != null && m.length), [l, u] = D(o);
|
|
378
385
|
if (T(() => {
|
|
379
386
|
o && u(!0);
|
|
380
387
|
}, [o]), !t && e.to)
|
|
@@ -395,7 +402,7 @@ function Ie({ group: e, pathname: n }) {
|
|
|
395
402
|
{
|
|
396
403
|
name: "ArrowDown4",
|
|
397
404
|
size: "sm",
|
|
398
|
-
className:
|
|
405
|
+
className: h.chevron,
|
|
399
406
|
"data-open": l ? "true" : "false"
|
|
400
407
|
}
|
|
401
408
|
);
|
|
@@ -418,7 +425,7 @@ function Ie({ group: e, pathname: n }) {
|
|
|
418
425
|
"button",
|
|
419
426
|
{
|
|
420
427
|
type: "button",
|
|
421
|
-
className:
|
|
428
|
+
className: h.chevronButton,
|
|
422
429
|
"aria-label": `${l ? "Collapse" : "Expand"} ${e.label}`,
|
|
423
430
|
"aria-expanded": l,
|
|
424
431
|
onClick: (f) => {
|
|
@@ -448,12 +455,12 @@ function Ie({ group: e, pathname: n }) {
|
|
|
448
455
|
),
|
|
449
456
|
t ? (
|
|
450
457
|
// smooth collapse, same grid-template-rows technique as Card
|
|
451
|
-
/* @__PURE__ */ i("div", { className: W(
|
|
458
|
+
/* @__PURE__ */ i("div", { className: W(h.collapsible, !l && h.collapsibleClosed), children: /* @__PURE__ */ i("div", { className: h.collapsibleInner, children: /* @__PURE__ */ i(y, { className: h.leaves, children: (p = e.children) == null ? void 0 : p.map((f) => /* @__PURE__ */ i(
|
|
452
459
|
k,
|
|
453
460
|
{
|
|
454
461
|
as: C,
|
|
455
462
|
to: f.to,
|
|
456
|
-
icon: /* @__PURE__ */ i("span", { className:
|
|
463
|
+
icon: /* @__PURE__ */ i("span", { className: h.leafDot }),
|
|
457
464
|
selected: x(n, f.to),
|
|
458
465
|
size: "md",
|
|
459
466
|
clickable: !0,
|
|
@@ -466,12 +473,12 @@ function Ie({ group: e, pathname: n }) {
|
|
|
466
473
|
] });
|
|
467
474
|
}
|
|
468
475
|
export {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
476
|
+
Ee as F,
|
|
477
|
+
Fe as N,
|
|
478
|
+
Ae as S,
|
|
479
|
+
Be as a,
|
|
473
480
|
fe as b,
|
|
474
481
|
O as f,
|
|
475
|
-
|
|
482
|
+
Me as u
|
|
476
483
|
};
|
|
477
|
-
//# sourceMappingURL=Sidebar-
|
|
484
|
+
//# sourceMappingURL=Sidebar-D2RZH5m5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar-D2RZH5m5.js","sources":["../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport {\n Link,\n Navigate,\n useNavigate,\n useRouter,\n useRouterState,\n type LinkProps,\n type StaticDataRouteOption,\n} from '@tanstack/react-router'\nimport { clsx } from 'clsx'\nimport { Icon } from '../Icon'\nimport { List, ListItem, type ListItemProps } from '../List'\nimport { TextField } from '../TextField'\nimport { useT, type ThemeColor } from '../../theme'\nimport type { IconName } from '../../icons/names'\nimport { hasAccess, useAccessKeys } from '../../helpers/access'\nimport styles from './Sidebar.module.css'\n\n// `ListItem` rendered as a TanStack `Link` — it forwards unrecognized props (like `to`) to the\n// element, so this typed alias lets us pass `to` while keeping `ListItem`'s look + behavior.\nconst NavLink = ListItem as unknown as (props: ListItemProps & { to: string }) => ReactNode\n\nexport type { IconName }\n\n// Typed `staticData` for consumers — every route describes its own menu entry.\ndeclare module '@tanstack/react-router' {\n interface StaticDataRouteOption {\n /** Menu label. A route with no `name` never appears in the menu. */\n name?: string\n /**\n * Explicit page-title / breadcrumb label for **this** route, taking priority over the path-prefix\n * `name` resolution. Read from the current (leaf) matched route, so it works on **dynamic** routes\n * (e.g. `/core/list/$id`) too. Either a static string, or a **function of the route `params`** —\n * called with the matched route's params so a detail page can title itself from the URL, e.g.\n * `title: ({ id }) => \\`Order #${id}\\``. Does **not** affect the sidebar (which reads only `name`).\n */\n title?: string | ((params: Record<string, string>) => ReactNode)\n /** Optional menu icon (the library's `IconName` union). */\n icon?: IconName\n /** Sort order within the parent (ascending); falls back to alphabetical. */\n order?: number\n /** Routed but hidden from the menu. */\n hidden?: boolean\n /** Allowed accessKeys (OR — user needs any one). Omitted/empty = public. */\n roles?: string[]\n /** Small text label (e.g. `\"New\"`) shown as a pill on the menu row. */\n badge?: string\n /** Theme color of a small dot indicator on the menu row (e.g. `\"error\"`). */\n dot?: ThemeColor\n }\n}\n\nexport interface NavLeaf {\n label: string\n to: string\n icon?: IconName\n badge?: string\n dot?: ThemeColor\n}\nexport interface NavGroup {\n label: string\n icon?: IconName\n to?: string\n badge?: string\n dot?: ThemeColor\n children?: NavLeaf[]\n}\nexport interface NavModule {\n module: string\n icon?: IconName\n groups: NavGroup[]\n}\n\nconst prettify = (seg: string) =>\n seg\n .split('-')\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(' ')\nconst trimSlashes = (p: string) => p.replace(/^\\/+|\\/+$/g, '')\n/** Normalize a pathname for comparison — drop a single trailing slash (but keep the root `/`). */\nconst normalizePath = (p: string) => (p.length > 1 && p.endsWith('/') ? p.slice(0, -1) : p)\nconst byOrderThenLabel = (\n a: { order: number; label: string },\n b: { order: number; label: string },\n) => a.order - b.order || a.label.localeCompare(b.label)\n\ninterface LeafAcc {\n label: string\n to: string\n icon?: IconName\n badge?: string\n dot?: ThemeColor\n order: number\n}\ninterface GroupAcc {\n label: string\n icon?: IconName\n to?: string\n badge?: string\n dot?: ThemeColor\n order: number\n leaves: LeafAcc[]\n isContainer: boolean\n}\ninterface ModuleAcc {\n label: string\n icon?: IconName\n order: number\n groups: Map<string, GroupAcc>\n}\n\n/** A single route, reduced to what the menu needs. */\nexport interface NavRoute {\n fullPath: string\n staticData?: StaticDataRouteOption\n}\n\n/**\n * Pure menu builder — derives the 3-level nav tree (module → group → page) from a flat route list.\n * Kept router-free so it's unit-testable; `useNavTree` feeds it the live routes.\n */\nexport function buildNavTree(routes: NavRoute[]): { links: NavLeaf[]; modules: NavModule[] } {\n const entries: Array<{ path: string; name: string; sd: StaticDataRouteOption }> = []\n for (const route of routes) {\n const sd = route.staticData\n const path = trimSlashes(route.fullPath)\n if (!sd?.name || !path) continue\n entries.push({ path, name: sd.name, sd })\n }\n\n const metaByPath = new Map(entries.map((e) => [e.path, e]))\n const paths = entries.map((e) => e.path)\n // A path is a \"container\" only when it has a **non-hidden** descendant — a hidden child must not turn\n // its parent into a container (which would drop the parent's own row and, if every child is hidden,\n // make the whole parent vanish from the menu).\n const isContainer = (p: string) =>\n paths.some((o) => o !== p && o.startsWith(`${p}/`) && !metaByPath.get(o)?.sd.hidden)\n const rawFullPaths = new Set(routes.map((r) => r.fullPath))\n const groupHasOwnPage = (groupKey: string) => rawFullPaths.has(`/${groupKey}/`)\n\n const chrome = (key: string, seg: string) => {\n const e = metaByPath.get(key)\n return {\n label: e?.name ?? prettify(seg),\n icon: e?.sd.icon,\n badge: e?.sd.badge,\n dot: e?.sd.dot,\n order: e?.sd.order ?? Number.POSITIVE_INFINITY,\n }\n }\n\n const modules = new Map<string, ModuleAcc>()\n const getModule = (seg: string) => {\n let mod = modules.get(seg)\n if (!mod) {\n const c = chrome(seg, seg)\n mod = { label: c.label, icon: c.icon, order: c.order, groups: new Map() }\n modules.set(seg, mod)\n }\n return mod\n }\n\n const topLinks: LeafAcc[] = []\n for (const { path, name, sd } of entries) {\n const segs = path.split('/')\n // The menu is 3 levels deep by design (module → group → page). A path only counts as a\n // \"container\" (holds children instead of being its own row) at the module/group levels; a\n // depth-3+ route is always a leaf, so a named page with even-deeper children isn't dropped.\n // Routes deeper than 3 segments still appear — flattened as leaves under their depth-2 group\n // (their `to` stays correct) — the nav just can't nest beyond level 3.\n if ((segs.length <= 2 && isContainer(path)) || sd.hidden) continue\n if (segs.length === 1) {\n topLinks.push({\n label: name,\n to: `/${path}`,\n icon: sd.icon,\n badge: sd.badge,\n dot: sd.dot,\n order: sd.order ?? Number.POSITIVE_INFINITY,\n })\n continue\n }\n const mod = getModule(segs[0])\n if (segs.length === 2) {\n mod.groups.set(path, {\n label: name,\n icon: sd.icon,\n to: `/${path}`,\n badge: sd.badge,\n dot: sd.dot,\n order: sd.order ?? Number.POSITIVE_INFINITY,\n leaves: [],\n isContainer: false,\n })\n } else {\n const groupKey = segs.slice(0, 2).join('/')\n let group = mod.groups.get(groupKey)\n if (!group) {\n const c = chrome(groupKey, segs[1])\n group = {\n label: c.label,\n icon: c.icon,\n badge: c.badge,\n dot: c.dot,\n order: c.order,\n to: groupHasOwnPage(groupKey) ? `/${groupKey}` : undefined,\n leaves: [],\n isContainer: true,\n }\n mod.groups.set(groupKey, group)\n }\n group.leaves.push({\n label: name,\n to: `/${path}`,\n icon: sd.icon,\n badge: sd.badge,\n dot: sd.dot,\n order: sd.order ?? Number.POSITIVE_INFINITY,\n })\n }\n }\n\n return {\n links: topLinks\n .sort(byOrderThenLabel)\n .map((l) => ({ label: l.label, to: l.to, icon: l.icon, badge: l.badge, dot: l.dot })),\n modules: [...modules.values()].sort(byOrderThenLabel).map(\n (mod): NavModule => ({\n module: mod.label,\n icon: mod.icon,\n groups: [...mod.groups.values()].sort(byOrderThenLabel).map(\n (g): NavGroup => ({\n label: g.label,\n icon: g.icon,\n to: g.to,\n badge: g.badge,\n dot: g.dot,\n children: g.isContainer\n ? g.leaves.sort(byOrderThenLabel).map((l) => ({\n label: l.label,\n to: l.to,\n icon: l.icon,\n badge: l.badge,\n dot: l.dot,\n }))\n : undefined,\n }),\n ),\n }),\n ),\n }\n}\n\nfunction useNavTree(): { links: NavLeaf[]; modules: NavModule[] } {\n const router = useRouter()\n const accessKeys = useAccessKeys() // re-render the menu when the user's roles change (login/logout)\n return useMemo(\n () =>\n buildNavTree(\n Object.values(router.looseRoutesById)\n .map((route) => ({\n fullPath: route.fullPath,\n staticData: route.options?.staticData,\n }))\n // Drop pages the current user can't access — empty groups/modules then vanish on their own.\n .filter((route) => hasAccess(route.staticData?.roles)),\n ),\n [router, accessKeys],\n )\n}\n\n/** The first menu destination (top link, else first group/leaf) — used by `FirstRouteRedirect`. */\nexport function firstNavTo(tree: { links: NavLeaf[]; modules: NavModule[] }): string | undefined {\n if (tree.links[0]) return tree.links[0].to\n for (const mod of tree.modules)\n for (const group of mod.groups) {\n if (group.to) return group.to\n const firstChild = group.children?.[0]\n if (firstChild) return firstChild.to\n }\n return undefined\n}\n\nfunction useFirstNavTo() {\n return firstNavTo(useNavTree())\n}\n\n/**\n * A `normalized fullPath → staticData.name` map from **all** routes (index routes included), the same\n * route source the `Sidebar` walks. The key drops a single trailing slash (`/core/list/` → `/core/list`),\n * so a list's **index route** (which carries the name) resolves under the plain path too. A named route\n * never loses its slot to an unnamed one. Pure + router-free, so it's unit-testable.\n */\nexport function buildNameMap(routes: NavRoute[]): Map<string, string> {\n const map = new Map<string, string>()\n for (const route of routes) {\n const name = route.staticData?.name\n if (!name) continue\n const key = normalizePath(route.fullPath)\n if (!map.has(key)) map.set(key, name)\n }\n return map\n}\n\n/**\n * Resolve a pathname's name crumbs from its **cumulative path prefixes** (not the matched-route chain),\n * so a dynamic/detail leaf (e.g. `/core/list/$id`) inherits its named ancestors. Each prefix is looked\n * up in `nameMap` (trailing slashes already normalized on both sides); a prefix with no name is simply\n * **skipped** — it never breaks the chain. Returns the recognized crumbs in order, each with its `to`.\n */\nexport function resolvePathNames(\n pathname: string,\n nameMap: Map<string, string>,\n): Array<{ name: string; to: string }> {\n const out: Array<{ name: string; to: string }> = []\n let prefix = ''\n for (const seg of trimSlashes(pathname).split('/').filter(Boolean)) {\n prefix += `/${seg}` // accumulates `/core`, `/core/list`, … — never trailing-slashed\n const name = nameMap.get(prefix)\n if (name) out.push({ name, to: prefix })\n }\n return out\n}\n\nfunction useNameMap(): Map<string, string> {\n const router = useRouter()\n return useMemo(\n () =>\n buildNameMap(\n Object.values(router.looseRoutesById).map((route) => ({\n fullPath: route.fullPath,\n staticData: route.options?.staticData,\n })),\n ),\n [router],\n )\n}\n\n/** Resolve a `staticData.title` value: a function is called with the route `params`, a string is used\n * as-is, and nullish yields `undefined`. Pure, so it's unit-testable. */\nexport function resolveTitle(\n title: string | ((params: Record<string, string>) => ReactNode) | undefined,\n params: Record<string, string>,\n): ReactNode | undefined {\n if (title == null) return undefined\n return typeof title === 'function' ? title(params) : title\n}\n\n/**\n * The deepest matched route's explicit `staticData.title`, resolved from the live match chain. A string\n * is used as-is; a function is called with that matched route's `params` (so a dynamic detail route can\n * build its label from the URL, e.g. `({ id }) => \\`Order #${id}\\``).\n */\nfunction useLeafTitle(): ReactNode | undefined {\n const matches = useRouterState({ select: (s) => s.matches })\n for (let i = matches.length - 1; i >= 0; i--) {\n const resolved = resolveTitle(\n matches[i].staticData?.title,\n (matches[i].params ?? {}) as Record<string, string>,\n )\n if (resolved) return resolved\n }\n return undefined\n}\n\n/**\n * The current page's title. Priority: the leaf matched route's explicit **`staticData.title`** (works on\n * dynamic routes, read from the match chain), else the **last** recognized name along the current\n * pathname's cumulative prefixes (see `resolvePathNames`), so a dynamic detail route inherits its parent\n * list's name instead of falling back to the nearest named ancestor. Used by `RootLayout` to label the\n * header automatically.\n */\nexport function usePageTitle(): ReactNode | undefined {\n const leafTitle = useLeafTitle()\n const nameMap = useNameMap()\n const pathname = useRouterState({ select: (s) => s.location.pathname })\n if (leafTitle != null) return leafTitle\n const names = resolvePathNames(pathname, nameMap)\n return names.length > 0 ? names[names.length - 1].name : undefined\n}\n\n/** One breadcrumb. `to` is set only when the crumb points at a real, navigable menu page. */\nexport interface Breadcrumb {\n label: ReactNode\n to?: string\n}\n\n/** Every `to` that the menu actually navigates to (top links, group pages, leaves). */\nfunction navigablePaths(tree: { links: NavLeaf[]; modules: NavModule[] }): Set<string> {\n const set = new Set<string>()\n for (const link of tree.links) set.add(link.to)\n for (const mod of tree.modules)\n for (const group of mod.groups) {\n if (group.to) set.add(group.to)\n for (const leaf of group.children ?? []) set.add(leaf.to)\n }\n return set\n}\n\n/**\n * Assemble the breadcrumb items from the resolved prefix names. A crumb links when it maps to a real\n * navigable page **and is not the current page itself** (`to === leafPath` — you're already there, so it\n * stays plain text); this is the key difference from a blanket \"last crumb is never a link\" — an\n * **ancestor** crumb (e.g. the parent list while you're on its detail child) keeps its link. `leafTitle`\n * (the leaf route's `staticData.title`) overrides the current page's label when the leaf is itself a\n * named prefix, otherwise it's appended as the trailing current-page crumb. Pure, so it's unit-testable.\n */\nexport function buildBreadcrumbItems(\n resolved: Array<{ name: string; to: string }>,\n opts: { leafPath: string; leafTitle?: ReactNode; navigable: Set<string> },\n): Breadcrumb[] {\n const { leafPath, leafTitle, navigable } = opts\n const items: Breadcrumb[] = resolved.map(({ name, to }) => ({\n label: name,\n to: to !== leafPath && navigable.has(to) ? to : undefined,\n }))\n if (leafTitle) {\n if (resolved.length > 0 && resolved[resolved.length - 1].to === leafPath) {\n // the leaf is itself a named prefix (the current page) — the title overrides its label\n items[items.length - 1] = { label: leafTitle }\n } else {\n // a dynamic / deeper leaf with no prefix name — the title is the trailing current-page crumb\n items.push({ label: leafTitle })\n }\n }\n return items\n}\n\n/**\n * Breadcrumb trail for the current route, derived from the current pathname's **cumulative prefixes**\n * (via `resolvePathNames`) rather than the matched-route chain — so a dynamic/detail route (e.g.\n * `/core/list/$id`) still shows its named ancestors (Core › List) instead of collapsing to the nearest\n * named one. The leaf matched route's explicit **`staticData.title`** takes priority for the current-page\n * crumb: it overrides the leaf's own label when the leaf is a named prefix, else it's appended as the\n * trailing current-page crumb (so a titled dynamic detail reads Core › List › <title>). `homeTo` is the\n * first allowed menu page (same target as `FirstRouteRedirect`). A crumb links only when it maps to a\n * real navigable page **and isn't the current page** — so an ancestor crumb (the parent list while you're\n * on its detail child) stays a link, while the page you're already on is plain text.\n */\nexport function useBreadcrumbs(): { homeTo?: string; items: Breadcrumb[] } {\n const tree = useNavTree()\n const nameMap = useNameMap()\n const pathname = useRouterState({ select: (s) => s.location.pathname })\n const leafTitle = useLeafTitle()\n const homeTo = firstNavTo(tree)\n const items = buildBreadcrumbItems(resolvePathNames(pathname, nameMap), {\n leafPath: normalizePath(pathname),\n leafTitle,\n navigable: navigablePaths(tree),\n })\n return { homeTo, items }\n}\n\n/** Drop-in component for the `/` route: forwards to whatever sits FIRST in the menu. */\nexport function FirstRouteRedirect() {\n const to = useFirstNavTo()\n return to ? <Navigate to={to as LinkProps['to']} /> : null\n}\n\n/** Auto-generated navigation, derived from the routes' `staticData`. Rendered inside `RootLayout`. */\nexport function Sidebar() {\n const { links, modules } = useNavTree()\n const pathname = useRouterState({ select: (s) => s.location.pathname })\n\n return (\n <nav className={styles.nav}>\n {links.length > 0 ? (\n <List>\n {links.map((link) => (\n <NavLink\n key={link.to}\n as={Link}\n to={link.to}\n icon={link.icon}\n selected={isActivePath(pathname, link.to)}\n clickable\n trailing={navTrailing(link.badge, link.dot)}\n >\n {link.label}\n </NavLink>\n ))}\n </List>\n ) : null}\n {modules.map((mod) => (\n <div className={styles.module} key={mod.module}>\n <div className={styles.moduleLabel}>{mod.module}</div>\n <List>\n {mod.groups.map((group) => (\n <NavGroupItem key={group.label} group={group} pathname={pathname} />\n ))}\n </List>\n </div>\n ))}\n </nav>\n )\n}\n\n/** A single searchable destination — a nav page flattened out of the tree, with a breadcrumb context. */\ninterface NavPage {\n label: string\n to: string\n /** Where it lives — e.g. `\"Components · Forms\"` — shown as the muted second line. */\n context?: string\n}\n\n/** Flatten the nav tree into every navigable page (top links + group pages + leaves). */\nfunction flattenPages(tree: { links: NavLeaf[]; modules: NavModule[] }): NavPage[] {\n const pages: NavPage[] = []\n for (const link of tree.links) pages.push({ label: link.label, to: link.to })\n for (const mod of tree.modules)\n for (const group of mod.groups) {\n if (group.to) pages.push({ label: group.label, to: group.to, context: mod.module })\n for (const leaf of group.children ?? [])\n pages.push({\n label: leaf.label,\n to: leaf.to,\n context: `${mod.module} · ${group.label}`,\n })\n }\n return pages\n}\n\nconst MAX_SEARCH_RESULTS = 8\n\n/**\n * Header search over the sidebar's pages — type to filter the nav (by page name or its section) and\n * pick a suggestion to jump there. Data comes from the same `useNavTree` the sidebar uses (so it\n * respects RBAC). Keyboard: Up/Down move, Enter opens, Escape closes. Rendered by `RootLayout`'s header.\n */\nexport function NavSearch() {\n const t = useT()\n const tree = useNavTree()\n const navigate = useNavigate()\n const pages = useMemo(() => flattenPages(tree), [tree])\n\n const [query, setQuery] = useState('')\n const [open, setOpen] = useState(false)\n const [active, setActive] = useState(0)\n const rootRef = useRef<HTMLDivElement | null>(null)\n\n const results = useMemo(() => {\n const q = query.trim().toLowerCase()\n if (!q) return []\n return pages\n .filter(\n (p) => p.label.toLowerCase().includes(q) || (p.context?.toLowerCase().includes(q) ?? false),\n )\n .slice(0, MAX_SEARCH_RESULTS)\n }, [pages, query])\n\n const showList = open && results.length > 0\n\n // reset the highlighted row whenever the query changes\n useEffect(() => setActive(0), [query])\n\n // clamp the highlight if the result set shrinks without a query change (e.g. RBAC pages update)\n useEffect(() => {\n setActive((a) => (a > results.length - 1 ? Math.max(0, results.length - 1) : a))\n }, [results.length])\n\n // close the suggestions on an outside pointerdown\n useEffect(() => {\n if (!open) return\n const onDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) setOpen(false)\n }\n document.addEventListener('pointerdown', onDown)\n return () => document.removeEventListener('pointerdown', onDown)\n }, [open])\n\n const go = (to: string) => {\n navigate({ to: to as LinkProps['to'] })\n setQuery('')\n setOpen(false)\n }\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (!showList) return\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setActive((i) => (i + 1) % results.length)\n } else if (event.key === 'ArrowUp') {\n event.preventDefault()\n setActive((i) => (i - 1 + results.length) % results.length)\n } else if (event.key === 'Enter') {\n event.preventDefault()\n const hit = results[active]\n if (hit) go(hit.to)\n } else if (event.key === 'Escape') {\n setOpen(false)\n }\n }\n\n return (\n <div\n ref={rootRef}\n className={styles.search}\n role=\"combobox\"\n aria-expanded={showList}\n aria-haspopup=\"listbox\"\n >\n <TextField\n value={query}\n onChange={(event: ChangeEvent<HTMLInputElement>) => {\n setQuery(event.target.value)\n setOpen(true)\n }}\n onFocus={() => setOpen(true)}\n onKeyDown={onKeyDown}\n adornment={<Icon name=\"SearchNormal\" />}\n placeholder={t('sidebar.searchPages')}\n aria-label={t('sidebar.searchPages')}\n autoComplete=\"off\"\n />\n {showList ? (\n <div className={styles.searchPanel}>\n <List role=\"listbox\">\n {results.map((page, i) => (\n <ListItem\n key={page.to}\n description={page.context}\n clickable\n selected={i === active}\n // keep the input focused through the click so blur doesn't close the list first\n onMouseDown={(event: MouseEvent) => event.preventDefault()}\n onMouseEnter={() => setActive(i)}\n onClick={() => go(page.to)}\n >\n {page.label}\n </ListItem>\n ))}\n </List>\n </div>\n ) : null}\n </div>\n )\n}\n\n/**\n * Is `to` the active nav target for `currentPath`? True on an **exact** match or when `currentPath` is a\n * **descendant** of `to` (so a parent row highlights for its child routes, e.g. `/core/page` stays active\n * on `/core/page/edit`). Trailing slashes are normalized on both sides (`/x/` === `/x`). The root `/`\n * matches **only exactly** — otherwise every route would count as its descendant.\n */\nexport function isActivePath(currentPath: string, to: string): boolean {\n const a = normalizePath(currentPath)\n const b = normalizePath(to)\n if (b === '/') return a === '/'\n return a === b || a.startsWith(b + '/')\n}\n\nfunction groupIsActive(group: NavGroup, pathname: string): boolean {\n if (group.to && isActivePath(pathname, group.to)) return true\n return group.children?.some((leaf) => isActivePath(pathname, leaf.to)) ?? false\n}\n\n/** A small \"New\"-style pill rendered on a menu row from `staticData.badge`. */\nfunction navBadge(text?: string) {\n return text ? <span className={styles.navBadge}>{text}</span> : null\n}\n\n/** A small colored dot indicator on a menu row from `staticData.dot`. */\nfunction navDot(color?: ThemeColor) {\n return color ? (\n <span className={styles.navDot} style={{ background: `var(--tz-color-${color})` }} />\n ) : null\n}\n\n/** The menu row's trailing slot: dot + badge + an optional chevron (omitted entirely when empty). */\nfunction navTrailing(badge?: string, dot?: ThemeColor, chevron?: ReactNode): ReactNode {\n if (badge == null && dot == null && chevron == null) return undefined\n return (\n <>\n {navBadge(badge)}\n {navDot(dot)}\n {chevron}\n </>\n )\n}\n\nfunction NavGroupItem({ group, pathname }: { group: NavGroup; pathname: string }) {\n const active = groupIsActive(group, pathname)\n const hasChildren = !!group.children?.length\n const [open, setOpen] = useState(active)\n\n // re-open when navigation makes this group active via a path the mount-time seed missed\n // (NavSearch, Breadcrumbs, back/forward) — collapsing an active group hides the current page\n useEffect(() => {\n if (active) setOpen(true)\n }, [active])\n\n // a plain level-2 page (no children) — just a link row\n if (!hasChildren && group.to) {\n return (\n <NavLink\n as={Link}\n to={group.to}\n icon={group.icon}\n selected={active}\n clickable\n trailing={navTrailing(group.badge, group.dot)}\n >\n {group.label}\n </NavLink>\n )\n }\n\n const chevron = (\n <Icon\n name=\"ArrowDown4\"\n size=\"sm\"\n className={styles.chevron}\n data-open={open ? 'true' : 'false'}\n />\n )\n\n return (\n <>\n {hasChildren && group.to ? (\n // \"Case B\": the row navigates (and expands); a separate chevron only toggles.\n <NavLink\n as={Link}\n to={group.to}\n icon={group.icon}\n selected={active}\n clickable\n onClick={() => setOpen(true)}\n trailing={navTrailing(\n group.badge,\n group.dot,\n <button\n type=\"button\"\n className={styles.chevronButton}\n aria-label={`${open ? 'Collapse' : 'Expand'} ${group.label}`}\n aria-expanded={open}\n onClick={(event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n setOpen((o) => !o)\n }}\n >\n {chevron}\n </button>,\n )}\n >\n {group.label}\n </NavLink>\n ) : (\n // a pure container — the whole row toggles its children\n <ListItem\n icon={group.icon}\n selected={active}\n clickable\n aria-expanded={open}\n onClick={() => setOpen((o) => !o)}\n trailing={navTrailing(group.badge, group.dot, chevron)}\n >\n {group.label}\n </ListItem>\n )}\n {hasChildren ? (\n // smooth collapse, same grid-template-rows technique as Card\n <div className={clsx(styles.collapsible, !open && styles.collapsibleClosed)}>\n <div className={styles.collapsibleInner}>\n <List className={styles.leaves}>\n {group.children?.map((leaf) => (\n <NavLink\n key={leaf.to}\n as={Link}\n to={leaf.to}\n icon={<span className={styles.leafDot} />}\n selected={isActivePath(pathname, leaf.to)}\n size=\"md\"\n clickable\n trailing={navTrailing(leaf.badge, leaf.dot)}\n >\n {leaf.label}\n </NavLink>\n ))}\n </List>\n </div>\n </div>\n ) : null}\n </>\n )\n}\n"],"names":["NavLink","ListItem","prettify","seg","w","trimSlashes","p","normalizePath","byOrderThenLabel","a","b","buildNavTree","routes","entries","route","sd","path","metaByPath","e","paths","isContainer","o","_a","rawFullPaths","r","groupHasOwnPage","groupKey","chrome","key","modules","getModule","mod","c","topLinks","name","segs","group","l","g","useNavTree","router","useRouter","accessKeys","useAccessKeys","useMemo","hasAccess","firstNavTo","tree","firstChild","useFirstNavTo","buildNameMap","map","resolvePathNames","pathname","nameMap","out","prefix","useNameMap","resolveTitle","title","params","useLeafTitle","matches","useRouterState","s","i","resolved","usePageTitle","leafTitle","names","navigablePaths","set","link","leaf","buildBreadcrumbItems","opts","leafPath","navigable","items","to","useBreadcrumbs","homeTo","FirstRouteRedirect","jsx","Navigate","Sidebar","links","jsxs","styles","List","Link","isActivePath","navTrailing","NavGroupItem","flattenPages","pages","MAX_SEARCH_RESULTS","NavSearch","t","useT","navigate","useNavigate","query","setQuery","useState","open","setOpen","active","setActive","rootRef","useRef","results","q","showList","useEffect","onDown","event","go","onKeyDown","hit","TextField","Icon","page","currentPath","groupIsActive","navBadge","text","navDot","color","badge","dot","chevron","Fragment","hasChildren","clsx","_b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;GA8BMA,IAAUC,GAqDVC,KAAW,CAACC,MAChBA,EACG,MAAM,GAAG,EACT,IAAI,CAACC,MAAMA,EAAE,OAAO,CAAC,EAAE,gBAAgBA,EAAE,MAAM,CAAC,CAAC,EACjD,KAAK,GAAG,GACPC,IAAc,CAACC,MAAcA,EAAE,QAAQ,cAAc,EAAE,GAEvDC,IAAgB,CAACD,MAAeA,EAAE,SAAS,KAAKA,EAAE,SAAS,GAAG,IAAIA,EAAE,MAAM,GAAG,EAAE,IAAIA,GACnFE,IAAmB,CACvBC,GACAC,MACGD,EAAE,QAAQC,EAAE,SAASD,EAAE,MAAM,cAAcC,EAAE,KAAK;AAqChD,SAASC,GAAaC,GAAgE;AAC3F,QAAMC,IAA4E,CAAA;AAClF,aAAWC,KAASF,GAAQ;AAC1B,UAAMG,IAAKD,EAAM,YACXE,IAAOX,EAAYS,EAAM,QAAQ;AACvC,IAAI,EAACC,KAAA,QAAAA,EAAI,SAAQ,CAACC,KAClBH,E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AAWD,EAAO,QACrB,WAAA+C,IAAAnG,EAAM,aAAN,gBAAAmG,EAAgB,IAAI,CAAC9D,MACpB,gBAAAU;AAAA,QAACnF;AAAA,QAAA;AAAA,UAEC,IAAI0F;AAAA,UACJ,IAAIjB,EAAK;AAAA,UACT,MAAM,gBAAAU,EAAC,QAAA,EAAK,WAAWK,EAAO,SAAS;AAAA,UACvC,UAAUG,EAAatC,GAAUoB,EAAK,EAAE;AAAA,UACxC,MAAK;AAAA,UACL,WAAS;AAAA,UACT,UAAUmB,EAAYnB,EAAK,OAAOA,EAAK,GAAG;AAAA,UAEzC,UAAAA,EAAK;AAAA,QAAA;AAAA,QATDA,EAAK;AAAA,MAAA,GAWb,CACH,EAAA,CACF,EAAA,CACF;AAAA,QACE;AAAA,EAAA,GACN;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../Breadcrumbs-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../Breadcrumbs-s90MO0PD.cjs");exports.Breadcrumbs=e.Breadcrumbs;exports.default=e.Breadcrumbs;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../PageNotFound-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../PageNotFound-D3ZjMKYD.cjs");exports.PageNotFound=e.PageNotFound;exports.default=e.PageNotFound;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../../RootLayout-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../../RootLayout-DGYOCwOK.cjs");exports.RootLayout=o.RootLayout;exports.default=o.RootLayout;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import { type StaticDataRouteOption } from '@tanstack/react-router';
|
|
2
3
|
import { type ThemeColor } from '../../theme';
|
|
3
4
|
import type { IconName } from '../../icons/names';
|
|
@@ -9,10 +10,11 @@ declare module '@tanstack/react-router' {
|
|
|
9
10
|
/**
|
|
10
11
|
* Explicit page-title / breadcrumb label for **this** route, taking priority over the path-prefix
|
|
11
12
|
* `name` resolution. Read from the current (leaf) matched route, so it works on **dynamic** routes
|
|
12
|
-
* (e.g. `/core/list/$id`) too.
|
|
13
|
-
*
|
|
13
|
+
* (e.g. `/core/list/$id`) too. Either a static string, or a **function of the route `params`** —
|
|
14
|
+
* called with the matched route's params so a detail page can title itself from the URL, e.g.
|
|
15
|
+
* `title: ({ id }) => \`Order #${id}\``. Does **not** affect the sidebar (which reads only `name`).
|
|
14
16
|
*/
|
|
15
|
-
title?: string;
|
|
17
|
+
title?: string | ((params: Record<string, string>) => ReactNode);
|
|
16
18
|
/** Optional menu icon (the library's `IconName` union). */
|
|
17
19
|
icon?: IconName;
|
|
18
20
|
/** Sort order within the parent (ascending); falls back to alphabetical. */
|
|
@@ -82,6 +84,9 @@ export declare function resolvePathNames(pathname: string, nameMap: Map<string,
|
|
|
82
84
|
name: string;
|
|
83
85
|
to: string;
|
|
84
86
|
}>;
|
|
87
|
+
/** Resolve a `staticData.title` value: a function is called with the route `params`, a string is used
|
|
88
|
+
* as-is, and nullish yields `undefined`. Pure, so it's unit-testable. */
|
|
89
|
+
export declare function resolveTitle(title: string | ((params: Record<string, string>) => ReactNode) | undefined, params: Record<string, string>): ReactNode | undefined;
|
|
85
90
|
/**
|
|
86
91
|
* The current page's title. Priority: the leaf matched route's explicit **`staticData.title`** (works on
|
|
87
92
|
* dynamic routes, read from the match chain), else the **last** recognized name along the current
|
|
@@ -89,10 +94,10 @@ export declare function resolvePathNames(pathname: string, nameMap: Map<string,
|
|
|
89
94
|
* list's name instead of falling back to the nearest named ancestor. Used by `RootLayout` to label the
|
|
90
95
|
* header automatically.
|
|
91
96
|
*/
|
|
92
|
-
export declare function usePageTitle():
|
|
97
|
+
export declare function usePageTitle(): ReactNode | undefined;
|
|
93
98
|
/** One breadcrumb. `to` is set only when the crumb points at a real, navigable menu page. */
|
|
94
99
|
export interface Breadcrumb {
|
|
95
|
-
label:
|
|
100
|
+
label: ReactNode;
|
|
96
101
|
to?: string;
|
|
97
102
|
}
|
|
98
103
|
/**
|
|
@@ -108,7 +113,7 @@ export declare function buildBreadcrumbItems(resolved: Array<{
|
|
|
108
113
|
to: string;
|
|
109
114
|
}>, opts: {
|
|
110
115
|
leafPath: string;
|
|
111
|
-
leafTitle?:
|
|
116
|
+
leafTitle?: ReactNode;
|
|
112
117
|
navigable: Set<string>;
|
|
113
118
|
}): Breadcrumb[];
|
|
114
119
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import { type StaticDataRouteOption } from '@tanstack/react-router';
|
|
2
3
|
import { type ThemeColor } from '../../theme';
|
|
3
4
|
import type { IconName } from '../../icons/names';
|
|
@@ -9,10 +10,11 @@ declare module '@tanstack/react-router' {
|
|
|
9
10
|
/**
|
|
10
11
|
* Explicit page-title / breadcrumb label for **this** route, taking priority over the path-prefix
|
|
11
12
|
* `name` resolution. Read from the current (leaf) matched route, so it works on **dynamic** routes
|
|
12
|
-
* (e.g. `/core/list/$id`) too.
|
|
13
|
-
*
|
|
13
|
+
* (e.g. `/core/list/$id`) too. Either a static string, or a **function of the route `params`** —
|
|
14
|
+
* called with the matched route's params so a detail page can title itself from the URL, e.g.
|
|
15
|
+
* `title: ({ id }) => \`Order #${id}\``. Does **not** affect the sidebar (which reads only `name`).
|
|
14
16
|
*/
|
|
15
|
-
title?: string;
|
|
17
|
+
title?: string | ((params: Record<string, string>) => ReactNode);
|
|
16
18
|
/** Optional menu icon (the library's `IconName` union). */
|
|
17
19
|
icon?: IconName;
|
|
18
20
|
/** Sort order within the parent (ascending); falls back to alphabetical. */
|
|
@@ -82,6 +84,9 @@ export declare function resolvePathNames(pathname: string, nameMap: Map<string,
|
|
|
82
84
|
name: string;
|
|
83
85
|
to: string;
|
|
84
86
|
}>;
|
|
87
|
+
/** Resolve a `staticData.title` value: a function is called with the route `params`, a string is used
|
|
88
|
+
* as-is, and nullish yields `undefined`. Pure, so it's unit-testable. */
|
|
89
|
+
export declare function resolveTitle(title: string | ((params: Record<string, string>) => ReactNode) | undefined, params: Record<string, string>): ReactNode | undefined;
|
|
85
90
|
/**
|
|
86
91
|
* The current page's title. Priority: the leaf matched route's explicit **`staticData.title`** (works on
|
|
87
92
|
* dynamic routes, read from the match chain), else the **last** recognized name along the current
|
|
@@ -89,10 +94,10 @@ export declare function resolvePathNames(pathname: string, nameMap: Map<string,
|
|
|
89
94
|
* list's name instead of falling back to the nearest named ancestor. Used by `RootLayout` to label the
|
|
90
95
|
* header automatically.
|
|
91
96
|
*/
|
|
92
|
-
export declare function usePageTitle():
|
|
97
|
+
export declare function usePageTitle(): ReactNode | undefined;
|
|
93
98
|
/** One breadcrumb. `to` is set only when the crumb points at a real, navigable menu page. */
|
|
94
99
|
export interface Breadcrumb {
|
|
95
|
-
label:
|
|
100
|
+
label: ReactNode;
|
|
96
101
|
to?: string;
|
|
97
102
|
}
|
|
98
103
|
/**
|
|
@@ -108,7 +113,7 @@ export declare function buildBreadcrumbItems(resolved: Array<{
|
|
|
108
113
|
to: string;
|
|
109
114
|
}>, opts: {
|
|
110
115
|
leafPath: string;
|
|
111
|
-
leafTitle?:
|
|
116
|
+
leafTitle?: ReactNode;
|
|
112
117
|
navigable: Set<string>;
|
|
113
118
|
}): Breadcrumb[];
|
|
114
119
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../Sidebar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../Sidebar-BYqUTa8D.cjs");exports.FirstRouteRedirect=e.FirstRouteRedirect;exports.Sidebar=e.Sidebar;exports.default=e.Sidebar;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/entries/app.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../AdminRoot-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../AdminRoot-D866Bc0e.cjs");exports.AdminRoot=o.AdminRoot;
|
|
2
2
|
//# sourceMappingURL=app.cjs.map
|
package/dist/entries/app.js
CHANGED