@ah-oh/ao-workspaces-design-system 0.0.47 → 0.0.48
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 { Component, inject, signal, Injectable, makeEnvironmentProviders, input, ChangeDetectionStrategy, computed, model, forwardRef, output, DestroyRef, ElementRef, HostListener, viewChild, TemplateRef, Directive, contentChildren, effect, ViewContainerRef, ViewChild, InjectionToken, ApplicationRef, Injector, EnvironmentInjector, createComponent, untracked, Optional, SkipSelf, NgModule, EventEmitter, PLATFORM_ID, Output, Input, Inject, viewChildren } from '@angular/core';
|
|
2
|
+
import { Component, inject, signal, Injectable, makeEnvironmentProviders, input, ChangeDetectionStrategy, computed, model, forwardRef, output, DestroyRef, ElementRef, HostListener, viewChild, TemplateRef, Directive, contentChildren, effect, ViewContainerRef, ViewChild, InjectionToken, ApplicationRef, Injector, EnvironmentInjector, createComponent, runInInjectionContext, untracked, Optional, SkipSelf, NgModule, EventEmitter, PLATFORM_ID, Output, Input, Inject, viewChildren } from '@angular/core';
|
|
3
3
|
import { DOCUMENT, NgTemplateOutlet, isPlatformBrowser, DatePipe } from '@angular/common';
|
|
4
4
|
import * as i2 from '@angular/common/http';
|
|
5
5
|
import { withInterceptors, HttpParams, HttpHeaders, HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
|
|
@@ -2767,16 +2767,19 @@ class TabsComponent {
|
|
|
2767
2767
|
activeTab = model('', ...(ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []));
|
|
2768
2768
|
tabChange = output();
|
|
2769
2769
|
panels = contentChildren(TabPanelComponent, ...(ngDevMode ? [{ debugName: "panels" }] : /* istanbul ignore next */ []));
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
const
|
|
2776
|
-
if (
|
|
2777
|
-
|
|
2770
|
+
injector = inject(Injector);
|
|
2771
|
+
ngAfterViewInit() {
|
|
2772
|
+
runInInjectionContext(this.injector, () => {
|
|
2773
|
+
effect(() => {
|
|
2774
|
+
const panelList = this.panels();
|
|
2775
|
+
const currentActiveTab = untracked(() => this.activeTab());
|
|
2776
|
+
if (panelList.length > 0 && !currentActiveTab) {
|
|
2777
|
+
const firstEnabled = panelList.find(p => !p.disabled());
|
|
2778
|
+
if (firstEnabled) {
|
|
2779
|
+
this.activeTab.set(firstEnabled.id());
|
|
2780
|
+
}
|
|
2778
2781
|
}
|
|
2779
|
-
}
|
|
2782
|
+
});
|
|
2780
2783
|
});
|
|
2781
2784
|
}
|
|
2782
2785
|
selectTab(panel) {
|
|
@@ -2788,19 +2791,17 @@ class TabsComponent {
|
|
|
2788
2791
|
this.tabChange.emit({ previousTabId, currentTabId: panel.id() });
|
|
2789
2792
|
}
|
|
2790
2793
|
onKeydown(event, currentPanel) {
|
|
2791
|
-
const enabledPanels = this.panels().filter(
|
|
2792
|
-
const currentIndex = enabledPanels.findIndex(
|
|
2794
|
+
const enabledPanels = this.panels().filter(p => !p.disabled());
|
|
2795
|
+
const currentIndex = enabledPanels.findIndex(p => p.id() === currentPanel.id());
|
|
2793
2796
|
if (currentIndex === -1)
|
|
2794
2797
|
return;
|
|
2795
2798
|
let targetIndex = null;
|
|
2796
2799
|
switch (event.key) {
|
|
2797
2800
|
case 'ArrowLeft':
|
|
2798
|
-
targetIndex =
|
|
2799
|
-
currentIndex > 0 ? currentIndex - 1 : enabledPanels.length - 1;
|
|
2801
|
+
targetIndex = currentIndex > 0 ? currentIndex - 1 : enabledPanels.length - 1;
|
|
2800
2802
|
break;
|
|
2801
2803
|
case 'ArrowRight':
|
|
2802
|
-
targetIndex =
|
|
2803
|
-
currentIndex < enabledPanels.length - 1 ? currentIndex + 1 : 0;
|
|
2804
|
+
targetIndex = currentIndex < enabledPanels.length - 1 ? currentIndex + 1 : 0;
|
|
2804
2805
|
break;
|
|
2805
2806
|
case 'Home':
|
|
2806
2807
|
targetIndex = 0;
|
|
@@ -2828,7 +2829,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.13", ngImpo
|
|
|
2828
2829
|
args: [{ selector: 'ao-tabs', imports: [NgTemplateOutlet, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2829
2830
|
class: 'ao-tabs',
|
|
2830
2831
|
}, template: "<div class=\"ao-tabs__header\" role=\"tablist\">\n @for (panel of panels(); track panel.id()) {\n <button\n class=\"ao-tabs__tab\"\n role=\"tab\"\n type=\"button\"\n [class.ao-tabs__tab--active]=\"panel.id() === activeTab()\"\n [class.ao-tabs__tab--disabled]=\"panel.disabled()\"\n [attr.aria-selected]=\"panel.id() === activeTab()\"\n [attr.aria-controls]=\"'panel-' + panel.id()\"\n [attr.aria-disabled]=\"panel.disabled()\"\n [attr.data-tab-id]=\"panel.id()\"\n [attr.tabindex]=\"panel.id() === activeTab() ? 0 : -1\"\n [disabled]=\"panel.disabled()\"\n (click)=\"selectTab(panel)\"\n (keydown)=\"onKeydown($event, panel)\"\n >\n @if (panel.icon()) {\n <ao-icon [svg]=\"panel.icon()!\" size=\"sm\" />\n }\n {{ panel.label() }}\n </button>\n }\n</div>\n<div class=\"ao-tabs__content\">\n @for (panel of panels(); track panel.id()) {\n <div\n class=\"ao-tabs__panel\"\n role=\"tabpanel\"\n [id]=\"'panel-' + panel.id()\"\n [attr.aria-labelledby]=\"panel.id()\"\n [class.ao-tabs__panel--active]=\"panel.id() === activeTab()\"\n [attr.hidden]=\"panel.id() !== activeTab() ? true : null\"\n >\n @if (panel.id() === activeTab()) {\n <ng-container [ngTemplateOutlet]=\"panel.panelContent()\" />\n }\n </div>\n }\n</div>\n", styles: [":host{display:block}.ao-tabs__header{display:flex;gap:20px;border-bottom:1px solid #e9e9e9}.ao-tabs__tab{font-size:13px;font-weight:700;line-height:19.5px;letter-spacing:0;position:relative;display:inline-flex;align-items:center;gap:5px;padding:10px 5px;background:transparent;border:none;color:#212121;cursor:pointer;transition:color .2s ease}.ao-tabs__tab:after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:3px;background:transparent;transition:background-color .2s ease}.ao-tabs__tab:hover:not(:disabled){color:#ff004d}.ao-tabs__tab:focus-visible{outline:2px solid #ff004d;outline-offset:2px}.ao-tabs__tab--active{color:#ff004d}.ao-tabs__tab--active:after{background:#ff004d}.ao-tabs__tab--disabled{color:#909090;cursor:not-allowed}.ao-tabs__content{padding-top:15px}.ao-tabs__panel[hidden]{display:none}\n"] }]
|
|
2831
|
-
}],
|
|
2832
|
+
}], propDecorators: { activeTab: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTab", required: false }] }, { type: i0.Output, args: ["activeTabChange"] }], tabChange: [{ type: i0.Output, args: ["tabChange"] }], panels: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TabPanelComponent), { isSignal: true }] }] } });
|
|
2832
2833
|
|
|
2833
2834
|
class SideNavComponent {
|
|
2834
2835
|
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|