@ojiepermana/angular 22.2.4 → 22.2.6

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.
Files changed (19) hide show
  1. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs +234 -0
  2. package/fesm2022/{ojiepermana-angular-navigation-navigation-dockbar-menu.component-DC8rfxS5.mjs → ojiepermana-angular-navigation-navigation-dockbar-menu.component-UrcWBqBk.mjs} +25 -38
  3. package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-meQb_EWZ.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-1WiRlut1.mjs} +44 -20
  4. package/fesm2022/{ojiepermana-angular-navigation-navigation-flyout-menu.component-DRdw2G-c.mjs → ojiepermana-angular-navigation-navigation-flyout-menu.component-dAVUnvwq.mjs} +23 -4
  5. package/fesm2022/{ojiepermana-angular-navigation-navigation-horizontal.component-Bx1NcrWO.mjs → ojiepermana-angular-navigation-navigation-horizontal.component-OD_cAkg8.mjs} +31 -4
  6. package/fesm2022/{ojiepermana-angular-navigation-navigation-item.component-ERZNpmTZ.mjs → ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs} +402 -108
  7. package/fesm2022/{ojiepermana-angular-navigation-navigation-list.component-D-oOKwHg.mjs → ojiepermana-angular-navigation-navigation-list.component-DefF7_rB.mjs} +20 -1
  8. package/fesm2022/ojiepermana-angular-navigation.mjs +95 -19
  9. package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +48 -2
  10. package/fesm2022/ojiepermana-angular-theme-page-root.mjs +1 -0
  11. package/fesm2022/ojiepermana-angular-theme-shell.mjs +1 -0
  12. package/navigation/README.md +148 -3
  13. package/package.json +2 -2
  14. package/theme/styles/css/base/components.css +20 -0
  15. package/theme/styles/css/base/tokens.css +6 -0
  16. package/types/ojiepermana-angular-navigation-types.d.ts +3 -3
  17. package/types/ojiepermana-angular-navigation.d.ts +17 -0
  18. package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +16 -2
  19. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-4RIokl1C.mjs +0 -129
@@ -0,0 +1,234 @@
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DestroyRef, InjectionToken, computed, effect, inject, input, signal, untracked } from "@angular/core";
3
+ import { cn } from "@ojiepermana/angular/component/utils/core";
4
+ import { Subscription, catchError, isObservable, of, shareReplay } from "rxjs";
5
+ import { formatNavigationBadgeCount } from "@ojiepermana/angular/navigation/types";
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __exportAll = (all, no_symbols) => {
11
+ let target = {};
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ return target;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
26
+ }
27
+ return to;
28
+ };
29
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
30
+ const NAVIGATION_BADGE_STREAMS = new InjectionToken("NavigationBadgeStreams");
31
+ function normalizeNavigationBadgeCount(value) {
32
+ return value === null || value === void 0 || !Number.isFinite(value) ? 0 : Math.max(Math.trunc(value), 0);
33
+ }
34
+ function injectNavigationBadgeTotal(sources) {
35
+ const shared = inject(NAVIGATION_BADGE_STREAMS, { optional: true });
36
+ const snapshots = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "snapshots" }] : /* istanbul ignore next */ []);
37
+ const subscriptions = /* @__PURE__ */ new Map();
38
+ effect(() => {
39
+ const streams = new Set(sources().map((source) => source.value).filter((value) => isObservable(value)));
40
+ untracked(() => {
41
+ for (const [stream, subscription] of subscriptions) if (!streams.has(stream)) {
42
+ subscription.unsubscribe();
43
+ subscriptions.delete(stream);
44
+ snapshots.update((previous) => {
45
+ const next = new Map(previous);
46
+ next.delete(stream);
47
+ return next;
48
+ });
49
+ }
50
+ for (const stream of streams) {
51
+ if (subscriptions.has(stream)) continue;
52
+ let resolved = shared?.get(stream);
53
+ if (!resolved) {
54
+ resolved = {
55
+ value: stream.pipe(catchError(() => of(null)), shareReplay({
56
+ bufferSize: 1,
57
+ refCount: true
58
+ })),
59
+ references: 0
60
+ };
61
+ shared?.set(stream, resolved);
62
+ }
63
+ const entry = resolved;
64
+ entry.references++;
65
+ const subscription = new Subscription(() => {
66
+ entry.references--;
67
+ if (entry.references === 0) shared?.delete(stream);
68
+ });
69
+ subscription.add(entry.value.subscribe((value) => {
70
+ snapshots.update((previous) => new Map(previous).set(stream, value));
71
+ }));
72
+ subscriptions.set(stream, subscription);
73
+ }
74
+ });
75
+ });
76
+ inject(DestroyRef).onDestroy(() => {
77
+ for (const subscription of subscriptions.values()) subscription.unsubscribe();
78
+ });
79
+ return () => sources().reduce((total, source) => {
80
+ const value = source.value;
81
+ return total + normalizeNavigationBadgeCount(isObservable(value) ? snapshots().get(value) : typeof value === "function" ? value() : value);
82
+ }, 0);
83
+ }
84
+ function navigationBadgeSourceKeys(items) {
85
+ const keys = /* @__PURE__ */ new Set();
86
+ const visit = (entries) => {
87
+ for (const item of entries) {
88
+ if (item.type === "divider" || item.type === "spacer") continue;
89
+ if (item.badge?.source) keys.add(item.badge.source);
90
+ visit(item.children);
91
+ }
92
+ };
93
+ visit(items);
94
+ return keys;
95
+ }
96
+ function hasNavigationCountBadge(item) {
97
+ return !!item.badge?.source || !item.badge?.title && navigationBadgeSourceKeys(item.children).size > 0;
98
+ }
99
+ function navigationDescendantBadgeSources(badge, children, context) {
100
+ if (badge?.source || badge?.title) return [];
101
+ return [...navigationBadgeSourceKeys(children)].filter((key) => Object.hasOwn(context, key) && context[key] != null).map((key) => context[key]);
102
+ }
103
+ var navigation_badge_count_component_exports = /* @__PURE__ */ __exportAll({ NavigationBadgeCountComponent: () => NavigationBadgeCountComponent });
104
+ var NavigationBadgeCountComponent = class NavigationBadgeCountComponent {
105
+ badge = input(null, ...ngDevMode ? [{ debugName: "badge" }] : /* istanbul ignore next */ []);
106
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
107
+ sources = input(null, ...ngDevMode ? [{ debugName: "sources" }] : /* istanbul ignore next */ []);
108
+ selectedSources = computed(() => {
109
+ const badge = this.badge();
110
+ return this.sources() ?? (badge ? [badge] : []);
111
+ }, ...ngDevMode ? [{ debugName: "selectedSources" }] : /* istanbul ignore next */ []);
112
+ total = injectNavigationBadgeTotal(this.selectedSources);
113
+ resolvedBadge() {
114
+ const count = this.total();
115
+ const display = formatNavigationBadgeCount(count);
116
+ if (display === null) return null;
117
+ const label = this.badge()?.ariaLabel;
118
+ return {
119
+ count,
120
+ display,
121
+ accessibleLabel: (typeof label === "function" ? label(count) : label)?.trim() || `${count} items`
122
+ };
123
+ }
124
+ badgeClasses = computed(() => cn("nav-count pointer-events-none ml-auto inline-flex shrink-0 items-center justify-center self-center rounded-full bg-destructive text-destructive-foreground", this.badge()?.classes, this.class()), ...ngDevMode ? [{ debugName: "badgeClasses" }] : /* istanbul ignore next */ []);
125
+ static ɵfac = i0.ɵɵngDeclareFactory({
126
+ minVersion: "12.0.0",
127
+ version: "22.2.3",
128
+ ngImport: i0,
129
+ type: NavigationBadgeCountComponent,
130
+ deps: [],
131
+ target: i0.ɵɵFactoryTarget.Component
132
+ });
133
+ static ɵcmp = i0.ɵɵngDeclareComponent({
134
+ minVersion: "17.0.0",
135
+ version: "22.2.3",
136
+ type: NavigationBadgeCountComponent,
137
+ isStandalone: true,
138
+ selector: "NavigationBadgeCount",
139
+ inputs: {
140
+ badge: {
141
+ classPropertyName: "badge",
142
+ publicName: "badge",
143
+ isSignal: true,
144
+ isRequired: false,
145
+ transformFunction: null
146
+ },
147
+ class: {
148
+ classPropertyName: "class",
149
+ publicName: "class",
150
+ isSignal: true,
151
+ isRequired: false,
152
+ transformFunction: null
153
+ },
154
+ sources: {
155
+ classPropertyName: "sources",
156
+ publicName: "sources",
157
+ isSignal: true,
158
+ isRequired: false,
159
+ transformFunction: null
160
+ }
161
+ },
162
+ host: { classAttribute: "contents" },
163
+ ngImport: i0,
164
+ template: `
165
+ @if (resolvedBadge(); as resolved) {
166
+ <span
167
+ role="status"
168
+ aria-atomic="true"
169
+ data-navigation-badge="true"
170
+ [attr.data-navigation-badge-count]="resolved.count"
171
+ [attr.aria-label]="resolved.accessibleLabel"
172
+ [class]="badgeClasses()"
173
+ >
174
+ {{ resolved.display }}
175
+ </span>
176
+ }
177
+ `,
178
+ isInline: true
179
+ });
180
+ };
181
+ i0.ɵɵngDeclareClassMetadata({
182
+ minVersion: "12.0.0",
183
+ version: "22.2.3",
184
+ ngImport: i0,
185
+ type: NavigationBadgeCountComponent,
186
+ decorators: [{
187
+ type: Component,
188
+ args: [{
189
+ selector: "NavigationBadgeCount",
190
+ host: { class: "contents" },
191
+ template: `
192
+ @if (resolvedBadge(); as resolved) {
193
+ <span
194
+ role="status"
195
+ aria-atomic="true"
196
+ data-navigation-badge="true"
197
+ [attr.data-navigation-badge-count]="resolved.count"
198
+ [attr.aria-label]="resolved.accessibleLabel"
199
+ [class]="badgeClasses()"
200
+ >
201
+ {{ resolved.display }}
202
+ </span>
203
+ }
204
+ `
205
+ }]
206
+ }],
207
+ propDecorators: {
208
+ badge: [{
209
+ type: i0.Input,
210
+ args: [{
211
+ isSignal: true,
212
+ alias: "badge",
213
+ required: false
214
+ }]
215
+ }],
216
+ class: [{
217
+ type: i0.Input,
218
+ args: [{
219
+ isSignal: true,
220
+ alias: "class",
221
+ required: false
222
+ }]
223
+ }],
224
+ sources: [{
225
+ type: i0.Input,
226
+ args: [{
227
+ isSignal: true,
228
+ alias: "sources",
229
+ required: false
230
+ }]
231
+ }]
232
+ }
233
+ });
234
+ export { injectNavigationBadgeTotal as a, __exportAll as c, hasNavigationCountBadge as i, __reExport as l, navigation_badge_count_component_exports as n, navigationBadgeSourceKeys as o, NAVIGATION_BADGE_STREAMS as r, navigationDescendantBadgeSources as s, NavigationBadgeCountComponent as t };
@@ -1,6 +1,6 @@
1
- import { n as NAVIGATION_SHELL, t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-D-oOKwHg.mjs";
2
- import { r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-ERZNpmTZ.mjs";
3
- import { NavigationBadgeCountComponent } from "./ojiepermana-angular-navigation-navigation-badge-count.component-4RIokl1C.mjs";
1
+ import { i as hasNavigationCountBadge } from "./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs";
2
+ import { n as NAVIGATION_SHELL, t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-DefF7_rB.mjs";
3
+ import { r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs";
4
4
  import * as i0 from "@angular/core";
5
5
  import { Component, ElementRef, Injector, afterNextRender, computed, inject, input, output, signal } from "@angular/core";
6
6
  import { cn } from "@ojiepermana/angular/component/utils/core";
@@ -11,6 +11,7 @@ import { IconComponent, provideIcons } from "@ojiepermana/angular/component/icon
11
11
  import { TooltipDirective } from "@ojiepermana/angular/component/tooltip";
12
12
  const EMPTY_NAVIGATION_BADGE_CONTEXT = Object.freeze({});
13
13
  var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
14
+ hasCountBadge = hasNavigationCountBadge;
14
15
  nav = inject(NAVIGATION_ADAPTER);
15
16
  host = inject(ElementRef);
16
17
  injector = inject(Injector);
@@ -125,14 +126,6 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
125
126
  this.focusFirstAsideItem();
126
127
  });
127
128
  }
128
- badgeFor(entry) {
129
- const sourceKey = entry.badge?.source;
130
- if (!sourceKey) return null;
131
- return this.badgeContext()[sourceKey] ?? null;
132
- }
133
- badgeClassesFor(entry) {
134
- return cn("absolute -right-1 -top-1", entry.badge?.classes);
135
- }
136
129
  closeAside() {
137
130
  const openKey = this.openGroup()?.key ?? null;
138
131
  this.nav.closePanel(this.navId());
@@ -320,7 +313,9 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
320
313
  [class]="triggerClasses(entry)"
321
314
  [attr.aria-expanded]="isGroupOpen(entry)"
322
315
  [attr.aria-controls]="asideId()"
323
- [attr.aria-label]="badgeFor(entry) ? null : (entry.tooltip ?? entry.title ?? null)"
316
+ [attr.aria-label]="
317
+ hasCountBadge(entry) ? null : (entry.tooltip ?? entry.title ?? null)
318
+ "
324
319
  [attr.title]="isGroupOpen(entry) ? null : (entry.tooltip ?? entry.title ?? null)"
325
320
  [Tooltip]="entry.tooltip ?? entry.title ?? ''"
326
321
  [TooltipPosition]="tooltipPosition()"
@@ -329,20 +324,15 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
329
324
  [disabled]="entry.disabled || null"
330
325
  (click)="toggleGroup(entry)"
331
326
  >
332
- @if (badgeFor(entry)) {
333
- <span class="sr-only">{{ entry.tooltip ?? entry.title }}</span>
334
- }
335
327
  <NavigationItemContent
336
328
  [item]="entry"
337
329
  [active]="isGroupActive(entry)"
338
330
  [compact]="true"
339
331
  orientation="vertical"
340
332
  [level]="0"
333
+ [badgeContext]="badgeContext()"
341
334
  [iconTemplate]="iconTemplate()"
342
335
  />
343
- @if (badgeFor(entry); as badge) {
344
- <NavigationBadgeCount [badge]="badge" [class]="badgeClassesFor(entry)" />
345
- }
346
336
  </button>
347
337
  </li>
348
338
  } @else {
@@ -356,6 +346,7 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
356
346
  [itemClass]="itemClass()"
357
347
  [activeIds]="activeIds()"
358
348
  [activeUrl]="activeUrl()"
349
+ [badgeContext]="badgeContext()"
359
350
  [iconTemplate]="iconTemplate()"
360
351
  [tooltip-position]="tooltipPosition()"
361
352
  [collapseTree]="collapseTree()"
@@ -380,11 +371,11 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
380
371
  }
381
372
 
382
373
  <!-- Drawer non-modal: rail tetap interaktif di atas backdrop, jadi tanpa aria-modal. -->
383
- <aside
374
+ <div
384
375
  [id]="asideId()"
385
376
  [class]="asideClasses()"
386
377
  data-navigation-dockbar-aside="true"
387
- [attr.role]="isDrawerMode() ? 'dialog' : null"
378
+ [attr.role]="isDrawerMode() ? 'dialog' : 'complementary'"
388
379
  [attr.aria-labelledby]="asideHeadingId()"
389
380
  >
390
381
  <header
@@ -426,6 +417,7 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
426
417
  [itemClass]="itemClass()"
427
418
  [activeIds]="activeIds()"
428
419
  [activeUrl]="activeUrl()"
420
+ [badgeContext]="badgeContext()"
429
421
  [iconTemplate]="iconTemplate()"
430
422
  [collapseTree]="collapseTree()"
431
423
  [openedIds]="openedIds()"
@@ -445,7 +437,7 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
445
437
  />
446
438
  </footer>
447
439
  }
448
- </aside>
440
+ </div>
449
441
  }
450
442
  `,
451
443
  isInline: true,
@@ -462,17 +454,12 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
462
454
  "label"
463
455
  ]
464
456
  },
465
- {
466
- kind: "component",
467
- type: NavigationBadgeCountComponent,
468
- selector: "NavigationBadgeCount",
469
- inputs: ["badge", "class"]
470
- },
471
457
  {
472
458
  kind: "component",
473
459
  type: NavigationItemComponent,
474
460
  selector: "li[NavigationItem]",
475
461
  inputs: [
462
+ "badgeContext",
476
463
  "navId",
477
464
  "item",
478
465
  "level",
@@ -498,6 +485,7 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
498
485
  type: NavigationItemContentComponent,
499
486
  selector: "NavigationItemContent",
500
487
  inputs: [
488
+ "badgeContext",
501
489
  "item",
502
490
  "active",
503
491
  "compact",
@@ -511,6 +499,7 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
511
499
  type: NavigationListComponent,
512
500
  selector: "NavigationList",
513
501
  inputs: [
502
+ "badgeContext",
514
503
  "navId",
515
504
  "items",
516
505
  "collapsed",
@@ -563,7 +552,6 @@ i0.ɵɵngDeclareClassMetadata({
563
552
  selector: "NavigationDockbarMenu",
564
553
  imports: [
565
554
  IconComponent,
566
- NavigationBadgeCountComponent,
567
555
  NavigationItemComponent,
568
556
  NavigationItemContentComponent,
569
557
  NavigationListComponent,
@@ -591,7 +579,9 @@ i0.ɵɵngDeclareClassMetadata({
591
579
  [class]="triggerClasses(entry)"
592
580
  [attr.aria-expanded]="isGroupOpen(entry)"
593
581
  [attr.aria-controls]="asideId()"
594
- [attr.aria-label]="badgeFor(entry) ? null : (entry.tooltip ?? entry.title ?? null)"
582
+ [attr.aria-label]="
583
+ hasCountBadge(entry) ? null : (entry.tooltip ?? entry.title ?? null)
584
+ "
595
585
  [attr.title]="isGroupOpen(entry) ? null : (entry.tooltip ?? entry.title ?? null)"
596
586
  [Tooltip]="entry.tooltip ?? entry.title ?? ''"
597
587
  [TooltipPosition]="tooltipPosition()"
@@ -600,20 +590,15 @@ i0.ɵɵngDeclareClassMetadata({
600
590
  [disabled]="entry.disabled || null"
601
591
  (click)="toggleGroup(entry)"
602
592
  >
603
- @if (badgeFor(entry)) {
604
- <span class="sr-only">{{ entry.tooltip ?? entry.title }}</span>
605
- }
606
593
  <NavigationItemContent
607
594
  [item]="entry"
608
595
  [active]="isGroupActive(entry)"
609
596
  [compact]="true"
610
597
  orientation="vertical"
611
598
  [level]="0"
599
+ [badgeContext]="badgeContext()"
612
600
  [iconTemplate]="iconTemplate()"
613
601
  />
614
- @if (badgeFor(entry); as badge) {
615
- <NavigationBadgeCount [badge]="badge" [class]="badgeClassesFor(entry)" />
616
- }
617
602
  </button>
618
603
  </li>
619
604
  } @else {
@@ -627,6 +612,7 @@ i0.ɵɵngDeclareClassMetadata({
627
612
  [itemClass]="itemClass()"
628
613
  [activeIds]="activeIds()"
629
614
  [activeUrl]="activeUrl()"
615
+ [badgeContext]="badgeContext()"
630
616
  [iconTemplate]="iconTemplate()"
631
617
  [tooltip-position]="tooltipPosition()"
632
618
  [collapseTree]="collapseTree()"
@@ -651,11 +637,11 @@ i0.ɵɵngDeclareClassMetadata({
651
637
  }
652
638
 
653
639
  <!-- Drawer non-modal: rail tetap interaktif di atas backdrop, jadi tanpa aria-modal. -->
654
- <aside
640
+ <div
655
641
  [id]="asideId()"
656
642
  [class]="asideClasses()"
657
643
  data-navigation-dockbar-aside="true"
658
- [attr.role]="isDrawerMode() ? 'dialog' : null"
644
+ [attr.role]="isDrawerMode() ? 'dialog' : 'complementary'"
659
645
  [attr.aria-labelledby]="asideHeadingId()"
660
646
  >
661
647
  <header
@@ -697,6 +683,7 @@ i0.ɵɵngDeclareClassMetadata({
697
683
  [itemClass]="itemClass()"
698
684
  [activeIds]="activeIds()"
699
685
  [activeUrl]="activeUrl()"
686
+ [badgeContext]="badgeContext()"
700
687
  [iconTemplate]="iconTemplate()"
701
688
  [collapseTree]="collapseTree()"
702
689
  [openedIds]="openedIds()"
@@ -716,7 +703,7 @@ i0.ɵɵngDeclareClassMetadata({
716
703
  />
717
704
  </footer>
718
705
  }
719
- </aside>
706
+ </div>
720
707
  }
721
708
  `
722
709
  }]
@@ -1,4 +1,4 @@
1
- import { n as navigationPanelId, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-ERZNpmTZ.mjs";
1
+ import { i as NavigationItemBadgeComponent, n as navigationPanelId, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs";
2
2
  import * as i0 from "@angular/core";
3
3
  import { Component, computed, inject, input, output, signal } from "@angular/core";
4
4
  import { ActivatedRoute, Router, RouterLink } from "@angular/router";
@@ -12,6 +12,7 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
12
12
  routeContext = inject(NAVIGATION_ROUTE_CONTEXT_ADAPTER);
13
13
  router = inject(Router, { optional: true });
14
14
  activatedRoute = inject(ActivatedRoute, { optional: true });
15
+ badgeContext = input({}, ...ngDevMode ? [{ debugName: "badgeContext" }] : /* istanbul ignore next */ []);
15
16
  navId = input("default", ...ngDevMode ? [{ debugName: "navId" }] : /* istanbul ignore next */ []);
16
17
  branch = input.required(...ngDevMode ? [{ debugName: "branch" }] : /* istanbul ignore next */ []);
17
18
  typeStyle = input("flat", ...ngDevMode ? [{ debugName: "typeStyle" }] : /* istanbul ignore next */ []);
@@ -132,6 +133,13 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
132
133
  isStandalone: true,
133
134
  selector: "NavigationEntryGrid",
134
135
  inputs: {
136
+ badgeContext: {
137
+ classPropertyName: "badgeContext",
138
+ publicName: "badgeContext",
139
+ isSignal: true,
140
+ isRequired: false,
141
+ transformFunction: null
142
+ },
135
143
  navId: {
136
144
  classPropertyName: "navId",
137
145
  publicName: "navId",
@@ -261,6 +269,7 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
261
269
  [itemClass]="navItemClass()"
262
270
  [activeIds]="activeIds()"
263
271
  [activeUrl]="activeUrl()"
272
+ [badgeContext]="badgeContext()"
264
273
  [iconTemplate]="iconTemplate()"
265
274
  [collapseTree]="collapseTree()"
266
275
  [openedIds]="openedIds()"
@@ -402,15 +411,11 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
402
411
  }
403
412
  </span>
404
413
 
405
- @if (child.badge?.title; as badgeTitle) {
406
- <span
407
- [class]="
408
- child.badge?.classes ??
409
- 'nav-badge inline-flex h-5 shrink-0 items-center self-center rounded-full bg-muted px-2 text-muted-foreground'
410
- "
411
- >{{ badgeTitle }}</span
412
- >
413
- }
414
+ <NavigationItemBadge
415
+ [children]="child.children"
416
+ [itemBadge]="child.badge"
417
+ [badgeContext]="badgeContext()"
418
+ />
414
419
  </ng-template>
415
420
  `,
416
421
  isInline: true,
@@ -461,6 +466,7 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
461
466
  type: NavigationItemComponent,
462
467
  selector: "li[NavigationItem]",
463
468
  inputs: [
469
+ "badgeContext",
464
470
  "navId",
465
471
  "item",
466
472
  "level",
@@ -480,6 +486,18 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
480
486
  "openedIds"
481
487
  ],
482
488
  outputs: ["openedIdsChange", "itemSelected"]
489
+ },
490
+ {
491
+ kind: "component",
492
+ type: NavigationItemBadgeComponent,
493
+ selector: "NavigationItemBadge",
494
+ inputs: [
495
+ "staticClass",
496
+ "compact",
497
+ "itemBadge",
498
+ "badgeContext",
499
+ "children"
500
+ ]
483
501
  }
484
502
  ]
485
503
  });
@@ -497,7 +515,8 @@ i0.ɵɵngDeclareClassMetadata({
497
515
  NgTemplateOutlet,
498
516
  RouterLink,
499
517
  IconComponent,
500
- NavigationItemComponent
518
+ NavigationItemComponent,
519
+ NavigationItemBadgeComponent
501
520
  ],
502
521
  providers: [provideIcons(LucideChevronRight)],
503
522
  host: { class: "contents" },
@@ -559,6 +578,7 @@ i0.ɵɵngDeclareClassMetadata({
559
578
  [itemClass]="navItemClass()"
560
579
  [activeIds]="activeIds()"
561
580
  [activeUrl]="activeUrl()"
581
+ [badgeContext]="badgeContext()"
562
582
  [iconTemplate]="iconTemplate()"
563
583
  [collapseTree]="collapseTree()"
564
584
  [openedIds]="openedIds()"
@@ -700,20 +720,24 @@ i0.ɵɵngDeclareClassMetadata({
700
720
  }
701
721
  </span>
702
722
 
703
- @if (child.badge?.title; as badgeTitle) {
704
- <span
705
- [class]="
706
- child.badge?.classes ??
707
- 'nav-badge inline-flex h-5 shrink-0 items-center self-center rounded-full bg-muted px-2 text-muted-foreground'
708
- "
709
- >{{ badgeTitle }}</span
710
- >
711
- }
723
+ <NavigationItemBadge
724
+ [children]="child.children"
725
+ [itemBadge]="child.badge"
726
+ [badgeContext]="badgeContext()"
727
+ />
712
728
  </ng-template>
713
729
  `
714
730
  }]
715
731
  }],
716
732
  propDecorators: {
733
+ badgeContext: [{
734
+ type: i0.Input,
735
+ args: [{
736
+ isSignal: true,
737
+ alias: "badgeContext",
738
+ required: false
739
+ }]
740
+ }],
717
741
  navId: [{
718
742
  type: i0.Input,
719
743
  args: [{