@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.0
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.
- package/README.md +22 -48
- package/action-button/README.md +9 -11
- package/empty-state/README.md +11 -26
- package/feedback/README.md +3 -3
- package/fesm2022/cngx-ui-action-button.mjs +30 -26
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +26 -21
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +498 -261
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +32 -5
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +79 -104
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +111 -83
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-material.mjs +14 -3
- package/fesm2022/cngx-ui-material.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +22 -3
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +107 -28
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +61 -20
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +14 -5
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +484 -161
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +75 -39
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +2 -1
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/layout/README.md +9 -44
- package/mat-stepper/README.md +7 -10
- package/mat-tabs/README.md +13 -13
- package/mat-tabs/styles/mat-tabs.css +339 -213
- package/material/README.md +19 -19
- package/overlay/README.md +11 -11
- package/package.json +5 -4
- package/sidenav/README.md +4 -19
- package/skeleton/README.md +3 -17
- package/speak/README.md +15 -15
- package/stepper/README.md +139 -5
- package/tabs/README.md +4 -4
- package/theming/system-tokens.css +29 -0
- package/types/cngx-ui-action-button.d.ts +28 -13
- package/types/cngx-ui-empty-state.d.ts +21 -9
- package/types/cngx-ui-feedback.d.ts +437 -121
- package/types/cngx-ui-layout.d.ts +38 -8
- package/types/cngx-ui-mat-stepper.d.ts +58 -43
- package/types/cngx-ui-mat-tabs.d.ts +122 -72
- package/types/cngx-ui-material.d.ts +12 -1
- package/types/cngx-ui-overlay.d.ts +25 -4
- package/types/cngx-ui-sidenav.d.ts +106 -12
- package/types/cngx-ui-skeleton.d.ts +62 -8
- package/types/cngx-ui-speak.d.ts +10 -2
- package/types/cngx-ui-stepper.d.ts +280 -56
- package/types/cngx-ui-tabs.d.ts +38 -10
- package/types/cngx-ui.d.ts +1 -0
- package/speak/speak-button-theme.scss +0 -78
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, inject, ElementRef, Injector, contentChildren, contentChild, ChangeDetectionStrategy, Component, viewChild, DestroyRef, linkedSignal, computed, isDevMode, afterNextRender, effect, untracked } from '@angular/core';
|
|
3
|
+
import { input, inject, ElementRef, Injector, contentChildren, contentChild, ViewEncapsulation, ChangeDetectionStrategy, Component, viewChild, DestroyRef, linkedSignal, computed, isDevMode, afterNextRender, effect, untracked } from '@angular/core';
|
|
4
4
|
import * as i2 from '@cngx/common/a11y';
|
|
5
5
|
import { CngxLiveRegion, CngxRovingItem, CngxRovingTabindex, CngxFocusRestore, CngxActiveDescendant } from '@cngx/common/a11y';
|
|
6
6
|
import * as i1 from '@cngx/common/tabs';
|
|
@@ -13,10 +13,28 @@ import { CngxPopover, CngxPopoverTrigger } from '@cngx/common/popover';
|
|
|
13
13
|
* + `CngxRovingTabindex` + `CngxFocusRestore` via `hostDirectives`.
|
|
14
14
|
* Material variant lives at `[cngxMatTabs]` in `@cngx/ui/mat-tabs`.
|
|
15
15
|
*
|
|
16
|
-
* All ARIA attrs are signal-driven
|
|
16
|
+
* All ARIA attrs are signal-driven - never one-shot bindings.
|
|
17
17
|
* `CngxLiveRegion` is mounted as a child `<span>` rather than a
|
|
18
18
|
* host directive: its `role="status"` would clobber the wrapper's
|
|
19
19
|
* `role="group"` landmark.
|
|
20
|
+
*
|
|
21
|
+
* @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
|
|
22
|
+
* @see {@link CngxMatTabs} for the Material `<mat-tab-group>` variant with `[cngxMatTabError]`.
|
|
23
|
+
*
|
|
24
|
+
* @category ui/tabs
|
|
25
|
+
* @docsKind primary
|
|
26
|
+
* @wcag AA
|
|
27
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/tabs/tab-group.component.ts
|
|
28
|
+
* @since 0.1.0
|
|
29
|
+
* @relatedTo CngxTabOverflow, CngxTabGroupPresenter, CngxTab, CngxRovingTabindex, CngxFocusRestore
|
|
30
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
31
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
|
|
32
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
33
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
34
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
35
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
36
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
37
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
20
38
|
*/
|
|
21
39
|
class CngxTabGroup {
|
|
22
40
|
ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
@@ -33,7 +51,7 @@ class CngxTabGroup {
|
|
|
33
51
|
* Per-instance skin slots. Resolved via 3-stage cascade in {@link templates}:
|
|
34
52
|
* `*cngxTab*` directive > `CNGX_TABS_CONFIG.templates.<key>` > built-in.
|
|
35
53
|
* AOT (NG8110) requires `contentChild()` to be a direct field initialiser
|
|
36
|
-
* on the variant
|
|
54
|
+
* on the variant - cascade resolution is delegated to the factory.
|
|
37
55
|
*/
|
|
38
56
|
errorBadgeSlot = contentChild(CngxTabErrorBadge, ...(ngDevMode ? [{ debugName: "errorBadgeSlot" }] : /* istanbul ignore next */ []));
|
|
39
57
|
rejectionIconSlot = contentChild(CngxTabRejectionIcon, ...(ngDevMode ? [{ debugName: "rejectionIconSlot" }] : /* istanbul ignore next */ []));
|
|
@@ -124,12 +142,12 @@ class CngxTabGroup {
|
|
|
124
142
|
return ctx;
|
|
125
143
|
}
|
|
126
144
|
/**
|
|
127
|
-
* Context for `*cngxTabBusySpinner`. Allocates fresh per CD
|
|
145
|
+
* Context for `*cngxTabBusySpinner`. Allocates fresh per CD -
|
|
128
146
|
* `intendedIndex` is reactive, and `*ngTemplateOutlet` only
|
|
129
147
|
* re-evaluates `let-*` bindings when the context reference changes
|
|
130
148
|
* (`Object.is` input-diff); a cached mutated object would leave
|
|
131
149
|
* consumer bindings stale. `intendedIndex` is non-undefined by gate
|
|
132
|
-
*
|
|
150
|
+
* - `isTabBusy(tab)` returning `true` requires it.
|
|
133
151
|
*/
|
|
134
152
|
busySpinnerContextFor(tab) {
|
|
135
153
|
return { tab, intendedIndex: this.presenter.intendedIndex() ?? -1 };
|
|
@@ -154,13 +172,13 @@ class CngxTabGroup {
|
|
|
154
172
|
this.presenter.select(idx);
|
|
155
173
|
}
|
|
156
174
|
}
|
|
157
|
-
// CngxTabPanelHost contract
|
|
175
|
+
// CngxTabPanelHost contract - presenter owns clamping, disabled-skip,
|
|
158
176
|
// commit-action gating.
|
|
159
177
|
selectById(id) {
|
|
160
178
|
this.presenter.selectById(id);
|
|
161
179
|
}
|
|
162
180
|
/**
|
|
163
|
-
* Clear the presenter's `lastFailedIndex` rejection flag
|
|
181
|
+
* Clear the presenter's `lastFailedIndex` rejection flag - exposed
|
|
164
182
|
* so template-ref consumers (`#tg="cngxTabGroup"`) can dismiss the
|
|
165
183
|
* decoration without injecting the host token.
|
|
166
184
|
*/
|
|
@@ -168,26 +186,20 @@ class CngxTabGroup {
|
|
|
168
186
|
this.presenter.clearLastFailed();
|
|
169
187
|
}
|
|
170
188
|
labelTemplateFor(id) {
|
|
171
|
-
return
|
|
189
|
+
return this.tabDirectiveById().get(id)?.labelTemplate()?.templateRef ?? null;
|
|
172
190
|
}
|
|
173
191
|
contentTemplateFor(id) {
|
|
174
|
-
return
|
|
192
|
+
return this.tabDirectiveById().get(id)?.contentTemplate()?.templateRef ?? null;
|
|
175
193
|
}
|
|
176
194
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
177
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTabGroup, isStandalone: true, selector: "cngx-tab-group", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-roledescription": "announcements.tabsRoleDescription()", "attr.aria-orientation": "presenter.orientation()", "attr.data-orientation": "presenter.orientation()", "attr.aria-label": "announcements.resolvedAriaLabel()", "attr.aria-labelledby": "ariaLabelledBy()", "class.cngx-tabs": "true" } }, providers: [{ provide: CNGX_TAB_PANEL_HOST, useExisting: CngxTabGroup }], queries: [{ propertyName: "tabDirectives", predicate: CngxTab, descendants: true, isSignal: true }, { propertyName: "errorBadgeSlot", first: true, predicate: CngxTabErrorBadge, descendants: true, isSignal: true }, { propertyName: "rejectionIconSlot", first: true, predicate: CngxTabRejectionIcon, descendants: true, isSignal: true }, { propertyName: "busySpinnerSlot", first: true, predicate: CngxTabBusySpinner, descendants: true, isSignal: true }], exportAs: ["cngxTabGroup"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter, inputs: ["activeIndex", "activeIndex", "orientation", "orientation", "loop", "loop", "commitAction", "commitAction", "commitMode", "commitMode"], outputs: ["activeIndexChange", "activeIndexChange"] }, { directive: i2.CngxRovingTabindex, inputs: ["orientation", "orientation", "loop", "loop"] }, { directive: i2.CngxFocusRestore }], ngImport: i0, template: "<div class=\"cngx-tabs__strip-wrapper\">\n@let failedIdx = presenter.lastFailedIndex();\n<div\n class=\"cngx-tabs__strip\"\n role=\"tablist\"\n [attr.aria-orientation]=\"presenter.orientation()\"\n>\n @for (tab of tabs(); track tab.id; let i = $index) {\n <button\n type=\"button\"\n cngxRovingItem\n class=\"cngx-tabs__tab\"\n [class.cngx-tab--rejected]=\"failedIdx === i\"\n role=\"tab\"\n [id]=\"tabHeaderId(tab)\"\n [attr.aria-label]=\"announcements.tabAriaLabel(tab, i + 1)\"\n [attr.aria-selected]=\"isSelected(tab) ? 'true' : 'false'\"\n [attr.aria-controls]=\"tabPanelId(tab)\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : null\"\n [attr.aria-busy]=\"isTabBusy(tab) ? 'true' : null\"\n [attr.aria-describedby]=\"tabDescriptorId(tab)\"\n [cngxRovingItemDisabled]=\"tab.disabled()\"\n (click)=\"handleHeaderClick(tab)\"\n >\n <span class=\"cngx-tabs__label\">\n @let labelTpl = labelTemplateFor(tab.id);\n @if (labelTpl) {\n <ng-container *ngTemplateOutlet=\"labelTpl\"></ng-container>\n } @else {\n {{ tab.label() }}\n }\n </span>\n @if (showErrorBadge(tab)) {\n @let errorBadgeTpl = templates.errorBadge();\n @if (errorBadgeTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n errorBadgeTpl;\n context: errorBadgeContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__badge\" aria-hidden=\"true\">{{\n glyphs.errorBadge\n }}</span>\n }\n }\n @if (failedIdx === i) {\n @let rejectionIconTpl = templates.rejectionIcon();\n @if (rejectionIconTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n rejectionIconTpl;\n context: rejectionIconContextFor(i)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__rejection-icon\" aria-hidden=\"true\">{{\n glyphs.rejectionIcon\n }}</span>\n }\n }\n @if (isTabBusy(tab)) {\n @let busySpinnerTpl = templates.busySpinner();\n @if (busySpinnerTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n busySpinnerTpl;\n context: busySpinnerContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__busy-spinner\" aria-hidden=\"true\"></span>\n }\n }\n <span class=\"cngx-sr-only\" [id]=\"tabDescriptorId(tab)\">{{\n announcements.statusPhrase(tab)\n }}</span>\n </button>\n }\n</div>\n<ng-content select=\"cngx-tab-overflow\"></ng-content>\n</div>\n\n<div class=\"cngx-tabs__panels\">\n @for (tab of tabs(); track tab.id) {\n <div\n class=\"cngx-tabs__panel\"\n role=\"tabpanel\"\n [id]=\"tabPanelId(tab)\"\n [attr.aria-labelledby]=\"tabHeaderId(tab)\"\n [attr.aria-roledescription]=\"announcements.tabPanelRoleDescription()\"\n [hidden]=\"!isSelected(tab)\"\n >\n @let contentTpl = contentTemplateFor(tab.id);\n @if (contentTpl) {\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n }\n </div>\n }\n</div>\n\n<span class=\"cngx-tabs__live-region cngx-sr-only\" cngxLiveRegion>{{\n announcements.liveAnnouncement()\n}}</span>\n\n<!--\n Generic slot for opt-in skin sub-components other than the\n overflow molecule (which projects into the strip-wrapper via the\n named `select=\"cngx-tab-overflow\"` slot above). Projected content\n sees `CNGX_TAB_PANEL_HOST` via the organism's provider, so\n molecules inject the contract without reaching for the concrete\n `CngxTabGroup` class.\n-->\n<ng-content></ng-content>\n", styles: [":host{display:block}.cngx-tabs__strip-wrapper{display:flex;flex-direction:row;align-items:stretch;position:relative}.cngx-tabs__strip{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;flex:1 1 auto;min-width:0;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-strip-padding, .5rem 0);background:var(--cngx-tab-strip-bg, transparent);overflow-x:hidden;overflow-y:hidden;scroll-snap-type:x proximity}.cngx-tabs__tab{display:inline-flex;align-items:center;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-padding, .5rem .75rem);border:0;background:var(--cngx-tab-bg, transparent);color:var(--cngx-tab-color, currentColor);cursor:pointer;font:inherit;text-align:start;white-space:nowrap;scroll-snap-align:start}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color, currentColor)}.cngx-tabs__tab[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-tab-disabled-opacity, .55)}.cngx-tabs__tab:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}.cngx-tabs__tab[aria-busy=true]{cursor:progress}.cngx-tabs__label{flex:1 1 auto;min-width:0}.cngx-tabs__badge{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;background:var(--cngx-tab-error-badge-color, #c62828);margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__busy-spinner{display:inline-block;width:var(--cngx-tab-busy-spinner-size, 1rem);height:var(--cngx-tab-busy-spinner-size, 1rem);border:2px solid transparent;border-top-color:var(--cngx-tab-busy-spinner-color, currentColor);border-right-color:var(--cngx-tab-busy-spinner-color, currentColor);border-radius:50%;flex:0 0 auto;margin-inline-start:var(--cngx-tab-gap, .5rem);animation:cngx-tabs-spin .75s linear infinite}@keyframes cngx-tabs-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.cngx-tabs__panels{display:block}.cngx-tabs__panel{display:block;padding:var(--cngx-tab-padding, .5rem .75rem)}.cngx-tabs__panel[hidden]{display:none}.cngx-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}:host([data-orientation=\"vertical\"]){display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:var(--cngx-tab-gap, .5rem);align-items:start}:host([data-orientation=\"vertical\"]) .cngx-tabs__strip{flex-direction:column;flex-wrap:nowrap;overflow-x:hidden;overflow-y:auto;scroll-snap-type:y proximity}:host([data-orientation=\"vertical\"]) .cngx-tabs__tab{scroll-snap-align:start;white-space:normal}@media(prefers-reduced-motion:reduce){.cngx-tabs__busy-spinner{animation:none!important}}.cngx-tabs__rejection-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:var(--cngx-tab-rejection-icon-size, 1.25rem);height:var(--cngx-tab-rejection-icon-size, 1.25rem);border-radius:50%;background:var(--cngx-tab-rejection-icon-color, #c62828);color:var(--cngx-tab-rejection-icon-text, #fff);font-size:var(--cngx-tab-rejection-icon-font-size, .875rem);font-weight:700;line-height:1;margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__tab.cngx-tab--rejected{outline:var( --cngx-tab-rejected-outline, 2px solid var(--cngx-tab-rejection-icon-color, #c62828) );outline-offset:var(--cngx-tab-rejected-outline-offset, 1px)}@media(prefers-reduced-motion:no-preference){.cngx-tabs__tab.cngx-tab--rejected{animation:cngx-tab-pulse-error var(--cngx-tab-rejected-pulse-duration, .6s) ease-out}@keyframes cngx-tab-pulse-error{0%{background:var(--cngx-tab-bg, transparent)}50%{background:var(--cngx-tab-rejected-pulse-bg, rgba(198, 40, 40, .18))}to{background:var(--cngx-tab-bg, transparent)}}}\n", ":host{font:inherit}.cngx-tabs__strip{border-bottom:var(--cngx-tab-strip-border, 1px solid currentColor)}.cngx-tabs__tab{position:relative;border-bottom:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-bottom:calc(var(--cngx-tab-indicator-thickness, 2px) * -1);transition:color var(--cngx-tab-transition-duration, .15s) ease,border-color var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]){color:var(--cngx-tab-hover-color, var(--cngx-tab-active-color))}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color);border-bottom-color:var(--cngx-tab-active-indicator-color, currentColor)}:host([data-orientation=\"vertical\"]) .cngx-tabs__strip{border-bottom:0;border-inline-end:var(--cngx-tab-strip-border, 1px solid currentColor)}:host([data-orientation=\"vertical\"]) .cngx-tabs__tab{border-bottom:0;margin-bottom:0;border-inline-end:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-inline-end:calc(var(--cngx-tab-indicator-thickness, 2px) * -1)}:host([data-orientation=\"vertical\"]) .cngx-tabs__tab[aria-selected=true]{border-inline-end-color:var( --cngx-tab-active-indicator-color, currentColor )}.cngx-tabs__badge{width:var(--cngx-tab-badge-size, 1.25rem);height:var(--cngx-tab-badge-size, 1.25rem);border-radius:50%;color:var(--cngx-tab-error-badge-text-color, white);font-size:var(--cngx-tab-badge-font-size, .75em);font-weight:var(--cngx-tab-badge-font-weight, 700);line-height:1}@media(prefers-reduced-motion:reduce){.cngx-tabs__tab{transition:none!important}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CngxLiveRegion, selector: "[cngxLiveRegion]", inputs: ["politeness", "atomic", "relevant"], exportAs: ["cngxLiveRegion"] }, { kind: "directive", type: CngxRovingItem, selector: "[cngxRovingItem]", inputs: ["cngxRovingItemDisabled"], exportAs: ["cngxRovingItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
195
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTabGroup, isStandalone: true, selector: "cngx-tab-group", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-roledescription": "announcements.tabsRoleDescription()", "attr.aria-orientation": "presenter.orientation()", "attr.data-orientation": "presenter.orientation()", "attr.aria-label": "announcements.resolvedAriaLabel()", "attr.aria-labelledby": "ariaLabelledBy()", "class.cngx-tabs": "true" }, classAttribute: "cngx-tab-group" }, providers: [{ provide: CNGX_TAB_PANEL_HOST, useExisting: CngxTabGroup }], queries: [{ propertyName: "tabDirectives", predicate: CngxTab, descendants: true, isSignal: true }, { propertyName: "errorBadgeSlot", first: true, predicate: CngxTabErrorBadge, descendants: true, isSignal: true }, { propertyName: "rejectionIconSlot", first: true, predicate: CngxTabRejectionIcon, descendants: true, isSignal: true }, { propertyName: "busySpinnerSlot", first: true, predicate: CngxTabBusySpinner, descendants: true, isSignal: true }], exportAs: ["cngxTabGroup"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter, inputs: ["activeIndex", "activeIndex", "orientation", "orientation", "loop", "loop", "commitAction", "commitAction", "commitMode", "commitMode"], outputs: ["activeIndexChange", "activeIndexChange"] }, { directive: i2.CngxRovingTabindex, inputs: ["orientation", "orientation", "loop", "loop"] }, { directive: i2.CngxFocusRestore }], ngImport: i0, template: "<div class=\"cngx-tabs__strip-wrapper\">\n@let failedIdx = presenter.lastFailedIndex();\n<div\n class=\"cngx-tabs__strip\"\n role=\"tablist\"\n [attr.aria-orientation]=\"presenter.orientation()\"\n>\n @for (tab of tabs(); track tab.id; let i = $index) {\n <button\n type=\"button\"\n cngxRovingItem\n class=\"cngx-tabs__tab\"\n [class.cngx-tab--rejected]=\"failedIdx === i\"\n role=\"tab\"\n [id]=\"tabHeaderId(tab)\"\n [attr.aria-label]=\"announcements.tabAriaLabel(tab, i + 1)\"\n [attr.aria-selected]=\"isSelected(tab) ? 'true' : 'false'\"\n [attr.aria-controls]=\"tabPanelId(tab)\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : null\"\n [attr.aria-busy]=\"isTabBusy(tab) ? 'true' : null\"\n [attr.aria-describedby]=\"tabDescriptorId(tab)\"\n [cngxRovingItemDisabled]=\"tab.disabled()\"\n (click)=\"handleHeaderClick(tab)\"\n >\n <span class=\"cngx-tabs__label\">\n @let labelTpl = labelTemplateFor(tab.id);\n @if (labelTpl) {\n <ng-container *ngTemplateOutlet=\"labelTpl\"></ng-container>\n } @else {\n {{ tab.label() }}\n }\n </span>\n @if (showErrorBadge(tab)) {\n @let errorBadgeTpl = templates.errorBadge();\n @if (errorBadgeTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n errorBadgeTpl;\n context: errorBadgeContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__badge\" aria-hidden=\"true\">{{\n glyphs.errorBadge\n }}</span>\n }\n }\n @if (failedIdx === i) {\n @let rejectionIconTpl = templates.rejectionIcon();\n @if (rejectionIconTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n rejectionIconTpl;\n context: rejectionIconContextFor(i)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__rejection-icon\" aria-hidden=\"true\">{{\n glyphs.rejectionIcon\n }}</span>\n }\n }\n @if (isTabBusy(tab)) {\n @let busySpinnerTpl = templates.busySpinner();\n @if (busySpinnerTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n busySpinnerTpl;\n context: busySpinnerContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__busy-spinner\" aria-hidden=\"true\"></span>\n }\n }\n <span class=\"cngx-sr-only\" [id]=\"tabDescriptorId(tab)\">{{\n announcements.statusPhrase(tab)\n }}</span>\n </button>\n }\n</div>\n<ng-content select=\"cngx-tab-overflow\"></ng-content>\n</div>\n\n<div class=\"cngx-tabs__panels\">\n @for (tab of tabs(); track tab.id) {\n <div\n class=\"cngx-tabs__panel\"\n role=\"tabpanel\"\n [id]=\"tabPanelId(tab)\"\n [attr.aria-labelledby]=\"tabHeaderId(tab)\"\n [attr.aria-roledescription]=\"announcements.tabPanelRoleDescription()\"\n [hidden]=\"!isSelected(tab)\"\n >\n @let contentTpl = contentTemplateFor(tab.id);\n @if (contentTpl) {\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n }\n </div>\n }\n</div>\n\n<span class=\"cngx-tabs__live-region cngx-sr-only\" cngxLiveRegion>{{\n announcements.liveAnnouncement()\n}}</span>\n\n<!--\n Generic slot for opt-in skin sub-components other than the\n overflow molecule (which projects into the strip-wrapper via the\n named `select=\"cngx-tab-overflow\"` slot above). Projected content\n sees `CNGX_TAB_PANEL_HOST` via the organism's provider, so\n molecules inject the contract without reaching for the concrete\n `CngxTabGroup` class.\n-->\n<ng-content></ng-content>\n", styles: ["@layer cngx.tokens{@property --cngx-tab-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-tab-strip-padding{syntax: \"*\"; inherits: false; initial-value: .5rem 0;}@property --cngx-tab-strip-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-padding{syntax: \"*\"; inherits: false; initial-value: .5rem .75rem;}@property --cngx-tab-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-active-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-active-indicator-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-tab-active-indicator-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-tab-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .55;}@property --cngx-tab-focus-ring{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-tab-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-tab-error-badge-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25);}@property --cngx-tab-busy-spinner-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-tab-busy-spinner-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-rejection-icon-size{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-tab-rejection-icon-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25);}@property --cngx-tab-rejection-icon-text{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-tab-rejection-icon-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-tab-rejected-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.45 .15 25);}@property --cngx-tab-rejected-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@property --cngx-tab-rejected-pulse-duration{syntax: \"<time>\"; inherits: false; initial-value: .6s;}@property --cngx-tab-rejected-pulse-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25 / .18);}:root{--cngx-tab-active-indicator-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-tab-group{display:block}.cngx-tabs__strip-wrapper{display:flex;flex-direction:row;align-items:stretch;position:relative}.cngx-tabs__strip{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;flex:1 1 auto;min-width:0;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-strip-padding, .5rem 0);background:var(--cngx-tab-strip-bg, transparent);overflow-x:hidden;overflow-y:hidden;scroll-snap-type:x proximity}.cngx-tabs__tab{display:inline-flex;align-items:center;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-padding, .5rem .75rem);border:0;background:var(--cngx-tab-bg, transparent);color:var(--cngx-tab-color, currentColor);cursor:pointer;font:inherit;text-align:start;white-space:nowrap;scroll-snap-align:start}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color, currentColor);box-shadow:inset 0 calc(var(--cngx-tab-active-indicator-width, 2px) * -1) 0 var(--cngx-tab-active-indicator-color, oklch(.66 .19 50))}.cngx-tabs__tab[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-tab-disabled-opacity, .55)}.cngx-tabs__tab:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}.cngx-tabs__tab[aria-busy=true]{cursor:progress}.cngx-tabs__label{flex:1 1 auto;min-width:0}.cngx-tabs__badge{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;background:var(--cngx-tab-error-badge-color, oklch(.45 .15 25));margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__busy-spinner{display:inline-block;width:var(--cngx-tab-busy-spinner-size, 1rem);height:var(--cngx-tab-busy-spinner-size, 1rem);border:2px solid transparent;border-top-color:var(--cngx-tab-busy-spinner-color, currentColor);border-right-color:var(--cngx-tab-busy-spinner-color, currentColor);border-radius:50%;flex:0 0 auto;margin-inline-start:var(--cngx-tab-gap, .5rem);animation:cngx-tabs-spin .75s linear infinite}.cngx-tabs__panels{display:block}.cngx-tabs__panel{display:block;padding:var(--cngx-tab-padding, .5rem .75rem)}.cngx-tabs__panel[hidden]{display:none}.cngx-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}cngx-tab-group[data-orientation=vertical]{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:var(--cngx-tab-gap, .5rem);align-items:start}cngx-tab-group[data-orientation=vertical] .cngx-tabs__strip{flex-direction:column;flex-wrap:nowrap;overflow-x:hidden;overflow-y:auto;scroll-snap-type:y proximity}cngx-tab-group[data-orientation=vertical] .cngx-tabs__tab{scroll-snap-align:start;white-space:normal}@media(prefers-reduced-motion:reduce){.cngx-tabs__busy-spinner{animation:none!important}}.cngx-tabs__rejection-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:var(--cngx-tab-rejection-icon-size, 1.25rem);height:var(--cngx-tab-rejection-icon-size, 1.25rem);border-radius:50%;background:var(--cngx-tab-rejection-icon-color, oklch(.45 .15 25));color:var(--cngx-tab-rejection-icon-text, oklch(1 0 0));font-size:var(--cngx-tab-rejection-icon-font-size, .875rem);font-weight:700;line-height:1;margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__tab.cngx-tab--rejected{outline:var( --cngx-tab-rejected-outline, 2px solid var(--cngx-tab-rejection-icon-color, oklch(.45 .15 25)) );outline-offset:var(--cngx-tab-rejected-outline-offset, 1px)}@media(prefers-reduced-motion:no-preference){.cngx-tabs__tab.cngx-tab--rejected{animation:cngx-tab-pulse-error var(--cngx-tab-rejected-pulse-duration, .6s) ease-out}}}@keyframes cngx-tabs-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes cngx-tab-pulse-error{0%{background:var(--cngx-tab-bg, transparent)}50%{background:var(--cngx-tab-rejected-pulse-bg, oklch(.45 .15 25 / .18))}to{background:var(--cngx-tab-bg, transparent)}}\n", "@layer cngx.tokens{@property --cngx-tab-strip-border{syntax: \"*\"; inherits: false; initial-value: 1px solid currentColor;}@property --cngx-tab-indicator-thickness{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-tab-transition-duration{syntax: \"<time>\"; inherits: false; initial-value: .15s;}@property --cngx-tab-hover-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-active-indicator-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-badge-size{syntax: \"<length>\"; inherits: false; initial-value: 1.25rem;}@property --cngx-tab-error-badge-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-tab-badge-font-size{syntax: \"*\"; inherits: false; initial-value: .75em;}@property --cngx-tab-badge-font-weight{syntax: \"<number>\"; inherits: false; initial-value: 700;}}@layer cngx.components{@scope(.cngx-tab-group){:scope{font:inherit}.cngx-tabs__strip{border-bottom:var(--cngx-tab-strip-border, 1px solid currentColor)}.cngx-tabs__tab{position:relative;border-bottom:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-bottom:calc(var(--cngx-tab-indicator-thickness, 2px) * -1);transition:color var(--cngx-tab-transition-duration, .15s) ease,border-color var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]){color:var(--cngx-tab-hover-color, var(--cngx-tab-active-color))}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color);border-bottom-color:var(--cngx-tab-active-indicator-color, currentColor)}:scope[data-orientation=vertical] .cngx-tabs__strip{border-bottom:0;border-inline-end:var(--cngx-tab-strip-border, 1px solid currentColor)}:scope[data-orientation=vertical] .cngx-tabs__tab{border-bottom:0;margin-bottom:0;border-inline-end:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-inline-end:calc(var(--cngx-tab-indicator-thickness, 2px) * -1)}:scope[data-orientation=vertical] .cngx-tabs__tab[aria-selected=true]{border-inline-end-color:var(--cngx-tab-active-indicator-color, currentColor)}.cngx-tabs__badge{width:var(--cngx-tab-badge-size, 1.25rem);height:var(--cngx-tab-badge-size, 1.25rem);border-radius:50%;color:var(--cngx-tab-error-badge-text-color, oklch(1 0 0));font-size:var(--cngx-tab-badge-font-size, .75em);font-weight:var(--cngx-tab-badge-font-weight, 700);line-height:1}@media(prefers-reduced-motion:reduce){.cngx-tabs__tab{transition:none!important}}}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CngxLiveRegion, selector: "[cngxLiveRegion]", inputs: ["politeness", "atomic", "relevant"], exportAs: ["cngxLiveRegion"] }, { kind: "directive", type: CngxRovingItem, selector: "[cngxRovingItem]", inputs: ["cngxRovingItemDisabled"], exportAs: ["cngxRovingItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
178
196
|
}
|
|
179
197
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabGroup, decorators: [{
|
|
180
198
|
type: Component,
|
|
181
|
-
args: [{ selector: 'cngx-tab-group', exportAs: 'cngxTabGroup', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, CngxLiveRegion, CngxRovingItem], hostDirectives: [
|
|
199
|
+
args: [{ selector: 'cngx-tab-group', exportAs: 'cngxTabGroup', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, CngxLiveRegion, CngxRovingItem], encapsulation: ViewEncapsulation.None, hostDirectives: [
|
|
182
200
|
{
|
|
183
201
|
directive: CngxTabGroupPresenter,
|
|
184
|
-
inputs: [
|
|
185
|
-
'activeIndex',
|
|
186
|
-
'orientation',
|
|
187
|
-
'loop',
|
|
188
|
-
'commitAction',
|
|
189
|
-
'commitMode',
|
|
190
|
-
],
|
|
202
|
+
inputs: ['activeIndex', 'orientation', 'loop', 'commitAction', 'commitMode'],
|
|
191
203
|
outputs: ['activeIndexChange'],
|
|
192
204
|
},
|
|
193
205
|
{
|
|
@@ -196,6 +208,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
196
208
|
},
|
|
197
209
|
{ directive: CngxFocusRestore },
|
|
198
210
|
], providers: [{ provide: CNGX_TAB_PANEL_HOST, useExisting: CngxTabGroup }], host: {
|
|
211
|
+
class: 'cngx-tab-group',
|
|
199
212
|
role: 'group',
|
|
200
213
|
'[attr.aria-roledescription]': 'announcements.tabsRoleDescription()',
|
|
201
214
|
'[attr.aria-orientation]': 'presenter.orientation()',
|
|
@@ -203,12 +216,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
203
216
|
'[attr.aria-label]': 'announcements.resolvedAriaLabel()',
|
|
204
217
|
'[attr.aria-labelledby]': 'ariaLabelledBy()',
|
|
205
218
|
'[class.cngx-tabs]': 'true',
|
|
206
|
-
}, template: "<div class=\"cngx-tabs__strip-wrapper\">\n@let failedIdx = presenter.lastFailedIndex();\n<div\n class=\"cngx-tabs__strip\"\n role=\"tablist\"\n [attr.aria-orientation]=\"presenter.orientation()\"\n>\n @for (tab of tabs(); track tab.id; let i = $index) {\n <button\n type=\"button\"\n cngxRovingItem\n class=\"cngx-tabs__tab\"\n [class.cngx-tab--rejected]=\"failedIdx === i\"\n role=\"tab\"\n [id]=\"tabHeaderId(tab)\"\n [attr.aria-label]=\"announcements.tabAriaLabel(tab, i + 1)\"\n [attr.aria-selected]=\"isSelected(tab) ? 'true' : 'false'\"\n [attr.aria-controls]=\"tabPanelId(tab)\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : null\"\n [attr.aria-busy]=\"isTabBusy(tab) ? 'true' : null\"\n [attr.aria-describedby]=\"tabDescriptorId(tab)\"\n [cngxRovingItemDisabled]=\"tab.disabled()\"\n (click)=\"handleHeaderClick(tab)\"\n >\n <span class=\"cngx-tabs__label\">\n @let labelTpl = labelTemplateFor(tab.id);\n @if (labelTpl) {\n <ng-container *ngTemplateOutlet=\"labelTpl\"></ng-container>\n } @else {\n {{ tab.label() }}\n }\n </span>\n @if (showErrorBadge(tab)) {\n @let errorBadgeTpl = templates.errorBadge();\n @if (errorBadgeTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n errorBadgeTpl;\n context: errorBadgeContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__badge\" aria-hidden=\"true\">{{\n glyphs.errorBadge\n }}</span>\n }\n }\n @if (failedIdx === i) {\n @let rejectionIconTpl = templates.rejectionIcon();\n @if (rejectionIconTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n rejectionIconTpl;\n context: rejectionIconContextFor(i)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__rejection-icon\" aria-hidden=\"true\">{{\n glyphs.rejectionIcon\n }}</span>\n }\n }\n @if (isTabBusy(tab)) {\n @let busySpinnerTpl = templates.busySpinner();\n @if (busySpinnerTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n busySpinnerTpl;\n context: busySpinnerContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__busy-spinner\" aria-hidden=\"true\"></span>\n }\n }\n <span class=\"cngx-sr-only\" [id]=\"tabDescriptorId(tab)\">{{\n announcements.statusPhrase(tab)\n }}</span>\n </button>\n }\n</div>\n<ng-content select=\"cngx-tab-overflow\"></ng-content>\n</div>\n\n<div class=\"cngx-tabs__panels\">\n @for (tab of tabs(); track tab.id) {\n <div\n class=\"cngx-tabs__panel\"\n role=\"tabpanel\"\n [id]=\"tabPanelId(tab)\"\n [attr.aria-labelledby]=\"tabHeaderId(tab)\"\n [attr.aria-roledescription]=\"announcements.tabPanelRoleDescription()\"\n [hidden]=\"!isSelected(tab)\"\n >\n @let contentTpl = contentTemplateFor(tab.id);\n @if (contentTpl) {\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n }\n </div>\n }\n</div>\n\n<span class=\"cngx-tabs__live-region cngx-sr-only\" cngxLiveRegion>{{\n announcements.liveAnnouncement()\n}}</span>\n\n<!--\n Generic slot for opt-in skin sub-components other than the\n overflow molecule (which projects into the strip-wrapper via the\n named `select=\"cngx-tab-overflow\"` slot above). Projected content\n sees `CNGX_TAB_PANEL_HOST` via the organism's provider, so\n molecules inject the contract without reaching for the concrete\n `CngxTabGroup` class.\n-->\n<ng-content></ng-content>\n", styles: [":host{display:block}.cngx-tabs__strip-wrapper{display:flex;flex-direction:row;align-items:stretch;position:relative}.cngx-tabs__strip{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;flex:1 1 auto;min-width:0;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-strip-padding, .5rem 0);background:var(--cngx-tab-strip-bg, transparent);overflow-x:hidden;overflow-y:hidden;scroll-snap-type:x proximity}.cngx-tabs__tab{display:inline-flex;align-items:center;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-padding, .5rem .75rem);border:0;background:var(--cngx-tab-bg, transparent);color:var(--cngx-tab-color, currentColor);cursor:pointer;font:inherit;text-align:start;white-space:nowrap;scroll-snap-align:start}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color, currentColor)}.cngx-tabs__tab[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-tab-disabled-opacity, .55)}.cngx-tabs__tab:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}.cngx-tabs__tab[aria-busy=true]{cursor:progress}.cngx-tabs__label{flex:1 1 auto;min-width:0}.cngx-tabs__badge{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;background:var(--cngx-tab-error-badge-color, #c62828);margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__busy-spinner{display:inline-block;width:var(--cngx-tab-busy-spinner-size, 1rem);height:var(--cngx-tab-busy-spinner-size, 1rem);border:2px solid transparent;border-top-color:var(--cngx-tab-busy-spinner-color, currentColor);border-right-color:var(--cngx-tab-busy-spinner-color, currentColor);border-radius:50%;flex:0 0 auto;margin-inline-start:var(--cngx-tab-gap, .5rem);animation:cngx-tabs-spin .75s linear infinite}@keyframes cngx-tabs-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.cngx-tabs__panels{display:block}.cngx-tabs__panel{display:block;padding:var(--cngx-tab-padding, .5rem .75rem)}.cngx-tabs__panel[hidden]{display:none}.cngx-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}:host([data-orientation=\"vertical\"]){display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:var(--cngx-tab-gap, .5rem);align-items:start}:host([data-orientation=\"vertical\"]) .cngx-tabs__strip{flex-direction:column;flex-wrap:nowrap;overflow-x:hidden;overflow-y:auto;scroll-snap-type:y proximity}:host([data-orientation=\"vertical\"]) .cngx-tabs__tab{scroll-snap-align:start;white-space:normal}@media(prefers-reduced-motion:reduce){.cngx-tabs__busy-spinner{animation:none!important}}.cngx-tabs__rejection-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:var(--cngx-tab-rejection-icon-size, 1.25rem);height:var(--cngx-tab-rejection-icon-size, 1.25rem);border-radius:50%;background:var(--cngx-tab-rejection-icon-color, #c62828);color:var(--cngx-tab-rejection-icon-text, #fff);font-size:var(--cngx-tab-rejection-icon-font-size, .875rem);font-weight:700;line-height:1;margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__tab.cngx-tab--rejected{outline:var( --cngx-tab-rejected-outline, 2px solid var(--cngx-tab-rejection-icon-color, #c62828) );outline-offset:var(--cngx-tab-rejected-outline-offset, 1px)}@media(prefers-reduced-motion:no-preference){.cngx-tabs__tab.cngx-tab--rejected{animation:cngx-tab-pulse-error var(--cngx-tab-rejected-pulse-duration, .6s) ease-out}@keyframes cngx-tab-pulse-error{0%{background:var(--cngx-tab-bg, transparent)}50%{background:var(--cngx-tab-rejected-pulse-bg, rgba(198, 40, 40, .18))}to{background:var(--cngx-tab-bg, transparent)}}}\n", ":host{font:inherit}.cngx-tabs__strip{border-bottom:var(--cngx-tab-strip-border, 1px solid currentColor)}.cngx-tabs__tab{position:relative;border-bottom:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-bottom:calc(var(--cngx-tab-indicator-thickness, 2px) * -1);transition:color var(--cngx-tab-transition-duration, .15s) ease,border-color var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]){color:var(--cngx-tab-hover-color, var(--cngx-tab-active-color))}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color);border-bottom-color:var(--cngx-tab-active-indicator-color, currentColor)}:host([data-orientation=\"vertical\"]) .cngx-tabs__strip{border-bottom:0;border-inline-end:var(--cngx-tab-strip-border, 1px solid currentColor)}:host([data-orientation=\"vertical\"]) .cngx-tabs__tab{border-bottom:0;margin-bottom:0;border-inline-end:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-inline-end:calc(var(--cngx-tab-indicator-thickness, 2px) * -1)}:host([data-orientation=\"vertical\"]) .cngx-tabs__tab[aria-selected=true]{border-inline-end-color:var( --cngx-tab-active-indicator-color, currentColor )}.cngx-tabs__badge{width:var(--cngx-tab-badge-size, 1.25rem);height:var(--cngx-tab-badge-size, 1.25rem);border-radius:50%;color:var(--cngx-tab-error-badge-text-color, white);font-size:var(--cngx-tab-badge-font-size, .75em);font-weight:var(--cngx-tab-badge-font-weight, 700);line-height:1}@media(prefers-reduced-motion:reduce){.cngx-tabs__tab{transition:none!important}}\n"] }]
|
|
219
|
+
}, template: "<div class=\"cngx-tabs__strip-wrapper\">\n@let failedIdx = presenter.lastFailedIndex();\n<div\n class=\"cngx-tabs__strip\"\n role=\"tablist\"\n [attr.aria-orientation]=\"presenter.orientation()\"\n>\n @for (tab of tabs(); track tab.id; let i = $index) {\n <button\n type=\"button\"\n cngxRovingItem\n class=\"cngx-tabs__tab\"\n [class.cngx-tab--rejected]=\"failedIdx === i\"\n role=\"tab\"\n [id]=\"tabHeaderId(tab)\"\n [attr.aria-label]=\"announcements.tabAriaLabel(tab, i + 1)\"\n [attr.aria-selected]=\"isSelected(tab) ? 'true' : 'false'\"\n [attr.aria-controls]=\"tabPanelId(tab)\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : null\"\n [attr.aria-busy]=\"isTabBusy(tab) ? 'true' : null\"\n [attr.aria-describedby]=\"tabDescriptorId(tab)\"\n [cngxRovingItemDisabled]=\"tab.disabled()\"\n (click)=\"handleHeaderClick(tab)\"\n >\n <span class=\"cngx-tabs__label\">\n @let labelTpl = labelTemplateFor(tab.id);\n @if (labelTpl) {\n <ng-container *ngTemplateOutlet=\"labelTpl\"></ng-container>\n } @else {\n {{ tab.label() }}\n }\n </span>\n @if (showErrorBadge(tab)) {\n @let errorBadgeTpl = templates.errorBadge();\n @if (errorBadgeTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n errorBadgeTpl;\n context: errorBadgeContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__badge\" aria-hidden=\"true\">{{\n glyphs.errorBadge\n }}</span>\n }\n }\n @if (failedIdx === i) {\n @let rejectionIconTpl = templates.rejectionIcon();\n @if (rejectionIconTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n rejectionIconTpl;\n context: rejectionIconContextFor(i)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__rejection-icon\" aria-hidden=\"true\">{{\n glyphs.rejectionIcon\n }}</span>\n }\n }\n @if (isTabBusy(tab)) {\n @let busySpinnerTpl = templates.busySpinner();\n @if (busySpinnerTpl) {\n <ng-container\n *ngTemplateOutlet=\"\n busySpinnerTpl;\n context: busySpinnerContextFor(tab)\n \"\n ></ng-container>\n } @else {\n <span class=\"cngx-tabs__busy-spinner\" aria-hidden=\"true\"></span>\n }\n }\n <span class=\"cngx-sr-only\" [id]=\"tabDescriptorId(tab)\">{{\n announcements.statusPhrase(tab)\n }}</span>\n </button>\n }\n</div>\n<ng-content select=\"cngx-tab-overflow\"></ng-content>\n</div>\n\n<div class=\"cngx-tabs__panels\">\n @for (tab of tabs(); track tab.id) {\n <div\n class=\"cngx-tabs__panel\"\n role=\"tabpanel\"\n [id]=\"tabPanelId(tab)\"\n [attr.aria-labelledby]=\"tabHeaderId(tab)\"\n [attr.aria-roledescription]=\"announcements.tabPanelRoleDescription()\"\n [hidden]=\"!isSelected(tab)\"\n >\n @let contentTpl = contentTemplateFor(tab.id);\n @if (contentTpl) {\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n }\n </div>\n }\n</div>\n\n<span class=\"cngx-tabs__live-region cngx-sr-only\" cngxLiveRegion>{{\n announcements.liveAnnouncement()\n}}</span>\n\n<!--\n Generic slot for opt-in skin sub-components other than the\n overflow molecule (which projects into the strip-wrapper via the\n named `select=\"cngx-tab-overflow\"` slot above). Projected content\n sees `CNGX_TAB_PANEL_HOST` via the organism's provider, so\n molecules inject the contract without reaching for the concrete\n `CngxTabGroup` class.\n-->\n<ng-content></ng-content>\n", styles: ["@layer cngx.tokens{@property --cngx-tab-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-tab-strip-padding{syntax: \"*\"; inherits: false; initial-value: .5rem 0;}@property --cngx-tab-strip-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-padding{syntax: \"*\"; inherits: false; initial-value: .5rem .75rem;}@property --cngx-tab-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-active-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-active-indicator-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-tab-active-indicator-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-tab-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .55;}@property --cngx-tab-focus-ring{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-tab-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-tab-error-badge-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25);}@property --cngx-tab-busy-spinner-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-tab-busy-spinner-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-rejection-icon-size{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-tab-rejection-icon-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25);}@property --cngx-tab-rejection-icon-text{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-tab-rejection-icon-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-tab-rejected-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.45 .15 25);}@property --cngx-tab-rejected-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@property --cngx-tab-rejected-pulse-duration{syntax: \"<time>\"; inherits: false; initial-value: .6s;}@property --cngx-tab-rejected-pulse-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(.45 .15 25 / .18);}:root{--cngx-tab-active-indicator-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-tab-group{display:block}.cngx-tabs__strip-wrapper{display:flex;flex-direction:row;align-items:stretch;position:relative}.cngx-tabs__strip{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;flex:1 1 auto;min-width:0;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-strip-padding, .5rem 0);background:var(--cngx-tab-strip-bg, transparent);overflow-x:hidden;overflow-y:hidden;scroll-snap-type:x proximity}.cngx-tabs__tab{display:inline-flex;align-items:center;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-padding, .5rem .75rem);border:0;background:var(--cngx-tab-bg, transparent);color:var(--cngx-tab-color, currentColor);cursor:pointer;font:inherit;text-align:start;white-space:nowrap;scroll-snap-align:start}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color, currentColor);box-shadow:inset 0 calc(var(--cngx-tab-active-indicator-width, 2px) * -1) 0 var(--cngx-tab-active-indicator-color, oklch(.66 .19 50))}.cngx-tabs__tab[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-tab-disabled-opacity, .55)}.cngx-tabs__tab:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}.cngx-tabs__tab[aria-busy=true]{cursor:progress}.cngx-tabs__label{flex:1 1 auto;min-width:0}.cngx-tabs__badge{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;background:var(--cngx-tab-error-badge-color, oklch(.45 .15 25));margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__busy-spinner{display:inline-block;width:var(--cngx-tab-busy-spinner-size, 1rem);height:var(--cngx-tab-busy-spinner-size, 1rem);border:2px solid transparent;border-top-color:var(--cngx-tab-busy-spinner-color, currentColor);border-right-color:var(--cngx-tab-busy-spinner-color, currentColor);border-radius:50%;flex:0 0 auto;margin-inline-start:var(--cngx-tab-gap, .5rem);animation:cngx-tabs-spin .75s linear infinite}.cngx-tabs__panels{display:block}.cngx-tabs__panel{display:block;padding:var(--cngx-tab-padding, .5rem .75rem)}.cngx-tabs__panel[hidden]{display:none}.cngx-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}cngx-tab-group[data-orientation=vertical]{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:var(--cngx-tab-gap, .5rem);align-items:start}cngx-tab-group[data-orientation=vertical] .cngx-tabs__strip{flex-direction:column;flex-wrap:nowrap;overflow-x:hidden;overflow-y:auto;scroll-snap-type:y proximity}cngx-tab-group[data-orientation=vertical] .cngx-tabs__tab{scroll-snap-align:start;white-space:normal}@media(prefers-reduced-motion:reduce){.cngx-tabs__busy-spinner{animation:none!important}}.cngx-tabs__rejection-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:var(--cngx-tab-rejection-icon-size, 1.25rem);height:var(--cngx-tab-rejection-icon-size, 1.25rem);border-radius:50%;background:var(--cngx-tab-rejection-icon-color, oklch(.45 .15 25));color:var(--cngx-tab-rejection-icon-text, oklch(1 0 0));font-size:var(--cngx-tab-rejection-icon-font-size, .875rem);font-weight:700;line-height:1;margin-inline-start:var(--cngx-tab-gap, .5rem)}.cngx-tabs__tab.cngx-tab--rejected{outline:var( --cngx-tab-rejected-outline, 2px solid var(--cngx-tab-rejection-icon-color, oklch(.45 .15 25)) );outline-offset:var(--cngx-tab-rejected-outline-offset, 1px)}@media(prefers-reduced-motion:no-preference){.cngx-tabs__tab.cngx-tab--rejected{animation:cngx-tab-pulse-error var(--cngx-tab-rejected-pulse-duration, .6s) ease-out}}}@keyframes cngx-tabs-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes cngx-tab-pulse-error{0%{background:var(--cngx-tab-bg, transparent)}50%{background:var(--cngx-tab-rejected-pulse-bg, oklch(.45 .15 25 / .18))}to{background:var(--cngx-tab-bg, transparent)}}\n", "@layer cngx.tokens{@property --cngx-tab-strip-border{syntax: \"*\"; inherits: false; initial-value: 1px solid currentColor;}@property --cngx-tab-indicator-thickness{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-tab-transition-duration{syntax: \"<time>\"; inherits: false; initial-value: .15s;}@property --cngx-tab-hover-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-active-indicator-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-badge-size{syntax: \"<length>\"; inherits: false; initial-value: 1.25rem;}@property --cngx-tab-error-badge-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-tab-badge-font-size{syntax: \"*\"; inherits: false; initial-value: .75em;}@property --cngx-tab-badge-font-weight{syntax: \"<number>\"; inherits: false; initial-value: 700;}}@layer cngx.components{@scope(.cngx-tab-group){:scope{font:inherit}.cngx-tabs__strip{border-bottom:var(--cngx-tab-strip-border, 1px solid currentColor)}.cngx-tabs__tab{position:relative;border-bottom:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-bottom:calc(var(--cngx-tab-indicator-thickness, 2px) * -1);transition:color var(--cngx-tab-transition-duration, .15s) ease,border-color var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]){color:var(--cngx-tab-hover-color, var(--cngx-tab-active-color))}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color);border-bottom-color:var(--cngx-tab-active-indicator-color, currentColor)}:scope[data-orientation=vertical] .cngx-tabs__strip{border-bottom:0;border-inline-end:var(--cngx-tab-strip-border, 1px solid currentColor)}:scope[data-orientation=vertical] .cngx-tabs__tab{border-bottom:0;margin-bottom:0;border-inline-end:var(--cngx-tab-indicator-thickness, 2px) solid transparent;margin-inline-end:calc(var(--cngx-tab-indicator-thickness, 2px) * -1)}:scope[data-orientation=vertical] .cngx-tabs__tab[aria-selected=true]{border-inline-end-color:var(--cngx-tab-active-indicator-color, currentColor)}.cngx-tabs__badge{width:var(--cngx-tab-badge-size, 1.25rem);height:var(--cngx-tab-badge-size, 1.25rem);border-radius:50%;color:var(--cngx-tab-error-badge-text-color, oklch(1 0 0));font-size:var(--cngx-tab-badge-font-size, .75em);font-weight:var(--cngx-tab-badge-font-weight, 700);line-height:1}@media(prefers-reduced-motion:reduce){.cngx-tabs__tab{transition:none!important}}}}\n"] }]
|
|
207
220
|
}], ctorParameters: () => [], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], tabDirectives: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxTab), { ...{
|
|
208
221
|
descendants: true,
|
|
209
222
|
}, isSignal: true }] }], errorBadgeSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabErrorBadge), { isSignal: true }] }], rejectionIconSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabRejectionIcon), { isSignal: true }] }], busySpinnerSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabBusySpinner), { isSignal: true }] }] } });
|
|
210
223
|
|
|
211
|
-
/**
|
|
224
|
+
/**
|
|
225
|
+
* Structural equal for `hiddenTabs` - same ids in same order.
|
|
226
|
+
*
|
|
227
|
+
* @internal
|
|
228
|
+
*/
|
|
212
229
|
function tabIdListEqual(a, b) {
|
|
213
230
|
if (a === b) {
|
|
214
231
|
return true;
|
|
@@ -223,13 +240,19 @@ function tabIdListEqual(a, b) {
|
|
|
223
240
|
}
|
|
224
241
|
return true;
|
|
225
242
|
}
|
|
226
|
-
/**
|
|
243
|
+
/**
|
|
244
|
+
* Auto-open keys for the trigger button (APG combobox).
|
|
245
|
+
*
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
227
248
|
const NAV_OPEN_KEYS = new Set(['ArrowDown', 'ArrowUp', 'Home', 'End']);
|
|
228
249
|
/**
|
|
229
250
|
* Structural equal for `visibilityState`. Without this, the
|
|
230
251
|
* `update((prev) => new Map(prev))` cycle in `handleIntersections`
|
|
231
252
|
* cascades into `hiddenTabs` on every IO fire even when no tab
|
|
232
253
|
* actually flipped visibility.
|
|
254
|
+
*
|
|
255
|
+
* @internal
|
|
233
256
|
*/
|
|
234
257
|
function mapBoolEqual(a, b) {
|
|
235
258
|
if (a === b) {
|
|
@@ -251,12 +274,22 @@ function mapBoolEqual(a, b) {
|
|
|
251
274
|
* organism only via {@link CNGX_TAB_PANEL_HOST}.
|
|
252
275
|
*
|
|
253
276
|
* Visibility is tracked through a native `IntersectionObserver`
|
|
254
|
-
* rooted on the parent strip
|
|
277
|
+
* rooted on the parent strip - `CngxIntersectionObserver` doesn't
|
|
255
278
|
* fit (single-element scope, can't reach sibling `viewChildren`).
|
|
256
|
-
* `threshold: 0`
|
|
279
|
+
* `threshold: 0` - only fully-clipped tabs surface. Combined with
|
|
257
280
|
* the organism's `scrollIntoView` effect this forms the self-healing
|
|
258
281
|
* loop: pick hidden tab -> strip scrolls -> IO fires -> `hiddenTabs`
|
|
259
282
|
* self-trims.
|
|
283
|
+
*
|
|
284
|
+
* @playground Overflow showcase ./examples/overflow-showcase/overflow-showcase.component.ts
|
|
285
|
+
*
|
|
286
|
+
* @category ui/tabs
|
|
287
|
+
* @docsKind primary
|
|
288
|
+
* @wcag AA
|
|
289
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/tabs/tab-overflow.component.ts
|
|
290
|
+
* @since 0.1.0
|
|
291
|
+
* @relatedTo CngxTabGroup, CngxPopover, CngxActiveDescendant
|
|
292
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
260
293
|
*/
|
|
261
294
|
class CngxTabOverflow {
|
|
262
295
|
// Projected via <ng-content>, so DI walks up to the parent's injector.
|
|
@@ -271,7 +304,7 @@ class CngxTabOverflow {
|
|
|
271
304
|
// strip selectors; Material/custom variants swap via providers.
|
|
272
305
|
adapter = inject(CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY)();
|
|
273
306
|
// tab id -> visibility. `undefined` = not yet observed (treat as
|
|
274
|
-
// visible
|
|
307
|
+
// visible - prevents More-button flash on first render).
|
|
275
308
|
// `linkedSignal` prunes stale ids when the tabs list changes;
|
|
276
309
|
// observer re-attach lives in the effect below. `mapBoolEqual`
|
|
277
310
|
// suppresses identity-only re-emissions from the IO callback.
|
|
@@ -297,15 +330,15 @@ class CngxTabOverflow {
|
|
|
297
330
|
hasHiddenTabs = computed(() => this.hiddenTabs().length > 0, { ...(ngDevMode ? { debugName: "hasHiddenTabs" } : /* istanbul ignore next */ {}), equal: Object.is });
|
|
298
331
|
// Counter projected into trigger label + aria-label. Explicit
|
|
299
332
|
// computed isolates `Object.is` distinct-gate from `hiddenTabs`
|
|
300
|
-
// identity churn
|
|
333
|
+
// identity churn - prevents flicker on length-equal re-emissions.
|
|
301
334
|
hiddenCount = computed(() => this.hiddenTabs().length, ...(ngDevMode ? [{ debugName: "hiddenCount" }] : /* istanbul ignore next */ []));
|
|
302
335
|
// ARIA menu-button pattern: <button aria-haspopup="menu"> + popover
|
|
303
336
|
// role="menu". Quick-jump navigation (selectById is not a value
|
|
304
|
-
// commit), so menu/menuitem is correct
|
|
337
|
+
// commit), so menu/menuitem is correct - listbox/option implies
|
|
305
338
|
// persistent aria-selected. WAI-ARIA 1.2 §combobox forbids
|
|
306
339
|
// aria-haspopup="menu", so combobox is deliberately not used.
|
|
307
340
|
adItemId = tabOverflowOptionId;
|
|
308
|
-
// Read first
|
|
341
|
+
// Read first - TS field-init order; downstream fields snapshot off this.
|
|
309
342
|
tabsConfig = injectTabsConfig();
|
|
310
343
|
// 3-stage cascade: directive > config.templates.overflow* > built-in.
|
|
311
344
|
// `contentChild` must be a field-direct initializer (Angular AOT).
|
|
@@ -323,7 +356,7 @@ class CngxTabOverflow {
|
|
|
323
356
|
// Variant-agnostic target -> id lookup. cngx-native uses
|
|
324
357
|
// `${id}-header`, Material `mat-tab-group-N-label-M`.
|
|
325
358
|
targetToHandleId = new WeakMap();
|
|
326
|
-
// IO-debounce knobs
|
|
359
|
+
// IO-debounce knobs - see `CngxTabsConfig.overflowStabilizeMs` /
|
|
327
360
|
// `.overflowMaxDeferMs` for semantics. Captured once at construction.
|
|
328
361
|
stabilizeMs = this.tabsConfig.overflowStabilizeMs ?? 100;
|
|
329
362
|
maxDeferMs = this.tabsConfig.overflowMaxDeferMs ?? 250;
|
|
@@ -333,7 +366,7 @@ class CngxTabOverflow {
|
|
|
333
366
|
// between commits. Drives the max-defer cap.
|
|
334
367
|
firstPendingAt = null;
|
|
335
368
|
// rAF-scheduled IO attach retry. `display: none` toggles do NOT
|
|
336
|
-
// recover
|
|
369
|
+
// recover - unmount/remount is required to re-arm. Policy swap
|
|
337
370
|
// via CNGX_DOM_ANCHOR_RETRY_FACTORY.
|
|
338
371
|
attachRetry = inject(CNGX_DOM_ANCHOR_RETRY_FACTORY)({
|
|
339
372
|
attempt: () => {
|
|
@@ -341,9 +374,12 @@ class CngxTabOverflow {
|
|
|
341
374
|
if (!root) {
|
|
342
375
|
return null;
|
|
343
376
|
}
|
|
344
|
-
// threshold: 0
|
|
377
|
+
// threshold: 0 - any visible pixel = "in the strip". Drives
|
|
345
378
|
// the self-healing loop with the organism's scrollIntoView.
|
|
346
|
-
this.observer = new IntersectionObserver((entries) => this.handleIntersections(entries), {
|
|
379
|
+
this.observer = new IntersectionObserver((entries) => this.handleIntersections(entries), {
|
|
380
|
+
root,
|
|
381
|
+
threshold: 0,
|
|
382
|
+
});
|
|
347
383
|
this.observeCurrentTabs();
|
|
348
384
|
return true;
|
|
349
385
|
},
|
|
@@ -392,7 +428,7 @@ class CngxTabOverflow {
|
|
|
392
428
|
this.panelHost.selectById(tab.id);
|
|
393
429
|
this.popover().hide();
|
|
394
430
|
}
|
|
395
|
-
/** AD `(activated)`
|
|
431
|
+
/** AD `(activated)` - Enter / Space on a highlighted option picks. */
|
|
396
432
|
handleAdActivated(value) {
|
|
397
433
|
const tab = value;
|
|
398
434
|
if (tab?.id) {
|
|
@@ -402,7 +438,7 @@ class CngxTabOverflow {
|
|
|
402
438
|
/**
|
|
403
439
|
* Auto-opens popover on nav-key when collapsed. AD's host listener
|
|
404
440
|
* fires first, so `activeIndex` is already set when this runs.
|
|
405
|
-
* No-op while open
|
|
441
|
+
* No-op while open - AD owns navigation.
|
|
406
442
|
*/
|
|
407
443
|
handleTriggerKeydown(event) {
|
|
408
444
|
if (this.popover().isVisible() || !this.hasHiddenTabs()) {
|
|
@@ -462,10 +498,10 @@ class CngxTabOverflow {
|
|
|
462
498
|
const tabId = this.targetToHandleId.get(target);
|
|
463
499
|
if (tabId === undefined) {
|
|
464
500
|
// Stale registration during disconnect/observeCurrentTabs
|
|
465
|
-
// churn
|
|
501
|
+
// churn - skip rather than mis-key.
|
|
466
502
|
continue;
|
|
467
503
|
}
|
|
468
|
-
// threshold: 0
|
|
504
|
+
// threshold: 0 - partially-clipped stays visible; only
|
|
469
505
|
// fully-clipped surfaces as hidden.
|
|
470
506
|
next.set(tabId, entry.isIntersecting);
|
|
471
507
|
}
|
|
@@ -474,13 +510,13 @@ class CngxTabOverflow {
|
|
|
474
510
|
}
|
|
475
511
|
/**
|
|
476
512
|
* IO-root resolution via the injected adapter. Returns `null`
|
|
477
|
-
* before the molecule is anchored
|
|
513
|
+
* before the molecule is anchored - the rAF retry loop re-polls.
|
|
478
514
|
*/
|
|
479
515
|
resolveStrip() {
|
|
480
516
|
return this.adapter.resolveStripRoot(this.panelHost, this.hostElement);
|
|
481
517
|
}
|
|
482
518
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabOverflow, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
483
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTabOverflow, isStandalone: true, selector: "cngx-tab-overflow", host: { properties: { "class.cngx-tab-overflow": "true" } }, queries: [{ propertyName: "triggerSlot", first: true, predicate: CngxTabOverflowTrigger, descendants: true, isSignal: true }, { propertyName: "itemSlot", first: true, predicate: CngxTabOverflowItem, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popover", first: true, predicate: CngxPopover, descendants: true, isSignal: true }, { propertyName: "adRef", first: true, predicate: CngxActiveDescendant, descendants: true, isSignal: true }], exportAs: ["cngxTabOverflow"], ngImport: i0, template: "<button\n type=\"button\"\n class=\"cngx-tab-overflow__trigger\"\n cngxActiveDescendant\n #ad=\"cngxActiveDescendant\"\n [items]=\"templates.adItems()\"\n [cngxPopoverTrigger]=\"overflowPopover\"\n [haspopup]=\"'menu'\"\n [hidden]=\"!hasHiddenTabs()\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n (activated)=\"handleAdActivated($event)\"\n (keydown)=\"handleTriggerKeydown($event)\"\n (click)=\"overflowPopover.toggle()\"\n>\n @let triggerTpl = templates.triggerTemplate();\n @if (triggerTpl) {\n <ng-container\n *ngTemplateOutlet=\"triggerTpl; context: templates.triggerContext()\"\n />\n } @else {\n {{ i18n.moreTabsLabel(hiddenCount()) }}\n }\n</button>\n\n<div\n cngxPopover\n #overflowPopover=\"cngxPopover\"\n cngxClickOutside\n [eventType]=\"'click'\"\n [enabled]=\"overflowPopover.isVisible()\"\n (clickOutside)=\"overflowPopover.hide()\"\n role=\"menu\"\n class=\"cngx-tab-overflow__panel\"\n placement=\"bottom-end\"\n panelClass=\"cngx-tab-overflow__panel-surface\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n>\n <!--\n `role=\"presentation\"` flattens the <ul> away from the\n accessibility tree so each <li role=\"menuitem\"> is exposed as a\n direct child of the role=\"menu\" landmark on the popover surface.\n Each item carries a stable id derived from the tab handle id;\n CngxActiveDescendant on the trigger steers `aria-activedescendant`\n at one of these ids while the user navigates with\n ArrowUp/Down/Home/End/typeahead. The popover is a quick-jump\n navigation surface \u2014 selecting an item triggers `selectById`,\n not a value commit \u2014 so menu/menuitem is the spec-correct pattern\n (listbox/option carries `aria-selected` semantics that do not\n apply to a transient navigation popup).\n -->\n <ul class=\"cngx-tab-overflow__list\" role=\"presentation\">\n @for (tab of hiddenTabs(); track tab.id; let i = $index) {\n <li\n role=\"menuitem\"\n class=\"cngx-tab-overflow__item\"\n [class.cngx-tab-overflow__item--active]=\"ad.activeId() === adItemId(tab)\"\n [id]=\"adItemId(tab)\"\n [attr.data-tab-id]=\"tab.id\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : 'false'\"\n (click)=\"!tab.disabled() && pickTab(tab)\"\n >\n @let itemTpl = templates.itemTemplate();\n @if (itemTpl) {\n <ng-container\n *ngTemplateOutlet=\"itemTpl; context: templates.buildItemContext(tab, i)\"\n />\n } @else {\n {{ tab.label() ?? tab.id }}\n }\n </li>\n }\n </ul>\n</div>\n", styles: [":
|
|
519
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTabOverflow, isStandalone: true, selector: "cngx-tab-overflow", host: { properties: { "class.cngx-tab-overflow": "true" } }, queries: [{ propertyName: "triggerSlot", first: true, predicate: CngxTabOverflowTrigger, descendants: true, isSignal: true }, { propertyName: "itemSlot", first: true, predicate: CngxTabOverflowItem, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "popover", first: true, predicate: CngxPopover, descendants: true, isSignal: true }, { propertyName: "adRef", first: true, predicate: CngxActiveDescendant, descendants: true, isSignal: true }], exportAs: ["cngxTabOverflow"], ngImport: i0, template: "<button\n type=\"button\"\n class=\"cngx-tab-overflow__trigger\"\n cngxActiveDescendant\n #ad=\"cngxActiveDescendant\"\n [items]=\"templates.adItems()\"\n [cngxPopoverTrigger]=\"overflowPopover\"\n [haspopup]=\"'menu'\"\n [hidden]=\"!hasHiddenTabs()\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n (activated)=\"handleAdActivated($event)\"\n (keydown)=\"handleTriggerKeydown($event)\"\n (click)=\"overflowPopover.toggle()\"\n>\n @let triggerTpl = templates.triggerTemplate();\n @if (triggerTpl) {\n <ng-container\n *ngTemplateOutlet=\"triggerTpl; context: templates.triggerContext()\"\n />\n } @else {\n {{ i18n.moreTabsLabel(hiddenCount()) }}\n }\n</button>\n\n<div\n cngxPopover\n #overflowPopover=\"cngxPopover\"\n cngxClickOutside\n [eventType]=\"'click'\"\n [enabled]=\"overflowPopover.isVisible()\"\n (clickOutside)=\"overflowPopover.hide()\"\n role=\"menu\"\n class=\"cngx-tab-overflow__panel\"\n placement=\"bottom-end\"\n panelClass=\"cngx-tab-overflow__panel-surface\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n>\n <!--\n `role=\"presentation\"` flattens the <ul> away from the\n accessibility tree so each <li role=\"menuitem\"> is exposed as a\n direct child of the role=\"menu\" landmark on the popover surface.\n Each item carries a stable id derived from the tab handle id;\n CngxActiveDescendant on the trigger steers `aria-activedescendant`\n at one of these ids while the user navigates with\n ArrowUp/Down/Home/End/typeahead. The popover is a quick-jump\n navigation surface \u2014 selecting an item triggers `selectById`,\n not a value commit \u2014 so menu/menuitem is the spec-correct pattern\n (listbox/option carries `aria-selected` semantics that do not\n apply to a transient navigation popup).\n -->\n <ul class=\"cngx-tab-overflow__list\" role=\"presentation\">\n @for (tab of hiddenTabs(); track tab.id; let i = $index) {\n <li\n role=\"menuitem\"\n class=\"cngx-tab-overflow__item\"\n [class.cngx-tab-overflow__item--active]=\"ad.activeId() === adItemId(tab)\"\n [id]=\"adItemId(tab)\"\n [attr.data-tab-id]=\"tab.id\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : 'false'\"\n (click)=\"!tab.disabled() && pickTab(tab)\"\n >\n @let itemTpl = templates.itemTemplate();\n @if (itemTpl) {\n <ng-container\n *ngTemplateOutlet=\"itemTpl; context: templates.buildItemContext(tab, i)\"\n />\n } @else {\n {{ tab.label() ?? tab.id }}\n }\n </li>\n }\n </ul>\n</div>\n", styles: ["@layer cngx.tokens{@property --cngx-tab-overflow-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-overflow-button-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-overflow-button-radius{syntax: \"<length>\"; inherits: false; initial-value: .25rem;}@property --cngx-tab-overflow-popover-min-width{syntax: \"*\"; inherits: false; initial-value: 12rem;}@property --cngx-tab-overflow-popover-max-height{syntax: \"*\"; inherits: false; initial-value: 16rem;}@property --cngx-tab-overflow-popover-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0);}@property --cngx-tab-overflow-popover-border{syntax: \"*\"; inherits: false; initial-value: 1px solid currentColor;}@property --cngx-tab-overflow-popover-radius{syntax: \"<length>\"; inherits: false; initial-value: .25rem;}@property --cngx-tab-overflow-popover-padding{syntax: \"*\"; inherits: false; initial-value: .25rem 0;}@property --cngx-tab-overflow-item-padding{syntax: \"*\"; inherits: false; initial-value: .5rem .75rem;}@property --cngx-tab-overflow-item-hover-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0 / .05);}@property --cngx-tab-overflow-item-active-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0 / .08);}@property --cngx-tab-overflow-item-active-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-tab-overflow-item-active-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: -2px;}}@layer cngx.components{@scope(.cngx-tab-overflow){:scope{display:inline-flex;align-items:center;flex:0 0 auto;background:var(--cngx-tab-overflow-bg, var(--cngx-tab-strip-bg, transparent))}.cngx-tab-overflow__trigger{display:inline-flex;align-items:center;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-padding, .5rem .75rem);border:0;background:var(--cngx-tab-overflow-button-bg, transparent);color:var(--cngx-tab-color);cursor:pointer;font:inherit;border-radius:var(--cngx-tab-overflow-button-radius, .25rem)}.cngx-tab-overflow__trigger[hidden]{display:none}.cngx-tab-overflow__trigger:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}.cngx-tab-overflow__panel-surface{min-width:var(--cngx-tab-overflow-popover-min-width, 12rem);max-height:var(--cngx-tab-overflow-popover-max-height, 16rem);background:var(--cngx-tab-overflow-popover-bg, oklch(1 0 0));border:var(--cngx-tab-overflow-popover-border, 1px solid currentColor);border-radius:var(--cngx-tab-overflow-popover-radius, .25rem);overflow:auto;padding:var(--cngx-tab-overflow-popover-padding, .25rem 0)}.cngx-tab-overflow__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}.cngx-tab-overflow__item{padding:var(--cngx-tab-overflow-item-padding, .5rem .75rem);cursor:pointer;-webkit-user-select:none;user-select:none;white-space:nowrap}.cngx-tab-overflow__item:hover{background:var(--cngx-tab-overflow-item-hover-bg, oklch(0 0 0 / .05))}.cngx-tab-overflow__item--active{background:var( --cngx-tab-overflow-item-active-bg, var(--cngx-tab-overflow-item-hover-bg, oklch(0 0 0 / .08)) );outline:var(--cngx-tab-overflow-item-active-outline, 2px solid currentColor);outline-offset:var(--cngx-tab-overflow-item-active-outline-offset, -2px)}.cngx-tab-overflow__item[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-tab-disabled-opacity, .55)}}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CngxActiveDescendant, selector: "[cngxActiveDescendant]", inputs: ["items", "orientation", "loop", "typeahead", "typeaheadDebounce", "autoHighlightFirst", "skipDisabled", "virtualCount"], outputs: ["activated", "highlighted"], exportAs: ["cngxActiveDescendant"] }, { kind: "directive", type: CngxClickOutside, selector: "[cngxClickOutside]", inputs: ["eventType", "enabled"], outputs: ["clickOutside"], exportAs: ["cngxClickOutside"] }, { kind: "directive", type: CngxPopover, selector: "[cngxPopover]", inputs: ["placement", "positionTryFallbacks", "offset", "closeOnEscape", "mode", "cngxPopoverOpen", "exclusive"], exportAs: ["cngxPopover"] }, { kind: "directive", type: CngxPopoverTrigger, selector: "[cngxPopoverTrigger]", inputs: ["cngxPopoverTrigger", "haspopup", "restoreFocus"], exportAs: ["cngxPopoverTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
484
520
|
}
|
|
485
521
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabOverflow, decorators: [{
|
|
486
522
|
type: Component,
|
|
@@ -490,9 +526,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
490
526
|
CngxClickOutside,
|
|
491
527
|
CngxPopover,
|
|
492
528
|
CngxPopoverTrigger,
|
|
493
|
-
], host: {
|
|
529
|
+
], encapsulation: ViewEncapsulation.None, host: {
|
|
494
530
|
'[class.cngx-tab-overflow]': 'true',
|
|
495
|
-
}, template: "<button\n type=\"button\"\n class=\"cngx-tab-overflow__trigger\"\n cngxActiveDescendant\n #ad=\"cngxActiveDescendant\"\n [items]=\"templates.adItems()\"\n [cngxPopoverTrigger]=\"overflowPopover\"\n [haspopup]=\"'menu'\"\n [hidden]=\"!hasHiddenTabs()\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n (activated)=\"handleAdActivated($event)\"\n (keydown)=\"handleTriggerKeydown($event)\"\n (click)=\"overflowPopover.toggle()\"\n>\n @let triggerTpl = templates.triggerTemplate();\n @if (triggerTpl) {\n <ng-container\n *ngTemplateOutlet=\"triggerTpl; context: templates.triggerContext()\"\n />\n } @else {\n {{ i18n.moreTabsLabel(hiddenCount()) }}\n }\n</button>\n\n<div\n cngxPopover\n #overflowPopover=\"cngxPopover\"\n cngxClickOutside\n [eventType]=\"'click'\"\n [enabled]=\"overflowPopover.isVisible()\"\n (clickOutside)=\"overflowPopover.hide()\"\n role=\"menu\"\n class=\"cngx-tab-overflow__panel\"\n placement=\"bottom-end\"\n panelClass=\"cngx-tab-overflow__panel-surface\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n>\n <!--\n `role=\"presentation\"` flattens the <ul> away from the\n accessibility tree so each <li role=\"menuitem\"> is exposed as a\n direct child of the role=\"menu\" landmark on the popover surface.\n Each item carries a stable id derived from the tab handle id;\n CngxActiveDescendant on the trigger steers `aria-activedescendant`\n at one of these ids while the user navigates with\n ArrowUp/Down/Home/End/typeahead. The popover is a quick-jump\n navigation surface \u2014 selecting an item triggers `selectById`,\n not a value commit \u2014 so menu/menuitem is the spec-correct pattern\n (listbox/option carries `aria-selected` semantics that do not\n apply to a transient navigation popup).\n -->\n <ul class=\"cngx-tab-overflow__list\" role=\"presentation\">\n @for (tab of hiddenTabs(); track tab.id; let i = $index) {\n <li\n role=\"menuitem\"\n class=\"cngx-tab-overflow__item\"\n [class.cngx-tab-overflow__item--active]=\"ad.activeId() === adItemId(tab)\"\n [id]=\"adItemId(tab)\"\n [attr.data-tab-id]=\"tab.id\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : 'false'\"\n (click)=\"!tab.disabled() && pickTab(tab)\"\n >\n @let itemTpl = templates.itemTemplate();\n @if (itemTpl) {\n <ng-container\n *ngTemplateOutlet=\"itemTpl; context: templates.buildItemContext(tab, i)\"\n />\n } @else {\n {{ tab.label() ?? tab.id }}\n }\n </li>\n }\n </ul>\n</div>\n", styles: [":
|
|
531
|
+
}, template: "<button\n type=\"button\"\n class=\"cngx-tab-overflow__trigger\"\n cngxActiveDescendant\n #ad=\"cngxActiveDescendant\"\n [items]=\"templates.adItems()\"\n [cngxPopoverTrigger]=\"overflowPopover\"\n [haspopup]=\"'menu'\"\n [hidden]=\"!hasHiddenTabs()\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n (activated)=\"handleAdActivated($event)\"\n (keydown)=\"handleTriggerKeydown($event)\"\n (click)=\"overflowPopover.toggle()\"\n>\n @let triggerTpl = templates.triggerTemplate();\n @if (triggerTpl) {\n <ng-container\n *ngTemplateOutlet=\"triggerTpl; context: templates.triggerContext()\"\n />\n } @else {\n {{ i18n.moreTabsLabel(hiddenCount()) }}\n }\n</button>\n\n<div\n cngxPopover\n #overflowPopover=\"cngxPopover\"\n cngxClickOutside\n [eventType]=\"'click'\"\n [enabled]=\"overflowPopover.isVisible()\"\n (clickOutside)=\"overflowPopover.hide()\"\n role=\"menu\"\n class=\"cngx-tab-overflow__panel\"\n placement=\"bottom-end\"\n panelClass=\"cngx-tab-overflow__panel-surface\"\n [attr.aria-label]=\"i18n.moreTabsLabel(hiddenCount())\"\n>\n <!--\n `role=\"presentation\"` flattens the <ul> away from the\n accessibility tree so each <li role=\"menuitem\"> is exposed as a\n direct child of the role=\"menu\" landmark on the popover surface.\n Each item carries a stable id derived from the tab handle id;\n CngxActiveDescendant on the trigger steers `aria-activedescendant`\n at one of these ids while the user navigates with\n ArrowUp/Down/Home/End/typeahead. The popover is a quick-jump\n navigation surface \u2014 selecting an item triggers `selectById`,\n not a value commit \u2014 so menu/menuitem is the spec-correct pattern\n (listbox/option carries `aria-selected` semantics that do not\n apply to a transient navigation popup).\n -->\n <ul class=\"cngx-tab-overflow__list\" role=\"presentation\">\n @for (tab of hiddenTabs(); track tab.id; let i = $index) {\n <li\n role=\"menuitem\"\n class=\"cngx-tab-overflow__item\"\n [class.cngx-tab-overflow__item--active]=\"ad.activeId() === adItemId(tab)\"\n [id]=\"adItemId(tab)\"\n [attr.data-tab-id]=\"tab.id\"\n [attr.aria-disabled]=\"tab.disabled() ? 'true' : 'false'\"\n (click)=\"!tab.disabled() && pickTab(tab)\"\n >\n @let itemTpl = templates.itemTemplate();\n @if (itemTpl) {\n <ng-container\n *ngTemplateOutlet=\"itemTpl; context: templates.buildItemContext(tab, i)\"\n />\n } @else {\n {{ tab.label() ?? tab.id }}\n }\n </li>\n }\n </ul>\n</div>\n", styles: ["@layer cngx.tokens{@property --cngx-tab-overflow-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-overflow-button-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-tab-overflow-button-radius{syntax: \"<length>\"; inherits: false; initial-value: .25rem;}@property --cngx-tab-overflow-popover-min-width{syntax: \"*\"; inherits: false; initial-value: 12rem;}@property --cngx-tab-overflow-popover-max-height{syntax: \"*\"; inherits: false; initial-value: 16rem;}@property --cngx-tab-overflow-popover-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0);}@property --cngx-tab-overflow-popover-border{syntax: \"*\"; inherits: false; initial-value: 1px solid currentColor;}@property --cngx-tab-overflow-popover-radius{syntax: \"<length>\"; inherits: false; initial-value: .25rem;}@property --cngx-tab-overflow-popover-padding{syntax: \"*\"; inherits: false; initial-value: .25rem 0;}@property --cngx-tab-overflow-item-padding{syntax: \"*\"; inherits: false; initial-value: .5rem .75rem;}@property --cngx-tab-overflow-item-hover-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0 / .05);}@property --cngx-tab-overflow-item-active-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0 / .08);}@property --cngx-tab-overflow-item-active-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-tab-overflow-item-active-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: -2px;}}@layer cngx.components{@scope(.cngx-tab-overflow){:scope{display:inline-flex;align-items:center;flex:0 0 auto;background:var(--cngx-tab-overflow-bg, var(--cngx-tab-strip-bg, transparent))}.cngx-tab-overflow__trigger{display:inline-flex;align-items:center;gap:var(--cngx-tab-gap, .5rem);padding:var(--cngx-tab-padding, .5rem .75rem);border:0;background:var(--cngx-tab-overflow-button-bg, transparent);color:var(--cngx-tab-color);cursor:pointer;font:inherit;border-radius:var(--cngx-tab-overflow-button-radius, .25rem)}.cngx-tab-overflow__trigger[hidden]{display:none}.cngx-tab-overflow__trigger:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}.cngx-tab-overflow__panel-surface{min-width:var(--cngx-tab-overflow-popover-min-width, 12rem);max-height:var(--cngx-tab-overflow-popover-max-height, 16rem);background:var(--cngx-tab-overflow-popover-bg, oklch(1 0 0));border:var(--cngx-tab-overflow-popover-border, 1px solid currentColor);border-radius:var(--cngx-tab-overflow-popover-radius, .25rem);overflow:auto;padding:var(--cngx-tab-overflow-popover-padding, .25rem 0)}.cngx-tab-overflow__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}.cngx-tab-overflow__item{padding:var(--cngx-tab-overflow-item-padding, .5rem .75rem);cursor:pointer;-webkit-user-select:none;user-select:none;white-space:nowrap}.cngx-tab-overflow__item:hover{background:var(--cngx-tab-overflow-item-hover-bg, oklch(0 0 0 / .05))}.cngx-tab-overflow__item--active{background:var( --cngx-tab-overflow-item-active-bg, var(--cngx-tab-overflow-item-hover-bg, oklch(0 0 0 / .08)) );outline:var(--cngx-tab-overflow-item-active-outline, 2px solid currentColor);outline-offset:var(--cngx-tab-overflow-item-active-outline-offset, -2px)}.cngx-tab-overflow__item[aria-disabled=true]{cursor:not-allowed;opacity:var(--cngx-tab-disabled-opacity, .55)}}}\n"] }]
|
|
496
532
|
}], ctorParameters: () => [], propDecorators: { popover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CngxPopover), { isSignal: true }] }], adRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CngxActiveDescendant), { isSignal: true }] }], triggerSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabOverflowTrigger), { isSignal: true }] }], itemSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabOverflowItem), { isSignal: true }] }] } });
|
|
497
533
|
|
|
498
534
|
/**
|