@cloudfrogger/goodui 0.0.64 → 0.0.71

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 (152) hide show
  1. package/ai/README.md +15 -0
  2. package/ai/case-studies/dockerhub.md +7 -0
  3. package/ai/case-studies/index.md +1 -0
  4. package/ai/catalog/component.schema.json +6 -0
  5. package/ai/catalog/components/good-action-menu.json +2 -2
  6. package/ai/catalog/components/good-alert.json +2 -2
  7. package/ai/catalog/components/{good-topbar.json → good-app-header.json} +77 -83
  8. package/ai/catalog/components/{good-app-layout.json → good-app-shell.json} +32 -68
  9. package/ai/catalog/components/good-avatar-menu-item.json +2 -2
  10. package/ai/catalog/components/good-brand-icon.json +6 -6
  11. package/ai/catalog/components/good-button.json +2 -2
  12. package/ai/catalog/components/good-dropdown.json +2 -2
  13. package/ai/catalog/components/{good-main-menu.json → good-header-actions.json} +19 -10
  14. package/ai/catalog/components/{good-avatar-menu.json → good-header-avatar.json} +5 -5
  15. package/ai/catalog/components/{good-topbar-dropdown-item.json → good-header-dropdown-item.json} +17 -17
  16. package/ai/catalog/components/{good-topbar-dropdown-menu.json → good-header-dropdown-menu.json} +14 -14
  17. package/ai/catalog/components/{good-topbar-menu-item.json → good-header-menu-item.json} +17 -15
  18. package/ai/catalog/components/{good-topbar-menu-container.json → good-header-menu.json} +16 -14
  19. package/ai/catalog/components/{good-notifications.json → good-header-notification.json} +5 -5
  20. package/ai/catalog/components/{good-search.json → good-header-search.json} +16 -7
  21. package/ai/catalog/components/{good-topbar-submenu.json → good-header-submenu.json} +12 -12
  22. package/ai/catalog/components/{good-theme-toggle.json → good-header-themetoggle.json} +8 -6
  23. package/ai/catalog/components/{good-heading.json → good-heading-1.json} +15 -33
  24. package/ai/catalog/components/good-heading-2.json +46 -0
  25. package/ai/catalog/components/{good-subheading.json → good-heading-3.json} +9 -30
  26. package/ai/catalog/components/good-heading-4.json +46 -0
  27. package/ai/catalog/components/good-heading-5.json +46 -0
  28. package/ai/catalog/components/good-heading-6.json +46 -0
  29. package/ai/catalog/components/good-heading-7.json +46 -0
  30. package/ai/catalog/components/good-heading-group.json +1 -1
  31. package/ai/catalog/components/good-main-view.json +6 -49
  32. package/ai/catalog/components/good-notification-host.json +1 -1
  33. package/ai/catalog/components/good-section.json +20 -2
  34. package/ai/catalog/components/good-settings.json +1 -1
  35. package/ai/catalog/components/good-sidebar-item.json +4 -2
  36. package/ai/catalog/components/good-sidebar-menu-container.json +4 -2
  37. package/ai/catalog/components/good-sidebar-submenu-group.json +1 -1
  38. package/ai/catalog/components/good-sidebar-submenu-item.json +1 -1
  39. package/ai/catalog/components/{good-sidebar-container.json → good-sidebar.json} +23 -26
  40. package/ai/catalog/components/good-summary.json +6 -1
  41. package/ai/catalog/index.json +231 -171
  42. package/ai/examples/edit-form.html +3 -1
  43. package/ai/examples/edit-form.ts +2 -2
  44. package/ai/examples/login.html +3 -1
  45. package/ai/examples/login.ts +2 -2
  46. package/ai/examples/settings.html +3 -1
  47. package/ai/examples/settings.ts +2 -2
  48. package/ai/examples/shell.html +18 -0
  49. package/ai/examples/shell.ts +11 -0
  50. package/ai/examples/table-view.html +3 -1
  51. package/ai/examples/table-view.ts +2 -2
  52. package/ai/examples/tsconfig.json +2 -1
  53. package/ai/guides/component-discovery.md +2 -2
  54. package/ai/guides/layout.md +5 -3
  55. package/ai/guides/page-patterns.md +7 -3
  56. package/ai/manifest.json +2 -2
  57. package/ai/skill/goodui/SKILL.md +11 -3
  58. package/angular/projects/goodui/package.json +1 -1
  59. package/angular/projects/goodui/src/lib/actions.ts +47 -23
  60. package/angular/projects/goodui/src/lib/app-shell.ts +109 -0
  61. package/angular/projects/goodui/src/lib/{topbar.ts → header.ts} +98 -72
  62. package/angular/projects/goodui/src/lib/main-view.ts +22 -13
  63. package/angular/projects/goodui/src/lib/shell-context.ts +46 -0
  64. package/angular/projects/goodui/src/lib/sidebar.ts +58 -40
  65. package/angular/projects/goodui/src/lib/typography.ts +51 -41
  66. package/angular/projects/goodui/src/public-api.ts +2 -2
  67. package/angular/projects/goodui/src/styles.css +99 -65
  68. package/angular/projects/goodui/src/tokens.generated.css +43 -6
  69. package/design/app-shell-contract.json +118 -0
  70. package/design/component-map.json +171 -82
  71. package/design/header-search-variants.json +55 -0
  72. package/design/typography-components.json +327 -0
  73. package/design-tokens/penpot.tokens.json +160 -6
  74. package/design.md +51 -39
  75. package/fesm2022/cloudfrogger-goodui.mjs +541 -383
  76. package/fesm2022/cloudfrogger-goodui.mjs.map +1 -1
  77. package/guides/README.md +2 -1
  78. package/guides/components/action-bar.md +1 -1
  79. package/guides/components/app-header.md +27 -0
  80. package/guides/components/columns.md +3 -3
  81. package/guides/components/header-actions.md +34 -0
  82. package/guides/components/{avatar-menu.md → header-avatar.md} +5 -5
  83. package/guides/components/header-menu.md +64 -0
  84. package/guides/components/header-notification.md +13 -0
  85. package/guides/components/header-search.md +72 -0
  86. package/guides/components/{theme-toggle.md → header-themetoggle.md} +6 -6
  87. package/guides/components/icon.md +1 -1
  88. package/guides/components/main-view.md +30 -8
  89. package/guides/components/notifications.md +2 -2
  90. package/guides/components/settings.md +2 -2
  91. package/guides/components/sidebar.md +16 -34
  92. package/guides/components/submenus.md +4 -4
  93. package/guides/components/subnav.md +4 -3
  94. package/guides/components/typography.md +76 -19
  95. package/guides/contributing/design-to-code.md +62 -32
  96. package/guides/foundations/naming.md +1 -1
  97. package/guides/foundations/tokens.md +9 -9
  98. package/guides/intro.md +17 -19
  99. package/guides/layout/app-shell.md +37 -0
  100. package/guides/layout/layout-rules.md +3 -3
  101. package/guides/migrations/app-shell.md +28 -0
  102. package/guides/migrations/explicit-headings.md +20 -0
  103. package/guides/migrations/header-actions.md +17 -0
  104. package/guides/migrations/header-menu.md +16 -0
  105. package/homepage/src/app/examples/calendar-workspace/calendar-workspace-page.ts +2 -10
  106. package/homepage/src/app/examples/calendar-workspace/source-code.generated.ts +1 -1
  107. package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.html +6 -4
  108. package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.ts +2 -20
  109. package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.html +5 -5
  110. package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.ts +2 -20
  111. package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.html +3 -1
  112. package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.ts +2 -20
  113. package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.html +7 -5
  114. package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.ts +2 -14
  115. package/homepage/src/app/examples/case-studies/cloudhoster/home-page.html +4 -4
  116. package/homepage/src/app/examples/case-studies/cloudhoster/home-page.ts +2 -12
  117. package/homepage/src/app/examples/case-studies/cloudhoster/source-code.generated.ts +10 -10
  118. package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.html +6 -6
  119. package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.ts +2 -18
  120. package/homepage/src/app/examples/case-studies/vpshoster/overview-page.html +4 -4
  121. package/homepage/src/app/examples/case-studies/vpshoster/overview-page.ts +2 -8
  122. package/homepage/src/app/examples/case-studies/vpshoster/servers-page.html +4 -1
  123. package/homepage/src/app/examples/case-studies/vpshoster/servers-page.ts +2 -12
  124. package/homepage/src/app/examples/case-studies/vpshoster/source-code.generated.ts +4 -4
  125. package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.html +4 -4
  126. package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.ts +2 -8
  127. package/homepage/src/app/examples/error-pages/error-pages-example-page.html +3 -1
  128. package/homepage/src/app/examples/error-pages/error-pages-example-page.ts +2 -7
  129. package/homepage/src/app/examples/error-pages/source-code.generated.ts +2 -2
  130. package/homepage/src/app/examples/mail-compose/mail-compose-page.ts +2 -4
  131. package/homepage/src/app/examples/mail-workspace/mail-workspace-page.ts +2 -10
  132. package/homepage/src/app/examples/mail-workspace/source-code.generated.ts +1 -1
  133. package/homepage/src/app/examples/notifications/notifications-page.html +3 -1
  134. package/homepage/src/app/examples/notifications/notifications-page.ts +2 -8
  135. package/homepage/src/app/examples/notifications/source-code.generated.ts +2 -2
  136. package/homepage/src/app/examples/pdf-reader/pdf-reader-page.html +3 -1
  137. package/homepage/src/app/examples/pdf-reader/pdf-reader-page.ts +2 -7
  138. package/homepage/src/app/examples/pdf-reader/source-code.generated.ts +2 -2
  139. package/homepage/src/app/examples/user-registration/source-code.generated.ts +3 -3
  140. package/homepage/src/app/examples/user-registration/user-registration-example-page.html +1 -1
  141. package/homepage/src/app/examples/user-registration/user-registration-example-page.ts +2 -2
  142. package/homepage/src/app/examples/user-registration/user-registration-form.ts +2 -13
  143. package/homepage/src/app/examples/user-registration/user-registration-page.html +1 -1
  144. package/homepage/src/app/examples/user-registration/user-registration-page.ts +2 -7
  145. package/package.json +2 -2
  146. package/styles.css +1 -1
  147. package/types/cloudfrogger-goodui.d.ts +301 -207
  148. package/angular/projects/goodui/src/lib/app-layout.ts +0 -84
  149. package/guides/components/main-menu.md +0 -23
  150. package/guides/components/search.md +0 -51
  151. package/guides/components/topbar.md +0 -89
  152. package/guides/layout/app-layout.md +0 -81
@@ -1,6 +1,7 @@
1
- import { ChangeDetectionStrategy, Component, ElementRef, HostListener, OnDestroy, computed, contentChild, forwardRef, inject, input, output, signal, viewChild } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, ElementRef, HostListener, OnDestroy, computed, forwardRef, inject, input, output, signal, viewChild } from '@angular/core';
2
+ import { GoodNavigationState, GoodShellContext, GOOD_SHELL_DEFAULTS } from './shell-context';
2
3
  import { RouterLink } from '@angular/router';
3
- import { GoodMainMenuComponent } from './actions';
4
+ import { GoodHeaderActionsComponent } from './actions';
4
5
  import { GoodIconComponent } from './icon';
5
6
  import { GoodMenuAction, GoodNotification, GoodSearchItem, GoodTopbarItem, GoodUser, goodRouteActive, goodTopbarItemContainsRoute } from './models';
6
7
 
@@ -30,7 +31,7 @@ export class GoodBrandIconComponent {
30
31
  }
31
32
 
32
33
  @Component({
33
- selector: 'good-topbar-dropdown-item',
34
+ selector: 'good-header-dropdown-item',
34
35
  standalone: true,
35
36
  imports: [RouterLink, GoodIconComponent],
36
37
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -55,49 +56,53 @@ export class GoodBrandIconComponent {
55
56
  </span>
56
57
  }
57
58
  `,
58
- host: { class: 'good-topbar-dropdown-item' },
59
+ host: { class: 'good-header-dropdown-item' },
59
60
  })
60
- export class GoodTopbarDropdownItemComponent {
61
+ export class GoodHeaderDropdownItemComponent {
61
62
  readonly item = input.required<GoodTopbarItem>();
62
63
  readonly activeRoute = input('');
64
+ private readonly navigation = inject(GoodNavigationState);
65
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
63
66
  readonly expanded = input(false);
64
67
  readonly panelId = input<string | null>(null);
65
68
  readonly hover = output<void>();
66
69
  readonly focused = output<void>();
67
70
  readonly toggle = output<void>();
68
71
  readonly navigate = output<void>();
69
- readonly isActive = computed(() => goodTopbarItemContainsRoute(this.item(), this.activeRoute()));
72
+ readonly isActive = computed(() => goodTopbarItemContainsRoute(this.item(), this.routeState()));
70
73
  }
71
74
 
72
75
  @Component({
73
- selector: 'good-topbar-dropdown-menu',
76
+ selector: 'good-header-dropdown-menu',
74
77
  standalone: true,
75
- imports: [GoodTopbarDropdownItemComponent, forwardRef(() => GoodTopbarSubmenuComponent)],
78
+ imports: [GoodHeaderDropdownItemComponent, forwardRef(() => GoodHeaderSubmenuComponent)],
76
79
  changeDetection: ChangeDetectionStrategy.OnPush,
77
80
  template: `
78
81
  <div class="good-dropdown-panel" role="group" [attr.aria-label]="label()">
79
82
  @for (item of items(); track item.id) {
80
83
  <div class="good-dropdown-entry" [class.good-dropdown-separated]="item.separatorBefore">
81
- <good-topbar-dropdown-item [item]="item" [activeRoute]="activeRoute()"
84
+ <good-header-dropdown-item [item]="item" [activeRoute]="routeState()"
82
85
  [expanded]="openChildId() === item.id" [panelId]="item.children?.length ? panelId(item) : null"
83
86
  (hover)="onHover(item)" (focused)="onFocus(item)" (toggle)="onToggle(item)" (navigate)="onNavigate()" />
84
87
  @if (item.children?.length && openChildId() === item.id) {
85
- <good-topbar-submenu [id]="panelId(item)" [items]="item.children!" [activeRoute]="activeRoute()"
88
+ <good-header-submenu [id]="panelId(item)" [items]="item.children!" [activeRoute]="routeState()"
86
89
  [label]="item.label" (navigate)="onNavigate()" />
87
90
  }
88
91
  </div>
89
92
  }
90
93
  </div>
91
94
  `,
92
- host: { class: 'good-topbar-dropdown-menu' },
95
+ host: { class: 'good-header-dropdown-menu' },
93
96
  })
94
- export class GoodTopbarDropdownMenuComponent {
97
+ export class GoodHeaderDropdownMenuComponent {
95
98
  readonly items = input<readonly GoodTopbarItem[]>([]);
96
99
  readonly label = input('Menu');
97
100
  readonly activeRoute = input('');
101
+ private readonly navigation = inject(GoodNavigationState);
102
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
98
103
  readonly navigate = output<void>();
99
104
  readonly openChildId = signal<string | null>(null);
100
- readonly submenu = viewChild(GoodTopbarSubmenuComponent);
105
+ readonly submenu = viewChild(GoodHeaderSubmenuComponent);
101
106
  private readonly uid = `good-dropdown-${++nextDropdownId}`;
102
107
  private readonly element: ElementRef<HTMLElement> = inject(ElementRef);
103
108
  private openedByClick = false;
@@ -139,7 +144,7 @@ export class GoodTopbarDropdownMenuComponent {
139
144
  closeDeepest(): boolean {
140
145
  if (this.submenu()?.menu()?.closeDeepest()) return true;
141
146
  if (!this.openChildId()) return false;
142
- const trigger = this.element.nativeElement.querySelector<HTMLElement>(':scope > .good-dropdown-panel > .good-dropdown-entry > good-topbar-dropdown-item > button[aria-expanded="true"]');
147
+ const trigger = this.element.nativeElement.querySelector<HTMLElement>(':scope > .good-dropdown-panel > .good-dropdown-entry > good-header-dropdown-item > button[aria-expanded="true"]');
143
148
  this.openChildId.set(null);
144
149
  this.openedByClick = false;
145
150
  this.suppressFocusOpen = true;
@@ -156,20 +161,22 @@ export class GoodTopbarDropdownMenuComponent {
156
161
  }
157
162
 
158
163
  @Component({
159
- selector: 'good-topbar-submenu',
164
+ selector: 'good-header-submenu',
160
165
  standalone: true,
161
- imports: [GoodTopbarDropdownMenuComponent],
166
+ imports: [GoodHeaderDropdownMenuComponent],
162
167
  changeDetection: ChangeDetectionStrategy.OnPush,
163
- template: `<good-topbar-dropdown-menu [items]="items()" [label]="label()" [activeRoute]="activeRoute()" (navigate)="navigate.emit()" />`,
164
- host: { class: 'good-topbar-submenu', '[class.good-submenu-flipped]': 'flipped()' },
168
+ template: `<good-header-dropdown-menu [items]="items()" [label]="label()" [activeRoute]="routeState()" (navigate)="navigate.emit()" />`,
169
+ host: { class: 'good-header-submenu', '[class.good-submenu-flipped]': 'flipped()' },
165
170
  })
166
- export class GoodTopbarSubmenuComponent {
171
+ export class GoodHeaderSubmenuComponent {
167
172
  readonly items = input<readonly GoodTopbarItem[]>([]);
168
173
  readonly label = input('Submenu');
169
174
  readonly activeRoute = input('');
175
+ private readonly navigation = inject(GoodNavigationState);
176
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
170
177
  readonly navigate = output<void>();
171
178
  readonly flipped = signal(false);
172
- readonly menu = viewChild(GoodTopbarDropdownMenuComponent);
179
+ readonly menu = viewChild(GoodHeaderDropdownMenuComponent);
173
180
  private readonly element: ElementRef<HTMLElement> = inject(ElementRef);
174
181
 
175
182
  constructor() { setTimeout(() => this.updatePlacement()); }
@@ -185,9 +192,9 @@ export class GoodTopbarSubmenuComponent {
185
192
  }
186
193
 
187
194
  @Component({
188
- selector: 'good-topbar-menu-item',
195
+ selector: 'good-header-menu-item',
189
196
  standalone: true,
190
- imports: [RouterLink, GoodIconComponent, GoodTopbarDropdownMenuComponent],
197
+ imports: [RouterLink, GoodIconComponent, GoodHeaderDropdownMenuComponent],
191
198
  changeDetection: ChangeDetectionStrategy.OnPush,
192
199
  template: `
193
200
  @if (children().length) {
@@ -197,27 +204,29 @@ export class GoodTopbarSubmenuComponent {
197
204
  {{ text() }}<good-icon name="chevron-down" />
198
205
  </button>
199
206
  @if (open()) {
200
- <good-topbar-dropdown-menu [id]="panelId" [items]="children()" [label]="text()" [activeRoute]="activeRoute()" (navigate)="closeMenu()" />
207
+ <good-header-dropdown-menu [id]="panelId" [items]="children()" [label]="text()" [activeRoute]="routeState()" (navigate)="closeMenu()" />
201
208
  }
202
209
  } @else if (link()) {
203
210
  <a class="good-topbar-link" [class.good-is-active]="isActive()" [routerLink]="link()"
204
211
  [attr.aria-current]="isActive() ? 'page' : null">{{ text() }}</a>
205
212
  } @else { <span class="good-topbar-link">{{ text() }}</span> }
206
213
  `,
207
- host: { class: 'good-topbar-menu-item' },
214
+ host: { class: 'good-header-menu-item' },
208
215
  })
209
- export class GoodTopbarMenuItemComponent implements OnDestroy {
216
+ export class GoodHeaderMenuItemComponent implements OnDestroy {
210
217
  readonly item = input<GoodTopbarItem | null>(null);
211
218
  readonly label = input('');
212
219
  readonly route = input<string | undefined>();
213
220
  readonly active = input(false);
214
221
  readonly activeRoute = input('');
222
+ private readonly navigation = inject(GoodNavigationState);
223
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
215
224
  readonly text = computed(() => this.item()?.label ?? this.label());
216
225
  readonly link = computed(() => this.item()?.route ?? this.route());
217
226
  readonly children = computed(() => this.item()?.children ?? []);
218
- readonly isActive = computed(() => this.active() || goodRouteActive(this.link(), this.activeRoute()) || (this.item() ? goodTopbarItemContainsRoute(this.item()!, this.activeRoute()) : false));
227
+ readonly isActive = computed(() => this.active() || goodRouteActive(this.link(), this.routeState()) || (this.item() ? goodTopbarItemContainsRoute(this.item()!, this.routeState()) : false));
219
228
  readonly open = signal(false);
220
- readonly dropdown = viewChild(GoodTopbarDropdownMenuComponent);
229
+ readonly dropdown = viewChild(GoodHeaderDropdownMenuComponent);
221
230
  readonly panelId = `good-topbar-panel-${++nextDropdownId}`;
222
231
  private readonly element: ElementRef<HTMLElement> = inject(ElementRef);
223
232
  private openedByClick = false;
@@ -295,26 +304,28 @@ export class GoodTopbarMenuItemComponent implements OnDestroy {
295
304
  }
296
305
 
297
306
  @Component({
298
- selector: 'good-topbar-menu-container',
307
+ selector: 'good-header-menu',
299
308
  standalone: true,
300
- imports: [GoodIconComponent, GoodTopbarMenuItemComponent],
309
+ imports: [GoodIconComponent, GoodHeaderMenuItemComponent],
301
310
  changeDetection: ChangeDetectionStrategy.OnPush,
302
311
  template: `
303
312
  <button #mobileTrigger type="button" class="good-topbar-mobile-trigger good-action-button"
304
- [attr.aria-label]="mobileOpen() ? 'Close topbar menu' : 'Open topbar menu'"
313
+ [attr.aria-label]="mobileOpen() ? 'Close header menu' : 'Open header menu'"
305
314
  aria-haspopup="true" [attr.aria-expanded]="mobileOpen()" [attr.aria-controls]="mobilePanelId"
306
315
  (click)="toggleMobileMenu()"><good-icon name="grid" /></button>
307
- <div class="good-topbar-menu-items" [id]="mobilePanelId" [class.good-topbar-menu-popup-open]="mobileOpen()"
308
- [attr.role]="mobileMode() === 'popup' ? 'navigation' : null" [attr.aria-label]="mobileMode() === 'popup' ? 'Topbar menu' : null">
309
- @for (item of items(); track item.id) { <good-topbar-menu-item [item]="item" [activeRoute]="activeRoute()" /> }
316
+ <div class="good-header-menu-items" [id]="mobilePanelId" [class.good-header-menu-popup-open]="mobileOpen()"
317
+ [attr.role]="mobileMode() === 'popup' ? 'navigation' : null" [attr.aria-label]="mobileMode() === 'popup' ? 'Header menu' : null">
318
+ @for (item of items(); track item.id) { <good-header-menu-item [item]="item" [activeRoute]="routeState()" /> }
310
319
  <ng-content />
311
320
  </div>
312
321
  `,
313
- host: { class: 'good-topbar-menu-container', '[attr.data-mobile-mode]': 'mobileMode()' },
322
+ host: { class: 'good-header-menu', '[attr.data-mobile-mode]': 'mobileMode()' },
314
323
  })
315
- export class GoodTopbarMenuContainerComponent {
324
+ export class GoodHeaderMenuComponent {
316
325
  readonly items = input<readonly GoodTopbarItem[]>([]);
317
326
  readonly activeRoute = input('');
327
+ private readonly navigation = inject(GoodNavigationState);
328
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
318
329
  readonly mobileMode = input<GoodTopbarMobileMenuMode>('hidden');
319
330
  readonly mobileOpen = signal(false);
320
331
  readonly mobilePanelId = `good-topbar-mobile-panel-${++nextDropdownId}`;
@@ -350,54 +361,69 @@ export class GoodTopbarMenuContainerComponent {
350
361
  }
351
362
 
352
363
  @Component({
353
- selector: 'good-topbar',
364
+ selector: 'good-app-header',
354
365
  standalone: true,
355
- imports: [GoodIconComponent, GoodBrandIconComponent, GoodTopbarMenuContainerComponent, GoodMainMenuComponent],
366
+ imports: [GoodIconComponent, GoodBrandIconComponent, GoodHeaderActionsComponent],
356
367
  changeDetection: ChangeDetectionStrategy.OnPush,
357
368
  template: `
358
369
  <div class="good-topbar-left">
359
- <button type="button" class="good-mobile-menu-button good-action-button" aria-label="Open sidebar" (click)="menuToggle.emit()"><good-icon name="menu" /></button>
360
- @if (showMobileBrand()) {
361
- @if (brandMarkSrc()) {
362
- <good-brand-icon class="good-mobile-brand-icon" [src]="brandMarkSrc()" [darkSrc]="brandMarkDarkSrc()" [label]="brand()" />
370
+ @if (!shell || shell.hasSidebar()) { <button type="button" class="good-mobile-menu-button good-action-button" aria-label="Open sidebar" (click)="openSidebar()"><good-icon name="menu" /></button> }
371
+ @if (config().showMobileBrand) {
372
+ @if (config().brandMarkSrc) {
373
+ <good-brand-icon class="good-mobile-brand-icon" [src]="config().brandMarkSrc" [darkSrc]="config().brandMarkDarkSrc" [label]="config().brand" />
363
374
  } @else {
364
- <span class="good-mobile-brand" [class.good-has-dark-logo]="!!brandLogoDarkSrc()">
365
- @if (brandLogoSrc()) {
366
- <img class="good-brand-logo good-brand-logo-light" [src]="brandLogoSrc()" [alt]="brand()" />
367
- @if (brandLogoDarkSrc()) { <img class="good-brand-logo good-brand-logo-dark" [src]="brandLogoDarkSrc()" [alt]="brand()" /> }
368
- } @else { {{ brand() }} }
375
+ <span class="good-mobile-brand" [class.good-has-dark-logo]="!!config().brandLogoDarkSrc">
376
+ @if (config().brandLogoSrc) {
377
+ <img class="good-brand-logo good-brand-logo-light" [src]="config().brandLogoSrc" [alt]="config().brand" />
378
+ @if (config().brandLogoDarkSrc) { <img class="good-brand-logo good-brand-logo-dark" [src]="config().brandLogoDarkSrc" [alt]="config().brand" /> }
379
+ } @else { {{ config().brand }} }
369
380
  </span>
370
381
  }
371
382
  }
372
- @if (showBrandIcon()) { <good-brand-icon class="good-desktop-brand-icon" [src]="brandMarkSrc()" [darkSrc]="brandMarkDarkSrc()" [label]="brand()" /> }
373
- @if (!projectedMenu()) { <good-topbar-menu-container [items]="items()" [activeRoute]="activeRoute()" [mobileMode]="mobileMenuMode()" /> }
374
- <ng-content select="good-topbar-menu-container" />
383
+ @if (config().showBrandIcon) { <good-brand-icon class="good-desktop-brand-icon" [src]="config().brandMarkSrc" [darkSrc]="config().brandMarkDarkSrc" [label]="config().brand" /> }
384
+ <ng-content select="good-header-menu" />
375
385
  </div>
376
- <ng-content select="good-main-menu">
377
- <good-main-menu [user]="user()" [notifications]="notifications()" [searchItems]="searchItems()" [settingsActions]="settingsActions()" [avatarActions]="avatarActions()" [showThemeToggle]="showThemeToggle()" [showSettings]="showSettings()" />
386
+ <ng-content select="good-header-actions">
387
+ <good-header-actions [user]="config().user" [notifications]="config().notifications" [searchItems]="config().searchItems" [settingsActions]="config().settingsActions" [avatarActions]="config().avatarActions" [showThemeToggle]="config().showThemeToggle" [showSettings]="config().showSettings" />
378
388
  </ng-content>
379
389
  `,
380
- host: { class: 'good-topbar', '[attr.data-mobile-menu]': 'mobileMenuMode()' },
390
+ host: { class: 'good-app-header' },
381
391
  })
382
- export class GoodTopbarComponent {
383
- readonly brand = input('GOODUI');
384
- readonly brandLogoSrc = input('');
385
- readonly brandLogoDarkSrc = input('');
386
- readonly brandMarkSrc = input('');
387
- readonly brandMarkDarkSrc = input('');
388
- readonly showBrandIcon = input(false);
389
- readonly showMobileBrand = input(true);
390
- readonly items = input<readonly GoodTopbarItem[]>([]);
391
- readonly activeRoute = input('');
392
- readonly mobileMenuMode = input<GoodTopbarMobileMenuMode>('hidden');
393
- readonly user = input<GoodUser | null>(null);
394
- readonly notifications = input<readonly GoodNotification[]>([]);
395
- readonly searchItems = input<readonly GoodSearchItem[]>([]);
396
- readonly settingsActions = input<readonly GoodMenuAction[]>([]);
397
- readonly showThemeToggle = input(true);
398
- readonly showSettings = input(false);
399
- readonly avatarActions = input<readonly GoodMenuAction[]>([]);
392
+ export class GoodAppHeaderComponent {
393
+ readonly shell = inject(GoodShellContext, { optional: true });
394
+ readonly brand = input<string>();
395
+ readonly brandLogoSrc = input<string>();
396
+ readonly brandLogoDarkSrc = input<string>();
397
+ readonly brandMarkSrc = input<string>();
398
+ readonly brandMarkDarkSrc = input<string>();
399
+ readonly showBrandIcon = input<boolean>();
400
+ readonly showMobileBrand = input<boolean>();
401
+ readonly user = input<GoodUser | null>();
402
+ readonly notifications = input<readonly GoodNotification[]>();
403
+ readonly searchItems = input<readonly GoodSearchItem[]>();
404
+ readonly settingsActions = input<readonly GoodMenuAction[]>();
405
+ readonly showThemeToggle = input<boolean>();
406
+ readonly showSettings = input<boolean>();
407
+ readonly avatarActions = input<readonly GoodMenuAction[]>();
400
408
  readonly menuToggle = output<void>();
401
- readonly projectedMenu = contentChild(GoodTopbarMenuContainerComponent);
402
- readonly projectedMainMenu = contentChild(GoodMainMenuComponent);
409
+ readonly config = computed(() => {
410
+ const inherited = this.shell?.options() ?? GOOD_SHELL_DEFAULTS;
411
+ return {
412
+ brand: this.brand() ?? inherited.brand,
413
+ brandLogoSrc: this.brandLogoSrc() ?? inherited.brandLogoSrc,
414
+ brandLogoDarkSrc: this.brandLogoDarkSrc() ?? inherited.brandLogoDarkSrc,
415
+ brandMarkSrc: this.brandMarkSrc() ?? inherited.brandMarkSrc,
416
+ brandMarkDarkSrc: this.brandMarkDarkSrc() ?? inherited.brandMarkDarkSrc,
417
+ showBrandIcon: this.showBrandIcon() ?? inherited.showBrandIcon,
418
+ showMobileBrand: this.showMobileBrand() ?? inherited.showMobileBrand,
419
+ user: this.user() === undefined ? inherited.user : this.user()!,
420
+ notifications: this.notifications() ?? inherited.notifications,
421
+ searchItems: this.searchItems() ?? inherited.searchItems,
422
+ settingsActions: this.settingsActions() ?? inherited.settingsActions,
423
+ showThemeToggle: this.showThemeToggle() ?? inherited.showThemeToggle,
424
+ showSettings: this.showSettings() ?? inherited.showSettings,
425
+ avatarActions: this.avatarActions() ?? inherited.avatarActions,
426
+ };
427
+ });
428
+ openSidebar(): void { this.shell?.sidebarOpen.set(true); this.menuToggle.emit(); }
403
429
  }
@@ -1,6 +1,6 @@
1
- import { ChangeDetectionStrategy, Component, input } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, computed, contentChild, input } from '@angular/core';
2
2
  import { GoodSubnavComponent } from './subnav';
3
- import { GoodEyebrowComponent, GoodEyebrowAppearance, GoodHeadingComponent, GoodHeadingGroupComponent, GoodSummaryComponent } from './typography';
3
+ import { GoodEyebrowComponent, GoodHeading1Component, GoodHeadingGroupComponent, GoodSummaryComponent } from './typography';
4
4
  import { GoodSubnavAction, GoodSubnavItem } from './models';
5
5
 
6
6
  export type GoodMainViewLayout = 'page' | 'fill';
@@ -8,17 +8,24 @@ export type GoodMainViewLayout = 'page' | 'fill';
8
8
  @Component({
9
9
  selector: 'good-main-view',
10
10
  standalone: true,
11
- imports: [GoodSubnavComponent, GoodHeadingGroupComponent, GoodEyebrowComponent, GoodHeadingComponent, GoodSummaryComponent],
11
+ imports: [GoodSubnavComponent],
12
12
  changeDetection: ChangeDetectionStrategy.OnPush,
13
13
  template: `
14
14
  @if (subnavItems().length) { <good-subnav [items]="subnavItems()" [actions]="subnavActions()" [ariaLabel]="subnavLabel()" /> }
15
- @if (eyebrow() || title() || description()) {
15
+ @if (hasHeading()) {
16
16
  <header class="good-main-view-heading">
17
- <good-heading-group>
18
- @if (eyebrow()) { <good-eyebrow [appearance]="eyebrowAppearance()">{{ eyebrow() }}</good-eyebrow> }
19
- @if (title()) { <good-heading>{{ title() }}</good-heading> }
20
- @if (description()) { <good-summary>{{ description() }}</good-summary> }
21
- </good-heading-group>
17
+ <div class="good-main-view-heading-content">
18
+ <ng-content select="good-heading-group" />
19
+ @if (hasDirectHeading()) {
20
+ <div class="good-heading-group">
21
+ <ng-content select="good-eyebrow" />
22
+ <div class="good-heading-group-text">
23
+ <ng-content select="good-heading-1" />
24
+ <ng-content select="good-summary" />
25
+ </div>
26
+ </div>
27
+ }
28
+ </div>
22
29
  <div class="good-main-view-actions"><ng-content select="[good-main-view-actions]" /></div>
23
30
  </header>
24
31
  }
@@ -32,8 +39,10 @@ export class GoodMainViewComponent {
32
39
  readonly subnavItems = input<readonly GoodSubnavItem[]>([]);
33
40
  readonly subnavActions = input<readonly GoodSubnavAction[]>([]);
34
41
  readonly subnavLabel = input('Subnav');
35
- readonly title = input('');
36
- readonly description = input('');
37
- readonly eyebrow = input('');
38
- readonly eyebrowAppearance = input<GoodEyebrowAppearance>('brand');
42
+ private readonly heading = contentChild(GoodHeading1Component, { descendants: false });
43
+ private readonly summary = contentChild(GoodSummaryComponent, { descendants: false });
44
+ private readonly eyebrow = contentChild(GoodEyebrowComponent, { descendants: false });
45
+ private readonly headingGroup = contentChild(GoodHeadingGroupComponent, { descendants: false });
46
+ protected readonly hasDirectHeading = computed(() => !!(this.heading() || this.summary() || this.eyebrow()));
47
+ protected readonly hasHeading = computed(() => this.hasDirectHeading() || !!this.headingGroup());
39
48
  }
@@ -0,0 +1,46 @@
1
+ import { Injectable, inject, signal } from '@angular/core';
2
+ import { NavigationEnd, Router } from '@angular/router';
3
+ import { toSignal } from '@angular/core/rxjs-interop';
4
+ import { filter, map } from 'rxjs';
5
+ import { GoodMenuAction, GoodNotification, GoodSearchItem, GoodUser } from './models';
6
+
7
+ export interface GoodShellOptions {
8
+ brand: string;
9
+ brandLogoSrc: string;
10
+ brandLogoDarkSrc: string;
11
+ brandMarkSrc: string;
12
+ brandMarkDarkSrc: string;
13
+ showBrandIcon: boolean;
14
+ showMobileBrand: boolean;
15
+ user: GoodUser | null;
16
+ notifications: readonly GoodNotification[];
17
+ searchItems: readonly GoodSearchItem[];
18
+ settingsActions: readonly GoodMenuAction[];
19
+ showThemeToggle: boolean;
20
+ showSettings: boolean;
21
+ avatarActions: readonly GoodMenuAction[];
22
+ }
23
+
24
+ export const GOOD_SHELL_DEFAULTS: GoodShellOptions = {
25
+ brand: 'GOODUI', brandLogoSrc: '', brandLogoDarkSrc: '', brandMarkSrc: '', brandMarkDarkSrc: '',
26
+ showBrandIcon: false, showMobileBrand: true, user: null, notifications: [], searchItems: [],
27
+ settingsActions: [], showThemeToggle: true, showSettings: false, avatarActions: [],
28
+ };
29
+
30
+ @Injectable()
31
+ export class GoodShellContext {
32
+ readonly options = signal<GoodShellOptions>(GOOD_SHELL_DEFAULTS);
33
+ readonly hasSidebar = signal(false);
34
+ readonly sidebarOpen = signal(false);
35
+ }
36
+
37
+ @Injectable({ providedIn: 'root' })
38
+ export class GoodNavigationState {
39
+ private readonly router = inject(Router, { optional: true });
40
+ readonly activeRoute = this.router
41
+ ? toSignal(this.router.events.pipe(
42
+ filter((event): event is NavigationEnd => event instanceof NavigationEnd),
43
+ map(event => event.urlAfterRedirects.split(/[?#]/)[0] || '/'),
44
+ ), { initialValue: this.router.url.split(/[?#]/)[0] || '/' })
45
+ : signal('/');
46
+ }
@@ -1,7 +1,8 @@
1
- import { ChangeDetectionStrategy, Component, computed, contentChildren, effect, forwardRef, inject, input, signal } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, Signal, computed, contentChildren, effect, forwardRef, inject, input, signal } from '@angular/core';
2
+ import { GoodNavigationState, GoodShellContext, GOOD_SHELL_DEFAULTS } from './shell-context';
2
3
  import { RouterLink } from '@angular/router';
3
4
  import { GoodIconComponent } from './icon';
4
- import { GoodNavItem, GoodSidebarSection, goodItemContainsRoute, goodRouteActive } from './models';
5
+ import { GoodNavItem, goodItemContainsRoute, goodRouteActive } from './models';
5
6
 
6
7
  let nextPanelId = 0;
7
8
 
@@ -44,10 +45,12 @@ export class GoodSidebarSubmenuItemComponent {
44
45
  readonly active = input(false);
45
46
  readonly activeMatch = input<'exact' | 'prefix'>('prefix');
46
47
  readonly activeRoute = input('');
48
+ private readonly navigation = inject(GoodNavigationState);
49
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
47
50
  readonly disabled = computed(() => this.item()?.disabled ?? false);
48
51
  readonly text = computed(() => this.item()?.label ?? this.label());
49
52
  readonly link = computed(() => this.item()?.route ?? this.route());
50
- readonly isActive = computed(() => this.active() || goodRouteActive(this.link(), this.activeRoute(), this.item()?.activeMatch ?? this.activeMatch()));
53
+ readonly isActive: Signal<boolean> = computed(() => this.active() || goodRouteActive(this.link(), this.routeState(), this.item()?.activeMatch ?? this.activeMatch()));
51
54
  }
52
55
 
53
56
  @Component({
@@ -64,9 +67,9 @@ export class GoodSidebarSubmenuItemComponent {
64
67
  <div class="good-submenu-children" [id]="panelId" [hidden]="!isOpen()">
65
68
  @for (child of children(); track child.id) {
66
69
  @if (child.children?.length) {
67
- <good-sidebar-submenu-group [item]="child" [activeRoute]="activeRoute()" [depth]="depth() + 1" />
70
+ <good-sidebar-submenu-group [item]="child" [activeRoute]="routeState()" [depth]="depth() + 1" />
68
71
  } @else {
69
- <good-sidebar-submenu-item [item]="child" [activeRoute]="activeRoute()" />
72
+ <good-sidebar-submenu-item [item]="child" [activeRoute]="routeState()" />
70
73
  }
71
74
  }
72
75
  <ng-content />
@@ -82,11 +85,15 @@ export class GoodSidebarSubmenuGroupComponent {
82
85
  readonly label = input('');
83
86
  readonly expanded = input(false);
84
87
  readonly activeRoute = input('');
88
+ private readonly navigation = inject(GoodNavigationState);
89
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
85
90
  readonly depth = input(1);
86
91
  readonly localOpen = signal<boolean | null>(null);
92
+ readonly projectedLinks = contentChildren(GoodSidebarSubmenuItemComponent, { descendants: true });
93
+ readonly projectedGroups = contentChildren(GoodSidebarSubmenuGroupComponent, { descendants: true });
87
94
  readonly children = computed(() => this.item()?.children ?? []);
88
95
  readonly text = computed(() => this.item()?.label ?? this.label());
89
- readonly initiallyOpen = computed(() => this.expanded() || (!!this.item() && goodItemContainsRoute(this.item()!, this.activeRoute())));
96
+ readonly initiallyOpen: Signal<boolean> = computed(() => this.expanded() || this.projectedLinks().some(link => link.isActive()) || this.projectedGroups().some(group => group.initiallyOpen()) || (!!this.item() && goodItemContainsRoute(this.item()!, this.routeState())));
90
97
  readonly isOpen = computed(() => this.accordion
91
98
  ? this.accordion.isOpen(this.depth(), this.panelId, this.initiallyOpen())
92
99
  : (this.localOpen() ?? this.initiallyOpen()));
@@ -104,7 +111,7 @@ export class GoodSidebarSubmenuGroupComponent {
104
111
  changeDetection: ChangeDetectionStrategy.OnPush,
105
112
  template: `
106
113
  @if (hasChildren()) {
107
- <button type="button" class="good-sidebar-row" [class.good-is-active]="isActive()" [class.good-is-disabled]="item()?.disabled ?? false" [disabled]="item()?.disabled ?? false"
114
+ <button type="button" [class]="depth > 0 ? 'good-submenu-link' : 'good-sidebar-row'" [class.good-is-active]="isActive()" [class.good-is-disabled]="item()?.disabled ?? false" [disabled]="item()?.disabled ?? false"
108
115
  [attr.aria-expanded]="isOpen()" [attr.aria-controls]="panelId" (click)="toggle()">
109
116
  @if (iconName()) { <good-icon [name]="iconName()!" /> }
110
117
  <span class="good-menu-label">{{ text() }}</span>
@@ -114,16 +121,17 @@ export class GoodSidebarSubmenuGroupComponent {
114
121
  <div class="good-sidebar-children" [id]="panelId" [hidden]="!isOpen()">
115
122
  @for (child of children(); track child.id) {
116
123
  @if (child.children?.length) {
117
- <good-sidebar-submenu-group [item]="child" [activeRoute]="activeRoute()" [depth]="1" />
124
+ <good-sidebar-submenu-group [item]="child" [activeRoute]="routeState()" [depth]="1" />
118
125
  } @else {
119
- <good-sidebar-submenu-item [item]="child" [activeRoute]="activeRoute()" />
126
+ <good-sidebar-submenu-item [item]="child" [activeRoute]="routeState()" />
120
127
  }
121
128
  }
122
129
  <ng-content />
123
130
  </div>
124
131
  } @else if (link() && !item()?.disabled) {
125
- <a class="good-sidebar-row" [class.good-is-active]="isActive()" [routerLink]="link()"
132
+ <a [class]="depth > 0 ? 'good-submenu-link' : 'good-sidebar-row'" [class.good-is-active]="isActive()" [routerLink]="link()"
126
133
  [attr.aria-current]="isActive() ? 'page' : null">
134
+ @if (depth > 0) { <span class="good-submenu-dot" aria-hidden="true"></span> }
127
135
  @if (iconName()) { <good-icon [name]="iconName()!" /> }
128
136
  <span class="good-menu-label">{{ text() }}</span>
129
137
  @if (badgeText()) { <span class="good-menu-badge">{{ badgeText() }}</span> }
@@ -135,7 +143,7 @@ export class GoodSidebarSubmenuGroupComponent {
135
143
  </span>
136
144
  }
137
145
  `,
138
- host: { class: 'good-sidebar-item' },
146
+ host: { class: 'good-sidebar-item', '[attr.data-depth]': 'depth' },
139
147
  })
140
148
  export class GoodSidebarItemComponent {
141
149
  private readonly accordion = inject(GoodSidebarAccordion, { optional: true });
@@ -149,22 +157,28 @@ export class GoodSidebarItemComponent {
149
157
  readonly activeMatch = input<'exact' | 'prefix'>('prefix');
150
158
  readonly expanded = input(false);
151
159
  readonly activeRoute = input('');
152
- readonly projectedGroups = contentChildren(GoodSidebarSubmenuGroupComponent);
160
+ private readonly navigation = inject(GoodNavigationState);
161
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
162
+ private readonly parentItem = inject(GoodSidebarItemComponent, { optional: true, skipSelf: true });
163
+ readonly depth: number = (this.parentItem?.depth ?? -1) + 1;
164
+ readonly projectedItems = contentChildren(GoodSidebarItemComponent, { descendants: true });
165
+ readonly projectedGroups = contentChildren(GoodSidebarSubmenuGroupComponent, { descendants: true });
166
+ readonly projectedLinks = contentChildren(GoodSidebarSubmenuItemComponent, { descendants: true });
153
167
  readonly children = computed(() => this.item()?.children ?? []);
154
- readonly hasChildren = computed(() => this.children().length > 0 || this.projectedGroups().length > 0);
168
+ readonly hasChildren = computed(() => this.children().length > 0 || this.projectedGroups().length > 0 || this.projectedItems().length > 0 || this.projectedLinks().length > 0);
155
169
  readonly text = computed(() => this.item()?.label ?? this.label());
156
170
  readonly iconName = computed(() => this.item()?.icon ?? this.icon());
157
171
  readonly link = computed(() => this.item()?.route ?? this.route());
158
172
  readonly badgeText = computed(() => this.item()?.badge ?? this.badge());
159
- readonly isActive = computed(() => this.active() || goodRouteActive(this.link(), this.activeRoute(), this.item()?.activeMatch ?? this.activeMatch()));
160
- readonly initiallyOpen = computed(() => this.expanded() || (!!this.item() && goodItemContainsRoute(this.item()!, this.activeRoute())));
173
+ readonly isActive: Signal<boolean> = computed(() => this.active() || goodRouteActive(this.link(), this.routeState(), this.item()?.activeMatch ?? this.activeMatch()) || this.projectedItems().some(item => item.isActive()) || this.projectedGroups().some(group => group.initiallyOpen()) || this.projectedLinks().some(link => link.isActive()));
174
+ readonly initiallyOpen: Signal<boolean> = computed(() => this.expanded() || this.isActive() || (!!this.item() && goodItemContainsRoute(this.item()!, this.routeState())));
161
175
  readonly localOpen = signal<boolean | null>(null);
162
176
  readonly isOpen = computed(() => this.accordion
163
- ? this.accordion.isOpen(0, this.panelId, this.initiallyOpen())
177
+ ? this.accordion.isOpen(this.depth, this.panelId, this.initiallyOpen())
164
178
  : (this.localOpen() ?? this.initiallyOpen()));
165
179
 
166
180
  toggle(): void {
167
- if (this.accordion) this.accordion.toggle(0, this.panelId, this.isOpen());
181
+ if (this.accordion) this.accordion.toggle(this.depth, this.panelId, this.isOpen());
168
182
  else this.localOpen.set(!this.isOpen());
169
183
  }
170
184
  }
@@ -179,7 +193,7 @@ export class GoodSidebarItemComponent {
179
193
  @if (heading()) { <h2 class="good-sidebar-heading">{{ heading() }}</h2> }
180
194
  <div class="good-sidebar-items">
181
195
  @for (item of items(); track item.id) {
182
- <good-sidebar-item [item]="item" [activeRoute]="activeRoute()" />
196
+ <good-sidebar-item [item]="item" [activeRoute]="routeState()" />
183
197
  }
184
198
  <ng-content />
185
199
  </div>
@@ -191,42 +205,46 @@ export class GoodSidebarMenuContainerComponent {
191
205
  readonly heading = input('');
192
206
  readonly items = input<readonly GoodNavItem[]>([]);
193
207
  readonly activeRoute = input('');
208
+ private readonly navigation = inject(GoodNavigationState);
209
+ readonly routeState = computed(() => this.activeRoute() || this.navigation.activeRoute());
194
210
 
195
211
  constructor() {
196
212
  effect(() => {
197
- this.activeRoute();
213
+ this.routeState();
198
214
  this.accordion.reset();
199
215
  });
200
216
  }
201
217
  }
202
218
 
203
219
  @Component({
204
- selector: 'good-sidebar-container',
205
- standalone: true,
206
- imports: [GoodSidebarMenuContainerComponent],
220
+ selector: 'good-sidebar', standalone: true,
221
+ providers: [GoodSidebarAccordion],
207
222
  changeDetection: ChangeDetectionStrategy.OnPush,
208
223
  template: `
209
- <div class="good-sidebar-brand" [class.good-has-dark-logo]="!!brandLogoDarkSrc()">
210
- @if (brandLogoSrc()) {
211
- <img class="good-brand-logo good-brand-logo-light" [src]="brandLogoSrc()" [alt]="brand()" />
212
- @if (brandLogoDarkSrc()) { <img class="good-brand-logo good-brand-logo-dark" [src]="brandLogoDarkSrc()" [alt]="brand()" /> }
224
+ <div class="good-sidebar-brand" [class.good-has-dark-logo]="!!branding().brandLogoDarkSrc">
225
+ @if (branding().brandLogoSrc) {
226
+ <img class="good-brand-logo good-brand-logo-light" [src]="branding().brandLogoSrc" [alt]="branding().brand" />
227
+ @if (branding().brandLogoDarkSrc) { <img class="good-brand-logo good-brand-logo-dark" [src]="branding().brandLogoDarkSrc" [alt]="branding().brand" /> }
213
228
  } @else {
214
- <span class="good-brand-mark" aria-hidden="true"></span><span class="good-brand-name">{{ brand() }}</span>
229
+ <span class="good-brand-mark" aria-hidden="true"></span><span class="good-brand-name">{{ branding().brand }}</span>
215
230
  }
216
231
  </div>
217
- <nav class="good-sidebar-scroll" aria-label="Hauptnavigation">
218
- @for (section of sections(); track section.id) {
219
- <good-sidebar-menu-container [heading]="section.heading ?? ''" [items]="section.items" [activeRoute]="activeRoute()" />
220
- }
221
- <ng-content />
222
- </nav>
232
+ <nav class="good-sidebar-scroll" [attr.aria-label]="label()"><ng-content /></nav>
223
233
  `,
224
- host: { class: 'good-sidebar-container' },
234
+ host: { class: 'good-sidebar' },
225
235
  })
226
- export class GoodSidebarContainerComponent {
227
- readonly brand = input('GOODUI');
228
- readonly brandLogoSrc = input('');
229
- readonly brandLogoDarkSrc = input('');
230
- readonly sections = input<readonly GoodSidebarSection[]>([]);
231
- readonly activeRoute = input('');
236
+ export class GoodSidebarComponent {
237
+ private readonly shell = inject(GoodShellContext, { optional: true });
238
+ private readonly navigation = inject(GoodNavigationState);
239
+ private readonly accordion = inject(GoodSidebarAccordion);
240
+ readonly brand = input<string>();
241
+ readonly brandLogoSrc = input<string>();
242
+ readonly brandLogoDarkSrc = input<string>();
243
+ readonly label = input('Primary navigation');
244
+ readonly branding = computed(() => ({
245
+ brand: this.brand() ?? this.shell?.options().brand ?? GOOD_SHELL_DEFAULTS.brand,
246
+ brandLogoSrc: this.brandLogoSrc() ?? this.shell?.options().brandLogoSrc ?? '',
247
+ brandLogoDarkSrc: this.brandLogoDarkSrc() ?? this.shell?.options().brandLogoDarkSrc ?? '',
248
+ }));
249
+ constructor() { effect(() => { this.navigation.activeRoute(); this.accordion.reset(); }); }
232
250
  }