@object-ui/layout 6.2.3 → 7.1.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 +54 -0
- package/dist/{packages/layout/src/AppSchemaRenderer.d.ts → AppSchemaRenderer.d.ts} +2 -2
- package/dist/{packages/layout/src/AppShell.d.ts → AppShell.d.ts} +1 -1
- package/dist/{packages/layout/src/NavigationRenderer.d.ts → NavigationRenderer.d.ts} +45 -2
- package/dist/{packages/layout/src/Page.d.ts → Page.d.ts} +2 -2
- package/dist/{packages/layout/src/PageCard.d.ts → PageCard.d.ts} +1 -1
- package/dist/{packages/layout/src/PageHeader.d.ts → PageHeader.d.ts} +1 -1
- package/dist/{packages/layout/src/SidebarNav.d.ts → SidebarNav.d.ts} +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.js +224 -172
- package/dist/index.umd.cjs +1 -1
- package/package.json +11 -11
- package/dist/packages/layout/src/index.d.ts +0 -13
- /package/dist/{packages/layout/src/ResponsiveGrid.d.ts → ResponsiveGrid.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @object-ui/layout
|
|
2
2
|
|
|
3
|
+
## 7.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [677f7ed]
|
|
8
|
+
- Updated dependencies [08c47da]
|
|
9
|
+
- Updated dependencies [a71be60]
|
|
10
|
+
- Updated dependencies [cb03bc3]
|
|
11
|
+
- @object-ui/types@7.1.0
|
|
12
|
+
- @object-ui/core@7.1.0
|
|
13
|
+
- @object-ui/react@7.1.0
|
|
14
|
+
- @object-ui/components@7.1.0
|
|
15
|
+
|
|
16
|
+
## 7.0.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [5976ba3]
|
|
21
|
+
- Updated dependencies [a00e16d]
|
|
22
|
+
- Updated dependencies [eaccefd]
|
|
23
|
+
- Updated dependencies [f7f325d]
|
|
24
|
+
- Updated dependencies [c12986e]
|
|
25
|
+
- Updated dependencies [71d7ce0]
|
|
26
|
+
- Updated dependencies [053c948]
|
|
27
|
+
- Updated dependencies [ddbe4a2]
|
|
28
|
+
- Updated dependencies [2d47e94]
|
|
29
|
+
- Updated dependencies [9049bbe]
|
|
30
|
+
- Updated dependencies [6c0c92c]
|
|
31
|
+
- Updated dependencies [cb2fdb1]
|
|
32
|
+
- Updated dependencies [c3749eb]
|
|
33
|
+
- Updated dependencies [6cfa330]
|
|
34
|
+
- Updated dependencies [ad8ade6]
|
|
35
|
+
- Updated dependencies [d54346c]
|
|
36
|
+
- Updated dependencies [3870c20]
|
|
37
|
+
- Updated dependencies [2eb3096]
|
|
38
|
+
- Updated dependencies [b88c560]
|
|
39
|
+
- Updated dependencies [d16566f]
|
|
40
|
+
- Updated dependencies [90acb7f]
|
|
41
|
+
- Updated dependencies [7913390]
|
|
42
|
+
- Updated dependencies [1394e34]
|
|
43
|
+
- Updated dependencies [e95cc25]
|
|
44
|
+
- Updated dependencies [abe8ebc]
|
|
45
|
+
- Updated dependencies [300d755]
|
|
46
|
+
- Updated dependencies [bd8b054]
|
|
47
|
+
- Updated dependencies [4eb9cb6]
|
|
48
|
+
- Updated dependencies [7c239fd]
|
|
49
|
+
- Updated dependencies [858ad94]
|
|
50
|
+
- Updated dependencies [2270239]
|
|
51
|
+
- Updated dependencies [8d1195d]
|
|
52
|
+
- @object-ui/core@7.0.0
|
|
53
|
+
- @object-ui/components@7.0.0
|
|
54
|
+
- @object-ui/react@7.0.0
|
|
55
|
+
- @object-ui/types@7.0.0
|
|
56
|
+
|
|
3
57
|
## 6.2.3
|
|
4
58
|
|
|
5
59
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { AppSchema, NavigationItem } from '
|
|
2
|
+
import { AppSchema, NavigationItem } from '@object-ui/types';
|
|
3
3
|
import { VisibilityEvaluator, PermissionChecker, CapabilityChecker } from './NavigationRenderer';
|
|
4
4
|
/** Mobile navigation display mode */
|
|
5
5
|
export type MobileNavMode = 'drawer' | 'bottom_nav' | 'hamburger';
|
|
@@ -67,4 +67,4 @@ export interface AppSchemaRendererProps {
|
|
|
67
67
|
* </AppSchemaRenderer>
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
|
-
export declare function AppSchemaRenderer({ schema, basePath, mobileNavMode, evaluateVisibility: evalVisProp, checkPermission: checkPermProp, checkCapability: checkCapProp, onAction, navbar, sidebarHeader, sidebarFooter, sidebarExtra, children, className, defaultOpen, enableSearch, enablePinning, onPinToggle, enableReorder, onReorder, }: AppSchemaRendererProps):
|
|
70
|
+
export declare function AppSchemaRenderer({ schema, basePath, mobileNavMode, evaluateVisibility: evalVisProp, checkPermission: checkPermProp, checkCapability: checkCapProp, onAction, navbar, sidebarHeader, sidebarFooter, sidebarExtra, children, className, defaultOpen, enableSearch, enablePinning, onPinToggle, enableReorder, onReorder, }: AppSchemaRendererProps): React.JSX.Element;
|
|
@@ -29,4 +29,4 @@ export interface AppShellProps {
|
|
|
29
29
|
* This is extracted as a standalone hook so it can be re-used independently.
|
|
30
30
|
*/
|
|
31
31
|
export declare function useAppShellBranding(branding?: AppShellBranding, title?: string): void;
|
|
32
|
-
export declare function AppShell({ sidebar, navbar, children, className, defaultOpen, branding, }: AppShellProps):
|
|
32
|
+
export declare function AppShell({ sidebar, navbar, children, className, defaultOpen, branding, }: AppShellProps): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { NavigationItem } from '
|
|
2
|
+
import { NavigationItem } from '@object-ui/types';
|
|
3
3
|
/**
|
|
4
4
|
* Callback to evaluate a visibility expression.
|
|
5
5
|
* Return `true` if the item should be visible.
|
|
@@ -110,6 +110,16 @@ export interface NavigationRendererProps {
|
|
|
110
110
|
* through i18next; otherwise falls back to `defaultValue`.
|
|
111
111
|
*/
|
|
112
112
|
t?: (key: string, options?: any) => string;
|
|
113
|
+
/**
|
|
114
|
+
* Optional template-variable context for resolving `recordId` on
|
|
115
|
+
* `object`-type nav items that target a specific record. The shell
|
|
116
|
+
* passes the signed-in user id / active org id; authors write
|
|
117
|
+
* `{current_user_id}` / `{current_org_id}` in `recordId`.
|
|
118
|
+
*
|
|
119
|
+
* When omitted (or a referenced variable is missing), affected items
|
|
120
|
+
* fall back to opening the list view so the link is still functional.
|
|
121
|
+
*/
|
|
122
|
+
templateContext?: NavTemplateContext;
|
|
113
123
|
}
|
|
114
124
|
/**
|
|
115
125
|
* Resolve a Lucide icon component by name string.
|
|
@@ -127,6 +137,39 @@ export declare function resolveLabel(label: string | {
|
|
|
127
137
|
defaultValue?: string;
|
|
128
138
|
params?: Record<string, any>;
|
|
129
139
|
}, t?: (key: string, options?: any) => string): string;
|
|
140
|
+
/**
|
|
141
|
+
* Lightweight template-variable context for nav items that target a
|
|
142
|
+
* specific record / org. The shell injects the signed-in user id and
|
|
143
|
+
* active org id; the schema author writes `{current_user_id}` /
|
|
144
|
+
* `{current_org_id}` in `recordId` and the renderer substitutes.
|
|
145
|
+
*
|
|
146
|
+
* Kept intentionally small — anything beyond this should be a Page or
|
|
147
|
+
* a `component`-type nav, not encoded in metadata strings.
|
|
148
|
+
*/
|
|
149
|
+
export interface NavTemplateContext {
|
|
150
|
+
currentUserId?: string | null;
|
|
151
|
+
currentOrgId?: string | null;
|
|
152
|
+
/**
|
|
153
|
+
* Active values for app-level context selectors (e.g. the Studio
|
|
154
|
+
* package scope). Keyed by the selector's `id`; referenced in nav
|
|
155
|
+
* items as `{<id>}` (e.g. `{active_package}`). Empty/absent values
|
|
156
|
+
* are treated as "no scope" and dropped from the resolved URL.
|
|
157
|
+
*/
|
|
158
|
+
contextValues?: Record<string, string | null | undefined>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Resolve a NavigationItem to an absolute href (relative to `basePath`).
|
|
162
|
+
*
|
|
163
|
+
* Single source of truth for nav → URL mapping across the shell. Other
|
|
164
|
+
* surfaces that need to navigate to a nav item (command palette,
|
|
165
|
+
* pinned rail, search results, recent items, etc.) MUST use this helper
|
|
166
|
+
* instead of constructing URLs ad-hoc — otherwise features like
|
|
167
|
+
* `recordId` / `recordMode` / `componentRef` will silently regress.
|
|
168
|
+
*/
|
|
169
|
+
export declare function resolveHref(item: NavigationItem, basePath: string, templateContext?: NavTemplateContext): {
|
|
170
|
+
href: string;
|
|
171
|
+
external: boolean;
|
|
172
|
+
};
|
|
130
173
|
/**
|
|
131
174
|
* Recursively filter navigation items by search query (case-insensitive label match).
|
|
132
175
|
* Groups are kept if any child matches, with non-matching children pruned.
|
|
@@ -161,4 +204,4 @@ export declare function filterNavigationItems(items: NavigationItem[], query: st
|
|
|
161
204
|
* />
|
|
162
205
|
* ```
|
|
163
206
|
*/
|
|
164
|
-
export declare function NavigationRenderer({ items, basePath, evaluateVisibility: evalVis, checkPermission: checkPerm, checkCapability: checkCap, onAction, searchQuery, enablePinning, onPinToggle, enableReorder, onReorder, resolveObjectLabel, resolveDashboardLabel, resolveGroupLabel, resolveViewLabel, resolveItemLabel, t: tProp, }: NavigationRendererProps):
|
|
207
|
+
export declare function NavigationRenderer({ items, basePath, evaluateVisibility: evalVis, checkPermission: checkPerm, checkCapability: checkCap, onAction, searchQuery, enablePinning, onPinToggle, enableReorder, onReorder, resolveObjectLabel, resolveDashboardLabel, resolveGroupLabel, resolveViewLabel, resolveItemLabel, t: tProp, templateContext, }: NavigationRendererProps): React.JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { PageSchema } from '
|
|
2
|
+
import { PageSchema } from '@object-ui/types';
|
|
3
3
|
export declare function Page({ schema, className, style, id, ...props }: {
|
|
4
4
|
schema: PageSchema;
|
|
5
5
|
className?: string;
|
|
6
6
|
style?: React.CSSProperties;
|
|
7
7
|
id?: string;
|
|
8
|
-
} & any):
|
|
8
|
+
} & any): React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
export declare function PageCard({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>):
|
|
2
|
+
export declare function PageCard({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
@@ -44,4 +44,4 @@ export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
export declare function PageHeader({ title, subtitle, description, icon, action, actions, showBack, schema, className, children, ...props }: PageHeaderProps):
|
|
47
|
+
export declare function PageHeader({ title, subtitle, description, icon, action, actions, showBack, schema, className, children, ...props }: PageHeaderProps): React.JSX.Element;
|
|
@@ -21,4 +21,4 @@ export interface SidebarNavProps {
|
|
|
21
21
|
searchEnabled?: boolean;
|
|
22
22
|
searchPlaceholder?: string;
|
|
23
23
|
}
|
|
24
|
-
export declare function SidebarNav({ items, title, className, collapsible, searchEnabled, searchPlaceholder }: SidebarNavProps):
|
|
24
|
+
export declare function SidebarNav({ items, title, className, collapsible, searchEnabled, searchPlaceholder }: SidebarNavProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI Layout
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*/
|
|
5
|
+
export * from './PageHeader';
|
|
6
|
+
export * from './AppShell';
|
|
7
|
+
export * from './Page';
|
|
8
|
+
export * from './PageCard';
|
|
9
|
+
export * from './SidebarNav';
|
|
10
|
+
export * from './ResponsiveGrid';
|
|
11
|
+
export * from './NavigationRenderer';
|
|
12
|
+
export * from './AppSchemaRenderer';
|
|
13
|
+
export declare function registerLayout(): void;
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
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, 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
|
|
5
|
-
import { SchemaRenderer as I, useRecordContext as
|
|
3
|
+
import { Badge as a, Button as o, Collapsible as s, CollapsibleContent as c, CollapsibleTrigger as l, Input as u, LazyIcon as d, Separator as f, Sidebar as p, SidebarContent as m, SidebarFooter as h, SidebarGroup as g, SidebarGroupContent as _, SidebarGroupLabel as v, SidebarHeader as y, SidebarInput as b, SidebarInset as x, SidebarMenu as S, SidebarMenuAction as C, SidebarMenuButton as w, SidebarMenuItem as T, SidebarMenuSub as E, SidebarMenuSubButton as D, SidebarMenuSubItem as O, SidebarProvider as k, cn as A, getLazyIcon as j, useIsMobile as M } from "@object-ui/components";
|
|
4
|
+
import { ArrowLeft as N, ChevronRight as ee, FileText as P, GripVertical as te, Layers as F, Pin as ne, PinOff as re, Search as ie, Star as ae } from "lucide-react";
|
|
5
|
+
import { SchemaRenderer as I, useRecordContext as oe } from "@object-ui/react";
|
|
6
6
|
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
7
|
-
import { Link as
|
|
8
|
-
import { DndContext as
|
|
9
|
-
import { SortableContext as
|
|
10
|
-
import { CSS as
|
|
11
|
-
import { menuItemToNavigationItem as
|
|
7
|
+
import { Link as se, NavLink as B, useLocation as V } from "react-router-dom";
|
|
8
|
+
import { DndContext as H, KeyboardSensor as ce, PointerSensor as U, closestCenter as le, useSensor as W, useSensors as G } from "@dnd-kit/core";
|
|
9
|
+
import { SortableContext as K, arrayMove as ue, useSortable as de, verticalListSortingStrategy as fe } from "@dnd-kit/sortable";
|
|
10
|
+
import { CSS as pe } from "@dnd-kit/utilities";
|
|
11
|
+
import { menuItemToNavigationItem as me } from "@object-ui/types";
|
|
12
12
|
//#region src/PageHeader.tsx
|
|
13
|
-
var
|
|
13
|
+
var he = (e) => {
|
|
14
14
|
let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
|
|
15
15
|
return t != null && String(t).trim() ? String(t) : [
|
|
16
16
|
e?.salutation,
|
|
17
17
|
e?.first_name,
|
|
18
18
|
e?.last_name
|
|
19
19
|
].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
|
|
20
|
-
},
|
|
20
|
+
}, ge = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
|
|
21
21
|
let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
|
|
22
|
-
return r == null ? "" : typeof r == "object" ?
|
|
22
|
+
return r == null ? "" : typeof r == "object" ? he(r) ?? "" : String(r);
|
|
23
23
|
}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
|
|
24
|
-
function
|
|
25
|
-
let m =
|
|
24
|
+
function q({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
|
|
25
|
+
let m = oe(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = ge(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = ge(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
|
|
26
26
|
if (typeof window > "u") return;
|
|
27
27
|
let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
|
|
28
28
|
t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
@@ -48,7 +48,7 @@ function K({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
|
|
|
48
48
|
onClick: C,
|
|
49
49
|
"aria-label": "Back to list",
|
|
50
50
|
className: "flex-shrink-0 -ml-2",
|
|
51
|
-
children: /* @__PURE__ */ R(
|
|
51
|
+
children: /* @__PURE__ */ R(N, { className: "size-4" })
|
|
52
52
|
}),
|
|
53
53
|
i && (g || y) && /* @__PURE__ */ R("div", {
|
|
54
54
|
className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
|
|
@@ -77,7 +77,7 @@ function K({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
|
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/AppShell.tsx
|
|
80
|
-
function
|
|
80
|
+
function _e(e) {
|
|
81
81
|
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
82
82
|
if (!t) return null;
|
|
83
83
|
let n = parseInt(t[1], 16) / 255, r = parseInt(t[2], 16) / 255, i = parseInt(t[3], 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = 0, c = 0, l = (a + o) / 2;
|
|
@@ -101,17 +101,17 @@ function q(e) {
|
|
|
101
101
|
l: l * 100
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
let t =
|
|
104
|
+
function ve(e) {
|
|
105
|
+
let t = _e(e);
|
|
106
106
|
return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
let t =
|
|
108
|
+
function ye(e) {
|
|
109
|
+
let t = _e(e);
|
|
110
110
|
if (!t) return null;
|
|
111
111
|
let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
|
|
112
112
|
return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function be(e) {
|
|
115
115
|
let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
116
116
|
if (!t) return "0 0% 100%";
|
|
117
117
|
let n = (e) => {
|
|
@@ -120,16 +120,16 @@ function ye(e) {
|
|
|
120
120
|
}, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
|
|
121
121
|
return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function xe(e, t) {
|
|
124
124
|
n(() => {
|
|
125
125
|
let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
|
|
126
126
|
if (e?.primaryColor) {
|
|
127
|
-
let t =
|
|
128
|
-
a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" :
|
|
127
|
+
let t = ve(e.primaryColor), i = ye(e.primaryColor), a = r() && i || t;
|
|
128
|
+
a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : be(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
|
|
129
129
|
} else n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring");
|
|
130
130
|
if (e?.accentColor) {
|
|
131
|
-
let t =
|
|
132
|
-
a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" :
|
|
131
|
+
let t = ve(e.accentColor), i = ye(e.accentColor), a = r() && i || t;
|
|
132
|
+
a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : be(e.accentColor)));
|
|
133
133
|
} else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
|
|
134
134
|
};
|
|
135
135
|
i();
|
|
@@ -157,7 +157,7 @@ function be(e, t) {
|
|
|
157
157
|
]);
|
|
158
158
|
}
|
|
159
159
|
function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a }) {
|
|
160
|
-
return
|
|
160
|
+
return xe(a, a?.title), /* @__PURE__ */ z(k, {
|
|
161
161
|
defaultOpen: i,
|
|
162
162
|
className: "!flex-col h-svh overflow-hidden",
|
|
163
163
|
children: [/* @__PURE__ */ R("header", {
|
|
@@ -177,7 +177,7 @@ function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
|
|
|
177
177
|
}
|
|
178
178
|
//#endregion
|
|
179
179
|
//#region src/PageCard.tsx
|
|
180
|
-
function
|
|
180
|
+
function Se({ className: e, children: t, ...n }) {
|
|
181
181
|
return /* @__PURE__ */ R("div", {
|
|
182
182
|
className: A("rounded-xl border bg-card text-card-foreground shadow", e),
|
|
183
183
|
...n,
|
|
@@ -189,7 +189,7 @@ function xe({ className: e, children: t, ...n }) {
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/ResponsiveGrid.tsx
|
|
192
|
-
var
|
|
192
|
+
var Ce = {
|
|
193
193
|
xs: {
|
|
194
194
|
1: "grid-cols-1",
|
|
195
195
|
2: "grid-cols-2",
|
|
@@ -239,11 +239,11 @@ var Se = {
|
|
|
239
239
|
12: "2xl:grid-cols-12"
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
|
-
function
|
|
242
|
+
function we(e) {
|
|
243
243
|
if (!e) return "grid-cols-1";
|
|
244
244
|
let t = [];
|
|
245
245
|
for (let [n, r] of Object.entries(e)) {
|
|
246
|
-
let e =
|
|
246
|
+
let e = Ce[n];
|
|
247
247
|
if (e && r) {
|
|
248
248
|
let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
|
|
249
249
|
t.push(e[n]);
|
|
@@ -251,7 +251,7 @@ function Ce(e) {
|
|
|
251
251
|
}
|
|
252
252
|
return t.join(" ") || "grid-cols-1";
|
|
253
253
|
}
|
|
254
|
-
var
|
|
254
|
+
var Te = {
|
|
255
255
|
0: "gap-0",
|
|
256
256
|
1: "gap-1",
|
|
257
257
|
2: "gap-2",
|
|
@@ -260,14 +260,14 @@ var we = {
|
|
|
260
260
|
5: "gap-5",
|
|
261
261
|
6: "gap-6",
|
|
262
262
|
8: "gap-8"
|
|
263
|
-
},
|
|
264
|
-
className: A("grid",
|
|
263
|
+
}, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
|
|
264
|
+
className: A("grid", we(e), typeof t == "number" ? Te[t] || `gap-${t}` : "", n),
|
|
265
265
|
children: r
|
|
266
266
|
});
|
|
267
267
|
//#endregion
|
|
268
268
|
//#region src/NavigationRenderer.tsx
|
|
269
269
|
function Y(e) {
|
|
270
|
-
return e ? j(e) :
|
|
270
|
+
return e ? j(e) : P;
|
|
271
271
|
}
|
|
272
272
|
function X(e, t) {
|
|
273
273
|
if (typeof e == "string") return e;
|
|
@@ -280,7 +280,7 @@ function X(e, t) {
|
|
|
280
280
|
}
|
|
281
281
|
return e.defaultValue || e.key;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function De(e, t, n, r, i, a, o) {
|
|
284
284
|
let s = X(e.label, n);
|
|
285
285
|
if (typeof e.label != "string") return s;
|
|
286
286
|
if (e.type === "object" && e.objectName) {
|
|
@@ -289,13 +289,31 @@ function Ee(e, t, n, r, i, a, o) {
|
|
|
289
289
|
}
|
|
290
290
|
return r && e.type === "dashboard" && e.dashboardName ? r(e.dashboardName, s) : i && e.type === "group" && e.id ? i(e.id, s) : o && e.id ? o(e.id, s) : s;
|
|
291
291
|
}
|
|
292
|
-
var
|
|
293
|
-
function
|
|
292
|
+
var Oe = (e) => !(e === !1 || e === "false"), ke = () => !0, Ae = () => !0, je = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
|
|
293
|
+
function Z(e, t) {
|
|
294
|
+
if (!e.includes("{")) return e;
|
|
295
|
+
let n = !1, r = e.replace(je, (e, r) => {
|
|
296
|
+
let i;
|
|
297
|
+
return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
|
|
298
|
+
});
|
|
299
|
+
return n ? null : r;
|
|
300
|
+
}
|
|
301
|
+
function Me(e, t, n) {
|
|
294
302
|
switch (e.type) {
|
|
295
303
|
case "object": {
|
|
296
|
-
let
|
|
304
|
+
let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
|
|
305
|
+
if (i) {
|
|
306
|
+
let t = Z(i, n);
|
|
307
|
+
if (t) {
|
|
308
|
+
let n = `${r}/record/${encodeURIComponent(t)}`;
|
|
309
|
+
return {
|
|
310
|
+
href: e.recordMode === "edit" ? `${n}/edit` : n,
|
|
311
|
+
external: !1
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
297
315
|
return {
|
|
298
|
-
href: e.viewName ? `${
|
|
316
|
+
href: e.viewName ? `${r}/view/${e.viewName}` : r,
|
|
299
317
|
external: !1
|
|
300
318
|
};
|
|
301
319
|
}
|
|
@@ -303,10 +321,26 @@ function Ae(e, t) {
|
|
|
303
321
|
href: e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#",
|
|
304
322
|
external: !1
|
|
305
323
|
};
|
|
306
|
-
case "page":
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
324
|
+
case "page": {
|
|
325
|
+
if (!e.pageName) return {
|
|
326
|
+
href: "#",
|
|
327
|
+
external: !1
|
|
328
|
+
};
|
|
329
|
+
let r = e.params, i = `${t}/page/${e.pageName}`;
|
|
330
|
+
if (r && typeof r == "object") {
|
|
331
|
+
let e = new URLSearchParams();
|
|
332
|
+
for (let [t, i] of Object.entries(r)) if (i != null) if (typeof i == "string") {
|
|
333
|
+
let r = Z(i, n);
|
|
334
|
+
r !== null && e.set(t, r);
|
|
335
|
+
} else e.set(t, JSON.stringify(i));
|
|
336
|
+
let t = e.toString();
|
|
337
|
+
t && (i += `?${t}`);
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
href: i,
|
|
341
|
+
external: !1
|
|
342
|
+
};
|
|
343
|
+
}
|
|
310
344
|
case "report": return {
|
|
311
345
|
href: e.reportName ? `${t}/report/${e.reportName}` : "#",
|
|
312
346
|
external: !1
|
|
@@ -316,39 +350,48 @@ function Ae(e, t) {
|
|
|
316
350
|
external: e.target === "_blank"
|
|
317
351
|
};
|
|
318
352
|
case "component": {
|
|
319
|
-
let
|
|
320
|
-
if (!
|
|
353
|
+
let r = e.componentRef;
|
|
354
|
+
if (!r) return {
|
|
321
355
|
href: "#",
|
|
322
356
|
external: !1
|
|
323
357
|
};
|
|
324
|
-
let
|
|
325
|
-
if (
|
|
358
|
+
let i = r.split(":").filter(Boolean);
|
|
359
|
+
if (i.length === 0) return {
|
|
326
360
|
href: "#",
|
|
327
361
|
external: !1
|
|
328
362
|
};
|
|
329
|
-
let
|
|
330
|
-
if (
|
|
331
|
-
let e =
|
|
363
|
+
let a = e.params;
|
|
364
|
+
if (i[0] === "metadata") {
|
|
365
|
+
let e = i[1], r = a && typeof a.type == "string" ? a.type : void 0, o = a && typeof a.name == "string" ? a.name : void 0, s = "";
|
|
366
|
+
if (a && typeof a == "object") {
|
|
367
|
+
let e = new URLSearchParams();
|
|
368
|
+
for (let [t, r] of Object.entries(a)) if (!(t === "type" || t === "name") && r != null) if (typeof r == "string") {
|
|
369
|
+
let i = Z(r, n);
|
|
370
|
+
i && e.set(t, i);
|
|
371
|
+
} else e.set(t, JSON.stringify(r));
|
|
372
|
+
let t = e.toString();
|
|
373
|
+
t && (s = `?${t}`);
|
|
374
|
+
}
|
|
332
375
|
return e === "directory" || !e ? {
|
|
333
|
-
href: `${t}/metadata`,
|
|
376
|
+
href: `${t}/metadata${s}`,
|
|
334
377
|
external: !1
|
|
335
|
-
} : e === "resource" &&
|
|
336
|
-
href: `${t}/metadata${
|
|
378
|
+
} : e === "resource" && r ? {
|
|
379
|
+
href: `${t}/metadata${o ? `/${encodeURIComponent(r)}/${encodeURIComponent(o)}` : `/${encodeURIComponent(r)}`}${s}`,
|
|
337
380
|
external: !1
|
|
338
381
|
} : {
|
|
339
|
-
href: `${t}/metadata`,
|
|
382
|
+
href: `${t}/metadata${s}`,
|
|
340
383
|
external: !1
|
|
341
384
|
};
|
|
342
385
|
}
|
|
343
|
-
let
|
|
344
|
-
if (
|
|
386
|
+
let o = `${t}/component/${i.join("/")}`;
|
|
387
|
+
if (a && typeof a == "object") {
|
|
345
388
|
let e = new URLSearchParams();
|
|
346
|
-
for (let [t, n] of Object.entries(
|
|
389
|
+
for (let [t, n] of Object.entries(a)) n != null && e.set(t, typeof n == "string" ? n : JSON.stringify(n));
|
|
347
390
|
let t = e.toString();
|
|
348
|
-
t && (
|
|
391
|
+
t && (o += `?${t}`);
|
|
349
392
|
}
|
|
350
393
|
return {
|
|
351
|
-
href:
|
|
394
|
+
href: o,
|
|
352
395
|
external: !1
|
|
353
396
|
};
|
|
354
397
|
}
|
|
@@ -358,16 +401,19 @@ function Ae(e, t) {
|
|
|
358
401
|
};
|
|
359
402
|
}
|
|
360
403
|
}
|
|
361
|
-
function
|
|
362
|
-
|
|
404
|
+
function Ne(e, t, n) {
|
|
405
|
+
if (t === "#") return !1;
|
|
406
|
+
if (n === t) return !0;
|
|
407
|
+
let r = e.componentRef;
|
|
408
|
+
return r && r.split(":")[1] === "directory" ? !1 : e.type === "object" && e.objectName ? !(e.viewName || !n.startsWith(`${t}/`) || n.slice(t.length + 1).startsWith("view/")) : n.startsWith(`${t}/`);
|
|
363
409
|
}
|
|
364
|
-
function
|
|
410
|
+
function Pe(e, t) {
|
|
365
411
|
if (!t.trim()) return e;
|
|
366
412
|
let n = t.toLowerCase().trim();
|
|
367
413
|
return e.reduce((e, r) => {
|
|
368
414
|
if (r.type === "separator") return e;
|
|
369
415
|
if (r.type === "group" && r.children?.length) {
|
|
370
|
-
let n =
|
|
416
|
+
let n = Pe(r.children, t);
|
|
371
417
|
return n.length > 0 && e.push({
|
|
372
418
|
...r,
|
|
373
419
|
children: n
|
|
@@ -376,21 +422,21 @@ function Z(e, t) {
|
|
|
376
422
|
return X(r.label).toLowerCase().includes(n) && e.push(r), e;
|
|
377
423
|
}, []);
|
|
378
424
|
}
|
|
379
|
-
var
|
|
380
|
-
function
|
|
381
|
-
let { attributes:
|
|
425
|
+
var Fe = 5;
|
|
426
|
+
function Ie({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, resolveItemLabel: p, t: m, templateContext: h }) {
|
|
427
|
+
let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = de({
|
|
382
428
|
id: e.id,
|
|
383
429
|
disabled: !c
|
|
384
430
|
});
|
|
385
431
|
return /* @__PURE__ */ R("div", {
|
|
386
|
-
ref:
|
|
432
|
+
ref: v,
|
|
387
433
|
style: {
|
|
388
|
-
transform:
|
|
389
|
-
transition:
|
|
390
|
-
opacity:
|
|
391
|
-
zIndex:
|
|
434
|
+
transform: pe.Transform.toString(y),
|
|
435
|
+
transition: b,
|
|
436
|
+
opacity: x ? .5 : void 0,
|
|
437
|
+
zIndex: x ? 10 : void 0
|
|
392
438
|
},
|
|
393
|
-
...
|
|
439
|
+
...g,
|
|
394
440
|
children: /* @__PURE__ */ R(Q, {
|
|
395
441
|
item: e,
|
|
396
442
|
basePath: t,
|
|
@@ -400,22 +446,23 @@ function Ne({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
|
|
|
400
446
|
onAction: a,
|
|
401
447
|
enablePinning: o,
|
|
402
448
|
onPinToggle: s,
|
|
403
|
-
dragListeners: c ?
|
|
449
|
+
dragListeners: c ? _ : void 0,
|
|
404
450
|
resolveObjectLabel: l,
|
|
405
451
|
resolveDashboardLabel: u,
|
|
406
452
|
resolveGroupLabel: d,
|
|
407
453
|
resolveViewLabel: f,
|
|
408
454
|
resolveItemLabel: p,
|
|
409
|
-
t: m
|
|
455
|
+
t: m,
|
|
456
|
+
templateContext: h
|
|
410
457
|
})
|
|
411
458
|
});
|
|
412
459
|
}
|
|
413
|
-
function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onAction: d, enablePinning: p, onPinToggle: m, dragListeners: h, resolveObjectLabel: y, resolveDashboardLabel: b, resolveGroupLabel: x, resolveViewLabel: E, resolveItemLabel: D, t: O }) {
|
|
414
|
-
let
|
|
460
|
+
function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onAction: d, enablePinning: p, onPinToggle: m, dragListeners: h, resolveObjectLabel: y, resolveDashboardLabel: b, resolveGroupLabel: x, resolveViewLabel: E, resolveItemLabel: D, t: O, templateContext: k }) {
|
|
461
|
+
let j = V(), N = M(), P = N ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, F = A("shrink-0", N ? "h-5 w-5" : "h-4 w-4"), ie = (() => {
|
|
415
462
|
let t = e.expanded;
|
|
416
463
|
if (typeof t == "boolean") return t;
|
|
417
464
|
if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
|
|
418
|
-
})(),
|
|
465
|
+
})(), ae = e.type === "group" ? e.children?.length ?? 0 : 0, [I, oe] = i(t.useMemo(() => {
|
|
419
466
|
if (e.type !== "group") return !1;
|
|
420
467
|
let t = (e) => {
|
|
421
468
|
if (!e) return !1;
|
|
@@ -424,8 +471,8 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
424
471
|
if (t(r.children)) return !0;
|
|
425
472
|
continue;
|
|
426
473
|
}
|
|
427
|
-
let { href: e } =
|
|
428
|
-
if (
|
|
474
|
+
let { href: e } = Me(r, n, k);
|
|
475
|
+
if (Ne(r, e, j.pathname)) return !0;
|
|
429
476
|
}
|
|
430
477
|
return !1;
|
|
431
478
|
};
|
|
@@ -433,22 +480,22 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
433
480
|
}, [
|
|
434
481
|
e,
|
|
435
482
|
n,
|
|
436
|
-
|
|
437
|
-
]) ? !0 :
|
|
483
|
+
j.pathname
|
|
484
|
+
]) ? !0 : ie ?? !(ae >= 8));
|
|
438
485
|
if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
|
|
439
|
-
let
|
|
440
|
-
if (
|
|
486
|
+
let B = e.requiresObject, H = e.requiresService;
|
|
487
|
+
if (B && !u("object", B) || H && !u("service", H)) return null;
|
|
441
488
|
if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
|
|
442
489
|
if (e.type === "group") {
|
|
443
|
-
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
|
|
490
|
+
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = De(e, y, O, b, x, E, D);
|
|
444
491
|
return /* @__PURE__ */ R(s, {
|
|
445
|
-
open:
|
|
446
|
-
onOpenChange:
|
|
492
|
+
open: I,
|
|
493
|
+
onOpenChange: oe,
|
|
447
494
|
children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
|
|
448
495
|
asChild: !0,
|
|
449
496
|
children: /* @__PURE__ */ z(l, {
|
|
450
|
-
className: "flex w-full items-center justify-between",
|
|
451
|
-
children: [
|
|
497
|
+
className: A("flex w-full items-center justify-between", N && "min-h-[44px] text-[15px] rounded-xl"),
|
|
498
|
+
children: [i, /* @__PURE__ */ R(ee, { className: A("ml-auto transition-transform", N ? "h-5 w-5" : "h-4 w-4", I && "rotate-90") })]
|
|
452
499
|
})
|
|
453
500
|
}), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
|
|
454
501
|
item: e,
|
|
@@ -464,7 +511,8 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
464
511
|
resolveGroupLabel: x,
|
|
465
512
|
resolveViewLabel: E,
|
|
466
513
|
resolveItemLabel: D,
|
|
467
|
-
t: O
|
|
514
|
+
t: O,
|
|
515
|
+
templateContext: k
|
|
468
516
|
}, e.id)) }) }) })] })
|
|
469
517
|
});
|
|
470
518
|
}
|
|
@@ -475,13 +523,14 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
475
523
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
476
524
|
"aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
477
525
|
...h,
|
|
478
|
-
children: /* @__PURE__ */ R(
|
|
526
|
+
children: /* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" })
|
|
479
527
|
}),
|
|
480
528
|
/* @__PURE__ */ z(w, {
|
|
481
529
|
tooltip: r,
|
|
482
530
|
onClick: () => d?.(e),
|
|
531
|
+
className: P,
|
|
483
532
|
children: [
|
|
484
|
-
/* @__PURE__ */ R(t, { className:
|
|
533
|
+
/* @__PURE__ */ R(t, { className: F }),
|
|
485
534
|
/* @__PURE__ */ R("span", { children: r }),
|
|
486
535
|
e.badge != null && /* @__PURE__ */ R(a, {
|
|
487
536
|
variant: e.badgeVariant ?? "default",
|
|
@@ -497,13 +546,13 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
497
546
|
defaultValue: e.pinned ? `Unpin ${r}` : `Pin ${r}`,
|
|
498
547
|
name: r
|
|
499
548
|
}) : e.pinned ? `Unpin ${r}` : `Pin ${r}`,
|
|
500
|
-
children: e.pinned ? /* @__PURE__ */ R(
|
|
549
|
+
children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
|
|
501
550
|
})
|
|
502
551
|
] });
|
|
503
552
|
}
|
|
504
|
-
let
|
|
505
|
-
/* @__PURE__ */ R(
|
|
506
|
-
/* @__PURE__ */ R("span", { children:
|
|
553
|
+
let ce = Y(e.icon), { href: U, external: le } = Me(e, n, k), W = Ne(e, U, j.pathname), G = De(e, y, O, b, x, E, D), K = /* @__PURE__ */ z(L, { children: [
|
|
554
|
+
/* @__PURE__ */ R(ce, { className: F }),
|
|
555
|
+
/* @__PURE__ */ R("span", { children: G }),
|
|
507
556
|
e.badge != null && /* @__PURE__ */ R(a, {
|
|
508
557
|
variant: e.badgeVariant ?? "default",
|
|
509
558
|
className: "ml-auto text-[10px] px-1.5 py-0",
|
|
@@ -515,43 +564,44 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
515
564
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
516
565
|
"aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
|
|
517
566
|
...h,
|
|
518
|
-
children: /* @__PURE__ */ R(
|
|
567
|
+
children: /* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" })
|
|
519
568
|
}),
|
|
520
569
|
/* @__PURE__ */ R(w, {
|
|
521
570
|
asChild: !0,
|
|
522
|
-
isActive:
|
|
523
|
-
tooltip:
|
|
524
|
-
|
|
525
|
-
|
|
571
|
+
isActive: W,
|
|
572
|
+
tooltip: G,
|
|
573
|
+
className: P,
|
|
574
|
+
children: le ? /* @__PURE__ */ R("a", {
|
|
575
|
+
href: U,
|
|
526
576
|
target: "_blank",
|
|
527
577
|
rel: "noopener noreferrer",
|
|
528
|
-
children:
|
|
529
|
-
}) : /* @__PURE__ */ R(
|
|
530
|
-
to:
|
|
531
|
-
children:
|
|
578
|
+
children: K
|
|
579
|
+
}) : /* @__PURE__ */ R(se, {
|
|
580
|
+
to: U,
|
|
581
|
+
children: K
|
|
532
582
|
})
|
|
533
583
|
}),
|
|
534
584
|
p && m && /* @__PURE__ */ R(C, {
|
|
535
585
|
showOnHover: !0,
|
|
536
586
|
onClick: () => m(e.id, !e.pinned, e, n),
|
|
537
587
|
"aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
|
|
538
|
-
defaultValue: e.pinned ? `Unpin ${
|
|
539
|
-
name:
|
|
540
|
-
}) : e.pinned ? `Unpin ${
|
|
541
|
-
children: e.pinned ? /* @__PURE__ */ R(
|
|
588
|
+
defaultValue: e.pinned ? `Unpin ${G}` : `Pin ${G}`,
|
|
589
|
+
name: G
|
|
590
|
+
}) : e.pinned ? `Unpin ${G}` : `Pin ${G}`,
|
|
591
|
+
children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
|
|
542
592
|
})
|
|
543
593
|
] });
|
|
544
594
|
}
|
|
545
|
-
function $({ items: e, basePath: t = "", evaluateVisibility: n =
|
|
546
|
-
let
|
|
595
|
+
function $({ items: e, basePath: t = "", evaluateVisibility: n = Oe, checkPermission: i = ke, checkCapability: a = Ae, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
|
|
596
|
+
let C = r(() => s ? Pe(e, s) : e, [e, s]), w = r(() => Le(C), [C]), T = C.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), E = G(W(U, { activationConstraint: { distance: Fe } }), W(ce)), D = (e) => {
|
|
547
597
|
let { active: t, over: n } = e;
|
|
548
598
|
if (!n || t.id === n.id || !d) return;
|
|
549
|
-
let r =
|
|
550
|
-
r === -1 || i === -1 || d(
|
|
599
|
+
let r = T.findIndex((e) => e.id === t.id), i = T.findIndex((e) => e.id === n.id);
|
|
600
|
+
r === -1 || i === -1 || d(ue(T, r, i).map((e, t) => ({
|
|
551
601
|
...e,
|
|
552
602
|
order: t
|
|
553
603
|
})));
|
|
554
|
-
},
|
|
604
|
+
}, O = {
|
|
555
605
|
basePath: t,
|
|
556
606
|
evalVis: n,
|
|
557
607
|
checkPerm: i,
|
|
@@ -564,61 +614,62 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = De, checkPermis
|
|
|
564
614
|
resolveGroupLabel: m,
|
|
565
615
|
resolveViewLabel: h,
|
|
566
616
|
resolveItemLabel: y,
|
|
567
|
-
t: b
|
|
568
|
-
|
|
617
|
+
t: b,
|
|
618
|
+
templateContext: x
|
|
619
|
+
}, k = T.some((e) => e.type === "group"), A = w.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
569
620
|
className: "flex items-center gap-1.5",
|
|
570
|
-
children: [/* @__PURE__ */ R(
|
|
571
|
-
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children:
|
|
621
|
+
children: [/* @__PURE__ */ R(ae, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
|
|
622
|
+
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: w.map((e) => /* @__PURE__ */ R(Q, {
|
|
572
623
|
item: e,
|
|
573
|
-
...
|
|
624
|
+
...O
|
|
574
625
|
}, `fav-${e.id}`)) }) })] }) : null;
|
|
575
|
-
if (!
|
|
576
|
-
let e =
|
|
577
|
-
return /* @__PURE__ */ z(L, { children: [
|
|
578
|
-
sensors:
|
|
579
|
-
collisionDetection:
|
|
580
|
-
onDragEnd:
|
|
581
|
-
children: /* @__PURE__ */ R(
|
|
626
|
+
if (!k) {
|
|
627
|
+
let e = T.filter((e) => e.type !== "group").map((e) => e.id);
|
|
628
|
+
return /* @__PURE__ */ z(L, { children: [A, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: u ? /* @__PURE__ */ R(H, {
|
|
629
|
+
sensors: E,
|
|
630
|
+
collisionDetection: le,
|
|
631
|
+
onDragEnd: D,
|
|
632
|
+
children: /* @__PURE__ */ R(K, {
|
|
582
633
|
items: e,
|
|
583
|
-
strategy:
|
|
584
|
-
children: /* @__PURE__ */ R(S, { children:
|
|
634
|
+
strategy: fe,
|
|
635
|
+
children: /* @__PURE__ */ R(S, { children: T.map((e) => /* @__PURE__ */ R(Ie, {
|
|
585
636
|
item: e,
|
|
586
637
|
enableReorder: u,
|
|
587
|
-
...
|
|
638
|
+
...O
|
|
588
639
|
}, e.id)) })
|
|
589
640
|
})
|
|
590
|
-
}) : /* @__PURE__ */ R(S, { children:
|
|
641
|
+
}) : /* @__PURE__ */ R(S, { children: T.map((e) => /* @__PURE__ */ R(Q, {
|
|
591
642
|
item: e,
|
|
592
|
-
...
|
|
643
|
+
...O
|
|
593
644
|
}, e.id)) }) }) })] });
|
|
594
645
|
}
|
|
595
|
-
let
|
|
596
|
-
if (
|
|
597
|
-
let t =
|
|
598
|
-
|
|
646
|
+
let j = [], M = [], N = (e) => {
|
|
647
|
+
if (M.length === 0) return;
|
|
648
|
+
let t = M;
|
|
649
|
+
M = [], j.push(/* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
|
|
599
650
|
item: e,
|
|
600
|
-
...
|
|
651
|
+
...O
|
|
601
652
|
}, e.id)) }) }) }, e));
|
|
602
653
|
};
|
|
603
|
-
return
|
|
604
|
-
e.type === "group" ? (
|
|
654
|
+
return T.forEach((e, t) => {
|
|
655
|
+
e.type === "group" ? (N(`leaf-${t}`), j.push(/* @__PURE__ */ R(Q, {
|
|
605
656
|
item: e,
|
|
606
|
-
...
|
|
607
|
-
}, e.id))) :
|
|
608
|
-
}),
|
|
657
|
+
...O
|
|
658
|
+
}, e.id))) : M.push(e);
|
|
659
|
+
}), N("leaf-end"), /* @__PURE__ */ z(L, { children: [A, j] });
|
|
609
660
|
}
|
|
610
|
-
function
|
|
661
|
+
function Le(e) {
|
|
611
662
|
let t = [];
|
|
612
|
-
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...
|
|
663
|
+
for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Le(n.children));
|
|
613
664
|
return t;
|
|
614
665
|
}
|
|
615
666
|
//#endregion
|
|
616
667
|
//#region src/AppSchemaRenderer.tsx
|
|
617
|
-
function
|
|
668
|
+
function Re({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
|
|
618
669
|
let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
|
|
619
670
|
return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
|
|
620
671
|
className: "flex items-center gap-1.5",
|
|
621
|
-
children: [/* @__PURE__ */ R(
|
|
672
|
+
children: [/* @__PURE__ */ R(F, { className: "h-3.5 w-3.5" }), "Area"]
|
|
622
673
|
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
|
|
623
674
|
let r = Y(e.icon);
|
|
624
675
|
return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
|
|
@@ -629,8 +680,8 @@ function Fe({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm:
|
|
|
629
680
|
}) }, e.id);
|
|
630
681
|
}) }) })] });
|
|
631
682
|
}
|
|
632
|
-
function
|
|
633
|
-
let n =
|
|
683
|
+
function ze({ items: e, basePath: t }) {
|
|
684
|
+
let n = V(), r = (e) => {
|
|
634
685
|
let t = [];
|
|
635
686
|
for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
|
|
636
687
|
return t;
|
|
@@ -660,7 +711,7 @@ function Ie({ items: e, basePath: t }) {
|
|
|
660
711
|
}
|
|
661
712
|
}
|
|
662
713
|
let a = i !== "#" && n.pathname.startsWith(i);
|
|
663
|
-
return /* @__PURE__ */ z(
|
|
714
|
+
return /* @__PURE__ */ z(se, {
|
|
664
715
|
to: i,
|
|
665
716
|
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"}`,
|
|
666
717
|
children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
|
|
@@ -671,7 +722,7 @@ function Ie({ items: e, basePath: t }) {
|
|
|
671
722
|
})
|
|
672
723
|
});
|
|
673
724
|
}
|
|
674
|
-
function
|
|
725
|
+
function Be({ 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 }) {
|
|
675
726
|
let E = Y(e.logo), D = e.areas ?? [], [O, k] = i("");
|
|
676
727
|
return /* @__PURE__ */ z(p, {
|
|
677
728
|
collapsible: "icon",
|
|
@@ -703,7 +754,7 @@ function Le({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
703
754
|
"aria-label": "Search navigation"
|
|
704
755
|
})] }),
|
|
705
756
|
/* @__PURE__ */ z(m, { children: [
|
|
706
|
-
D.length > 1 && u && /* @__PURE__ */ R(
|
|
757
|
+
D.length > 1 && u && /* @__PURE__ */ R(Re, {
|
|
707
758
|
areas: D,
|
|
708
759
|
activeAreaId: u,
|
|
709
760
|
onAreaChange: d,
|
|
@@ -729,8 +780,8 @@ function Le({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onA
|
|
|
729
780
|
]
|
|
730
781
|
});
|
|
731
782
|
}
|
|
732
|
-
function
|
|
733
|
-
let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) =>
|
|
783
|
+
function Ve({ 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 }) {
|
|
784
|
+
let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => me(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(",");
|
|
734
785
|
n(() => {
|
|
735
786
|
D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
|
|
736
787
|
}, [e.name, A]);
|
|
@@ -740,7 +791,7 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
740
791
|
logo: e.logo
|
|
741
792
|
};
|
|
742
793
|
return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(J, {
|
|
743
|
-
sidebar: /* @__PURE__ */ R(
|
|
794
|
+
sidebar: /* @__PURE__ */ R(Be, {
|
|
744
795
|
schema: e,
|
|
745
796
|
basePath: t,
|
|
746
797
|
evalVis: S,
|
|
@@ -764,21 +815,21 @@ function Re({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
764
815
|
defaultOpen: g,
|
|
765
816
|
branding: M,
|
|
766
817
|
children: m
|
|
767
|
-
}), a === "bottom_nav" && /* @__PURE__ */ R(
|
|
818
|
+
}), a === "bottom_nav" && /* @__PURE__ */ R(ze, {
|
|
768
819
|
items: j,
|
|
769
820
|
basePath: t
|
|
770
821
|
})] });
|
|
771
822
|
}
|
|
772
823
|
//#endregion
|
|
773
824
|
//#region src/Page.tsx
|
|
774
|
-
var
|
|
775
|
-
function
|
|
776
|
-
let a =
|
|
825
|
+
var He = (e) => e ? Array.isArray(e) ? e : [e] : [];
|
|
826
|
+
function Ue({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
827
|
+
let a = He(e.children);
|
|
777
828
|
return /* @__PURE__ */ z("div", {
|
|
778
829
|
id: r || e.id,
|
|
779
830
|
className: A("flex flex-col h-full space-y-4", t),
|
|
780
831
|
style: n,
|
|
781
|
-
children: [/* @__PURE__ */ R(
|
|
832
|
+
children: [/* @__PURE__ */ R(q, {
|
|
782
833
|
title: e.title,
|
|
783
834
|
description: e.description
|
|
784
835
|
}), /* @__PURE__ */ R("div", {
|
|
@@ -792,10 +843,10 @@ function Be({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
|
792
843
|
}
|
|
793
844
|
//#endregion
|
|
794
845
|
//#region src/SidebarNav.tsx
|
|
795
|
-
function
|
|
846
|
+
function We(e) {
|
|
796
847
|
return "items" in e && !("href" in e);
|
|
797
848
|
}
|
|
798
|
-
function
|
|
849
|
+
function Ge({ item: e, pathname: t }) {
|
|
799
850
|
return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
|
|
800
851
|
asChild: !0,
|
|
801
852
|
defaultOpen: !0,
|
|
@@ -822,7 +873,7 @@ function He({ item: e, pathname: t }) {
|
|
|
822
873
|
asChild: !0,
|
|
823
874
|
isActive: t === e.href,
|
|
824
875
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
825
|
-
children: /* @__PURE__ */ z(
|
|
876
|
+
children: /* @__PURE__ */ z(B, {
|
|
826
877
|
to: e.href,
|
|
827
878
|
children: [
|
|
828
879
|
e.icon && /* @__PURE__ */ R(e.icon, {}),
|
|
@@ -841,7 +892,7 @@ function He({ item: e, pathname: t }) {
|
|
|
841
892
|
isActive: t === e.href,
|
|
842
893
|
tooltip: e.title,
|
|
843
894
|
className: "motion-safe:transition-colors motion-safe:duration-150",
|
|
844
|
-
children: /* @__PURE__ */ z(
|
|
895
|
+
children: /* @__PURE__ */ z(B, {
|
|
845
896
|
to: e.href,
|
|
846
897
|
children: [
|
|
847
898
|
e.icon && /* @__PURE__ */ R(e.icon, {}),
|
|
@@ -855,8 +906,8 @@ function He({ item: e, pathname: t }) {
|
|
|
855
906
|
})
|
|
856
907
|
}) });
|
|
857
908
|
}
|
|
858
|
-
function
|
|
859
|
-
let s =
|
|
909
|
+
function Ke({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
|
|
910
|
+
let s = V(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : We(e[0]) ? e.map((e) => ({
|
|
860
911
|
groupLabel: e.label,
|
|
861
912
|
items: e.items
|
|
862
913
|
})) : [{ items: e }], [e]), f = t.useMemo(() => {
|
|
@@ -874,7 +925,7 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
874
925
|
className: "px-3 py-2",
|
|
875
926
|
children: /* @__PURE__ */ z("div", {
|
|
876
927
|
className: "relative",
|
|
877
|
-
children: [/* @__PURE__ */ R(
|
|
928
|
+
children: [/* @__PURE__ */ R(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ R(u, {
|
|
878
929
|
type: "search",
|
|
879
930
|
placeholder: o,
|
|
880
931
|
value: c,
|
|
@@ -891,7 +942,7 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
891
942
|
className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
|
|
892
943
|
children: e.groupLabel || n
|
|
893
944
|
}),
|
|
894
|
-
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(
|
|
945
|
+
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(Ge, {
|
|
895
946
|
item: e,
|
|
896
947
|
pathname: s.pathname
|
|
897
948
|
}, e.href)) }) })
|
|
@@ -900,8 +951,8 @@ function Ue({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
900
951
|
}
|
|
901
952
|
//#endregion
|
|
902
953
|
//#region src/index.ts
|
|
903
|
-
function
|
|
904
|
-
e.register("page-header",
|
|
954
|
+
function qe() {
|
|
955
|
+
e.register("page-header", q, {
|
|
905
956
|
namespace: "layout",
|
|
906
957
|
label: "Page Header",
|
|
907
958
|
category: "Layout",
|
|
@@ -912,8 +963,9 @@ function We() {
|
|
|
912
963
|
name: "description",
|
|
913
964
|
type: "string"
|
|
914
965
|
}]
|
|
915
|
-
}), e.register("page:card",
|
|
966
|
+
}), e.register("page:card", Se, {
|
|
916
967
|
namespace: "layout",
|
|
968
|
+
skipFallback: !0,
|
|
917
969
|
label: "Page Card",
|
|
918
970
|
category: "Layout",
|
|
919
971
|
isContainer: !0
|
|
@@ -921,7 +973,7 @@ function We() {
|
|
|
921
973
|
namespace: "layout",
|
|
922
974
|
label: "App Shell",
|
|
923
975
|
category: "Layout"
|
|
924
|
-
}), e.register("responsive-grid",
|
|
976
|
+
}), e.register("responsive-grid", Ee, {
|
|
925
977
|
namespace: "layout",
|
|
926
978
|
label: "Responsive Grid",
|
|
927
979
|
category: "Layout",
|
|
@@ -944,7 +996,7 @@ function We() {
|
|
|
944
996
|
name: "basePath",
|
|
945
997
|
type: "string"
|
|
946
998
|
}]
|
|
947
|
-
}), e.register("app-schema-renderer",
|
|
999
|
+
}), e.register("app-schema-renderer", Ve, {
|
|
948
1000
|
namespace: "layout",
|
|
949
1001
|
label: "App Schema Renderer",
|
|
950
1002
|
category: "Layout",
|
|
@@ -966,7 +1018,7 @@ function We() {
|
|
|
966
1018
|
});
|
|
967
1019
|
}
|
|
968
1020
|
try {
|
|
969
|
-
|
|
1021
|
+
qe();
|
|
970
1022
|
} catch {}
|
|
971
1023
|
//#endregion
|
|
972
|
-
export {
|
|
1024
|
+
export { Ve as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Ue as Page, Se as PageCard, q as PageHeader, Ee as ResponsiveGrid, Ke as SidebarNav, Pe as filterNavigationItems, qe as registerLayout, Me as resolveHref, Y as resolveIcon, X as resolveLabel, xe as useAppShellBranding };
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("@object-ui/react"),require("react/jsx-runtime"),require("react-router-dom"),require("@dnd-kit/core"),require("@dnd-kit/sortable"),require("@dnd-kit/utilities"),require("@object-ui/types")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/react`,`react/jsx-runtime`,`react-router-dom`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.lucide_react,e._object_ui_react,e.react_jsx_runtime,e.react_router_dom,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y=e=>{let t=e?.name??e?.full_name??e?.display_name??e?.label??e?.title??e?.subject;return t!=null&&String(t).trim()?String(t):[e?.salutation,e?.first_name,e?.last_name].filter(e=>typeof e==`string`&&e.trim()).map(e=>e.trim()).join(` `)||(typeof e?.email==`string`&&e.email.trim()?e.email.trim():null)},b=(e,t)=>!e||typeof e!=`string`?e??``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>e==null?e:e[t],t);return r==null?``:typeof r==`object`?y(r)??``:String(r)}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g,``).replace(/^\s*[-–—|/·,:]\s*/,``).replace(/\s+/g,` `).trim():e;function x({title:e,subtitle:t,description:s,icon:c,action:l,actions:u,showBack:d,schema:f,className:p,children:m,...h}){let g=(0,a.useRecordContext)(),_=typeof e==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(e),v=b(e,g?.data)||(_?``:e),y=t??s,x=typeof y==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(y),S=b(y,g?.data)||(x?``:y),C=!!g?.recordId,w=!!g?.embedded,T=d??(C&&!w),E=n.default.useCallback(()=>{if(typeof window>`u`)return;let e=window.location.pathname,t=e.replace(/\/record\/[^/]+\/?$/,``);t===e?window.history.length>1&&window.history.back():(window.history.pushState({},``,t+window.location.search),window.dispatchEvent(new PopStateEvent(`popstate`)))},[]),D=Array.isArray(f?.children)?f.children.filter(Boolean).map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e},e?.id||`pgh-child-${t}`)):null,O=Array.isArray(u)&&u.length>0&&u||Array.isArray(f?.actions)&&f.actions.length>0&&f.actions||Array.isArray(f?.properties?.actions)&&f.properties.actions.length>0&&f.properties.actions||null,k=l||m||(O?(0,o.jsx)(a.SchemaRenderer,{schema:{type:`record:quick_actions`,properties:{actions:O,location:`record_header`,align:`end`,inline:!0}}}):null)||D;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-3 pb-4 border-b`,p),...h,children:(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[T&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,onClick:E,"aria-label":`Back to list`,className:`flex-shrink-0 -ml-2`,children:(0,o.jsx)(i.ArrowLeft,{className:`size-4`})}),c&&(v||S)&&(0,o.jsx)(`div`,{className:`flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary`,children:typeof c==`string`?(0,o.jsx)(r.LazyIcon,{name:c,className:`size-5`}):c}),(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[v?(0,o.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:v}):null,S&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:S})]}),k&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:k})]})})}function S(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=0,c=0,l=(a+o)/2;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function C(e){let t=S(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function w(e){let t=S(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function T(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function E(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=C(e.primaryColor),i=w(e.primaryColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-primary`,e.primaryColor),n.style.setProperty(`--brand-primary-hsl`,t||a),n.style.setProperty(`--primary`,a),n.style.setProperty(`--primary-foreground`,r()?`222 47% 11%`:T(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}else n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`);if(e?.accentColor){let t=C(e.accentColor),i=w(e.accentColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-accent`,e.accentColor),n.style.setProperty(`--brand-accent-hsl`,t||a),n.style.setProperty(`--accent`,a),n.style.setProperty(`--accent-foreground`,r()?`222 47% 11%`:T(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function D({sidebar:e,navbar:t,children:n,className:i,defaultOpen:a=!0,branding:s}){return E(s,s?.title),(0,o.jsxs)(r.SidebarProvider,{defaultOpen:a,className:`!flex-col h-svh overflow-hidden`,children:[(0,o.jsx)(`header`,{className:`sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4`,children:t}),(0,o.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,o.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,o.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,i),children:n})})]})]})}function O({className:e,children:t,...n}){return(0,o.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,o.jsx)(`div`,{className:`p-6`,children:t})})}var k={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function A(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=k[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var j={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},M=({columns:e,gap:t=4,className:n,children:i})=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid`,A(e),typeof t==`number`?j[t]||`gap-${t}`:``,n),children:i});function N(e){return e?(0,r.getLazyIcon)(e):i.FileText}function P(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function F(e,t,n,r,i,a,o){let s=P(e.label,n);if(typeof e.label!=`string`)return s;if(e.type===`object`&&e.objectName){if(e.viewName)return a?a(e.objectName,e.viewName,s):s;if(t)return t(e.objectName,s)}return r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,s):i&&e.type===`group`&&e.id?i(e.id,s):o&&e.id?o(e.id,s):s}var I=e=>!(e===!1||e===`false`),L=()=>!0,R=()=>!0;function z(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};case`component`:{let n=e.componentRef;if(!n)return{href:`#`,external:!1};let r=n.split(`:`).filter(Boolean);if(r.length===0)return{href:`#`,external:!1};let i=e.params;if(r[0]===`metadata`){let e=r[1],n=i&&typeof i.type==`string`?i.type:void 0,a=i&&typeof i.name==`string`?i.name:void 0;return e===`directory`||!e?{href:`${t}/metadata`,external:!1}:e===`resource`&&n?{href:`${t}/metadata${a?`/${encodeURIComponent(n)}/${encodeURIComponent(a)}`:`/${encodeURIComponent(n)}`}`,external:!1}:{href:`${t}/metadata`,external:!1}}let a=`${t}/component/${r.join(`/`)}`;if(i&&typeof i==`object`){let e=new URLSearchParams;for(let[t,n]of Object.entries(i))n!=null&&e.set(t,typeof n==`string`?n:JSON.stringify(n));let t=e.toString();t&&(a+=`?${t}`)}return{href:a,external:!1}}default:return{href:`#`,external:!1}}}function B(e,t,n){return t===`#`?!1:n===t?!0:e.type===`object`&&e.objectName?!(e.viewName||!n.startsWith(`${t}/`)||n.slice(t.length+1).startsWith(`view/`)):n.startsWith(`${t}/`)}function V(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=V(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return P(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var H=5;function U({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,resolveItemLabel:g,t:_}){let{attributes:v,listeners:y,setNodeRef:b,transform:x,transition:S,isDragging:C}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:b,style:{transform:u.CSS.Transform.toString(x),transition:S,opacity:C?.5:void 0,zIndex:C?10:void 0},...v,children:(0,o.jsx)(W,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?y:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,resolveItemLabel:g,t:_})})}function W({item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,resolveItemLabel:v,t:y}){let b=(0,s.useLocation)(),x=(()=>{let t=e.expanded;if(typeof t==`boolean`)return t;if(typeof e.defaultOpen==`boolean`)return e.defaultOpen})(),S=e.type===`group`?e.children?.length??0:0,[C,w]=(0,n.useState)(n.default.useMemo(()=>{if(e.type!==`group`)return!1;let n=e=>{if(!e)return!1;for(let r of e){if(r.type===`group`){if(n(r.children))return!0;continue}let{href:e}=z(r,t);if(B(r,e,b.pathname))return!0}return!1};return n(e.children)},[e,t,b.pathname])?!0:x??!(S>=8));if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let T=e.requiresObject,E=e.requiresService;if(T&&!l(`object`,T)||E&&!l(`service`,E))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:C,onOpenChange:w,children:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,o.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[F(e,m,y,h,g,_,v),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${C?`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)(W,{item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,resolveItemLabel:v,t:y},e.id))})})})]})})}if(e.type===`action`){let n=N(e.icon),a=P(e.label,y);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":y?y(`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:a,onClick:()=>u?.(e),children:[(0,o.jsx)(n,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:a}),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,e,t),"aria-label":y?y(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${a}`:`Pin ${a}`,name:a}):e.pinned?`Unpin ${a}`:`Pin ${a}`,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 D=N(e.icon),{href:O,external:k}=z(e,t),A=B(e,O,b.pathname),j=F(e,m,y,h,g,_,v),M=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:j}),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":y?y(`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:A,tooltip:j,children:k?(0,o.jsx)(`a`,{href:O,target:`_blank`,rel:`noopener noreferrer`,children:M}):(0,o.jsx)(s.Link,{to:O,children:M})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned,e,t),"aria-label":y?y(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${j}`:`Pin ${j}`,name:j}):e.pinned?`Unpin ${j}`:`Pin ${j}`,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 G({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:s=L,checkCapability:u=R,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,resolveItemLabel:x,t:S}){let C=(0,n.useMemo)(()=>f?V(e,f):e,[e,f]),w=(0,n.useMemo)(()=>K(C),[C]),T=C.slice().sort((e,t)=>(e.order??0)-(t.order??0)),E=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:H}}),(0,c.useSensor)(c.KeyboardSensor)),D=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=T.findIndex(e=>e.id===t.id),i=T.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(T,r,i).map((e,t)=>({...e,order:t})))},O={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,resolveItemLabel:x,t:S},k=T.some(e=>e.type===`group`),A=w.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`}),S?S(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:w.map(e=>(0,o.jsx)(W,{item:e,...O},`fav-${e.id}`))})})]}):null;if(!k){let e=T.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[A,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:E,collisionDetection:c.closestCenter,onDragEnd:D,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:T.map(e=>(0,o.jsx)(U,{item:e,enableReorder:h,...O},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:T.map(e=>(0,o.jsx)(W,{item:e,...O},e.id))})})})]})}let j=[],M=[],N=e=>{if(M.length===0)return;let t=M;M=[],j.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)(W,{item:e,...O},e.id))})})},e))};return T.forEach((e,t)=>{e.type===`group`?(N(`leaf-${t}`),j.push((0,o.jsx)(W,{item:e,...O},e.id))):M.push(e)}),N(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[A,j]})}function K(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...K(n.children));return t}function q({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:c.map(e=>{let i=N(e.icon);return(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:P(e.label),onClick:()=>n(e.id),children:[(0,o.jsx)(i,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:P(e.label)})]})},e.id)})})})]})}function J({items:e,basePath:t}){let n=(0,s.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},i=r(e).slice(0,5);return i.length===0?null:(0,o.jsx)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom`,role:`navigation`,"aria-label":`Mobile navigation`,children:i.map(e=>{let r=N(e.icon),i=`#`;if(e.type===`object`)i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`);else if(e.type===`dashboard`)i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`;else if(e.type===`page`)i=e.pageName?`${t}/page/${e.pageName}`:`#`;else if(e.type===`report`)i=e.reportName?`${t}/report/${e.reportName}`:`#`;else if(e.type===`url`)i=e.url??`#`;else if(e.type===`component`){let n=e.componentRef;if(n){i=`${t}/component/${n.split(`:`).filter(Boolean).join(`/`)}`;let r=e.params;if(r){let e=new URLSearchParams;for(let[t,n]of Object.entries(r))n!=null&&e.set(t,typeof n==`string`?n:JSON.stringify(n));let t=e.toString();t&&(i+=`?${t}`)}}}let a=i!==`#`&&n.pathname.startsWith(i);return(0,o.jsxs)(s.Link,{to:i,className:`flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,o.jsx)(r,{className:`h-5 w-5`}),(0,o.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:P(e.label)})]},e.id)})})}function Y({schema:e,basePath:t,evalVis:i,checkPerm:a,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=N(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,o.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,o.jsxs)(r.SidebarHeader,{children:[l??(0,o.jsx)(r.SidebarMenu,{children:(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,o.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,o.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,o.jsx)(b,{className:`size-4`})}),(0,o.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,o.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,o.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,o.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,o.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,o.jsx)(q,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(G,{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 X({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,navbar:l,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=i??(e=>!(e===!1||e===`false`)),C=a??(()=>!0),w=s??(()=>!0),T=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,d.menuItemToNavigationItem)(e,t)),[e.menu]),E=e.navigation??T,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??E,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{sidebar:(0,o.jsx)(Y,{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)(J,{items:M,basePath:t})]})}var Z=e=>e?Array.isArray(e)?e:[e]:[];function Q({schema:e,className:t,style:n,id:i,...s}){let c=Z(e.children);return(0,o.jsxs)(`div`,{id:i||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,o.jsx)(x,{title:e.title,description:e.description}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto`,children:c.map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e,...s},e?.id||t))})]})}function ee(e){return`items`in e&&!(`href`in e)}function te({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,className:`motion-safe:transition-colors motion-safe:duration-150`,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,{className:`motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:slide-out-to-top-1 motion-safe:data-[state=open]:slide-in-from-top-1 motion-safe:duration-150`,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,className:`motion-safe:transition-colors motion-safe:duration-150`,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,className:`motion-safe:transition-colors motion-safe:duration-150`,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 ne({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?[]:ee(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)(te,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,x,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:card`,O,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,D,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,M,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,G,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,X,{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=X,e.AppShell=D,e.NavigationRenderer=G,e.Page=Q,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=ne,e.filterNavigationItems=V,e.registerLayout=$,e.resolveIcon=N,e.resolveLabel=P,e.useAppShellBranding=E});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("@object-ui/react"),require("react/jsx-runtime"),require("react-router-dom"),require("@dnd-kit/core"),require("@dnd-kit/sortable"),require("@dnd-kit/utilities"),require("@object-ui/types")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/react`,`react/jsx-runtime`,`react-router-dom`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.lucide_react,e._object_ui_react,e.react_jsx_runtime,e.react_router_dom,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y=e=>{let t=e?.name??e?.full_name??e?.display_name??e?.label??e?.title??e?.subject;return t!=null&&String(t).trim()?String(t):[e?.salutation,e?.first_name,e?.last_name].filter(e=>typeof e==`string`&&e.trim()).map(e=>e.trim()).join(` `)||(typeof e?.email==`string`&&e.email.trim()?e.email.trim():null)},b=(e,t)=>!e||typeof e!=`string`?e??``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>e==null?e:e[t],t);return r==null?``:typeof r==`object`?y(r)??``:String(r)}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g,``).replace(/^\s*[-–—|/·,:]\s*/,``).replace(/\s+/g,` `).trim():e;function x({title:e,subtitle:t,description:s,icon:c,action:l,actions:u,showBack:d,schema:f,className:p,children:m,...h}){let g=(0,a.useRecordContext)(),_=typeof e==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(e),v=b(e,g?.data)||(_?``:e),y=t??s,x=typeof y==`string`&&/\{[a-zA-Z0-9_.]+\}/.test(y),S=b(y,g?.data)||(x?``:y),C=!!g?.recordId,w=!!g?.embedded,T=d??(C&&!w),E=n.default.useCallback(()=>{if(typeof window>`u`)return;let e=window.location.pathname,t=e.replace(/\/record\/[^/]+\/?$/,``);t===e?window.history.length>1&&window.history.back():(window.history.pushState({},``,t+window.location.search),window.dispatchEvent(new PopStateEvent(`popstate`)))},[]),D=Array.isArray(f?.children)?f.children.filter(Boolean).map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e},e?.id||`pgh-child-${t}`)):null,O=Array.isArray(u)&&u.length>0&&u||Array.isArray(f?.actions)&&f.actions.length>0&&f.actions||Array.isArray(f?.properties?.actions)&&f.properties.actions.length>0&&f.properties.actions||null,k=l||m||(O?(0,o.jsx)(a.SchemaRenderer,{schema:{type:`record:quick_actions`,properties:{actions:O,location:`record_header`,align:`end`,inline:!0}}}):null)||D;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-3 pb-4 border-b`,p),...h,children:(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[T&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,onClick:E,"aria-label":`Back to list`,className:`flex-shrink-0 -ml-2`,children:(0,o.jsx)(i.ArrowLeft,{className:`size-4`})}),c&&(v||S)&&(0,o.jsx)(`div`,{className:`flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary`,children:typeof c==`string`?(0,o.jsx)(r.LazyIcon,{name:c,className:`size-5`}):c}),(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[v?(0,o.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:v}):null,S&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:S})]}),k&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:k})]})})}function S(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=0,c=0,l=(a+o)/2;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function C(e){let t=S(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function w(e){let t=S(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function T(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function E(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=C(e.primaryColor),i=w(e.primaryColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-primary`,e.primaryColor),n.style.setProperty(`--brand-primary-hsl`,t||a),n.style.setProperty(`--primary`,a),n.style.setProperty(`--primary-foreground`,r()?`222 47% 11%`:T(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}else n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`);if(e?.accentColor){let t=C(e.accentColor),i=w(e.accentColor),a=r()&&i||t;a&&(n.style.setProperty(`--brand-accent`,e.accentColor),n.style.setProperty(`--brand-accent-hsl`,t||a),n.style.setProperty(`--accent`,a),n.style.setProperty(`--accent-foreground`,r()?`222 47% 11%`:T(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function D({sidebar:e,navbar:t,children:n,className:i,defaultOpen:a=!0,branding:s}){return E(s,s?.title),(0,o.jsxs)(r.SidebarProvider,{defaultOpen:a,className:`!flex-col h-svh overflow-hidden`,children:[(0,o.jsx)(`header`,{className:`sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4`,children:t}),(0,o.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,o.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,o.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,i),children:n})})]})]})}function O({className:e,children:t,...n}){return(0,o.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,o.jsx)(`div`,{className:`p-6`,children:t})})}var k={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function A(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=k[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var j={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},M=({columns:e,gap:t=4,className:n,children:i})=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid`,A(e),typeof t==`number`?j[t]||`gap-${t}`:``,n),children:i});function N(e){return e?(0,r.getLazyIcon)(e):i.FileText}function P(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function F(e,t,n,r,i,a,o){let s=P(e.label,n);if(typeof e.label!=`string`)return s;if(e.type===`object`&&e.objectName){if(e.viewName)return a?a(e.objectName,e.viewName,s):s;if(t)return t(e.objectName,s)}return r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,s):i&&e.type===`group`&&e.id?i(e.id,s):o&&e.id?o(e.id,s):s}var I=e=>!(e===!1||e===`false`),L=()=>!0,R=()=>!0,z=/\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;function B(e,t){if(!e.includes(`{`))return e;let n=!1,r=e.replace(z,(e,r)=>{let i;return i=r===`current_user_id`?t?.currentUserId:r===`current_org_id`?t?.currentOrgId:t?.contextValues?.[r],i||(n=!0,``)});return n?null:r}function V(e,t,n){switch(e.type){case`object`:{let r=`${t}/${e.objectName??``}`,i=e.recordId;if(i){let t=B(i,n);if(t){let n=`${r}/record/${encodeURIComponent(t)}`;return{href:e.recordMode===`edit`?`${n}/edit`:n,external:!1}}}return{href:e.viewName?`${r}/view/${e.viewName}`:r,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:{if(!e.pageName)return{href:`#`,external:!1};let r=e.params,i=`${t}/page/${e.pageName}`;if(r&&typeof r==`object`){let e=new URLSearchParams;for(let[t,i]of Object.entries(r))if(i!=null)if(typeof i==`string`){let r=B(i,n);r!==null&&e.set(t,r)}else e.set(t,JSON.stringify(i));let t=e.toString();t&&(i+=`?${t}`)}return{href:i,external:!1}}case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};case`component`:{let r=e.componentRef;if(!r)return{href:`#`,external:!1};let i=r.split(`:`).filter(Boolean);if(i.length===0)return{href:`#`,external:!1};let a=e.params;if(i[0]===`metadata`){let e=i[1],r=a&&typeof a.type==`string`?a.type:void 0,o=a&&typeof a.name==`string`?a.name:void 0,s=``;if(a&&typeof a==`object`){let e=new URLSearchParams;for(let[t,r]of Object.entries(a))if(!(t===`type`||t===`name`)&&r!=null)if(typeof r==`string`){let i=B(r,n);i&&e.set(t,i)}else e.set(t,JSON.stringify(r));let t=e.toString();t&&(s=`?${t}`)}return e===`directory`||!e?{href:`${t}/metadata${s}`,external:!1}:e===`resource`&&r?{href:`${t}/metadata${o?`/${encodeURIComponent(r)}/${encodeURIComponent(o)}`:`/${encodeURIComponent(r)}`}${s}`,external:!1}:{href:`${t}/metadata${s}`,external:!1}}let o=`${t}/component/${i.join(`/`)}`;if(a&&typeof a==`object`){let e=new URLSearchParams;for(let[t,n]of Object.entries(a))n!=null&&e.set(t,typeof n==`string`?n:JSON.stringify(n));let t=e.toString();t&&(o+=`?${t}`)}return{href:o,external:!1}}default:return{href:`#`,external:!1}}}function H(e,t,n){if(t===`#`)return!1;if(n===t)return!0;let r=e.componentRef;return r&&r.split(`:`)[1]===`directory`?!1:e.type===`object`&&e.objectName?!(e.viewName||!n.startsWith(`${t}/`)||n.slice(t.length+1).startsWith(`view/`)):n.startsWith(`${t}/`)}function U(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=U(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return P(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var W=5;function G({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,resolveItemLabel:g,t:_,templateContext:v}){let{attributes:y,listeners:b,setNodeRef:x,transform:S,transition:C,isDragging:w}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:x,style:{transform:u.CSS.Transform.toString(S),transition:C,opacity:w?.5:void 0,zIndex:w?10:void 0},...y,children:(0,o.jsx)(K,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?b:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,resolveViewLabel:h,resolveItemLabel:g,t:_,templateContext:v})})}function K({item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,resolveItemLabel:v,t:y,templateContext:b}){let x=(0,s.useLocation)(),S=(0,r.useIsMobile)(),C=S?`min-h-[44px] text-[15px] gap-3 rounded-xl`:void 0,w=(0,r.cn)(`shrink-0`,S?`h-5 w-5`:`h-4 w-4`),T=(()=>{let t=e.expanded;if(typeof t==`boolean`)return t;if(typeof e.defaultOpen==`boolean`)return e.defaultOpen})(),E=e.type===`group`?e.children?.length??0:0,[D,O]=(0,n.useState)(n.default.useMemo(()=>{if(e.type!==`group`)return!1;let n=e=>{if(!e)return!1;for(let r of e){if(r.type===`group`){if(n(r.children))return!0;continue}let{href:e}=V(r,t,b);if(H(r,e,x.pathname))return!0}return!1};return n(e.children)},[e,t,x.pathname])?!0:T??!(E>=8));if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let k=e.requiresObject,A=e.requiresService;if(k&&!l(`object`,k)||A&&!l(`service`,A))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)),s=F(e,m,y,h,g,_,v);return(0,o.jsx)(r.Collapsible,{open:D,onOpenChange:O,children:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,o.jsxs)(r.CollapsibleTrigger,{className:(0,r.cn)(`flex w-full items-center justify-between`,S&&`min-h-[44px] text-[15px] rounded-xl`),children:[s,(0,o.jsx)(i.ChevronRight,{className:(0,r.cn)(`ml-auto transition-transform`,S?`h-5 w-5`:`h-4 w-4`,D&&`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)(K,{item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,resolveViewLabel:_,resolveItemLabel:v,t:y,templateContext:b},e.id))})})})]})})}if(e.type===`action`){let n=N(e.icon),a=P(e.label,y);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":y?y(`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:a,onClick:()=>u?.(e),className:C,children:[(0,o.jsx)(n,{className:w}),(0,o.jsx)(`span`,{children:a}),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,e,t),"aria-label":y?y(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${a}`:`Pin ${a}`,name:a}):e.pinned?`Unpin ${a}`:`Pin ${a}`,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 j=N(e.icon),{href:M,external:I}=V(e,t,b),L=H(e,M,x.pathname),R=F(e,m,y,h,g,_,v),z=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(j,{className:w}),(0,o.jsx)(`span`,{children:R}),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":y?y(`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:L,tooltip:R,className:C,children:I?(0,o.jsx)(`a`,{href:M,target:`_blank`,rel:`noopener noreferrer`,children:z}):(0,o.jsx)(s.Link,{to:M,children:z})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned,e,t),"aria-label":y?y(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${R}`:`Pin ${R}`,name:R}):e.pinned?`Unpin ${R}`:`Pin ${R}`,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 q({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:s=L,checkCapability:u=R,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,resolveItemLabel:x,t:S,templateContext:C}){let w=(0,n.useMemo)(()=>f?U(e,f):e,[e,f]),T=(0,n.useMemo)(()=>J(w),[w]),E=w.slice().sort((e,t)=>(e.order??0)-(t.order??0)),D=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:W}}),(0,c.useSensor)(c.KeyboardSensor)),O=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=E.findIndex(e=>e.id===t.id),i=E.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(E,r,i).map((e,t)=>({...e,order:t})))},k={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,resolveViewLabel:b,resolveItemLabel:x,t:S,templateContext:C},A=E.some(e=>e.type===`group`),j=T.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`}),S?S(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:T.map(e=>(0,o.jsx)(K,{item:e,...k},`fav-${e.id}`))})})]}):null;if(!A){let e=E.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[j,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:D,collisionDetection:c.closestCenter,onDragEnd:O,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:E.map(e=>(0,o.jsx)(G,{item:e,enableReorder:h,...k},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:E.map(e=>(0,o.jsx)(K,{item:e,...k},e.id))})})})]})}let M=[],N=[],P=e=>{if(N.length===0)return;let t=N;N=[],M.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)(K,{item:e,...k},e.id))})})},e))};return E.forEach((e,t)=>{e.type===`group`?(P(`leaf-${t}`),M.push((0,o.jsx)(K,{item:e,...k},e.id))):N.push(e)}),P(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[j,M]})}function J(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...J(n.children));return t}function Y({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:c.map(e=>{let i=N(e.icon);return(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:P(e.label),onClick:()=>n(e.id),children:[(0,o.jsx)(i,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:P(e.label)})]})},e.id)})})})]})}function X({items:e,basePath:t}){let n=(0,s.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},i=r(e).slice(0,5);return i.length===0?null:(0,o.jsx)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom`,role:`navigation`,"aria-label":`Mobile navigation`,children:i.map(e=>{let r=N(e.icon),i=`#`;if(e.type===`object`)i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`);else if(e.type===`dashboard`)i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`;else if(e.type===`page`)i=e.pageName?`${t}/page/${e.pageName}`:`#`;else if(e.type===`report`)i=e.reportName?`${t}/report/${e.reportName}`:`#`;else if(e.type===`url`)i=e.url??`#`;else if(e.type===`component`){let n=e.componentRef;if(n){i=`${t}/component/${n.split(`:`).filter(Boolean).join(`/`)}`;let r=e.params;if(r){let e=new URLSearchParams;for(let[t,n]of Object.entries(r))n!=null&&e.set(t,typeof n==`string`?n:JSON.stringify(n));let t=e.toString();t&&(i+=`?${t}`)}}}let a=i!==`#`&&n.pathname.startsWith(i);return(0,o.jsxs)(s.Link,{to:i,className:`flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,o.jsx)(r,{className:`h-5 w-5`}),(0,o.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:P(e.label)})]},e.id)})})}function Z({schema:e,basePath:t,evalVis:i,checkPerm:a,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=N(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,o.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,o.jsxs)(r.SidebarHeader,{children:[l??(0,o.jsx)(r.SidebarMenu,{children:(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,o.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,o.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,o.jsx)(b,{className:`size-4`})}),(0,o.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,o.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,o.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,o.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,o.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,o.jsx)(Y,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(q,{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 Q({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,navbar:l,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=i??(e=>!(e===!1||e===`false`)),C=a??(()=>!0),w=s??(()=>!0),T=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,d.menuItemToNavigationItem)(e,t)),[e.menu]),E=e.navigation??T,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??E,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{sidebar:(0,o.jsx)(Z,{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)(X,{items:M,basePath:t})]})}var ee=e=>e?Array.isArray(e)?e:[e]:[];function te({schema:e,className:t,style:n,id:i,...s}){let c=ee(e.children);return(0,o.jsxs)(`div`,{id:i||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,o.jsx)(x,{title:e.title,description:e.description}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto`,children:c.map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e,...s},e?.id||t))})]})}function ne(e){return`items`in e&&!(`href`in e)}function re({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,className:`motion-safe:transition-colors motion-safe:duration-150`,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,{className:`motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:slide-out-to-top-1 motion-safe:data-[state=open]:slide-in-from-top-1 motion-safe:duration-150`,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,className:`motion-safe:transition-colors motion-safe:duration-150`,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,className:`motion-safe:transition-colors motion-safe:duration-150`,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 ie({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?[]:ne(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)(re,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,x,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:card`,O,{namespace:`layout`,skipFallback:!0,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,D,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,M,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,q,{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=D,e.NavigationRenderer=q,e.Page=te,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=ie,e.filterNavigationItems=U,e.registerLayout=$,e.resolveHref=V,e.resolveIcon=N,e.resolveLabel=P,e.useAppShellBranding=E});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.umd.cjs",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"@dnd-kit/sortable": "^10.0.0",
|
|
19
19
|
"@dnd-kit/utilities": "^3.2.2",
|
|
20
20
|
"clsx": "^2.1.1",
|
|
21
|
-
"lucide-react": "^1.
|
|
22
|
-
"react": "19.2.
|
|
23
|
-
"react-dom": "19.2.
|
|
21
|
+
"lucide-react": "^1.21.0",
|
|
22
|
+
"react": "19.2.7",
|
|
23
|
+
"react-dom": "19.2.7",
|
|
24
24
|
"tailwind-merge": "^3.6.0",
|
|
25
|
-
"@object-ui/components": "
|
|
26
|
-
"@object-ui/core": "
|
|
27
|
-
"@object-ui/react": "
|
|
28
|
-
"@object-ui/types": "
|
|
25
|
+
"@object-ui/components": "7.1.0",
|
|
26
|
+
"@object-ui/core": "7.1.0",
|
|
27
|
+
"@object-ui/react": "7.1.0",
|
|
28
|
+
"@object-ui/types": "7.1.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@vitejs/plugin-react": "^6.0.2",
|
|
37
|
-
"react-router-dom": "^7.
|
|
38
|
-
"vite": "^8.0.
|
|
39
|
-
"vite-plugin-dts": "^5.0.
|
|
37
|
+
"react-router-dom": "^7.18.0",
|
|
38
|
+
"vite": "^8.0.16",
|
|
39
|
+
"vite-plugin-dts": "^5.0.2"
|
|
40
40
|
},
|
|
41
41
|
"description": "Layout components for Object UI — AppShell, Page, SidebarNav and responsive containers with React Router integration",
|
|
42
42
|
"keywords": [
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ObjectUI Layout
|
|
3
|
-
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
-
*/
|
|
5
|
-
export * from './PageHeader';
|
|
6
|
-
export * from './AppShell';
|
|
7
|
-
export * from './Page';
|
|
8
|
-
export * from './PageCard';
|
|
9
|
-
export * from './SidebarNav';
|
|
10
|
-
export * from './ResponsiveGrid';
|
|
11
|
-
export * from './NavigationRenderer';
|
|
12
|
-
export * from './AppSchemaRenderer';
|
|
13
|
-
export declare function registerLayout(): void;
|
|
File without changes
|