@object-ui/layout 16.1.0 → 17.2.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 +290 -0
- package/README.md +11 -7
- package/dist/AppSchemaRenderer.d.ts +2 -2
- package/dist/NavigationRenderer.d.ts +13 -1
- package/dist/PageHeader.d.ts +24 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +82 -103
- package/dist/index.umd.cjs +1 -1
- package/package.json +13 -10
- package/dist/Page.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,295 @@
|
|
|
1
1
|
# @object-ui/layout
|
|
2
2
|
|
|
3
|
+
## 17.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4a51e77: Stop declaring 14 symbols across ten packages under names `@objectstack/spec`
|
|
8
|
+
owns (objectui#3161, objectstack#4115 batch 7 — the long tail, one or two
|
|
9
|
+
entries per package). All ten packages leave the ledger, which drops from 17
|
|
10
|
+
collisions across 11 packages to 3 across 1.
|
|
11
|
+
|
|
12
|
+
**Renamed exports** — in every case the spec exports the same name for a
|
|
13
|
+
_different_ thing, so the old name was a mis-description rather than a dialect:
|
|
14
|
+
|
|
15
|
+
| package | was | now | what the spec's same-named export is |
|
|
16
|
+
| :------------------------- | :--------------------------------- | :--------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `@object-ui/fields` | `FieldWidgetProps` | `FieldWidgetComponentProps` | the DECLARED field-widget plugin props contract (a zod object; `field.type` is the `FieldType` enum, `readonly`/`required` carry defaults) |
|
|
18
|
+
| `@object-ui/layout` | `PageHeaderProps` | `PageHeaderComponentProps` | the authored `page:header` node — a zod schema of `title`, `subtitle`, an icon NAME, `breadcrumb`, `actions: string[]` |
|
|
19
|
+
| `@object-ui/layout` | `Page` | `PageNodeRenderer` | the authored page metadata DOCUMENT (`name`, `label`, `type`, `regions`) |
|
|
20
|
+
| `@object-ui/plugin-detail` | `ObjectFieldLike` | `ObjectDefFieldLike` | the i18n duck type `translateObject` walks (`help`/`description`, plus `[key: string]: any`) |
|
|
21
|
+
| `@object-ui/plugin-grid` | `ColumnSummaryConfig` | `ColumnSummarySetting` | the OBJECT form of `ListColumn.summary` **only** — the local one was the whole union, shorthand included |
|
|
22
|
+
| `@object-ui/plugin-grid` | `isMultiValueField` | `hasMultiValueShape` | the spec's classifier, which requires a def with a `type`; the local one is called with `undefined` |
|
|
23
|
+
| `@object-ui/collaboration` | `RealtimeConfig` | `RealtimeSubscriptionConfig` | the app's realtime DECLARATION (`enabled`, `transport`, `subscriptions[]`) |
|
|
24
|
+
| `@object-ui/plugin-charts` | `ChartConfig` | `ChartContainerConfig` | the authored chart document (`type`, `xAxis`, `series`, `showLegend`, …) |
|
|
25
|
+
| `@object-ui/plugin-form` | `FormSection` / `FormSectionProps` | `FormSectionContainer` / `FormSectionContainerProps` | the authored form-section metadata (`name`, `pane`, `visibleWhen`, `fields`) |
|
|
26
|
+
| `@object-ui/providers` | `Theme` | `ThemePreference` | a whole theme DOCUMENT (`name`, `label`, `colors`, `typography`) |
|
|
27
|
+
| `@object-ui/runner` | `App` (default export) | `RunnerApp` | the authored application metadata type **and** the `App.create()` builder |
|
|
28
|
+
| `@object-ui/sdui-parser` | `ValidationResult` | `ManifestValidationResult` | plugin-manifest validation (`{ valid, errors?, warnings? }`), exported from both `kernel` and `contracts` |
|
|
29
|
+
|
|
30
|
+
`ManifestValidationResult` follows the `<what was validated>Validation<Error|Result>`
|
|
31
|
+
convention registered on objectstack#4115 (`@object-ui/core` took
|
|
32
|
+
`SchemaNodeValidationResult` in batch 4). `PageHeaderComponentProps` deliberately
|
|
33
|
+
reuses the name `@object-ui/app-shell` already chose for its own header props in
|
|
34
|
+
batch 3, so one concept does not acquire two dialect names one package apart.
|
|
35
|
+
|
|
36
|
+
**Now derived from the spec instead of hand-written:**
|
|
37
|
+
|
|
38
|
+
- `@object-ui/fields` — `isFileIdToken` is re-exported from
|
|
39
|
+
`@objectstack/spec/data`. The local copy was character-for-character identical
|
|
40
|
+
to the spec's function while its comment said it "mirrors" it, so every
|
|
41
|
+
behaviour test passed and only reference identity could tell the two apart.
|
|
42
|
+
The regex is a wire decision: widening it server-side while a copy here kept
|
|
43
|
+
the old bound would make every new id read as "not a reference", and the
|
|
44
|
+
widget would submit the legacy inline blob to a backend expecting a reference.
|
|
45
|
+
- `@object-ui/plugin-detail` — `FeedFilterMode` is re-exported from
|
|
46
|
+
`@objectstack/spec/data`, in a file that already imported the sibling
|
|
47
|
+
`FeedItemType` from the spec.
|
|
48
|
+
- `@object-ui/plugin-grid` — the eleven-member aggregation union is now the
|
|
49
|
+
spec's `ColumnSummary` enum, so the total `Record<ColumnSummaryType, string>`
|
|
50
|
+
label map turns a member the spec adds into a compile error instead of a
|
|
51
|
+
blank footer cell. `ColumnSummarySetting` is `NonNullable<ListColumn['summary']>`,
|
|
52
|
+
i.e. whatever forms the spec itself accepts. `hasMultiValueShape` delegates to
|
|
53
|
+
the spec's `isMultiValueField` rather than re-deriving it from
|
|
54
|
+
`MULTI_OPTION_TYPES` / `MULTI_CAPABLE_TYPES`.
|
|
55
|
+
- `@object-ui/providers` — `ThemePreference` is the spec's `ThemeMode` union
|
|
56
|
+
plus the one legacy `'system'` spelling this provider still honours for stored
|
|
57
|
+
preferences, read off the schema's own `_zod` carrier so the package takes no
|
|
58
|
+
zod dependency.
|
|
59
|
+
|
|
60
|
+
`@objectstack/spec` moves from `devDependencies` to `dependencies` in
|
|
61
|
+
`@object-ui/fields` (it re-exports a runtime function) and `@object-ui/providers`
|
|
62
|
+
(its public `.d.ts` now references the spec).
|
|
63
|
+
|
|
64
|
+
Scored `minor`, not `major`, per this repo's fixed-group rule — objectui's major
|
|
65
|
+
tracks `@objectstack`, so breaking changes of our own ship as minor with the
|
|
66
|
+
semantics spelled out above (see AGENTS.md §版本号策略). A `major` here would carry
|
|
67
|
+
all 39 packages of the fixed group to `18.0.0` and off objectstack's 17.x line.
|
|
68
|
+
|
|
69
|
+
- 07de7be: Navigation `action` items actually run now (framework#4509).
|
|
70
|
+
|
|
71
|
+
A `type: 'action'` nav item rendered, gated like any other item, and did
|
|
72
|
+
**nothing** when clicked. `NavigationRenderer` dispatches such a click to an
|
|
73
|
+
`onAction` prop it expects the host shell to supply — it deliberately never
|
|
74
|
+
reads `item.actionDef` itself — and no shipped sidebar supplied that prop. So
|
|
75
|
+
`actionDef.actionName` reached no dispatcher: an author could put an action in
|
|
76
|
+
the menu, watch it render with its icon and label, and never find out that
|
|
77
|
+
clicking it was a no-op. The framework's liveness ledger recorded this as the
|
|
78
|
+
single gap in the AppSchema navigation surface.
|
|
79
|
+
|
|
80
|
+
**New `useNavActionDispatch`** (`@object-ui/app-shell`) resolves the nav item's
|
|
81
|
+
`actionName` against `action` metadata at click time — the same source
|
|
82
|
+
`DeclaredActionsBar` reads for a record toolbar — and dispatches the resolved
|
|
83
|
+
definition through `useAction()`. `UnifiedSidebar` now passes it. No new
|
|
84
|
+
provider is involved: the sidebar already renders inside `ConsoleShell`'s
|
|
85
|
+
`GlobalActionRuntimeProvider`, so nav actions get the fully-wired console runner
|
|
86
|
+
including the confirm, param-collection, result and navigate dialogs. A declared
|
|
87
|
+
`params` array becomes the runner's param-dialog input, and the nav item's own
|
|
88
|
+
`actionDef.params` is passed as the value bag, so a menu entry can pre-fill the
|
|
89
|
+
action it launches.
|
|
90
|
+
|
|
91
|
+
Nav actions are inherently **global**: `ActionNavItemSchema` is strict with
|
|
92
|
+
exactly `{ actionName, params? }` and carries no `objectName`, so resolution is
|
|
93
|
+
by name alone and no record context rides along.
|
|
94
|
+
|
|
95
|
+
**Behaviour change:** a shell that passes no `onAction` no longer renders
|
|
96
|
+
`action` items at all, instead of rendering them dead. This mirrors the existing
|
|
97
|
+
capability guards — an item the host cannot serve is hidden — and it makes the
|
|
98
|
+
omission diagnosable: a missing prop now shows up as "my action item is gone",
|
|
99
|
+
which leads to the prop, rather than "clicking does nothing", which for three
|
|
100
|
+
releases led nowhere. Every failure at dispatch time (an unnamed item, an
|
|
101
|
+
unresolvable action, a throwing action) warns and toasts instead of returning
|
|
102
|
+
silently.
|
|
103
|
+
|
|
104
|
+
- 6d868e1: Remove `PageNodeRenderer`, the dead page-node renderer (objectui#3223, ADR-0049
|
|
105
|
+
enforce-or-remove).
|
|
106
|
+
|
|
107
|
+
**Removed:** the `PageNodeRenderer` export and its `./Page` module. It was
|
|
108
|
+
registered under no component key and imported by nothing — a whole-repo grep
|
|
109
|
+
found zero call sites — so it reached consumers only through
|
|
110
|
+
`export * from './Page'` in the package barrel. `registerLayout()` was already
|
|
111
|
+
saying so in a note that told the next reader _not_ to register it. Its props
|
|
112
|
+
were also `{ schema: PageNodeSchema; … } & any`, and an intersection with `any`
|
|
113
|
+
absorbs the whole type, so the signature asserted nothing beyond "there is a
|
|
114
|
+
schema".
|
|
115
|
+
|
|
116
|
+
**Migration:** there is nothing to re-point in a working app — an unregistered
|
|
117
|
+
renderer had no call site to migrate. If you imported the symbol directly:
|
|
118
|
+
|
|
119
|
+
```diff
|
|
120
|
+
-import { PageNodeRenderer } from '@object-ui/layout';
|
|
121
|
+
+import { PageRenderer } from '@object-ui/components';
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`PageRenderer` in `@object-ui/components` is, and remains, the renderer for the
|
|
125
|
+
`page` component key. It is the one that supports page types
|
|
126
|
+
(record/home/app/utility), named regions and `PageVariablesProvider` — the
|
|
127
|
+
deleted one rendered a header plus children and nothing else. Schema-driven
|
|
128
|
+
consumers are unaffected: a `{ type: 'page' }` node has always resolved through
|
|
129
|
+
the registry to `PageRenderer`, never to this export.
|
|
130
|
+
|
|
131
|
+
Also note: this supersedes the `Page` → `PageNodeRenderer` rename shipped for
|
|
132
|
+
this package in the batch 7 symbol burn-down — the renamed symbol is gone rather
|
|
133
|
+
than renamed again. `PageHeaderProps` → `PageHeaderComponentProps` from that same
|
|
134
|
+
batch is unaffected.
|
|
135
|
+
|
|
136
|
+
Scored `minor`, not `major`, per this repo's fixed-group rule — objectui's major
|
|
137
|
+
tracks `@objectstack`, so breaking changes of our own ship as minor with the
|
|
138
|
+
semantics spelled out above (see AGENTS.md §版本号策略). A `major` here would carry
|
|
139
|
+
all 39 packages of the fixed group to `18.0.0` and off objectstack's 17.x line.
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [4ae0ac4]
|
|
144
|
+
- Updated dependencies [696e3c1]
|
|
145
|
+
- Updated dependencies [bca45cc]
|
|
146
|
+
- Updated dependencies [a889e31]
|
|
147
|
+
- Updated dependencies [09d30a4]
|
|
148
|
+
- Updated dependencies [4bf612c]
|
|
149
|
+
- Updated dependencies [335041c]
|
|
150
|
+
- Updated dependencies [b414983]
|
|
151
|
+
- Updated dependencies [256f8cc]
|
|
152
|
+
- Updated dependencies [d9668a7]
|
|
153
|
+
- Updated dependencies [cb82705]
|
|
154
|
+
- Updated dependencies [f572849]
|
|
155
|
+
- Updated dependencies [f6e8d78]
|
|
156
|
+
- Updated dependencies [ea96284]
|
|
157
|
+
- Updated dependencies [d3584c6]
|
|
158
|
+
- Updated dependencies [a8ad6c0]
|
|
159
|
+
- Updated dependencies [444457c]
|
|
160
|
+
- Updated dependencies [850033c]
|
|
161
|
+
- Updated dependencies [022e4c3]
|
|
162
|
+
- Updated dependencies [009e25d]
|
|
163
|
+
- Updated dependencies [726b89c]
|
|
164
|
+
- @object-ui/types@17.2.0
|
|
165
|
+
- @object-ui/components@17.2.0
|
|
166
|
+
- @object-ui/core@17.2.0
|
|
167
|
+
- @object-ui/react@17.2.0
|
|
168
|
+
|
|
169
|
+
## 17.1.0
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- b5b97e2: fix(types,layout): nav item type `component` joins `NavigationItemType` and its zod enum — objectui#2918
|
|
174
|
+
|
|
175
|
+
The renderers have carried a full `type: 'component'` implementation (Phase 3b:
|
|
176
|
+
`componentRef` colon-split to `/component/<ns>/<name>`, `params` serialised as
|
|
177
|
+
querystring, `metadata:*` special-cases) — but the vocabulary never gained the
|
|
178
|
+
member, and `@objectstack/spec` has had `ComponentNavItem` all along. The zod
|
|
179
|
+
enum was the part that bit: `NavigationItemTypeSchema` rejected
|
|
180
|
+
`type: 'component'` at validation time, so authors could not declare one and
|
|
181
|
+
the renderer half was unreachable — dead on arrival rather than dead code.
|
|
182
|
+
|
|
183
|
+
- `NavigationItemType` and `NavigationItemTypeSchema` gain `'component'`;
|
|
184
|
+
`NavigationItem` gains the fields the renderer consumes, `componentRef` and
|
|
185
|
+
`params` (also used by `type: 'page'`), mirroring spec's `ComponentNavItem` —
|
|
186
|
+
declared in zod too, so parse no longer strips them.
|
|
187
|
+
- The `(item as any).componentRef` / `params` casts in `NavigationRenderer`
|
|
188
|
+
and `AppSchemaRenderer` become typed access.
|
|
189
|
+
- `NavigationDesigner`'s exhaustive type-meta map gains a `component` badge
|
|
190
|
+
(new `appDesigner.navTypeComponent` key in all 10 locales).
|
|
191
|
+
- `@object-ui/layout` gains `type-check` (src + tests) with the #2915 `paths`
|
|
192
|
+
override; its DEBT entry in `check-type-check-coverage.mjs` is deleted.
|
|
193
|
+
|
|
194
|
+
- Updated dependencies [62311b6]
|
|
195
|
+
- Updated dependencies [fc0272a]
|
|
196
|
+
- Updated dependencies [9e7349e]
|
|
197
|
+
- Updated dependencies [8864971]
|
|
198
|
+
- Updated dependencies [c785740]
|
|
199
|
+
- Updated dependencies [b41f401]
|
|
200
|
+
- Updated dependencies [19e9fa0]
|
|
201
|
+
- Updated dependencies [95b7214]
|
|
202
|
+
- Updated dependencies [7d9734d]
|
|
203
|
+
- Updated dependencies [6ae818e]
|
|
204
|
+
- Updated dependencies [9eb932b]
|
|
205
|
+
- Updated dependencies [746dd00]
|
|
206
|
+
- Updated dependencies [aebfa4f]
|
|
207
|
+
- Updated dependencies [38ca8be]
|
|
208
|
+
- Updated dependencies [68ef584]
|
|
209
|
+
- Updated dependencies [4952edf]
|
|
210
|
+
- Updated dependencies [7f0252e]
|
|
211
|
+
- Updated dependencies [c4d7b20]
|
|
212
|
+
- Updated dependencies [c769d3d]
|
|
213
|
+
- Updated dependencies [7639a61]
|
|
214
|
+
- Updated dependencies [94e63ef]
|
|
215
|
+
- Updated dependencies [c735bf7]
|
|
216
|
+
- Updated dependencies [02aef0c]
|
|
217
|
+
- Updated dependencies [6f29aa5]
|
|
218
|
+
- Updated dependencies [c4db402]
|
|
219
|
+
- Updated dependencies [5319bf1]
|
|
220
|
+
- Updated dependencies [49e5671]
|
|
221
|
+
- Updated dependencies [9a04d25]
|
|
222
|
+
- Updated dependencies [b5b97e2]
|
|
223
|
+
- Updated dependencies [f59f2c1]
|
|
224
|
+
- Updated dependencies [07de839]
|
|
225
|
+
- Updated dependencies [2a40b5e]
|
|
226
|
+
- Updated dependencies [df613fa]
|
|
227
|
+
- Updated dependencies [4874117]
|
|
228
|
+
- Updated dependencies [ad0183a]
|
|
229
|
+
- Updated dependencies [ce08d55]
|
|
230
|
+
- Updated dependencies [eb4b740]
|
|
231
|
+
- Updated dependencies [5b084eb]
|
|
232
|
+
- Updated dependencies [aa1240a]
|
|
233
|
+
- Updated dependencies [2374a49]
|
|
234
|
+
- Updated dependencies [390c071]
|
|
235
|
+
- Updated dependencies [d10f526]
|
|
236
|
+
- Updated dependencies [2d5d594]
|
|
237
|
+
- Updated dependencies [ea7f477]
|
|
238
|
+
- Updated dependencies [379728f]
|
|
239
|
+
- Updated dependencies [7f23cd0]
|
|
240
|
+
- Updated dependencies [0ded602]
|
|
241
|
+
- Updated dependencies [24e0e0a]
|
|
242
|
+
- Updated dependencies [3a6cf24]
|
|
243
|
+
- Updated dependencies [aa35561]
|
|
244
|
+
- Updated dependencies [03bd53b]
|
|
245
|
+
- Updated dependencies [3c1f321]
|
|
246
|
+
- Updated dependencies [a045a32]
|
|
247
|
+
- Updated dependencies [912496d]
|
|
248
|
+
- Updated dependencies [80edbd4]
|
|
249
|
+
- Updated dependencies [9867281]
|
|
250
|
+
- @object-ui/core@17.1.0
|
|
251
|
+
- @object-ui/components@17.1.0
|
|
252
|
+
- @object-ui/react@17.1.0
|
|
253
|
+
- @object-ui/types@17.1.0
|
|
254
|
+
|
|
255
|
+
## 17.0.0
|
|
256
|
+
|
|
257
|
+
### Patch Changes
|
|
258
|
+
|
|
259
|
+
- Updated dependencies [7b21891]
|
|
260
|
+
- Updated dependencies [952b978]
|
|
261
|
+
- Updated dependencies [de5e40c]
|
|
262
|
+
- Updated dependencies [1767124]
|
|
263
|
+
- Updated dependencies [8ecf5a6]
|
|
264
|
+
- Updated dependencies [7b35e4b]
|
|
265
|
+
- Updated dependencies [8fb1295]
|
|
266
|
+
- Updated dependencies [e16ed2d]
|
|
267
|
+
- Updated dependencies [f9bbddb]
|
|
268
|
+
- Updated dependencies [dfd3705]
|
|
269
|
+
- Updated dependencies [c77108c]
|
|
270
|
+
- Updated dependencies [2735de6]
|
|
271
|
+
- Updated dependencies [c19ac11]
|
|
272
|
+
- Updated dependencies [6dee2cb]
|
|
273
|
+
- Updated dependencies [c7cff19]
|
|
274
|
+
- Updated dependencies [cd09a7b]
|
|
275
|
+
- Updated dependencies [f1abf0e]
|
|
276
|
+
- Updated dependencies [f05b84e]
|
|
277
|
+
- Updated dependencies [2f947e4]
|
|
278
|
+
- Updated dependencies [7d46648]
|
|
279
|
+
- Updated dependencies [9b53d72]
|
|
280
|
+
- Updated dependencies [662bdf9]
|
|
281
|
+
- Updated dependencies [059a052]
|
|
282
|
+
- Updated dependencies [53642d4]
|
|
283
|
+
- Updated dependencies [8aae006]
|
|
284
|
+
- Updated dependencies [c6cfdf1]
|
|
285
|
+
- Updated dependencies [d147a13]
|
|
286
|
+
- Updated dependencies [c6aaed8]
|
|
287
|
+
- Updated dependencies [dc334da]
|
|
288
|
+
- @object-ui/components@17.0.0
|
|
289
|
+
- @object-ui/react@17.0.0
|
|
290
|
+
- @object-ui/types@17.0.0
|
|
291
|
+
- @object-ui/core@17.0.0
|
|
292
|
+
|
|
3
293
|
## 16.1.0
|
|
4
294
|
|
|
5
295
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -38,19 +38,23 @@ import { AppShell } from '@object-ui/layout';
|
|
|
38
38
|
</AppShell>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
###
|
|
41
|
+
### PageHeader
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Page title block with an optional description, used at the top of a page's
|
|
44
|
+
content area.
|
|
44
45
|
|
|
45
46
|
```typescript
|
|
46
|
-
import {
|
|
47
|
+
import { PageHeader } from '@object-ui/layout';
|
|
47
48
|
|
|
48
|
-
<
|
|
49
|
-
<PageHeader title="Dashboard" description="View your metrics" />
|
|
50
|
-
<div>Page Content</div>
|
|
51
|
-
</Page>
|
|
49
|
+
<PageHeader title="Dashboard" description="View your metrics" />
|
|
52
50
|
```
|
|
53
51
|
|
|
52
|
+
> **Rendering a whole `page` node?** That belongs to `PageRenderer` in
|
|
53
|
+
> `@object-ui/components`, which is what the `page` component key resolves to —
|
|
54
|
+
> it handles page types (record/home/app/utility), named regions and page
|
|
55
|
+
> variables. This package deliberately does not register or export a second
|
|
56
|
+
> renderer for that key (objectui#3223).
|
|
57
|
+
|
|
54
58
|
### SidebarNav
|
|
55
59
|
|
|
56
60
|
Navigation sidebar component with React Router integration.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AppComponentSchema, 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';
|
|
6
6
|
export interface AppSchemaRendererProps {
|
|
7
7
|
/** The AppSchema JSON to render */
|
|
8
|
-
schema:
|
|
8
|
+
schema: AppComponentSchema;
|
|
9
9
|
/** Base URL prefix for generated hrefs (e.g. "/apps/crm") */
|
|
10
10
|
basePath?: string;
|
|
11
11
|
/** Mobile navigation mode @default "drawer" */
|
|
@@ -41,7 +41,19 @@ export interface NavigationRendererProps {
|
|
|
41
41
|
checkPermission?: PermissionChecker;
|
|
42
42
|
/** Optional runtime-capability checker for `requiresObject` / `requiresService` */
|
|
43
43
|
checkCapability?: CapabilityChecker;
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Called when an `action`-type item is clicked.
|
|
46
|
+
*
|
|
47
|
+
* A shell that renders `action` items MUST supply this: the renderer has no
|
|
48
|
+
* dispatcher of its own and never reads `item.actionDef` — unpacking
|
|
49
|
+
* `actionName` / `params` and invoking the action is the host's job (see
|
|
50
|
+
* `useNavActionDispatch` in `@objectstack/app-shell`). Omitting it does not
|
|
51
|
+
* degrade to an inert button; action items are **not rendered at all**,
|
|
52
|
+
* because a nav entry that looks clickable and silently does nothing is worse
|
|
53
|
+
* than an absent one (framework#4509 — every shipped sidebar omitted this
|
|
54
|
+
* prop, so `actionDef.actionName` reached no dispatcher and every such item
|
|
55
|
+
* dead-clicked).
|
|
56
|
+
*/
|
|
45
57
|
onAction?: (item: NavigationItem) => void;
|
|
46
58
|
/** Search query to filter navigation items by label */
|
|
47
59
|
searchQuery?: string;
|
package/dist/PageHeader.d.ts
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Props of this package's `<PageHeader>` React component.
|
|
4
|
+
*
|
|
5
|
+
* Named `PageHeaderComponentProps`, not `PageHeaderProps` (objectui#3161,
|
|
6
|
+
* objectstack#4115 ledger batch 7) — the same name `@object-ui/app-shell`
|
|
7
|
+
* settled on for its own header props in objectui#3169, deliberately reused
|
|
8
|
+
* rather than re-invented, so one concept does not end up with two dialect
|
|
9
|
+
* names one package apart.
|
|
10
|
+
*
|
|
11
|
+
* `@objectstack/spec/ui` owns `PageHeaderProps` for the AUTHORED `page:header`
|
|
12
|
+
* node: a zod object of `title: string`, `subtitle`, an icon NAME, `breadcrumb`
|
|
13
|
+
* and `actions: string[]` (action IDs). This interface is the rendered layer of
|
|
14
|
+
* that same element — `icon` accepts a React node as well as a name, `actions`
|
|
15
|
+
* is a list of action definitions the `record:quick_actions` widget renders,
|
|
16
|
+
* `schema` carries the raw node, and it extends `HTMLAttributes` so every DOM
|
|
17
|
+
* prop rides along. Authored layer vs rendered layer, which is exactly the
|
|
18
|
+
* one-name-two-layers failure objectstack#4115 exists to end.
|
|
19
|
+
*
|
|
20
|
+
* Pinned by `__tests__/spec-symbol-batch7.test.tsx`, which fails if the spec
|
|
21
|
+
* stops owning `PageHeaderProps` (then this can take the plain name back) or
|
|
22
|
+
* starts owning `PageHeaderComponentProps`.
|
|
23
|
+
*/
|
|
24
|
+
export interface PageHeaderComponentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
25
|
title: string;
|
|
4
26
|
/**
|
|
5
27
|
* Optional secondary line under the title. Spec schemas use `subtitle`,
|
|
@@ -44,4 +66,4 @@ export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
44
66
|
};
|
|
45
67
|
};
|
|
46
68
|
}
|
|
47
|
-
export declare function PageHeader({ title, subtitle, description, icon, action, actions, showBack, schema, className, children, ...props }:
|
|
69
|
+
export declare function PageHeader({ title, subtitle, description, icon, action, actions, showBack, schema, className, children, ...props }: PageHeaderComponentProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var _e = (e) => {
|
|
|
21
21
|
let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
|
|
22
22
|
return r == null ? "" : typeof r == "object" ? _e(r) ?? "" : String(r);
|
|
23
23
|
}).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
|
|
24
|
-
function
|
|
24
|
+
function ye({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
|
|
25
25
|
let m = ae(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = ve(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = ve(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
|
|
26
26
|
if (typeof window > "u") return;
|
|
27
27
|
let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
|
|
@@ -77,7 +77,7 @@ function G({ title: e, subtitle: n, description: r, icon: i, action: a, actions:
|
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/AppShell.tsx
|
|
80
|
-
function
|
|
80
|
+
function be(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 ye(e) {
|
|
|
101
101
|
l: l * 100
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
let t =
|
|
104
|
+
function xe(e) {
|
|
105
|
+
let t = be(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 Se(e) {
|
|
109
|
+
let t = be(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 Ce(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 Se(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 we(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 = xe(e.primaryColor), i = Se(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%" : Ce(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 = xe(e.accentColor), i = Se(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%" : Ce(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();
|
|
@@ -156,8 +156,8 @@ function Ce(e, t) {
|
|
|
156
156
|
t
|
|
157
157
|
]);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
159
|
+
function G({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
|
|
160
|
+
return we(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", {
|
|
@@ -181,7 +181,7 @@ function K({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
|
|
|
181
181
|
}
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/PageCard.tsx
|
|
184
|
-
function
|
|
184
|
+
function Te({ className: e, children: t, ...n }) {
|
|
185
185
|
return /* @__PURE__ */ R("div", {
|
|
186
186
|
className: A("rounded-xl border bg-card text-card-foreground shadow", e),
|
|
187
187
|
...n,
|
|
@@ -193,7 +193,7 @@ function we({ className: e, children: t, ...n }) {
|
|
|
193
193
|
}
|
|
194
194
|
//#endregion
|
|
195
195
|
//#region src/ResponsiveGrid.tsx
|
|
196
|
-
var
|
|
196
|
+
var Ee = {
|
|
197
197
|
xs: {
|
|
198
198
|
1: "grid-cols-1",
|
|
199
199
|
2: "grid-cols-2",
|
|
@@ -243,11 +243,11 @@ var Te = {
|
|
|
243
243
|
12: "2xl:grid-cols-12"
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
function
|
|
246
|
+
function De(e) {
|
|
247
247
|
if (!e) return "grid-cols-1";
|
|
248
248
|
let t = [];
|
|
249
249
|
for (let [n, r] of Object.entries(e)) {
|
|
250
|
-
let e =
|
|
250
|
+
let e = Ee[n];
|
|
251
251
|
if (e && r) {
|
|
252
252
|
let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
|
|
253
253
|
t.push(e[n]);
|
|
@@ -255,7 +255,7 @@ function Ee(e) {
|
|
|
255
255
|
}
|
|
256
256
|
return t.join(" ") || "grid-cols-1";
|
|
257
257
|
}
|
|
258
|
-
var
|
|
258
|
+
var Oe = {
|
|
259
259
|
0: "gap-0",
|
|
260
260
|
1: "gap-1",
|
|
261
261
|
2: "gap-2",
|
|
@@ -264,16 +264,16 @@ var De = {
|
|
|
264
264
|
5: "gap-5",
|
|
265
265
|
6: "gap-6",
|
|
266
266
|
8: "gap-8"
|
|
267
|
-
},
|
|
268
|
-
className: A("grid",
|
|
267
|
+
}, ke = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
|
|
268
|
+
className: A("grid", De(e), typeof t == "number" ? Oe[t] || `gap-${t}` : "", n),
|
|
269
269
|
children: r
|
|
270
270
|
});
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/NavigationRenderer.tsx
|
|
273
|
-
function
|
|
273
|
+
function K(e) {
|
|
274
274
|
return e ? j(e) : F;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function q(e, t) {
|
|
277
277
|
if (typeof e == "string") return e;
|
|
278
278
|
if (t) {
|
|
279
279
|
let n = t(e.key, {
|
|
@@ -284,8 +284,8 @@ function J(e, t) {
|
|
|
284
284
|
}
|
|
285
285
|
return e.defaultValue || e.key;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
let s =
|
|
287
|
+
function Ae(e, t, n, r, i, a, o) {
|
|
288
|
+
let s = q(e.label, n);
|
|
289
289
|
if (typeof e.label != "string") return s;
|
|
290
290
|
let c = (e) => !!e && s.trim().toLowerCase() !== e.trim().toLowerCase();
|
|
291
291
|
if (e.type === "object" && e.objectName) {
|
|
@@ -303,21 +303,21 @@ function ke(e, t, n, r, i, a, o) {
|
|
|
303
303
|
}
|
|
304
304
|
return o && e.id && !c(e.id) ? o(e.id, s) : s;
|
|
305
305
|
}
|
|
306
|
-
var
|
|
307
|
-
function
|
|
306
|
+
var je = (e) => !(e === !1 || e === "false"), Me = () => !0, Ne = () => !0, Pe = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
|
|
307
|
+
function J(e, t) {
|
|
308
308
|
if (!e.includes("{")) return e;
|
|
309
|
-
let n = !1, r = e.replace(
|
|
309
|
+
let n = !1, r = e.replace(Pe, (e, r) => {
|
|
310
310
|
let i;
|
|
311
311
|
return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
|
|
312
312
|
});
|
|
313
313
|
return n ? null : r;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function Y(e, t, n) {
|
|
316
316
|
switch (e.type) {
|
|
317
317
|
case "object": {
|
|
318
318
|
let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
|
|
319
319
|
if (i) {
|
|
320
|
-
let t =
|
|
320
|
+
let t = J(i, n);
|
|
321
321
|
if (t) {
|
|
322
322
|
let n = `${r}/record/${encodeURIComponent(t)}`;
|
|
323
323
|
return {
|
|
@@ -331,7 +331,7 @@ function X(e, t, n) {
|
|
|
331
331
|
let e = new URLSearchParams();
|
|
332
332
|
for (let [t, r] of Object.entries(a)) {
|
|
333
333
|
if (r == null || t === "") continue;
|
|
334
|
-
let i =
|
|
334
|
+
let i = J(String(r), n);
|
|
335
335
|
i !== null && e.set(`filter[${t}]`, i);
|
|
336
336
|
}
|
|
337
337
|
let t = e.toString();
|
|
@@ -358,7 +358,7 @@ function X(e, t, n) {
|
|
|
358
358
|
if (r && typeof r == "object") {
|
|
359
359
|
let e = new URLSearchParams();
|
|
360
360
|
for (let [t, i] of Object.entries(r)) if (i != null) if (typeof i == "string") {
|
|
361
|
-
let r =
|
|
361
|
+
let r = J(i, n);
|
|
362
362
|
r !== null && e.set(t, r);
|
|
363
363
|
} else e.set(t, JSON.stringify(i));
|
|
364
364
|
let t = e.toString();
|
|
@@ -394,7 +394,7 @@ function X(e, t, n) {
|
|
|
394
394
|
if (a && typeof a == "object") {
|
|
395
395
|
let e = new URLSearchParams();
|
|
396
396
|
for (let [t, r] of Object.entries(a)) if (!(t === "type" || t === "name") && r != null) if (typeof r == "string") {
|
|
397
|
-
let i =
|
|
397
|
+
let i = J(r, n);
|
|
398
398
|
i && e.set(t, i);
|
|
399
399
|
} else e.set(t, JSON.stringify(r));
|
|
400
400
|
let t = e.toString();
|
|
@@ -429,27 +429,27 @@ function X(e, t, n) {
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
var
|
|
433
|
-
function
|
|
432
|
+
var Fe = 50, Ie = 40, Le = 30, Re = 25, ze = 10, Be = 5;
|
|
433
|
+
function Ve(e) {
|
|
434
434
|
let t = /* @__PURE__ */ new Map();
|
|
435
435
|
return new URLSearchParams(e).forEach((e, n) => {
|
|
436
436
|
let r = /^filter\[(.+)\]$/.exec(n);
|
|
437
437
|
r && r[1] && e !== "" && t.set(r[1], e);
|
|
438
438
|
}), t;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function He(e, t) {
|
|
441
441
|
return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
let { href: a, external: o } =
|
|
443
|
+
function Ue(e, t, n, r, i) {
|
|
444
|
+
let { href: a, external: o } = Y(e, r, i);
|
|
445
445
|
if (o || a === "#") return 0;
|
|
446
446
|
if (e.type === "object" && e.objectName) {
|
|
447
447
|
let a = `${r}/${e.objectName}`;
|
|
448
448
|
if (t !== a && !t.startsWith(`${a}/`)) return 0;
|
|
449
449
|
let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
|
|
450
450
|
if (s) {
|
|
451
|
-
let e =
|
|
452
|
-
if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ?
|
|
451
|
+
let e = J(s, i);
|
|
452
|
+
if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Fe : 0;
|
|
453
453
|
}
|
|
454
454
|
let c = e.filters;
|
|
455
455
|
if (c && typeof c == "object" && !Array.isArray(c)) {
|
|
@@ -457,47 +457,47 @@ function He(e, t, n, r, i) {
|
|
|
457
457
|
let e = /* @__PURE__ */ new Map();
|
|
458
458
|
for (let [t, n] of Object.entries(c)) {
|
|
459
459
|
if (n == null || t === "") continue;
|
|
460
|
-
let r =
|
|
460
|
+
let r = J(String(n), i);
|
|
461
461
|
r !== null && e.set(t, r);
|
|
462
462
|
}
|
|
463
463
|
if (e.size !== n.size) return 0;
|
|
464
464
|
for (let [t, r] of e) if (n.get(t) !== r) return 0;
|
|
465
|
-
return
|
|
465
|
+
return Ie;
|
|
466
466
|
}
|
|
467
|
-
return e.viewName ? o[0] !== "view" || !o[1] ? 0 :
|
|
467
|
+
return e.viewName ? o[0] !== "view" || !o[1] ? 0 : He(e.objectName, decodeURIComponent(o[1])) === He(e.objectName, e.viewName) ? Le : 0 : o.length === 0 ? Re : ze;
|
|
468
468
|
}
|
|
469
469
|
let s = a.split("?")[0];
|
|
470
|
-
if (t === s) return
|
|
470
|
+
if (t === s) return Re;
|
|
471
471
|
let c = e.componentRef;
|
|
472
|
-
return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ?
|
|
472
|
+
return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? Be : 0;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
475
|
-
let a =
|
|
474
|
+
function We(e, t, n, r, i) {
|
|
475
|
+
let a = Ve(n), o = null, s = 0, c = (e) => {
|
|
476
476
|
if (e) for (let n of e) {
|
|
477
477
|
if (n.type === "group") {
|
|
478
478
|
c(n.children);
|
|
479
479
|
continue;
|
|
480
480
|
}
|
|
481
|
-
let e =
|
|
481
|
+
let e = Ue(n, t, a, r, i);
|
|
482
482
|
e > s && (o = n, s = e);
|
|
483
483
|
}
|
|
484
484
|
};
|
|
485
485
|
return c(e), o;
|
|
486
486
|
}
|
|
487
|
-
var
|
|
488
|
-
function
|
|
487
|
+
var X = t.createContext(null);
|
|
488
|
+
function Z(e, t) {
|
|
489
489
|
if (!t.trim()) return e;
|
|
490
490
|
let n = t.toLowerCase().trim();
|
|
491
491
|
return e.reduce((e, r) => {
|
|
492
492
|
if (r.type === "separator") return e;
|
|
493
493
|
if (r.type === "group" && r.children?.length) {
|
|
494
|
-
let n =
|
|
494
|
+
let n = Z(r.children, t);
|
|
495
495
|
return n.length > 0 && e.push({
|
|
496
496
|
...r,
|
|
497
497
|
children: n
|
|
498
498
|
}), e;
|
|
499
499
|
}
|
|
500
|
-
return
|
|
500
|
+
return q(r.label).toLowerCase().includes(n) && e.push(r), e;
|
|
501
501
|
}, []);
|
|
502
502
|
}
|
|
503
503
|
var Ge = 5;
|
|
@@ -537,10 +537,9 @@ function Ke({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
|
|
|
537
537
|
}
|
|
538
538
|
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 }) {
|
|
539
539
|
let j = M(), N = j ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, F = A("shrink-0", j ? "h-5 w-5" : "h-4 w-4"), te = (() => {
|
|
540
|
-
|
|
541
|
-
if (typeof t == "boolean") return t;
|
|
540
|
+
if (typeof e.expanded == "boolean") return e.expanded;
|
|
542
541
|
if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
|
|
543
|
-
})(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(
|
|
542
|
+
})(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(X), [L, ae] = i(t.useMemo(() => {
|
|
544
543
|
if (e.type !== "group" || !I) return !1;
|
|
545
544
|
let t = (e) => !!e?.some((e) => e.id === I || e.type === "group" && t(e.children));
|
|
546
545
|
return t(e.children);
|
|
@@ -550,7 +549,7 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
550
549
|
if (B && !u("object", B) || V && !u("service", V)) return null;
|
|
551
550
|
if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
|
|
552
551
|
if (e.type === "group") {
|
|
553
|
-
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i =
|
|
552
|
+
let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = Ae(e, y, O, b, x, E, D);
|
|
554
553
|
return /* @__PURE__ */ R(s, {
|
|
555
554
|
open: L,
|
|
556
555
|
onOpenChange: ae,
|
|
@@ -580,7 +579,8 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
580
579
|
});
|
|
581
580
|
}
|
|
582
581
|
if (e.type === "action") {
|
|
583
|
-
|
|
582
|
+
if (!d) return null;
|
|
583
|
+
let t = K(e.icon), r = q(e.label, O);
|
|
584
584
|
return /* @__PURE__ */ z(T, { children: [
|
|
585
585
|
h && /* @__PURE__ */ R("span", {
|
|
586
586
|
className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
|
|
@@ -613,7 +613,7 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
613
613
|
})
|
|
614
614
|
] });
|
|
615
615
|
}
|
|
616
|
-
let ce =
|
|
616
|
+
let ce = K(e.icon), { href: H, external: le } = Y(e, n, k), ue = I !== null && e.id === I, U = Ae(e, y, O, b, x, E, D), W = /* @__PURE__ */ z(oe, { children: [
|
|
617
617
|
/* @__PURE__ */ R(ce, { className: F }),
|
|
618
618
|
/* @__PURE__ */ R("span", { children: U }),
|
|
619
619
|
e.badge != null && /* @__PURE__ */ R(a, {
|
|
@@ -655,14 +655,14 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
|
|
|
655
655
|
})
|
|
656
656
|
] });
|
|
657
657
|
}
|
|
658
|
-
function $({ items: e, basePath: t = "", evaluateVisibility: n =
|
|
659
|
-
let C = V(), w = r(() =>
|
|
658
|
+
function $({ items: e, basePath: t = "", evaluateVisibility: n = je, checkPermission: i = Me, checkCapability: a = Ne, 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 }) {
|
|
659
|
+
let C = V(), w = r(() => We(e, C.pathname, C.search, t, x)?.id ?? null, [
|
|
660
660
|
e,
|
|
661
661
|
C.pathname,
|
|
662
662
|
C.search,
|
|
663
663
|
t,
|
|
664
664
|
x
|
|
665
|
-
]), T = r(() => s ?
|
|
665
|
+
]), T = r(() => s ? Z(e, s) : e, [e, s]), E = r(() => qe(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = W(U(le, { activationConstraint: { distance: Ge } }), U(H)), k = (e) => {
|
|
666
666
|
let { active: t, over: n } = e;
|
|
667
667
|
if (!n || t.id === n.id || !d) return;
|
|
668
668
|
let r = D.findIndex((e) => e.id === t.id), i = D.findIndex((e) => e.id === n.id);
|
|
@@ -710,7 +710,7 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermis
|
|
|
710
710
|
item: e,
|
|
711
711
|
...A
|
|
712
712
|
}, e.id)) });
|
|
713
|
-
return /* @__PURE__ */ z(
|
|
713
|
+
return /* @__PURE__ */ z(X.Provider, {
|
|
714
714
|
value: w,
|
|
715
715
|
children: [M, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: t }) })]
|
|
716
716
|
});
|
|
@@ -728,7 +728,7 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermis
|
|
|
728
728
|
item: e,
|
|
729
729
|
...A
|
|
730
730
|
}, e.id))) : P.push(e);
|
|
731
|
-
}), F("leaf-end"), /* @__PURE__ */ z(
|
|
731
|
+
}), F("leaf-end"), /* @__PURE__ */ z(X.Provider, {
|
|
732
732
|
value: w,
|
|
733
733
|
children: [M, N]
|
|
734
734
|
});
|
|
@@ -746,12 +746,12 @@ function Je({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm:
|
|
|
746
746
|
className: "flex items-center gap-1.5",
|
|
747
747
|
children: [/* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" }), "Area"]
|
|
748
748
|
}), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
|
|
749
|
-
let r =
|
|
749
|
+
let r = K(e.icon);
|
|
750
750
|
return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
|
|
751
751
|
isActive: e.id === t,
|
|
752
|
-
tooltip:
|
|
752
|
+
tooltip: q(e.label),
|
|
753
753
|
onClick: () => n(e.id),
|
|
754
|
-
children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children:
|
|
754
|
+
children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: q(e.label) })]
|
|
755
755
|
}) }, e.id);
|
|
756
756
|
}) }) })] });
|
|
757
757
|
}
|
|
@@ -766,7 +766,7 @@ function Ye({ items: e, basePath: t }) {
|
|
|
766
766
|
role: "navigation",
|
|
767
767
|
"aria-label": "Mobile navigation",
|
|
768
768
|
children: i.map((e) => {
|
|
769
|
-
let r =
|
|
769
|
+
let r = K(e.icon), i = "#";
|
|
770
770
|
if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
|
|
771
771
|
else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
|
|
772
772
|
else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
|
|
@@ -791,14 +791,14 @@ function Ye({ items: e, basePath: t }) {
|
|
|
791
791
|
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"}`,
|
|
792
792
|
children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
|
|
793
793
|
className: "text-[10px] truncate max-w-[60px]",
|
|
794
|
-
children:
|
|
794
|
+
children: q(e.label)
|
|
795
795
|
})]
|
|
796
796
|
}, e.id);
|
|
797
797
|
})
|
|
798
798
|
});
|
|
799
799
|
}
|
|
800
800
|
function Xe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, activeAreaId: u, setActiveAreaId: d, resolvedNavigation: f, enableSearch: g, enablePinning: _, onPinToggle: v, enableReorder: x, onReorder: C }) {
|
|
801
|
-
let E =
|
|
801
|
+
let E = K(e.logo), D = e.areas ?? [], [O, k] = i("");
|
|
802
802
|
return /* @__PURE__ */ z(p, {
|
|
803
803
|
collapsible: "icon",
|
|
804
804
|
children: [
|
|
@@ -865,7 +865,7 @@ function Ze({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
865
865
|
favicon: e.favicon,
|
|
866
866
|
logo: e.logo
|
|
867
867
|
};
|
|
868
|
-
return /* @__PURE__ */ z(oe, { children: [/* @__PURE__ */ R(
|
|
868
|
+
return /* @__PURE__ */ z(oe, { children: [/* @__PURE__ */ R(G, {
|
|
869
869
|
sidebar: /* @__PURE__ */ R(Xe, {
|
|
870
870
|
schema: e,
|
|
871
871
|
basePath: t,
|
|
@@ -896,32 +896,11 @@ function Ze({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
|
|
|
896
896
|
})] });
|
|
897
897
|
}
|
|
898
898
|
//#endregion
|
|
899
|
-
//#region src/Page.tsx
|
|
900
|
-
var Qe = (e) => e ? Array.isArray(e) ? e : [e] : [];
|
|
901
|
-
function $e({ schema: e, className: t, style: n, id: r, ...i }) {
|
|
902
|
-
let a = Qe(e.children);
|
|
903
|
-
return /* @__PURE__ */ z("div", {
|
|
904
|
-
id: r || e.id,
|
|
905
|
-
className: A("flex flex-col h-full space-y-4", t),
|
|
906
|
-
style: n,
|
|
907
|
-
children: [/* @__PURE__ */ R(G, {
|
|
908
|
-
title: e.title,
|
|
909
|
-
description: e.description
|
|
910
|
-
}), /* @__PURE__ */ R("div", {
|
|
911
|
-
className: "flex-1 overflow-auto",
|
|
912
|
-
children: a.map((e, t) => /* @__PURE__ */ R(L, {
|
|
913
|
-
schema: e,
|
|
914
|
-
...i
|
|
915
|
-
}, e?.id || t))
|
|
916
|
-
})]
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
//#endregion
|
|
920
899
|
//#region src/SidebarNav.tsx
|
|
921
|
-
function
|
|
900
|
+
function Qe(e) {
|
|
922
901
|
return "items" in e && !("href" in e);
|
|
923
902
|
}
|
|
924
|
-
function
|
|
903
|
+
function $e({ item: e, pathname: t }) {
|
|
925
904
|
return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
|
|
926
905
|
asChild: !0,
|
|
927
906
|
defaultOpen: !0,
|
|
@@ -981,8 +960,8 @@ function tt({ item: e, pathname: t }) {
|
|
|
981
960
|
})
|
|
982
961
|
}) });
|
|
983
962
|
}
|
|
984
|
-
function
|
|
985
|
-
let s = V(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] :
|
|
963
|
+
function et({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
|
|
964
|
+
let s = V(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Qe(e[0]) ? e.map((e) => ({
|
|
986
965
|
groupLabel: e.label,
|
|
987
966
|
items: e.items
|
|
988
967
|
})) : [{ items: e }], [e]), f = t.useMemo(() => {
|
|
@@ -1017,7 +996,7 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
1017
996
|
className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
|
|
1018
997
|
children: e.groupLabel || n
|
|
1019
998
|
}),
|
|
1020
|
-
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(
|
|
999
|
+
/* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R($e, {
|
|
1021
1000
|
item: e,
|
|
1022
1001
|
pathname: s.pathname
|
|
1023
1002
|
}, e.href)) }) })
|
|
@@ -1026,8 +1005,8 @@ function nt({ items: e, title: n = "Application", className: r, collapsible: i =
|
|
|
1026
1005
|
}
|
|
1027
1006
|
//#endregion
|
|
1028
1007
|
//#region src/index.ts
|
|
1029
|
-
function
|
|
1030
|
-
e.register("page-header",
|
|
1008
|
+
function tt() {
|
|
1009
|
+
e.register("page-header", ye, {
|
|
1031
1010
|
namespace: "layout",
|
|
1032
1011
|
label: "Page Header",
|
|
1033
1012
|
category: "Layout",
|
|
@@ -1038,17 +1017,17 @@ function rt() {
|
|
|
1038
1017
|
name: "description",
|
|
1039
1018
|
type: "string"
|
|
1040
1019
|
}]
|
|
1041
|
-
}), e.register("page:card",
|
|
1020
|
+
}), e.register("page:card", Te, {
|
|
1042
1021
|
namespace: "layout",
|
|
1043
1022
|
skipFallback: !0,
|
|
1044
1023
|
label: "Page Card",
|
|
1045
1024
|
category: "Layout",
|
|
1046
1025
|
isContainer: !0
|
|
1047
|
-
}), e.register("app-shell",
|
|
1026
|
+
}), e.register("app-shell", G, {
|
|
1048
1027
|
namespace: "layout",
|
|
1049
1028
|
label: "App Shell",
|
|
1050
1029
|
category: "Layout"
|
|
1051
|
-
}), e.register("responsive-grid",
|
|
1030
|
+
}), e.register("responsive-grid", ke, {
|
|
1052
1031
|
namespace: "layout",
|
|
1053
1032
|
label: "Responsive Grid",
|
|
1054
1033
|
category: "Layout",
|
|
@@ -1093,7 +1072,7 @@ function rt() {
|
|
|
1093
1072
|
});
|
|
1094
1073
|
}
|
|
1095
1074
|
try {
|
|
1096
|
-
|
|
1075
|
+
tt();
|
|
1097
1076
|
} catch {}
|
|
1098
1077
|
//#endregion
|
|
1099
|
-
export { Ze as AppSchemaRenderer,
|
|
1078
|
+
export { Ze as AppSchemaRenderer, G as AppShell, $ as NavigationRenderer, Te as PageCard, ye as PageHeader, ke as ResponsiveGrid, et as SidebarNav, Z as filterNavigationItems, tt as registerLayout, We as resolveActiveNavItem, Y as resolveHref, K as resolveIcon, q as resolveLabel, we 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,rightRail:c}){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})}),c]})]})}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;let c=e=>!!e&&s.trim().toLowerCase()!==e.trim().toLowerCase();if(e.type===`object`&&e.objectName){if(e.viewName)return c(e.viewName)?s:a?a(e.objectName,e.viewName,s):s;if(c(e.objectName))return s;if(t)return t(e.objectName,s)}if(e.type===`dashboard`&&e.dashboardName){if(c(e.dashboardName))return s;if(r)return r(e.dashboardName,s)}if(e.type===`group`&&e.id){if(c(e.id))return s;if(i)return i(e.id,s)}return o&&e.id&&!c(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}}}let a=e.filters;if(a&&typeof a==`object`&&!Array.isArray(a)){let e=new URLSearchParams;for(let[t,r]of Object.entries(a)){if(r==null||t===``)continue;let i=B(String(r),n);i!==null&&e.set(`filter[${t}]`,i)}let t=e.toString();return{href:t?`${r}/data?${t}`:`${r}/data`,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}}}var ee=50,te=40,ne=30,H=25,U=10,W=5;function re(e){let t=new Map;return new URLSearchParams(e).forEach((e,n)=>{let r=/^filter\[(.+)\]$/.exec(n);r&&r[1]&&e!==``&&t.set(r[1],e)}),t}function G(e,t){return t.startsWith(`${e}.`)?t.slice(e.length+1):t}function ie(e,t,n,r,i){let{href:a,external:o}=V(e,r,i);if(o||a===`#`)return 0;if(e.type===`object`&&e.objectName){let a=`${r}/${e.objectName}`;if(t!==a&&!t.startsWith(`${a}/`))return 0;let o=t===a?[]:t.slice(a.length+1).split(`/`),s=e.recordId;if(s){let e=B(s,i);if(e)return o[0]===`record`&&decodeURIComponent(o[1]??``)===e?ee:0}let c=e.filters;if(c&&typeof c==`object`&&!Array.isArray(c)){if(o[0]!==`data`)return 0;let e=new Map;for(let[t,n]of Object.entries(c)){if(n==null||t===``)continue;let r=B(String(n),i);r!==null&&e.set(t,r)}if(e.size!==n.size)return 0;for(let[t,r]of e)if(n.get(t)!==r)return 0;return te}return e.viewName?o[0]!==`view`||!o[1]?0:G(e.objectName,decodeURIComponent(o[1]))===G(e.objectName,e.viewName)?ne:0:o.length===0?H:U}let s=a.split(`?`)[0];if(t===s)return H;let c=e.componentRef;return c&&c.split(`:`)[1]===`directory`?0:t.startsWith(`${s}/`)?W:0}function K(e,t,n,r,i){let a=re(n),o=null,s=0,c=e=>{if(e)for(let n of e){if(n.type===`group`){c(n.children);continue}let e=ie(n,t,a,r,i);e>s&&(o=n,s=e)}};return c(e),o}var q=n.default.createContext(null);function J(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=J(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 ae=5;function oe({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)(Y,{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 Y({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,r.useIsMobile)(),S=x?`min-h-[44px] text-[15px] gap-3 rounded-xl`:void 0,C=(0,r.cn)(`shrink-0`,x?`h-5 w-5`:`h-4 w-4`),w=(()=>{let t=e.expanded;if(typeof t==`boolean`)return t;if(typeof e.defaultOpen==`boolean`)return e.defaultOpen})(),T=e.type===`group`?e.children?.length??0:0,E=n.default.useContext(q),[D,O]=(0,n.useState)(n.default.useMemo(()=>{if(e.type!==`group`||!E)return!1;let t=e=>!!e?.some(e=>e.id===E||e.type===`group`&&t(e.children));return t(e.children)},[e,E])?!0:w??!(T>=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`,x&&`min-h-[44px] text-[15px] rounded-xl`),children:[s,(0,o.jsx)(i.ChevronRight,{className:(0,r.cn)(`ml-auto transition-transform`,x?`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)(Y,{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:S,children:[(0,o.jsx)(n,{className:C}),(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=E!==null&&e.id===E,R=F(e,m,y,h,g,_,v),z=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(j,{className:C}),(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:S,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 X({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:u=L,checkCapability:d=R,onAction:f,searchQuery:p,enablePinning:m,onPinToggle:h,enableReorder:g,onReorder:_,resolveObjectLabel:v,resolveDashboardLabel:y,resolveGroupLabel:b,resolveViewLabel:x,resolveItemLabel:S,t:C,templateContext:w}){let T=(0,s.useLocation)(),E=(0,n.useMemo)(()=>K(e,T.pathname,T.search,t,w)?.id??null,[e,T.pathname,T.search,t,w]),D=(0,n.useMemo)(()=>p?J(e,p):e,[e,p]),O=(0,n.useMemo)(()=>Z(D),[D]),k=D.slice().sort((e,t)=>(e.order??0)-(t.order??0)),A=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:ae}}),(0,c.useSensor)(c.KeyboardSensor)),j=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!_)return;let r=k.findIndex(e=>e.id===t.id),i=k.findIndex(e=>e.id===n.id);r===-1||i===-1||_((0,l.arrayMove)(k,r,i).map((e,t)=>({...e,order:t})))},M={basePath:t,evalVis:a,checkPerm:u,checkCap:d,onAction:f,enablePinning:m,onPinToggle:h,resolveObjectLabel:v,resolveDashboardLabel:y,resolveGroupLabel:b,resolveViewLabel:x,resolveItemLabel:S,t:C,templateContext:w},N=k.some(e=>e.type===`group`),P=O.length>0&&m?(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`}),C?C(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:O.map(e=>(0,o.jsx)(Y,{item:e,...M},`fav-${e.id}`))})})]}):null;if(!N){let e=k.filter(e=>e.type!==`group`).map(e=>e.id),t=g?(0,o.jsx)(c.DndContext,{sensors:A,collisionDetection:c.closestCenter,onDragEnd:j,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:k.map(e=>(0,o.jsx)(oe,{item:e,enableReorder:g,...M},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:k.map(e=>(0,o.jsx)(Y,{item:e,...M},e.id))});return(0,o.jsxs)(q.Provider,{value:E,children:[P,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:t})})]})}let F=[],z=[],B=e=>{if(z.length===0)return;let t=z;z=[],F.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)(Y,{item:e,...M},e.id))})})},e))};return k.forEach((e,t)=>{e.type===`group`?(B(`leaf-${t}`),F.push((0,o.jsx)(Y,{item:e,...M},e.id))):z.push(e)}),B(`leaf-end`),(0,o.jsxs)(q.Provider,{value:E,children:[P,F]})}function Z(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...Z(n.children));return t}function se({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 ce({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 le({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)(se,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(X,{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)(le,{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)(ce,{items:M,basePath:t})]})}var ue=e=>e?Array.isArray(e)?e:[e]:[];function de({schema:e,className:t,style:n,id:i,...s}){let c=ue(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 fe(e){return`items`in e&&!(`href`in e)}function pe({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 me({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?[]:fe(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)(pe,{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`,X,{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=X,e.Page=de,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=me,e.filterNavigationItems=J,e.registerLayout=$,e.resolveActiveNavItem=K,e.resolveHref=V,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,rightRail:c}){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})}),c]})]})}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;let c=e=>!!e&&s.trim().toLowerCase()!==e.trim().toLowerCase();if(e.type===`object`&&e.objectName){if(e.viewName)return c(e.viewName)?s:a?a(e.objectName,e.viewName,s):s;if(c(e.objectName))return s;if(t)return t(e.objectName,s)}if(e.type===`dashboard`&&e.dashboardName){if(c(e.dashboardName))return s;if(r)return r(e.dashboardName,s)}if(e.type===`group`&&e.id){if(c(e.id))return s;if(i)return i(e.id,s)}return o&&e.id&&!c(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}}}let a=e.filters;if(a&&typeof a==`object`&&!Array.isArray(a)){let e=new URLSearchParams;for(let[t,r]of Object.entries(a)){if(r==null||t===``)continue;let i=B(String(r),n);i!==null&&e.set(`filter[${t}]`,i)}let t=e.toString();return{href:t?`${r}/data?${t}`:`${r}/data`,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}}}var H=50,U=40,ee=30,W=25,te=10,ne=5;function re(e){let t=new Map;return new URLSearchParams(e).forEach((e,n)=>{let r=/^filter\[(.+)\]$/.exec(n);r&&r[1]&&e!==``&&t.set(r[1],e)}),t}function G(e,t){return t.startsWith(`${e}.`)?t.slice(e.length+1):t}function ie(e,t,n,r,i){let{href:a,external:o}=V(e,r,i);if(o||a===`#`)return 0;if(e.type===`object`&&e.objectName){let a=`${r}/${e.objectName}`;if(t!==a&&!t.startsWith(`${a}/`))return 0;let o=t===a?[]:t.slice(a.length+1).split(`/`),s=e.recordId;if(s){let e=B(s,i);if(e)return o[0]===`record`&&decodeURIComponent(o[1]??``)===e?H:0}let c=e.filters;if(c&&typeof c==`object`&&!Array.isArray(c)){if(o[0]!==`data`)return 0;let e=new Map;for(let[t,n]of Object.entries(c)){if(n==null||t===``)continue;let r=B(String(n),i);r!==null&&e.set(t,r)}if(e.size!==n.size)return 0;for(let[t,r]of e)if(n.get(t)!==r)return 0;return U}return e.viewName?o[0]!==`view`||!o[1]?0:G(e.objectName,decodeURIComponent(o[1]))===G(e.objectName,e.viewName)?ee:0:o.length===0?W:te}let s=a.split(`?`)[0];if(t===s)return W;let c=e.componentRef;return c&&c.split(`:`)[1]===`directory`?0:t.startsWith(`${s}/`)?ne:0}function K(e,t,n,r,i){let a=re(n),o=null,s=0,c=e=>{if(e)for(let n of e){if(n.type===`group`){c(n.children);continue}let e=ie(n,t,a,r,i);e>s&&(o=n,s=e)}};return c(e),o}var q=n.default.createContext(null);function J(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=J(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 ae=5;function oe({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)(Y,{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 Y({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,r.useIsMobile)(),S=x?`min-h-[44px] text-[15px] gap-3 rounded-xl`:void 0,C=(0,r.cn)(`shrink-0`,x?`h-5 w-5`:`h-4 w-4`),w=(()=>{if(typeof e.expanded==`boolean`)return e.expanded;if(typeof e.defaultOpen==`boolean`)return e.defaultOpen})(),T=e.type===`group`?e.children?.length??0:0,E=n.default.useContext(q),[D,O]=(0,n.useState)(n.default.useMemo(()=>{if(e.type!==`group`||!E)return!1;let t=e=>!!e?.some(e=>e.id===E||e.type===`group`&&t(e.children));return t(e.children)},[e,E])?!0:w??!(T>=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`,x&&`min-h-[44px] text-[15px] rounded-xl`),children:[s,(0,o.jsx)(i.ChevronRight,{className:(0,r.cn)(`ml-auto transition-transform`,x?`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)(Y,{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`){if(!u)return null;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:S,children:[(0,o.jsx)(n,{className:C}),(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=E!==null&&e.id===E,R=F(e,m,y,h,g,_,v),z=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(j,{className:C}),(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:S,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 X({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:u=L,checkCapability:d=R,onAction:f,searchQuery:p,enablePinning:m,onPinToggle:h,enableReorder:g,onReorder:_,resolveObjectLabel:v,resolveDashboardLabel:y,resolveGroupLabel:b,resolveViewLabel:x,resolveItemLabel:S,t:C,templateContext:w}){let T=(0,s.useLocation)(),E=(0,n.useMemo)(()=>K(e,T.pathname,T.search,t,w)?.id??null,[e,T.pathname,T.search,t,w]),D=(0,n.useMemo)(()=>p?J(e,p):e,[e,p]),O=(0,n.useMemo)(()=>Z(D),[D]),k=D.slice().sort((e,t)=>(e.order??0)-(t.order??0)),A=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:ae}}),(0,c.useSensor)(c.KeyboardSensor)),j=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!_)return;let r=k.findIndex(e=>e.id===t.id),i=k.findIndex(e=>e.id===n.id);r===-1||i===-1||_((0,l.arrayMove)(k,r,i).map((e,t)=>({...e,order:t})))},M={basePath:t,evalVis:a,checkPerm:u,checkCap:d,onAction:f,enablePinning:m,onPinToggle:h,resolveObjectLabel:v,resolveDashboardLabel:y,resolveGroupLabel:b,resolveViewLabel:x,resolveItemLabel:S,t:C,templateContext:w},N=k.some(e=>e.type===`group`),P=O.length>0&&m?(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`}),C?C(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:O.map(e=>(0,o.jsx)(Y,{item:e,...M},`fav-${e.id}`))})})]}):null;if(!N){let e=k.filter(e=>e.type!==`group`).map(e=>e.id),t=g?(0,o.jsx)(c.DndContext,{sensors:A,collisionDetection:c.closestCenter,onDragEnd:j,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:k.map(e=>(0,o.jsx)(oe,{item:e,enableReorder:g,...M},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:k.map(e=>(0,o.jsx)(Y,{item:e,...M},e.id))});return(0,o.jsxs)(q.Provider,{value:E,children:[P,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:t})})]})}let F=[],z=[],B=e=>{if(z.length===0)return;let t=z;z=[],F.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)(Y,{item:e,...M},e.id))})})},e))};return k.forEach((e,t)=>{e.type===`group`?(B(`leaf-${t}`),F.push((0,o.jsx)(Y,{item:e,...M},e.id))):z.push(e)}),B(`leaf-end`),(0,o.jsxs)(q.Provider,{value:E,children:[P,F]})}function Z(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...Z(n.children));return t}function se({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 ce({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 le({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)(se,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(X,{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)(le,{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)(ce,{items:M,basePath:t})]})}function ue(e){return`items`in e&&!(`href`in e)}function de({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 fe({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?[]:ue(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)(de,{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`,X,{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=X,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=fe,e.filterNavigationItems=J,e.registerLayout=$,e.resolveActiveNavItem=K,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": "17.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.umd.cjs",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"@dnd-kit/utilities": "^3.2.2",
|
|
20
20
|
"clsx": "^2.1.1",
|
|
21
21
|
"lucide-react": "^1.25.0",
|
|
22
|
-
"react": "19.2.
|
|
23
|
-
"react-dom": "19.2.
|
|
22
|
+
"react": "19.2.8",
|
|
23
|
+
"react-dom": "19.2.8",
|
|
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": "17.2.0",
|
|
26
|
+
"@object-ui/core": "17.2.0",
|
|
27
|
+
"@object-ui/react": "17.2.0",
|
|
28
|
+
"@object-ui/types": "17.2.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -33,12 +33,14 @@
|
|
|
33
33
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@
|
|
36
|
+
"@objectstack/spec": "^17.0.0-rc.1",
|
|
37
|
+
"@vitejs/plugin-react": "^6.0.4",
|
|
37
38
|
"react-router-dom": "^7.18.1",
|
|
38
39
|
"vite": "^8.1.5",
|
|
39
|
-
"vite-plugin-dts": "^5.0.3"
|
|
40
|
+
"vite-plugin-dts": "^5.0.3",
|
|
41
|
+
"vitest": "^4.1.10"
|
|
40
42
|
},
|
|
41
|
-
"description": "Layout components for Object UI — AppShell,
|
|
43
|
+
"description": "Layout components for Object UI — AppShell, PageHeader, SidebarNav and responsive containers with React Router integration",
|
|
42
44
|
"keywords": [
|
|
43
45
|
"objectui",
|
|
44
46
|
"sdui",
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
],
|
|
76
78
|
"scripts": {
|
|
77
79
|
"build": "vite build",
|
|
80
|
+
"type-check": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
78
81
|
"lint": "eslint ."
|
|
79
82
|
}
|
|
80
83
|
}
|
package/dist/Page.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { PageSchema } from '@object-ui/types';
|
|
3
|
-
export declare function Page({ schema, className, style, id, ...props }: {
|
|
4
|
-
schema: PageSchema;
|
|
5
|
-
className?: string;
|
|
6
|
-
style?: React.CSSProperties;
|
|
7
|
-
id?: string;
|
|
8
|
-
} & any): React.JSX.Element;
|