@object-ui/layout 4.3.0 → 4.4.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 +87 -0
- package/dist/index.js +274 -233
- package/dist/index.umd.cjs +1 -1
- package/dist/packages/layout/src/PageHeader.d.ts +41 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# @object-ui/layout
|
|
2
2
|
|
|
3
|
+
## 4.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 67dabe1: feat(page-header): first-class `actions` property on page:header
|
|
8
|
+
|
|
9
|
+
PageHeader now accepts an `actions: ActionDef[]` (or string[]) property
|
|
10
|
+
and renders the toolbar inline in the header's right-aligned action slot.
|
|
11
|
+
Removes the need for authors to declare a sibling `record:quick_actions`
|
|
12
|
+
node and the `-mt-12` visual offset hack to pair the toolbar with the
|
|
13
|
+
title. The hack still applies for legacy schemas using the sibling form
|
|
14
|
+
(via location:'record_header'); the new in-header rendering opts out via
|
|
15
|
+
an `inline: true` flag automatically set by PageHeader.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 63eb66d: fix(detail): expand lookup fields so subtitle + lookup cells show display names
|
|
20
|
+
|
|
21
|
+
The record-page fetch in `RecordDetailView` (the page-mode path) now
|
|
22
|
+
requests `$expand` for every lookup/master_detail field on the object,
|
|
23
|
+
mirroring the behaviour the legacy `DetailView` already had. Combined
|
|
24
|
+
with two small downstream fixes — `PageHeader` subtitle interpolation
|
|
25
|
+
now extracts `name/label` from expanded reference objects instead of
|
|
26
|
+
rendering `[object Object]`, and `LookupCellRenderer` now short-circuits
|
|
27
|
+
to `pickRecordDisplayName` when the value is already a nested record —
|
|
28
|
+
all `record:*` renderers and the page header subtitle (`Owned by
|
|
29
|
+
{account}`) now display the related record's name rather than the raw
|
|
30
|
+
foreign-key id.
|
|
31
|
+
|
|
32
|
+
- ef0e30d: feat(page-header): back-to-list arrow on record pages
|
|
33
|
+
|
|
34
|
+
`page:header` now renders a ← back arrow at the left when a record
|
|
35
|
+
context with an id is present. Clicking it strips the trailing
|
|
36
|
+
`/record/{id}` segment from the URL so users return to the object list,
|
|
37
|
+
falling back to `history.back()` for deep-linked entry. The legacy app
|
|
38
|
+
pages without a record context are unaffected.
|
|
39
|
+
|
|
40
|
+
- 2bd45af: feat(shell): main becomes the scroll container; record tabs are sticky
|
|
41
|
+
- `AppShell`'s SidebarProvider wrapper is now constrained to viewport
|
|
42
|
+
height (`h-svh overflow-hidden`) instead of expanding with content via
|
|
43
|
+
the default `min-h-svh`. This makes the inner `<main>` (which is
|
|
44
|
+
`overflow-auto`) the actual scroll container instead of the window.
|
|
45
|
+
- `RecordDetailView` page-mode container drops the redundant
|
|
46
|
+
`h-full overflow-auto` (avoids nested scrollers; main owns scroll now).
|
|
47
|
+
- `page:tabs` (horizontal) gets `sticky top-0 z-20` with a translucent
|
|
48
|
+
backdrop so the tab strip stays visible while users scroll through
|
|
49
|
+
long record pages — the Salesforce Lightning behaviour our schemas
|
|
50
|
+
were already implying.
|
|
51
|
+
|
|
52
|
+
- Updated dependencies [2bd45af]
|
|
53
|
+
- @object-ui/components@4.4.0
|
|
54
|
+
- @object-ui/types@4.4.0
|
|
55
|
+
- @object-ui/core@4.4.0
|
|
56
|
+
- @object-ui/react@4.4.0
|
|
57
|
+
|
|
58
|
+
## 4.3.1
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- 6b683c8: fix(detail): clean up record page rendering
|
|
63
|
+
- Drop `ai:chat_window` from the protocol-component placeholder list. The
|
|
64
|
+
floating chat overlay (plugin-chatbot) is the canonical AI entry point;
|
|
65
|
+
inline page schemas that still reference `ai:chat_window` now surface
|
|
66
|
+
as an explicit "Unknown component type" so the misconfiguration is
|
|
67
|
+
fixed at the source instead of silently leaking a placeholder card.
|
|
68
|
+
- `page:header` now resolves `{field.path}` tokens in `title` / `description`
|
|
69
|
+
against the current record context (matching the behaviour of the
|
|
70
|
+
alternative `containers.tsx` renderer). Without this, schemas like
|
|
71
|
+
`title: "{first_name} {last_name}"` rendered the literal template.
|
|
72
|
+
- `containers.tsx` `PageHeaderRenderer`: also read from `schema.properties.*`
|
|
73
|
+
as a fallback so both inlined and raw-bag schema shapes are supported.
|
|
74
|
+
|
|
75
|
+
- 0d8eb98: feat(detail): Salesforce-style record header + section field grid
|
|
76
|
+
- `page:header` now renders an icon chip (resolves Lucide names via
|
|
77
|
+
`LazyIcon`) plus subtitle, so detail pages can show
|
|
78
|
+
"Name / Company" without an extra component.
|
|
79
|
+
- `record:details` normalises string field entries (`fields: ['email']`)
|
|
80
|
+
into the `{name, label?}` shape expected by `DetailSection`, and maps
|
|
81
|
+
section `label` → `title`. Schemas authored against `@objectstack/spec`
|
|
82
|
+
now produce a real grouped field grid instead of an empty card.
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [6b683c8]
|
|
85
|
+
- @object-ui/components@4.3.1
|
|
86
|
+
- @object-ui/react@4.3.1
|
|
87
|
+
- @object-ui/types@4.3.1
|
|
88
|
+
- @object-ui/core@4.3.1
|
|
89
|
+
|
|
3
90
|
## 4.3.0
|
|
4
91
|
|
|
5
92
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,75 @@
|
|
|
1
1
|
import { ComponentRegistry as e } from "@object-ui/core";
|
|
2
2
|
import t, { useEffect as n, useMemo as r, useState as i } from "react";
|
|
3
|
-
import { Badge as a,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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 } from "@object-ui/components";
|
|
4
|
+
import { ArrowLeft as M, ChevronRight as ee, FileText as N, GripVertical as te, Layers as ne, Pin as re, PinOff as ie, Search as P, Star as F } from "lucide-react";
|
|
5
|
+
import { SchemaRenderer as I, useRecordContext as ae } from "@object-ui/react";
|
|
6
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
7
|
+
import { Link as oe, NavLink as se, useLocation as B } from "react-router-dom";
|
|
8
|
+
import { DndContext as ce, KeyboardSensor as le, PointerSensor as ue, closestCenter as de, useSensor as fe, useSensors as pe } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as me, arrayMove as he, useSortable as ge, verticalListSortingStrategy as _e } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as ve } from "@dnd-kit/utilities";
|
|
11
|
+
import { menuItemToNavigationItem as ye } from "@object-ui/types";
|
|
12
12
|
//#region src/PageHeader.tsx
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
var V = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
|
|
14
|
+
let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
|
|
15
|
+
if (r == null) return "";
|
|
16
|
+
if (typeof r == "object") {
|
|
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
|
+
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, g = n ?? r, _ = V(g, m?.data) || g, v = !!m?.recordId, y = c ?? v, b = t.useCallback(() => {
|
|
24
|
+
if (typeof window > "u") return;
|
|
25
|
+
let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
|
|
26
|
+
t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
27
|
+
}, []), x = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ R(I, { schema: e }, e?.id || `pgh-child-${t}`)) : null, S = 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, C = a || f || (S ? /* @__PURE__ */ R(I, { schema: {
|
|
28
|
+
type: "record:quick_actions",
|
|
29
|
+
properties: {
|
|
30
|
+
actions: S,
|
|
31
|
+
location: "record_header",
|
|
32
|
+
align: "end",
|
|
33
|
+
inline: !0
|
|
34
|
+
}
|
|
35
|
+
} }) : null) || x;
|
|
36
|
+
return /* @__PURE__ */ R("div", {
|
|
37
|
+
className: A("flex flex-col gap-3 pb-4 border-b", u),
|
|
38
|
+
...p,
|
|
39
|
+
children: /* @__PURE__ */ z("div", {
|
|
40
|
+
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
41
|
+
children: [
|
|
42
|
+
y && /* @__PURE__ */ R(o, {
|
|
43
|
+
type: "button",
|
|
44
|
+
variant: "ghost",
|
|
45
|
+
size: "icon",
|
|
46
|
+
onClick: b,
|
|
47
|
+
"aria-label": "Back to list",
|
|
48
|
+
className: "flex-shrink-0 -ml-2",
|
|
49
|
+
children: /* @__PURE__ */ R(M, { className: "size-4" })
|
|
50
|
+
}),
|
|
51
|
+
i && /* @__PURE__ */ R("div", {
|
|
52
|
+
className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
|
|
53
|
+
children: typeof i == "string" ? /* @__PURE__ */ R(d, {
|
|
54
|
+
name: i,
|
|
55
|
+
className: "size-5"
|
|
56
|
+
}) : i
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ z("div", {
|
|
59
|
+
className: "flex flex-col min-w-0 flex-1",
|
|
60
|
+
children: [/* @__PURE__ */ R("h1", {
|
|
61
|
+
className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
|
|
62
|
+
children: h
|
|
63
|
+
}), _ && /* @__PURE__ */ R("p", {
|
|
64
|
+
className: "text-sm text-muted-foreground truncate",
|
|
65
|
+
children: _
|
|
66
|
+
})]
|
|
67
|
+
}),
|
|
68
|
+
C && /* @__PURE__ */ R("div", {
|
|
69
|
+
className: "flex items-center gap-2 ml-auto",
|
|
70
|
+
children: C
|
|
71
|
+
})
|
|
72
|
+
]
|
|
32
73
|
})
|
|
33
74
|
});
|
|
34
75
|
}
|
|
@@ -77,7 +118,7 @@ function K(e) {
|
|
|
77
118
|
}, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
|
|
78
119
|
return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
|
|
79
120
|
}
|
|
80
|
-
function
|
|
121
|
+
function be(e, t) {
|
|
81
122
|
n(() => {
|
|
82
123
|
let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
|
|
83
124
|
if (e?.primaryColor) {
|
|
@@ -113,19 +154,19 @@ function q(e, t) {
|
|
|
113
154
|
t
|
|
114
155
|
]);
|
|
115
156
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
157
|
+
function q({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a }) {
|
|
158
|
+
return be(a, a?.title), /* @__PURE__ */ z(k, {
|
|
118
159
|
defaultOpen: i,
|
|
119
|
-
className: "!flex-col",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
160
|
+
className: "!flex-col h-svh overflow-hidden",
|
|
161
|
+
children: [/* @__PURE__ */ R("header", {
|
|
121
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",
|
|
122
163
|
children: t
|
|
123
|
-
}), /* @__PURE__ */
|
|
164
|
+
}), /* @__PURE__ */ z("div", {
|
|
124
165
|
className: "flex flex-1 min-h-0 w-full",
|
|
125
|
-
children: [e, /* @__PURE__ */
|
|
166
|
+
children: [e, /* @__PURE__ */ R(x, {
|
|
126
167
|
className: "min-w-0",
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
-
className:
|
|
168
|
+
children: /* @__PURE__ */ R("main", {
|
|
169
|
+
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),
|
|
129
170
|
children: n
|
|
130
171
|
})
|
|
131
172
|
})]
|
|
@@ -134,11 +175,11 @@ function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
|
|
|
134
175
|
}
|
|
135
176
|
//#endregion
|
|
136
177
|
//#region src/PageCard.tsx
|
|
137
|
-
function
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
className:
|
|
178
|
+
function xe({ className: e, children: t, ...n }) {
|
|
179
|
+
return /* @__PURE__ */ R("div", {
|
|
180
|
+
className: A("rounded-xl border bg-card text-card-foreground shadow", e),
|
|
140
181
|
...n,
|
|
141
|
-
children: /* @__PURE__ */
|
|
182
|
+
children: /* @__PURE__ */ R("div", {
|
|
142
183
|
className: "p-6",
|
|
143
184
|
children: t
|
|
144
185
|
})
|
|
@@ -146,7 +187,7 @@ function he({ className: e, children: t, ...n }) {
|
|
|
146
187
|
}
|
|
147
188
|
//#endregion
|
|
148
189
|
//#region src/ResponsiveGrid.tsx
|
|
149
|
-
var
|
|
190
|
+
var Se = {
|
|
150
191
|
xs: {
|
|
151
192
|
1: "grid-cols-1",
|
|
152
193
|
2: "grid-cols-2",
|
|
@@ -196,11 +237,11 @@ var ge = {
|
|
|
196
237
|
12: "2xl:grid-cols-12"
|
|
197
238
|
}
|
|
198
239
|
};
|
|
199
|
-
function
|
|
240
|
+
function Ce(e) {
|
|
200
241
|
if (!e) return "grid-cols-1";
|
|
201
242
|
let t = [];
|
|
202
243
|
for (let [n, r] of Object.entries(e)) {
|
|
203
|
-
let e =
|
|
244
|
+
let e = Se[n];
|
|
204
245
|
if (e && r) {
|
|
205
246
|
let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
|
|
206
247
|
t.push(e[n]);
|
|
@@ -208,7 +249,7 @@ function _e(e) {
|
|
|
208
249
|
}
|
|
209
250
|
return t.join(" ") || "grid-cols-1";
|
|
210
251
|
}
|
|
211
|
-
var
|
|
252
|
+
var we = {
|
|
212
253
|
0: "gap-0",
|
|
213
254
|
1: "gap-1",
|
|
214
255
|
2: "gap-2",
|
|
@@ -217,16 +258,16 @@ var ve = {
|
|
|
217
258
|
5: "gap-5",
|
|
218
259
|
6: "gap-6",
|
|
219
260
|
8: "gap-8"
|
|
220
|
-
},
|
|
221
|
-
className:
|
|
261
|
+
}, Te = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
|
|
262
|
+
className: A("grid", Ce(e), typeof t == "number" ? we[t] || `gap-${t}` : "", n),
|
|
222
263
|
children: r
|
|
223
264
|
});
|
|
224
265
|
//#endregion
|
|
225
266
|
//#region src/NavigationRenderer.tsx
|
|
226
|
-
function
|
|
227
|
-
return e ?
|
|
267
|
+
function J(e) {
|
|
268
|
+
return e ? j(e) : N;
|
|
228
269
|
}
|
|
229
|
-
function
|
|
270
|
+
function Y(e, t) {
|
|
230
271
|
if (typeof e == "string") return e;
|
|
231
272
|
if (t) {
|
|
232
273
|
let n = t(e.key, {
|
|
@@ -237,12 +278,12 @@ function X(e, t) {
|
|
|
237
278
|
}
|
|
238
279
|
return e.defaultValue || e.key;
|
|
239
280
|
}
|
|
240
|
-
function
|
|
241
|
-
let a =
|
|
281
|
+
function X(e, t, n, r, i) {
|
|
282
|
+
let a = Y(e.label, n);
|
|
242
283
|
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;
|
|
243
284
|
}
|
|
244
|
-
var
|
|
245
|
-
function
|
|
285
|
+
var Ee = (e) => !(e === !1 || e === "false"), De = () => !0, Oe = () => !0;
|
|
286
|
+
function ke(e, t) {
|
|
246
287
|
switch (e.type) {
|
|
247
288
|
case "object": {
|
|
248
289
|
let n = `${t}/${e.objectName ?? ""}`;
|
|
@@ -285,25 +326,25 @@ function Z(e, t) {
|
|
|
285
326
|
children: n
|
|
286
327
|
}), e;
|
|
287
328
|
}
|
|
288
|
-
return
|
|
329
|
+
return Y(r.label).toLowerCase().includes(n) && e.push(r), e;
|
|
289
330
|
}, []);
|
|
290
331
|
}
|
|
291
|
-
var
|
|
292
|
-
function
|
|
293
|
-
let { attributes: p, listeners: m, setNodeRef: h, transform: g, transition: _, isDragging: v } =
|
|
332
|
+
var Ae = 5;
|
|
333
|
+
function je({ 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
|
+
let { attributes: p, listeners: m, setNodeRef: h, transform: g, transition: _, isDragging: v } = ge({
|
|
294
335
|
id: e.id,
|
|
295
336
|
disabled: !c
|
|
296
337
|
});
|
|
297
|
-
return /* @__PURE__ */
|
|
338
|
+
return /* @__PURE__ */ R("div", {
|
|
298
339
|
ref: h,
|
|
299
340
|
style: {
|
|
300
|
-
transform:
|
|
341
|
+
transform: ve.Transform.toString(g),
|
|
301
342
|
transition: _,
|
|
302
343
|
opacity: v ? .5 : void 0,
|
|
303
344
|
zIndex: v ? 10 : void 0
|
|
304
345
|
},
|
|
305
346
|
...p,
|
|
306
|
-
children: /* @__PURE__ */
|
|
347
|
+
children: /* @__PURE__ */ R(Q, {
|
|
307
348
|
item: e,
|
|
308
349
|
basePath: t,
|
|
309
350
|
evalVis: n,
|
|
@@ -320,119 +361,119 @@ function Ee({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
|
|
|
320
361
|
})
|
|
321
362
|
});
|
|
322
363
|
}
|
|
323
|
-
function Q({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap:
|
|
324
|
-
let E =
|
|
364
|
+
function Q({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: o, onAction: u, enablePinning: d, onPinToggle: p, dragListeners: m, resolveObjectLabel: h, resolveDashboardLabel: y, resolveGroupLabel: b, t: x }) {
|
|
365
|
+
let E = B(), [D, O] = i(e.defaultOpen !== !1);
|
|
325
366
|
if (!n(e.visible) || e.requiredPermissions?.length && !r(e.requiredPermissions)) return null;
|
|
326
|
-
let k = e.requiresObject,
|
|
327
|
-
if (k && !
|
|
328
|
-
if (e.type === "separator") return /* @__PURE__ */
|
|
367
|
+
let k = e.requiresObject, A = e.requiresService;
|
|
368
|
+
if (k && !o("object", k) || A && !o("service", A)) return null;
|
|
369
|
+
if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
|
|
329
370
|
if (e.type === "group") {
|
|
330
371
|
let i = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
331
|
-
return /* @__PURE__ */
|
|
372
|
+
return /* @__PURE__ */ R(s, {
|
|
332
373
|
open: D,
|
|
333
374
|
onOpenChange: O,
|
|
334
|
-
children: /* @__PURE__ */
|
|
375
|
+
children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
|
|
335
376
|
asChild: !0,
|
|
336
|
-
children: /* @__PURE__ */
|
|
377
|
+
children: /* @__PURE__ */ z(l, {
|
|
337
378
|
className: "flex w-full items-center justify-between",
|
|
338
|
-
children: [
|
|
379
|
+
children: [X(e, h, x, y, b), /* @__PURE__ */ R(ee, { className: `ml-auto h-4 w-4 transition-transform ${D ? "rotate-90" : ""}` })]
|
|
339
380
|
})
|
|
340
|
-
}), /* @__PURE__ */
|
|
381
|
+
}), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: i.map((e) => /* @__PURE__ */ R(Q, {
|
|
341
382
|
item: e,
|
|
342
383
|
basePath: t,
|
|
343
384
|
evalVis: n,
|
|
344
385
|
checkPerm: r,
|
|
345
|
-
checkCap:
|
|
346
|
-
onAction:
|
|
347
|
-
enablePinning:
|
|
386
|
+
checkCap: o,
|
|
387
|
+
onAction: u,
|
|
388
|
+
enablePinning: d,
|
|
348
389
|
onPinToggle: p,
|
|
349
|
-
resolveObjectLabel:
|
|
390
|
+
resolveObjectLabel: h,
|
|
350
391
|
resolveDashboardLabel: y,
|
|
351
|
-
resolveGroupLabel:
|
|
352
|
-
t:
|
|
392
|
+
resolveGroupLabel: b,
|
|
393
|
+
t: x
|
|
353
394
|
}, e.id)) }) }) })] })
|
|
354
395
|
});
|
|
355
396
|
}
|
|
356
397
|
if (e.type === "action") {
|
|
357
|
-
let t =
|
|
358
|
-
return /* @__PURE__ */
|
|
359
|
-
|
|
398
|
+
let t = J(e.icon), n = Y(e.label, x);
|
|
399
|
+
return /* @__PURE__ */ z(T, { children: [
|
|
400
|
+
m && /* @__PURE__ */ R("span", {
|
|
360
401
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
361
|
-
"aria-label":
|
|
362
|
-
...
|
|
363
|
-
children: /* @__PURE__ */
|
|
402
|
+
"aria-label": x ? x("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
403
|
+
...m,
|
|
404
|
+
children: /* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" })
|
|
364
405
|
}),
|
|
365
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ z(w, {
|
|
366
407
|
tooltip: n,
|
|
367
|
-
onClick: () =>
|
|
408
|
+
onClick: () => u?.(e),
|
|
368
409
|
children: [
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
/* @__PURE__ */
|
|
371
|
-
e.badge != null && /* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ R(t, { className: "h-4 w-4" }),
|
|
411
|
+
/* @__PURE__ */ R("span", { children: n }),
|
|
412
|
+
e.badge != null && /* @__PURE__ */ R(a, {
|
|
372
413
|
variant: e.badgeVariant ?? "default",
|
|
373
414
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
374
415
|
children: e.badge
|
|
375
416
|
})
|
|
376
417
|
]
|
|
377
418
|
}),
|
|
378
|
-
|
|
419
|
+
d && p && /* @__PURE__ */ R(C, {
|
|
379
420
|
showOnHover: !0,
|
|
380
421
|
onClick: () => p(e.id, !e.pinned),
|
|
381
|
-
"aria-label":
|
|
422
|
+
"aria-label": x ? x(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
382
423
|
defaultValue: e.pinned ? `Unpin ${n}` : `Pin ${n}`,
|
|
383
424
|
name: n
|
|
384
425
|
}) : e.pinned ? `Unpin ${n}` : `Pin ${n}`,
|
|
385
|
-
children: e.pinned ? /* @__PURE__ */
|
|
426
|
+
children: e.pinned ? /* @__PURE__ */ R(ie, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" })
|
|
386
427
|
})
|
|
387
428
|
] });
|
|
388
429
|
}
|
|
389
|
-
let
|
|
390
|
-
/* @__PURE__ */ j
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
e.badge != null && /* @__PURE__ */
|
|
430
|
+
let j = J(e.icon), { href: M, external: N } = ke(e, t), ne = M !== "#" && E.pathname.startsWith(M), P = X(e, h, x, y, b), F = /* @__PURE__ */ z(L, { children: [
|
|
431
|
+
/* @__PURE__ */ R(j, { className: "h-4 w-4" }),
|
|
432
|
+
/* @__PURE__ */ R("span", { children: P }),
|
|
433
|
+
e.badge != null && /* @__PURE__ */ R(a, {
|
|
393
434
|
variant: e.badgeVariant ?? "default",
|
|
394
435
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
395
436
|
children: e.badge
|
|
396
437
|
})
|
|
397
438
|
] });
|
|
398
|
-
return /* @__PURE__ */
|
|
399
|
-
|
|
439
|
+
return /* @__PURE__ */ z(T, { children: [
|
|
440
|
+
m && /* @__PURE__ */ R("span", {
|
|
400
441
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
401
|
-
"aria-label":
|
|
402
|
-
...
|
|
403
|
-
children: /* @__PURE__ */
|
|
442
|
+
"aria-label": x ? x("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
443
|
+
...m,
|
|
444
|
+
children: /* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" })
|
|
404
445
|
}),
|
|
405
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ R(w, {
|
|
406
447
|
asChild: !0,
|
|
407
|
-
isActive:
|
|
408
|
-
tooltip:
|
|
409
|
-
children:
|
|
410
|
-
href:
|
|
448
|
+
isActive: ne,
|
|
449
|
+
tooltip: P,
|
|
450
|
+
children: N ? /* @__PURE__ */ R("a", {
|
|
451
|
+
href: M,
|
|
411
452
|
target: "_blank",
|
|
412
453
|
rel: "noopener noreferrer",
|
|
413
|
-
children:
|
|
414
|
-
}) : /* @__PURE__ */
|
|
415
|
-
to:
|
|
416
|
-
children:
|
|
454
|
+
children: F
|
|
455
|
+
}) : /* @__PURE__ */ R(oe, {
|
|
456
|
+
to: M,
|
|
457
|
+
children: F
|
|
417
458
|
})
|
|
418
459
|
}),
|
|
419
|
-
|
|
460
|
+
d && p && /* @__PURE__ */ R(C, {
|
|
420
461
|
showOnHover: !0,
|
|
421
462
|
onClick: () => p(e.id, !e.pinned),
|
|
422
|
-
"aria-label":
|
|
423
|
-
defaultValue: e.pinned ? `Unpin ${
|
|
424
|
-
name:
|
|
425
|
-
}) : e.pinned ? `Unpin ${
|
|
426
|
-
children: e.pinned ? /* @__PURE__ */
|
|
463
|
+
"aria-label": x ? x(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
464
|
+
defaultValue: e.pinned ? `Unpin ${P}` : `Pin ${P}`,
|
|
465
|
+
name: P
|
|
466
|
+
}) : e.pinned ? `Unpin ${P}` : `Pin ${P}`,
|
|
467
|
+
children: e.pinned ? /* @__PURE__ */ R(ie, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" })
|
|
427
468
|
})
|
|
428
469
|
] });
|
|
429
470
|
}
|
|
430
|
-
function $({ items: e, basePath: t = "", evaluateVisibility: n =
|
|
431
|
-
let y = r(() => s ? Z(e, s) : e, [e, s]),
|
|
471
|
+
function $({ items: e, basePath: t = "", evaluateVisibility: n = Ee, checkPermission: i = De, checkCapability: a = Oe, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, t: h }) {
|
|
472
|
+
let y = r(() => s ? Z(e, s) : e, [e, s]), b = r(() => Me(y), [y]), x = y.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), C = pe(fe(ue, { activationConstraint: { distance: Ae } }), fe(le)), w = (e) => {
|
|
432
473
|
let { active: t, over: n } = e;
|
|
433
474
|
if (!n || t.id === n.id || !d) return;
|
|
434
|
-
let r =
|
|
435
|
-
r === -1 || i === -1 || d(
|
|
475
|
+
let r = x.findIndex((e) => e.id === t.id), i = x.findIndex((e) => e.id === n.id);
|
|
476
|
+
r === -1 || i === -1 || d(he(x, r, i).map((e, t) => ({
|
|
436
477
|
...e,
|
|
437
478
|
order: t
|
|
438
479
|
})));
|
|
@@ -446,167 +487,167 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = xe, checkPermis
|
|
|
446
487
|
onPinToggle: l,
|
|
447
488
|
resolveObjectLabel: f,
|
|
448
489
|
resolveDashboardLabel: p,
|
|
449
|
-
resolveGroupLabel:
|
|
450
|
-
t:
|
|
451
|
-
}, E =
|
|
490
|
+
resolveGroupLabel: m,
|
|
491
|
+
t: h
|
|
492
|
+
}, E = x.some((e) => e.type === "group"), D = b.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
452
493
|
className: "flex items-center gap-1.5",
|
|
453
|
-
children: [/* @__PURE__ */
|
|
454
|
-
}), /* @__PURE__ */
|
|
494
|
+
children: [/* @__PURE__ */ R(F, { className: "h-3.5 w-3.5" }), h ? h("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
|
|
495
|
+
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: b.map((e) => /* @__PURE__ */ R(Q, {
|
|
455
496
|
item: e,
|
|
456
497
|
...T
|
|
457
498
|
}, `fav-${e.id}`)) }) })] }) : null;
|
|
458
499
|
if (!E) {
|
|
459
|
-
let e =
|
|
460
|
-
return /* @__PURE__ */
|
|
500
|
+
let e = x.filter((e) => e.type !== "group").map((e) => e.id);
|
|
501
|
+
return /* @__PURE__ */ z(L, { children: [D, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: u ? /* @__PURE__ */ R(ce, {
|
|
461
502
|
sensors: C,
|
|
462
|
-
collisionDetection:
|
|
503
|
+
collisionDetection: de,
|
|
463
504
|
onDragEnd: w,
|
|
464
|
-
children: /* @__PURE__ */
|
|
505
|
+
children: /* @__PURE__ */ R(me, {
|
|
465
506
|
items: e,
|
|
466
|
-
strategy:
|
|
467
|
-
children: /* @__PURE__ */
|
|
507
|
+
strategy: _e,
|
|
508
|
+
children: /* @__PURE__ */ R(S, { children: x.map((e) => /* @__PURE__ */ R(je, {
|
|
468
509
|
item: e,
|
|
469
510
|
enableReorder: u,
|
|
470
511
|
...T
|
|
471
512
|
}, e.id)) })
|
|
472
513
|
})
|
|
473
|
-
}) : /* @__PURE__ */
|
|
514
|
+
}) : /* @__PURE__ */ R(S, { children: x.map((e) => /* @__PURE__ */ R(Q, {
|
|
474
515
|
item: e,
|
|
475
516
|
...T
|
|
476
517
|
}, e.id)) }) }) })] });
|
|
477
518
|
}
|
|
478
|
-
let O = [], k = [],
|
|
519
|
+
let O = [], k = [], A = (e) => {
|
|
479
520
|
if (k.length === 0) return;
|
|
480
521
|
let t = k;
|
|
481
|
-
k = [], O.push(/* @__PURE__ */
|
|
522
|
+
k = [], O.push(/* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
|
|
482
523
|
item: e,
|
|
483
524
|
...T
|
|
484
525
|
}, e.id)) }) }) }, e));
|
|
485
526
|
};
|
|
486
|
-
return
|
|
487
|
-
e.type === "group" ? (
|
|
527
|
+
return x.forEach((e, t) => {
|
|
528
|
+
e.type === "group" ? (A(`leaf-${t}`), O.push(/* @__PURE__ */ R(Q, {
|
|
488
529
|
item: e,
|
|
489
530
|
...T
|
|
490
531
|
}, e.id))) : k.push(e);
|
|
491
|
-
}),
|
|
532
|
+
}), A("leaf-end"), /* @__PURE__ */ z(L, { children: [D, O] });
|
|
492
533
|
}
|
|
493
|
-
function
|
|
534
|
+
function Me(e) {
|
|
494
535
|
let t = [];
|
|
495
|
-
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...
|
|
536
|
+
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Me(n.children));
|
|
496
537
|
return t;
|
|
497
538
|
}
|
|
498
539
|
//#endregion
|
|
499
540
|
//#region src/AppSchemaRenderer.tsx
|
|
500
|
-
function
|
|
541
|
+
function Ne({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
|
|
501
542
|
let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
|
|
502
|
-
return a.length <= 1 ? null : /* @__PURE__ */
|
|
543
|
+
return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
503
544
|
className: "flex items-center gap-1.5",
|
|
504
|
-
children: [/* @__PURE__ */
|
|
505
|
-
}), /* @__PURE__ */
|
|
506
|
-
let r =
|
|
507
|
-
return /* @__PURE__ */
|
|
545
|
+
children: [/* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" }), "Area"]
|
|
546
|
+
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
|
|
547
|
+
let r = J(e.icon);
|
|
548
|
+
return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
|
|
508
549
|
isActive: e.id === t,
|
|
509
|
-
tooltip:
|
|
550
|
+
tooltip: Y(e.label),
|
|
510
551
|
onClick: () => n(e.id),
|
|
511
|
-
children: [/* @__PURE__ */
|
|
552
|
+
children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: Y(e.label) })]
|
|
512
553
|
}) }, e.id);
|
|
513
554
|
}) }) })] });
|
|
514
555
|
}
|
|
515
|
-
function
|
|
516
|
-
let n =
|
|
556
|
+
function Pe({ items: e, basePath: t }) {
|
|
557
|
+
let n = B(), r = (e) => {
|
|
517
558
|
let t = [];
|
|
518
559
|
for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
|
|
519
560
|
return t;
|
|
520
561
|
}, i = r(e).slice(0, 5);
|
|
521
|
-
return i.length === 0 ? null : /* @__PURE__ */
|
|
562
|
+
return i.length === 0 ? null : /* @__PURE__ */ R("div", {
|
|
522
563
|
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",
|
|
523
564
|
role: "navigation",
|
|
524
565
|
"aria-label": "Mobile navigation",
|
|
525
566
|
children: i.map((e) => {
|
|
526
|
-
let r =
|
|
567
|
+
let r = J(e.icon), i = "#";
|
|
527
568
|
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 ?? "#");
|
|
528
569
|
let a = i !== "#" && n.pathname.startsWith(i);
|
|
529
|
-
return /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ z(oe, {
|
|
530
571
|
to: i,
|
|
531
572
|
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"}`,
|
|
532
|
-
children: [/* @__PURE__ */
|
|
573
|
+
children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
|
|
533
574
|
className: "text-[10px] truncate max-w-[60px]",
|
|
534
|
-
children:
|
|
575
|
+
children: Y(e.label)
|
|
535
576
|
})]
|
|
536
577
|
}, e.id);
|
|
537
578
|
})
|
|
538
579
|
});
|
|
539
580
|
}
|
|
540
|
-
function
|
|
541
|
-
let E =
|
|
542
|
-
return /* @__PURE__ */
|
|
581
|
+
function Fe({ 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
|
+
let E = J(e.logo), D = e.areas ?? [], [O, k] = i("");
|
|
583
|
+
return /* @__PURE__ */ z(p, {
|
|
543
584
|
collapsible: "icon",
|
|
544
585
|
children: [
|
|
545
|
-
/* @__PURE__ */
|
|
586
|
+
/* @__PURE__ */ z(y, { children: [s ?? /* @__PURE__ */ R(S, { children: /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
|
|
546
587
|
size: "lg",
|
|
547
588
|
tooltip: e.title ?? e.name,
|
|
548
|
-
children: [/* @__PURE__ */
|
|
589
|
+
children: [/* @__PURE__ */ R("div", {
|
|
549
590
|
className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
|
|
550
|
-
children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */
|
|
591
|
+
children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ R("img", {
|
|
551
592
|
src: e.logo,
|
|
552
593
|
alt: e.title ?? "",
|
|
553
594
|
className: "size-6 object-contain"
|
|
554
|
-
}) : /* @__PURE__ */
|
|
555
|
-
}), /* @__PURE__ */
|
|
595
|
+
}) : /* @__PURE__ */ R(E, { className: "size-4" })
|
|
596
|
+
}), /* @__PURE__ */ z("div", {
|
|
556
597
|
className: "grid flex-1 text-left text-sm leading-tight",
|
|
557
|
-
children: [/* @__PURE__ */
|
|
598
|
+
children: [/* @__PURE__ */ R("span", {
|
|
558
599
|
className: "truncate font-semibold",
|
|
559
600
|
children: e.title ?? e.name ?? "App"
|
|
560
|
-
}), e.description && /* @__PURE__ */
|
|
601
|
+
}), e.description && /* @__PURE__ */ R("span", {
|
|
561
602
|
className: "truncate text-xs text-muted-foreground",
|
|
562
603
|
children: e.description
|
|
563
604
|
})]
|
|
564
605
|
})]
|
|
565
|
-
}) }) }), g && /* @__PURE__ */
|
|
606
|
+
}) }) }), g && /* @__PURE__ */ R(b, {
|
|
566
607
|
placeholder: "Search navigation…",
|
|
567
608
|
value: O,
|
|
568
609
|
onChange: (e) => k(e.target.value),
|
|
569
610
|
"aria-label": "Search navigation"
|
|
570
611
|
})] }),
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
D.length > 1 && u && /* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ z(m, { children: [
|
|
613
|
+
D.length > 1 && u && /* @__PURE__ */ R(Ne, {
|
|
573
614
|
areas: D,
|
|
574
615
|
activeAreaId: u,
|
|
575
|
-
onAreaChange:
|
|
616
|
+
onAreaChange: d,
|
|
576
617
|
evalVis: n,
|
|
577
618
|
checkPerm: r
|
|
578
619
|
}),
|
|
579
|
-
/* @__PURE__ */
|
|
580
|
-
items:
|
|
620
|
+
/* @__PURE__ */ R($, {
|
|
621
|
+
items: f,
|
|
581
622
|
basePath: t,
|
|
582
623
|
evaluateVisibility: n,
|
|
583
624
|
checkPermission: r,
|
|
584
625
|
checkCapability: a,
|
|
585
626
|
onAction: o,
|
|
586
627
|
searchQuery: O,
|
|
587
|
-
enablePinning:
|
|
588
|
-
onPinToggle:
|
|
589
|
-
enableReorder:
|
|
590
|
-
onReorder:
|
|
628
|
+
enablePinning: _,
|
|
629
|
+
onPinToggle: v,
|
|
630
|
+
enableReorder: x,
|
|
631
|
+
onReorder: C
|
|
591
632
|
}),
|
|
592
633
|
l
|
|
593
634
|
] }),
|
|
594
|
-
c && /* @__PURE__ */
|
|
635
|
+
c && /* @__PURE__ */ R(h, { children: c })
|
|
595
636
|
]
|
|
596
637
|
});
|
|
597
638
|
}
|
|
598
|
-
function
|
|
599
|
-
let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) =>
|
|
639
|
+
function Ie({ 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
|
+
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(",");
|
|
600
641
|
n(() => {
|
|
601
642
|
D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
|
|
602
|
-
}, [e.name,
|
|
603
|
-
let
|
|
643
|
+
}, [e.name, A]);
|
|
644
|
+
let j = D.find((e) => e.id === O)?.navigation ?? E, M = {
|
|
604
645
|
title: e.title,
|
|
605
646
|
favicon: e.favicon,
|
|
606
647
|
logo: e.logo
|
|
607
648
|
};
|
|
608
|
-
return /* @__PURE__ */
|
|
609
|
-
sidebar: /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(q, {
|
|
650
|
+
sidebar: /* @__PURE__ */ R(Fe, {
|
|
610
651
|
schema: e,
|
|
611
652
|
basePath: t,
|
|
612
653
|
evalVis: S,
|
|
@@ -618,7 +659,7 @@ function je({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
618
659
|
sidebarExtra: p,
|
|
619
660
|
activeAreaId: O,
|
|
620
661
|
setActiveAreaId: k,
|
|
621
|
-
resolvedNavigation:
|
|
662
|
+
resolvedNavigation: j,
|
|
622
663
|
enableSearch: _,
|
|
623
664
|
enablePinning: v,
|
|
624
665
|
onPinToggle: y,
|
|
@@ -628,28 +669,28 @@ function je({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
628
669
|
navbar: u,
|
|
629
670
|
className: h,
|
|
630
671
|
defaultOpen: g,
|
|
631
|
-
branding:
|
|
672
|
+
branding: M,
|
|
632
673
|
children: m
|
|
633
|
-
}), a === "bottom_nav" && /* @__PURE__ */
|
|
634
|
-
items:
|
|
674
|
+
}), a === "bottom_nav" && /* @__PURE__ */ R(Pe, {
|
|
675
|
+
items: j,
|
|
635
676
|
basePath: t
|
|
636
677
|
})] });
|
|
637
678
|
}
|
|
638
679
|
//#endregion
|
|
639
680
|
//#region src/Page.tsx
|
|
640
|
-
var
|
|
641
|
-
function
|
|
642
|
-
let a =
|
|
643
|
-
return /* @__PURE__ */
|
|
681
|
+
var Le = (e) => e ? Array.isArray(e) ? e : [e] : [];
|
|
682
|
+
function Re({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
683
|
+
let a = Le(e.children);
|
|
684
|
+
return /* @__PURE__ */ z("div", {
|
|
644
685
|
id: r || e.id,
|
|
645
|
-
className:
|
|
686
|
+
className: A("flex flex-col h-full space-y-4", t),
|
|
646
687
|
style: n,
|
|
647
|
-
children: [/* @__PURE__ */
|
|
688
|
+
children: [/* @__PURE__ */ R(H, {
|
|
648
689
|
title: e.title,
|
|
649
690
|
description: e.description
|
|
650
|
-
}), /* @__PURE__ */
|
|
691
|
+
}), /* @__PURE__ */ R("div", {
|
|
651
692
|
className: "flex-1 overflow-auto",
|
|
652
|
-
children: a.map((e, t) => /* @__PURE__ */
|
|
693
|
+
children: a.map((e, t) => /* @__PURE__ */ R(I, {
|
|
653
694
|
schema: e,
|
|
654
695
|
...i
|
|
655
696
|
}, e?.id || t))
|
|
@@ -658,38 +699,38 @@ function Ne({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
|
658
699
|
}
|
|
659
700
|
//#endregion
|
|
660
701
|
//#region src/SidebarNav.tsx
|
|
661
|
-
function
|
|
702
|
+
function ze(e) {
|
|
662
703
|
return "items" in e && !("href" in e);
|
|
663
704
|
}
|
|
664
|
-
function
|
|
665
|
-
return e.children && e.children.length > 0 ? /* @__PURE__ */
|
|
705
|
+
function Be({ item: e, pathname: t }) {
|
|
706
|
+
return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
|
|
666
707
|
asChild: !0,
|
|
667
708
|
defaultOpen: !0,
|
|
668
709
|
className: "group/collapsible",
|
|
669
|
-
children: /* @__PURE__ */
|
|
710
|
+
children: /* @__PURE__ */ z(T, { children: [/* @__PURE__ */ R(l, {
|
|
670
711
|
asChild: !0,
|
|
671
|
-
children: /* @__PURE__ */
|
|
712
|
+
children: /* @__PURE__ */ z(w, {
|
|
672
713
|
tooltip: e.title,
|
|
673
714
|
children: [
|
|
674
|
-
e.icon && /* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
e.badge != null && /* @__PURE__ */
|
|
715
|
+
e.icon && /* @__PURE__ */ R(e.icon, {}),
|
|
716
|
+
/* @__PURE__ */ R("span", { children: e.title }),
|
|
717
|
+
e.badge != null && /* @__PURE__ */ R(a, {
|
|
677
718
|
variant: e.badgeVariant || "default",
|
|
678
719
|
className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
|
|
679
720
|
children: e.badge
|
|
680
721
|
}),
|
|
681
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ R(ee, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
|
|
682
723
|
]
|
|
683
724
|
})
|
|
684
|
-
}), /* @__PURE__ */
|
|
725
|
+
}), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(E, { children: e.children.map((e) => /* @__PURE__ */ R(O, { children: /* @__PURE__ */ R(D, {
|
|
685
726
|
asChild: !0,
|
|
686
727
|
isActive: t === e.href,
|
|
687
|
-
children: /* @__PURE__ */
|
|
728
|
+
children: /* @__PURE__ */ z(se, {
|
|
688
729
|
to: e.href,
|
|
689
730
|
children: [
|
|
690
|
-
e.icon && /* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */
|
|
692
|
-
e.badge != null && /* @__PURE__ */
|
|
731
|
+
e.icon && /* @__PURE__ */ R(e.icon, {}),
|
|
732
|
+
/* @__PURE__ */ R("span", { children: e.title }),
|
|
733
|
+
e.badge != null && /* @__PURE__ */ R(a, {
|
|
693
734
|
variant: e.badgeVariant || "default",
|
|
694
735
|
className: "ml-auto h-5 min-w-5 px-1 text-xs",
|
|
695
736
|
children: e.badge
|
|
@@ -697,16 +738,16 @@ function Fe({ item: e, pathname: t }) {
|
|
|
697
738
|
]
|
|
698
739
|
})
|
|
699
740
|
}) }, e.href)) }) })] })
|
|
700
|
-
}) : /* @__PURE__ */
|
|
741
|
+
}) : /* @__PURE__ */ R(T, { children: /* @__PURE__ */ R(w, {
|
|
701
742
|
asChild: !0,
|
|
702
743
|
isActive: t === e.href,
|
|
703
744
|
tooltip: e.title,
|
|
704
|
-
children: /* @__PURE__ */
|
|
745
|
+
children: /* @__PURE__ */ z(se, {
|
|
705
746
|
to: e.href,
|
|
706
747
|
children: [
|
|
707
|
-
e.icon && /* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
e.badge != null && /* @__PURE__ */
|
|
748
|
+
e.icon && /* @__PURE__ */ R(e.icon, {}),
|
|
749
|
+
/* @__PURE__ */ R("span", { children: e.title }),
|
|
750
|
+
e.badge != null && /* @__PURE__ */ R(a, {
|
|
710
751
|
variant: e.badgeVariant || "default",
|
|
711
752
|
className: "ml-auto h-5 min-w-5 px-1 text-xs",
|
|
712
753
|
children: e.badge
|
|
@@ -715,43 +756,43 @@ function Fe({ item: e, pathname: t }) {
|
|
|
715
756
|
})
|
|
716
757
|
}) });
|
|
717
758
|
}
|
|
718
|
-
function
|
|
719
|
-
let s =
|
|
759
|
+
function Ve({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search..." }) {
|
|
760
|
+
let s = B(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : ze(e[0]) ? e.map((e) => ({
|
|
720
761
|
groupLabel: e.label,
|
|
721
762
|
items: e.items
|
|
722
|
-
})) : [{ items: e }], [e]),
|
|
723
|
-
if (!c) return
|
|
763
|
+
})) : [{ items: e }], [e]), f = t.useMemo(() => {
|
|
764
|
+
if (!c) return d;
|
|
724
765
|
let e = c.toLowerCase();
|
|
725
|
-
return
|
|
766
|
+
return d.map((t) => ({
|
|
726
767
|
...t,
|
|
727
768
|
items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
|
|
728
769
|
})).filter((e) => e.items.length > 0);
|
|
729
|
-
}, [
|
|
730
|
-
return /* @__PURE__ */
|
|
770
|
+
}, [d, c]);
|
|
771
|
+
return /* @__PURE__ */ R(p, {
|
|
731
772
|
className: r,
|
|
732
773
|
collapsible: i,
|
|
733
|
-
children: /* @__PURE__ */
|
|
774
|
+
children: /* @__PURE__ */ z(m, { children: [a && /* @__PURE__ */ R("div", {
|
|
734
775
|
className: "px-3 py-2",
|
|
735
|
-
children: /* @__PURE__ */
|
|
776
|
+
children: /* @__PURE__ */ z("div", {
|
|
736
777
|
className: "relative",
|
|
737
|
-
children: [/* @__PURE__ */
|
|
778
|
+
children: [/* @__PURE__ */ R(P, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ R(u, {
|
|
738
779
|
type: "search",
|
|
739
780
|
placeholder: o,
|
|
740
781
|
value: c,
|
|
741
|
-
onChange: (e) =>
|
|
782
|
+
onChange: (e) => l(e.target.value),
|
|
742
783
|
className: "pl-8 h-9"
|
|
743
784
|
})]
|
|
744
785
|
})
|
|
745
|
-
}),
|
|
746
|
-
t > 0 && /* @__PURE__ */
|
|
786
|
+
}), f.map((e, t) => /* @__PURE__ */ z(g, { children: [
|
|
787
|
+
t > 0 && /* @__PURE__ */ R("div", {
|
|
747
788
|
className: "mx-3 mb-1 h-px bg-sidebar-border/60",
|
|
748
789
|
"aria-hidden": !0
|
|
749
790
|
}),
|
|
750
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ R(v, {
|
|
751
792
|
className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
|
|
752
793
|
children: e.groupLabel || n
|
|
753
794
|
}),
|
|
754
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(Be, {
|
|
755
796
|
item: e,
|
|
756
797
|
pathname: s.pathname
|
|
757
798
|
}, e.href)) }) })
|
|
@@ -760,7 +801,7 @@ function Ie({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
760
801
|
}
|
|
761
802
|
//#endregion
|
|
762
803
|
//#region src/index.ts
|
|
763
|
-
function
|
|
804
|
+
function He() {
|
|
764
805
|
e.register("page-header", H, {
|
|
765
806
|
namespace: "layout",
|
|
766
807
|
label: "Page Header",
|
|
@@ -772,16 +813,16 @@ function Le() {
|
|
|
772
813
|
name: "description",
|
|
773
814
|
type: "string"
|
|
774
815
|
}]
|
|
775
|
-
}), e.register("page:header", H, { namespace: "layout" }), e.register("page:card",
|
|
816
|
+
}), e.register("page:header", H, { namespace: "layout" }), e.register("page:card", xe, {
|
|
776
817
|
namespace: "layout",
|
|
777
818
|
label: "Page Card",
|
|
778
819
|
category: "Layout",
|
|
779
820
|
isContainer: !0
|
|
780
|
-
}), e.register("app-shell",
|
|
821
|
+
}), e.register("app-shell", q, {
|
|
781
822
|
namespace: "layout",
|
|
782
823
|
label: "App Shell",
|
|
783
824
|
category: "Layout"
|
|
784
|
-
}), e.register("responsive-grid",
|
|
825
|
+
}), e.register("responsive-grid", Te, {
|
|
785
826
|
namespace: "layout",
|
|
786
827
|
label: "Responsive Grid",
|
|
787
828
|
category: "Layout",
|
|
@@ -804,7 +845,7 @@ function Le() {
|
|
|
804
845
|
name: "basePath",
|
|
805
846
|
type: "string"
|
|
806
847
|
}]
|
|
807
|
-
}), e.register("app-schema-renderer",
|
|
848
|
+
}), e.register("app-schema-renderer", Ie, {
|
|
808
849
|
namespace: "layout",
|
|
809
850
|
label: "App Schema Renderer",
|
|
810
851
|
category: "Layout",
|
|
@@ -826,7 +867,7 @@ function Le() {
|
|
|
826
867
|
});
|
|
827
868
|
}
|
|
828
869
|
try {
|
|
829
|
-
|
|
870
|
+
He();
|
|
830
871
|
} catch {}
|
|
831
872
|
//#endregion
|
|
832
|
-
export {
|
|
873
|
+
export { Ie as AppSchemaRenderer, q as AppShell, $ as NavigationRenderer, Re as Page, xe as PageCard, H as PageHeader, Te as ResponsiveGrid, Ve as SidebarNav, Z as filterNavigationItems, He as registerLayout, J as resolveIcon, Y as resolveLabel, be 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(`react/jsx-runtime`),require(`react-router-dom`),require(`lucide-react`),require(`@dnd-kit/core`),require(`@dnd-kit/sortable`),require(`@dnd-kit/utilities`),require(`@object-ui/types`),require(`@object-ui/react`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`react-router-dom`,`lucide-react`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`,`@object-ui/react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.react_jsx_runtime,e.react_router_dom,e.lucide_react,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types,e._object_ui_react))})(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);function y({title:e,description:t,action:n,className:a,children:o,...s}){return(0,i.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-4 pb-4 md:pb-8`,a),...s,children:(0,i.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-2`,children:[(0,i.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,i.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:e}),t&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(n||o)&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto sm:ml-0`,children:[n,o]})]})})}function b(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 x(e){let t=b(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function S(e){let t=b(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 C(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 w(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=x(e.primaryColor),i=S(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%`:C(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=x(e.accentColor),i=S(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%`:C(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 T({sidebar:e,navbar:t,children:n,className:a,defaultOpen:o=!0,branding:s}){return w(s,s?.title),(0,i.jsxs)(r.SidebarProvider,{defaultOpen:o,className:`!flex-col`,children:[(0,i.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,i.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,i.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,i.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`,a),children:n})})]})]})}function E({className:e,children:t,...n}){return(0,i.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,i.jsx)(`div`,{className:`p-6`,children:t})})}var D={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 O(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=D[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 k={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},A=({columns:e,gap:t=4,className:n,children:a})=>(0,i.jsx)(`div`,{className:(0,r.cn)(`grid`,O(e),typeof t==`number`?k[t]||`gap-${t}`:``,n),children:a});function j(e){return e?(0,r.getLazyIcon)(e):o.FileText}function M(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 N(e,t,n,r,i){let a=M(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 P=e=>!(e===!1||e===`false`),F=()=>!0,I=()=>!0;function L(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 R(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=R(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return M(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var z=5;function B({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:a,onAction:o,enablePinning:s,onPinToggle:u,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h}){let{attributes:g,listeners:_,setNodeRef:v,transform:y,transition:b,isDragging:x}=(0,c.useSortable)({id:e.id,disabled:!d});return(0,i.jsx)(`div`,{ref:v,style:{transform:l.CSS.Transform.toString(y),transition:b,opacity:x?.5:void 0,zIndex:x?10:void 0},...g,children:(0,i.jsx)(V,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:a,onAction:o,enablePinning:s,onPinToggle:u,dragListeners:d?_:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h})})}function V({item:e,basePath:t,evalVis:s,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_}){let v=(0,a.useLocation)(),[y,b]=(0,n.useState)(e.defaultOpen!==!1);if(!s(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,i.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,i.jsx)(r.Collapsible,{open:y,onOpenChange:b,children:(0,i.jsxs)(r.SidebarGroup,{children:[(0,i.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,i.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[N(e,m,_,h,g),(0,i.jsx)(o.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${y?`rotate-90`:``}`})]})}),(0,i.jsx)(r.CollapsibleContent,{children:(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:n.map(e=>(0,i.jsx)(V,{item:e,basePath:t,evalVis:s,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=j(e.icon),n=M(e.label,_);return(0,i.jsxs)(r.SidebarMenuItem,{children:[p&&(0,i.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,i.jsx)(o.GripVertical,{className:`h-3.5 w-3.5`})}),(0,i.jsxs)(r.SidebarMenuButton,{tooltip:n,onClick:()=>u?.(e),children:[(0,i.jsx)(t,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:n}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),d&&f&&(0,i.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,i.jsx)(o.PinOff,{className:`h-3.5 w-3.5`}):(0,i.jsx)(o.Pin,{className:`h-3.5 w-3.5`})})]})}let C=j(e.icon),{href:w,external:T}=L(e,t),E=w!==`#`&&v.pathname.startsWith(w),D=N(e,m,_,h,g),O=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:D}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,i.jsxs)(r.SidebarMenuItem,{children:[p&&(0,i.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,i.jsx)(o.GripVertical,{className:`h-3.5 w-3.5`})}),(0,i.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:E,tooltip:D,children:T?(0,i.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,children:O}):(0,i.jsx)(a.Link,{to:w,children:O})}),d&&f&&(0,i.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,i.jsx)(o.PinOff,{className:`h-3.5 w-3.5`}):(0,i.jsx)(o.Pin,{className:`h-3.5 w-3.5`})})]})}function H({items:e,basePath:t=``,evaluateVisibility:a=P,checkPermission:l=F,checkCapability:u=I,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?R(e,f):e,[e,f]),S=(0,n.useMemo)(()=>U(x),[x]),C=x.slice().sort((e,t)=>(e.order??0)-(t.order??0)),w=(0,s.useSensors)((0,s.useSensor)(s.PointerSensor,{activationConstraint:{distance:z}}),(0,s.useSensor)(s.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,c.arrayMove)(C,r,i).map((e,t)=>({...e,order:t})))},E={basePath:t,evalVis:a,checkPerm:l,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,i.jsxs)(r.SidebarGroup,{children:[(0,i.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(o.Star,{className:`h-3.5 w-3.5`}),b?b(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:S.map(e=>(0,i.jsx)(V,{item:e,...E},`fav-${e.id}`))})})]}):null;if(!D){let e=C.filter(e=>e.type!==`group`).map(e=>e.id);return(0,i.jsxs)(i.Fragment,{children:[O,(0,i.jsx)(r.SidebarGroup,{children:(0,i.jsx)(r.SidebarGroupContent,{children:h?(0,i.jsx)(s.DndContext,{sensors:w,collisionDetection:s.closestCenter,onDragEnd:T,children:(0,i.jsx)(c.SortableContext,{items:e,strategy:c.verticalListSortingStrategy,children:(0,i.jsx)(r.SidebarMenu,{children:C.map(e=>(0,i.jsx)(B,{item:e,enableReorder:h,...E},e.id))})})}):(0,i.jsx)(r.SidebarMenu,{children:C.map(e=>(0,i.jsx)(V,{item:e,...E},e.id))})})})]})}let k=[],A=[],j=e=>{if(A.length===0)return;let t=A;A=[],k.push((0,i.jsx)(r.SidebarGroup,{children:(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:t.map(e=>(0,i.jsx)(V,{item:e,...E},e.id))})})},e))};return C.forEach((e,t)=>{e.type===`group`?(j(`leaf-${t}`),k.push((0,i.jsx)(V,{item:e,...E},e.id))):A.push(e)}),j(`leaf-end`),(0,i.jsxs)(i.Fragment,{children:[O,k]})}function U(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...U(n.children));return t}function W({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,i.jsxs)(r.SidebarGroup,{children:[(0,i.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(o.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:c.map(e=>{let a=j(e.icon);return(0,i.jsx)(r.SidebarMenuItem,{children:(0,i.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:M(e.label),onClick:()=>n(e.id),children:[(0,i.jsx)(a,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:M(e.label)})]})},e.id)})})})]})}function G({items:e,basePath:t}){let n=(0,a.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},o=r(e).slice(0,5);return o.length===0?null:(0,i.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:o.map(e=>{let r=j(e.icon),o=`#`;e.type===`object`?(o=`${t}/${e.objectName}`,e.viewName&&(o+=`/view/${e.viewName}`)):e.type===`dashboard`?o=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`:e.type===`page`?o=e.pageName?`${t}/page/${e.pageName}`:`#`:e.type===`report`?o=e.reportName?`${t}/report/${e.reportName}`:`#`:e.type===`url`&&(o=e.url??`#`);let s=o!==`#`&&n.pathname.startsWith(o);return(0,i.jsxs)(a.Link,{to:o,className:`flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${s?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,i.jsx)(r,{className:`h-5 w-5`}),(0,i.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:M(e.label)})]},e.id)})})}function K({schema:e,basePath:t,evalVis:a,checkPerm:o,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=j(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,i.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,i.jsxs)(r.SidebarHeader,{children:[l??(0,i.jsx)(r.SidebarMenu,{children:(0,i.jsx)(r.SidebarMenuItem,{children:(0,i.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,i.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,i.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,i.jsx)(b,{className:`size-4`})}),(0,i.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,i.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,i.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,i.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,i.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,i.jsx)(W,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:a,checkPerm:o}),(0,i.jsx)(H,{items:m,basePath:t,evaluateVisibility:a,checkPermission:o,checkCapability:s,onAction:c,searchQuery:S,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}),d]}),u&&(0,i.jsx)(r.SidebarFooter,{children:u})]})}function q({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:a,checkPermission:o,checkCapability:s,onAction:c,navbar:l,sidebarHeader:d,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=a??(e=>!(e===!1||e===`false`)),C=o??(()=>!0),w=s??(()=>!0),E=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,u.menuItemToNavigationItem)(e,t)),[e.menu]),D=e.navigation??E,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,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(T,{sidebar:(0,i.jsx)(K,{schema:e,basePath:t,evalVis:S,checkPerm:C,checkCap:w,onAction:c,sidebarHeader:d,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,i.jsx)(G,{items:M,basePath:t})]})}var J=e=>e?Array.isArray(e)?e:[e]:[];function Y({schema:e,className:t,style:n,id:a,...o}){let s=J(e.children);return(0,i.jsxs)(`div`,{id:a||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,i.jsx)(y,{title:e.title,description:e.description}),(0,i.jsx)(`div`,{className:`flex-1 overflow-auto`,children:s.map((e,t)=>(0,i.jsx)(d.SchemaRenderer,{schema:e,...o},e?.id||t))})]})}function X(e){return`items`in e&&!(`href`in e)}function Z({item:e,pathname:t}){return e.children&&e.children.length>0?(0,i.jsx)(r.Collapsible,{asChild:!0,defaultOpen:!0,className:`group/collapsible`,children:(0,i.jsxs)(r.SidebarMenuItem,{children:[(0,i.jsx)(r.CollapsibleTrigger,{asChild:!0,children:(0,i.jsxs)(r.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,i.jsx)(e.icon,{}),(0,i.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,i.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,i.jsx)(o.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,i.jsx)(r.CollapsibleContent,{children:(0,i.jsx)(r.SidebarMenuSub,{children:e.children.map(e=>(0,i.jsx)(r.SidebarMenuSubItem,{children:(0,i.jsx)(r.SidebarMenuSubButton,{asChild:!0,isActive:t===e.href,children:(0,i.jsxs)(a.NavLink,{to:e.href,children:[e.icon&&(0,i.jsx)(e.icon,{}),(0,i.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,i.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,i.jsx)(r.SidebarMenuItem,{children:(0,i.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,children:(0,i.jsxs)(a.NavLink,{to:e.href,children:[e.icon&&(0,i.jsx)(e.icon,{}),(0,i.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})})}function Q({items:e,title:t=`Application`,className:s,collapsible:c=`icon`,searchEnabled:l=!1,searchPlaceholder:u=`Search...`}){let d=(0,a.useLocation)(),[f,p]=n.default.useState(``),m=n.default.useMemo(()=>e.length===0?[]:X(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,i.jsx)(r.Sidebar,{className:s,collapsible:c,children:(0,i.jsxs)(r.SidebarContent,{children:[l&&(0,i.jsx)(`div`,{className:`px-3 py-2`,children:(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(o.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,i.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,i.jsxs)(r.SidebarGroup,{children:[n>0&&(0,i.jsx)(`div`,{className:`mx-3 mb-1 h-px bg-sidebar-border/60`,"aria-hidden":!0}),(0,i.jsx)(r.SidebarGroupLabel,{className:`text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60`,children:e.groupLabel||t}),(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:e.items.map(e=>(0,i.jsx)(Z,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,y,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:header`,y,{namespace:`layout`}),t.ComponentRegistry.register(`page:card`,E,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,T,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,A,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,H,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,q,{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=q,e.AppShell=T,e.NavigationRenderer=H,e.Page=Y,e.PageCard=E,e.PageHeader=y,e.ResponsiveGrid=A,e.SidebarNav=Q,e.filterNavigationItems=R,e.registerLayout=$,e.resolveIcon=j,e.resolveLabel=M,e.useAppShellBranding=w});
|
|
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,7 +1,47 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
title: string;
|
|
4
|
+
/**
|
|
5
|
+
* Optional secondary line under the title. Spec schemas use `subtitle`,
|
|
6
|
+
* the legacy console pages use `description` — both are supported and
|
|
7
|
+
* resolve {field.path} tokens against the current record context.
|
|
8
|
+
*/
|
|
9
|
+
subtitle?: string;
|
|
4
10
|
description?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Optional icon for the header chip. Accepts either a string Lucide icon
|
|
13
|
+
* name (resolved via `LazyIcon`, the standard ObjectUI helper) or a
|
|
14
|
+
* pre-rendered React node.
|
|
15
|
+
*/
|
|
16
|
+
icon?: React.ReactNode | string;
|
|
5
17
|
action?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Show a back arrow at the left of the header that navigates one level
|
|
20
|
+
* up the URL (e.g. /apps/{app}/{obj}/record/{id} → /apps/{app}/{obj}).
|
|
21
|
+
* Defaults to true on record pages and false otherwise — the inference
|
|
22
|
+
* is based on whether a record context with a recordId is available.
|
|
23
|
+
*/
|
|
24
|
+
showBack?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Optional inline action list rendered into the header's right-aligned
|
|
27
|
+
* slot. Accepts an array of `ActionDef` objects (or action ids) and
|
|
28
|
+
* delegates rendering to the standard `record:quick_actions` widget
|
|
29
|
+
* with `location: 'record_header'`. Authors no longer need to declare
|
|
30
|
+
* a sibling `record:quick_actions` node + visual `-mt-12` hack.
|
|
31
|
+
*/
|
|
32
|
+
actions?: unknown[];
|
|
33
|
+
/**
|
|
34
|
+
* When rendered from a schema, `SchemaRenderer` injects the full schema
|
|
35
|
+
* node so we can render its `children` into the right-aligned action
|
|
36
|
+
* slot (Salesforce Lightning-style header). React children passed at
|
|
37
|
+
* the JSX call site take precedence over schema children.
|
|
38
|
+
*/
|
|
39
|
+
schema?: {
|
|
40
|
+
children?: unknown[];
|
|
41
|
+
actions?: unknown[];
|
|
42
|
+
properties?: {
|
|
43
|
+
actions?: unknown[];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
6
46
|
}
|
|
7
|
-
export declare function PageHeader({ title, description, action, className, children, ...props }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function PageHeader({ title, subtitle, description, icon, action, actions, showBack, schema, className, children, ...props }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/layout",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.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/core": "4.4.0",
|
|
26
|
+
"@object-ui/react": "4.4.0",
|
|
27
|
+
"@object-ui/types": "4.4.0",
|
|
28
|
+
"@object-ui/components": "4.4.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0",
|