@object-ui/layout 17.1.0 → 17.3.0

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
@@ -2,31 +2,31 @@ import { ComponentRegistry as e } from "@object-ui/core";
2
2
  import t, { useEffect as n, useMemo as r, useState as i } from "react";
3
3
  import { Badge as a, Button as o, Collapsible as s, CollapsibleContent as c, CollapsibleTrigger as l, Input as u, LazyIcon as d, Separator as f, Sidebar as p, SidebarContent as m, SidebarFooter as h, SidebarGroup as g, SidebarGroupContent as _, SidebarGroupLabel as v, SidebarHeader as y, SidebarInput as b, SidebarInset as x, SidebarMenu as S, SidebarMenuAction as C, SidebarMenuButton as w, SidebarMenuItem as T, SidebarMenuSub as E, SidebarMenuSubButton as D, SidebarMenuSubItem as O, SidebarProvider as k, cn as A, getLazyIcon as j, useIsMobile as M } from "@object-ui/components";
4
4
  import { ArrowLeft as N, ChevronRight as P, FileText as F, GripVertical as ee, Layers as te, Pin as ne, PinOff as re, Search as ie, Star as I } from "lucide-react";
5
- import { SchemaRenderer as L, useRecordContext as ae } from "@object-ui/react";
6
- import { Fragment as oe, jsx as R, jsxs as z } from "react/jsx-runtime";
7
- import { Link as se, NavLink as B, useLocation as V } from "react-router-dom";
8
- import { DndContext as ce, KeyboardSensor as H, PointerSensor as le, closestCenter as ue, useSensor as U, useSensors as W } from "@dnd-kit/core";
9
- import { SortableContext as de, arrayMove as fe, useSortable as pe, verticalListSortingStrategy as me } from "@dnd-kit/sortable";
10
- import { CSS as he } from "@dnd-kit/utilities";
11
- import { menuItemToNavigationItem as ge } from "@object-ui/types";
5
+ import { SchemaRenderer as L, useRecordContext as R } from "@object-ui/react";
6
+ import { Fragment as ae, jsx as z, jsxs as B } from "react/jsx-runtime";
7
+ import { Link as oe, NavLink as V, useLocation as H } from "react-router-dom";
8
+ import { DndContext as U, KeyboardSensor as se, PointerSensor as W, closestCenter as ce, useSensor as G, useSensors as K } from "@dnd-kit/core";
9
+ import { SortableContext as q, arrayMove as le, useSortable as ue, verticalListSortingStrategy as de } from "@dnd-kit/sortable";
10
+ import { CSS as fe } from "@dnd-kit/utilities";
11
+ import { menuItemToNavigationItem as pe } from "@object-ui/types";
12
12
  //#region src/PageHeader.tsx
13
- var _e = (e) => {
13
+ var me = (e) => {
14
14
  let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
15
15
  return t != null && String(t).trim() ? String(t) : [
16
16
  e?.salutation,
17
17
  e?.first_name,
18
18
  e?.last_name
19
19
  ].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
20
- }, ve = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
20
+ }, he = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
21
21
  let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
22
- return r == null ? "" : typeof r == "object" ? _e(r) ?? "" : String(r);
22
+ return r == null ? "" : typeof r == "object" ? me(r) ?? "" : String(r);
23
23
  }).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
24
- function G({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
25
- let m = ae(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = ve(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = ve(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
24
+ function ge({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
25
+ let m = R(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = he(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = he(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
26
26
  if (typeof window > "u") return;
27
27
  let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
28
28
  t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
29
- }, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ R(L, { schema: e }, e?.id || `pgh-child-${t}`)) : null, T = Array.isArray(s) && s.length > 0 && s || Array.isArray(l?.actions) && l.actions.length > 0 && l.actions || Array.isArray(l?.properties?.actions) && l.properties.actions.length > 0 && l.properties.actions || null, E = a || f || (T ? /* @__PURE__ */ R(L, { schema: {
29
+ }, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ z(L, { schema: e }, e?.id || `pgh-child-${t}`)) : null, T = Array.isArray(s) && s.length > 0 && s || Array.isArray(l?.actions) && l.actions.length > 0 && l.actions || Array.isArray(l?.properties?.actions) && l.properties.actions.length > 0 && l.properties.actions || null, E = a || f || (T ? /* @__PURE__ */ z(L, { schema: {
30
30
  type: "record:quick_actions",
31
31
  properties: {
32
32
  actions: T,
@@ -35,39 +35,39 @@ function G({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
35
35
  inline: !0
36
36
  }
37
37
  } }) : null) || w;
38
- return /* @__PURE__ */ R("div", {
38
+ return /* @__PURE__ */ z("div", {
39
39
  className: A("flex flex-col gap-3 pb-4 border-b", u),
40
40
  ...p,
41
- children: /* @__PURE__ */ z("div", {
41
+ children: /* @__PURE__ */ B("div", {
42
42
  className: "flex flex-wrap items-center gap-x-4 gap-y-2",
43
43
  children: [
44
- S && /* @__PURE__ */ R(o, {
44
+ S && /* @__PURE__ */ z(o, {
45
45
  type: "button",
46
46
  variant: "ghost",
47
47
  size: "icon",
48
48
  onClick: C,
49
49
  "aria-label": "Back to list",
50
50
  className: "flex-shrink-0 -ml-2",
51
- children: /* @__PURE__ */ R(N, { className: "size-4" })
51
+ children: /* @__PURE__ */ z(N, { className: "size-4" })
52
52
  }),
53
- i && (g || y) && /* @__PURE__ */ R("div", {
53
+ i && (g || y) && /* @__PURE__ */ z("div", {
54
54
  className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
55
- children: typeof i == "string" ? /* @__PURE__ */ R(d, {
55
+ children: typeof i == "string" ? /* @__PURE__ */ z(d, {
56
56
  name: i,
57
57
  className: "size-5"
58
58
  }) : i
59
59
  }),
60
- /* @__PURE__ */ z("div", {
60
+ /* @__PURE__ */ B("div", {
61
61
  className: "flex flex-col min-w-0 flex-1",
62
- children: [g ? /* @__PURE__ */ R("h1", {
62
+ children: [g ? /* @__PURE__ */ z("h1", {
63
63
  className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
64
64
  children: g
65
- }) : null, y && /* @__PURE__ */ R("p", {
65
+ }) : null, y && /* @__PURE__ */ z("p", {
66
66
  className: "text-sm text-muted-foreground truncate",
67
67
  children: y
68
68
  })]
69
69
  }),
70
- E && /* @__PURE__ */ R("div", {
70
+ E && /* @__PURE__ */ z("div", {
71
71
  className: "flex items-center gap-2 ml-auto",
72
72
  children: E
73
73
  })
@@ -77,7 +77,7 @@ function G({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
77
77
  }
78
78
  //#endregion
79
79
  //#region src/AppShell.tsx
80
- function ye(e) {
80
+ function _e(e) {
81
81
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
82
82
  if (!t) return null;
83
83
  let n = parseInt(t[1], 16) / 255, r = parseInt(t[2], 16) / 255, i = parseInt(t[3], 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = 0, c = 0, l = (a + o) / 2;
@@ -90,9 +90,7 @@ function ye(e) {
90
90
  case r:
91
91
  s = ((i - n) / e + 2) / 6;
92
92
  break;
93
- case i:
94
- s = ((n - r) / e + 4) / 6;
95
- break;
93
+ case i: s = ((n - r) / e + 4) / 6;
96
94
  }
97
95
  }
98
96
  return {
@@ -101,17 +99,17 @@ function ye(e) {
101
99
  l: l * 100
102
100
  };
103
101
  }
104
- function be(e) {
105
- let t = ye(e);
102
+ function ve(e) {
103
+ let t = _e(e);
106
104
  return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
107
105
  }
108
- function xe(e) {
109
- let t = ye(e);
106
+ function ye(e) {
107
+ let t = _e(e);
110
108
  if (!t) return null;
111
109
  let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
112
110
  return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
113
111
  }
114
- function Se(e) {
112
+ function be(e) {
115
113
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
116
114
  if (!t) return "0 0% 100%";
117
115
  let n = (e) => {
@@ -120,16 +118,16 @@ function Se(e) {
120
118
  }, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
121
119
  return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
122
120
  }
123
- function Ce(e, t) {
121
+ function xe(e, t) {
124
122
  n(() => {
125
123
  let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
126
124
  if (e?.primaryColor) {
127
- let t = be(e.primaryColor), i = xe(e.primaryColor), a = r() && i || t;
128
- a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : Se(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
125
+ let t = ve(e.primaryColor), i = ye(e.primaryColor), a = r() && i || t;
126
+ a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : be(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
129
127
  } else n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring");
130
128
  if (e?.accentColor) {
131
- let t = be(e.accentColor), i = xe(e.accentColor), a = r() && i || t;
132
- a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : Se(e.accentColor)));
129
+ let t = ve(e.accentColor), i = ye(e.accentColor), a = r() && i || t;
130
+ a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : be(e.accentColor)));
133
131
  } else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
134
132
  };
135
133
  i();
@@ -156,20 +154,20 @@ function Ce(e, t) {
156
154
  t
157
155
  ]);
158
156
  }
159
- function K({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
160
- return Ce(a, a?.title), /* @__PURE__ */ z(k, {
157
+ function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
158
+ return xe(a, a?.title), /* @__PURE__ */ B(k, {
161
159
  defaultOpen: i,
162
160
  className: "!flex-col h-svh overflow-hidden",
163
- children: [/* @__PURE__ */ R("header", {
161
+ children: [/* @__PURE__ */ z("header", {
164
162
  className: "sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4",
165
163
  children: t
166
- }), /* @__PURE__ */ z("div", {
164
+ }), /* @__PURE__ */ B("div", {
167
165
  className: "flex flex-1 min-h-0 w-full",
168
166
  children: [
169
167
  e,
170
- /* @__PURE__ */ R(x, {
168
+ /* @__PURE__ */ z(x, {
171
169
  className: "min-w-0",
172
- children: /* @__PURE__ */ R("main", {
170
+ children: /* @__PURE__ */ z("main", {
173
171
  className: A("flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6", r),
174
172
  children: n
175
173
  })
@@ -181,11 +179,11 @@ function K({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
181
179
  }
182
180
  //#endregion
183
181
  //#region src/PageCard.tsx
184
- function we({ className: e, children: t, ...n }) {
185
- return /* @__PURE__ */ R("div", {
182
+ function Se({ className: e, children: t, ...n }) {
183
+ return /* @__PURE__ */ z("div", {
186
184
  className: A("rounded-xl border bg-card text-card-foreground shadow", e),
187
185
  ...n,
188
- children: /* @__PURE__ */ R("div", {
186
+ children: /* @__PURE__ */ z("div", {
189
187
  className: "p-6",
190
188
  children: t
191
189
  })
@@ -193,7 +191,7 @@ function we({ className: e, children: t, ...n }) {
193
191
  }
194
192
  //#endregion
195
193
  //#region src/ResponsiveGrid.tsx
196
- var Te = {
194
+ var Ce = {
197
195
  xs: {
198
196
  1: "grid-cols-1",
199
197
  2: "grid-cols-2",
@@ -243,11 +241,11 @@ var Te = {
243
241
  12: "2xl:grid-cols-12"
244
242
  }
245
243
  };
246
- function Ee(e) {
244
+ function we(e) {
247
245
  if (!e) return "grid-cols-1";
248
246
  let t = [];
249
247
  for (let [n, r] of Object.entries(e)) {
250
- let e = Te[n];
248
+ let e = Ce[n];
251
249
  if (e && r) {
252
250
  let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
253
251
  t.push(e[n]);
@@ -255,7 +253,7 @@ function Ee(e) {
255
253
  }
256
254
  return t.join(" ") || "grid-cols-1";
257
255
  }
258
- var De = {
256
+ var Te = {
259
257
  0: "gap-0",
260
258
  1: "gap-1",
261
259
  2: "gap-2",
@@ -264,16 +262,19 @@ var De = {
264
262
  5: "gap-5",
265
263
  6: "gap-6",
266
264
  8: "gap-8"
267
- }, Oe = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
268
- className: A("grid", Ee(e), typeof t == "number" ? De[t] || `gap-${t}` : "", n),
269
- children: r
270
- });
265
+ }, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => {
266
+ let i = we(e), a = typeof t == "number" ? Te[t] || `gap-${t}` : "";
267
+ return /* @__PURE__ */ z("div", {
268
+ className: A("grid", i, a, n),
269
+ children: r
270
+ });
271
+ };
271
272
  //#endregion
272
273
  //#region src/NavigationRenderer.tsx
273
- function q(e) {
274
+ function Y(e) {
274
275
  return e ? j(e) : F;
275
276
  }
276
- function J(e, t) {
277
+ function X(e, t) {
277
278
  if (typeof e == "string") return e;
278
279
  if (t) {
279
280
  let n = t(e.key, {
@@ -284,8 +285,8 @@ function J(e, t) {
284
285
  }
285
286
  return e.defaultValue || e.key;
286
287
  }
287
- function ke(e, t, n, r, i, a, o) {
288
- let s = J(e.label, n);
288
+ function De(e, t, n, r, i, a, o) {
289
+ let s = X(e.label, n);
289
290
  if (typeof e.label != "string") return s;
290
291
  let c = (e) => !!e && s.trim().toLowerCase() !== e.trim().toLowerCase();
291
292
  if (e.type === "object" && e.objectName) {
@@ -303,21 +304,33 @@ function ke(e, t, n, r, i, a, o) {
303
304
  }
304
305
  return o && e.id && !c(e.id) ? o(e.id, s) : s;
305
306
  }
306
- var Ae = (e) => !(e === !1 || e === "false"), je = () => !0, Me = () => !0, Ne = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
307
- function Y(e, t) {
307
+ var Oe = (e) => e !== !1 && e !== "false", ke = () => !0, Ae = () => !0;
308
+ function je(e, t = {}) {
309
+ let { evaluateVisibility: n = Oe, checkPermission: r = ke, checkCapability: i = Ae, hasActionHandler: a = !1 } = t;
310
+ for (let o of e) if (n(o.visible) && !(o.requiredPermissions?.length && !r(o.requiredPermissions)) && !(o.requiresObject && !i("object", o.requiresObject)) && !(o.requiresService && !i("service", o.requiresService)) && o.type !== "separator") {
311
+ if (o.type === "group") {
312
+ if (je(o.children ?? [], t)) return !0;
313
+ continue;
314
+ }
315
+ if (!(o.type === "action" && !a)) return !0;
316
+ }
317
+ return !1;
318
+ }
319
+ var Me = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
320
+ function Z(e, t) {
308
321
  if (!e.includes("{")) return e;
309
- let n = !1, r = e.replace(Ne, (e, r) => {
322
+ let n = !1, r = e.replace(Me, (e, r) => {
310
323
  let i;
311
324
  return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
312
325
  });
313
326
  return n ? null : r;
314
327
  }
315
- function X(e, t, n) {
328
+ function Ne(e, t, n) {
316
329
  switch (e.type) {
317
330
  case "object": {
318
331
  let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
319
332
  if (i) {
320
- let t = Y(i, n);
333
+ let t = Z(i, n);
321
334
  if (t) {
322
335
  let n = `${r}/record/${encodeURIComponent(t)}`;
323
336
  return {
@@ -331,7 +344,7 @@ function X(e, t, n) {
331
344
  let e = new URLSearchParams();
332
345
  for (let [t, r] of Object.entries(a)) {
333
346
  if (r == null || t === "") continue;
334
- let i = Y(String(r), n);
347
+ let i = Z(String(r), n);
335
348
  i !== null && e.set(`filter[${t}]`, i);
336
349
  }
337
350
  let t = e.toString();
@@ -358,7 +371,7 @@ function X(e, t, n) {
358
371
  if (r && typeof r == "object") {
359
372
  let e = new URLSearchParams();
360
373
  for (let [t, i] of Object.entries(r)) if (i != null) if (typeof i == "string") {
361
- let r = Y(i, n);
374
+ let r = Z(i, n);
362
375
  r !== null && e.set(t, r);
363
376
  } else e.set(t, JSON.stringify(i));
364
377
  let t = e.toString();
@@ -393,8 +406,8 @@ function X(e, t, n) {
393
406
  let e = i[1], r = a && typeof a.type == "string" ? a.type : void 0, o = a && typeof a.name == "string" ? a.name : void 0, s = "";
394
407
  if (a && typeof a == "object") {
395
408
  let e = new URLSearchParams();
396
- for (let [t, r] of Object.entries(a)) if (!(t === "type" || t === "name") && r != null) if (typeof r == "string") {
397
- let i = Y(r, n);
409
+ for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) if (typeof r == "string") {
410
+ let i = Z(r, n);
398
411
  i && e.set(t, i);
399
412
  } else e.set(t, JSON.stringify(r));
400
413
  let t = e.toString();
@@ -441,14 +454,14 @@ function Ve(e, t) {
441
454
  return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
442
455
  }
443
456
  function He(e, t, n, r, i) {
444
- let { href: a, external: o } = X(e, r, i);
457
+ let { href: a, external: o } = Ne(e, r, i);
445
458
  if (o || a === "#") return 0;
446
459
  if (e.type === "object" && e.objectName) {
447
460
  let a = `${r}/${e.objectName}`;
448
461
  if (t !== a && !t.startsWith(`${a}/`)) return 0;
449
462
  let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
450
463
  if (s) {
451
- let e = Y(s, i);
464
+ let e = Z(s, i);
452
465
  if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Pe : 0;
453
466
  }
454
467
  let c = e.filters;
@@ -457,7 +470,7 @@ function He(e, t, n, r, i) {
457
470
  let e = /* @__PURE__ */ new Map();
458
471
  for (let [t, n] of Object.entries(c)) {
459
472
  if (n == null || t === "") continue;
460
- let r = Y(String(n), i);
473
+ let r = Z(String(n), i);
461
474
  r !== null && e.set(t, r);
462
475
  }
463
476
  if (e.size !== n.size) return 0;
@@ -484,38 +497,38 @@ function Ue(e, t, n, r, i) {
484
497
  };
485
498
  return c(e), o;
486
499
  }
487
- var Z = t.createContext(null);
488
- function We(e, t) {
500
+ var We = t.createContext(null);
501
+ function Ge(e, t) {
489
502
  if (!t.trim()) return e;
490
503
  let n = t.toLowerCase().trim();
491
504
  return e.reduce((e, r) => {
492
505
  if (r.type === "separator") return e;
493
506
  if (r.type === "group" && r.children?.length) {
494
- let n = We(r.children, t);
507
+ let n = Ge(r.children, t);
495
508
  return n.length > 0 && e.push({
496
509
  ...r,
497
510
  children: n
498
511
  }), e;
499
512
  }
500
- return J(r.label).toLowerCase().includes(n) && e.push(r), e;
513
+ return X(r.label).toLowerCase().includes(n) && e.push(r), e;
501
514
  }, []);
502
515
  }
503
- var Ge = 5;
504
- function Ke({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, resolveItemLabel: p, t: m, templateContext: h }) {
505
- let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = pe({
516
+ var Ke = 5;
517
+ function qe({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, resolveItemLabel: p, t: m, templateContext: h }) {
518
+ let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = ue({
506
519
  id: e.id,
507
520
  disabled: !c
508
- });
509
- return /* @__PURE__ */ R("div", {
521
+ }), S = {
522
+ transform: fe.Transform.toString(y),
523
+ transition: b,
524
+ opacity: x ? .5 : void 0,
525
+ zIndex: x ? 10 : void 0
526
+ };
527
+ return /* @__PURE__ */ z("div", {
510
528
  ref: v,
511
- style: {
512
- transform: he.Transform.toString(y),
513
- transition: b,
514
- opacity: x ? .5 : void 0,
515
- zIndex: x ? 10 : void 0
516
- },
529
+ style: S,
517
530
  ...g,
518
- children: /* @__PURE__ */ R(Q, {
531
+ children: /* @__PURE__ */ z(Q, {
519
532
  item: e,
520
533
  basePath: t,
521
534
  evalVis: n,
@@ -539,27 +552,27 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
539
552
  let j = M(), N = j ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, F = A("shrink-0", j ? "h-5 w-5" : "h-4 w-4"), te = (() => {
540
553
  if (typeof e.expanded == "boolean") return e.expanded;
541
554
  if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
542
- })(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(Z), [L, ae] = i(t.useMemo(() => {
555
+ })(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(We), L = t.useMemo(() => {
543
556
  if (e.type !== "group" || !I) return !1;
544
557
  let t = (e) => !!e?.some((e) => e.id === I || e.type === "group" && t(e.children));
545
558
  return t(e.children);
546
- }, [e, I]) ? !0 : te ?? !(ie >= 8));
559
+ }, [e, I]) ? !0 : te ?? !(ie >= 8), [R, V] = i(L);
547
560
  if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
548
- let B = e.requiresObject, V = e.requiresService;
549
- if (B && !u("object", B) || V && !u("service", V)) return null;
550
- if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
561
+ let H = e.requiresObject, U = e.requiresService;
562
+ if (H && !u("object", H) || U && !u("service", U)) return null;
563
+ if (e.type === "separator") return /* @__PURE__ */ z(f, { className: "my-2" });
551
564
  if (e.type === "group") {
552
- let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = ke(e, y, O, b, x, E, D);
553
- return /* @__PURE__ */ R(s, {
554
- open: L,
555
- onOpenChange: ae,
556
- children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
565
+ let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = De(e, y, O, b, x, E, D);
566
+ return /* @__PURE__ */ z(s, {
567
+ open: R,
568
+ onOpenChange: V,
569
+ children: /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, {
557
570
  asChild: !0,
558
- children: /* @__PURE__ */ z(l, {
571
+ children: /* @__PURE__ */ B(l, {
559
572
  className: A("flex w-full items-center justify-between", j && "min-h-[44px] text-[15px] rounded-xl"),
560
- children: [i, /* @__PURE__ */ R(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4", L && "rotate-90") })]
573
+ children: [i, /* @__PURE__ */ z(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4", R && "rotate-90") })]
561
574
  })
562
- }), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
575
+ }), /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
563
576
  item: e,
564
577
  basePath: n,
565
578
  evalVis: r,
@@ -579,93 +592,94 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
579
592
  });
580
593
  }
581
594
  if (e.type === "action") {
582
- let t = q(e.icon), r = J(e.label, O);
583
- return /* @__PURE__ */ z(T, { children: [
584
- h && /* @__PURE__ */ R("span", {
595
+ if (!d) return null;
596
+ let t = Y(e.icon), r = X(e.label, O);
597
+ return /* @__PURE__ */ B(T, { children: [
598
+ h && /* @__PURE__ */ z("span", {
585
599
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
586
600
  "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
587
601
  ...h,
588
- children: /* @__PURE__ */ R(ee, { className: "h-3.5 w-3.5" })
602
+ children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
589
603
  }),
590
- /* @__PURE__ */ z(w, {
604
+ /* @__PURE__ */ B(w, {
591
605
  tooltip: r,
592
606
  onClick: () => d?.(e),
593
607
  className: N,
594
608
  children: [
595
- /* @__PURE__ */ R(t, { className: F }),
596
- /* @__PURE__ */ R("span", { children: r }),
597
- e.badge != null && /* @__PURE__ */ R(a, {
609
+ /* @__PURE__ */ z(t, { className: F }),
610
+ /* @__PURE__ */ z("span", { children: r }),
611
+ e.badge != null && /* @__PURE__ */ z(a, {
598
612
  variant: e.badgeVariant ?? "default",
599
613
  className: "ml-auto text-[10px] px-1.5 py-0",
600
614
  children: e.badge
601
615
  })
602
616
  ]
603
617
  }),
604
- p && m && /* @__PURE__ */ R(C, {
618
+ p && m && /* @__PURE__ */ z(C, {
605
619
  showOnHover: !0,
606
620
  onClick: () => m(e.id, !e.pinned, e, n),
607
621
  "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
608
622
  defaultValue: e.pinned ? `Unpin ${r}` : `Pin ${r}`,
609
623
  name: r
610
624
  }) : e.pinned ? `Unpin ${r}` : `Pin ${r}`,
611
- children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
625
+ children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
612
626
  })
613
627
  ] });
614
628
  }
615
- let ce = q(e.icon), { href: H, external: le } = X(e, n, k), ue = I !== null && e.id === I, U = ke(e, y, O, b, x, E, D), W = /* @__PURE__ */ z(oe, { children: [
616
- /* @__PURE__ */ R(ce, { className: F }),
617
- /* @__PURE__ */ R("span", { children: U }),
618
- e.badge != null && /* @__PURE__ */ R(a, {
629
+ let se = Y(e.icon), { href: W, external: ce } = Ne(e, n, k), G = I !== null && e.id === I, K = De(e, y, O, b, x, E, D), q = /* @__PURE__ */ B(ae, { children: [
630
+ /* @__PURE__ */ z(se, { className: F }),
631
+ /* @__PURE__ */ z("span", { children: K }),
632
+ e.badge != null && /* @__PURE__ */ z(a, {
619
633
  variant: e.badgeVariant ?? "default",
620
634
  className: "ml-auto text-[10px] px-1.5 py-0",
621
635
  children: e.badge
622
636
  })
623
637
  ] });
624
- return /* @__PURE__ */ z(T, { children: [
625
- h && /* @__PURE__ */ R("span", {
638
+ return /* @__PURE__ */ B(T, { children: [
639
+ h && /* @__PURE__ */ z("span", {
626
640
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
627
641
  "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
628
642
  ...h,
629
- children: /* @__PURE__ */ R(ee, { className: "h-3.5 w-3.5" })
643
+ children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
630
644
  }),
631
- /* @__PURE__ */ R(w, {
645
+ /* @__PURE__ */ z(w, {
632
646
  asChild: !0,
633
- isActive: ue,
634
- tooltip: U,
647
+ isActive: G,
648
+ tooltip: K,
635
649
  className: N,
636
- children: le ? /* @__PURE__ */ R("a", {
637
- href: H,
650
+ children: ce ? /* @__PURE__ */ z("a", {
651
+ href: W,
638
652
  target: "_blank",
639
653
  rel: "noopener noreferrer",
640
- children: W
641
- }) : /* @__PURE__ */ R(se, {
642
- to: H,
643
- children: W
654
+ children: q
655
+ }) : /* @__PURE__ */ z(oe, {
656
+ to: W,
657
+ children: q
644
658
  })
645
659
  }),
646
- p && m && /* @__PURE__ */ R(C, {
660
+ p && m && /* @__PURE__ */ z(C, {
647
661
  showOnHover: !0,
648
662
  onClick: () => m(e.id, !e.pinned, e, n),
649
663
  "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
650
- defaultValue: e.pinned ? `Unpin ${U}` : `Pin ${U}`,
651
- name: U
652
- }) : e.pinned ? `Unpin ${U}` : `Pin ${U}`,
653
- children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
664
+ defaultValue: e.pinned ? `Unpin ${K}` : `Pin ${K}`,
665
+ name: K
666
+ }) : e.pinned ? `Unpin ${K}` : `Pin ${K}`,
667
+ children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
654
668
  })
655
669
  ] });
656
670
  }
657
- function $({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermission: i = je, checkCapability: a = Me, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
658
- let C = V(), w = r(() => Ue(e, C.pathname, C.search, t, x)?.id ?? null, [
671
+ function $({ items: e, basePath: t = "", evaluateVisibility: n = Oe, checkPermission: i = ke, checkCapability: a = Ae, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
672
+ let C = H(), w = r(() => Ue(e, C.pathname, C.search, t, x)?.id ?? null, [
659
673
  e,
660
674
  C.pathname,
661
675
  C.search,
662
676
  t,
663
677
  x
664
- ]), T = r(() => s ? We(e, s) : e, [e, s]), E = r(() => qe(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = W(U(le, { activationConstraint: { distance: Ge } }), U(H)), k = (e) => {
678
+ ]), T = r(() => s ? Ge(e, s) : e, [e, s]), E = r(() => Je(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = K(G(W, { activationConstraint: { distance: Ke } }), G(se)), k = (e) => {
665
679
  let { active: t, over: n } = e;
666
680
  if (!n || t.id === n.id || !d) return;
667
681
  let r = D.findIndex((e) => e.id === t.id), i = D.findIndex((e) => e.id === n.id);
668
- r === -1 || i === -1 || d(fe(D, r, i).map((e, t) => ({
682
+ r !== -1 && i !== -1 && d(le(D, r, i).map((e, t) => ({
669
683
  ...e,
670
684
  order: t
671
685
  })));
@@ -684,88 +698,87 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermis
684
698
  resolveItemLabel: y,
685
699
  t: b,
686
700
  templateContext: x
687
- }, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
701
+ }, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
688
702
  className: "flex items-center gap-1.5",
689
- children: [/* @__PURE__ */ R(I, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
690
- }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: E.map((e) => /* @__PURE__ */ R(Q, {
703
+ children: [/* @__PURE__ */ z(I, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
704
+ }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: E.map((e) => /* @__PURE__ */ z(Q, {
691
705
  item: e,
692
706
  ...A
693
707
  }, `fav-${e.id}`)) }) })] }) : null;
694
708
  if (!j) {
695
- let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ R(ce, {
709
+ let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ z(U, {
696
710
  sensors: O,
697
- collisionDetection: ue,
711
+ collisionDetection: ce,
698
712
  onDragEnd: k,
699
- children: /* @__PURE__ */ R(de, {
713
+ children: /* @__PURE__ */ z(q, {
700
714
  items: e,
701
- strategy: me,
702
- children: /* @__PURE__ */ R(S, { children: D.map((e) => /* @__PURE__ */ R(Ke, {
715
+ strategy: de,
716
+ children: /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(qe, {
703
717
  item: e,
704
718
  enableReorder: u,
705
719
  ...A
706
720
  }, e.id)) })
707
721
  })
708
- }) : /* @__PURE__ */ R(S, { children: D.map((e) => /* @__PURE__ */ R(Q, {
722
+ }) : /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(Q, {
709
723
  item: e,
710
724
  ...A
711
725
  }, e.id)) });
712
- return /* @__PURE__ */ z(Z.Provider, {
726
+ return /* @__PURE__ */ B(We.Provider, {
713
727
  value: w,
714
- children: [M, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: t }) })]
728
+ children: [M, /* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: t }) })]
715
729
  });
716
730
  }
717
731
  let N = [], P = [], F = (e) => {
718
732
  if (P.length === 0) return;
719
733
  let t = P;
720
- P = [], N.push(/* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
734
+ P = [], N.push(/* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
721
735
  item: e,
722
736
  ...A
723
737
  }, e.id)) }) }) }, e));
724
738
  };
725
739
  return D.forEach((e, t) => {
726
- e.type === "group" ? (F(`leaf-${t}`), N.push(/* @__PURE__ */ R(Q, {
740
+ e.type === "group" ? (F(`leaf-${t}`), N.push(/* @__PURE__ */ z(Q, {
727
741
  item: e,
728
742
  ...A
729
743
  }, e.id))) : P.push(e);
730
- }), F("leaf-end"), /* @__PURE__ */ z(Z.Provider, {
744
+ }), F("leaf-end"), /* @__PURE__ */ B(We.Provider, {
731
745
  value: w,
732
746
  children: [M, N]
733
747
  });
734
748
  }
735
- function qe(e) {
749
+ function Je(e) {
736
750
  let t = [];
737
- for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...qe(n.children));
751
+ for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Je(n.children));
738
752
  return t;
739
753
  }
740
754
  //#endregion
741
755
  //#region src/AppSchemaRenderer.tsx
742
- function Je({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
743
- let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
744
- return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
756
+ function Ye({ areas: e, activeAreaId: t, onAreaChange: n }) {
757
+ return e.length <= 1 ? null : /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
745
758
  className: "flex items-center gap-1.5",
746
- children: [/* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" }), "Area"]
747
- }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
748
- let r = q(e.icon);
749
- return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
759
+ children: [/* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" }), "Area"]
760
+ }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.map((e) => {
761
+ let r = Y(e.icon);
762
+ return /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
750
763
  isActive: e.id === t,
751
- tooltip: J(e.label),
764
+ tooltip: X(e.label),
752
765
  onClick: () => n(e.id),
753
- children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: J(e.label) })]
766
+ children: [/* @__PURE__ */ z(r, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: X(e.label) })]
754
767
  }) }, e.id);
755
768
  }) }) })] });
756
769
  }
757
- function Ye({ items: e, basePath: t }) {
758
- let n = V(), r = (e) => {
770
+ function Xe({ items: e, basePath: t }) {
771
+ let n = H(), r = (e) => {
759
772
  let t = [];
760
773
  for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
761
774
  return t;
762
775
  }, i = r(e).slice(0, 5);
763
- return i.length === 0 ? null : /* @__PURE__ */ R("div", {
776
+ return i.length === 0 ? null : /* @__PURE__ */ z("div", {
764
777
  className: "fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom",
765
778
  role: "navigation",
766
779
  "aria-label": "Mobile navigation",
767
780
  children: i.map((e) => {
768
- let r = q(e.icon), i = "#";
781
+ let r = Y(e.icon), i = "#";
769
782
  if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
770
783
  else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
771
784
  else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
@@ -785,174 +798,157 @@ function Ye({ items: e, basePath: t }) {
785
798
  }
786
799
  }
787
800
  let a = i !== "#" && n.pathname.startsWith(i);
788
- return /* @__PURE__ */ z(se, {
801
+ return /* @__PURE__ */ B(oe, {
789
802
  to: i,
790
803
  className: `flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a ? "text-primary" : "text-muted-foreground hover:text-foreground"}`,
791
- children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
804
+ children: [/* @__PURE__ */ z(r, { className: "h-5 w-5" }), /* @__PURE__ */ z("span", {
792
805
  className: "text-[10px] truncate max-w-[60px]",
793
- children: J(e.label)
806
+ children: X(e.label)
794
807
  })]
795
808
  }, e.id);
796
809
  })
797
810
  });
798
811
  }
799
- function Xe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, activeAreaId: u, setActiveAreaId: d, resolvedNavigation: f, enableSearch: g, enablePinning: _, onPinToggle: v, enableReorder: x, onReorder: C }) {
800
- let E = q(e.logo), D = e.areas ?? [], [O, k] = i("");
801
- return /* @__PURE__ */ z(p, {
812
+ function Ze({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, visibleAreas: u, activeAreaId: d, setActiveAreaId: f, resolvedNavigation: g, enableSearch: _, enablePinning: v, onPinToggle: x, enableReorder: C, onReorder: E }) {
813
+ let D = Y(e.logo), [O, k] = i("");
814
+ return /* @__PURE__ */ B(p, {
802
815
  collapsible: "icon",
803
816
  children: [
804
- /* @__PURE__ */ z(y, { children: [s ?? /* @__PURE__ */ R(S, { children: /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
817
+ /* @__PURE__ */ B(y, { children: [s ?? /* @__PURE__ */ z(S, { children: /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
805
818
  size: "lg",
806
819
  tooltip: e.title ?? e.name,
807
- children: [/* @__PURE__ */ R("div", {
820
+ children: [/* @__PURE__ */ z("div", {
808
821
  className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
809
- children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ R("img", {
822
+ children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ z("img", {
810
823
  src: e.logo,
811
824
  alt: e.title ?? "",
812
825
  className: "size-6 object-contain"
813
- }) : /* @__PURE__ */ R(E, { className: "size-4" })
814
- }), /* @__PURE__ */ z("div", {
826
+ }) : /* @__PURE__ */ z(D, { className: "size-4" })
827
+ }), /* @__PURE__ */ B("div", {
815
828
  className: "grid flex-1 text-left text-sm leading-tight",
816
- children: [/* @__PURE__ */ R("span", {
829
+ children: [/* @__PURE__ */ z("span", {
817
830
  className: "truncate font-semibold",
818
831
  children: e.title ?? e.name ?? "App"
819
- }), e.description && /* @__PURE__ */ R("span", {
832
+ }), e.description && /* @__PURE__ */ z("span", {
820
833
  className: "truncate text-xs text-muted-foreground",
821
834
  children: e.description
822
835
  })]
823
836
  })]
824
- }) }) }), g && /* @__PURE__ */ R(b, {
837
+ }) }) }), _ && /* @__PURE__ */ z(b, {
825
838
  placeholder: "Search navigation…",
826
839
  value: O,
827
840
  onChange: (e) => k(e.target.value),
828
841
  "aria-label": "Search navigation"
829
842
  })] }),
830
- /* @__PURE__ */ z(m, { children: [
831
- D.length > 1 && u && /* @__PURE__ */ R(Je, {
832
- areas: D,
833
- activeAreaId: u,
834
- onAreaChange: d,
835
- evalVis: n,
836
- checkPerm: r
843
+ /* @__PURE__ */ B(m, { children: [
844
+ u.length > 1 && d && /* @__PURE__ */ z(Ye, {
845
+ areas: u,
846
+ activeAreaId: d,
847
+ onAreaChange: f
837
848
  }),
838
- /* @__PURE__ */ R($, {
839
- items: f,
849
+ /* @__PURE__ */ z($, {
850
+ items: g,
840
851
  basePath: t,
841
852
  evaluateVisibility: n,
842
853
  checkPermission: r,
843
854
  checkCapability: a,
844
855
  onAction: o,
845
856
  searchQuery: O,
846
- enablePinning: _,
847
- onPinToggle: v,
848
- enableReorder: x,
849
- onReorder: C
857
+ enablePinning: v,
858
+ onPinToggle: x,
859
+ enableReorder: C,
860
+ onReorder: E
850
861
  }),
851
862
  l
852
863
  ] }),
853
- c && /* @__PURE__ */ R(h, { children: c })
864
+ c && /* @__PURE__ */ z(h, { children: c })
854
865
  ]
855
866
  });
856
867
  }
857
- function Ze({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, onAction: l, navbar: u, sidebarHeader: d, sidebarFooter: f, sidebarExtra: p, children: m, className: h, defaultOpen: g = !0, enableSearch: _, enablePinning: v, onPinToggle: y, enableReorder: b, onReorder: x }) {
858
- let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => ge(e, t)), [e.menu]), E = e.navigation ?? T, D = e.areas ?? [], [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
868
+ function Qe({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, onAction: l, navbar: u, sidebarHeader: d, sidebarFooter: f, sidebarExtra: p, children: m, className: h, defaultOpen: g = !0, enableSearch: _, enablePinning: v, onPinToggle: y, enableReorder: b, onReorder: x }) {
869
+ let S = o ?? ((e) => e !== !1 && e !== "false"), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => pe(e, t)), [e.menu]), E = e.navigation ?? T, D = (e.areas ?? []).filter((e) => je(e.navigation, {
870
+ evaluateVisibility: S,
871
+ checkPermission: C,
872
+ checkCapability: w,
873
+ hasActionHandler: !!l
874
+ })), [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
859
875
  n(() => {
860
876
  D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
861
877
  }, [e.name, A]);
862
- let j = D.find((e) => e.id === O)?.navigation ?? E, M = {
878
+ let j = D.find((e) => e.id === O) ?? D[0], M = j?.navigation ?? E, N = {
863
879
  title: e.title,
864
880
  favicon: e.favicon,
865
881
  logo: e.logo
866
- };
867
- return /* @__PURE__ */ z(oe, { children: [/* @__PURE__ */ R(K, {
868
- sidebar: /* @__PURE__ */ R(Xe, {
869
- schema: e,
870
- basePath: t,
871
- evalVis: S,
872
- checkPerm: C,
873
- checkCap: w,
874
- onAction: l,
875
- sidebarHeader: d,
876
- sidebarFooter: f,
877
- sidebarExtra: p,
878
- activeAreaId: O,
879
- setActiveAreaId: k,
880
- resolvedNavigation: j,
881
- enableSearch: _,
882
- enablePinning: v,
883
- onPinToggle: y,
884
- enableReorder: b,
885
- onReorder: x
886
- }),
882
+ }, P = /* @__PURE__ */ z(Ze, {
883
+ schema: e,
884
+ basePath: t,
885
+ evalVis: S,
886
+ checkPerm: C,
887
+ checkCap: w,
888
+ onAction: l,
889
+ sidebarHeader: d,
890
+ sidebarFooter: f,
891
+ sidebarExtra: p,
892
+ visibleAreas: D,
893
+ activeAreaId: j?.id ?? null,
894
+ setActiveAreaId: k,
895
+ resolvedNavigation: M,
896
+ enableSearch: _,
897
+ enablePinning: v,
898
+ onPinToggle: y,
899
+ enableReorder: b,
900
+ onReorder: x
901
+ });
902
+ return /* @__PURE__ */ B(ae, { children: [/* @__PURE__ */ z(J, {
903
+ sidebar: P,
887
904
  navbar: u,
888
905
  className: h,
889
906
  defaultOpen: g,
890
- branding: M,
907
+ branding: N,
891
908
  children: m
892
- }), a === "bottom_nav" && /* @__PURE__ */ R(Ye, {
893
- items: j,
909
+ }), a === "bottom_nav" && /* @__PURE__ */ z(Xe, {
910
+ items: M,
894
911
  basePath: t
895
912
  })] });
896
913
  }
897
914
  //#endregion
898
- //#region src/Page.tsx
899
- var Qe = (e) => e ? Array.isArray(e) ? e : [e] : [];
900
- function $e({ schema: e, className: t, style: n, id: r, ...i }) {
901
- let a = Qe(e.children);
902
- return /* @__PURE__ */ z("div", {
903
- id: r || e.id,
904
- className: A("flex flex-col h-full space-y-4", t),
905
- style: n,
906
- children: [/* @__PURE__ */ R(G, {
907
- title: e.title,
908
- description: e.description
909
- }), /* @__PURE__ */ R("div", {
910
- className: "flex-1 overflow-auto",
911
- children: a.map((e, t) => /* @__PURE__ */ R(L, {
912
- schema: e,
913
- ...i
914
- }, e?.id || t))
915
- })]
916
- });
917
- }
918
- //#endregion
919
915
  //#region src/SidebarNav.tsx
920
- function et(e) {
916
+ function $e(e) {
921
917
  return "items" in e && !("href" in e);
922
918
  }
923
- function tt({ item: e, pathname: t }) {
924
- return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
919
+ function et({ item: e, pathname: t }) {
920
+ return e.children && e.children.length > 0 ? /* @__PURE__ */ z(s, {
925
921
  asChild: !0,
926
922
  defaultOpen: !0,
927
923
  className: "group/collapsible",
928
- children: /* @__PURE__ */ z(T, { children: [/* @__PURE__ */ R(l, {
924
+ children: /* @__PURE__ */ B(T, { children: [/* @__PURE__ */ z(l, {
929
925
  asChild: !0,
930
- children: /* @__PURE__ */ z(w, {
926
+ children: /* @__PURE__ */ B(w, {
931
927
  tooltip: e.title,
932
928
  className: "motion-safe:transition-colors motion-safe:duration-150",
933
929
  children: [
934
- e.icon && /* @__PURE__ */ R(e.icon, {}),
935
- /* @__PURE__ */ R("span", { children: e.title }),
936
- e.badge != null && /* @__PURE__ */ R(a, {
930
+ e.icon && /* @__PURE__ */ z(e.icon, {}),
931
+ /* @__PURE__ */ z("span", { children: e.title }),
932
+ e.badge != null && /* @__PURE__ */ z(a, {
937
933
  variant: e.badgeVariant || "default",
938
934
  className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
939
935
  children: e.badge
940
936
  }),
941
- /* @__PURE__ */ R(P, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
937
+ /* @__PURE__ */ z(P, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
942
938
  ]
943
939
  })
944
- }), /* @__PURE__ */ R(c, {
940
+ }), /* @__PURE__ */ z(c, {
945
941
  className: "motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:slide-out-to-top-1 motion-safe:data-[state=open]:slide-in-from-top-1 motion-safe:duration-150",
946
- children: /* @__PURE__ */ R(E, { children: e.children.map((e) => /* @__PURE__ */ R(O, { children: /* @__PURE__ */ R(D, {
942
+ children: /* @__PURE__ */ z(E, { children: e.children.map((e) => /* @__PURE__ */ z(O, { children: /* @__PURE__ */ z(D, {
947
943
  asChild: !0,
948
944
  isActive: t === e.href,
949
945
  className: "motion-safe:transition-colors motion-safe:duration-150",
950
- children: /* @__PURE__ */ z(B, {
946
+ children: /* @__PURE__ */ B(V, {
951
947
  to: e.href,
952
948
  children: [
953
- e.icon && /* @__PURE__ */ R(e.icon, {}),
954
- /* @__PURE__ */ R("span", { children: e.title }),
955
- e.badge != null && /* @__PURE__ */ R(a, {
949
+ e.icon && /* @__PURE__ */ z(e.icon, {}),
950
+ /* @__PURE__ */ z("span", { children: e.title }),
951
+ e.badge != null && /* @__PURE__ */ z(a, {
956
952
  variant: e.badgeVariant || "default",
957
953
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
958
954
  children: e.badge
@@ -961,17 +957,17 @@ function tt({ item: e, pathname: t }) {
961
957
  })
962
958
  }) }, e.href)) })
963
959
  })] })
964
- }) : /* @__PURE__ */ R(T, { children: /* @__PURE__ */ R(w, {
960
+ }) : /* @__PURE__ */ z(T, { children: /* @__PURE__ */ z(w, {
965
961
  asChild: !0,
966
962
  isActive: t === e.href,
967
963
  tooltip: e.title,
968
964
  className: "motion-safe:transition-colors motion-safe:duration-150",
969
- children: /* @__PURE__ */ z(B, {
965
+ children: /* @__PURE__ */ B(V, {
970
966
  to: e.href,
971
967
  children: [
972
- e.icon && /* @__PURE__ */ R(e.icon, {}),
973
- /* @__PURE__ */ R("span", { children: e.title }),
974
- e.badge != null && /* @__PURE__ */ R(a, {
968
+ e.icon && /* @__PURE__ */ z(e.icon, {}),
969
+ /* @__PURE__ */ z("span", { children: e.title }),
970
+ e.badge != null && /* @__PURE__ */ z(a, {
975
971
  variant: e.badgeVariant || "default",
976
972
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
977
973
  children: e.badge
@@ -980,8 +976,8 @@ function tt({ item: e, pathname: t }) {
980
976
  })
981
977
  }) });
982
978
  }
983
- function nt({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
984
- let s = V(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : et(e[0]) ? e.map((e) => ({
979
+ function tt({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
980
+ let s = H(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : $e(e[0]) ? e.map((e) => ({
985
981
  groupLabel: e.label,
986
982
  items: e.items
987
983
  })) : [{ items: e }], [e]), f = t.useMemo(() => {
@@ -992,14 +988,14 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
992
988
  items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
993
989
  })).filter((e) => e.items.length > 0);
994
990
  }, [d, c]);
995
- return /* @__PURE__ */ R(p, {
991
+ return /* @__PURE__ */ z(p, {
996
992
  className: r,
997
993
  collapsible: i,
998
- children: /* @__PURE__ */ z(m, { children: [a && /* @__PURE__ */ R("div", {
994
+ children: /* @__PURE__ */ B(m, { children: [a && /* @__PURE__ */ z("div", {
999
995
  className: "px-3 py-2",
1000
- children: /* @__PURE__ */ z("div", {
996
+ children: /* @__PURE__ */ B("div", {
1001
997
  className: "relative",
1002
- children: [/* @__PURE__ */ R(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ R(u, {
998
+ children: [/* @__PURE__ */ z(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ z(u, {
1003
999
  type: "search",
1004
1000
  placeholder: o,
1005
1001
  value: c,
@@ -1007,16 +1003,16 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
1007
1003
  className: "pl-8 h-9"
1008
1004
  })]
1009
1005
  })
1010
- }), f.map((e, t) => /* @__PURE__ */ z(g, { children: [
1011
- t > 0 && /* @__PURE__ */ R("div", {
1006
+ }), f.map((e, t) => /* @__PURE__ */ B(g, { children: [
1007
+ t > 0 && /* @__PURE__ */ z("div", {
1012
1008
  className: "mx-3 mb-1 h-px bg-sidebar-border/60",
1013
1009
  "aria-hidden": !0
1014
1010
  }),
1015
- /* @__PURE__ */ R(v, {
1011
+ /* @__PURE__ */ z(v, {
1016
1012
  className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
1017
1013
  children: e.groupLabel || n
1018
1014
  }),
1019
- /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(tt, {
1015
+ /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.items.map((e) => /* @__PURE__ */ z(et, {
1020
1016
  item: e,
1021
1017
  pathname: s.pathname
1022
1018
  }, e.href)) }) })
@@ -1025,29 +1021,31 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
1025
1021
  }
1026
1022
  //#endregion
1027
1023
  //#region src/index.ts
1028
- function rt() {
1029
- e.register("page-header", G, {
1024
+ function nt() {
1025
+ e.register("page-header", ge, {
1030
1026
  namespace: "layout",
1031
1027
  label: "Page Header",
1032
1028
  category: "Layout",
1033
1029
  inputs: [{
1034
1030
  name: "title",
1035
- type: "string"
1031
+ type: "string",
1032
+ label: "Title"
1036
1033
  }, {
1037
- name: "description",
1038
- type: "string"
1034
+ name: "subtitle",
1035
+ type: "string",
1036
+ label: "Subtitle"
1039
1037
  }]
1040
- }), e.register("page:card", we, {
1038
+ }), e.register("page:card", Se, {
1041
1039
  namespace: "layout",
1042
1040
  skipFallback: !0,
1043
1041
  label: "Page Card",
1044
1042
  category: "Layout",
1045
1043
  isContainer: !0
1046
- }), e.register("app-shell", K, {
1044
+ }), e.register("app-shell", J, {
1047
1045
  namespace: "layout",
1048
1046
  label: "App Shell",
1049
1047
  category: "Layout"
1050
- }), e.register("responsive-grid", Oe, {
1048
+ }), e.register("responsive-grid", Ee, {
1051
1049
  namespace: "layout",
1052
1050
  label: "Responsive Grid",
1053
1051
  category: "Layout",
@@ -1070,7 +1068,7 @@ function rt() {
1070
1068
  name: "basePath",
1071
1069
  type: "string"
1072
1070
  }]
1073
- }), e.register("app-schema-renderer", Ze, {
1071
+ }), e.register("app-schema-renderer", Qe, {
1074
1072
  namespace: "layout",
1075
1073
  label: "App Schema Renderer",
1076
1074
  category: "Layout",
@@ -1092,7 +1090,7 @@ function rt() {
1092
1090
  });
1093
1091
  }
1094
1092
  try {
1095
- rt();
1093
+ nt();
1096
1094
  } catch {}
1097
1095
  //#endregion
1098
- export { Ze as AppSchemaRenderer, K as AppShell, $ as NavigationRenderer, $e as Page, we as PageCard, G as PageHeader, Oe as ResponsiveGrid, nt as SidebarNav, We as filterNavigationItems, rt as registerLayout, Ue as resolveActiveNavItem, X as resolveHref, q as resolveIcon, J as resolveLabel, Ce as useAppShellBranding };
1096
+ export { Qe as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Se as PageCard, ge as PageHeader, Ee as ResponsiveGrid, tt as SidebarNav, Ge as filterNavigationItems, je as hasVisibleNavigationItems, nt as registerLayout, Ue as resolveActiveNavItem, Ne as resolveHref, Y as resolveIcon, X as resolveLabel, xe as useAppShellBranding };