@abgov/angular-components 5.2.0-dev.4 → 5.2.0-dev.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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, forwardRef, HostListener, Directive, Renderer2, CUSTOM_ELEMENTS_SCHEMA, NgModule, Input, Component, booleanAttribute, ViewChild, ChangeDetectorRef, EventEmitter, Output, numberAttribute, TemplateRef, HostBinding } from '@angular/core';
2
+ import { inject, ElementRef, forwardRef, HostListener, Directive, Renderer2, CUSTOM_ELEMENTS_SCHEMA, NgModule, Input, Component, booleanAttribute, ViewChild, ChangeDetectorRef, EventEmitter, Output, numberAttribute, TemplateRef, HostBinding, signal, effect, Injectable } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR, CheckboxControlValueAccessor } from '@angular/forms';
4
4
  import { NgTemplateOutlet } from '@angular/common';
5
5
  import { Once, CalendarDate } from '@abgov/ui-components-common';
@@ -6749,15 +6749,21 @@ class GoabWorkSideMenu {
6749
6749
  (_toggle)="_onToggle()"
6750
6750
  (_navigate)="_onNavigate($event)"
6751
6751
  >
6752
- <div slot="primary">
6753
- <ng-container [ngTemplateOutlet]="primaryContent"></ng-container>
6754
- </div>
6755
- <div slot="secondary">
6756
- <ng-container [ngTemplateOutlet]="secondaryContent"></ng-container>
6757
- </div>
6758
- <div slot="account">
6759
- <ng-container [ngTemplateOutlet]="accountContent"></ng-container>
6760
- </div>
6752
+ @if (primaryContent) {
6753
+ <div slot="primary">
6754
+ <ng-container [ngTemplateOutlet]="primaryContent"></ng-container>
6755
+ </div>
6756
+ }
6757
+ @if (secondaryContent) {
6758
+ <div slot="secondary">
6759
+ <ng-container [ngTemplateOutlet]="secondaryContent"></ng-container>
6760
+ </div>
6761
+ }
6762
+ @if (accountContent) {
6763
+ <div slot="account">
6764
+ <ng-container [ngTemplateOutlet]="accountContent"></ng-container>
6765
+ </div>
6766
+ }
6761
6767
  </goa-work-side-menu>
6762
6768
  }
6763
6769
  `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
@@ -6780,15 +6786,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
6780
6786
  (_toggle)="_onToggle()"
6781
6787
  (_navigate)="_onNavigate($event)"
6782
6788
  >
6783
- <div slot="primary">
6784
- <ng-container [ngTemplateOutlet]="primaryContent"></ng-container>
6785
- </div>
6786
- <div slot="secondary">
6787
- <ng-container [ngTemplateOutlet]="secondaryContent"></ng-container>
6788
- </div>
6789
- <div slot="account">
6790
- <ng-container [ngTemplateOutlet]="accountContent"></ng-container>
6791
- </div>
6789
+ @if (primaryContent) {
6790
+ <div slot="primary">
6791
+ <ng-container [ngTemplateOutlet]="primaryContent"></ng-container>
6792
+ </div>
6793
+ }
6794
+ @if (secondaryContent) {
6795
+ <div slot="secondary">
6796
+ <ng-container [ngTemplateOutlet]="secondaryContent"></ng-container>
6797
+ </div>
6798
+ }
6799
+ @if (accountContent) {
6800
+ <div slot="account">
6801
+ <ng-container [ngTemplateOutlet]="accountContent"></ng-container>
6802
+ </div>
6803
+ }
6792
6804
  </goa-work-side-menu>
6793
6805
  }
6794
6806
  `,
@@ -7123,9 +7135,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
7123
7135
  type: Output
7124
7136
  }] } });
7125
7137
 
7138
+ const STORAGE_KEY = "goab-theme";
7139
+ const ATTRIBUTE = "data-theme";
7140
+ class GoabThemeService {
7141
+ constructor() {
7142
+ this._mode = signal(this.readInitialMode(), ...(ngDevMode ? [{ debugName: "_mode" }] : /* istanbul ignore next */ []));
7143
+ /** Read-only signal for consumers. Use in templates: theme.mode() === 'dark'. */
7144
+ this.mode = this._mode.asReadonly();
7145
+ effect(() => {
7146
+ const current = this._mode();
7147
+ if (typeof document === "undefined")
7148
+ return;
7149
+ document.documentElement.setAttribute(ATTRIBUTE, current);
7150
+ try {
7151
+ window.localStorage.setItem(STORAGE_KEY, current);
7152
+ }
7153
+ catch {
7154
+ // localStorage blocked: fail silently.
7155
+ }
7156
+ });
7157
+ }
7158
+ setMode(next) {
7159
+ this._mode.set(next);
7160
+ }
7161
+ toggle() {
7162
+ this._mode.update((prev) => (prev === "light" ? "dark" : "light"));
7163
+ }
7164
+ readInitialMode() {
7165
+ if (typeof window === "undefined")
7166
+ return "light";
7167
+ try {
7168
+ const stored = window.localStorage.getItem(STORAGE_KEY);
7169
+ if (stored === "light" || stored === "dark")
7170
+ return stored;
7171
+ }
7172
+ catch {
7173
+ // fall through
7174
+ }
7175
+ const fromAttribute = document.documentElement.getAttribute(ATTRIBUTE);
7176
+ if (fromAttribute === "light" || fromAttribute === "dark")
7177
+ return fromAttribute;
7178
+ if (window.matchMedia("(prefers-color-scheme: dark)").matches)
7179
+ return "dark";
7180
+ return "light";
7181
+ }
7182
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: GoabThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
7183
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: GoabThemeService, providedIn: "root" }); }
7184
+ }
7185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: GoabThemeService, decorators: [{
7186
+ type: Injectable,
7187
+ args: [{ providedIn: "root" }]
7188
+ }], ctorParameters: () => [] });
7189
+
7126
7190
  /**
7127
7191
  * Generated bundle index. Do not edit.
7128
7192
  */
7129
7193
 
7130
- export { AngularComponentsModule, CheckedDirective, GoabAccordion, GoabAppFooter, GoabAppFooterMetaSection, GoabAppFooterNavSection, GoabAppHeader, GoabAppHeaderMenu, GoabBadge, GoabBlock, GoabButton, GoabButtonGroup, GoabCalendar, GoabCallout, GoabCard, GoabCardActions, GoabCardContent, GoabCardImage, GoabCheckbox, GoabCheckboxList, GoabChip, GoabCircularProgress, GoabColumnLayout, GoabContainer, GoabDataGrid, GoabDatePicker, GoabDetails, GoabDivider, GoabDrawer, GoabDropdown, GoabDropdownItem, GoabFieldset, GoabFileUploadCard, GoabFileUploadInput, GoabFilterChip, GoabFormItem, GoabFormItemSlot, GoabFormStep, GoabFormStepper, GoabGrid, GoabHeroBanner, GoabIcon, GoabIconButton, GoabInput, GoabInputNumber, GoabLinearProgress, GoabLink, GoabMenuAction, GoabMenuButton, GoabMicrositeHeader, GoabModal, GoabNotification, GoabPageBlock, GoabPages, GoabPagination, GoabPopover, GoabPublicForm, GoabPublicFormPage, GoabPublicFormSummary, GoabPublicFormTask, GoabPublicFormTaskList, GoabPublicSubform, GoabPublicSubformIndex, GoabPushDrawer, GoabRadioGroup, GoabRadioItem, GoabSideMenu, GoabSideMenuGroup, GoabSideMenuHeading, GoabSkeleton, GoabSpacer, GoabTab, GoabTable, GoabTableSortHeader, GoabTabs, GoabTemporaryNotificationCtrl, GoabText, GoabTextArea, GoabTooltip, GoabWorkSideMenu, GoabWorkSideMenuGroup, GoabWorkSideMenuItem, GoabWorkSideNotificationItem, GoabWorkSideNotificationPanel, ValueDirective, ValueListDirective };
7194
+ export { AngularComponentsModule, CheckedDirective, GoabAccordion, GoabAppFooter, GoabAppFooterMetaSection, GoabAppFooterNavSection, GoabAppHeader, GoabAppHeaderMenu, GoabBadge, GoabBlock, GoabButton, GoabButtonGroup, GoabCalendar, GoabCallout, GoabCard, GoabCardActions, GoabCardContent, GoabCardImage, GoabCheckbox, GoabCheckboxList, GoabChip, GoabCircularProgress, GoabColumnLayout, GoabContainer, GoabDataGrid, GoabDatePicker, GoabDetails, GoabDivider, GoabDrawer, GoabDropdown, GoabDropdownItem, GoabFieldset, GoabFileUploadCard, GoabFileUploadInput, GoabFilterChip, GoabFormItem, GoabFormItemSlot, GoabFormStep, GoabFormStepper, GoabGrid, GoabHeroBanner, GoabIcon, GoabIconButton, GoabInput, GoabInputNumber, GoabLinearProgress, GoabLink, GoabMenuAction, GoabMenuButton, GoabMicrositeHeader, GoabModal, GoabNotification, GoabPageBlock, GoabPages, GoabPagination, GoabPopover, GoabPublicForm, GoabPublicFormPage, GoabPublicFormSummary, GoabPublicFormTask, GoabPublicFormTaskList, GoabPublicSubform, GoabPublicSubformIndex, GoabPushDrawer, GoabRadioGroup, GoabRadioItem, GoabSideMenu, GoabSideMenuGroup, GoabSideMenuHeading, GoabSkeleton, GoabSpacer, GoabTab, GoabTable, GoabTableSortHeader, GoabTabs, GoabTemporaryNotificationCtrl, GoabText, GoabTextArea, GoabThemeService, GoabTooltip, GoabWorkSideMenu, GoabWorkSideMenuGroup, GoabWorkSideMenuItem, GoabWorkSideNotificationItem, GoabWorkSideNotificationPanel, ValueDirective, ValueListDirective };
7131
7195
  //# sourceMappingURL=abgov-angular-components.mjs.map