@object-ui/layout 4.4.0 → 4.6.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/CHANGELOG.md +37 -0
- package/dist/index.js +63 -61
- package/dist/index.umd.cjs +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @object-ui/layout
|
|
2
2
|
|
|
3
|
+
## 4.6.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3ee436d]
|
|
8
|
+
- @object-ui/components@4.6.0
|
|
9
|
+
- @object-ui/types@4.6.0
|
|
10
|
+
- @object-ui/core@4.6.0
|
|
11
|
+
- @object-ui/react@4.6.0
|
|
12
|
+
|
|
13
|
+
## 4.5.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- d714e85: Lookup display-name resolution now falls back through a Salesforce-style chain
|
|
18
|
+
when an `$expand`'d reference object lacks a top-level `name`/`label`/
|
|
19
|
+
`display_name`/`title` field:
|
|
20
|
+
1. Standard display fields (existing behaviour)
|
|
21
|
+
2. `salutation first_name last_name` composite — handles person records that
|
|
22
|
+
only carry first/last name parts
|
|
23
|
+
3. `email` — last-resort identifier, beats the opaque id
|
|
24
|
+
|
|
25
|
+
Applies to `LookupCellRenderer`, `PageHeader.subtitle` interpolation,
|
|
26
|
+
`DetailView` page-mode `titleFormat`, and the shared `formatRecordTitle`
|
|
27
|
+
utility. Concretely: a Contact reference with `first_name: Bob`, `last_name:
|
|
28
|
+
Lin` and no `name` field now renders as `Bob Lin` everywhere — instead of
|
|
29
|
+
the email or [object Object] fallback.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [ab5e281]
|
|
32
|
+
- Updated dependencies [6b6afd1]
|
|
33
|
+
- Updated dependencies [aa7855f]
|
|
34
|
+
- Updated dependencies [170d89f]
|
|
35
|
+
- @object-ui/types@4.5.0
|
|
36
|
+
- @object-ui/components@4.5.0
|
|
37
|
+
- @object-ui/core@4.5.0
|
|
38
|
+
- @object-ui/react@4.5.0
|
|
39
|
+
|
|
3
40
|
## 4.4.0
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -10,45 +10,47 @@ import { SortableContext as me, arrayMove as he, useSortable as ge, verticalList
|
|
|
10
10
|
import { CSS as ve } from "@dnd-kit/utilities";
|
|
11
11
|
import { menuItemToNavigationItem as ye } from "@object-ui/types";
|
|
12
12
|
//#region src/PageHeader.tsx
|
|
13
|
-
var
|
|
13
|
+
var be = (e) => {
|
|
14
|
+
let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
|
|
15
|
+
return t != null && String(t).trim() ? String(t) : [
|
|
16
|
+
e?.salutation,
|
|
17
|
+
e?.first_name,
|
|
18
|
+
e?.last_name
|
|
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
|
+
}, V = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
|
|
14
21
|
let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let e = r.name ?? r.label ?? r.display_name ?? r.title;
|
|
18
|
-
return e == null ? "" : String(e);
|
|
19
|
-
}
|
|
20
|
-
return String(r);
|
|
21
|
-
}).replace(/\s+/g, " ").trim() : e;
|
|
22
|
+
return r == null ? "" : typeof r == "object" ? be(r) ?? "" : String(r);
|
|
23
|
+
}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
|
|
22
24
|
function H({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
|
|
23
|
-
let m = ae(), h = V(e, m?.data) || e,
|
|
25
|
+
let m = ae(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = V(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = V(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
|
|
24
26
|
if (typeof window > "u") return;
|
|
25
27
|
let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
|
|
26
28
|
t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
27
|
-
}, []),
|
|
29
|
+
}, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ R(I, { 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(I, { schema: {
|
|
28
30
|
type: "record:quick_actions",
|
|
29
31
|
properties: {
|
|
30
|
-
actions:
|
|
32
|
+
actions: T,
|
|
31
33
|
location: "record_header",
|
|
32
34
|
align: "end",
|
|
33
35
|
inline: !0
|
|
34
36
|
}
|
|
35
|
-
} }) : null) ||
|
|
37
|
+
} }) : null) || w;
|
|
36
38
|
return /* @__PURE__ */ R("div", {
|
|
37
39
|
className: A("flex flex-col gap-3 pb-4 border-b", u),
|
|
38
40
|
...p,
|
|
39
41
|
children: /* @__PURE__ */ z("div", {
|
|
40
42
|
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
41
43
|
children: [
|
|
42
|
-
|
|
44
|
+
S && /* @__PURE__ */ R(o, {
|
|
43
45
|
type: "button",
|
|
44
46
|
variant: "ghost",
|
|
45
47
|
size: "icon",
|
|
46
|
-
onClick:
|
|
48
|
+
onClick: C,
|
|
47
49
|
"aria-label": "Back to list",
|
|
48
50
|
className: "flex-shrink-0 -ml-2",
|
|
49
51
|
children: /* @__PURE__ */ R(M, { className: "size-4" })
|
|
50
52
|
}),
|
|
51
|
-
i && /* @__PURE__ */ R("div", {
|
|
53
|
+
i && (g || y) && /* @__PURE__ */ R("div", {
|
|
52
54
|
className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
|
|
53
55
|
children: typeof i == "string" ? /* @__PURE__ */ R(d, {
|
|
54
56
|
name: i,
|
|
@@ -57,17 +59,17 @@ function H({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
|
|
|
57
59
|
}),
|
|
58
60
|
/* @__PURE__ */ z("div", {
|
|
59
61
|
className: "flex flex-col min-w-0 flex-1",
|
|
60
|
-
children: [/* @__PURE__ */ R("h1", {
|
|
62
|
+
children: [g ? /* @__PURE__ */ R("h1", {
|
|
61
63
|
className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
|
|
62
|
-
children:
|
|
63
|
-
}),
|
|
64
|
+
children: g
|
|
65
|
+
}) : null, y && /* @__PURE__ */ R("p", {
|
|
64
66
|
className: "text-sm text-muted-foreground truncate",
|
|
65
|
-
children:
|
|
67
|
+
children: y
|
|
66
68
|
})]
|
|
67
69
|
}),
|
|
68
|
-
|
|
70
|
+
E && /* @__PURE__ */ R("div", {
|
|
69
71
|
className: "flex items-center gap-2 ml-auto",
|
|
70
|
-
children:
|
|
72
|
+
children: E
|
|
71
73
|
})
|
|
72
74
|
]
|
|
73
75
|
})
|
|
@@ -118,7 +120,7 @@ function K(e) {
|
|
|
118
120
|
}, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
|
|
119
121
|
return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
|
|
120
122
|
}
|
|
121
|
-
function
|
|
123
|
+
function xe(e, t) {
|
|
122
124
|
n(() => {
|
|
123
125
|
let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
|
|
124
126
|
if (e?.primaryColor) {
|
|
@@ -155,7 +157,7 @@ function be(e, t) {
|
|
|
155
157
|
]);
|
|
156
158
|
}
|
|
157
159
|
function q({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a }) {
|
|
158
|
-
return
|
|
160
|
+
return xe(a, a?.title), /* @__PURE__ */ z(k, {
|
|
159
161
|
defaultOpen: i,
|
|
160
162
|
className: "!flex-col h-svh overflow-hidden",
|
|
161
163
|
children: [/* @__PURE__ */ R("header", {
|
|
@@ -175,7 +177,7 @@ function q({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
|
|
|
175
177
|
}
|
|
176
178
|
//#endregion
|
|
177
179
|
//#region src/PageCard.tsx
|
|
178
|
-
function
|
|
180
|
+
function Se({ className: e, children: t, ...n }) {
|
|
179
181
|
return /* @__PURE__ */ R("div", {
|
|
180
182
|
className: A("rounded-xl border bg-card text-card-foreground shadow", e),
|
|
181
183
|
...n,
|
|
@@ -187,7 +189,7 @@ function xe({ className: e, children: t, ...n }) {
|
|
|
187
189
|
}
|
|
188
190
|
//#endregion
|
|
189
191
|
//#region src/ResponsiveGrid.tsx
|
|
190
|
-
var
|
|
192
|
+
var Ce = {
|
|
191
193
|
xs: {
|
|
192
194
|
1: "grid-cols-1",
|
|
193
195
|
2: "grid-cols-2",
|
|
@@ -237,11 +239,11 @@ var Se = {
|
|
|
237
239
|
12: "2xl:grid-cols-12"
|
|
238
240
|
}
|
|
239
241
|
};
|
|
240
|
-
function
|
|
242
|
+
function we(e) {
|
|
241
243
|
if (!e) return "grid-cols-1";
|
|
242
244
|
let t = [];
|
|
243
245
|
for (let [n, r] of Object.entries(e)) {
|
|
244
|
-
let e =
|
|
246
|
+
let e = Ce[n];
|
|
245
247
|
if (e && r) {
|
|
246
248
|
let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
|
|
247
249
|
t.push(e[n]);
|
|
@@ -249,7 +251,7 @@ function Ce(e) {
|
|
|
249
251
|
}
|
|
250
252
|
return t.join(" ") || "grid-cols-1";
|
|
251
253
|
}
|
|
252
|
-
var
|
|
254
|
+
var Te = {
|
|
253
255
|
0: "gap-0",
|
|
254
256
|
1: "gap-1",
|
|
255
257
|
2: "gap-2",
|
|
@@ -258,8 +260,8 @@ var we = {
|
|
|
258
260
|
5: "gap-5",
|
|
259
261
|
6: "gap-6",
|
|
260
262
|
8: "gap-8"
|
|
261
|
-
},
|
|
262
|
-
className: A("grid",
|
|
263
|
+
}, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
|
|
264
|
+
className: A("grid", we(e), typeof t == "number" ? Te[t] || `gap-${t}` : "", n),
|
|
263
265
|
children: r
|
|
264
266
|
});
|
|
265
267
|
//#endregion
|
|
@@ -282,8 +284,8 @@ function X(e, t, n, r, i) {
|
|
|
282
284
|
let a = Y(e.label, n);
|
|
283
285
|
return typeof e.label == "string" ? t && e.type === "object" && e.objectName ? t(e.objectName, a) : r && e.type === "dashboard" && e.dashboardName ? r(e.dashboardName, a) : i && e.type === "group" && e.id ? i(e.id, a) : a : a;
|
|
284
286
|
}
|
|
285
|
-
var
|
|
286
|
-
function
|
|
287
|
+
var De = (e) => !(e === !1 || e === "false"), Oe = () => !0, ke = () => !0;
|
|
288
|
+
function Ae(e, t) {
|
|
287
289
|
switch (e.type) {
|
|
288
290
|
case "object": {
|
|
289
291
|
let n = `${t}/${e.objectName ?? ""}`;
|
|
@@ -329,8 +331,8 @@ function Z(e, t) {
|
|
|
329
331
|
return Y(r.label).toLowerCase().includes(n) && e.push(r), e;
|
|
330
332
|
}, []);
|
|
331
333
|
}
|
|
332
|
-
var
|
|
333
|
-
function
|
|
334
|
+
var je = 5;
|
|
335
|
+
function Me({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, t: f }) {
|
|
334
336
|
let { attributes: p, listeners: m, setNodeRef: h, transform: g, transition: _, isDragging: v } = ge({
|
|
335
337
|
id: e.id,
|
|
336
338
|
disabled: !c
|
|
@@ -427,7 +429,7 @@ function Q({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: o, onActi
|
|
|
427
429
|
})
|
|
428
430
|
] });
|
|
429
431
|
}
|
|
430
|
-
let j = J(e.icon), { href: M, external: N } =
|
|
432
|
+
let j = J(e.icon), { href: M, external: N } = Ae(e, t), ne = M !== "#" && E.pathname.startsWith(M), P = X(e, h, x, y, b), F = /* @__PURE__ */ z(L, { children: [
|
|
431
433
|
/* @__PURE__ */ R(j, { className: "h-4 w-4" }),
|
|
432
434
|
/* @__PURE__ */ R("span", { children: P }),
|
|
433
435
|
e.badge != null && /* @__PURE__ */ R(a, {
|
|
@@ -468,8 +470,8 @@ function Q({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: o, onActi
|
|
|
468
470
|
})
|
|
469
471
|
] });
|
|
470
472
|
}
|
|
471
|
-
function $({ items: e, basePath: t = "", evaluateVisibility: n =
|
|
472
|
-
let y = r(() => s ? Z(e, s) : e, [e, s]), b = r(() =>
|
|
473
|
+
function $({ items: e, basePath: t = "", evaluateVisibility: n = De, checkPermission: i = Oe, checkCapability: a = ke, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, t: h }) {
|
|
474
|
+
let y = r(() => s ? Z(e, s) : e, [e, s]), b = r(() => Ne(y), [y]), x = y.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), C = pe(fe(ue, { activationConstraint: { distance: je } }), fe(le)), w = (e) => {
|
|
473
475
|
let { active: t, over: n } = e;
|
|
474
476
|
if (!n || t.id === n.id || !d) return;
|
|
475
477
|
let r = x.findIndex((e) => e.id === t.id), i = x.findIndex((e) => e.id === n.id);
|
|
@@ -505,7 +507,7 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Ee, checkPermis
|
|
|
505
507
|
children: /* @__PURE__ */ R(me, {
|
|
506
508
|
items: e,
|
|
507
509
|
strategy: _e,
|
|
508
|
-
children: /* @__PURE__ */ R(S, { children: x.map((e) => /* @__PURE__ */ R(
|
|
510
|
+
children: /* @__PURE__ */ R(S, { children: x.map((e) => /* @__PURE__ */ R(Me, {
|
|
509
511
|
item: e,
|
|
510
512
|
enableReorder: u,
|
|
511
513
|
...T
|
|
@@ -531,14 +533,14 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Ee, checkPermis
|
|
|
531
533
|
}, e.id))) : k.push(e);
|
|
532
534
|
}), A("leaf-end"), /* @__PURE__ */ z(L, { children: [D, O] });
|
|
533
535
|
}
|
|
534
|
-
function
|
|
536
|
+
function Ne(e) {
|
|
535
537
|
let t = [];
|
|
536
|
-
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...
|
|
538
|
+
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Ne(n.children));
|
|
537
539
|
return t;
|
|
538
540
|
}
|
|
539
541
|
//#endregion
|
|
540
542
|
//#region src/AppSchemaRenderer.tsx
|
|
541
|
-
function
|
|
543
|
+
function Pe({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
|
|
542
544
|
let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
|
|
543
545
|
return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
544
546
|
className: "flex items-center gap-1.5",
|
|
@@ -553,7 +555,7 @@ function Ne({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm:
|
|
|
553
555
|
}) }, e.id);
|
|
554
556
|
}) }) })] });
|
|
555
557
|
}
|
|
556
|
-
function
|
|
558
|
+
function Fe({ items: e, basePath: t }) {
|
|
557
559
|
let n = B(), r = (e) => {
|
|
558
560
|
let t = [];
|
|
559
561
|
for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
|
|
@@ -578,7 +580,7 @@ function Pe({ items: e, basePath: t }) {
|
|
|
578
580
|
})
|
|
579
581
|
});
|
|
580
582
|
}
|
|
581
|
-
function
|
|
583
|
+
function Ie({ 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 }) {
|
|
582
584
|
let E = J(e.logo), D = e.areas ?? [], [O, k] = i("");
|
|
583
585
|
return /* @__PURE__ */ z(p, {
|
|
584
586
|
collapsible: "icon",
|
|
@@ -610,7 +612,7 @@ function Fe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
610
612
|
"aria-label": "Search navigation"
|
|
611
613
|
})] }),
|
|
612
614
|
/* @__PURE__ */ z(m, { children: [
|
|
613
|
-
D.length > 1 && u && /* @__PURE__ */ R(
|
|
615
|
+
D.length > 1 && u && /* @__PURE__ */ R(Pe, {
|
|
614
616
|
areas: D,
|
|
615
617
|
activeAreaId: u,
|
|
616
618
|
onAreaChange: d,
|
|
@@ -636,7 +638,7 @@ function Fe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
636
638
|
]
|
|
637
639
|
});
|
|
638
640
|
}
|
|
639
|
-
function
|
|
641
|
+
function Le({ 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 }) {
|
|
640
642
|
let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => ye(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(",");
|
|
641
643
|
n(() => {
|
|
642
644
|
D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
|
|
@@ -647,7 +649,7 @@ function Ie({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
647
649
|
logo: e.logo
|
|
648
650
|
};
|
|
649
651
|
return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(q, {
|
|
650
|
-
sidebar: /* @__PURE__ */ R(
|
|
652
|
+
sidebar: /* @__PURE__ */ R(Ie, {
|
|
651
653
|
schema: e,
|
|
652
654
|
basePath: t,
|
|
653
655
|
evalVis: S,
|
|
@@ -671,16 +673,16 @@ function Ie({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
671
673
|
defaultOpen: g,
|
|
672
674
|
branding: M,
|
|
673
675
|
children: m
|
|
674
|
-
}), a === "bottom_nav" && /* @__PURE__ */ R(
|
|
676
|
+
}), a === "bottom_nav" && /* @__PURE__ */ R(Fe, {
|
|
675
677
|
items: j,
|
|
676
678
|
basePath: t
|
|
677
679
|
})] });
|
|
678
680
|
}
|
|
679
681
|
//#endregion
|
|
680
682
|
//#region src/Page.tsx
|
|
681
|
-
var
|
|
682
|
-
function
|
|
683
|
-
let a =
|
|
683
|
+
var Re = (e) => e ? Array.isArray(e) ? e : [e] : [];
|
|
684
|
+
function ze({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
685
|
+
let a = Re(e.children);
|
|
684
686
|
return /* @__PURE__ */ z("div", {
|
|
685
687
|
id: r || e.id,
|
|
686
688
|
className: A("flex flex-col h-full space-y-4", t),
|
|
@@ -699,10 +701,10 @@ function Re({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
|
699
701
|
}
|
|
700
702
|
//#endregion
|
|
701
703
|
//#region src/SidebarNav.tsx
|
|
702
|
-
function
|
|
704
|
+
function Be(e) {
|
|
703
705
|
return "items" in e && !("href" in e);
|
|
704
706
|
}
|
|
705
|
-
function
|
|
707
|
+
function Ve({ item: e, pathname: t }) {
|
|
706
708
|
return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
|
|
707
709
|
asChild: !0,
|
|
708
710
|
defaultOpen: !0,
|
|
@@ -756,8 +758,8 @@ function Be({ item: e, pathname: t }) {
|
|
|
756
758
|
})
|
|
757
759
|
}) });
|
|
758
760
|
}
|
|
759
|
-
function
|
|
760
|
-
let s = B(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] :
|
|
761
|
+
function He({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search..." }) {
|
|
762
|
+
let s = B(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Be(e[0]) ? e.map((e) => ({
|
|
761
763
|
groupLabel: e.label,
|
|
762
764
|
items: e.items
|
|
763
765
|
})) : [{ items: e }], [e]), f = t.useMemo(() => {
|
|
@@ -792,7 +794,7 @@ function Ve({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
792
794
|
className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
|
|
793
795
|
children: e.groupLabel || n
|
|
794
796
|
}),
|
|
795
|
-
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(
|
|
797
|
+
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(Ve, {
|
|
796
798
|
item: e,
|
|
797
799
|
pathname: s.pathname
|
|
798
800
|
}, e.href)) }) })
|
|
@@ -801,7 +803,7 @@ function Ve({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
801
803
|
}
|
|
802
804
|
//#endregion
|
|
803
805
|
//#region src/index.ts
|
|
804
|
-
function
|
|
806
|
+
function Ue() {
|
|
805
807
|
e.register("page-header", H, {
|
|
806
808
|
namespace: "layout",
|
|
807
809
|
label: "Page Header",
|
|
@@ -813,7 +815,7 @@ function He() {
|
|
|
813
815
|
name: "description",
|
|
814
816
|
type: "string"
|
|
815
817
|
}]
|
|
816
|
-
}), e.register("page:header", H, { namespace: "layout" }), e.register("page:card",
|
|
818
|
+
}), e.register("page:header", H, { namespace: "layout" }), e.register("page:card", Se, {
|
|
817
819
|
namespace: "layout",
|
|
818
820
|
label: "Page Card",
|
|
819
821
|
category: "Layout",
|
|
@@ -822,7 +824,7 @@ function He() {
|
|
|
822
824
|
namespace: "layout",
|
|
823
825
|
label: "App Shell",
|
|
824
826
|
category: "Layout"
|
|
825
|
-
}), e.register("responsive-grid",
|
|
827
|
+
}), e.register("responsive-grid", Ee, {
|
|
826
828
|
namespace: "layout",
|
|
827
829
|
label: "Responsive Grid",
|
|
828
830
|
category: "Layout",
|
|
@@ -845,7 +847,7 @@ function He() {
|
|
|
845
847
|
name: "basePath",
|
|
846
848
|
type: "string"
|
|
847
849
|
}]
|
|
848
|
-
}), e.register("app-schema-renderer",
|
|
850
|
+
}), e.register("app-schema-renderer", Le, {
|
|
849
851
|
namespace: "layout",
|
|
850
852
|
label: "App Schema Renderer",
|
|
851
853
|
category: "Layout",
|
|
@@ -867,7 +869,7 @@ function He() {
|
|
|
867
869
|
});
|
|
868
870
|
}
|
|
869
871
|
try {
|
|
870
|
-
|
|
872
|
+
Ue();
|
|
871
873
|
} catch {}
|
|
872
874
|
//#endregion
|
|
873
|
-
export {
|
|
875
|
+
export { Le as AppSchemaRenderer, q as AppShell, $ as NavigationRenderer, ze as Page, Se as PageCard, H as PageHeader, Ee as ResponsiveGrid, He as SidebarNav, Z as filterNavigationItems, Ue as registerLayout, J as resolveIcon, Y as resolveLabel, xe as useAppShellBranding };
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`),require(`@object-ui/react`),require(`react/jsx-runtime`),require(`react-router-dom`),require(`@dnd-kit/core`),require(`@dnd-kit/sortable`),require(`@dnd-kit/utilities`),require(`@object-ui/types`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/react`,`react/jsx-runtime`,`react-router-dom`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.lucide_react,e._object_ui_react,e.react_jsx_runtime,e.react_router_dom,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y=(e,t)=>!e||typeof e!=`string`?e??``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>e==null?e:e[t],t);if(r==null)return``;if(typeof r==`object`){let e=r.name??r.label??r.display_name??r.title;return e==null?``:String(e)}return String(r)}).replace(/\s+/g,` `).trim():e;function b({title:e,subtitle:t,description:s,icon:c,action:l,actions:u,showBack:d,schema:f,className:p,children:m,...h}){let g=(0,a.useRecordContext)(),_=y(e,g?.data)||e,v=t??s,b=y(v,g?.data)||v,x=!!g?.recordId,S=d??x,C=n.default.useCallback(()=>{if(typeof window>`u`)return;let e=window.location.pathname,t=e.replace(/\/record\/[^/]+\/?$/,``);t===e?window.history.length>1&&window.history.back():(window.history.pushState({},``,t+window.location.search),window.dispatchEvent(new PopStateEvent(`popstate`)))},[]),w=Array.isArray(f?.children)?f.children.filter(Boolean).map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e},e?.id||`pgh-child-${t}`)):null,T=Array.isArray(u)&&u.length>0&&u||Array.isArray(f?.actions)&&f.actions.length>0&&f.actions||Array.isArray(f?.properties?.actions)&&f.properties.actions.length>0&&f.properties.actions||null,E=l||m||(T?(0,o.jsx)(a.SchemaRenderer,{schema:{type:`record:quick_actions`,properties:{actions:T,location:`record_header`,align:`end`,inline:!0}}}):null)||w;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-3 pb-4 border-b`,p),...h,children:(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[S&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,onClick:C,"aria-label":`Back to list`,className:`flex-shrink-0 -ml-2`,children:(0,o.jsx)(i.ArrowLeft,{className:`size-4`})}),c&&(0,o.jsx)(`div`,{className:`flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary`,children:typeof c==`string`?(0,o.jsx)(r.LazyIcon,{name:c,className:`size-5`}):c}),(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,o.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:_}),b&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:b})]}),E&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:E})]})})}function x(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;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;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function S(e){let t=x(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function C(e){let t=x(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function w(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function T(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=S(e.primaryColor),i=C(e.primaryColor),a=r()&&i||t;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%`:w(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}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`);if(e?.accentColor){let t=S(e.accentColor),i=C(e.accentColor),a=r()&&i||t;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%`:w(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function E({sidebar:e,navbar:t,children:n,className:i,defaultOpen:a=!0,branding:s}){return T(s,s?.title),(0,o.jsxs)(r.SidebarProvider,{defaultOpen:a,className:`!flex-col h-svh overflow-hidden`,children:[(0,o.jsx)(`header`,{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`,children:t}),(0,o.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,o.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,o.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,i),children:n})})]})]})}function D({className:e,children:t,...n}){return(0,o.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,o.jsx)(`div`,{className:`p-6`,children:t})})}var O={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function k(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=O[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var A={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},j=({columns:e,gap:t=4,className:n,children:i})=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid`,k(e),typeof t==`number`?A[t]||`gap-${t}`:``,n),children:i});function M(e){return e?(0,r.getLazyIcon)(e):i.FileText}function N(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function P(e,t,n,r,i){let a=N(e.label,n);return typeof e.label==`string`?t&&e.type===`object`&&e.objectName?t(e.objectName,a):r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,a):i&&e.type===`group`&&e.id?i(e.id,a):a:a}var F=e=>!(e===!1||e===`false`),I=()=>!0,L=()=>!0;function R(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};default:return{href:`#`,external:!1}}}function z(e,t){if(!t.trim())return e;let n=t.toLowerCase().trim();return e.reduce((e,r)=>{if(r.type===`separator`)return e;if(r.type===`group`&&r.children?.length){let n=z(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return N(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var B=5;function V({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h}){let{attributes:g,listeners:_,setNodeRef:v,transform:y,transition:b,isDragging:x}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:v,style:{transform:u.CSS.Transform.toString(y),transition:b,opacity:x?.5:void 0,zIndex:x?10:void 0},...g,children:(0,o.jsx)(H,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?_:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h})})}function H({item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_}){let v=(0,s.useLocation)(),[y,b]=(0,n.useState)(e.defaultOpen!==!1);if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let x=e.requiresObject,S=e.requiresService;if(x&&!l(`object`,x)||S&&!l(`service`,S))return null;if(e.type===`separator`)return(0,o.jsx)(r.Separator,{className:`my-2`});if(e.type===`group`){let n=(e.children??[]).slice().sort((e,t)=>(e.order??0)-(t.order??0));return(0,o.jsx)(r.Collapsible,{open:y,onOpenChange:b,children:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,o.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[P(e,m,_,h,g),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${y?`rotate-90`:``}`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:n.map(e=>(0,o.jsx)(H,{item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_},e.id))})})})]})})}if(e.type===`action`){let t=M(e.icon),n=N(e.label,_);return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsxs)(r.SidebarMenuButton,{tooltip:n,onClick:()=>u?.(e),children:[(0,o.jsx)(t,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:n}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${n}`:`Pin ${n}`,name:n}):e.pinned?`Unpin ${n}`:`Pin ${n}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}let C=M(e.icon),{href:w,external:T}=R(e,t),E=w!==`#`&&v.pathname.startsWith(w),D=P(e,m,_,h,g),O=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(C,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:D}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:E,tooltip:D,children:T?(0,o.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,children:O}):(0,o.jsx)(s.Link,{to:w,children:O})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${D}`:`Pin ${D}`,name:D}):e.pinned?`Unpin ${D}`:`Pin ${D}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}function U({items:e,basePath:t=``,evaluateVisibility:a=F,checkPermission:s=I,checkCapability:u=L,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b}){let x=(0,n.useMemo)(()=>f?z(e,f):e,[e,f]),S=(0,n.useMemo)(()=>W(x),[x]),C=x.slice().sort((e,t)=>(e.order??0)-(t.order??0)),w=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:B}}),(0,c.useSensor)(c.KeyboardSensor)),T=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=C.findIndex(e=>e.id===t.id),i=C.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(C,r,i).map((e,t)=>({...e,order:t})))},E={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b},D=C.some(e=>e.type===`group`),O=S.length>0&&p?(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Star,{className:`h-3.5 w-3.5`}),b?b(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:S.map(e=>(0,o.jsx)(H,{item:e,...E},`fav-${e.id}`))})})]}):null;if(!D){let e=C.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[O,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:w,collisionDetection:c.closestCenter,onDragEnd:T,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(V,{item:e,enableReorder:h,...E},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(H,{item:e,...E},e.id))})})})]})}let k=[],A=[],j=e=>{if(A.length===0)return;let t=A;A=[],k.push((0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:t.map(e=>(0,o.jsx)(H,{item:e,...E},e.id))})})},e))};return C.forEach((e,t)=>{e.type===`group`?(j(`leaf-${t}`),k.push((0,o.jsx)(H,{item:e,...E},e.id))):A.push(e)}),j(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[O,k]})}function W(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...W(n.children));return t}function G({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:c.map(e=>{let i=M(e.icon);return(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:N(e.label),onClick:()=>n(e.id),children:[(0,o.jsx)(i,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:N(e.label)})]})},e.id)})})})]})}function K({items:e,basePath:t}){let n=(0,s.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},i=r(e).slice(0,5);return i.length===0?null:(0,o.jsx)(`div`,{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`,role:`navigation`,"aria-label":`Mobile navigation`,children:i.map(e=>{let r=M(e.icon),i=`#`;e.type===`object`?(i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`)):e.type===`dashboard`?i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`:e.type===`page`?i=e.pageName?`${t}/page/${e.pageName}`:`#`:e.type===`report`?i=e.reportName?`${t}/report/${e.reportName}`:`#`:e.type===`url`&&(i=e.url??`#`);let a=i!==`#`&&n.pathname.startsWith(i);return(0,o.jsxs)(s.Link,{to:i,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`}`,children:[(0,o.jsx)(r,{className:`h-5 w-5`}),(0,o.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:N(e.label)})]},e.id)})})}function q({schema:e,basePath:t,evalVis:i,checkPerm:a,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=M(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,o.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,o.jsxs)(r.SidebarHeader,{children:[l??(0,o.jsx)(r.SidebarMenu,{children:(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,o.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,o.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,o.jsx)(b,{className:`size-4`})}),(0,o.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,o.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,o.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,o.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,o.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,o.jsx)(G,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(U,{items:m,basePath:t,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,searchQuery:S,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}),d]}),u&&(0,o.jsx)(r.SidebarFooter,{children:u})]})}function J({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,navbar:l,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=i??(e=>!(e===!1||e===`false`)),C=a??(()=>!0),w=s??(()=>!0),T=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,d.menuItemToNavigationItem)(e,t)),[e.menu]),D=e.navigation??T,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??D,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(E,{sidebar:(0,o.jsx)(q,{schema:e,basePath:t,evalVis:S,checkPerm:C,checkCap:w,onAction:c,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,activeAreaId:k,setActiveAreaId:A,resolvedNavigation:M,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}),navbar:l,className:h,defaultOpen:g,branding:N,children:m}),r===`bottom_nav`&&(0,o.jsx)(K,{items:M,basePath:t})]})}var Y=e=>e?Array.isArray(e)?e:[e]:[];function X({schema:e,className:t,style:n,id:i,...s}){let c=Y(e.children);return(0,o.jsxs)(`div`,{id:i||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,o.jsx)(b,{title:e.title,description:e.description}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto`,children:c.map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e,...s},e?.id||t))})]})}function Z(e){return`items`in e&&!(`href`in e)}function Q({item:e,pathname:t}){return e.children&&e.children.length>0?(0,o.jsx)(r.Collapsible,{asChild:!0,defaultOpen:!0,className:`group/collapsible`,children:(0,o.jsxs)(r.SidebarMenuItem,{children:[(0,o.jsx)(r.CollapsibleTrigger,{asChild:!0,children:(0,o.jsxs)(r.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto mr-1 h-5 min-w-5 px-1 text-xs`,children:e.badge}),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarMenuSub,{children:e.children.map(e=>(0,o.jsx)(r.SidebarMenuSubItem,{children:(0,o.jsx)(r.SidebarMenuSubButton,{asChild:!0,isActive:t===e.href,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})},e.href))})})]})}):(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})})}function ee({items:e,title:t=`Application`,className:a,collapsible:c=`icon`,searchEnabled:l=!1,searchPlaceholder:u=`Search...`}){let d=(0,s.useLocation)(),[f,p]=n.default.useState(``),m=n.default.useMemo(()=>e.length===0?[]:Z(e[0])?e.map(e=>({groupLabel:e.label,items:e.items})):[{items:e}],[e]),h=n.default.useMemo(()=>{if(!f)return m;let e=f.toLowerCase();return m.map(t=>({...t,items:t.items.filter(t=>t.title.toLowerCase().includes(e)||t.children?.some(t=>t.title.toLowerCase().includes(e)))})).filter(e=>e.items.length>0)},[m,f]);return(0,o.jsx)(r.Sidebar,{className:a,collapsible:c,children:(0,o.jsxs)(r.SidebarContent,{children:[l&&(0,o.jsx)(`div`,{className:`px-3 py-2`,children:(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(r.Input,{type:`search`,placeholder:u,value:f,onChange:e=>p(e.target.value),className:`pl-8 h-9`})]})}),h.map((e,n)=>(0,o.jsxs)(r.SidebarGroup,{children:[n>0&&(0,o.jsx)(`div`,{className:`mx-3 mb-1 h-px bg-sidebar-border/60`,"aria-hidden":!0}),(0,o.jsx)(r.SidebarGroupLabel,{className:`text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60`,children:e.groupLabel||t}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:e.items.map(e=>(0,o.jsx)(Q,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,b,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:header`,b,{namespace:`layout`}),t.ComponentRegistry.register(`page:card`,D,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,E,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,j,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,U,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,J,{namespace:`layout`,label:`App Schema Renderer`,category:`Layout`,isContainer:!0,inputs:[{name:`schema`,type:`object`},{name:`basePath`,type:`string`},{name:`mobileNavMode`,type:`string`}]})}try{$()}catch{}e.AppSchemaRenderer=J,e.AppShell=E,e.NavigationRenderer=U,e.Page=X,e.PageCard=D,e.PageHeader=b,e.ResponsiveGrid=j,e.SidebarNav=ee,e.filterNavigationItems=z,e.registerLayout=$,e.resolveIcon=M,e.resolveLabel=N,e.useAppShellBranding=T});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`),require(`@object-ui/react`),require(`react/jsx-runtime`),require(`react-router-dom`),require(`@dnd-kit/core`),require(`@dnd-kit/sortable`),require(`@dnd-kit/utilities`),require(`@object-ui/types`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/react`,`react/jsx-runtime`,`react-router-dom`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.lucide_react,e._object_ui_react,e.react_jsx_runtime,e.react_router_dom,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y=e=>{let t=e?.name??e?.full_name??e?.display_name??e?.label??e?.title??e?.subject;return t!=null&&String(t).trim()?String(t):[e?.salutation,e?.first_name,e?.last_name].filter(e=>typeof e==`string`&&e.trim()).map(e=>e.trim()).join(` `)||(typeof e?.email==`string`&&e.email.trim()?e.email.trim():null)},b=(e,t)=>!e||typeof e!=`string`?e??``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>e==null?e:e[t],t);return r==null?``:typeof r==`object`?y(r)??``:String(r)}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g,``).replace(/^\s*[-–—|/·,:]\s*/,``).replace(/\s+/g,` `).trim():e;function x({title:e,subtitle:t,description:s,icon:c,action:l,actions:u,showBack:d,schema:f,className:p,children:m,...h}){let g=(0,a.useRecordContext)(),_=typeof e==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(e),v=b(e,g?.data)||(_?``:e),y=t??s,x=typeof y==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(y),S=b(y,g?.data)||(x?``:y),C=!!g?.recordId,w=!!g?.embedded,T=d??(C&&!w),E=n.default.useCallback(()=>{if(typeof window>`u`)return;let e=window.location.pathname,t=e.replace(/\/record\/[^/]+\/?$/,``);t===e?window.history.length>1&&window.history.back():(window.history.pushState({},``,t+window.location.search),window.dispatchEvent(new PopStateEvent(`popstate`)))},[]),D=Array.isArray(f?.children)?f.children.filter(Boolean).map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e},e?.id||`pgh-child-${t}`)):null,O=Array.isArray(u)&&u.length>0&&u||Array.isArray(f?.actions)&&f.actions.length>0&&f.actions||Array.isArray(f?.properties?.actions)&&f.properties.actions.length>0&&f.properties.actions||null,k=l||m||(O?(0,o.jsx)(a.SchemaRenderer,{schema:{type:`record:quick_actions`,properties:{actions:O,location:`record_header`,align:`end`,inline:!0}}}):null)||D;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-3 pb-4 border-b`,p),...h,children:(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[T&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,onClick:E,"aria-label":`Back to list`,className:`flex-shrink-0 -ml-2`,children:(0,o.jsx)(i.ArrowLeft,{className:`size-4`})}),c&&(v||S)&&(0,o.jsx)(`div`,{className:`flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary`,children:typeof c==`string`?(0,o.jsx)(r.LazyIcon,{name:c,className:`size-5`}):c}),(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[v?(0,o.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:v}):null,S&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:S})]}),k&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:k})]})})}function S(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;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;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function C(e){let t=S(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function w(e){let t=S(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function T(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function E(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=C(e.primaryColor),i=w(e.primaryColor),a=r()&&i||t;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%`:T(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}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`);if(e?.accentColor){let t=C(e.accentColor),i=w(e.accentColor),a=r()&&i||t;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%`:T(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function D({sidebar:e,navbar:t,children:n,className:i,defaultOpen:a=!0,branding:s}){return E(s,s?.title),(0,o.jsxs)(r.SidebarProvider,{defaultOpen:a,className:`!flex-col h-svh overflow-hidden`,children:[(0,o.jsx)(`header`,{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`,children:t}),(0,o.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,o.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,o.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,i),children:n})})]})]})}function O({className:e,children:t,...n}){return(0,o.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,o.jsx)(`div`,{className:`p-6`,children:t})})}var k={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function A(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=k[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var j={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},M=({columns:e,gap:t=4,className:n,children:i})=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid`,A(e),typeof t==`number`?j[t]||`gap-${t}`:``,n),children:i});function N(e){return e?(0,r.getLazyIcon)(e):i.FileText}function P(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function F(e,t,n,r,i){let a=P(e.label,n);return typeof e.label==`string`?t&&e.type===`object`&&e.objectName?t(e.objectName,a):r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,a):i&&e.type===`group`&&e.id?i(e.id,a):a:a}var I=e=>!(e===!1||e===`false`),L=()=>!0,R=()=>!0;function z(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};default:return{href:`#`,external:!1}}}function B(e,t){if(!t.trim())return e;let n=t.toLowerCase().trim();return e.reduce((e,r)=>{if(r.type===`separator`)return e;if(r.type===`group`&&r.children?.length){let n=B(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return P(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var V=5;function H({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h}){let{attributes:g,listeners:_,setNodeRef:v,transform:y,transition:b,isDragging:x}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:v,style:{transform:u.CSS.Transform.toString(y),transition:b,opacity:x?.5:void 0,zIndex:x?10:void 0},...g,children:(0,o.jsx)(U,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?_:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h})})}function U({item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_}){let v=(0,s.useLocation)(),[y,b]=(0,n.useState)(e.defaultOpen!==!1);if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let x=e.requiresObject,S=e.requiresService;if(x&&!l(`object`,x)||S&&!l(`service`,S))return null;if(e.type===`separator`)return(0,o.jsx)(r.Separator,{className:`my-2`});if(e.type===`group`){let n=(e.children??[]).slice().sort((e,t)=>(e.order??0)-(t.order??0));return(0,o.jsx)(r.Collapsible,{open:y,onOpenChange:b,children:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,o.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[F(e,m,_,h,g),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${y?`rotate-90`:``}`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:n.map(e=>(0,o.jsx)(U,{item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_},e.id))})})})]})})}if(e.type===`action`){let t=N(e.icon),n=P(e.label,_);return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsxs)(r.SidebarMenuButton,{tooltip:n,onClick:()=>u?.(e),children:[(0,o.jsx)(t,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:n}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${n}`:`Pin ${n}`,name:n}):e.pinned?`Unpin ${n}`:`Pin ${n}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}let C=N(e.icon),{href:w,external:T}=z(e,t),E=w!==`#`&&v.pathname.startsWith(w),D=F(e,m,_,h,g),O=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(C,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:D}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:E,tooltip:D,children:T?(0,o.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,children:O}):(0,o.jsx)(s.Link,{to:w,children:O})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${D}`:`Pin ${D}`,name:D}):e.pinned?`Unpin ${D}`:`Pin ${D}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}function W({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:s=L,checkCapability:u=R,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b}){let x=(0,n.useMemo)(()=>f?B(e,f):e,[e,f]),S=(0,n.useMemo)(()=>G(x),[x]),C=x.slice().sort((e,t)=>(e.order??0)-(t.order??0)),w=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:V}}),(0,c.useSensor)(c.KeyboardSensor)),T=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=C.findIndex(e=>e.id===t.id),i=C.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(C,r,i).map((e,t)=>({...e,order:t})))},E={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b},D=C.some(e=>e.type===`group`),O=S.length>0&&p?(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Star,{className:`h-3.5 w-3.5`}),b?b(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:S.map(e=>(0,o.jsx)(U,{item:e,...E},`fav-${e.id}`))})})]}):null;if(!D){let e=C.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[O,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:w,collisionDetection:c.closestCenter,onDragEnd:T,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(H,{item:e,enableReorder:h,...E},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(U,{item:e,...E},e.id))})})})]})}let k=[],A=[],j=e=>{if(A.length===0)return;let t=A;A=[],k.push((0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:t.map(e=>(0,o.jsx)(U,{item:e,...E},e.id))})})},e))};return C.forEach((e,t)=>{e.type===`group`?(j(`leaf-${t}`),k.push((0,o.jsx)(U,{item:e,...E},e.id))):A.push(e)}),j(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[O,k]})}function G(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...G(n.children));return t}function K({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:c.map(e=>{let i=N(e.icon);return(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:P(e.label),onClick:()=>n(e.id),children:[(0,o.jsx)(i,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:P(e.label)})]})},e.id)})})})]})}function q({items:e,basePath:t}){let n=(0,s.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},i=r(e).slice(0,5);return i.length===0?null:(0,o.jsx)(`div`,{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`,role:`navigation`,"aria-label":`Mobile navigation`,children:i.map(e=>{let r=N(e.icon),i=`#`;e.type===`object`?(i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`)):e.type===`dashboard`?i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`:e.type===`page`?i=e.pageName?`${t}/page/${e.pageName}`:`#`:e.type===`report`?i=e.reportName?`${t}/report/${e.reportName}`:`#`:e.type===`url`&&(i=e.url??`#`);let a=i!==`#`&&n.pathname.startsWith(i);return(0,o.jsxs)(s.Link,{to:i,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`}`,children:[(0,o.jsx)(r,{className:`h-5 w-5`}),(0,o.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:P(e.label)})]},e.id)})})}function J({schema:e,basePath:t,evalVis:i,checkPerm:a,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=N(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,o.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,o.jsxs)(r.SidebarHeader,{children:[l??(0,o.jsx)(r.SidebarMenu,{children:(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,o.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,o.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,o.jsx)(b,{className:`size-4`})}),(0,o.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,o.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,o.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,o.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,o.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,o.jsx)(K,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(W,{items:m,basePath:t,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,searchQuery:S,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}),d]}),u&&(0,o.jsx)(r.SidebarFooter,{children:u})]})}function Y({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,navbar:l,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=i??(e=>!(e===!1||e===`false`)),C=a??(()=>!0),w=s??(()=>!0),T=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,d.menuItemToNavigationItem)(e,t)),[e.menu]),E=e.navigation??T,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??E,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{sidebar:(0,o.jsx)(J,{schema:e,basePath:t,evalVis:S,checkPerm:C,checkCap:w,onAction:c,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,activeAreaId:k,setActiveAreaId:A,resolvedNavigation:M,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}),navbar:l,className:h,defaultOpen:g,branding:N,children:m}),r===`bottom_nav`&&(0,o.jsx)(q,{items:M,basePath:t})]})}var X=e=>e?Array.isArray(e)?e:[e]:[];function Z({schema:e,className:t,style:n,id:i,...s}){let c=X(e.children);return(0,o.jsxs)(`div`,{id:i||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,o.jsx)(x,{title:e.title,description:e.description}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto`,children:c.map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e,...s},e?.id||t))})]})}function Q(e){return`items`in e&&!(`href`in e)}function ee({item:e,pathname:t}){return e.children&&e.children.length>0?(0,o.jsx)(r.Collapsible,{asChild:!0,defaultOpen:!0,className:`group/collapsible`,children:(0,o.jsxs)(r.SidebarMenuItem,{children:[(0,o.jsx)(r.CollapsibleTrigger,{asChild:!0,children:(0,o.jsxs)(r.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto mr-1 h-5 min-w-5 px-1 text-xs`,children:e.badge}),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarMenuSub,{children:e.children.map(e=>(0,o.jsx)(r.SidebarMenuSubItem,{children:(0,o.jsx)(r.SidebarMenuSubButton,{asChild:!0,isActive:t===e.href,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})},e.href))})})]})}):(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})})}function te({items:e,title:t=`Application`,className:a,collapsible:c=`icon`,searchEnabled:l=!1,searchPlaceholder:u=`Search...`}){let d=(0,s.useLocation)(),[f,p]=n.default.useState(``),m=n.default.useMemo(()=>e.length===0?[]:Q(e[0])?e.map(e=>({groupLabel:e.label,items:e.items})):[{items:e}],[e]),h=n.default.useMemo(()=>{if(!f)return m;let e=f.toLowerCase();return m.map(t=>({...t,items:t.items.filter(t=>t.title.toLowerCase().includes(e)||t.children?.some(t=>t.title.toLowerCase().includes(e)))})).filter(e=>e.items.length>0)},[m,f]);return(0,o.jsx)(r.Sidebar,{className:a,collapsible:c,children:(0,o.jsxs)(r.SidebarContent,{children:[l&&(0,o.jsx)(`div`,{className:`px-3 py-2`,children:(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(r.Input,{type:`search`,placeholder:u,value:f,onChange:e=>p(e.target.value),className:`pl-8 h-9`})]})}),h.map((e,n)=>(0,o.jsxs)(r.SidebarGroup,{children:[n>0&&(0,o.jsx)(`div`,{className:`mx-3 mb-1 h-px bg-sidebar-border/60`,"aria-hidden":!0}),(0,o.jsx)(r.SidebarGroupLabel,{className:`text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60`,children:e.groupLabel||t}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:e.items.map(e=>(0,o.jsx)(ee,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,x,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:header`,x,{namespace:`layout`}),t.ComponentRegistry.register(`page:card`,O,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,D,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,M,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,W,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,Y,{namespace:`layout`,label:`App Schema Renderer`,category:`Layout`,isContainer:!0,inputs:[{name:`schema`,type:`object`},{name:`basePath`,type:`string`},{name:`mobileNavMode`,type:`string`}]})}try{$()}catch{}e.AppSchemaRenderer=Y,e.AppShell=D,e.NavigationRenderer=W,e.Page=Z,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=te,e.filterNavigationItems=B,e.registerLayout=$,e.resolveIcon=N,e.resolveLabel=P,e.useAppShellBranding=E});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/layout",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.umd.cjs",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"react": "19.2.6",
|
|
23
23
|
"react-dom": "19.2.6",
|
|
24
24
|
"tailwind-merge": "^3.6.0",
|
|
25
|
-
"@object-ui/
|
|
26
|
-
"@object-ui/
|
|
27
|
-
"@object-ui/
|
|
28
|
-
"@object-ui/
|
|
25
|
+
"@object-ui/components": "4.6.0",
|
|
26
|
+
"@object-ui/core": "4.6.0",
|
|
27
|
+
"@object-ui/react": "4.6.0",
|
|
28
|
+
"@object-ui/types": "4.6.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0",
|