@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
@@ -60,8 +60,9 @@ Type dipilih lewat komponen anak deklaratif (`NavigationSidebar`, `NavigationDoc
60
60
  - `dockbar-route-context` on `NavigationDockbar` opts into Router-aware header, rail deduplication,
61
61
  and sticky-panel restore behavior. Pass `true` for the default Angular Router adapter or a
62
62
  `NavigationDockbarRouteConfig` to override URL, metadata, or the fallback icon.
63
- - `dockbar-badge` on `NavigationDockbar` accepts a generic badge registry keyed by
64
- `NavigationItem.badge.source` or route `data.navigationBadge`.
63
+ - `badge-context` on `Navigation` supplies one reactive badge registry for every navigation type, keyed by
64
+ `NavigationItem.badge.source` (and route `data.navigationBadge` for the dockbar header).
65
+ `NavigationDockbar` also accepts `badge-context`; its legacy `dockbar-badge` input remains supported.
65
66
  - `ariaLabel` overrides the host navigation label and defaults to `Primary navigation`.
66
67
  - `label` on `NavigationFlyout` sets the single trigger label and defaults to `Menu`.
67
68
  - `icon` on `NavigationFlyout` renders a Lucide icon on the trigger (the name must be registered with `provideIcons()`); `icon-position` (`start`/`end`) sets its placement and `icon-only` hides the label visually while keeping it as the accessible name (compact mode is always icon-only and falls back to the `menu` icon).
@@ -91,6 +92,8 @@ Type dipilih lewat komponen anak deklaratif (`NavigationSidebar`, `NavigationDoc
91
92
 
92
93
  Inputs pada `<Navigation>` (container):
93
94
 
95
+ `[badge-context]` accepts `NavigationBadgeContext | null` and defaults to the type registry or an empty registry.
96
+
94
97
  | API | Type | Notes |
95
98
  | ----------------- | -------------------------------------------------- | ------------------------------------------------------------------------------- |
96
99
  | `id` | `string` | Navigation instance id. `main` is the only id persisted to `localStorage`. |
@@ -137,7 +140,7 @@ Semua type juga menerima `class` untuk kelas tambahan pada elemen shell-nya.
137
140
  | `title`, `subtitle`, `tooltip` | `string` | Primary labels and optional compact tooltip. |
138
141
  | `active`, `disabled` | `boolean` | Explicit active and disabled flags. |
139
142
  | `icon` | `string` | Rendered through the default icon slot unless overridden. |
140
- | `badge` | `{ title?: string; classes?: string; source?: string }` | Static item label plus an optional dockbar badge-source key. |
143
+ | `badge` | `{ title?: string; classes?: string; source?: string }` | Static item label plus an optional shared badge-source key. |
141
144
  | `classes` | `{ wrapper?, container?, icon?, title?, subtitle? }` | Per-item class overrides. `container` targets the horizontal group `<li>` wrapper. |
142
145
  | `meta` | `Record<string, unknown>` | Consumer-owned metadata bag. |
143
146
  | `isHidden` | `(item) => boolean` | Filters items at normalization time. |
@@ -423,3 +426,145 @@ tetap sama; hanya distribusi chunk di sisi consumer yang lebih ringan.
423
426
  Angular 22.2–22.x CSR/browser usage is supported; SSR, prerendering, and hydration are not. See the
424
427
  bundled `SUPPORT.md`. Report suspected vulnerabilities privately using the instructions in the
425
428
  bundled `SECURITY.md`. This package is MIT licensed; see the bundled `LICENSE`.
429
+
430
+ ## Shared reactive badge counts
431
+
432
+ All navigation types use the same `NavigationBadgeContext`. Bind it to `[badge-context]` on
433
+ `Navigation`. Items only carry a source key, so updating a Signal or Observable does not rebuild
434
+ the navigation tree. The registry belongs to the consumer, with no global or per-type registry.
435
+ The library performs no fetching, polling, authentication, sockets, or business counting.
436
+
437
+ ```ts
438
+ import { signal } from '@angular/core';
439
+ import { BehaviorSubject } from 'rxjs';
440
+ import type { NavigationBadgeContext, NavigationItem } from '@ojiepermana/angular/navigation';
441
+
442
+ // Members of the consumer component:
443
+ readonly taskCount = signal(3);
444
+ readonly reviewCount$ = new BehaviorSubject<number | null>(10);
445
+ readonly navigation: readonly NavigationItem[] = [
446
+ { id: 'tasks', title: 'Tugas', icon: 'circle-check-big', link: '/my/tasks', badge: { source: 'tasks' } },
447
+ { id: 'reviews', title: 'Review', icon: 'file', link: '/my/reviews', badge: { source: 'reviews' } },
448
+ { id: 'guide', title: 'Panduan', link: '/guide', badge: { title: 'New' } },
449
+ ];
450
+ readonly badgeContext: NavigationBadgeContext = {
451
+ tasks: { value: this.taskCount, ariaLabel: count => `${count} tugas` },
452
+ reviews: { value: this.reviewCount$, ariaLabel: count => `${count} review` },
453
+ };
454
+
455
+ // Run these in consumer event handlers after updating consumer data:
456
+ // this.taskCount.set(120);
457
+ // this.reviewCount$.next(99);
458
+ ```
459
+
460
+ ```html
461
+ <Navigation id="main" [data]="navigation" [badge-context]="badgeContext">
462
+ <NavigationSidebar />
463
+ </Navigation>
464
+ ```
465
+
466
+ Replace the type child with `NavigationMinidock`, `NavigationDockbar`, `NavigationNavbar`, or
467
+ `NavigationFlyout` without changing the registry. Minidock still requires flat navigation items;
468
+ use `toMinidockItems()` for a tree. Register icon names with `provideIcons()` as usual. Multiple
469
+ `Navigation` instances can bind the same registry and react together.
470
+
471
+ `NavigationBadgeSource.value` accepts `number | null | undefined`, `Signal`, `Observable`, or a
472
+ zero-argument reader returning that count. Reader functions are evaluated during Angular checks;
473
+ reading signals inside them tracks those signals. A plain external variable needs an Angular change
474
+ notification, so prefer Signal or Observable for asynchronous updates.
475
+
476
+ Finite numeric values are truncated toward zero before display and accessible labeling. Zero,
477
+ negative values, null, undefined, NaN, Infinity, and unknown source keys hide the badge. Values
478
+ 1–99 display their number; values above 99 display `99+`. The `ariaLabel` callback receives the
479
+ normalized, uncapped count. A string can supply a complete accessible label; without a label the
480
+ fallback is `<count> items`. Keep the actual count in consumer labels, including when capped.
481
+ Source keys are resolved as own registry properties. When `source` is present it takes precedence
482
+ over `title`, even when that source is missing or hidden. Text-only `badge.title` remains supported.
483
+
484
+ Observable errors hide the badge. Source replacement unsubscribes the previous Observable and
485
+ never renders its cached count for the replacement. Destroying a badge view unsubscribes it.
486
+ Changing a sidebar between labelled, collapsed, hover, and keyboard preview layouts keeps the same
487
+ badge view and subscription, including the last emission from a non-replaying Observable.
488
+ Within one `Navigation`, badges share one upstream subscription per Observable identity, including
489
+ parent totals and child badges. Sources referenced by the visible normalized navigation tree or
490
+ built-in route header stay subscribed while their data remains available, including while panels
491
+ are closed or an active root moves between rail and header. Unreferenced registry keys are ignored.
492
+ Removing the last data and view reference discards its cached replay, including completed cold
493
+ Observables, so restoring navigation data reads fresh counts. Replacing sources unsubscribes the
494
+ old stream, and destroying the navigation releases all subscriptions. Sources that remain in use
495
+ retain their last emission when another descendant changes. Separate `Navigation` instances have separate lifetimes;
496
+ use `shareReplay({ bufferSize: 1, refCount: true })` in the consumer to share work across instances.
497
+
498
+ Labelled items reserve space at the right for a nonshrinking red pill. Count badges use
499
+ `destructive` / `destructive-foreground`, 20px minimum width and height, 10px type, and 4px inline
500
+ padding at normal density. Collapsed sidebar, minidock, and dockbar rails show a smaller 16px badge
501
+ over the icon corner, without changing the item hit area. A sidebar hover or keyboard preview uses
502
+ the labelled version, with one badge per item. Geometry follows the theme space axis through
503
+ `--nav-count-height`, `--nav-count-compact-height`, `--nav-count-padding`, and `--nav-count-offset`;
504
+ font size uses `--nav-count-font-size`. Static text badges retain their existing styling.
505
+
506
+ ### Parent totals
507
+
508
+ Parents without their own badge automatically sum the unique `badge.source` keys anywhere in their
509
+ visible descendant tree, after `isHidden` filtering. A hidden branch contributes nothing, including
510
+ its children. Missing keys and invalid counts contribute zero. Each count is normalized before
511
+ addition, so negative or fractional invalid values cannot cancel other sources. A total of zero
512
+ hides the badge. A total of 120 displays `99+` with the accessible label `120 items`.
513
+
514
+ ```ts
515
+ readonly taskCount = signal(3);
516
+ readonly reviewCount = signal(5);
517
+ readonly badgeContext: NavigationBadgeContext = {
518
+ tasks: { value: this.taskCount, ariaLabel: count => `${count} tugas` },
519
+ reviews: { value: this.reviewCount }, // Observable and callback readers work here too.
520
+ management: { value: 4 },
521
+ };
522
+ readonly navigation: readonly NavigationItem[] = [{
523
+ id: 'management', title: 'Manajemen', icon: 'folder',
524
+ children: [
525
+ { title: 'Tugas', badge: { source: 'tasks' }, link: '/tasks' },
526
+ { title: 'Review', badge: { source: 'reviews' }, link: '/reviews' },
527
+ { title: 'Tugas lainnya', badge: { source: 'tasks' }, link: '/other-tasks' },
528
+ ],
529
+ }];
530
+ // Manajemen displays 8, counting tasks once.
531
+ // this.reviewCount.set(0) changes the total to 3.
532
+ // this.reviewCount.set(117) changes it to 99+ (accessible label: 120 items).
533
+ ```
534
+
535
+ Priority applies independently at each parent:
536
+
537
+ 1. `badge: { source: 'management' }` displays only that source, here `4`, without adding children.
538
+ A missing or zero own source hides the badge; it does not fall back to descendants.
539
+ 2. `badge: { title: 'New' }` keeps the existing static text badge instead of replacing it with a total.
540
+ 3. Otherwise, descendant source keys produce the automatic total. Ancestors still collect source
541
+ keys throughout their descendant tree, rather than summing already accumulated parent badges.
542
+
543
+ Automatic totals use the shared red count pill and the default `<total> items` accessible label;
544
+ child labels and source style overrides do not override the aggregate label or color. To supply a
545
+ custom aggregate label or business total, compute it in the consumer and bind it as the parent's own
546
+ source. The consumer continues to own data fetching and updates; the library does no requests or polling.
547
+
548
+ Expanded sidebar, navbar, and flyout parents place the count after their label, including submenu
549
+ triggers. Collapsed sidebar and dockbar group triggers place it over the icon corner. Opening a
550
+ dockbar panel keeps each child's own badge. With `dockbar-route-context`, an active group keeps its
551
+ total when its icon moves from the rail to the built-in route header. Existing explicit route metadata
552
+ badge keys keep their fallback priority in that header. Minidock accepts flat items only, so it never renders
553
+ parent totals. `toMinidockItems()` preserves individual leaf badges without copying parent totals.
554
+
555
+ ### Migration
556
+
557
+ Existing `<NavigationDockbar [dockbar-badge]="registry" />` continues to work, including its
558
+ route-context header and aside. Prefer moving the binding to its parent:
559
+
560
+ ```html
561
+ <Navigation [data]="navigation" [badge-context]="registry">
562
+ <NavigationDockbar [dockbar-route-context]="true" />
563
+ </Navigation>
564
+ ```
565
+
566
+ For a dockbar-only assembly, `[badge-context]` is also accepted on `NavigationDockbar`.
567
+ If both old and new dockbar inputs are bound, its generic input wins. A registry on `Navigation`
568
+ takes precedence over the type-level registry as a whole (including an explicit empty object).
569
+ `LayoutWrapperDefault` also accepts `[badge-context]` for every desktop navigation type and its
570
+ mobile sidebar; `[dockbar-badge]` remains its fallback for compatibility.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ojiepermana/angular",
3
- "version": "22.2.4",
3
+ "version": "22.2.6",
4
4
  "description": "Accessible, tree-shakable Angular 22 design system from ojiepermana: UI components, charts, navigation shells, theme tokens, and an OpenAPI SDK generator.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -503,5 +503,5 @@
503
503
  "module": "fesm2022/ojiepermana-angular.mjs",
504
504
  "typings": "types/ojiepermana-angular.d.ts",
505
505
  "type": "module",
506
- "gitHead": "9bf6b28075ea1896efc601f2228d5c9a568354d1"
506
+ "gitHead": "36761836fcc9ad9cd75bca17dc88834061ea4572"
507
507
  }
@@ -172,6 +172,26 @@
172
172
  letter-spacing: 0;
173
173
  }
174
174
 
175
+ .nav-count {
176
+ height: var(--nav-count-height);
177
+ min-width: var(--nav-count-height);
178
+ padding-inline: var(--nav-count-padding);
179
+ font-family: var(--nav-badge-font-family);
180
+ font-size: var(--nav-count-font-size);
181
+ line-height: 1;
182
+ font-weight: 600;
183
+ font-variant-numeric: tabular-nums;
184
+ }
185
+
186
+ .nav-count-overlay {
187
+ position: absolute;
188
+ top: var(--nav-count-offset);
189
+ right: var(--nav-count-offset);
190
+ height: var(--nav-count-compact-height);
191
+ min-width: var(--nav-count-compact-height);
192
+ z-index: 20;
193
+ }
194
+
175
195
  /* Modal overlay backdrop shared by Dialog, Sheet, and Drawer. The element is
176
196
  * rendered inside the CDK overlay container (outside component view
177
197
  * encapsulation), so its styles must live in this global layer. The default
@@ -146,6 +146,12 @@
146
146
  --nav-badge-size: var(--text-2xs-plus);
147
147
  --nav-badge-line-height: var(--text-2xs-plus--line-height);
148
148
  --nav-badge-weight: 500;
149
+ /* Count badges: 20px beside labels, 16px on icon rails at normal density. */
150
+ --nav-count-height: calc(var(--spacing-base) * 5);
151
+ --nav-count-compact-height: calc(var(--spacing-base) * 4);
152
+ --nav-count-padding: var(--spacing-base);
153
+ --nav-count-offset: calc(var(--spacing-base) * -2);
154
+ --nav-count-font-size: calc(var(--font-size-base) * 0.625);
149
155
  /* Item subtitles/descriptions — a quiet 12px tier under labels. */
150
156
  --nav-subtitle-size: calc(var(--font-size-base) * 0.75);
151
157
  --nav-subtitle-line-height: 1.35;
@@ -22,7 +22,7 @@ export type NavigationBadgeAriaLabel = string | ((count: number) => string);
22
22
  /** Sumber badge generik yang dapat direferensikan navigation item atau route metadata. */
23
23
  export interface NavigationBadgeSource {
24
24
  readonly value: NavigationBadgeValueSource;
25
- readonly ariaLabel: NavigationBadgeAriaLabel;
25
+ readonly ariaLabel?: NavigationBadgeAriaLabel;
26
26
  readonly classes?: string;
27
27
  }
28
28
  export type NavigationBadgeContext = Readonly<Record<string, NavigationBadgeSource>>;
@@ -79,7 +79,7 @@ export interface NavigationItemClasses {
79
79
  export interface NavigationItemBadge {
80
80
  readonly title?: string;
81
81
  readonly classes?: string;
82
- /** Key generik yang dicari pada input `dockbar-badge`. */
82
+ /** Key generik yang dicari pada input `badge-context`. */
83
83
  readonly source?: string;
84
84
  }
85
85
  export type NavigationVisibilityHandler = (item: NavigationItem) => boolean;
@@ -136,7 +136,7 @@ export interface NavigationIconContext {
136
136
  readonly level: number;
137
137
  }
138
138
  export declare function normalizeUiNavItems(items: readonly NavigationItem[]): readonly NavigationNormalizedItem[];
139
- /** Format visual count badge dockbar. Count nol atau invalid tidak dirender. */
139
+ /** Format visual count badge navigasi. Count nol atau invalid tidak dirender. */
140
140
  export declare function formatNavigationBadgeCount(value: NavigationBadgeCount): string | null;
141
141
  /**
142
142
  * Memadatkan divider: yang di awal, di akhir, dan yang berurutan dibuang. Dari
@@ -80,6 +80,8 @@ export declare class NavigationContainerComponent implements NavigationShellCont
80
80
  /** Id data publik dapat dipisahkan dari id state. Berguna untuk mirror mobile tanpa berbagi persistence state. */
81
81
  readonly dataId: import("@angular/core").InputSignal<string | null>;
82
82
  readonly data: import("@angular/core").InputSignal<readonly NavigationItem$1[]>;
83
+ /** Registry badge bersama untuk semua jenis navigasi. */
84
+ readonly badgeContext: import("@angular/core").InputSignal<Readonly<Record<string, NavigationBadgeSource$1>> | null>;
83
85
  readonly ariaLabel: import("@angular/core").InputSignal<string>;
84
86
  readonly compact: import("@angular/core").InputSignal<boolean>;
85
87
  readonly collapseTree: import("@angular/core").InputSignal<NavigationCollapseTree$1>;
@@ -116,6 +118,8 @@ export declare class NavigationContainerComponent implements NavigationShellCont
116
118
  private readonly collapsedPreference;
117
119
  private readonly dockbarModePreference;
118
120
  private readonly dockbarRouteContextPreference;
121
+ readonly resolvedBadgeContext: import("@angular/core").Signal<Readonly<Record<string, NavigationBadgeSource$1>>>;
122
+ /** @deprecated Gunakan resolvedBadgeContext. */
119
123
  readonly dockbarBadgeContext: import("@angular/core").Signal<Readonly<Record<string, NavigationBadgeSource$1>>>;
120
124
  readonly dockbarRouteHeaderVisible: import("@angular/core").Signal<boolean>;
121
125
  /** Template footer aside dockbar dari slot `ng-template[NavigationAsideFooter]`. */
@@ -193,6 +197,11 @@ export declare class NavigationContainerComponent implements NavigationShellCont
193
197
  "required": false;
194
198
  "isSignal": true;
195
199
  };
200
+ "badgeContext": {
201
+ "alias": "badge-context";
202
+ "required": false;
203
+ "isSignal": true;
204
+ };
196
205
  "ariaLabel": {
197
206
  "alias": "ariaLabel";
198
207
  "required": false;
@@ -403,11 +412,14 @@ export declare class NavigationDockbarComponent {
403
412
  readonly position: import("@angular/core").InputSignal<NavigationVerticalPosition$1 | null>;
404
413
  readonly routeContext: import("@angular/core").InputSignal<NavigationDockbarRouteContext$1 | null>;
405
414
  readonly badgeContext: import("@angular/core").InputSignal<Readonly<Record<string, import("@ojiepermana/angular/navigation").NavigationBadgeSource>>>;
415
+ readonly badges: import("@angular/core").InputSignal<Readonly<Record<string, import("@ojiepermana/angular/navigation").NavigationBadgeSource>> | null>;
416
+ private readonly resolvedBadges;
406
417
  readonly class: import("@angular/core").InputSignal<string>;
407
418
  protected readonly headerSlot: import("@angular/core").Signal<NavigationHeaderComponent | undefined>;
408
419
  protected readonly contentSlot: import("@angular/core").Signal<NavigationContentComponent | undefined>;
409
420
  protected readonly footerSlot: import("@angular/core").Signal<NavigationFooterComponent | undefined>;
410
421
  protected readonly asideFooterSlot: import("@angular/core").Signal<NavigationAsideFooterDirective | undefined>;
422
+ protected readonly headerDescendantSources: import("@angular/core").Signal<readonly import("@ojiepermana/angular/navigation").NavigationBadgeSource[]>;
411
423
  private readonly routeContextEnabled;
412
424
  protected readonly hostClasses: import("@angular/core").Signal<string>;
413
425
  constructor();
@@ -436,6 +448,11 @@ export declare class NavigationDockbarComponent {
436
448
  "required": false;
437
449
  "isSignal": true;
438
450
  };
451
+ "badges": {
452
+ "alias": "badge-context";
453
+ "required": false;
454
+ "isSignal": true;
455
+ };
439
456
  "class": {
440
457
  "alias": "class";
441
458
  "required": false;
@@ -293,7 +293,8 @@ export declare class LayoutNavDockbar {
293
293
  readonly navTypeMode: import("@angular/core").InputSignal<ThemeSettingsNavigationMode>;
294
294
  /** Opt-in route-aware header; ketika aktif, header route menggantikan compact brand. */
295
295
  readonly dockbarRouteContext: import("@angular/core").InputSignal<NavigationDockbarRouteContext | null>;
296
- /** The generic badge registry forwarded to `NavigationDockbar`. */
296
+ readonly badgeContext: import("@angular/core").InputSignal<Readonly<Record<string, import("@ojiepermana/angular/navigation").NavigationBadgeSource>> | null>;
297
+ /** @deprecated Gunakan badge-context. The generic badge registry forwarded to `NavigationDockbar`. */
297
298
  readonly dockbarBadgeContext: import("@angular/core").InputSignal<Readonly<Record<string, import("@ojiepermana/angular/navigation").NavigationBadgeSource>>>;
298
299
  /** Forwarded from the rail and aside footer logout buttons; the effect is the consumer's. */
299
300
  readonly logout: import("@angular/core").OutputEmitterRef<void>;
@@ -329,6 +330,11 @@ export declare class LayoutNavDockbar {
329
330
  "required": false;
330
331
  "isSignal": true;
331
332
  };
333
+ "badgeContext": {
334
+ "alias": "badge-context";
335
+ "required": false;
336
+ "isSignal": true;
337
+ };
332
338
  "dockbarBadgeContext": {
333
339
  "alias": "dockbar-badge";
334
340
  "required": false;
@@ -502,7 +508,10 @@ export declare class LayoutWrapperDefault {
502
508
  readonly navTypeMode: import("@angular/core").InputSignal<ThemeSettingsNavigationMode>;
503
509
  /** Opt-in route-aware dockbar state; ignored by other navigation types. */
504
510
  readonly dockbarRouteContext: import("@angular/core").InputSignal<NavigationDockbarRouteContext$1 | null>;
505
- /** Generic dockbar badge registry; ignored by sidebar/navbar/flyout. */
511
+ /** Registry badge untuk semua jenis navigasi desktop dan sidebar mobile. */
512
+ readonly badgeContext: import("@angular/core").InputSignal<Readonly<Record<string, import("@ojiepermana/angular/navigation").NavigationBadgeSource>> | null>;
513
+ protected readonly resolvedBadgeContext: import("@angular/core").Signal<Readonly<Record<string, import("@ojiepermana/angular/navigation").NavigationBadgeSource>>>;
514
+ /** @deprecated Gunakan badge-context. */
506
515
  readonly dockbarBadgeContext: import("@angular/core").InputSignal<Readonly<Record<string, import("@ojiepermana/angular/navigation").NavigationBadgeSource>>>;
507
516
  /** Item navigasi. */
508
517
  readonly data: import("@angular/core").InputSignal<readonly NavigationItem[]>;
@@ -593,6 +602,11 @@ export declare class LayoutWrapperDefault {
593
602
  "required": false;
594
603
  "isSignal": true;
595
604
  };
605
+ "badgeContext": {
606
+ "alias": "badge-context";
607
+ "required": false;
608
+ "isSignal": true;
609
+ };
596
610
  "dockbarBadgeContext": {
597
611
  "alias": "dockbar-badge";
598
612
  "required": false;
@@ -1,129 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- import { Component, computed, input, isSignal } from "@angular/core";
3
- import { cn } from "@ojiepermana/angular/component/utils/core";
4
- import { formatNavigationBadgeCount } from "@ojiepermana/angular/navigation/types";
5
- import { toObservable, toSignal } from "@angular/core/rxjs-interop";
6
- import { catchError, isObservable, of, switchMap } from "rxjs";
7
- var NavigationBadgeCountComponent = class NavigationBadgeCountComponent {
8
- badge = input(null, ...ngDevMode ? [{ debugName: "badge" }] : /* istanbul ignore next */ []);
9
- class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
10
- observableSource = computed(() => {
11
- const value = this.badge()?.value;
12
- return isObservable(value) ? value : of(null);
13
- }, ...ngDevMode ? [{ debugName: "observableSource" }] : /* istanbul ignore next */ []);
14
- observableValue = toSignal(toObservable(this.observableSource).pipe(switchMap((source) => source.pipe(catchError(() => of(null))))), { initialValue: null });
15
- rawValue() {
16
- const value = this.badge()?.value;
17
- if (isObservable(value)) return this.observableValue();
18
- if (isSignal(value)) return value();
19
- if (typeof value === "function") return value();
20
- return value;
21
- }
22
- resolvedBadge() {
23
- const value = this.rawValue();
24
- const count = value === null || value === void 0 || !Number.isFinite(value) ? 0 : Math.max(Math.trunc(value), 0);
25
- const display = formatNavigationBadgeCount(count);
26
- if (display === null) return null;
27
- const label = this.badge()?.ariaLabel;
28
- return {
29
- count,
30
- display,
31
- accessibleLabel: (typeof label === "function" ? label(count) : label)?.trim() || `${count} items`
32
- };
33
- }
34
- badgeClasses = computed(() => cn("nav-badge inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-xs font-semibold text-destructive-foreground", this.badge()?.classes, this.class()), ...ngDevMode ? [{ debugName: "badgeClasses" }] : /* istanbul ignore next */ []);
35
- static ɵfac = i0.ɵɵngDeclareFactory({
36
- minVersion: "12.0.0",
37
- version: "22.2.3",
38
- ngImport: i0,
39
- type: NavigationBadgeCountComponent,
40
- deps: [],
41
- target: i0.ɵɵFactoryTarget.Component
42
- });
43
- static ɵcmp = i0.ɵɵngDeclareComponent({
44
- minVersion: "17.0.0",
45
- version: "22.2.3",
46
- type: NavigationBadgeCountComponent,
47
- isStandalone: true,
48
- selector: "NavigationBadgeCount",
49
- inputs: {
50
- badge: {
51
- classPropertyName: "badge",
52
- publicName: "badge",
53
- isSignal: true,
54
- isRequired: false,
55
- transformFunction: null
56
- },
57
- class: {
58
- classPropertyName: "class",
59
- publicName: "class",
60
- isSignal: true,
61
- isRequired: false,
62
- transformFunction: null
63
- }
64
- },
65
- host: { classAttribute: "contents" },
66
- ngImport: i0,
67
- template: `
68
- @if (resolvedBadge(); as resolved) {
69
- <span
70
- role="status"
71
- aria-atomic="true"
72
- data-navigation-badge="true"
73
- [attr.data-navigation-badge-count]="resolved.count"
74
- [attr.aria-label]="resolved.accessibleLabel"
75
- [class]="badgeClasses()"
76
- >
77
- {{ resolved.display }}
78
- </span>
79
- }
80
- `,
81
- isInline: true
82
- });
83
- };
84
- i0.ɵɵngDeclareClassMetadata({
85
- minVersion: "12.0.0",
86
- version: "22.2.3",
87
- ngImport: i0,
88
- type: NavigationBadgeCountComponent,
89
- decorators: [{
90
- type: Component,
91
- args: [{
92
- selector: "NavigationBadgeCount",
93
- host: { class: "contents" },
94
- template: `
95
- @if (resolvedBadge(); as resolved) {
96
- <span
97
- role="status"
98
- aria-atomic="true"
99
- data-navigation-badge="true"
100
- [attr.data-navigation-badge-count]="resolved.count"
101
- [attr.aria-label]="resolved.accessibleLabel"
102
- [class]="badgeClasses()"
103
- >
104
- {{ resolved.display }}
105
- </span>
106
- }
107
- `
108
- }]
109
- }],
110
- propDecorators: {
111
- badge: [{
112
- type: i0.Input,
113
- args: [{
114
- isSignal: true,
115
- alias: "badge",
116
- required: false
117
- }]
118
- }],
119
- class: [{
120
- type: i0.Input,
121
- args: [{
122
- isSignal: true,
123
- alias: "class",
124
- required: false
125
- }]
126
- }]
127
- }
128
- });
129
- export { NavigationBadgeCountComponent };