@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.1
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 +119 -297
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +455 -120
- 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 +659 -163
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +306 -55
- 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 +37 -17
- package/mat-tabs/README.md +13 -13
- package/mat-tabs/styles/mat-tabs.css +357 -213
- package/material/README.md +19 -19
- package/overlay/README.md +11 -11
- package/package.json +7 -6
- package/sidenav/README.md +4 -19
- package/skeleton/README.md +3 -17
- package/speak/README.md +15 -15
- package/stepper/README.md +213 -5
- package/tabs/README.md +22 -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 +100 -134
- package/types/cngx-ui-mat-tabs.d.ts +291 -84
- 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 +390 -57
- package/types/cngx-ui-tabs.d.ts +182 -18
- package/types/cngx-ui.d.ts +1 -0
- package/speak/speak-button-theme.scss +0 -78
|
@@ -1,30 +1,94 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, inject, ElementRef, Injector, contentChildren, contentChild,
|
|
3
|
+
import { input, inject, ElementRef, Injector, contentChildren, contentChild, signal, afterRenderEffect, isDevMode, afterNextRender, linkedSignal, ViewEncapsulation, ChangeDetectionStrategy, Component, viewChild, DestroyRef, computed, effect, untracked } from '@angular/core';
|
|
4
4
|
import * as i2 from '@cngx/common/a11y';
|
|
5
|
-
import {
|
|
5
|
+
import { CNGX_FOCUSABLE_SELECTOR, CngxLiveRegion, CngxFocusRestore, CngxActiveDescendant } from '@cngx/common/a11y';
|
|
6
6
|
import * as i1 from '@cngx/common/tabs';
|
|
7
|
-
import { CNGX_TAB_GROUP_HOST, injectTabsI18n, injectTabsConfig, CNGX_TABS_GLYPHS, CngxTab, CngxTabErrorBadge, CngxTabRejectionIcon, CngxTabBusySpinner, createTabGroupAnnouncements, CNGX_ORGANISM_SCROLL_SYNC_FACTORY, CNGX_DIRECTIVE_BY_ID_MAP_FACTORY, createTabGroupTemplateBindings, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, tabOverflowOptionId, CngxTabOverflowTrigger, CngxTabOverflowItem, createTabOverflowTemplateBindings, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY } from '@cngx/common/tabs';
|
|
7
|
+
import { CNGX_TAB_GROUP_HOST, injectTabsI18n, injectTabsConfig, CNGX_TABS_GLYPHS, CngxTab, CngxTabErrorBadge, CngxTabRejectionIcon, CngxTabBusySpinner, CngxTabIcon, CngxTabCloseIcon, CngxTabAddIcon, createTabDismissals, createTabKeyboardNav, createTabGroupAnnouncements, createTabsHostAttrs, CNGX_ORGANISM_SCROLL_SYNC_FACTORY, CNGX_DIRECTIVE_BY_ID_MAP_FACTORY, createTabGroupTemplateBindings, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, tabOverflowOptionId, CngxTabOverflowTrigger, CngxTabOverflowItem, createTabOverflowTemplateBindings, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY } from '@cngx/common/tabs';
|
|
8
8
|
import { CngxClickOutside } from '@cngx/common/interactive';
|
|
9
9
|
import { CngxPopover, CngxPopoverTrigger } from '@cngx/common/popover';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* CNGX tab-group organism. Thin shell over {@link CngxTabGroupPresenter}
|
|
13
|
-
* + `
|
|
14
|
-
*
|
|
13
|
+
* + `CngxFocusRestore` via `hostDirectives`. The APG tablist keyboard
|
|
14
|
+
* model (automatic activation: arrow keys move focus AND select; Home/End
|
|
15
|
+
* jump to first/last; the active tab is the lone tab stop) lives in
|
|
16
|
+
* {@link createTabKeyboardNav}, deriving the roving stop from the
|
|
17
|
+
* presenter's `activeId` rather than a competing index. Material variant
|
|
18
|
+
* lives at `[cngxMatTabs]` in `@cngx/ui/mat-tabs`.
|
|
15
19
|
*
|
|
16
|
-
* All ARIA attrs are signal-driven
|
|
20
|
+
* All ARIA attrs are signal-driven - never one-shot bindings.
|
|
17
21
|
* `CngxLiveRegion` is mounted as a child `<span>` rather than a
|
|
18
22
|
* host directive: its `role="status"` would clobber the wrapper's
|
|
19
23
|
* `role="group"` landmark.
|
|
24
|
+
*
|
|
25
|
+
* @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
|
|
26
|
+
* @see {@link CngxMatTabs} for the Material `<mat-tab-group>` variant with `[cngxMatTabError]`.
|
|
27
|
+
*
|
|
28
|
+
* @category ui/tabs
|
|
29
|
+
* @docsKind primary
|
|
30
|
+
* @wcag AA
|
|
31
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/tabs/tab-group.component.ts
|
|
32
|
+
* @since 0.1.0
|
|
33
|
+
* @relatedTo CngxTabOverflow, CngxTabGroupPresenter, CngxTab, CngxFocusRestore
|
|
34
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
35
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
|
|
36
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
37
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
38
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
39
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
40
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
41
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
20
42
|
*/
|
|
21
43
|
class CngxTabGroup {
|
|
22
44
|
ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
23
45
|
ariaLabelledBy = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
46
|
+
/**
|
|
47
|
+
* Visual skin. Cascade `input ?? config ?? 'line'`, resolved by
|
|
48
|
+
* {@link hostAttrs} and reflected onto `[data-skin]`. The skin is a
|
|
49
|
+
* pure CSS concern - structure, slots, ARIA, and keyboard behaviour
|
|
50
|
+
* are identical across all values. Public (consumer-facing input,
|
|
51
|
+
* like `ariaLabel`); the resolved value, not the raw input, is what
|
|
52
|
+
* the host binding reads.
|
|
53
|
+
*/
|
|
54
|
+
skin = input(undefined, ...(ngDevMode ? [{ debugName: "skin" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/**
|
|
56
|
+
* Icon layout. Cascade `input ?? config ?? 'start'`, reflected onto
|
|
57
|
+
* `[data-icon-layout]`. Orthogonal to skin and orientation.
|
|
58
|
+
*/
|
|
59
|
+
iconLayout = input(undefined, ...(ngDevMode ? [{ debugName: "iconLayout" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/**
|
|
61
|
+
* Panel render strategy. Cascade `input ?? config ?? 'eager'`,
|
|
62
|
+
* reflected onto `[data-panel-mode]`. `'eager'` (default) renders every
|
|
63
|
+
* panel's content up front (byte-identical to before this input
|
|
64
|
+
* existed); `'lazy'` keep-alives content after first activation;
|
|
65
|
+
* `'lazy-destroy'` renders only the active panel's content. The panel
|
|
66
|
+
* `<div>` always stays in the DOM regardless.
|
|
67
|
+
*/
|
|
68
|
+
panelMode = input(undefined, ...(ngDevMode ? [{ debugName: "panelMode" }] : /* istanbul ignore next */ []));
|
|
69
|
+
/** Stretch tabs to fill the strip width (horizontal only); reflects `[data-fitted]`. Cascade `input ?? config ?? false`. */
|
|
70
|
+
fitted = input(undefined, ...(ngDevMode ? [{ debugName: "fitted" }] : /* istanbul ignore next */ []));
|
|
71
|
+
/** Tab-cluster alignment when not fitted (horizontal only); reflects `[data-tab-align]`. Cascade `input ?? config ?? 'start'`. */
|
|
72
|
+
tabAlign = input(undefined, ...(ngDevMode ? [{ debugName: "tabAlign" }] : /* istanbul ignore next */ []));
|
|
73
|
+
/**
|
|
74
|
+
* Whether tabs render a close affordance. Cascade
|
|
75
|
+
* `input ?? config ?? false`. A per-`CngxTab` `[closable]` override
|
|
76
|
+
* wins over this group default. When on, each closable tab gets a
|
|
77
|
+
* close button (and Delete on the focused tab closes it); the
|
|
78
|
+
* `(tabClose)` output fires with the tab id and index for the
|
|
79
|
+
* consumer to remove from its data.
|
|
80
|
+
*/
|
|
81
|
+
closable = input(undefined, ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
|
|
82
|
+
/**
|
|
83
|
+
* Whether the group renders an add-tab button after the strip. Cascade
|
|
84
|
+
* `input ?? config ?? false`. When on, the `(tabAdd)` output fires for
|
|
85
|
+
* the consumer to append a tab to its data.
|
|
86
|
+
*/
|
|
87
|
+
addable = input(undefined, ...(ngDevMode ? [{ debugName: "addable" }] : /* istanbul ignore next */ []));
|
|
24
88
|
presenter = inject(CNGX_TAB_GROUP_HOST);
|
|
25
89
|
i18n = injectTabsI18n();
|
|
26
90
|
config = injectTabsConfig();
|
|
27
|
-
/** Default-glyph table for the template's fallback spans.
|
|
91
|
+
/** Default-glyph table for the template's fallback spans. */
|
|
28
92
|
glyphs = CNGX_TABS_GLYPHS;
|
|
29
93
|
hostElement = inject(ElementRef).nativeElement;
|
|
30
94
|
injector = inject(Injector);
|
|
@@ -33,11 +97,39 @@ class CngxTabGroup {
|
|
|
33
97
|
* Per-instance skin slots. Resolved via 3-stage cascade in {@link templates}:
|
|
34
98
|
* `*cngxTab*` directive > `CNGX_TABS_CONFIG.templates.<key>` > built-in.
|
|
35
99
|
* AOT (NG8110) requires `contentChild()` to be a direct field initialiser
|
|
36
|
-
* on the variant
|
|
100
|
+
* on the variant - cascade resolution is delegated to the factory.
|
|
37
101
|
*/
|
|
38
102
|
errorBadgeSlot = contentChild(CngxTabErrorBadge, ...(ngDevMode ? [{ debugName: "errorBadgeSlot" }] : /* istanbul ignore next */ []));
|
|
39
103
|
rejectionIconSlot = contentChild(CngxTabRejectionIcon, ...(ngDevMode ? [{ debugName: "rejectionIconSlot" }] : /* istanbul ignore next */ []));
|
|
40
104
|
busySpinnerSlot = contentChild(CngxTabBusySpinner, ...(ngDevMode ? [{ debugName: "busySpinnerSlot" }] : /* istanbul ignore next */ []));
|
|
105
|
+
iconSlot = contentChild(CngxTabIcon, ...(ngDevMode ? [{ debugName: "iconSlot" }] : /* istanbul ignore next */ []));
|
|
106
|
+
closeIconSlot = contentChild(CngxTabCloseIcon, ...(ngDevMode ? [{ debugName: "closeIconSlot" }] : /* istanbul ignore next */ []));
|
|
107
|
+
addIconSlot = contentChild(CngxTabAddIcon, ...(ngDevMode ? [{ debugName: "addIconSlot" }] : /* istanbul ignore next */ []));
|
|
108
|
+
/**
|
|
109
|
+
* Dismissable / addable affordance surface (close + add resolution,
|
|
110
|
+
* close interaction, focus restoration). Level-2 helper keeps the
|
|
111
|
+
* cascade + handlers off the organism class (LOC guard).
|
|
112
|
+
*/
|
|
113
|
+
dismiss = createTabDismissals({
|
|
114
|
+
host: this.presenter,
|
|
115
|
+
config: this.config,
|
|
116
|
+
i18n: this.i18n,
|
|
117
|
+
closable: this.closable,
|
|
118
|
+
addable: this.addable,
|
|
119
|
+
hostElement: this.hostElement,
|
|
120
|
+
injector: this.injector,
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* APG tablist keyboard model (automatic activation). Owns arrow / Home /
|
|
124
|
+
* End resolution, the `host.select()` activation, and focus movement;
|
|
125
|
+
* derives each tab's roving `tabindex` from the presenter's `activeId`
|
|
126
|
+
* (single source of truth). Level-2 helper keeps the keyboard logic off
|
|
127
|
+
* the organism class (LOC guard).
|
|
128
|
+
*/
|
|
129
|
+
keyboard = createTabKeyboardNav({
|
|
130
|
+
host: this.presenter,
|
|
131
|
+
hostElement: this.hostElement,
|
|
132
|
+
});
|
|
41
133
|
/**
|
|
42
134
|
* AT-announcement bundle from `@cngx/common/tabs/announcements/`.
|
|
43
135
|
* Owns role descriptions, resolved aria-label, live-region phrasing,
|
|
@@ -51,6 +143,29 @@ class CngxTabGroup {
|
|
|
51
143
|
ariaLabel: this.ariaLabel,
|
|
52
144
|
ariaLabelledBy: this.ariaLabelledBy,
|
|
53
145
|
});
|
|
146
|
+
/**
|
|
147
|
+
* Resolved skin / icon-layout cascade (`input ?? config ?? default`),
|
|
148
|
+
* read by the `[data-skin]` / `[data-icon-layout]` host bindings. The
|
|
149
|
+
* Level-2 helper keeps the cascade off the organism class (LOC guard).
|
|
150
|
+
*/
|
|
151
|
+
hostAttrs = createTabsHostAttrs({
|
|
152
|
+
skin: this.skin,
|
|
153
|
+
iconLayout: this.iconLayout,
|
|
154
|
+
panelMode: this.panelMode,
|
|
155
|
+
fitted: this.fitted,
|
|
156
|
+
tabAlign: this.tabAlign,
|
|
157
|
+
config: this.config,
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* Whether the active panel contains a natively-focusable descendant.
|
|
161
|
+
* Resolved by a post-render DOM probe (the only way to know - the
|
|
162
|
+
* panel content is consumer-projected). Drives {@link panelTabindex}:
|
|
163
|
+
* a panel with no focusable child earns one tab stop so keyboard users
|
|
164
|
+
* can still reach its content (APG tabpanel pattern); a panel that
|
|
165
|
+
* already has reachable content does not (no redundant stop). Boolean
|
|
166
|
+
* with default `Object.is`, so a stable probe never re-triggers CD.
|
|
167
|
+
*/
|
|
168
|
+
activePanelHasFocusable = signal(false, ...(ngDevMode ? [{ debugName: "activePanelHasFocusable" }] : /* istanbul ignore next */ []));
|
|
54
169
|
constructor() {
|
|
55
170
|
// Self-healing scroll loop: activeId change -> scrollIntoView ->
|
|
56
171
|
// overflow IO sees new visibility -> More dropdown self-trims.
|
|
@@ -60,6 +175,34 @@ class CngxTabGroup {
|
|
|
60
175
|
hostElement: this.hostElement,
|
|
61
176
|
injector: this.injector,
|
|
62
177
|
});
|
|
178
|
+
// APG tabpanel focus probe. afterRenderEffect re-runs after render
|
|
179
|
+
// whenever its tracked dep (the active panel id) changes - i.e. on
|
|
180
|
+
// every tab switch, which is when the active panel (always rendered
|
|
181
|
+
// in every panelMode) gets its current content. Reading the DOM is
|
|
182
|
+
// the only way to know whether the consumer-projected content is
|
|
183
|
+
// focusable. The boolean set is not read inside the effect, so it
|
|
184
|
+
// never re-triggers itself, and its default Object.is equality makes
|
|
185
|
+
// a stable probe a no-op. Scope: content that mutates inside the
|
|
186
|
+
// already-active panel without a tab switch (late async content) is
|
|
187
|
+
// not re-probed - an accepted heuristic limit, not a correctness bug.
|
|
188
|
+
afterRenderEffect(() => {
|
|
189
|
+
// Tracked: re-probe when the active panel changes.
|
|
190
|
+
this.presenter.activeId();
|
|
191
|
+
const panel = this.hostElement.querySelector('.cngx-tabs__panel:not([hidden])');
|
|
192
|
+
this.activePanelHasFocusable.set(panel?.querySelector(CNGX_FOCUSABLE_SELECTOR) != null);
|
|
193
|
+
});
|
|
194
|
+
if (isDevMode()) {
|
|
195
|
+
// One-shot post-mount check: icon-only hides the label, so a
|
|
196
|
+
// missing *cngxTabIcon template leaves the tab visually empty.
|
|
197
|
+
// afterNextRender runs once, off the reactive graph.
|
|
198
|
+
afterNextRender(() => {
|
|
199
|
+
if (this.hostAttrs.resolvedIconLayout() === 'only' && !this.iconSlot()) {
|
|
200
|
+
console.warn("[cngx-tab-group] iconLayout='only' but no *cngxTabIcon template " +
|
|
201
|
+
'is provided - tabs render no icon and the label is visually ' +
|
|
202
|
+
"hidden. Provide an <ng-template cngxTabIcon> or use 'start' / 'end' / 'top'.");
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
63
206
|
}
|
|
64
207
|
// Map<id, CngxTab> for O(1) labelTemplateFor / contentTemplateFor.
|
|
65
208
|
// Structural equal on id-set + directive identity prevents cascade
|
|
@@ -68,13 +211,17 @@ class CngxTabGroup {
|
|
|
68
211
|
source: this.tabDirectives,
|
|
69
212
|
});
|
|
70
213
|
/**
|
|
71
|
-
* Resolved 3-stage cascade for `errorBadge`, `rejectionIcon`,
|
|
72
|
-
* `null` -> render built-in default
|
|
214
|
+
* Resolved 3-stage cascade for `errorBadge`, `rejectionIcon`,
|
|
215
|
+
* `busySpinner`, `icon`. `null` -> render built-in default (or, for
|
|
216
|
+
* `icon`, render nothing).
|
|
73
217
|
*/
|
|
74
218
|
templates = createTabGroupTemplateBindings({
|
|
75
219
|
errorBadgeSlot: this.errorBadgeSlot,
|
|
76
220
|
rejectionIconSlot: this.rejectionIconSlot,
|
|
77
221
|
busySpinnerSlot: this.busySpinnerSlot,
|
|
222
|
+
iconSlot: this.iconSlot,
|
|
223
|
+
closeIconSlot: this.closeIconSlot,
|
|
224
|
+
addIconSlot: this.addIconSlot,
|
|
78
225
|
config: this.config,
|
|
79
226
|
});
|
|
80
227
|
tabs = this.presenter.tabs;
|
|
@@ -100,12 +247,74 @@ class CngxTabGroup {
|
|
|
100
247
|
tabPanelId(tab) {
|
|
101
248
|
return `${tab.id}-panel`;
|
|
102
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* APG tabpanel `tabindex`: `0` only when the selected panel has no
|
|
252
|
+
* focusable descendant (so its content is keyboard-reachable from the
|
|
253
|
+
* tablist), else `null` - never a redundant tab stop. Inactive panels
|
|
254
|
+
* are `null` (they are `[hidden]`).
|
|
255
|
+
*/
|
|
256
|
+
panelTabindex(tab) {
|
|
257
|
+
return this.isSelected(tab) && !this.activePanelHasFocusable() ? 0 : null;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Keep-alive set for `panelMode='lazy'`: the ids of every tab that has
|
|
261
|
+
* ever been activated. Derived history (Pillar 1) - a `linkedSignal`
|
|
262
|
+
* accumulating onto its own previous value as `activeId` moves, NOT an
|
|
263
|
+
* `effect` that writes a set. The structural `equal` (size + membership)
|
|
264
|
+
* means re-activating an already-seen tab returns an equal set, so the
|
|
265
|
+
* reference is stable and downstream `shouldRenderContent` reads do not
|
|
266
|
+
* churn. Unbounded by design: `lazy` trades retention (every visited
|
|
267
|
+
* panel's content stays alive for the directive's life) for keep-alive;
|
|
268
|
+
* the set is bounded by tab count, and `lazy-destroy` is the bounded
|
|
269
|
+
* alternative when retention is unwanted.
|
|
270
|
+
*/
|
|
271
|
+
seenIds = linkedSignal({ ...(ngDevMode ? { debugName: "seenIds" } : /* istanbul ignore next */ {}), source: () => this.presenter.activeId(),
|
|
272
|
+
computation: (id, prev) => {
|
|
273
|
+
const next = new Set(prev?.value ?? []);
|
|
274
|
+
if (id != null) {
|
|
275
|
+
next.add(id);
|
|
276
|
+
}
|
|
277
|
+
return next;
|
|
278
|
+
},
|
|
279
|
+
equal: (a, b) => a.size === b.size && [...a].every((x) => b.has(x)) });
|
|
280
|
+
/**
|
|
281
|
+
* Whether a tab's panel content should be rendered now. The panel
|
|
282
|
+
* `<div>` is always in the DOM (the `aria-controls` target); only its
|
|
283
|
+
* inner content is gated. `eager` is byte-identical to the original
|
|
284
|
+
* behaviour (everything rendered, visibility toggled via `[hidden]`).
|
|
285
|
+
*/
|
|
286
|
+
shouldRenderContent(tab) {
|
|
287
|
+
switch (this.hostAttrs.resolvedPanelMode()) {
|
|
288
|
+
case 'lazy':
|
|
289
|
+
return this.seenIds().has(tab.id);
|
|
290
|
+
case 'lazy-destroy':
|
|
291
|
+
return this.isSelected(tab);
|
|
292
|
+
default:
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
103
296
|
tabDescriptorId(tab) {
|
|
104
297
|
return `${tab.id}-desc`;
|
|
105
298
|
}
|
|
106
|
-
/**
|
|
299
|
+
/**
|
|
300
|
+
* `true` when the tab is in error - the folded `hasError` (direct
|
|
301
|
+
* `[error]` flag OR the aggregator's reveal-gated `shouldShow()`), so
|
|
302
|
+
* a direct-error tab lights the badge without an aggregator while
|
|
303
|
+
* deferred-reveal aggregators stay silent until revealed.
|
|
304
|
+
*/
|
|
107
305
|
showErrorBadge(tab) {
|
|
108
|
-
return
|
|
306
|
+
return tab.hasError();
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Context for `*cngxTabIcon`. Allocates fresh per CD - `active` is
|
|
310
|
+
* reactive (selection), and `*ngTemplateOutlet` only re-evaluates
|
|
311
|
+
* `let-*` bindings when the context reference changes (`Object.is`
|
|
312
|
+
* input-diff); a `WeakMap`-cached object with a mutated `active`
|
|
313
|
+
* would leave consumer bindings stale. Same pattern as
|
|
314
|
+
* {@link busySpinnerContextFor}.
|
|
315
|
+
*/
|
|
316
|
+
iconContextFor(tab, index) {
|
|
317
|
+
return { tab, active: this.isSelected(tab), index };
|
|
109
318
|
}
|
|
110
319
|
/**
|
|
111
320
|
* Stable per-tab `*cngxTabErrorBadge` context cache. Context is
|
|
@@ -124,12 +333,12 @@ class CngxTabGroup {
|
|
|
124
333
|
return ctx;
|
|
125
334
|
}
|
|
126
335
|
/**
|
|
127
|
-
* Context for `*cngxTabBusySpinner`. Allocates fresh per CD
|
|
336
|
+
* Context for `*cngxTabBusySpinner`. Allocates fresh per CD -
|
|
128
337
|
* `intendedIndex` is reactive, and `*ngTemplateOutlet` only
|
|
129
338
|
* re-evaluates `let-*` bindings when the context reference changes
|
|
130
339
|
* (`Object.is` input-diff); a cached mutated object would leave
|
|
131
340
|
* consumer bindings stale. `intendedIndex` is non-undefined by gate
|
|
132
|
-
*
|
|
341
|
+
* - `isTabBusy(tab)` returning `true` requires it.
|
|
133
342
|
*/
|
|
134
343
|
busySpinnerContextFor(tab) {
|
|
135
344
|
return { tab, intendedIndex: this.presenter.intendedIndex() ?? -1 };
|
|
@@ -154,13 +363,33 @@ class CngxTabGroup {
|
|
|
154
363
|
this.presenter.select(idx);
|
|
155
364
|
}
|
|
156
365
|
}
|
|
157
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Roving `tabindex` for a tab button: `0` for the active tab, `-1` for
|
|
368
|
+
* the rest, so the tablist is a single tab stop (APG) and `Tab` lands
|
|
369
|
+
* on the active tab. Derived in {@link keyboard} from `activeId`.
|
|
370
|
+
*/
|
|
371
|
+
tabTabindex(tab) {
|
|
372
|
+
return this.keyboard.tabTabindex(tab);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Single `(keydown)` entry for a tab button: APG navigation
|
|
376
|
+
* (arrows / Home / End, automatic activation) first, then Delete-to-close
|
|
377
|
+
* when navigation did not consume the event.
|
|
378
|
+
*/
|
|
379
|
+
handleTabKeydown(tab, event) {
|
|
380
|
+
this.keyboard.handleKeydown(event);
|
|
381
|
+
if (event.defaultPrevented) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
this.dismiss.handleTabKeydown(tab, event);
|
|
385
|
+
}
|
|
386
|
+
// CngxTabPanelHost contract - presenter owns clamping, disabled-skip,
|
|
158
387
|
// commit-action gating.
|
|
159
388
|
selectById(id) {
|
|
160
389
|
this.presenter.selectById(id);
|
|
161
390
|
}
|
|
162
391
|
/**
|
|
163
|
-
* Clear the presenter's `lastFailedIndex` rejection flag
|
|
392
|
+
* Clear the presenter's `lastFailedIndex` rejection flag - exposed
|
|
164
393
|
* so template-ref consumers (`#tg="cngxTabGroup"`) can dismiss the
|
|
165
394
|
* decoration without injecting the host token.
|
|
166
395
|
*/
|
|
@@ -168,47 +397,50 @@ class CngxTabGroup {
|
|
|
168
397
|
this.presenter.clearLastFailed();
|
|
169
398
|
}
|
|
170
399
|
labelTemplateFor(id) {
|
|
171
|
-
return
|
|
400
|
+
return this.tabDirectiveById().get(id)?.labelTemplate()?.templateRef ?? null;
|
|
401
|
+
}
|
|
402
|
+
subLabelTemplateFor(id) {
|
|
403
|
+
return this.tabDirectiveById().get(id)?.subLabelTemplate()?.templateRef ?? null;
|
|
172
404
|
}
|
|
173
405
|
contentTemplateFor(id) {
|
|
174
|
-
return
|
|
406
|
+
return this.tabDirectiveById().get(id)?.contentTemplate()?.templateRef ?? null;
|
|
175
407
|
}
|
|
176
408
|
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 });
|
|
409
|
+
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 }, skin: { classPropertyName: "skin", publicName: "skin", isSignal: true, isRequired: false, transformFunction: null }, iconLayout: { classPropertyName: "iconLayout", publicName: "iconLayout", isSignal: true, isRequired: false, transformFunction: null }, panelMode: { classPropertyName: "panelMode", publicName: "panelMode", isSignal: true, isRequired: false, transformFunction: null }, fitted: { classPropertyName: "fitted", publicName: "fitted", isSignal: true, isRequired: false, transformFunction: null }, tabAlign: { classPropertyName: "tabAlign", publicName: "tabAlign", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", 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.data-skin": "hostAttrs.resolvedSkin()", "attr.data-icon-layout": "hostAttrs.resolvedIconLayout()", "attr.data-panel-mode": "hostAttrs.resolvedPanelMode()", "attr.data-fitted": "hostAttrs.resolvedFitted() ? '' : null", "attr.data-tab-align": "hostAttrs.resolvedTabAlign()", "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 }, { propertyName: "iconSlot", first: true, predicate: CngxTabIcon, descendants: true, isSignal: true }, { propertyName: "closeIconSlot", first: true, predicate: CngxTabCloseIcon, descendants: true, isSignal: true }, { propertyName: "addIconSlot", first: true, predicate: CngxTabAddIcon, descendants: true, isSignal: true }], exportAs: ["cngxTabGroup"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter, inputs: ["activeIndex", "activeIndex", "orientation", "orientation", "loop", "loop", "commitAction", "commitAction", "commitMode", "commitMode"], outputs: ["activeIndexChange", "activeIndexChange", "tabClose", "tabClose", "tabAdd", "tabAdd"] }, { 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 <div class=\"cngx-tabs__tab-wrapper\" role=\"presentation\">\n <button\n type=\"button\"\n class=\"cngx-tabs__tab\"\n [class.cngx-tab--rejected]=\"failedIdx === i\"\n [class.cngx-tabs__tab--closable]=\"dismiss.isTabClosable(tab)\"\n role=\"tab\"\n [id]=\"tabHeaderId(tab)\"\n [attr.data-tab-id]=\"tab.id\"\n [attr.tabindex]=\"tabTabindex(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 [attr.aria-keyshortcuts]=\"dismiss.isTabClosable(tab) ? 'Delete' : null\"\n (click)=\"handleHeaderClick(tab)\"\n (keydown)=\"handleTabKeydown(tab, $event)\"\n >\n @let iconTpl = templates.icon();\n @if (iconTpl) {\n <span class=\"cngx-tabs__icon\" aria-hidden=\"true\">\n <ng-container\n *ngTemplateOutlet=\"iconTpl; context: iconContextFor(tab, i)\"\n ></ng-container>\n </span>\n }\n <span class=\"cngx-tabs__text\">\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 @let subLabelTpl = subLabelTemplateFor(tab.id);\n @if (subLabelTpl || tab.subLabel()) {\n <span class=\"cngx-tabs__sublabel\">\n @if (subLabelTpl) {\n <ng-container *ngTemplateOutlet=\"subLabelTpl\"></ng-container>\n } @else {\n {{ tab.subLabel() }}\n }\n </span>\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 @if (dismiss.isTabClosable(tab)) {\n <button\n type=\"button\"\n class=\"cngx-tabs__close\"\n tabindex=\"-1\"\n [attr.aria-label]=\"dismiss.closeButtonLabel(tab)\"\n (click)=\"dismiss.handleClose(tab, $event)\"\n >\n @let closeIconTpl = templates.closeIcon();\n @if (closeIconTpl) {\n <ng-container\n *ngTemplateOutlet=\"closeIconTpl; context: dismiss.closeIconContextFor(tab)\"\n ></ng-container>\n } @else {\n <span aria-hidden=\"true\">{{ glyphs.closeIcon }}</span>\n }\n </button>\n }\n </div>\n }\n</div>\n@if (dismiss.resolvedAddable()) {\n <button\n type=\"button\"\n class=\"cngx-tabs__add\"\n [attr.aria-label]=\"i18n.addTab\"\n (click)=\"dismiss.handleAdd()\"\n >\n @let addIconTpl = templates.addIcon();\n @if (addIconTpl) {\n <ng-container *ngTemplateOutlet=\"addIconTpl\"></ng-container>\n } @else {\n <span aria-hidden=\"true\">{{ glyphs.addIcon }}</span>\n }\n </button>\n}\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 [attr.tabindex]=\"panelTabindex(tab)\"\n [hidden]=\"!isSelected(tab)\"\n >\n @if (shouldRenderContent(tab)) {\n @let contentTpl = contentTemplateFor(tab.id);\n @if (contentTpl) {\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n }\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);}@property --cngx-tab-affordance-size{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-tab-affordance-radius{syntax: \"*\"; inherits: false; initial-value: 50%;}@property --cngx-tab-affordance-hover-bg{syntax: \"*\"; inherits: false; initial-value: color-mix(in oklch,currentColor 14%,transparent);}@property --cngx-tab-label-line-height{syntax: \"*\"; inherits: true; initial-value: 1.4;}@property --cngx-tab-sublabel-font-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-tab-sublabel-color{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklab,currentColor 65%,transparent);}: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__text{display:flex;flex-direction:column;flex:1 1 auto;min-width:0}.cngx-tabs__label{min-width:0;overflow:hidden;text-overflow:ellipsis;line-height:var(--cngx-tab-label-line-height, 1.4)}.cngx-tabs__sublabel{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:var(--cngx-tab-sublabel-font-size, .8125rem);color:var(--cngx-tab-sublabel-color, color-mix(in oklab, currentColor 65%, transparent))}.cngx-tabs__tab-wrapper{position:relative;display:inline-flex;align-items:stretch}.cngx-tabs__tab--closable{padding-inline-end:calc(var(--cngx-tab-affordance-size, 1.25rem) + var(--cngx-tab-gap, .5rem) * 2)}.cngx-tabs__close,.cngx-tabs__add{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:var(--cngx-tab-affordance-size, 1.25rem);height:var(--cngx-tab-affordance-size, 1.25rem);padding:0;border:0;border-radius:var(--cngx-tab-affordance-radius, 50%);background:transparent;color:inherit;font:inherit;line-height:1;cursor:pointer}.cngx-tabs__close{position:absolute;inset-inline-end:var(--cngx-tab-gap, .5rem);top:50%;transform:translateY(-50%);z-index:1}.cngx-tabs__add{margin-inline-start:var(--cngx-tab-gap, .5rem);align-self:center}.cngx-tabs__close:hover,.cngx-tabs__add:hover{background:var( --cngx-tab-affordance-hover-bg, color-mix(in oklch, currentColor 14%, transparent) )}.cngx-tabs__close:focus-visible,.cngx-tabs__add:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}cngx-tab-group[data-orientation=vertical] .cngx-tabs__add{margin-inline-start:0;margin-block-start:var(--cngx-tab-gap, .5rem)}.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:max-content 1fr;gap:var(--cngx-tab-vertical-gap, 1rem);align-items:start}cngx-tab-group[data-orientation=vertical] .cngx-tabs__strip{flex-direction:column;flex-wrap:nowrap;overflow-x:hidden;overflow-y:hidden;scroll-snap-type:y proximity}cngx-tab-group[data-orientation=vertical] .cngx-tabs__tab{scroll-snap-align:start;white-space:normal;box-sizing:border-box;min-inline-size:100%}cngx-tab-group[data-orientation=vertical] .cngx-tabs__label{min-inline-size:auto;overflow:visible;text-overflow:clip}cngx-tab-group[data-fitted]:not([data-orientation=vertical]) .cngx-tabs__tab-wrapper{flex:1 1 0}cngx-tab-group[data-fitted]:not([data-orientation=vertical]) .cngx-tabs__tab{inline-size:100%;justify-content:center;text-align:center}cngx-tab-group[data-tab-align=center]:not([data-orientation=vertical]) .cngx-tabs__strip{justify-content:center}cngx-tab-group[data-tab-align=end]:not([data-orientation=vertical]) .cngx-tabs__strip{justify-content:flex-end}@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: true; initial-value: 1px solid oklch(.87 0 0);}@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: \"*\"; 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;}@property --cngx-tab-radius{syntax: \"*\"; inherits: true; initial-value: .5rem;}@property --cngx-tab-active-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-tab-inactive-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 0 0);}@property --cngx-tab-surface-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.87 0 0);}@property --cngx-tab-surface-border-width{syntax: \"<length>\"; inherits: true; initial-value: 1px;}@property --cngx-tab-pill-active-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-pill-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.95 0 0);}@property --cngx-tab-segmented-track-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 0 0);}@property --cngx-tab-segmented-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.93 0 0);}@property --cngx-tab-segmented-active-shadow{syntax: \"*\"; inherits: true; initial-value: 0 1px 2px oklch(0 0 0 / .06);}@property --cngx-tab-pill-outline-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-tab-pill-outline-bg{syntax: \"<color>\"; inherits: true; initial-value: color-mix(in oklch,oklch(.66 .19 50) 12%,transparent);}@property --cngx-tab-pill-radius{syntax: \"<length>\"; inherits: true; initial-value: 100px;}@property --cngx-tab-contained-accent-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-tab-contained-accent-thickness{syntax: \"<length>\"; inherits: true; initial-value: 3px;}}@layer cngx.components{@scope(.cngx-tab-group){:scope{font:inherit;--cngx-tab-active-indicator-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-strip-border: 1px solid var(--cngx-color-border, oklch(.88 .005 250))}.cngx-tabs__panel{container-type:inline-size;container-name:var(--cngx-tab-panel-container-name, cngx-tab-panel)}.cngx-tabs__strip{border-bottom:var(--cngx-tab-strip-border, 1px solid currentColor);gap:0;padding:0}.cngx-tabs__tab{position:relative;--cngx-tab-padding: .625rem 1rem;--cngx-tab-focus-ring: var(--cngx-tab-focus-ring-width, 2px) solid var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-focus-offset: -2px;font-size:var(--cngx-tab-font-size, .875rem);font-weight:var(--cngx-tab-font-weight, 500);transition:color var(--cngx-tab-transition-duration, .15s) ease,background var(--cngx-tab-transition-duration, .15s) ease,box-shadow var(--cngx-tab-transition-duration, .15s) ease}:where(:scope[data-orientation=vertical]) .cngx-tabs__tab{--cngx-tab-padding: .5rem 1rem}.cngx-tabs__tab:after{content:\"\";position:absolute;inset-inline:0;bottom:0;block-size:var(--cngx-tab-indicator-thickness, 2px);background:var(--cngx-tab-active-indicator-color, currentColor);border-radius:var(--cngx-tab-indicator-thickness, 2px) var(--cngx-tab-indicator-thickness, 2px) 0 0;transform:scaleX(0);transition:transform var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){color:var(--cngx-tab-hover-color, var(--cngx-tab-active-color))}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color);box-shadow:none}.cngx-tabs__tab[aria-selected=true]:after{transform:scaleX(1)}:scope[data-orientation=vertical] .cngx-tabs__strip{border-bottom:0;border-inline-end:var(--cngx-tab-strip-border, 1px solid currentColor);padding:0}:scope[data-orientation=vertical] .cngx-tabs__tab:after{inset-inline:auto;inset-block:0;inset-inline-end:0;inline-size:var(--cngx-tab-indicator-thickness, 2px);block-size:auto;border-start-start-radius:var(--cngx-tab-indicator-thickness, 2px);border-end-start-radius:var(--cngx-tab-indicator-thickness, 2px);border-start-end-radius:0;border-end-end-radius:0;transform:scaleY(0)}:scope[data-orientation=vertical] .cngx-tabs__tab[aria-selected=true]:after{transform:scaleY(1)}.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}.cngx-tabs__icon{display:inline-flex;align-items:center;flex:0 0 auto}:scope[data-icon-layout=start] .cngx-tabs__tab{flex-direction:row}:scope[data-icon-layout=end] .cngx-tabs__tab{flex-direction:row-reverse}:scope[data-icon-layout=top] .cngx-tabs__tab{flex-direction:column;align-items:center;text-align:center}:scope[data-icon-layout=start] .cngx-tabs__icon,:scope[data-icon-layout=end] .cngx-tabs__icon{align-self:flex-start;min-height:calc(var(--cngx-tab-label-line-height, 1.4) * 1em)}:scope[data-icon-layout=only] .cngx-tabs__text,:scope[data-icon-layout=only] .cngx-tabs__label,:scope[data-icon-layout=only] .cngx-tabs__sublabel{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(prefers-reduced-motion:reduce){.cngx-tabs__tab,.cngx-tabs__tab:before,.cngx-tabs__tab:after{transition:none!important}}}@scope(.cngx-tab-group[data-skin=contained]){:scope{--cngx-tab-active-bg: var(--cngx-color-surface, oklch(1 0 0));--cngx-tab-inactive-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 25% );--cngx-tab-surface-border-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-tab-contained-accent-color: var(--cngx-color-primary, oklch(.66 .19 50))}.cngx-tabs__tab:after{display:none}.cngx-tabs__strip{border-bottom:0;gap:0;padding:0}.cngx-tabs__strip-wrapper{position:relative;z-index:1}.cngx-tabs__tab{--cngx-tab-padding: .625rem 1.25rem;background:var(--cngx-tab-inactive-bg, oklch(.97 0 0));border:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-bottom:0;border-radius:0;margin-bottom:0;margin-inline-end:-1px}.cngx-tabs__tab[aria-selected=true]{font-weight:var(--cngx-tab-active-font-weight, 600)}.cngx-tabs__tab:before{content:\"\";position:absolute;inset-inline:0;top:-1px;height:var(--cngx-tab-contained-accent-thickness, 3px);background:var(--cngx-tab-contained-accent-color, oklch(.66 .19 50));transform:scaleX(0);transition:transform var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){background:color-mix(in oklch,var(--cngx-tab-inactive-bg, oklch(.97 0 0)) 60%,var(--cngx-tab-active-bg, oklch(1 0 0)))}.cngx-tabs__tab+.cngx-tabs__tab{margin-inline-start:calc(var(--cngx-tab-surface-border-width, 1px) * -1)}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-active-bg, oklch(1 0 0));color:var(--cngx-tab-active-color, currentColor);box-shadow:none;margin-bottom:0;position:relative;z-index:1}.cngx-tabs__tab[aria-selected=true]:before{transform:scaleX(1)}.cngx-tabs__panels{border:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-radius:0;margin-block-start:calc(var(--cngx-tab-surface-border-width, 1px) * -1);background:var(--cngx-tab-active-bg, oklch(1 0 0))}}@scope(.cngx-tab-group[data-skin=contained][data-orientation=vertical]){:scope[data-orientation=vertical]{--cngx-tab-vertical-gap: 0;align-items:stretch}:scope[data-orientation=vertical] .cngx-tabs__strip{border-bottom:0;border-inline-end:0;padding:0}.cngx-tabs__tab{border:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-radius:0;margin-inline-end:0;margin-bottom:calc(var(--cngx-tab-surface-border-width, 1px) * -1)}.cngx-tabs__tab:before{inset-inline:auto;inset-inline-start:-1px;inset-block:0;width:var(--cngx-tab-contained-accent-thickness, 3px);height:auto;transform:scaleY(0)}.cngx-tabs__tab[aria-selected=true]:before{transform:scaleY(1)}.cngx-tabs__tab[aria-selected=true]{border-inline-end:0;margin-bottom:calc(var(--cngx-tab-surface-border-width, 1px) * -1);margin-inline-end:0}.cngx-tabs__tab-wrapper:last-child .cngx-tabs__tab{margin-bottom:0}.cngx-tabs__panels{border-block-start:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-inline-start:0;margin-block-start:0}}@scope(.cngx-tab-group[data-skin=pill]){:scope{--cngx-tab-active-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-pill-active-color: var(--cngx-color-on-primary, oklch(1 0 0));--cngx-tab-pill-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 8%, transparent )}.cngx-tabs__strip{border-bottom:0;gap:var(--cngx-tab-pill-gap, .375rem);padding:var(--cngx-tab-pill-strip-padding, .25rem)}.cngx-tabs__tab{--cngx-tab-padding: .4375rem .875rem;--cngx-tab-focus-offset: 1px;background:transparent;border:0;border-radius:var(--cngx-tab-pill-radius, 100px);margin-bottom:0}.cngx-tabs__tab:after{display:none}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){background:var(--cngx-tab-pill-hover-bg, oklch(.95 0 0))}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-active-bg, oklch(.66 .19 50));color:var(--cngx-tab-pill-active-color, oklch(1 0 0));box-shadow:none}}@scope(.cngx-tab-group[data-skin=pill][data-orientation=vertical]){:scope[data-orientation=vertical] .cngx-tabs__strip{border-inline-end:0;padding:var(--cngx-tab-pill-strip-padding, .25rem)}:scope[data-orientation=vertical] .cngx-tabs__tab{--cngx-tab-padding: .4375rem 1rem;border-inline-end:0;margin-inline-end:0;justify-content:center;text-align:center}}@scope(.cngx-tab-group[data-skin=pill-outline]){:scope{--cngx-tab-pill-outline-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-pill-outline-bg: color-mix( in oklch, var(--cngx-tab-pill-outline-color, oklch(.66 .19 50)) 12%, transparent )}.cngx-tabs__strip{border-bottom:0;gap:var(--cngx-tab-pill-gap, .375rem);padding:var(--cngx-tab-pill-strip-padding, .25rem)}.cngx-tabs__tab{--cngx-tab-padding: .4375rem .875rem;--cngx-tab-focus-offset: 1px;background:transparent;border:var(--cngx-tab-surface-border-width, 1px) solid transparent;border-radius:var(--cngx-tab-pill-radius, 100px);margin-bottom:0}.cngx-tabs__tab:after{display:none}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){border-color:var(--cngx-tab-surface-border-color, oklch(.87 0 0))}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-pill-outline-bg);border-color:var(--cngx-tab-pill-outline-color, oklch(.66 .19 50));color:var(--cngx-tab-pill-outline-color, oklch(.66 .19 50));box-shadow:none}}@scope(.cngx-tab-group[data-skin=segmented]){:scope{--cngx-tab-segmented-track-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 25% );--cngx-tab-active-bg: var(--cngx-color-surface, oklch(1 0 0));--cngx-tab-segmented-hover-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 45% )}.cngx-tabs__strip{background:var(--cngx-tab-segmented-track-bg, oklch(.96 0 0));border-bottom:0;border-radius:var(--cngx-tab-radius, .5rem);gap:var(--cngx-tab-segmented-gap, .25rem);padding:var(--cngx-tab-segmented-track-padding, .25rem);flex:0 1 auto;align-self:start}:scope[data-fitted]:not([data-orientation=vertical]) .cngx-tabs__strip{flex:1 1 auto}:scope[data-tab-align=center]:not([data-orientation=vertical]) .cngx-tabs__strip{margin-inline:auto}:scope[data-tab-align=end]:not([data-orientation=vertical]) .cngx-tabs__strip{margin-inline-start:auto}.cngx-tabs__tab{--cngx-tab-padding: .5rem .875rem;--cngx-tab-focus-offset: 1px;background:transparent;border:0;border-radius:calc(var(--cngx-tab-radius, .5rem) - .125rem);margin-bottom:0}.cngx-tabs__tab:after{display:none}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){background:var(--cngx-tab-segmented-hover-bg, oklch(.93 0 0))}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-active-bg, oklch(1 0 0));color:var(--cngx-tab-active-color, currentColor);box-shadow:var(--cngx-tab-segmented-active-shadow, 0 1px 2px oklch(0 0 0 / .06))}}@scope(.cngx-tab-group[data-skin=segmented][data-orientation=vertical]){:scope[data-orientation=vertical] .cngx-tabs__strip{border-inline-end:0;align-self:start;padding:var(--cngx-tab-segmented-track-padding, .25rem)}:scope[data-orientation=vertical] .cngx-tabs__tab{--cngx-tab-padding: .5rem 1rem;border-inline-end:0;margin-inline-end:0}}@scope(.cngx-tab-group[data-skin=pill-outline][data-orientation=vertical]){:scope[data-orientation=vertical] .cngx-tabs__strip{border-inline-end:0;padding:var(--cngx-tab-pill-strip-padding, .25rem)}:scope[data-orientation=vertical] .cngx-tabs__tab{--cngx-tab-padding: .4375rem 1rem;border:var(--cngx-tab-surface-border-width, 1px) solid transparent;margin-bottom:0;margin-inline-end:0;justify-content:center;text-align:center}:scope[data-orientation=vertical] .cngx-tabs__tab[aria-selected=true]{border-color:var(--cngx-tab-pill-outline-color, oklch(.66 .19 50))}}}@media(prefers-color-scheme:dark){.cngx-tab-group[data-skin=segmented]{--cngx-tab-segmented-active-shadow: 0 1px 3px oklch(0 0 0 / .3)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CngxLiveRegion, selector: "[cngxLiveRegion]", inputs: ["politeness", "atomic", "relevant"], exportAs: ["cngxLiveRegion"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
178
410
|
}
|
|
179
411
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabGroup, decorators: [{
|
|
180
412
|
type: Component,
|
|
181
|
-
args: [{ selector: 'cngx-tab-group', exportAs: 'cngxTabGroup', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, CngxLiveRegion,
|
|
413
|
+
args: [{ selector: 'cngx-tab-group', exportAs: 'cngxTabGroup', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, CngxLiveRegion], encapsulation: ViewEncapsulation.None, hostDirectives: [
|
|
182
414
|
{
|
|
183
415
|
directive: CngxTabGroupPresenter,
|
|
184
|
-
inputs: [
|
|
185
|
-
|
|
186
|
-
'orientation',
|
|
187
|
-
'loop',
|
|
188
|
-
'commitAction',
|
|
189
|
-
'commitMode',
|
|
190
|
-
],
|
|
191
|
-
outputs: ['activeIndexChange'],
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
directive: CngxRovingTabindex,
|
|
195
|
-
inputs: ['orientation', 'loop'],
|
|
416
|
+
inputs: ['activeIndex', 'orientation', 'loop', 'commitAction', 'commitMode'],
|
|
417
|
+
outputs: ['activeIndexChange', 'tabClose', 'tabAdd'],
|
|
196
418
|
},
|
|
197
419
|
{ directive: CngxFocusRestore },
|
|
198
420
|
], providers: [{ provide: CNGX_TAB_PANEL_HOST, useExisting: CngxTabGroup }], host: {
|
|
421
|
+
class: 'cngx-tab-group',
|
|
199
422
|
role: 'group',
|
|
200
423
|
'[attr.aria-roledescription]': 'announcements.tabsRoleDescription()',
|
|
201
424
|
'[attr.aria-orientation]': 'presenter.orientation()',
|
|
202
425
|
'[attr.data-orientation]': 'presenter.orientation()',
|
|
426
|
+
'[attr.data-skin]': 'hostAttrs.resolvedSkin()',
|
|
427
|
+
'[attr.data-icon-layout]': 'hostAttrs.resolvedIconLayout()',
|
|
428
|
+
'[attr.data-panel-mode]': 'hostAttrs.resolvedPanelMode()',
|
|
429
|
+
'[attr.data-fitted]': "hostAttrs.resolvedFitted() ? '' : null",
|
|
430
|
+
'[attr.data-tab-align]': 'hostAttrs.resolvedTabAlign()',
|
|
203
431
|
'[attr.aria-label]': 'announcements.resolvedAriaLabel()',
|
|
204
432
|
'[attr.aria-labelledby]': 'ariaLabelledBy()',
|
|
205
433
|
'[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"] }]
|
|
207
|
-
}], 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), { ...{
|
|
434
|
+
}, 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 <div class=\"cngx-tabs__tab-wrapper\" role=\"presentation\">\n <button\n type=\"button\"\n class=\"cngx-tabs__tab\"\n [class.cngx-tab--rejected]=\"failedIdx === i\"\n [class.cngx-tabs__tab--closable]=\"dismiss.isTabClosable(tab)\"\n role=\"tab\"\n [id]=\"tabHeaderId(tab)\"\n [attr.data-tab-id]=\"tab.id\"\n [attr.tabindex]=\"tabTabindex(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 [attr.aria-keyshortcuts]=\"dismiss.isTabClosable(tab) ? 'Delete' : null\"\n (click)=\"handleHeaderClick(tab)\"\n (keydown)=\"handleTabKeydown(tab, $event)\"\n >\n @let iconTpl = templates.icon();\n @if (iconTpl) {\n <span class=\"cngx-tabs__icon\" aria-hidden=\"true\">\n <ng-container\n *ngTemplateOutlet=\"iconTpl; context: iconContextFor(tab, i)\"\n ></ng-container>\n </span>\n }\n <span class=\"cngx-tabs__text\">\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 @let subLabelTpl = subLabelTemplateFor(tab.id);\n @if (subLabelTpl || tab.subLabel()) {\n <span class=\"cngx-tabs__sublabel\">\n @if (subLabelTpl) {\n <ng-container *ngTemplateOutlet=\"subLabelTpl\"></ng-container>\n } @else {\n {{ tab.subLabel() }}\n }\n </span>\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 @if (dismiss.isTabClosable(tab)) {\n <button\n type=\"button\"\n class=\"cngx-tabs__close\"\n tabindex=\"-1\"\n [attr.aria-label]=\"dismiss.closeButtonLabel(tab)\"\n (click)=\"dismiss.handleClose(tab, $event)\"\n >\n @let closeIconTpl = templates.closeIcon();\n @if (closeIconTpl) {\n <ng-container\n *ngTemplateOutlet=\"closeIconTpl; context: dismiss.closeIconContextFor(tab)\"\n ></ng-container>\n } @else {\n <span aria-hidden=\"true\">{{ glyphs.closeIcon }}</span>\n }\n </button>\n }\n </div>\n }\n</div>\n@if (dismiss.resolvedAddable()) {\n <button\n type=\"button\"\n class=\"cngx-tabs__add\"\n [attr.aria-label]=\"i18n.addTab\"\n (click)=\"dismiss.handleAdd()\"\n >\n @let addIconTpl = templates.addIcon();\n @if (addIconTpl) {\n <ng-container *ngTemplateOutlet=\"addIconTpl\"></ng-container>\n } @else {\n <span aria-hidden=\"true\">{{ glyphs.addIcon }}</span>\n }\n </button>\n}\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 [attr.tabindex]=\"panelTabindex(tab)\"\n [hidden]=\"!isSelected(tab)\"\n >\n @if (shouldRenderContent(tab)) {\n @let contentTpl = contentTemplateFor(tab.id);\n @if (contentTpl) {\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n }\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);}@property --cngx-tab-affordance-size{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-tab-affordance-radius{syntax: \"*\"; inherits: false; initial-value: 50%;}@property --cngx-tab-affordance-hover-bg{syntax: \"*\"; inherits: false; initial-value: color-mix(in oklch,currentColor 14%,transparent);}@property --cngx-tab-label-line-height{syntax: \"*\"; inherits: true; initial-value: 1.4;}@property --cngx-tab-sublabel-font-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-tab-sublabel-color{syntax: \"*\"; inherits: true; initial-value: color-mix(in oklab,currentColor 65%,transparent);}: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__text{display:flex;flex-direction:column;flex:1 1 auto;min-width:0}.cngx-tabs__label{min-width:0;overflow:hidden;text-overflow:ellipsis;line-height:var(--cngx-tab-label-line-height, 1.4)}.cngx-tabs__sublabel{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:var(--cngx-tab-sublabel-font-size, .8125rem);color:var(--cngx-tab-sublabel-color, color-mix(in oklab, currentColor 65%, transparent))}.cngx-tabs__tab-wrapper{position:relative;display:inline-flex;align-items:stretch}.cngx-tabs__tab--closable{padding-inline-end:calc(var(--cngx-tab-affordance-size, 1.25rem) + var(--cngx-tab-gap, .5rem) * 2)}.cngx-tabs__close,.cngx-tabs__add{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:var(--cngx-tab-affordance-size, 1.25rem);height:var(--cngx-tab-affordance-size, 1.25rem);padding:0;border:0;border-radius:var(--cngx-tab-affordance-radius, 50%);background:transparent;color:inherit;font:inherit;line-height:1;cursor:pointer}.cngx-tabs__close{position:absolute;inset-inline-end:var(--cngx-tab-gap, .5rem);top:50%;transform:translateY(-50%);z-index:1}.cngx-tabs__add{margin-inline-start:var(--cngx-tab-gap, .5rem);align-self:center}.cngx-tabs__close:hover,.cngx-tabs__add:hover{background:var( --cngx-tab-affordance-hover-bg, color-mix(in oklch, currentColor 14%, transparent) )}.cngx-tabs__close:focus-visible,.cngx-tabs__add:focus-visible{outline:var(--cngx-tab-focus-ring, 2px solid currentColor);outline-offset:var(--cngx-tab-focus-offset, 2px)}cngx-tab-group[data-orientation=vertical] .cngx-tabs__add{margin-inline-start:0;margin-block-start:var(--cngx-tab-gap, .5rem)}.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:max-content 1fr;gap:var(--cngx-tab-vertical-gap, 1rem);align-items:start}cngx-tab-group[data-orientation=vertical] .cngx-tabs__strip{flex-direction:column;flex-wrap:nowrap;overflow-x:hidden;overflow-y:hidden;scroll-snap-type:y proximity}cngx-tab-group[data-orientation=vertical] .cngx-tabs__tab{scroll-snap-align:start;white-space:normal;box-sizing:border-box;min-inline-size:100%}cngx-tab-group[data-orientation=vertical] .cngx-tabs__label{min-inline-size:auto;overflow:visible;text-overflow:clip}cngx-tab-group[data-fitted]:not([data-orientation=vertical]) .cngx-tabs__tab-wrapper{flex:1 1 0}cngx-tab-group[data-fitted]:not([data-orientation=vertical]) .cngx-tabs__tab{inline-size:100%;justify-content:center;text-align:center}cngx-tab-group[data-tab-align=center]:not([data-orientation=vertical]) .cngx-tabs__strip{justify-content:center}cngx-tab-group[data-tab-align=end]:not([data-orientation=vertical]) .cngx-tabs__strip{justify-content:flex-end}@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: true; initial-value: 1px solid oklch(.87 0 0);}@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: \"*\"; 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;}@property --cngx-tab-radius{syntax: \"*\"; inherits: true; initial-value: .5rem;}@property --cngx-tab-active-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-tab-inactive-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 0 0);}@property --cngx-tab-surface-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.87 0 0);}@property --cngx-tab-surface-border-width{syntax: \"<length>\"; inherits: true; initial-value: 1px;}@property --cngx-tab-pill-active-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tab-pill-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.95 0 0);}@property --cngx-tab-segmented-track-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 0 0);}@property --cngx-tab-segmented-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.93 0 0);}@property --cngx-tab-segmented-active-shadow{syntax: \"*\"; inherits: true; initial-value: 0 1px 2px oklch(0 0 0 / .06);}@property --cngx-tab-pill-outline-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-tab-pill-outline-bg{syntax: \"<color>\"; inherits: true; initial-value: color-mix(in oklch,oklch(.66 .19 50) 12%,transparent);}@property --cngx-tab-pill-radius{syntax: \"<length>\"; inherits: true; initial-value: 100px;}@property --cngx-tab-contained-accent-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-tab-contained-accent-thickness{syntax: \"<length>\"; inherits: true; initial-value: 3px;}}@layer cngx.components{@scope(.cngx-tab-group){:scope{font:inherit;--cngx-tab-active-indicator-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-strip-border: 1px solid var(--cngx-color-border, oklch(.88 .005 250))}.cngx-tabs__panel{container-type:inline-size;container-name:var(--cngx-tab-panel-container-name, cngx-tab-panel)}.cngx-tabs__strip{border-bottom:var(--cngx-tab-strip-border, 1px solid currentColor);gap:0;padding:0}.cngx-tabs__tab{position:relative;--cngx-tab-padding: .625rem 1rem;--cngx-tab-focus-ring: var(--cngx-tab-focus-ring-width, 2px) solid var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-focus-offset: -2px;font-size:var(--cngx-tab-font-size, .875rem);font-weight:var(--cngx-tab-font-weight, 500);transition:color var(--cngx-tab-transition-duration, .15s) ease,background var(--cngx-tab-transition-duration, .15s) ease,box-shadow var(--cngx-tab-transition-duration, .15s) ease}:where(:scope[data-orientation=vertical]) .cngx-tabs__tab{--cngx-tab-padding: .5rem 1rem}.cngx-tabs__tab:after{content:\"\";position:absolute;inset-inline:0;bottom:0;block-size:var(--cngx-tab-indicator-thickness, 2px);background:var(--cngx-tab-active-indicator-color, currentColor);border-radius:var(--cngx-tab-indicator-thickness, 2px) var(--cngx-tab-indicator-thickness, 2px) 0 0;transform:scaleX(0);transition:transform var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){color:var(--cngx-tab-hover-color, var(--cngx-tab-active-color))}.cngx-tabs__tab[aria-selected=true]{color:var(--cngx-tab-active-color);box-shadow:none}.cngx-tabs__tab[aria-selected=true]:after{transform:scaleX(1)}:scope[data-orientation=vertical] .cngx-tabs__strip{border-bottom:0;border-inline-end:var(--cngx-tab-strip-border, 1px solid currentColor);padding:0}:scope[data-orientation=vertical] .cngx-tabs__tab:after{inset-inline:auto;inset-block:0;inset-inline-end:0;inline-size:var(--cngx-tab-indicator-thickness, 2px);block-size:auto;border-start-start-radius:var(--cngx-tab-indicator-thickness, 2px);border-end-start-radius:var(--cngx-tab-indicator-thickness, 2px);border-start-end-radius:0;border-end-end-radius:0;transform:scaleY(0)}:scope[data-orientation=vertical] .cngx-tabs__tab[aria-selected=true]:after{transform:scaleY(1)}.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}.cngx-tabs__icon{display:inline-flex;align-items:center;flex:0 0 auto}:scope[data-icon-layout=start] .cngx-tabs__tab{flex-direction:row}:scope[data-icon-layout=end] .cngx-tabs__tab{flex-direction:row-reverse}:scope[data-icon-layout=top] .cngx-tabs__tab{flex-direction:column;align-items:center;text-align:center}:scope[data-icon-layout=start] .cngx-tabs__icon,:scope[data-icon-layout=end] .cngx-tabs__icon{align-self:flex-start;min-height:calc(var(--cngx-tab-label-line-height, 1.4) * 1em)}:scope[data-icon-layout=only] .cngx-tabs__text,:scope[data-icon-layout=only] .cngx-tabs__label,:scope[data-icon-layout=only] .cngx-tabs__sublabel{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(prefers-reduced-motion:reduce){.cngx-tabs__tab,.cngx-tabs__tab:before,.cngx-tabs__tab:after{transition:none!important}}}@scope(.cngx-tab-group[data-skin=contained]){:scope{--cngx-tab-active-bg: var(--cngx-color-surface, oklch(1 0 0));--cngx-tab-inactive-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 25% );--cngx-tab-surface-border-color: var(--cngx-color-border, oklch(.88 .005 250));--cngx-tab-contained-accent-color: var(--cngx-color-primary, oklch(.66 .19 50))}.cngx-tabs__tab:after{display:none}.cngx-tabs__strip{border-bottom:0;gap:0;padding:0}.cngx-tabs__strip-wrapper{position:relative;z-index:1}.cngx-tabs__tab{--cngx-tab-padding: .625rem 1.25rem;background:var(--cngx-tab-inactive-bg, oklch(.97 0 0));border:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-bottom:0;border-radius:0;margin-bottom:0;margin-inline-end:-1px}.cngx-tabs__tab[aria-selected=true]{font-weight:var(--cngx-tab-active-font-weight, 600)}.cngx-tabs__tab:before{content:\"\";position:absolute;inset-inline:0;top:-1px;height:var(--cngx-tab-contained-accent-thickness, 3px);background:var(--cngx-tab-contained-accent-color, oklch(.66 .19 50));transform:scaleX(0);transition:transform var(--cngx-tab-transition-duration, .15s) ease}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){background:color-mix(in oklch,var(--cngx-tab-inactive-bg, oklch(.97 0 0)) 60%,var(--cngx-tab-active-bg, oklch(1 0 0)))}.cngx-tabs__tab+.cngx-tabs__tab{margin-inline-start:calc(var(--cngx-tab-surface-border-width, 1px) * -1)}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-active-bg, oklch(1 0 0));color:var(--cngx-tab-active-color, currentColor);box-shadow:none;margin-bottom:0;position:relative;z-index:1}.cngx-tabs__tab[aria-selected=true]:before{transform:scaleX(1)}.cngx-tabs__panels{border:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-radius:0;margin-block-start:calc(var(--cngx-tab-surface-border-width, 1px) * -1);background:var(--cngx-tab-active-bg, oklch(1 0 0))}}@scope(.cngx-tab-group[data-skin=contained][data-orientation=vertical]){:scope[data-orientation=vertical]{--cngx-tab-vertical-gap: 0;align-items:stretch}:scope[data-orientation=vertical] .cngx-tabs__strip{border-bottom:0;border-inline-end:0;padding:0}.cngx-tabs__tab{border:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-radius:0;margin-inline-end:0;margin-bottom:calc(var(--cngx-tab-surface-border-width, 1px) * -1)}.cngx-tabs__tab:before{inset-inline:auto;inset-inline-start:-1px;inset-block:0;width:var(--cngx-tab-contained-accent-thickness, 3px);height:auto;transform:scaleY(0)}.cngx-tabs__tab[aria-selected=true]:before{transform:scaleY(1)}.cngx-tabs__tab[aria-selected=true]{border-inline-end:0;margin-bottom:calc(var(--cngx-tab-surface-border-width, 1px) * -1);margin-inline-end:0}.cngx-tabs__tab-wrapper:last-child .cngx-tabs__tab{margin-bottom:0}.cngx-tabs__panels{border-block-start:var(--cngx-tab-surface-border-width, 1px) solid var(--cngx-tab-surface-border-color, oklch(.87 0 0));border-inline-start:0;margin-block-start:0}}@scope(.cngx-tab-group[data-skin=pill]){:scope{--cngx-tab-active-bg: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-pill-active-color: var(--cngx-color-on-primary, oklch(1 0 0));--cngx-tab-pill-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 8%, transparent )}.cngx-tabs__strip{border-bottom:0;gap:var(--cngx-tab-pill-gap, .375rem);padding:var(--cngx-tab-pill-strip-padding, .25rem)}.cngx-tabs__tab{--cngx-tab-padding: .4375rem .875rem;--cngx-tab-focus-offset: 1px;background:transparent;border:0;border-radius:var(--cngx-tab-pill-radius, 100px);margin-bottom:0}.cngx-tabs__tab:after{display:none}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){background:var(--cngx-tab-pill-hover-bg, oklch(.95 0 0))}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-active-bg, oklch(.66 .19 50));color:var(--cngx-tab-pill-active-color, oklch(1 0 0));box-shadow:none}}@scope(.cngx-tab-group[data-skin=pill][data-orientation=vertical]){:scope[data-orientation=vertical] .cngx-tabs__strip{border-inline-end:0;padding:var(--cngx-tab-pill-strip-padding, .25rem)}:scope[data-orientation=vertical] .cngx-tabs__tab{--cngx-tab-padding: .4375rem 1rem;border-inline-end:0;margin-inline-end:0;justify-content:center;text-align:center}}@scope(.cngx-tab-group[data-skin=pill-outline]){:scope{--cngx-tab-pill-outline-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-tab-pill-outline-bg: color-mix( in oklch, var(--cngx-tab-pill-outline-color, oklch(.66 .19 50)) 12%, transparent )}.cngx-tabs__strip{border-bottom:0;gap:var(--cngx-tab-pill-gap, .375rem);padding:var(--cngx-tab-pill-strip-padding, .25rem)}.cngx-tabs__tab{--cngx-tab-padding: .4375rem .875rem;--cngx-tab-focus-offset: 1px;background:transparent;border:var(--cngx-tab-surface-border-width, 1px) solid transparent;border-radius:var(--cngx-tab-pill-radius, 100px);margin-bottom:0}.cngx-tabs__tab:after{display:none}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){border-color:var(--cngx-tab-surface-border-color, oklch(.87 0 0))}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-pill-outline-bg);border-color:var(--cngx-tab-pill-outline-color, oklch(.66 .19 50));color:var(--cngx-tab-pill-outline-color, oklch(.66 .19 50));box-shadow:none}}@scope(.cngx-tab-group[data-skin=segmented]){:scope{--cngx-tab-segmented-track-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 25% );--cngx-tab-active-bg: var(--cngx-color-surface, oklch(1 0 0));--cngx-tab-segmented-hover-bg: color-mix( in oklch, var(--cngx-color-surface, oklch(1 0 0)), var(--cngx-color-border, oklch(.88 .005 250)) 45% )}.cngx-tabs__strip{background:var(--cngx-tab-segmented-track-bg, oklch(.96 0 0));border-bottom:0;border-radius:var(--cngx-tab-radius, .5rem);gap:var(--cngx-tab-segmented-gap, .25rem);padding:var(--cngx-tab-segmented-track-padding, .25rem);flex:0 1 auto;align-self:start}:scope[data-fitted]:not([data-orientation=vertical]) .cngx-tabs__strip{flex:1 1 auto}:scope[data-tab-align=center]:not([data-orientation=vertical]) .cngx-tabs__strip{margin-inline:auto}:scope[data-tab-align=end]:not([data-orientation=vertical]) .cngx-tabs__strip{margin-inline-start:auto}.cngx-tabs__tab{--cngx-tab-padding: .5rem .875rem;--cngx-tab-focus-offset: 1px;background:transparent;border:0;border-radius:calc(var(--cngx-tab-radius, .5rem) - .125rem);margin-bottom:0}.cngx-tabs__tab:after{display:none}.cngx-tabs__tab:hover:not([aria-disabled=true]):not([aria-selected=true]){background:var(--cngx-tab-segmented-hover-bg, oklch(.93 0 0))}.cngx-tabs__tab[aria-selected=true]{background:var(--cngx-tab-active-bg, oklch(1 0 0));color:var(--cngx-tab-active-color, currentColor);box-shadow:var(--cngx-tab-segmented-active-shadow, 0 1px 2px oklch(0 0 0 / .06))}}@scope(.cngx-tab-group[data-skin=segmented][data-orientation=vertical]){:scope[data-orientation=vertical] .cngx-tabs__strip{border-inline-end:0;align-self:start;padding:var(--cngx-tab-segmented-track-padding, .25rem)}:scope[data-orientation=vertical] .cngx-tabs__tab{--cngx-tab-padding: .5rem 1rem;border-inline-end:0;margin-inline-end:0}}@scope(.cngx-tab-group[data-skin=pill-outline][data-orientation=vertical]){:scope[data-orientation=vertical] .cngx-tabs__strip{border-inline-end:0;padding:var(--cngx-tab-pill-strip-padding, .25rem)}:scope[data-orientation=vertical] .cngx-tabs__tab{--cngx-tab-padding: .4375rem 1rem;border:var(--cngx-tab-surface-border-width, 1px) solid transparent;margin-bottom:0;margin-inline-end:0;justify-content:center;text-align:center}:scope[data-orientation=vertical] .cngx-tabs__tab[aria-selected=true]{border-color:var(--cngx-tab-pill-outline-color, oklch(.66 .19 50))}}}@media(prefers-color-scheme:dark){.cngx-tab-group[data-skin=segmented]{--cngx-tab-segmented-active-shadow: 0 1px 3px oklch(0 0 0 / .3)}}\n"] }]
|
|
435
|
+
}], 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 }] }], skin: [{ type: i0.Input, args: [{ isSignal: true, alias: "skin", required: false }] }], iconLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconLayout", required: false }] }], panelMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelMode", required: false }] }], fitted: [{ type: i0.Input, args: [{ isSignal: true, alias: "fitted", required: false }] }], tabAlign: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabAlign", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], addable: [{ type: i0.Input, args: [{ isSignal: true, alias: "addable", required: false }] }], tabDirectives: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxTab), { ...{
|
|
208
436
|
descendants: true,
|
|
209
|
-
}, 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 }] }] } });
|
|
437
|
+
}, 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 }] }], iconSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabIcon), { isSignal: true }] }], closeIconSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabCloseIcon), { isSignal: true }] }], addIconSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabAddIcon), { isSignal: true }] }] } });
|
|
210
438
|
|
|
211
|
-
/**
|
|
439
|
+
/**
|
|
440
|
+
* Structural equal for `hiddenTabs` - same ids in same order.
|
|
441
|
+
*
|
|
442
|
+
* @internal
|
|
443
|
+
*/
|
|
212
444
|
function tabIdListEqual(a, b) {
|
|
213
445
|
if (a === b) {
|
|
214
446
|
return true;
|
|
@@ -223,13 +455,19 @@ function tabIdListEqual(a, b) {
|
|
|
223
455
|
}
|
|
224
456
|
return true;
|
|
225
457
|
}
|
|
226
|
-
/**
|
|
458
|
+
/**
|
|
459
|
+
* Auto-open keys for the trigger button (APG combobox).
|
|
460
|
+
*
|
|
461
|
+
* @internal
|
|
462
|
+
*/
|
|
227
463
|
const NAV_OPEN_KEYS = new Set(['ArrowDown', 'ArrowUp', 'Home', 'End']);
|
|
228
464
|
/**
|
|
229
465
|
* Structural equal for `visibilityState`. Without this, the
|
|
230
466
|
* `update((prev) => new Map(prev))` cycle in `handleIntersections`
|
|
231
467
|
* cascades into `hiddenTabs` on every IO fire even when no tab
|
|
232
468
|
* actually flipped visibility.
|
|
469
|
+
*
|
|
470
|
+
* @internal
|
|
233
471
|
*/
|
|
234
472
|
function mapBoolEqual(a, b) {
|
|
235
473
|
if (a === b) {
|
|
@@ -251,12 +489,22 @@ function mapBoolEqual(a, b) {
|
|
|
251
489
|
* organism only via {@link CNGX_TAB_PANEL_HOST}.
|
|
252
490
|
*
|
|
253
491
|
* Visibility is tracked through a native `IntersectionObserver`
|
|
254
|
-
* rooted on the parent strip
|
|
492
|
+
* rooted on the parent strip - `CngxIntersectionObserver` doesn't
|
|
255
493
|
* fit (single-element scope, can't reach sibling `viewChildren`).
|
|
256
|
-
* `threshold: 0`
|
|
494
|
+
* `threshold: 0` - only fully-clipped tabs surface. Combined with
|
|
257
495
|
* the organism's `scrollIntoView` effect this forms the self-healing
|
|
258
496
|
* loop: pick hidden tab -> strip scrolls -> IO fires -> `hiddenTabs`
|
|
259
497
|
* self-trims.
|
|
498
|
+
*
|
|
499
|
+
* @playground Overflow showcase ./examples/overflow-showcase/overflow-showcase.component.ts
|
|
500
|
+
*
|
|
501
|
+
* @category ui/tabs
|
|
502
|
+
* @docsKind primary
|
|
503
|
+
* @wcag AA
|
|
504
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/tabs/tab-overflow.component.ts
|
|
505
|
+
* @since 0.1.0
|
|
506
|
+
* @relatedTo CngxTabGroup, CngxPopover, CngxActiveDescendant
|
|
507
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
260
508
|
*/
|
|
261
509
|
class CngxTabOverflow {
|
|
262
510
|
// Projected via <ng-content>, so DI walks up to the parent's injector.
|
|
@@ -271,7 +519,7 @@ class CngxTabOverflow {
|
|
|
271
519
|
// strip selectors; Material/custom variants swap via providers.
|
|
272
520
|
adapter = inject(CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY)();
|
|
273
521
|
// tab id -> visibility. `undefined` = not yet observed (treat as
|
|
274
|
-
// visible
|
|
522
|
+
// visible - prevents More-button flash on first render).
|
|
275
523
|
// `linkedSignal` prunes stale ids when the tabs list changes;
|
|
276
524
|
// observer re-attach lives in the effect below. `mapBoolEqual`
|
|
277
525
|
// suppresses identity-only re-emissions from the IO callback.
|
|
@@ -297,15 +545,15 @@ class CngxTabOverflow {
|
|
|
297
545
|
hasHiddenTabs = computed(() => this.hiddenTabs().length > 0, { ...(ngDevMode ? { debugName: "hasHiddenTabs" } : /* istanbul ignore next */ {}), equal: Object.is });
|
|
298
546
|
// Counter projected into trigger label + aria-label. Explicit
|
|
299
547
|
// computed isolates `Object.is` distinct-gate from `hiddenTabs`
|
|
300
|
-
// identity churn
|
|
548
|
+
// identity churn - prevents flicker on length-equal re-emissions.
|
|
301
549
|
hiddenCount = computed(() => this.hiddenTabs().length, ...(ngDevMode ? [{ debugName: "hiddenCount" }] : /* istanbul ignore next */ []));
|
|
302
550
|
// ARIA menu-button pattern: <button aria-haspopup="menu"> + popover
|
|
303
551
|
// role="menu". Quick-jump navigation (selectById is not a value
|
|
304
|
-
// commit), so menu/menuitem is correct
|
|
552
|
+
// commit), so menu/menuitem is correct - listbox/option implies
|
|
305
553
|
// persistent aria-selected. WAI-ARIA 1.2 §combobox forbids
|
|
306
554
|
// aria-haspopup="menu", so combobox is deliberately not used.
|
|
307
555
|
adItemId = tabOverflowOptionId;
|
|
308
|
-
// Read first
|
|
556
|
+
// Read first - TS field-init order; downstream fields snapshot off this.
|
|
309
557
|
tabsConfig = injectTabsConfig();
|
|
310
558
|
// 3-stage cascade: directive > config.templates.overflow* > built-in.
|
|
311
559
|
// `contentChild` must be a field-direct initializer (Angular AOT).
|
|
@@ -323,7 +571,7 @@ class CngxTabOverflow {
|
|
|
323
571
|
// Variant-agnostic target -> id lookup. cngx-native uses
|
|
324
572
|
// `${id}-header`, Material `mat-tab-group-N-label-M`.
|
|
325
573
|
targetToHandleId = new WeakMap();
|
|
326
|
-
// IO-debounce knobs
|
|
574
|
+
// IO-debounce knobs - see `CngxTabsConfig.overflowStabilizeMs` /
|
|
327
575
|
// `.overflowMaxDeferMs` for semantics. Captured once at construction.
|
|
328
576
|
stabilizeMs = this.tabsConfig.overflowStabilizeMs ?? 100;
|
|
329
577
|
maxDeferMs = this.tabsConfig.overflowMaxDeferMs ?? 250;
|
|
@@ -333,7 +581,7 @@ class CngxTabOverflow {
|
|
|
333
581
|
// between commits. Drives the max-defer cap.
|
|
334
582
|
firstPendingAt = null;
|
|
335
583
|
// rAF-scheduled IO attach retry. `display: none` toggles do NOT
|
|
336
|
-
// recover
|
|
584
|
+
// recover - unmount/remount is required to re-arm. Policy swap
|
|
337
585
|
// via CNGX_DOM_ANCHOR_RETRY_FACTORY.
|
|
338
586
|
attachRetry = inject(CNGX_DOM_ANCHOR_RETRY_FACTORY)({
|
|
339
587
|
attempt: () => {
|
|
@@ -341,9 +589,12 @@ class CngxTabOverflow {
|
|
|
341
589
|
if (!root) {
|
|
342
590
|
return null;
|
|
343
591
|
}
|
|
344
|
-
// threshold: 0
|
|
592
|
+
// threshold: 0 - any visible pixel = "in the strip". Drives
|
|
345
593
|
// the self-healing loop with the organism's scrollIntoView.
|
|
346
|
-
this.observer = new IntersectionObserver((entries) => this.handleIntersections(entries), {
|
|
594
|
+
this.observer = new IntersectionObserver((entries) => this.handleIntersections(entries), {
|
|
595
|
+
root,
|
|
596
|
+
threshold: 0,
|
|
597
|
+
});
|
|
347
598
|
this.observeCurrentTabs();
|
|
348
599
|
return true;
|
|
349
600
|
},
|
|
@@ -392,7 +643,7 @@ class CngxTabOverflow {
|
|
|
392
643
|
this.panelHost.selectById(tab.id);
|
|
393
644
|
this.popover().hide();
|
|
394
645
|
}
|
|
395
|
-
/** AD `(activated)`
|
|
646
|
+
/** AD `(activated)` - Enter / Space on a highlighted option picks. */
|
|
396
647
|
handleAdActivated(value) {
|
|
397
648
|
const tab = value;
|
|
398
649
|
if (tab?.id) {
|
|
@@ -402,7 +653,7 @@ class CngxTabOverflow {
|
|
|
402
653
|
/**
|
|
403
654
|
* Auto-opens popover on nav-key when collapsed. AD's host listener
|
|
404
655
|
* fires first, so `activeIndex` is already set when this runs.
|
|
405
|
-
* No-op while open
|
|
656
|
+
* No-op while open - AD owns navigation.
|
|
406
657
|
*/
|
|
407
658
|
handleTriggerKeydown(event) {
|
|
408
659
|
if (this.popover().isVisible() || !this.hasHiddenTabs()) {
|
|
@@ -462,10 +713,10 @@ class CngxTabOverflow {
|
|
|
462
713
|
const tabId = this.targetToHandleId.get(target);
|
|
463
714
|
if (tabId === undefined) {
|
|
464
715
|
// Stale registration during disconnect/observeCurrentTabs
|
|
465
|
-
// churn
|
|
716
|
+
// churn - skip rather than mis-key.
|
|
466
717
|
continue;
|
|
467
718
|
}
|
|
468
|
-
// threshold: 0
|
|
719
|
+
// threshold: 0 - partially-clipped stays visible; only
|
|
469
720
|
// fully-clipped surfaces as hidden.
|
|
470
721
|
next.set(tabId, entry.isIntersecting);
|
|
471
722
|
}
|
|
@@ -474,13 +725,13 @@ class CngxTabOverflow {
|
|
|
474
725
|
}
|
|
475
726
|
/**
|
|
476
727
|
* IO-root resolution via the injected adapter. Returns `null`
|
|
477
|
-
* before the molecule is anchored
|
|
728
|
+
* before the molecule is anchored - the rAF retry loop re-polls.
|
|
478
729
|
*/
|
|
479
730
|
resolveStrip() {
|
|
480
731
|
return this.adapter.resolveStripRoot(this.panelHost, this.hostElement);
|
|
481
732
|
}
|
|
482
733
|
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: [":
|
|
734
|
+
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: \"*\"; 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: \"*\"; 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
735
|
}
|
|
485
736
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabOverflow, decorators: [{
|
|
486
737
|
type: Component,
|
|
@@ -490,9 +741,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
490
741
|
CngxClickOutside,
|
|
491
742
|
CngxPopover,
|
|
492
743
|
CngxPopoverTrigger,
|
|
493
|
-
], host: {
|
|
744
|
+
], encapsulation: ViewEncapsulation.None, host: {
|
|
494
745
|
'[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: [":
|
|
746
|
+
}, 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: \"*\"; 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: \"*\"; 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
747
|
}], 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
748
|
|
|
498
749
|
/**
|