@cngx/common 0.1.0-rc.0 → 0.1.0-rc.2
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/fesm2022/cngx-common-a11y.mjs +24 -11
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +64 -48
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +45 -11
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +559 -38
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1394 -160
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/package.json +3 -3
- package/stepper/README.md +16 -9
- package/theming/components/cngx-badge.css +1 -1
- package/theming/components/cngx-menu.css +1 -1
- package/types/cngx-common-a11y.d.ts +23 -2
- package/types/cngx-common-data.d.ts +46 -33
- package/types/cngx-common-interactive.d.ts +20 -2
- package/types/cngx-common-stepper.d.ts +604 -17
- package/types/cngx-common-tabs.d.ts +1363 -159
- package/tabs/README.md +0 -32
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Signal, InjectionToken, ModelSignal, TemplateRef, EnvironmentProviders, Provider, Injector } from '@angular/core';
|
|
2
|
+
import { Signal, InjectionToken, ModelSignal, TemplateRef, OnInit, EnvironmentProviders, Provider, Injector } from '@angular/core';
|
|
3
3
|
import { CngxAsyncState, StatusTransition } from '@cngx/core/utils';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { CngxErrorAggregatorContract } from '@cngx/common/interactive';
|
|
6
|
+
import { Router } from '@angular/router';
|
|
6
7
|
import { CngxCommitController } from '@cngx/common/data';
|
|
7
8
|
import { CngxActiveDescendant, ActiveDescendantItem } from '@cngx/common/a11y';
|
|
8
9
|
import { CngxPopover } from '@cngx/common/popover';
|
|
@@ -19,8 +20,51 @@ import { CngxPopover } from '@cngx/common/popover';
|
|
|
19
20
|
interface CngxTabHandle {
|
|
20
21
|
readonly id: string;
|
|
21
22
|
readonly label: Signal<string | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional secondary label line. Rendered stacked under the primary
|
|
25
|
+
* label by the organism and folded into the tab's accessible name.
|
|
26
|
+
* `undefined` (default) renders byte-identically to a single-line
|
|
27
|
+
* tab. `[cngxMatTabs]` pins this to `undefined` - Material owns its
|
|
28
|
+
* own tab chrome.
|
|
29
|
+
*/
|
|
30
|
+
readonly subLabel: Signal<string | undefined>;
|
|
22
31
|
readonly disabled: Signal<boolean>;
|
|
23
32
|
readonly errorAggregator: Signal<CngxErrorAggregatorContract | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Folded per-tab error state, exposed by reference. `true` when the
|
|
35
|
+
* direct `[error]` flag is set OR the aggregator wants to reveal
|
|
36
|
+
* (`shouldShow()`, so deferred-reveal validation stays silent until
|
|
37
|
+
* revealed). The organism gates the error badge + SR descriptor on
|
|
38
|
+
* this; both handle producers (`CngxTab`, `createMatTabHandle`)
|
|
39
|
+
* carry it.
|
|
40
|
+
*/
|
|
41
|
+
readonly hasError: Signal<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Resolved direct-error message - the `[error]` string when non-empty,
|
|
44
|
+
* else `undefined`. Rides the handle so the error badge slot can render
|
|
45
|
+
* it via `ctx.tab.errorMessage()`. `[cngxMatTabs]` pins this to
|
|
46
|
+
* `undefined` - Material owns its own tab chrome.
|
|
47
|
+
*/
|
|
48
|
+
readonly errorMessage: Signal<string | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Per-tab closable override. `undefined` (default) inherits the
|
|
51
|
+
* group-level `closable` resolution; `true`/`false` pin this tab's
|
|
52
|
+
* close affordance regardless of the group default (e.g. a
|
|
53
|
+
* non-closable "Home" tab inside an otherwise dismissable group).
|
|
54
|
+
*/
|
|
55
|
+
readonly closable: Signal<boolean | undefined>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Payload of {@link CngxTabGroupHost.tabClose}. Carries the closed
|
|
59
|
+
* tab's id and its index at close time. The consumer removes the tab
|
|
60
|
+
* from its own data in response; the presenter has already moved the
|
|
61
|
+
* active index to the surviving neighbour.
|
|
62
|
+
*
|
|
63
|
+
* @category common/tabs
|
|
64
|
+
*/
|
|
65
|
+
interface CngxTabCloseEvent {
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly index: number;
|
|
24
68
|
}
|
|
25
69
|
/**
|
|
26
70
|
* Contract atoms see when they inject the presenter via
|
|
@@ -74,6 +118,20 @@ interface CngxTabGroupHost {
|
|
|
74
118
|
selectNext(): void;
|
|
75
119
|
selectPrevious(): void;
|
|
76
120
|
selectById(id: string): void;
|
|
121
|
+
/**
|
|
122
|
+
* Request closing the tab with the given id. The presenter moves the
|
|
123
|
+
* active index onto the surviving neighbour (APG: next tab, or the
|
|
124
|
+
* previous one when closing the last tab) and emits `tabClose`; the
|
|
125
|
+
* consumer performs the actual removal from its data. No-op for an
|
|
126
|
+
* unknown id.
|
|
127
|
+
*/
|
|
128
|
+
requestClose(id: string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Request adding a new tab. Emits `tabAdd`; the consumer appends to
|
|
131
|
+
* its data. The presenter owns no tab-creation logic - tabs are
|
|
132
|
+
* derived from consumer data (Ableitung statt Verwaltung).
|
|
133
|
+
*/
|
|
134
|
+
requestAdd(): void;
|
|
77
135
|
/**
|
|
78
136
|
* Clear {@link lastFailedIndex} without unwinding
|
|
79
137
|
* {@link originIndexDuringCommit} (consumers gate reads on
|
|
@@ -83,9 +141,11 @@ interface CngxTabGroupHost {
|
|
|
83
141
|
clearLastFailed(): void;
|
|
84
142
|
}
|
|
85
143
|
/**
|
|
86
|
-
* DI token for the tab presenter's contract.
|
|
87
|
-
* `useExisting`; `CngxTab` injects to register; the organism injects
|
|
88
|
-
* to
|
|
144
|
+
* DI token for the tab presenter's contract. \
|
|
145
|
+
* Presenter provides via `useExisting`; `CngxTab` injects to register; the organism injects
|
|
146
|
+
* to drive the APG tablist keyboard model (automatic activation via
|
|
147
|
+
* `select()`, roving stop derived from `activeId`) through
|
|
148
|
+
* `createTabKeyboardNav`.
|
|
89
149
|
*
|
|
90
150
|
* @category common/tabs
|
|
91
151
|
* @wcag AA
|
|
@@ -95,24 +155,24 @@ interface CngxTabGroupHost {
|
|
|
95
155
|
declare const CNGX_TAB_GROUP_HOST: InjectionToken<CngxTabGroupHost>;
|
|
96
156
|
|
|
97
157
|
/**
|
|
98
|
-
* Async-commit action shape for tab transitions.
|
|
99
|
-
* and target indices; resolves `true` to commit, `false` to refuse.
|
|
100
|
-
* `Observable | Promise | sync` union mirrors the rest of the
|
|
158
|
+
* Async-commit action shape for tab transitions. \
|
|
159
|
+
* Receives origin and target indices; resolves `true` to commit, `false` to refuse.
|
|
160
|
+
* `Observable | Promise | sync` union mirrors the rest of the CNGX
|
|
101
161
|
* commit-action family.
|
|
102
162
|
*
|
|
103
163
|
* @category common/tabs
|
|
104
164
|
*/
|
|
105
165
|
type CngxTabsCommitAction = (fromIndex: number, toIndex: number) => boolean | Promise<boolean> | Observable<boolean>;
|
|
106
166
|
/**
|
|
107
|
-
* Tab-group presenter - brain of every
|
|
108
|
-
* active-index model, the tab registry, orientation, loop policy,
|
|
109
|
-
* and the commit-controller lifecycle.
|
|
110
|
-
* {@link CNGX_TAB_GROUP_HOST} for atoms and {@link CNGX_STATEFUL}
|
|
167
|
+
* Tab-group presenter - brain of every CNGX tab flow. \
|
|
168
|
+
* Owns the active-index model, the tab registry, orientation, loop policy,
|
|
169
|
+
* and the commit-controller lifecycle. \
|
|
170
|
+
* Provides {@link CNGX_TAB_GROUP_HOST} for atoms and {@link CNGX_STATEFUL}
|
|
111
171
|
* so `<cngx-toast-on />` / `<cngx-banner-on />` compose without
|
|
112
172
|
* `[state]` wiring.
|
|
113
173
|
*
|
|
114
|
-
* **Layer:** `@cngx/common/tabs
|
|
115
|
-
* organisms compose via `hostDirectives`, consumers attach
|
|
174
|
+
* **Layer:** `@cngx/common/tabs`. \
|
|
175
|
+
* Directive-only - organisms compose via `hostDirectives`, consumers attach
|
|
116
176
|
* `[cngxTabGroup]` directly.
|
|
117
177
|
*
|
|
118
178
|
* @category common/tabs
|
|
@@ -128,20 +188,56 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
128
188
|
readonly orientation: i0.InputSignal<"horizontal" | "vertical">;
|
|
129
189
|
readonly loop: i0.InputSignal<boolean>;
|
|
130
190
|
/**
|
|
131
|
-
* Async-commit action gating the transition.
|
|
132
|
-
* `select(...)` routes through {@link CngxTabsCommitHandler}; the
|
|
191
|
+
* Async-commit action gating the transition.
|
|
192
|
+
* When non-null, `select(...)` routes through {@link CngxTabsCommitHandler}; the
|
|
133
193
|
* action's resolution decides whether the change lands. Supersede
|
|
134
194
|
* semantics come from the commit-controller - a rapid second
|
|
135
195
|
* `select(...)` cancels the in-flight runner.
|
|
196
|
+
*
|
|
197
|
+
* @internal Two-field alias - bind the public `[commitAction]`; read
|
|
198
|
+
* the resolved {@link commitAction} computed (input ?? DI fallback).
|
|
136
199
|
*/
|
|
137
|
-
readonly
|
|
200
|
+
readonly commitActionInput: i0.InputSignal<CngxTabsCommitAction | null>;
|
|
138
201
|
/**
|
|
139
202
|
* Default `'optimistic'` - tab change is navigation, not a save,
|
|
140
203
|
* so eager visual feedback matches the user's mental model.
|
|
141
204
|
* Switch to `'pessimistic'` when the new tab must wait for the
|
|
142
205
|
* action to confirm.
|
|
206
|
+
*
|
|
207
|
+
* @internal Two-field alias - bind the public `[commitMode]`; read
|
|
208
|
+
* the resolved {@link commitMode} computed (DI fallback mode wins
|
|
209
|
+
* when a routed action is active).
|
|
210
|
+
*/
|
|
211
|
+
readonly commitModeInput: i0.InputSignal<"optimistic" | "pessimistic">;
|
|
212
|
+
private readonly injector;
|
|
213
|
+
private injectedActionSource;
|
|
214
|
+
private resolveInjectedAction;
|
|
215
|
+
/**
|
|
216
|
+
* Resolved commit-action: the `[commitAction]` input when bound, else
|
|
217
|
+
* the {@link CNGX_TABS_COMMIT_ACTION} DI fallback (routed path), else
|
|
218
|
+
* `null`. `select()` reads this.
|
|
219
|
+
*/
|
|
220
|
+
readonly commitAction: Signal<CngxTabsCommitAction | null>;
|
|
221
|
+
/**
|
|
222
|
+
* Resolved commit mode. When the DI fallback supplies an active
|
|
223
|
+
* action its `mode` wins - the routed path pins `'pessimistic'` so a
|
|
224
|
+
* stray `[commitMode]="'optimistic'"` cannot break the
|
|
225
|
+
* route-follows-resolution invariant. Otherwise the `[commitMode]`
|
|
226
|
+
* input drives.
|
|
227
|
+
*/
|
|
228
|
+
readonly commitMode: Signal<"optimistic" | "pessimistic">;
|
|
229
|
+
/**
|
|
230
|
+
* Emitted when a tab's close affordance is activated (the close
|
|
231
|
+
* button or Delete/Backspace on the focused tab). The presenter has
|
|
232
|
+
* already moved the active index onto the surviving neighbour; the
|
|
233
|
+
* consumer removes the tab from its own data in the handler.
|
|
234
|
+
*/
|
|
235
|
+
readonly tabClose: i0.OutputEmitterRef<CngxTabCloseEvent>;
|
|
236
|
+
/**
|
|
237
|
+
* Emitted when the add-tab affordance is activated. The consumer
|
|
238
|
+
* appends a tab to its own data; the presenter owns no creation logic.
|
|
143
239
|
*/
|
|
144
|
-
readonly
|
|
240
|
+
readonly tabAdd: i0.OutputEmitterRef<void>;
|
|
145
241
|
private readonly genericFactory;
|
|
146
242
|
private readonly commitController;
|
|
147
243
|
private readonly commitHandler;
|
|
@@ -179,14 +275,16 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
179
275
|
selectNext(): void;
|
|
180
276
|
selectPrevious(): void;
|
|
181
277
|
selectById(id: string): void;
|
|
278
|
+
requestClose(id: string): void;
|
|
279
|
+
requestAdd(): void;
|
|
182
280
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabGroupPresenter, never>;
|
|
183
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabGroupPresenter, "[cngxTabGroup]", ["cngxTabGroup"], { "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "
|
|
281
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabGroupPresenter, "[cngxTabGroup]", ["cngxTabGroup"], { "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "commitActionInput": { "alias": "commitAction"; "required": false; "isSignal": true; }; "commitModeInput": { "alias": "commitMode"; "required": false; "isSignal": true; }; }, { "activeIndex": "activeIndexChange"; "tabClose": "tabClose"; "tabAdd": "tabAdd"; }, never, never, true, never>;
|
|
184
282
|
}
|
|
185
283
|
|
|
186
284
|
/**
|
|
187
285
|
* Read-mostly panel-surface contract for the overflow molecule, skin
|
|
188
|
-
* sub-components, and future panel-level helpers.
|
|
189
|
-
* {@link CngxTabGroupHost} - register / unregister stay on the brain.
|
|
286
|
+
* sub-components, and future panel-level helpers. \
|
|
287
|
+
* Narrower than {@link CngxTabGroupHost} - register / unregister stay on the brain.
|
|
190
288
|
*
|
|
191
289
|
* The single write path is `selectById`; routing back through the
|
|
192
290
|
* presenter preserves clamping, disabled-skip, and commit-action
|
|
@@ -207,8 +305,8 @@ interface CngxTabPanelHost {
|
|
|
207
305
|
contentTemplateFor(id: string): TemplateRef<unknown> | null;
|
|
208
306
|
}
|
|
209
307
|
/**
|
|
210
|
-
* DI token the organism provides via `useExisting
|
|
211
|
-
* molecule and consumer-authored skin sub-components inject this
|
|
308
|
+
* DI token the organism provides via `useExisting`.\
|
|
309
|
+
* The overflow molecule and consumer-authored skin sub-components inject this
|
|
212
310
|
* instead of the concrete component class.
|
|
213
311
|
*
|
|
214
312
|
* @category common/tabs
|
|
@@ -219,13 +317,12 @@ interface CngxTabPanelHost {
|
|
|
219
317
|
declare const CNGX_TAB_PANEL_HOST: InjectionToken<CngxTabPanelHost>;
|
|
220
318
|
|
|
221
319
|
/**
|
|
222
|
-
* Structural slot directive marking the per-tab panel-body template.
|
|
320
|
+
* Structural slot directive marking the per-tab panel-body template. \
|
|
223
321
|
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
224
322
|
* `CngxTab` and projected into the matching `role="tabpanel"`.
|
|
225
323
|
*
|
|
226
324
|
* ```html
|
|
227
|
-
* <div cngxTab
|
|
228
|
-
* <ng-template cngxTabLabel>Settings</ng-template>
|
|
325
|
+
* <div cngxTab [label]="'Settings'">
|
|
229
326
|
* <ng-template cngxTabContent>
|
|
230
327
|
* <p>Settings panel body…</p>
|
|
231
328
|
* </ng-template>
|
|
@@ -237,14 +334,6 @@ declare const CNGX_TAB_PANEL_HOST: InjectionToken<CngxTabPanelHost>;
|
|
|
237
334
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-content.directive.ts
|
|
238
335
|
* @since 0.1.0
|
|
239
336
|
* @relatedTo CngxTab, CngxTabLabel
|
|
240
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
241
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
|
|
242
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
243
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
244
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
245
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
246
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
247
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
248
337
|
*/
|
|
249
338
|
declare class CngxTabContent {
|
|
250
339
|
readonly templateRef: TemplateRef<any>;
|
|
@@ -253,14 +342,14 @@ declare class CngxTabContent {
|
|
|
253
342
|
}
|
|
254
343
|
|
|
255
344
|
/**
|
|
256
|
-
* Structural slot directive marking the per-tab label template.
|
|
345
|
+
* Structural slot directive marking the per-tab label template. \
|
|
257
346
|
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
258
347
|
* `CngxTab` and projected into the tab strip.
|
|
259
348
|
*
|
|
260
349
|
* ```html
|
|
261
350
|
* <div cngxTab id="settings">
|
|
262
351
|
* <ng-template cngxTabLabel>Settings</ng-template>
|
|
263
|
-
*
|
|
352
|
+
* ... tab content ...
|
|
264
353
|
* </div>
|
|
265
354
|
* ```
|
|
266
355
|
*
|
|
@@ -269,8 +358,6 @@ declare class CngxTabContent {
|
|
|
269
358
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-label.directive.ts
|
|
270
359
|
* @since 0.1.0
|
|
271
360
|
* @relatedTo CngxTab, CngxTabContent
|
|
272
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
273
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
274
361
|
*/
|
|
275
362
|
declare class CngxTabLabel {
|
|
276
363
|
readonly templateRef: TemplateRef<any>;
|
|
@@ -279,54 +366,237 @@ declare class CngxTabLabel {
|
|
|
279
366
|
}
|
|
280
367
|
|
|
281
368
|
/**
|
|
282
|
-
*
|
|
369
|
+
* Structural slot directive marking a tab's secondary label template. \
|
|
370
|
+
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
371
|
+
* `CngxTab` and rendered as a stacked second line under the primary
|
|
372
|
+
* label. \
|
|
373
|
+
*
|
|
374
|
+
* Per-tab content, mirroring `CngxTabLabel` - the convenience
|
|
375
|
+
* `[subLabel]` string input on `CngxTab` covers the plain-text case.
|
|
376
|
+
*
|
|
377
|
+
* ```html
|
|
378
|
+
* <div cngxTab id="bookmarks">
|
|
379
|
+
* <ng-template cngxTabLabel>Bookmarks</ng-template>
|
|
380
|
+
* <ng-template cngxTabSubLabel>45 saved</ng-template>
|
|
381
|
+
* <ng-template cngxTabContent>...</ng-template>
|
|
382
|
+
* </div>
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
385
|
+
* @category common/tabs/slots
|
|
386
|
+
* @wcag AA
|
|
387
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-sub-label.directive.ts
|
|
388
|
+
* @since 0.1.0
|
|
389
|
+
* @relatedTo CngxTab, CngxTabLabel, CngxTabContent
|
|
390
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-sub-label/label-with-count</example-url>
|
|
391
|
+
*/
|
|
392
|
+
declare class CngxTabSubLabel {
|
|
393
|
+
/**
|
|
394
|
+
* The captured `<ng-template>`, projected by `<cngx-tab-group>` as the
|
|
395
|
+
* tab's secondary label line under the primary label.
|
|
396
|
+
*/
|
|
397
|
+
readonly templateRef: TemplateRef<any>;
|
|
398
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabSubLabel, never>;
|
|
399
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabSubLabel, "ng-template[cngxTabSubLabel]", ["cngxTabSubLabel"], {}, {}, never, never, true, never>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Single-tab atom. \
|
|
404
|
+
* Registers with the enclosing presenter via
|
|
283
405
|
* {@link CNGX_TAB_GROUP_HOST} on construction; deregisters via
|
|
284
|
-
* {@link DestroyRef} on teardown.
|
|
406
|
+
* {@link DestroyRef} on teardown. \
|
|
407
|
+
* The presenter holds the atom's
|
|
285
408
|
* input signals by reference, so input changes propagate without
|
|
286
|
-
* re-registration.
|
|
409
|
+
* re-registration. \
|
|
410
|
+
* `labelTemplate` / `contentTemplate` are projected
|
|
287
411
|
* by the organism - the atom carries no rendering logic.
|
|
288
412
|
*
|
|
413
|
+
* ```html
|
|
414
|
+
* <div cngxTab [label]="'Settings'">
|
|
415
|
+
* ... content templates here ...
|
|
416
|
+
* </div>
|
|
417
|
+
* ```
|
|
289
418
|
* @category common/tabs
|
|
290
419
|
* @docsKind primary
|
|
291
420
|
* @wcag AA
|
|
292
421
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab.directive.ts
|
|
293
422
|
* @since 0.1.0
|
|
294
423
|
* @relatedTo CngxTabGroupPresenter, CngxTabLabel, CngxTabContent, CngxTabErrorBadge
|
|
295
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
296
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
|
|
297
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
298
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
299
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
300
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
301
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
302
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
303
424
|
*/
|
|
304
|
-
declare class CngxTab {
|
|
425
|
+
declare class CngxTab implements OnInit {
|
|
305
426
|
readonly id: i0.InputSignal<string>;
|
|
306
427
|
readonly disabled: i0.InputSignal<boolean>;
|
|
307
428
|
readonly label: i0.InputSignal<string | undefined>;
|
|
429
|
+
/**
|
|
430
|
+
* Optional secondary text line under the primary label (a count, a
|
|
431
|
+
* status word, a short detail). Convenience for the common text
|
|
432
|
+
* case, parallel to `[label]`; the `*cngxTabSubLabel` slot covers
|
|
433
|
+
* richer content. Folds into the tab's accessible name.
|
|
434
|
+
*/
|
|
435
|
+
readonly subLabel: i0.InputSignal<string | undefined>;
|
|
308
436
|
readonly errorAggregator: i0.InputSignal<CngxErrorAggregatorContract | undefined>;
|
|
437
|
+
/**
|
|
438
|
+
* Direct error flag for the common "this tab is invalid" case - no
|
|
439
|
+
* `errorAggregator` boilerplate required. `true` or a non-empty string
|
|
440
|
+
* drives the error state; a string doubles as the inline message
|
|
441
|
+
* (surfaced via the `*cngxTabErrorBadge` slot context). `false` / `''`
|
|
442
|
+
* clear it. The aggregator stays the rich multi-source forms path; the
|
|
443
|
+
* two channels compose (either errors). Mirrors `CngxStep.error`.
|
|
444
|
+
*/
|
|
445
|
+
readonly error: i0.InputSignal<string | boolean>;
|
|
446
|
+
/**
|
|
447
|
+
* Resolved direct-error message: the `[error]` string when non-empty,
|
|
448
|
+
* else `undefined`. Carried onto the registration handle so the error
|
|
449
|
+
* badge slot can render it. `computed` over the input - never written.
|
|
450
|
+
*/
|
|
451
|
+
readonly errorMessage: Signal<string | undefined>;
|
|
452
|
+
/**
|
|
453
|
+
* Per-tab error fold driving the badge + SR descriptor. `true` when
|
|
454
|
+
* the direct `[error]` flag is set OR the optional aggregator wants to
|
|
455
|
+
* reveal (`shouldShow()` = `hasError` AND scope reveal-state). The
|
|
456
|
+
* aggregator arm reads `shouldShow`, not `hasError`, so deferred-reveal
|
|
457
|
+
* validation stays silent until revealed - the direct flag has no
|
|
458
|
+
* reveal concept (the consumer sets it when it wants it shown). A
|
|
459
|
+
* boolean, not a status enum: tabs carry no success/completed/disabled
|
|
460
|
+
* model (Pillar 3).
|
|
461
|
+
*/
|
|
462
|
+
readonly hasError: Signal<boolean>;
|
|
463
|
+
/**
|
|
464
|
+
* Per-tab close-affordance override. `undefined` (default) inherits
|
|
465
|
+
* the group-level `[closable]` resolution; set `false` to pin this
|
|
466
|
+
* tab open inside a dismissable group, or `true` to make a single tab
|
|
467
|
+
* closable while the group default is off.
|
|
468
|
+
*/
|
|
469
|
+
readonly closable: i0.InputSignal<boolean | undefined>;
|
|
309
470
|
readonly labelTemplate: Signal<CngxTabLabel | undefined>;
|
|
471
|
+
readonly subLabelTemplate: Signal<CngxTabSubLabel | undefined>;
|
|
310
472
|
readonly contentTemplate: Signal<CngxTabContent | undefined>;
|
|
311
473
|
private readonly host;
|
|
474
|
+
private readonly destroyRef;
|
|
312
475
|
/** `true` when the presenter's `activeId` equals this tab's id. */
|
|
313
476
|
readonly selected: Signal<boolean>;
|
|
314
477
|
constructor();
|
|
478
|
+
ngOnInit(): void;
|
|
315
479
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTab, never>;
|
|
316
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTab, "[cngxTab]", ["cngxTab"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; }, {}, ["labelTemplate", "contentTemplate"], never, true, never>;
|
|
480
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTab, "[cngxTab]", ["cngxTab"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "subLabel": { "alias": "subLabel"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; }, {}, ["labelTemplate", "subLabelTemplate", "contentTemplate"], never, true, never>;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Turns a consumer `<a routerLink>` into a registered {@link CngxTabHandle}
|
|
485
|
+
* inside a {@link CngxTabNav}. \
|
|
486
|
+
* Native parallel of {@link CngxMatTabLink}: in a
|
|
487
|
+
* navigation bar the link IS the tab, so this per-anchor directive is the
|
|
488
|
+
* registration seam - symmetric with how `CngxTab` registers each `[cngxTab]`.
|
|
489
|
+
*
|
|
490
|
+
* Carries no rendering and no click handler. Navigation is the native
|
|
491
|
+
* `routerLink` (middle-click, open-in-new-tab and the hover URL all work),
|
|
492
|
+
* gating is the link's own `CanDeactivate`, and the active marker comes from
|
|
493
|
+
* the route: `[cngxTabsRouteSync]` on the nav reflects `NavigationEnd` onto the
|
|
494
|
+
* presenter's `activeId`, which this link matches against its own `id`. \
|
|
495
|
+
* There is no `select()` call - invoking it would re-enter the commit path the
|
|
496
|
+
* routed-nav model deliberately keeps dormant.
|
|
497
|
+
*
|
|
498
|
+
* **Error communication is reactive:** `aria-invalid` plus the
|
|
499
|
+
* `--error` skin glyph signal the state, and an injected screen-reader
|
|
500
|
+
* descriptor span (referenced by a permanent `aria-describedby`) carries the
|
|
501
|
+
* direct `[error]` message string so assistive tech reads *why* the link is
|
|
502
|
+
* invalid.
|
|
503
|
+
*
|
|
504
|
+
* ```html
|
|
505
|
+
* <cngx-tab-nav cngxTabsRouteSync>
|
|
506
|
+
* <a cngxTabLink id="overview" routerLink="overview">Overview</a>
|
|
507
|
+
* <a cngxTabLink id="profile" routerLink="profile" [error]="profileInvalid">Profile</a>
|
|
508
|
+
* </cngx-tab-nav>
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
511
|
+
* @category common/tabs
|
|
512
|
+
* @docsKind primary
|
|
513
|
+
* @wcag AA
|
|
514
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-link.directive.ts
|
|
515
|
+
* @since 0.1.0
|
|
516
|
+
* @relatedTo CngxTabNav, CngxTabsRouteSync, CngxTab, CngxMatTabLink
|
|
517
|
+
*/
|
|
518
|
+
declare class CngxTabLink implements OnInit {
|
|
519
|
+
private readonly host;
|
|
520
|
+
private readonly destroyRef;
|
|
521
|
+
private readonly renderer;
|
|
522
|
+
private readonly hostEl;
|
|
523
|
+
/**
|
|
524
|
+
* Handle id. Set it to the link's route segment so the nav's
|
|
525
|
+
* `[cngxTabsRouteSync]` reflects the active route onto this link via the
|
|
526
|
+
* default `(h) => [h.id]` mapping. Defaults to a fresh uid when route-sync
|
|
527
|
+
* is not used.
|
|
528
|
+
*/
|
|
529
|
+
readonly id: i0.InputSignal<string>;
|
|
530
|
+
/** Accessible label fed to the nav's live-region announcer. */
|
|
531
|
+
readonly label: i0.InputSignal<string | undefined>;
|
|
532
|
+
/**
|
|
533
|
+
* Direct error flag for the link - `true` or a non-empty string marks it
|
|
534
|
+
* invalid (the string doubles as the message). Mirrors `CngxTab.error`.
|
|
535
|
+
*/
|
|
536
|
+
readonly error: i0.InputSignal<string | boolean>;
|
|
537
|
+
/** Optional rich error aggregator for the link. */
|
|
538
|
+
readonly errorAggregator: i0.InputSignal<CngxErrorAggregatorContract | undefined>;
|
|
539
|
+
/**
|
|
540
|
+
* Resolved direct-error message: the `[error]` string when non-empty, else
|
|
541
|
+
* `undefined`. Carried onto the registration handle by reference.
|
|
542
|
+
* `computed` over the input - never written.
|
|
543
|
+
*/
|
|
544
|
+
private readonly errorMessage;
|
|
545
|
+
/**
|
|
546
|
+
* Per-link error fold driving `aria-invalid` and the `--error` class.
|
|
547
|
+
* `true` when the direct `[error]` flag is set OR the optional aggregator
|
|
548
|
+
* wants to reveal (`shouldShow()`, so deferred-reveal validation stays
|
|
549
|
+
* silent until revealed). Mirrors `CngxTab.hasError`.
|
|
550
|
+
*/
|
|
551
|
+
protected readonly hasError: Signal<boolean>;
|
|
552
|
+
/** `true` when the presenter's `activeId` equals this link's id. */
|
|
553
|
+
protected readonly selected: Signal<boolean>;
|
|
554
|
+
/**
|
|
555
|
+
* Id of the injected SR error-message descriptor. Always referenced by the
|
|
556
|
+
* `aria-describedby` host binding (Pillar 2 - the id is permanent; the
|
|
557
|
+
* span's content and `aria-hidden` toggle, never the id itself).
|
|
558
|
+
*/
|
|
559
|
+
protected readonly descriptorId: Signal<string>;
|
|
560
|
+
/** The injected descriptor `<span>`, created in {@link ngOnInit}. */
|
|
561
|
+
private descriptorEl;
|
|
562
|
+
constructor();
|
|
563
|
+
ngOnInit(): void;
|
|
564
|
+
/**
|
|
565
|
+
* Write the current direct-error message into the descriptor span and
|
|
566
|
+
* toggle its `aria-hidden` so a clear link exposes no description. Keeps
|
|
567
|
+
* the span id in sync with {@link descriptorId} (read here so the effect
|
|
568
|
+
* tracks an id change too).
|
|
569
|
+
*/
|
|
570
|
+
private syncDescriptor;
|
|
571
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabLink, never>;
|
|
572
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabLink, "[cngxTabLink]", ["cngxTabLink"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
317
573
|
}
|
|
318
574
|
|
|
319
575
|
/**
|
|
320
|
-
* URL deep-linking for tab groups.
|
|
321
|
-
* `activeId` and a URL fragment or query-param. Opt-in via
|
|
576
|
+
* URL deep-linking for tab groups. \
|
|
577
|
+
* Bidirectional sync between `activeId` and a URL fragment or query-param. Opt-in via
|
|
322
578
|
* `[cngxTabsFragmentSync]` on the presenter element.
|
|
323
579
|
*
|
|
324
580
|
* - `mode = 'fragment'` (default) → `#tab=settings`
|
|
325
581
|
* - `mode = 'queryParam'` with `paramName = 'tab'` → `?tab=settings`
|
|
326
582
|
*
|
|
327
583
|
* `Router` is optional - without it the directive logs a dev warning
|
|
328
|
-
* via `afterNextRender` and becomes a no-op.
|
|
329
|
-
* and `host.selectById` inside the effects sits in `untracked()`.
|
|
584
|
+
* via `afterNextRender` and becomes a no-op. \
|
|
585
|
+
* Every `router.navigate` and `host.selectById` inside the effects sits in `untracked()`.
|
|
586
|
+
*
|
|
587
|
+
* ```html
|
|
588
|
+
* <!-- Default fragment mode: the active tab reflects to #tab=<id>, and a
|
|
589
|
+
* deep link like /account#tab=settings selects that tab on load. -->
|
|
590
|
+
* <cngx-tab-group cngxTabsFragmentSync>
|
|
591
|
+
* <div cngxTab id="overview" label="Overview"></div>
|
|
592
|
+
* <div cngxTab id="settings" label="Settings"></div>
|
|
593
|
+
* </cngx-tab-group>
|
|
594
|
+
*
|
|
595
|
+
* <!-- Query-param mode with a custom name -> ?section=settings -->
|
|
596
|
+
* <cngx-tab-group cngxTabsFragmentSync mode="queryParam" paramName="section">
|
|
597
|
+
* <!-- ...tabs... -->
|
|
598
|
+
* </cngx-tab-group>
|
|
599
|
+
* ```
|
|
330
600
|
*
|
|
331
601
|
* @category common/tabs
|
|
332
602
|
* @docsKind primary
|
|
@@ -347,6 +617,223 @@ declare class CngxTabsFragmentSync {
|
|
|
347
617
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabsFragmentSync, "[cngxTabsFragmentSync]", ["cngxTabsFragmentSync"], { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "paramName": { "alias": "paramName"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
348
618
|
}
|
|
349
619
|
|
|
620
|
+
/**
|
|
621
|
+
* Source supplied through {@link CNGX_TABS_COMMIT_ACTION}. \
|
|
622
|
+
* A sync directive (e.g. `[cngxTabsRouteSync]`) provides one so the presenter
|
|
623
|
+
* picks up a commit-action without the consumer hand-binding
|
|
624
|
+
* `[commitAction]`.
|
|
625
|
+
*
|
|
626
|
+
* Carries `mode` alongside `action` so the routed
|
|
627
|
+
* path can pin pessimistic - the active tab must follow the *resolved*
|
|
628
|
+
* route, and a stray `[commitMode]="'optimistic'"` must not override
|
|
629
|
+
* that invariant.
|
|
630
|
+
*
|
|
631
|
+
* @category common/tabs
|
|
632
|
+
*/
|
|
633
|
+
interface CngxTabsCommitActionSource {
|
|
634
|
+
/**
|
|
635
|
+
* The commit-action the presenter runs on a tab switch, or `null` when
|
|
636
|
+
* the source has nothing to gate with (e.g. a route-sync without a
|
|
637
|
+
* `Router`). A non-null value activates this source over the
|
|
638
|
+
* presenter's `[commitAction]` input.
|
|
639
|
+
*/
|
|
640
|
+
readonly action: Signal<CngxTabsCommitAction | null>;
|
|
641
|
+
/**
|
|
642
|
+
* Commit semantics for this source. When `action()` is non-null, this
|
|
643
|
+
* wins over the presenter's `[commitMode]` input - the route-sync pins
|
|
644
|
+
* `'pessimistic'` so the active tab follows the resolved route.
|
|
645
|
+
*/
|
|
646
|
+
readonly mode: Signal<'optimistic' | 'pessimistic'>;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* DI fallback the presenter reads when its `[commitAction]` input is
|
|
650
|
+
* unbound. Directives compose via DI tokens, not by hand-binding
|
|
651
|
+
* another directive's input (Pillar 3). When a source is present and
|
|
652
|
+
* exposes a non-null `action()`, its `mode()` wins over the
|
|
653
|
+
* `[commitMode]` input.
|
|
654
|
+
*
|
|
655
|
+
* @category common/tabs
|
|
656
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/commit-action.token.ts
|
|
657
|
+
* @since 0.1.0
|
|
658
|
+
*/
|
|
659
|
+
declare const CNGX_TABS_COMMIT_ACTION: InjectionToken<CngxTabsCommitActionSource>;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Router-outlet integration for tab groups. \
|
|
663
|
+
* Opt-in via `[cngxTabsRouteSync]` on the presenter element. Each tab is an
|
|
664
|
+
* Angular child route whose component renders into a `<router-outlet>`;
|
|
665
|
+
* switching tabs navigates, and a `CanDeactivate` guard can gate the
|
|
666
|
+
* leave.
|
|
667
|
+
*
|
|
668
|
+
* Supplies the presenter's commit-action through the
|
|
669
|
+
* {@link CNGX_TABS_COMMIT_ACTION} DI fallback (no consumer
|
|
670
|
+
* `[commitAction]` hand-binding) and pins **pessimistic** mode so the
|
|
671
|
+
* active tab follows the *resolved* route - a guard-cancelled switch
|
|
672
|
+
* keeps the old tab. The routing gate reuses the presenter's commit
|
|
673
|
+
* lifecycle verbatim; the router navigation is the async op.
|
|
674
|
+
*
|
|
675
|
+
* Seeds the active tab from the current URL on mount and reflects
|
|
676
|
+
* external navigations (back/forward, direct URL) into `activeIndex`
|
|
677
|
+
* *without* re-navigating - those writes bypass the commit-action,
|
|
678
|
+
* since the router is already at the resolved route.
|
|
679
|
+
*
|
|
680
|
+
* `Router` is optional - without it the directive logs a single dev
|
|
681
|
+
* warning via `afterNextRender`, exposes a null action, and becomes a
|
|
682
|
+
* no-op. Mirrors {@link CngxTabsFragmentSync}; every `activeIndex`
|
|
683
|
+
* write inside an effect sits in `untracked()`.
|
|
684
|
+
*
|
|
685
|
+
* **The mental model.** It turns the tab group into the router's view
|
|
686
|
+
* switcher: the tabs choose *which child route* renders in the
|
|
687
|
+
* `<router-outlet>`, not which inline template shows. \
|
|
688
|
+
* Concretely, a Settings page with Profile / Security / Billing tabs then gets, for
|
|
689
|
+
* free: each tab its own URL (`/settings/profile`) so a refresh or a
|
|
690
|
+
* shared link stays on the tab; browser back/forward between tabs;
|
|
691
|
+
* `Billing` lazy-loading its chunk only when first opened; and `Profile`
|
|
692
|
+
* blocking the switch via a `CanDeactivate` guard while its form is
|
|
693
|
+
* dirty - all while keeping the `role="tab"` keyboard and ARIA model.
|
|
694
|
+
*
|
|
695
|
+
* **Use it when** each tab's content is a real Angular route - a lazy
|
|
696
|
+
* chunk, a resolver, or a `CanActivate` / `CanDeactivate` guard -
|
|
697
|
+
* rendered into a `<router-outlet>`, and you want browser back/forward
|
|
698
|
+
* and deep links to move between tabs while the route's own guard gates
|
|
699
|
+
* the switch (e.g. an unsaved-changes prompt on leave). \
|
|
700
|
+
* If the tabs are purely visual, use a plain `<cngx-tab-group>` with no sync directive;
|
|
701
|
+
* if you only want the active tab reflected in the URL while content
|
|
702
|
+
* stays inline, use {@link CngxTabsFragmentSync}.
|
|
703
|
+
*
|
|
704
|
+
* **What this is not.** \
|
|
705
|
+
* Not a per-tab `routerLink`: \
|
|
706
|
+
* the tabs stay `role="tab"` buttons and the directive drives `router.navigate`
|
|
707
|
+
* centrally through the commit lifecycle, so there are no anchors, no
|
|
708
|
+
* `href`, and no native open-in-new-tab / middle-click / copy-link. \
|
|
709
|
+
* For real link semantics (right-click, ctrl-click) reach for the CNGX
|
|
710
|
+
* `<cngx-tab-nav>` and `<a cngx-tab-link routerLink>` variant
|
|
711
|
+
* instead. \
|
|
712
|
+
* Not URL deep-linking either - that is {@link CngxTabsFragmentSync} (a `#tab=` fragment or `?tab=`
|
|
713
|
+
* query-param); this directive renders child route *components* into a
|
|
714
|
+
* `<router-outlet>`. \
|
|
715
|
+
* And not optimistic: the active tab moves only once
|
|
716
|
+
* the route resolves, so a `CanDeactivate` guard can cancel the switch.
|
|
717
|
+
*
|
|
718
|
+
* ```ts
|
|
719
|
+
* // Each tab is a child route; the editor guards its own exit.
|
|
720
|
+
* const ROUTES: Routes = [
|
|
721
|
+
* { path: '', pathMatch: 'full', redirectTo: 'editor' },
|
|
722
|
+
* { path: 'editor', component: EditorPage, canDeactivate: [unsavedChangesGuard] },
|
|
723
|
+
* { path: 'preview', component: PreviewPage },
|
|
724
|
+
* { path: 'settings', component: SettingsPage },
|
|
725
|
+
* ];
|
|
726
|
+
* ```
|
|
727
|
+
*
|
|
728
|
+
* ```html
|
|
729
|
+
* <!-- Tab ids match the child segments (default routeFor = (h) => [h.id]).
|
|
730
|
+
* Switching a tab navigates; the guard gates leaving the editor;
|
|
731
|
+
* back/forward and /account/settings deep links move the active tab. -->
|
|
732
|
+
* <cngx-tab-group cngxTabsRouteSync aria-label="Account">
|
|
733
|
+
* <div cngxTab id="editor" label="Editor"></div>
|
|
734
|
+
* <div cngxTab id="preview" label="Preview"></div>
|
|
735
|
+
* <div cngxTab id="settings" label="Settings"></div>
|
|
736
|
+
* </cngx-tab-group>
|
|
737
|
+
*
|
|
738
|
+
* <!-- The active tab's routed component renders here. -->
|
|
739
|
+
* <router-outlet></router-outlet>
|
|
740
|
+
* ```
|
|
741
|
+
*
|
|
742
|
+
* @category common/tabs
|
|
743
|
+
* @docsKind primary
|
|
744
|
+
* @wcag AA
|
|
745
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/route-sync.directive.ts
|
|
746
|
+
* @since 0.1.0
|
|
747
|
+
* @relatedTo CngxTabGroupPresenter, CngxTabsFragmentSync, createTabRouterCommit, CngxTabNav, CngxTabLink
|
|
748
|
+
*/
|
|
749
|
+
declare class CngxTabsRouteSync implements CngxTabsCommitActionSource {
|
|
750
|
+
/**
|
|
751
|
+
* Maps a tab handle to its router command array. Default
|
|
752
|
+
* `(handle) => [handle.id]` - the tab id is the child segment.
|
|
753
|
+
* Override for real route paths.
|
|
754
|
+
*/
|
|
755
|
+
readonly routeFor: i0.InputSignal<(handle: CngxTabHandle) => unknown[]>;
|
|
756
|
+
private readonly host;
|
|
757
|
+
private readonly router;
|
|
758
|
+
/**
|
|
759
|
+
* Pessimistic-only - not exposed as an input. The route-sync owns the
|
|
760
|
+
* mode so optimistic (show-then-revert) can never flash the target
|
|
761
|
+
* tab before a `CanDeactivate` guard decides.
|
|
762
|
+
*/
|
|
763
|
+
readonly mode: Signal<'optimistic' | 'pessimistic'>;
|
|
764
|
+
/**
|
|
765
|
+
* Router commit-action read by the presenter via the DI fallback.
|
|
766
|
+
* `null` when no `Router` is available (graceful no-op). Rebuilt only
|
|
767
|
+
* when `routeFor` changes; the navigation gate itself is the async
|
|
768
|
+
* op inside the action.
|
|
769
|
+
*/
|
|
770
|
+
readonly action: Signal<CngxTabsCommitAction | null>;
|
|
771
|
+
constructor();
|
|
772
|
+
/**
|
|
773
|
+
* Mirror the URL's active tab onto `activeIndex` without navigating.
|
|
774
|
+
* Writing the index directly (not via `select()`) is the re-entry
|
|
775
|
+
* guard: `select()` would re-run the commit-action and navigate to
|
|
776
|
+
* the route the router is already on, leaving the commit pending
|
|
777
|
+
* forever.
|
|
778
|
+
*/
|
|
779
|
+
private reflectFromUrl;
|
|
780
|
+
/**
|
|
781
|
+
* Find the tab whose route is the trailing segment(s) of the current
|
|
782
|
+
* URL path. Anchors on position (a suffix match), not a loose
|
|
783
|
+
* "appears anywhere" scan - a tab id that happens to equal an
|
|
784
|
+
* unrelated parent segment cannot win. The path is taken before any
|
|
785
|
+
* query/fragment. If two tabs produce the same trailing segment(s)
|
|
786
|
+
* (only possible with a custom `routeFor` that collides), the first
|
|
787
|
+
* registered tab wins - the default id-based mapping never collides.
|
|
788
|
+
*/
|
|
789
|
+
private readActiveId;
|
|
790
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabsRouteSync, never>;
|
|
791
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabsRouteSync, "[cngxTabsRouteSync]", ["cngxTabsRouteSync"], { "routeFor": { "alias": "routeFor"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Options for {@link createTabRouterCommit}.
|
|
796
|
+
*
|
|
797
|
+
* `tabs` is the presenter's live handle list - the action receives the
|
|
798
|
+
* target *index*, so it needs the registry to resolve the matching
|
|
799
|
+
* {@link CngxTabHandle} before computing its route. `[cngxTabsRouteSync]`
|
|
800
|
+
* passes the host's `tabs` signal straight through.
|
|
801
|
+
*
|
|
802
|
+
* @category common/tabs
|
|
803
|
+
*/
|
|
804
|
+
interface CngxTabRouterCommitOptions {
|
|
805
|
+
readonly router: Router;
|
|
806
|
+
readonly tabs: () => readonly CngxTabHandle[];
|
|
807
|
+
/**
|
|
808
|
+
* Maps a tab handle to its router command array. Default
|
|
809
|
+
* `(handle) => [handle.id]` - the tab id is the child segment.
|
|
810
|
+
* Override for real route paths (`(h) => ['settings', h.id]`).
|
|
811
|
+
*/
|
|
812
|
+
readonly routeFor?: (handle: CngxTabHandle) => unknown[];
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Builds a {@link CngxTabsCommitAction} that gates a tab switch through
|
|
816
|
+
* `@angular/router`. The action navigates to the target tab's route and
|
|
817
|
+
* resolves on the router's own outcome:
|
|
818
|
+
*
|
|
819
|
+
* - `NavigationEnd` → `true` (commit the switch)
|
|
820
|
+
* - `NavigationCancel` (a `CanDeactivate` guard blocked) → `false`
|
|
821
|
+
* - `NavigationError` (guard/resolver threw) → `false`
|
|
822
|
+
*
|
|
823
|
+
* Routed tabs reuse the presenter's commit lifecycle verbatim - the
|
|
824
|
+
* router navigation is simply the async op. \
|
|
825
|
+
* In pessimistic mode the active tab follows the *resolved* route, so a cancelled guard keeps
|
|
826
|
+
* the old tab with zero extra gate machinery. The events subscription
|
|
827
|
+
* is opened *before* `navigate(...)` so a synchronously-resolving
|
|
828
|
+
* navigation cannot emit before the action is listening; the commit
|
|
829
|
+
* controller's `cancel()` unsubscribes on supersede.
|
|
830
|
+
*
|
|
831
|
+
* @category common/tabs
|
|
832
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/router-commit.ts
|
|
833
|
+
* @since 0.1.0
|
|
834
|
+
*/
|
|
835
|
+
declare function createTabRouterCommit(opts: CngxTabRouterCommitOptions): CngxTabsCommitAction;
|
|
836
|
+
|
|
350
837
|
/**
|
|
351
838
|
* Context for the `*cngxTabOverflowItem` template. Replaces the
|
|
352
839
|
* default `tab.label() ?? tab.id` text inside the More popover; the
|
|
@@ -474,8 +961,6 @@ interface CngxTabBusySpinnerContext {
|
|
|
474
961
|
* @since 0.1.0
|
|
475
962
|
* @relatedTo CngxTabErrorBadge, CngxTabRejectionIcon, CngxTab
|
|
476
963
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
477
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
478
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
479
964
|
*/
|
|
480
965
|
declare class CngxTabBusySpinner {
|
|
481
966
|
readonly templateRef: TemplateRef<CngxTabBusySpinnerContext>;
|
|
@@ -483,6 +968,43 @@ declare class CngxTabBusySpinner {
|
|
|
483
968
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabBusySpinner, "ng-template[cngxTabBusySpinner]", ["cngxTabBusySpinner"], {}, {}, never, never, true, never>;
|
|
484
969
|
}
|
|
485
970
|
|
|
971
|
+
/**
|
|
972
|
+
* Context for the `*cngxTabCloseIcon` template. Rendered inside each
|
|
973
|
+
* closable tab's close button (the button itself owns the
|
|
974
|
+
* `aria-label`); the template paints only the glyph, so it carries the
|
|
975
|
+
* tab handle in case the visual varies per tab.
|
|
976
|
+
*
|
|
977
|
+
* @category common/tabs/slots
|
|
978
|
+
*/
|
|
979
|
+
interface CngxTabCloseIconContext {
|
|
980
|
+
/** The tab handle whose close button this icon paints. */
|
|
981
|
+
readonly tab: CngxTabHandle;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Structural slot for a tab's close-button glyph. 3-stage cascade:
|
|
985
|
+
* per-instance directive > `CNGX_TABS_CONFIG.templates.closeIcon` >
|
|
986
|
+
* `CNGX_TABS_GLYPHS.closeIcon`.
|
|
987
|
+
*
|
|
988
|
+
* ```html
|
|
989
|
+
* <cngx-tab-group closable (tabClose)="remove($event.id)">
|
|
990
|
+
* <ng-template cngxTabCloseIcon><cngx-icon name="close" /></ng-template>
|
|
991
|
+
* ...
|
|
992
|
+
* </cngx-tab-group>
|
|
993
|
+
* ```
|
|
994
|
+
*
|
|
995
|
+
* @category common/tabs/slots
|
|
996
|
+
* @wcag AA
|
|
997
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-close-icon.directive.ts
|
|
998
|
+
* @since 0.1.0
|
|
999
|
+
* @relatedTo CngxTabAddIcon, CngxTabGroup
|
|
1000
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-dismissable/dismissable-and-addable</example-url>
|
|
1001
|
+
*/
|
|
1002
|
+
declare class CngxTabCloseIcon {
|
|
1003
|
+
readonly templateRef: TemplateRef<CngxTabCloseIconContext>;
|
|
1004
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabCloseIcon, never>;
|
|
1005
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabCloseIcon, "ng-template[cngxTabCloseIcon]", ["cngxTabCloseIcon"], {}, {}, never, never, true, never>;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
486
1008
|
/**
|
|
487
1009
|
* Context for the `*cngxTabErrorBadge` template. Renders only when
|
|
488
1010
|
* the tab's `errorAggregator?.shouldShow()` is `true`; the visibility
|
|
@@ -515,9 +1037,7 @@ interface CngxTabErrorBadgeContext {
|
|
|
515
1037
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-error-badge.directive.ts
|
|
516
1038
|
* @since 0.1.0
|
|
517
1039
|
* @relatedTo CngxTabRejectionIcon, CngxTabBusySpinner, CngxTab
|
|
518
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
519
1040
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
520
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
521
1041
|
*/
|
|
522
1042
|
declare class CngxTabErrorBadge {
|
|
523
1043
|
readonly templateRef: TemplateRef<CngxTabErrorBadgeContext>;
|
|
@@ -525,6 +1045,55 @@ declare class CngxTabErrorBadge {
|
|
|
525
1045
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabErrorBadge, "ng-template[cngxTabErrorBadge]", ["cngxTabErrorBadge"], {}, {}, never, never, true, never>;
|
|
526
1046
|
}
|
|
527
1047
|
|
|
1048
|
+
/**
|
|
1049
|
+
* Context for the `*cngxTabIcon` template. \
|
|
1050
|
+
* Rendered once per tab in the header, ahead of the label. \
|
|
1051
|
+
* Carries the tab handle plus the two
|
|
1052
|
+
* per-tab signals a consumer icon usually keys off - whether the tab is
|
|
1053
|
+
* the active one and its positional index.
|
|
1054
|
+
*
|
|
1055
|
+
* Richer than {@link CngxTabErrorBadgeContext} (which only needs `tab`) because an
|
|
1056
|
+
* icon commonly swaps glyph on the active tab.
|
|
1057
|
+
*
|
|
1058
|
+
* @category common/tabs/slots
|
|
1059
|
+
*/
|
|
1060
|
+
interface CngxTabIconContext {
|
|
1061
|
+
/** The tab handle carrying id / label / disabled / aggregator signals. */
|
|
1062
|
+
readonly tab: CngxTabHandle;
|
|
1063
|
+
/** Whether this tab is the currently active one. */
|
|
1064
|
+
readonly active: boolean;
|
|
1065
|
+
/** Zero-based position of the tab in the strip. */
|
|
1066
|
+
readonly index: number;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Structural slot for the tab-icon template. \
|
|
1070
|
+
* One group-level slot with per-tab context (stepper-slot parity), not a per-`CngxTab` input.\
|
|
1071
|
+
* 3-stage cascade:
|
|
1072
|
+
* per-instance directive > `CNGX_TABS_CONFIG.templates.icon` > none (no icon rendered).
|
|
1073
|
+
*
|
|
1074
|
+
* ```html
|
|
1075
|
+
* <ng-template cngxTabIcon let-active="active">
|
|
1076
|
+
* <cngx-icon [name]="active ? 'folder-open' : 'folder'" />
|
|
1077
|
+
* </ng-template>
|
|
1078
|
+
* ```
|
|
1079
|
+
*
|
|
1080
|
+
* @category common/tabs/slots
|
|
1081
|
+
* @wcag AA
|
|
1082
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-icon.directive.ts
|
|
1083
|
+
* @since 0.1.0
|
|
1084
|
+
* @relatedTo CngxTabErrorBadge, CngxTab, CngxTabGroup
|
|
1085
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-icons/icon-end</example-url>
|
|
1086
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-icons/icon-only</example-url>
|
|
1087
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-icons/icon-start</example-url>
|
|
1088
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-icons/icon-top</example-url>
|
|
1089
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-icons/icon-vertical-sidebar</example-url>
|
|
1090
|
+
*/
|
|
1091
|
+
declare class CngxTabIcon {
|
|
1092
|
+
readonly templateRef: TemplateRef<CngxTabIconContext>;
|
|
1093
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabIcon, never>;
|
|
1094
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabIcon, "ng-template[cngxTabIcon]", ["cngxTabIcon"], {}, {}, never, never, true, never>;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
528
1097
|
/**
|
|
529
1098
|
* Context for the `*cngxTabRejectionIcon` template. Renders only on
|
|
530
1099
|
* the tab matching `presenter.lastFailedIndex()`; the visibility
|
|
@@ -567,8 +1136,6 @@ interface CngxTabRejectionIconContext {
|
|
|
567
1136
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-rejection-icon.directive.ts
|
|
568
1137
|
* @since 0.1.0
|
|
569
1138
|
* @relatedTo CngxTabErrorBadge, CngxTabBusySpinner, CngxTab
|
|
570
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
571
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
572
1139
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
573
1140
|
*/
|
|
574
1141
|
declare class CngxTabRejectionIcon {
|
|
@@ -578,8 +1145,8 @@ declare class CngxTabRejectionIcon {
|
|
|
578
1145
|
}
|
|
579
1146
|
|
|
580
1147
|
/**
|
|
581
|
-
* Aria-label overrides for the tab-group landmark region.
|
|
582
|
-
* defaults are English; consumers override via
|
|
1148
|
+
* Aria-label overrides for the tab-group landmark region. \
|
|
1149
|
+
* Library defaults are English; consumers override via
|
|
583
1150
|
* {@link withTabsAriaLabels}.
|
|
584
1151
|
*
|
|
585
1152
|
* Per-tab nav phrasing (`previousTab`, `nextTab`) lives in
|
|
@@ -589,6 +1156,12 @@ declare class CngxTabRejectionIcon {
|
|
|
589
1156
|
* @category common/tabs
|
|
590
1157
|
*/
|
|
591
1158
|
interface CngxTabsAriaLabels {
|
|
1159
|
+
/**
|
|
1160
|
+
* Accessible name for the tab-group wrapper (`role="group"`), read by
|
|
1161
|
+
* AT when focus enters the region. Default `'Tabs'`. Ignored when a
|
|
1162
|
+
* per-instance `[aria-label]` / `[aria-labelledby]` is bound (those
|
|
1163
|
+
* win).
|
|
1164
|
+
*/
|
|
592
1165
|
readonly tabsRegion?: string;
|
|
593
1166
|
}
|
|
594
1167
|
/**
|
|
@@ -599,13 +1172,22 @@ interface CngxTabsAriaLabels {
|
|
|
599
1172
|
* @category common/tabs
|
|
600
1173
|
*/
|
|
601
1174
|
interface CngxTabsFallbackLabels {
|
|
1175
|
+
/**
|
|
1176
|
+
* `aria-roledescription` for the tablist. Default `'tab list'` (the
|
|
1177
|
+
* W3C ARIA convention) - kept distinct from the region `aria-label`
|
|
1178
|
+
* so AT does not read the same word twice back-to-back.
|
|
1179
|
+
*/
|
|
602
1180
|
readonly tabRoleDescription?: string;
|
|
1181
|
+
/**
|
|
1182
|
+
* `aria-roledescription` for each tab panel. Default `'tab panel'`.
|
|
1183
|
+
*/
|
|
603
1184
|
readonly tabPanelRoleDescription?: string;
|
|
604
1185
|
}
|
|
605
1186
|
/**
|
|
606
1187
|
* App-wide template overrides for `<cngx-tab-group>` and
|
|
607
|
-
* `<cngx-tab-overflow>` skin regions.
|
|
608
|
-
*
|
|
1188
|
+
* `<cngx-tab-overflow>` skin regions. \
|
|
1189
|
+
* Middle tier of the 3-stage cascade -
|
|
1190
|
+
* per-instance directive > this field > built-in markup. \
|
|
609
1191
|
* Apply via the matching `with*Template` builders. Shape mirrors
|
|
610
1192
|
* `CngxStepperTemplates` so consumer templates port across
|
|
611
1193
|
* families.
|
|
@@ -613,25 +1195,172 @@ interface CngxTabsFallbackLabels {
|
|
|
613
1195
|
* @category common/tabs
|
|
614
1196
|
*/
|
|
615
1197
|
interface CngxTabsTemplates {
|
|
1198
|
+
/** Default for the overflow "More" button label (`*cngxTabOverflowTrigger`). */
|
|
616
1199
|
readonly overflowTrigger?: TemplateRef<CngxTabOverflowTriggerContext>;
|
|
1200
|
+
/** Default for each row inside the overflow popover (`*cngxTabOverflowItem`). */
|
|
617
1201
|
readonly overflowItem?: TemplateRef<CngxTabOverflowItemContext>;
|
|
1202
|
+
/** Default for the per-tab error badge (`*cngxTabErrorBadge`). */
|
|
618
1203
|
readonly errorBadge?: TemplateRef<CngxTabErrorBadgeContext>;
|
|
1204
|
+
/** Default for the per-tab rejection decoration (`*cngxTabRejectionIcon`). */
|
|
619
1205
|
readonly rejectionIcon?: TemplateRef<CngxTabRejectionIconContext>;
|
|
1206
|
+
/** Default for the commit-pending busy spinner (`*cngxTabBusySpinner`). */
|
|
620
1207
|
readonly busySpinner?: TemplateRef<CngxTabBusySpinnerContext>;
|
|
1208
|
+
/** Default for the per-tab icon ahead of the label (`*cngxTabIcon`). */
|
|
1209
|
+
readonly icon?: TemplateRef<CngxTabIconContext>;
|
|
1210
|
+
/** Default for a tab's close-button glyph (`*cngxTabCloseIcon`). */
|
|
1211
|
+
readonly closeIcon?: TemplateRef<CngxTabCloseIconContext>;
|
|
1212
|
+
/** Default for the add-tab button glyph (`*cngxTabAddIcon`). */
|
|
1213
|
+
readonly addIcon?: TemplateRef<void>;
|
|
621
1214
|
}
|
|
622
1215
|
/**
|
|
623
|
-
*
|
|
624
|
-
*
|
|
1216
|
+
* Selectable visual skin for `<cngx-tab-group>`. \
|
|
1217
|
+
* The skin is a pure thematic concern - every value renders the same `tablist` / `tab` /
|
|
1218
|
+
* `tabpanel` structure, slots, ARIA, and keyboard behaviour, and only
|
|
1219
|
+
* redirects CSS via the `[data-skin]` host attribute. `'line'`
|
|
1220
|
+
* (default) is the underline indicator; `'contained'` fuses the active
|
|
1221
|
+
* tab with the panel surface; `'segmented'` sits the tabs in a muted
|
|
1222
|
+
* track and lifts the active tab onto a raised surface; `'pill'`
|
|
1223
|
+
* renders rounded solid fills; `'pill-outline'` renders the same pill
|
|
1224
|
+
* geometry with a tinted, outlined active state instead of a solid
|
|
1225
|
+
* fill.
|
|
1226
|
+
*
|
|
1227
|
+
* Sized to the tab use cases - not a 1:1 copy of the stepper's
|
|
1228
|
+
* seven skins. The Material twin (`[cngxMatTabs]`) ignores this setting.
|
|
1229
|
+
*
|
|
1230
|
+
* @category common/tabs
|
|
1231
|
+
*/
|
|
1232
|
+
type CngxTabsSkin = 'line' | 'contained' | 'segmented' | 'pill' | 'pill-outline';
|
|
1233
|
+
/**
|
|
1234
|
+
* Icon-layout axis for `<cngx-tab-group>`, orthogonal to both skin and
|
|
1235
|
+
* orientation. \
|
|
1236
|
+
* Positions the `*cngxTabIcon` slot relative to the tab
|
|
1237
|
+
* label: `'start'` (default) places the icon before the label in a row;
|
|
1238
|
+
* `'end'` places it after the label in a row; `'top'` stacks the icon
|
|
1239
|
+
* above the label in a column; `'only'` hides the label visually while
|
|
1240
|
+
* keeping it in the DOM as the accessible name.
|
|
1241
|
+
*
|
|
1242
|
+
* Redirected purely via
|
|
1243
|
+
* the `[data-icon-layout]` host attribute.
|
|
1244
|
+
*
|
|
1245
|
+
* @category common/tabs
|
|
1246
|
+
*/
|
|
1247
|
+
type CngxTabIconLayout = 'start' | 'end' | 'top' | 'only';
|
|
1248
|
+
/**
|
|
1249
|
+
* Panel render strategy for `<cngx-tab-group>`. \
|
|
1250
|
+
* The panel `<div>` (the `aria-controls` target) always stays in the DOM; only its content is
|
|
1251
|
+
* rendered per mode. `'eager'` (default) renders every panel's content
|
|
1252
|
+
* up front and toggles visibility via `[hidden]` - today's behaviour,
|
|
1253
|
+
* byte-identical. `'lazy'` renders a panel's content the first time it
|
|
1254
|
+
* is activated and keeps it (keep-alive). `'lazy-destroy'` renders only
|
|
1255
|
+
* the active panel's content and destroys it on leave.
|
|
1256
|
+
*
|
|
1257
|
+
* @category common/tabs
|
|
1258
|
+
*/
|
|
1259
|
+
type CngxTabsPanelMode = 'eager' | 'lazy' | 'lazy-destroy';
|
|
1260
|
+
/**
|
|
1261
|
+
* Horizontal alignment of the tab cluster along the strip, set via the
|
|
1262
|
+
* `[tabAlign]` Input and reflected onto `[data-tab-align]`. `'start'`
|
|
1263
|
+
* (default), `'center'`, or `'end'`. Horizontal only - ignored under
|
|
1264
|
+
* `orientation="vertical"` (tabs fill the column) and when `[fitted]`
|
|
1265
|
+
* stretches them to the full width.
|
|
1266
|
+
*
|
|
1267
|
+
* @category common/tabs
|
|
1268
|
+
*/
|
|
1269
|
+
type CngxTabAlign = 'start' | 'center' | 'end';
|
|
1270
|
+
/**
|
|
1271
|
+
* Tab-group config surface. Resolution priority: \
|
|
1272
|
+
* per-instance Input → `provideTabsConfigAt` (viewProviders) → `provideTabsConfig`
|
|
625
1273
|
* (root) → library default.
|
|
626
1274
|
*
|
|
627
1275
|
* @category common/tabs
|
|
628
1276
|
*/
|
|
629
1277
|
interface CngxTabsConfig {
|
|
1278
|
+
/**
|
|
1279
|
+
* App-wide default tablist orientation. Default `'horizontal'`
|
|
1280
|
+
* (left-to-right strip with arrow-left/right navigation);
|
|
1281
|
+
* `'vertical'` stacks the tabs in a column with arrow-up/down.
|
|
1282
|
+
* Per-instance `[orientation]` Input still wins. Override via
|
|
1283
|
+
* {@link withTabsDefaultOrientation}.
|
|
1284
|
+
*/
|
|
630
1285
|
readonly defaultOrientation?: 'horizontal' | 'vertical';
|
|
1286
|
+
/**
|
|
1287
|
+
* App-wide default for whether roving-tabindex navigation wraps from
|
|
1288
|
+
* the last tab back to the first (and vice versa). Default `true`.
|
|
1289
|
+
* Per-instance `[loop]` Input still wins. Override via
|
|
1290
|
+
* {@link withTabsRovingLoop}.
|
|
1291
|
+
*/
|
|
631
1292
|
readonly defaultLoop?: boolean;
|
|
1293
|
+
/**
|
|
1294
|
+
* App-wide default commit mode for async tab transitions.
|
|
1295
|
+
* `'optimistic'` (default) activates the target tab on action
|
|
1296
|
+
* dispatch and rolls back on error; `'pessimistic'` keeps the old tab
|
|
1297
|
+
* until the action resolves. Per-instance `[commitMode]` Input still
|
|
1298
|
+
* wins (and `[cngxTabsRouteSync]` pins pessimistic regardless).
|
|
1299
|
+
* Override via {@link withTabsCommitMode}.
|
|
1300
|
+
*/
|
|
632
1301
|
readonly defaultCommitMode?: 'optimistic' | 'pessimistic';
|
|
633
|
-
|
|
634
|
-
|
|
1302
|
+
/**
|
|
1303
|
+
* URL surface for {@link CngxTabsFragmentSync} deep-linking:
|
|
1304
|
+
* `'fragment'` (default) writes `#tab=<id>`, `'queryParam'` writes
|
|
1305
|
+
* `?tab=<id>`. Has no effect unless the directive is applied. Not the
|
|
1306
|
+
* router-outlet integration (`[cngxTabsRouteSync]`). Override via
|
|
1307
|
+
* {@link withTabsFragmentSync}.
|
|
1308
|
+
*/
|
|
1309
|
+
readonly fragmentSyncMode?: 'fragment' | 'queryParam';
|
|
1310
|
+
/**
|
|
1311
|
+
* Key name for the fragment / query-param deep-link written by
|
|
1312
|
+
* {@link CngxTabsFragmentSync}. Default `'tab'` (e.g. `#tab=settings`).
|
|
1313
|
+
* Override via {@link withTabsFragmentSync}.
|
|
1314
|
+
*/
|
|
1315
|
+
readonly fragmentSyncParam?: string;
|
|
1316
|
+
/**
|
|
1317
|
+
* App-wide default visual skin. \
|
|
1318
|
+
* Default `'line'`. Per-instance
|
|
1319
|
+
* `[skin]` Input still wins; the cascade default itself lives in
|
|
1320
|
+
* `createTabsHostAttrs`, not here (mirrors the stepper). Override via
|
|
1321
|
+
* {@link withTabsSkin}.
|
|
1322
|
+
*/
|
|
1323
|
+
readonly skin?: CngxTabsSkin;
|
|
1324
|
+
/**
|
|
1325
|
+
* App-wide default icon layout. \
|
|
1326
|
+
* Default `'start'`. Per-instance
|
|
1327
|
+
* `[iconLayout]` Input still wins; the cascade default lives in
|
|
1328
|
+
* `createTabsHostAttrs`. Override via {@link withTabsIconLayout}.
|
|
1329
|
+
*/
|
|
1330
|
+
readonly iconLayout?: CngxTabIconLayout;
|
|
1331
|
+
/**
|
|
1332
|
+
* App-wide default panel render strategy. Default `'eager'`.
|
|
1333
|
+
* Per-instance `[panelMode]` Input still wins; the cascade default
|
|
1334
|
+
* lives in `createTabsHostAttrs`. Override via
|
|
1335
|
+
* {@link withTabsPanelMode}.
|
|
1336
|
+
*/
|
|
1337
|
+
readonly panelMode?: CngxTabsPanelMode;
|
|
1338
|
+
/**
|
|
1339
|
+
* App-wide default for stretching tabs to the full strip width
|
|
1340
|
+
* (horizontal only). Default `false`. Per-instance `[fitted]` Input
|
|
1341
|
+
* wins; the cascade default lives in `createTabsHostAttrs`. Override
|
|
1342
|
+
* via {@link withTabsFitted}.
|
|
1343
|
+
*/
|
|
1344
|
+
readonly fitted?: boolean;
|
|
1345
|
+
/**
|
|
1346
|
+
* App-wide default tab-cluster alignment (horizontal only). Default
|
|
1347
|
+
* `'start'`. Per-instance `[tabAlign]` Input wins; the cascade default
|
|
1348
|
+
* lives in `createTabsHostAttrs`. Override via {@link withTabsAlign}.
|
|
1349
|
+
*/
|
|
1350
|
+
readonly tabAlign?: CngxTabAlign;
|
|
1351
|
+
/**
|
|
1352
|
+
* App-wide default for whether tabs render a close affordance.
|
|
1353
|
+
* Default `false`. Per-instance `[closable]` Input wins, and a
|
|
1354
|
+
* per-`CngxTab` `[closable]` override wins over both. The cascade
|
|
1355
|
+
* default lives in the organism. Override via {@link withTabsClosable}.
|
|
1356
|
+
*/
|
|
1357
|
+
readonly closable?: boolean;
|
|
1358
|
+
/**
|
|
1359
|
+
* App-wide default for whether the group renders an add-tab button.
|
|
1360
|
+
* Default `false`. Per-instance `[addable]` Input wins. Override via
|
|
1361
|
+
* {@link withTabsAddable}.
|
|
1362
|
+
*/
|
|
1363
|
+
readonly addable?: boolean;
|
|
635
1364
|
readonly ariaLabels?: CngxTabsAriaLabels;
|
|
636
1365
|
readonly fallbackLabels?: CngxTabsFallbackLabels;
|
|
637
1366
|
/**
|
|
@@ -645,20 +1374,19 @@ interface CngxTabsConfig {
|
|
|
645
1374
|
* Hard ceiling (ms) on commit deferral while IO bursts keep
|
|
646
1375
|
* arriving - without it, sustained churn (momentum scroll,
|
|
647
1376
|
* continuous resize) would clear the stabilize timer forever and
|
|
648
|
-
* the More counter would freeze on a stale value
|
|
649
|
-
* Pillar 2. Default 250ms.
|
|
1377
|
+
* the More counter would freeze on a stale value. Default 250ms.
|
|
650
1378
|
*/
|
|
651
1379
|
readonly overflowMaxDeferMs?: number;
|
|
652
1380
|
/**
|
|
653
|
-
* App-wide template overrides for `<cngx-tab-overflow>` regions.
|
|
1381
|
+
* App-wide template overrides for `<cngx-tab-overflow>` regions. \
|
|
654
1382
|
* Middle tier of the family-standard 3-stage cascade. See
|
|
655
1383
|
* {@link CngxTabsTemplates}.
|
|
656
1384
|
*/
|
|
657
1385
|
readonly templates?: CngxTabsTemplates;
|
|
658
1386
|
}
|
|
659
1387
|
/**
|
|
660
|
-
* DI token for the resolved tabs config.
|
|
661
|
-
* the library defaults; override via {@link provideTabsConfig}
|
|
1388
|
+
* DI token for the resolved tabs config. \
|
|
1389
|
+
* `providedIn: 'root'` with the library defaults; override via {@link provideTabsConfig}
|
|
662
1390
|
* (root) or {@link provideTabsConfigAt} (component scope).
|
|
663
1391
|
*
|
|
664
1392
|
* @category common/tabs
|
|
@@ -668,8 +1396,8 @@ interface CngxTabsConfig {
|
|
|
668
1396
|
*/
|
|
669
1397
|
declare const CNGX_TABS_CONFIG: InjectionToken<CngxTabsConfig>;
|
|
670
1398
|
/**
|
|
671
|
-
* Feature signature for `with*` config builders.
|
|
672
|
-
* `_target` discriminator lets {@link provideCngxTabs} dispatch
|
|
1399
|
+
* Feature signature for `with*` config builders. \
|
|
1400
|
+
* The hidden `_target` discriminator lets {@link provideCngxTabs} dispatch
|
|
673
1401
|
* config features to {@link provideTabsConfig} while i18n features
|
|
674
1402
|
* route to {@link provideTabsI18n}.
|
|
675
1403
|
*
|
|
@@ -711,13 +1439,89 @@ declare function withTabsRovingLoop(loop: boolean): CngxTabsConfigFeature;
|
|
|
711
1439
|
*/
|
|
712
1440
|
declare function withTabsCommitMode(mode: 'optimistic' | 'pessimistic'): CngxTabsConfigFeature;
|
|
713
1441
|
/**
|
|
714
|
-
* Configure
|
|
715
|
-
* the
|
|
716
|
-
* the
|
|
1442
|
+
* Configure URL fragment / query-param deep-linking for the active tab
|
|
1443
|
+
* (the {@link CngxTabsFragmentSync} directive). \
|
|
1444
|
+
* `mode` chooses the URL surface (URL fragment or query parameter); `param` names the key
|
|
1445
|
+
* (default `'tab'`).
|
|
1446
|
+
*
|
|
1447
|
+
* Not to be confused with `[cngxTabsRouteSync]`, the router-outlet
|
|
1448
|
+
* integration - this feature configures fragment deep-linking only.
|
|
1449
|
+
*
|
|
1450
|
+
* @category common/tabs
|
|
1451
|
+
*/
|
|
1452
|
+
declare function withTabsFragmentSync(mode: 'fragment' | 'queryParam', param?: string): CngxTabsConfigFeature;
|
|
1453
|
+
/**
|
|
1454
|
+
* @deprecated Use {@link withTabsFragmentSync}. "Router sync" collided
|
|
1455
|
+
* with the new `[cngxTabsRouteSync]` router-outlet directive; this
|
|
1456
|
+
* feature only ever configured fragment / query-param deep-linking. The
|
|
1457
|
+
* alias stays for one minor release before removal.
|
|
1458
|
+
*
|
|
1459
|
+
* @category common/tabs
|
|
1460
|
+
*/
|
|
1461
|
+
declare const withTabsRouterSync: typeof withTabsFragmentSync;
|
|
1462
|
+
/**
|
|
1463
|
+
* Select the app-wide default visual skin for `<cngx-tab-group>`. \
|
|
1464
|
+
* Default `'line'`. Per-instance `[skin]` Input still wins; this moves
|
|
1465
|
+
* the cascade default. Structure, slots, ARIA, and keyboard behaviour
|
|
1466
|
+
* are identical across skins - only the `[data-skin]` host attribute
|
|
1467
|
+
* changes the CSS layer. The Material twin (`[cngxMatTabs]`) ignores it.
|
|
1468
|
+
*
|
|
1469
|
+
* @category common/tabs
|
|
1470
|
+
*/
|
|
1471
|
+
declare function withTabsSkin(skin: CngxTabsSkin): CngxTabsConfigFeature;
|
|
1472
|
+
/**
|
|
1473
|
+
* Set the app-wide default icon layout for `<cngx-tab-group>`. \
|
|
1474
|
+
* Default`'start'`. Per-instance `[iconLayout]` Input still wins. Orthogonal to
|
|
1475
|
+
* skin and orientation - only the `[data-icon-layout]` host attribute
|
|
1476
|
+
* changes.
|
|
1477
|
+
*
|
|
1478
|
+
* @category common/tabs
|
|
1479
|
+
*/
|
|
1480
|
+
declare function withTabsIconLayout(layout: CngxTabIconLayout): CngxTabsConfigFeature;
|
|
1481
|
+
/**
|
|
1482
|
+
* Set the app-wide default panel render strategy for `<cngx-tab-group>`. \
|
|
1483
|
+
* Default `'eager'` (every panel's content rendered up front, toggled
|
|
1484
|
+
* via `[hidden]`). `'lazy'` keep-alives content after first activation;
|
|
1485
|
+
* `'lazy-destroy'` renders only the active panel's content. Per-instance
|
|
1486
|
+
* `[panelMode]` Input still wins. The panel `<div>` always stays in the
|
|
1487
|
+
* DOM regardless of mode (the `aria-controls` target).
|
|
1488
|
+
*
|
|
1489
|
+
* @category common/tabs
|
|
1490
|
+
*/
|
|
1491
|
+
declare function withTabsPanelMode(mode: CngxTabsPanelMode): CngxTabsConfigFeature;
|
|
1492
|
+
/**
|
|
1493
|
+
* Set the app-wide default for stretching tabs to the full strip width
|
|
1494
|
+
* (horizontal only). \
|
|
1495
|
+
* Default `false`. Per-instance `[fitted]` Input still
|
|
1496
|
+
* wins. No effect under `orientation="vertical"`.
|
|
1497
|
+
*
|
|
1498
|
+
* @category common/tabs
|
|
1499
|
+
*/
|
|
1500
|
+
declare function withTabsFitted(fitted: boolean): CngxTabsConfigFeature;
|
|
1501
|
+
/**
|
|
1502
|
+
* Set the app-wide default tab-cluster alignment (horizontal only). \
|
|
1503
|
+
* Default `'start'`. Per-instance `[tabAlign]` Input still wins. Ignored
|
|
1504
|
+
* under `orientation="vertical"` and when the group is `fitted`.
|
|
1505
|
+
*
|
|
1506
|
+
* @category common/tabs
|
|
1507
|
+
*/
|
|
1508
|
+
declare function withTabsAlign(align: CngxTabAlign): CngxTabsConfigFeature;
|
|
1509
|
+
/**
|
|
1510
|
+
* Set the app-wide default for whether tabs render a close affordance. \
|
|
1511
|
+
* Default `false`. Per-instance `[closable]` Input wins; a per-`CngxTab`
|
|
1512
|
+
* `[closable]` override wins over both.
|
|
717
1513
|
*
|
|
718
1514
|
* @category common/tabs
|
|
719
1515
|
*/
|
|
720
|
-
declare function
|
|
1516
|
+
declare function withTabsClosable(closable: boolean): CngxTabsConfigFeature;
|
|
1517
|
+
/**
|
|
1518
|
+
* Set the app-wide default for whether the group renders an add-tab
|
|
1519
|
+
* button. \
|
|
1520
|
+
* Default `false`. Per-instance `[addable]` Input wins.
|
|
1521
|
+
*
|
|
1522
|
+
* @category common/tabs
|
|
1523
|
+
*/
|
|
1524
|
+
declare function withTabsAddable(addable: boolean): CngxTabsConfigFeature;
|
|
721
1525
|
/**
|
|
722
1526
|
* Merge ARIA labels into the cascade. Keys not provided keep their
|
|
723
1527
|
* library defaults; per-instance overrides on the tab group still win.
|
|
@@ -747,21 +1551,23 @@ declare function withTabOverflowStabilizeMs(ms: number): CngxTabsConfigFeature;
|
|
|
747
1551
|
*/
|
|
748
1552
|
declare function withTabOverflowMaxDeferMs(ms: number): CngxTabsConfigFeature;
|
|
749
1553
|
/**
|
|
750
|
-
* App-wide override for the More-button label. Middle tier;
|
|
1554
|
+
* App-wide override for the More-button label. Middle tier; \
|
|
751
1555
|
* per-instance `*cngxTabOverflowTrigger` still wins.
|
|
752
1556
|
*
|
|
753
1557
|
* ```ts
|
|
754
|
-
*
|
|
755
|
-
*
|
|
1558
|
+
* readonly moreTrigger = viewChild.required<TemplateRef<CngxTabOverflowTriggerContext>>(
|
|
1559
|
+
* 'moreTrigger',
|
|
1560
|
+
* { read: TemplateRef },
|
|
1561
|
+
* );
|
|
756
1562
|
*
|
|
757
|
-
* providers: [provideTabsConfig(withTabOverflowTriggerTemplate(this.moreTrigger))]
|
|
1563
|
+
* providers: [provideTabsConfig(withTabOverflowTriggerTemplate(this.moreTrigger()))]
|
|
758
1564
|
* ```
|
|
759
1565
|
*
|
|
760
1566
|
* @category common/tabs
|
|
761
1567
|
*/
|
|
762
1568
|
declare function withTabOverflowTriggerTemplate(template: TemplateRef<CngxTabOverflowTriggerContext>): CngxTabsConfigFeature;
|
|
763
1569
|
/**
|
|
764
|
-
* App-wide override for each row inside the overflow popover.
|
|
1570
|
+
* App-wide override for each row inside the overflow popover. \
|
|
765
1571
|
* Middle tier; per-instance `*cngxTabOverflowItem` still wins.
|
|
766
1572
|
*
|
|
767
1573
|
* @category common/tabs
|
|
@@ -777,7 +1583,8 @@ declare function withTabOverflowItemTemplate(template: TemplateRef<CngxTabOverfl
|
|
|
777
1583
|
declare function withTabErrorBadgeTemplate(template: TemplateRef<CngxTabErrorBadgeContext>): CngxTabsConfigFeature;
|
|
778
1584
|
/**
|
|
779
1585
|
* App-wide override for the rejection-icon decoration. Middle
|
|
780
|
-
* tier;
|
|
1586
|
+
* tier; \
|
|
1587
|
+
* per-instance `*cngxTabRejectionIcon` still wins. Sibling
|
|
781
1588
|
* of {@link withStepRejectionTemplate}.
|
|
782
1589
|
*
|
|
783
1590
|
* @category common/tabs
|
|
@@ -791,6 +1598,28 @@ declare function withTabRejectionIconTemplate(template: TemplateRef<CngxTabRejec
|
|
|
791
1598
|
* @category common/tabs
|
|
792
1599
|
*/
|
|
793
1600
|
declare function withTabBusySpinnerTemplate(template: TemplateRef<CngxTabBusySpinnerContext>): CngxTabsConfigFeature;
|
|
1601
|
+
/**
|
|
1602
|
+
* App-wide override for the tab-icon slot. Middle tier of the 3-stage
|
|
1603
|
+
* cascade; per-instance `*cngxTabIcon` still wins. Sibling of
|
|
1604
|
+
* {@link withStepIndicatorTemplate}.
|
|
1605
|
+
*
|
|
1606
|
+
* @category common/tabs
|
|
1607
|
+
*/
|
|
1608
|
+
declare function withTabIconTemplate(template: TemplateRef<CngxTabIconContext>): CngxTabsConfigFeature;
|
|
1609
|
+
/**
|
|
1610
|
+
* App-wide override for a tab's close-button glyph. Middle tier;
|
|
1611
|
+
* per-instance `*cngxTabCloseIcon` still wins.
|
|
1612
|
+
*
|
|
1613
|
+
* @category common/tabs
|
|
1614
|
+
*/
|
|
1615
|
+
declare function withTabCloseIconTemplate(template: TemplateRef<CngxTabCloseIconContext>): CngxTabsConfigFeature;
|
|
1616
|
+
/**
|
|
1617
|
+
* App-wide override for the add-tab button glyph. Middle tier;
|
|
1618
|
+
* per-instance `*cngxTabAddIcon` still wins.
|
|
1619
|
+
*
|
|
1620
|
+
* @category common/tabs
|
|
1621
|
+
*/
|
|
1622
|
+
declare function withTabAddIconTemplate(template: TemplateRef<void>): CngxTabsConfigFeature;
|
|
794
1623
|
/**
|
|
795
1624
|
* Root-level provider. Apply once in `bootstrapApplication` /
|
|
796
1625
|
* `appConfig.providers`. Returns {@link EnvironmentProviders} per
|
|
@@ -821,6 +1650,51 @@ declare function provideTabsConfigAt(...features: readonly CngxTabsConfigFeature
|
|
|
821
1650
|
*/
|
|
822
1651
|
declare function injectTabsConfig(): CngxTabsConfig;
|
|
823
1652
|
|
|
1653
|
+
/**
|
|
1654
|
+
* Input bundle for {@link createTabsHostAttrs}: the per-instance inputs
|
|
1655
|
+
* (each `Signal<T | undefined>`) and the resolved config (read
|
|
1656
|
+
* synchronously at construction). Each cascade collapses through
|
|
1657
|
+
* `input ?? config ?? library-default`.
|
|
1658
|
+
*
|
|
1659
|
+
* @internal
|
|
1660
|
+
*/
|
|
1661
|
+
interface CngxTabsHostAttrsInputs {
|
|
1662
|
+
readonly skin: Signal<CngxTabsSkin | undefined>;
|
|
1663
|
+
readonly iconLayout: Signal<CngxTabIconLayout | undefined>;
|
|
1664
|
+
readonly panelMode: Signal<CngxTabsPanelMode | undefined>;
|
|
1665
|
+
readonly fitted: Signal<boolean | undefined>;
|
|
1666
|
+
readonly tabAlign: Signal<CngxTabAlign | undefined>;
|
|
1667
|
+
readonly config: CngxTabsConfig;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Host-attribute signals for `<cngx-tab-group>`. Each is read by a
|
|
1671
|
+
* `[attr.data-*]` host binding on the organism.
|
|
1672
|
+
*
|
|
1673
|
+
* @internal
|
|
1674
|
+
*/
|
|
1675
|
+
interface CngxTabsHostAttrs {
|
|
1676
|
+
readonly resolvedSkin: Signal<CngxTabsSkin>;
|
|
1677
|
+
readonly resolvedIconLayout: Signal<CngxTabIconLayout>;
|
|
1678
|
+
readonly resolvedPanelMode: Signal<CngxTabsPanelMode>;
|
|
1679
|
+
readonly resolvedFitted: Signal<boolean>;
|
|
1680
|
+
readonly resolvedTabAlign: Signal<CngxTabAlign>;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Helper resolving the host-attribute cascades for
|
|
1684
|
+
* `<cngx-tab-group>` (skin / iconLayout). Keeps the organism class
|
|
1685
|
+
* under the LOC guard while making the cascade pattern reusable. Sibling
|
|
1686
|
+
* shape to `createStepperHostAttrs`; the resolved-type unions differ per
|
|
1687
|
+
* family, so the helpers are siblings, not shared code.
|
|
1688
|
+
*
|
|
1689
|
+
* Each computed honors the cascade:
|
|
1690
|
+
* per-instance input wins over root config wins over library default. No
|
|
1691
|
+
* manual sync. The library defaults (`'line'` / `'start'`) live here,
|
|
1692
|
+
* not in `TABS_CONFIG_DEFAULTS` - mirroring the stepper.
|
|
1693
|
+
*
|
|
1694
|
+
* @internal
|
|
1695
|
+
*/
|
|
1696
|
+
declare function createTabsHostAttrs(inputs: CngxTabsHostAttrsInputs): CngxTabsHostAttrs;
|
|
1697
|
+
|
|
824
1698
|
/**
|
|
825
1699
|
* Tabs i18n surface. Library defaults are English; consumers
|
|
826
1700
|
* override via {@link provideTabsI18n}. Sibling to
|
|
@@ -831,10 +1705,26 @@ declare function injectTabsConfig(): CngxTabsConfig;
|
|
|
831
1705
|
interface CngxTabsI18n {
|
|
832
1706
|
readonly tabsLabel: string;
|
|
833
1707
|
readonly selectedTab: (label: string, position: number, count: number) => string;
|
|
1708
|
+
/**
|
|
1709
|
+
* Folds a tab's optional secondary label into its accessible name.
|
|
1710
|
+
* Receives the primary label and the sub-label detail; the result
|
|
1711
|
+
* is passed to {@link selectedTab} as the label part, e.g.
|
|
1712
|
+
* `Tab 2 of 5: Bookmarks, 45`. Only invoked when a sub-label is
|
|
1713
|
+
* present.
|
|
1714
|
+
*/
|
|
1715
|
+
readonly tabLabelWithDetail: (label: string, detail: string) => string;
|
|
834
1716
|
readonly tabHasErrors: (count: number) => string;
|
|
835
1717
|
readonly moreTabsLabel: (count: number) => string;
|
|
836
1718
|
readonly previousTab: string;
|
|
837
1719
|
readonly nextTab: string;
|
|
1720
|
+
/**
|
|
1721
|
+
* Accessible name for a tab's close button. Receives the tab label
|
|
1722
|
+
* (or a generic fallback when unlabeled) and yields the button's
|
|
1723
|
+
* `aria-label`, e.g. `Close "Profile"`.
|
|
1724
|
+
*/
|
|
1725
|
+
readonly closeTab: (label: string) => string;
|
|
1726
|
+
/** Accessible name for the add-tab button. */
|
|
1727
|
+
readonly addTab: string;
|
|
838
1728
|
/**
|
|
839
1729
|
* @deprecated Superseded by {@link commitRolledBackTo}. Retained as
|
|
840
1730
|
* the defensive fallback in `liveAnnouncement` when the origin
|
|
@@ -908,20 +1798,23 @@ declare function provideTabsI18n(...features: readonly CngxTabsI18nFeature[]): P
|
|
|
908
1798
|
declare function injectTabsI18n(): CngxTabsI18n;
|
|
909
1799
|
|
|
910
1800
|
/**
|
|
911
|
-
* Union of feature kinds the tabs aggregator accepts.
|
|
912
|
-
*
|
|
1801
|
+
* Union of feature kinds the tabs aggregator accepts. \
|
|
1802
|
+
* Today: config and i18n; future surfaces widen the union and dispatch via the
|
|
913
1803
|
* hidden `_target` discriminator.
|
|
914
1804
|
*
|
|
915
1805
|
* @category common/tabs
|
|
916
1806
|
*/
|
|
917
1807
|
type CngxTabsFeature = CngxTabsConfigFeature | CngxTabsI18nFeature;
|
|
918
1808
|
/**
|
|
919
|
-
* Unified aggregator for tabs configuration.
|
|
920
|
-
* `_target` to {@link provideTabsConfig} and {@link provideTabsI18n}.
|
|
921
|
-
* Sibling to
|
|
922
|
-
*
|
|
923
|
-
* `
|
|
924
|
-
*
|
|
1809
|
+
* Unified aggregator for tabs configuration. \
|
|
1810
|
+
* Routes features by `_target` to {@link provideTabsConfig} and {@link provideTabsI18n}. \
|
|
1811
|
+
* Sibling to
|
|
1812
|
+
* - `provideCngxMenu` and
|
|
1813
|
+
* - `provideCngxSelect`;
|
|
1814
|
+
* apply once in the app providers array. \
|
|
1815
|
+
* Returns {@link EnvironmentProviders}; for
|
|
1816
|
+
* - `viewProviders` use {@link provideCngxTabsAt} — opaque
|
|
1817
|
+
* - `EnvironmentProviders` cannot live there.
|
|
925
1818
|
*
|
|
926
1819
|
* ```ts
|
|
927
1820
|
* bootstrapApplication(AppComponent, {
|
|
@@ -937,11 +1830,14 @@ type CngxTabsFeature = CngxTabsConfigFeature | CngxTabsI18nFeature;
|
|
|
937
1830
|
* ```
|
|
938
1831
|
*
|
|
939
1832
|
* @category common/tabs
|
|
1833
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/provide-cngx-tabs.ts
|
|
1834
|
+
* @since 0.1.0
|
|
1835
|
+
* @relatedTo CngxTabGroup, CngxTabsConfig, provideCngxTabsAt
|
|
940
1836
|
*/
|
|
941
1837
|
declare function provideCngxTabs(...features: readonly CngxTabsFeature[]): EnvironmentProviders;
|
|
942
1838
|
/**
|
|
943
|
-
* Component-scoped twin of {@link provideCngxTabs}.
|
|
944
|
-
* `Provider[]` for `viewProviders`/`providers`; same dispatch
|
|
1839
|
+
* Component-scoped twin of {@link provideCngxTabs}. \
|
|
1840
|
+
* Returns `Provider[]` for `viewProviders`/`providers`; same dispatch
|
|
945
1841
|
* semantics, different scope.
|
|
946
1842
|
*
|
|
947
1843
|
* ```ts
|
|
@@ -956,19 +1852,23 @@ declare function provideCngxTabs(...features: readonly CngxTabsFeature[]): Envir
|
|
|
956
1852
|
* ```
|
|
957
1853
|
*
|
|
958
1854
|
* @category common/tabs
|
|
1855
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/provide-cngx-tabs.ts
|
|
1856
|
+
* @since 0.1.0
|
|
1857
|
+
* @relatedTo CngxTabGroup, CngxTabsConfig, provideCngxTabs
|
|
959
1858
|
*/
|
|
960
1859
|
declare function provideCngxTabsAt(...features: readonly CngxTabsFeature[]): Provider[];
|
|
961
1860
|
|
|
962
1861
|
/**
|
|
963
|
-
* Adapts the shared commit-controller to the tabs action shape.
|
|
964
|
-
* presenter delegates to {@link beginTransition} when `commitAction`
|
|
1862
|
+
* Adapts the shared commit-controller to the tabs action shape. \
|
|
1863
|
+
* The presenter delegates to {@link beginTransition} when `commitAction`
|
|
965
1864
|
* is bound.
|
|
966
1865
|
*
|
|
967
1866
|
* @category common/tabs
|
|
968
1867
|
*/
|
|
969
1868
|
interface CngxTabsCommitHandler {
|
|
970
1869
|
/**
|
|
971
|
-
* Start a tab-transition commit.
|
|
1870
|
+
* Start a tab-transition commit. \
|
|
1871
|
+
* Returns synchronously - read the
|
|
972
1872
|
* controller's `state` signal for in-flight status. `onResolve`
|
|
973
1873
|
* fires once with `accept = true` on success or `false` on
|
|
974
1874
|
* rejection; skipped on supersede.
|
|
@@ -1004,10 +1904,11 @@ declare function createTabsCommitHandler(opts: CngxTabsCommitHandlerOptions): Cn
|
|
|
1004
1904
|
*/
|
|
1005
1905
|
type CngxTabsCommitHandlerFactory = (opts: CngxTabsCommitHandlerOptions) => CngxTabsCommitHandler;
|
|
1006
1906
|
/**
|
|
1007
|
-
* DI token for the commit-handler factory.
|
|
1008
|
-
* {@link createTabsCommitHandler}.
|
|
1009
|
-
*
|
|
1010
|
-
* `
|
|
1907
|
+
* DI token for the commit-handler factory. \
|
|
1908
|
+
* Defaults to {@link createTabsCommitHandler}. \
|
|
1909
|
+
* Sibling to
|
|
1910
|
+
* - `CNGX_ARRAY_COMMIT_HANDLER_FACTORY` (select) and
|
|
1911
|
+
* - `CNGX_STEPPER_COMMIT_HANDLER_FACTORY`.
|
|
1011
1912
|
*
|
|
1012
1913
|
* @category common/tabs
|
|
1013
1914
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/commit-handler.ts
|
|
@@ -1016,10 +1917,12 @@ type CngxTabsCommitHandlerFactory = (opts: CngxTabsCommitHandlerOptions) => Cngx
|
|
|
1016
1917
|
declare const CNGX_TABS_COMMIT_HANDLER_FACTORY: InjectionToken<CngxTabsCommitHandlerFactory>;
|
|
1017
1918
|
|
|
1018
1919
|
/**
|
|
1019
|
-
* Resolves the DOM elements `<cngx-tab-overflow>` observes.
|
|
1020
|
-
* keys by `[id="${handle.id}-header"]`; the Material twin keys by
|
|
1920
|
+
* Resolves the DOM elements `<cngx-tab-overflow>` observes. \
|
|
1921
|
+
* cngx-native keys by `[id="${handle.id}-header"]`; the Material twin keys by
|
|
1021
1922
|
* positional index into `.mat-mdc-tab` (handle ids never appear on
|
|
1022
|
-
* Material's rendered DOM).
|
|
1923
|
+
* Material's rendered DOM). \
|
|
1924
|
+
*
|
|
1925
|
+
* The molecule is variant-agnostic and
|
|
1023
1926
|
* consumes whichever adapter
|
|
1024
1927
|
* {@link CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY} provides.
|
|
1025
1928
|
*
|
|
@@ -1028,7 +1931,8 @@ declare const CNGX_TABS_COMMIT_HANDLER_FACTORY: InjectionToken<CngxTabsCommitHan
|
|
|
1028
1931
|
interface CngxTabOverflowDomAdapter {
|
|
1029
1932
|
/**
|
|
1030
1933
|
* Resolve the IntersectionObserver root - the scroll viewport the
|
|
1031
|
-
* molecule observes.
|
|
1934
|
+
* molecule observes. \
|
|
1935
|
+
* Returning `null` short-circuits the attach;
|
|
1032
1936
|
* the molecule's rAF retry loop polls again next frame.
|
|
1033
1937
|
*/
|
|
1034
1938
|
resolveStripRoot(panelHost: CngxTabPanelHost, host: HTMLElement): HTMLElement | null;
|
|
@@ -1045,7 +1949,7 @@ interface CngxTabOverflowDomAdapter {
|
|
|
1045
1949
|
*/
|
|
1046
1950
|
type CngxTabOverflowDomAdapterFactory = () => CngxTabOverflowDomAdapter;
|
|
1047
1951
|
/**
|
|
1048
|
-
* Default adapter for the cngx-native `<cngx-tab-group>` strip:
|
|
1952
|
+
* Default adapter for the cngx-native `<cngx-tab-group>` strip: \
|
|
1049
1953
|
* walks `host.closest('.cngx-tabs__strip-wrapper')` for the IO root,
|
|
1050
1954
|
* then `[id="${handle.id}-header"]` for each button.
|
|
1051
1955
|
*
|
|
@@ -1053,7 +1957,7 @@ type CngxTabOverflowDomAdapterFactory = () => CngxTabOverflowDomAdapter;
|
|
|
1053
1957
|
*/
|
|
1054
1958
|
declare function createCngxTabOverflowDefaultDomAdapter(): CngxTabOverflowDomAdapter;
|
|
1055
1959
|
/**
|
|
1056
|
-
* DI token for the overflow molecule's DOM-resolution strategy.
|
|
1960
|
+
* DI token for the overflow molecule's DOM-resolution strategy. \
|
|
1057
1961
|
* Override at directive `providers` or component `viewProviders` to
|
|
1058
1962
|
* swap in a Material, custom-skin, or test-double adapter without
|
|
1059
1963
|
* forking the molecule. Defaults to
|
|
@@ -1111,9 +2015,12 @@ interface CngxDomAnchorRetryHandle {
|
|
|
1111
2015
|
}
|
|
1112
2016
|
/**
|
|
1113
2017
|
* Bounded retry loop for DOM-anchoring patterns - shared
|
|
1114
|
-
* attempt-counter
|
|
2018
|
+
* attempt-counter and give-up and cancellation contract. \
|
|
2019
|
+
* Used by
|
|
1115
2020
|
* `<cngx-tab-overflow>`'s rAF strip-attach loop and `[cngxMatTabs]`'s
|
|
1116
|
-
* `afterNextRender` header-anchor loop.
|
|
2021
|
+
* `afterNextRender` header-anchor loop.
|
|
2022
|
+
*
|
|
2023
|
+
* Consumer-supplied scheduler
|
|
1117
2024
|
* lets different timing primitives flow through one counter.
|
|
1118
2025
|
*
|
|
1119
2026
|
* ```ts
|
|
@@ -1146,15 +2053,16 @@ declare function createDomAnchorRetry(options: CngxDomAnchorRetryOptions): CngxD
|
|
|
1146
2053
|
*/
|
|
1147
2054
|
type CngxDomAnchorRetryFactory = (options: CngxDomAnchorRetryOptions) => CngxDomAnchorRetryHandle;
|
|
1148
2055
|
/**
|
|
1149
|
-
* DI token for the DOM-anchor retry policy.
|
|
1150
|
-
* {@link createDomAnchorRetry}. Two real consumers today -
|
|
2056
|
+
* DI token for the DOM-anchor retry policy. \
|
|
2057
|
+
* Default {@link createDomAnchorRetry}. Two real consumers today -
|
|
1151
2058
|
* `<cngx-tab-overflow>`'s rAF strip-attach loop and
|
|
1152
2059
|
* `[cngxMatTabs]`'s `afterNextRender` header-anchor loop. Override
|
|
1153
2060
|
* via `providers` / `viewProviders` for retry-with-backoff,
|
|
1154
|
-
* telemetry on give-up, etc.
|
|
1155
|
-
*
|
|
1156
|
-
* `
|
|
1157
|
-
* `
|
|
2061
|
+
* telemetry on give-up, etc. \
|
|
2062
|
+
* Symmetric to
|
|
2063
|
+
* - `CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY`,
|
|
2064
|
+
* - `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY`, and
|
|
2065
|
+
* - `CNGX_TABS_COMMIT_HANDLER_FACTORY`.
|
|
1158
2066
|
*
|
|
1159
2067
|
* @category common/tabs/overflow
|
|
1160
2068
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/overflow/dom-anchor-retry.ts
|
|
@@ -1163,11 +2071,187 @@ type CngxDomAnchorRetryFactory = (options: CngxDomAnchorRetryOptions) => CngxDom
|
|
|
1163
2071
|
declare const CNGX_DOM_ANCHOR_RETRY_FACTORY: InjectionToken<CngxDomAnchorRetryFactory>;
|
|
1164
2072
|
|
|
1165
2073
|
/**
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
2074
|
+
* Structural slot for the add-tab button glyph. 3-stage cascade:
|
|
2075
|
+
* per-instance directive > `CNGX_TABS_CONFIG.templates.addIcon` >
|
|
2076
|
+
* `CNGX_TABS_GLYPHS.addIcon`. The button owns its `aria-label`; the
|
|
2077
|
+
* template paints only the glyph, so its context is `void`.
|
|
2078
|
+
*
|
|
2079
|
+
* ```html
|
|
2080
|
+
* <cngx-tab-group addable (tabAdd)="add()">
|
|
2081
|
+
* <ng-template cngxTabAddIcon><cngx-icon name="plus" /></ng-template>
|
|
2082
|
+
* ...
|
|
2083
|
+
* </cngx-tab-group>
|
|
2084
|
+
* ```
|
|
2085
|
+
*
|
|
2086
|
+
* @category common/tabs/slots
|
|
2087
|
+
* @wcag AA
|
|
2088
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-add-icon.directive.ts
|
|
2089
|
+
* @since 0.1.0
|
|
2090
|
+
* @relatedTo CngxTabCloseIcon, CngxTabGroup
|
|
2091
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-dismissable/dismissable-and-addable</example-url>
|
|
2092
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/addable-tabs</example-url>
|
|
2093
|
+
*/
|
|
2094
|
+
declare class CngxTabAddIcon {
|
|
2095
|
+
readonly templateRef: TemplateRef<void>;
|
|
2096
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabAddIcon, never>;
|
|
2097
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabAddIcon, "ng-template[cngxTabAddIcon]", ["cngxTabAddIcon"], {}, {}, never, never, true, never>;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
/**
|
|
2101
|
+
* Inputs to {@link createTabDismissals}. \
|
|
2102
|
+
* The organism owns the
|
|
2103
|
+
* `[closable]` / `[addable]` inputs and the DOM handle; the factory runs
|
|
2104
|
+
* the cascade and the close/add interaction so the organism class stays
|
|
2105
|
+
* under the LOC guard. \
|
|
2106
|
+
*
|
|
2107
|
+
* Sibling shape to `createTabGroupAnnouncements`.
|
|
2108
|
+
*
|
|
2109
|
+
* @category common/tabs
|
|
2110
|
+
*/
|
|
2111
|
+
interface CngxTabDismissalsOptions {
|
|
2112
|
+
readonly host: CngxTabGroupHost;
|
|
2113
|
+
readonly config: CngxTabsConfig;
|
|
2114
|
+
readonly i18n: CngxTabsI18n;
|
|
2115
|
+
readonly closable: Signal<boolean | undefined>;
|
|
2116
|
+
readonly addable: Signal<boolean | undefined>;
|
|
2117
|
+
readonly hostElement: HTMLElement;
|
|
2118
|
+
readonly injector: Injector;
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Resolved dismissable/addable surface for `<cngx-tab-group>`. \
|
|
2122
|
+
* The organism holds this as one field and the template reads it.
|
|
2123
|
+
*
|
|
2124
|
+
* @category common/tabs
|
|
2125
|
+
*/
|
|
2126
|
+
interface CngxTabDismissals {
|
|
2127
|
+
/** Effective group-level close affordance (`input ?? config ?? false`). */
|
|
2128
|
+
readonly resolvedClosable: Signal<boolean>;
|
|
2129
|
+
/** Effective group-level add affordance (`input ?? config ?? false`). */
|
|
2130
|
+
readonly resolvedAddable: Signal<boolean>;
|
|
2131
|
+
/** Per-tab closable: per-tab override > group resolution. */
|
|
2132
|
+
isTabClosable(tab: CngxTabHandle): boolean;
|
|
2133
|
+
/** i18n accessible name for a tab's close button. */
|
|
2134
|
+
closeButtonLabel(tab: CngxTabHandle): string;
|
|
2135
|
+
/** Stable `*cngxTabCloseIcon` context (`{ tab }`) per tab. */
|
|
2136
|
+
closeIconContextFor(tab: CngxTabHandle): CngxTabCloseIconContext;
|
|
2137
|
+
/** Close a tab and restore focus to the new active tab / add button. */
|
|
2138
|
+
handleClose(tab: CngxTabHandle, event?: Event): void;
|
|
2139
|
+
/** Delete on a focused closable tab requests its close (APG). */
|
|
2140
|
+
handleTabKeydown(tab: CngxTabHandle, event: KeyboardEvent): void;
|
|
2141
|
+
/** Request a new tab via the add button. */
|
|
2142
|
+
handleAdd(): void;
|
|
2143
|
+
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Helper resolving the dismissable/addable affordances for
|
|
2146
|
+
* `<cngx-tab-group>`. \
|
|
2147
|
+
* Keeps the close/add cascade + interaction off the
|
|
2148
|
+
* organism class (LOC guard). \
|
|
2149
|
+
* Each cascade is one `computed()`.
|
|
2150
|
+
* The actual tab removal is the consumer's -
|
|
2151
|
+
* `handleClose` only routes through the presenter's `requestClose`, which
|
|
2152
|
+
* moves the active index, and restores focus once the consumer's removal
|
|
2153
|
+
* has rendered.
|
|
2154
|
+
*
|
|
2155
|
+
* ```ts
|
|
2156
|
+
* // The organism builds it once from field-init; the template reads it.
|
|
2157
|
+
* protected readonly dismiss = createTabDismissals({
|
|
2158
|
+
* host: this.host, // CNGX_TAB_GROUP_HOST
|
|
2159
|
+
* config: this.config, // injectTabsConfig()
|
|
2160
|
+
* i18n: this.i18n, // injectTabsI18n()
|
|
2161
|
+
* closable: this.closable, // input<boolean | undefined>('closable')
|
|
2162
|
+
* addable: this.addable, // input<boolean | undefined>('addable')
|
|
2163
|
+
* hostElement: this.hostElement,
|
|
2164
|
+
* injector: this.injector,
|
|
2165
|
+
* });
|
|
2166
|
+
*
|
|
2167
|
+
* // Per-tab close affordance, read from the header template:
|
|
2168
|
+
* dismiss.isTabClosable(tab); // per-tab override > group resolution
|
|
2169
|
+
* dismiss.closeButtonLabel(tab); // i18n accessible name for the close button
|
|
2170
|
+
* dismiss.handleClose(tab, clickEvent); // routes through presenter.requestClose, restores focus
|
|
2171
|
+
* dismiss.handleTabKeydown(tab, keyEvent); // Delete on a focused closable tab closes it (APG)
|
|
2172
|
+
*
|
|
2173
|
+
* // Group-level add affordance:
|
|
2174
|
+
* dismiss.resolvedAddable(); // input ?? config ?? false
|
|
2175
|
+
* dismiss.handleAdd(); // routes through presenter.requestAdd
|
|
2176
|
+
* ```
|
|
2177
|
+
*
|
|
2178
|
+
* @category common/tabs
|
|
2179
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/dismissals/tab-dismissals.ts
|
|
2180
|
+
* @since 0.1.0
|
|
2181
|
+
* @relatedTo CngxTabGroup, CngxTabCloseIcon, CngxTabAddIcon
|
|
2182
|
+
*/
|
|
2183
|
+
declare function createTabDismissals(opts: CngxTabDismissalsOptions): CngxTabDismissals;
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* Inputs to {@link createTabKeyboardNav}. The organism owns the DOM
|
|
2187
|
+
* handle and the presenter contract; the factory runs the APG tablist
|
|
2188
|
+
* keyboard model so the organism class stays under the LOC guard.
|
|
2189
|
+
* Sibling shape to `createTabDismissals`.
|
|
2190
|
+
*
|
|
2191
|
+
* @category common/tabs
|
|
2192
|
+
*/
|
|
2193
|
+
interface CngxTabKeyboardNavOptions {
|
|
2194
|
+
readonly host: CngxTabGroupHost;
|
|
2195
|
+
readonly hostElement: HTMLElement;
|
|
2196
|
+
}
|
|
2197
|
+
/**
|
|
2198
|
+
* Resolved keyboard surface for `<cngx-tab-group>`'s tablist. The
|
|
2199
|
+
* organism holds this as one field; the template reads `tabTabindex`
|
|
2200
|
+
* for the roving stop and routes the tab buttons' `(keydown)` through
|
|
2201
|
+
* `handleKeydown`.
|
|
2202
|
+
*
|
|
2203
|
+
* @category common/tabs
|
|
2204
|
+
*/
|
|
2205
|
+
interface CngxTabKeyboardNav {
|
|
2206
|
+
/**
|
|
2207
|
+
* Roving `tabindex` for a tab button: `0` for the selected tab, `-1`
|
|
2208
|
+
* for every other. Derived from `host.activeId()` (Pillar 1: a single
|
|
2209
|
+
* source, never a second index to keep in sync) so the active tab is
|
|
2210
|
+
* the group's lone tab stop and `Tab` always lands on it.
|
|
2211
|
+
*/
|
|
2212
|
+
tabTabindex(tab: CngxTabHandle): 0 | -1;
|
|
2213
|
+
/**
|
|
2214
|
+
* APG tablist navigation: arrow keys (axis from orientation), Home,
|
|
2215
|
+
* and End move between tabs with disabled-skip + loop, activate the
|
|
2216
|
+
* target through `host.select()` (automatic activation), and move DOM
|
|
2217
|
+
* focus to it. Returns silently for any other key so the caller can
|
|
2218
|
+
* chain further handlers (e.g. Delete-to-close).
|
|
2219
|
+
*/
|
|
2220
|
+
handleKeydown(event: KeyboardEvent): void;
|
|
2221
|
+
}
|
|
2222
|
+
/**
|
|
2223
|
+
* Level-2 helper implementing the WAI-ARIA APG tabs keyboard model for
|
|
2224
|
+
* `<cngx-tab-group>` with **automatic activation**: an arrow press moves
|
|
2225
|
+
* focus AND activates the target tab in one step, so focus and selection
|
|
2226
|
+
* never diverge. Keeps the keyboard logic off the organism class (LOC
|
|
2227
|
+
* guard) and out of a competing roving-tabindex state machine.
|
|
2228
|
+
*
|
|
2229
|
+
* Pillar 1 (Ableitung statt Verwaltung): the tab stop is derived from the
|
|
2230
|
+
* presenter's `activeId`, not managed as a second index. Pillar 2
|
|
2231
|
+
* (Kommunikation): activation routes through `host.select()`, which owns
|
|
2232
|
+
* disabled-skip, loop, commit gating, and the live-region announcement -
|
|
2233
|
+
* the keyboard layer adds only focus movement (a DOM concern the
|
|
2234
|
+
* presenter, living in `@cngx/common`, must not own).
|
|
2235
|
+
*
|
|
2236
|
+
* Navigation always originates from the active tab: under automatic
|
|
2237
|
+
* activation the focused tab is always the active one, so the clamped
|
|
2238
|
+
* active index is the correct origin.
|
|
2239
|
+
*
|
|
2240
|
+
* @category common/tabs
|
|
2241
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/keyboard/tab-keyboard-nav.ts
|
|
2242
|
+
* @since 0.1.0
|
|
2243
|
+
* @relatedTo CngxTabGroupPresenter, CngxTabGroup, createTabGroupAnnouncements
|
|
2244
|
+
*/
|
|
2245
|
+
declare function createTabKeyboardNav(opts: CngxTabKeyboardNavOptions): CngxTabKeyboardNav;
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
2248
|
+
* Inputs to {@link createTabGroupTemplateBindings}. \
|
|
2249
|
+
* The organism owns the `contentChild()` queries (NG8110 — must run in component
|
|
1168
2250
|
* injection context) and the resolved {@link CngxTabsConfig}; the
|
|
1169
|
-
* factory runs the 3-stage cascade per slot key.
|
|
1170
|
-
*
|
|
2251
|
+
* factory runs the 3-stage cascade per slot key.
|
|
2252
|
+
*
|
|
2253
|
+
* Sibling shape to
|
|
2254
|
+
* - `createStepperTemplateBindings`.
|
|
1171
2255
|
*
|
|
1172
2256
|
* @category common/tabs/slots
|
|
1173
2257
|
*/
|
|
@@ -1175,6 +2259,11 @@ interface CngxTabGroupTemplateBindingsOptions {
|
|
|
1175
2259
|
readonly errorBadgeSlot: Signal<CngxTabErrorBadge | undefined>;
|
|
1176
2260
|
readonly rejectionIconSlot: Signal<CngxTabRejectionIcon | undefined>;
|
|
1177
2261
|
readonly busySpinnerSlot: Signal<CngxTabBusySpinner | undefined>;
|
|
2262
|
+
readonly iconSlot: Signal<CngxTabIcon | undefined>;
|
|
2263
|
+
/** Per-instance `*cngxTabCloseIcon` slot. Optional - close is opt-in. */
|
|
2264
|
+
readonly closeIconSlot?: Signal<CngxTabCloseIcon | undefined>;
|
|
2265
|
+
/** Per-instance `*cngxTabAddIcon` slot. Optional - add is opt-in. */
|
|
2266
|
+
readonly addIconSlot?: Signal<CngxTabAddIcon | undefined>;
|
|
1178
2267
|
readonly config: CngxTabsConfig;
|
|
1179
2268
|
}
|
|
1180
2269
|
/**
|
|
@@ -1188,13 +2277,21 @@ interface CngxTabGroupTemplateBindings {
|
|
|
1188
2277
|
readonly errorBadge: Signal<TemplateRef<CngxTabErrorBadgeContext> | null>;
|
|
1189
2278
|
readonly rejectionIcon: Signal<TemplateRef<CngxTabRejectionIconContext> | null>;
|
|
1190
2279
|
readonly busySpinner: Signal<TemplateRef<CngxTabBusySpinnerContext> | null>;
|
|
2280
|
+
readonly icon: Signal<TemplateRef<CngxTabIconContext> | null>;
|
|
2281
|
+
readonly closeIcon: Signal<TemplateRef<CngxTabCloseIconContext> | null>;
|
|
2282
|
+
readonly addIcon: Signal<TemplateRef<void> | null>;
|
|
1191
2283
|
}
|
|
1192
2284
|
/**
|
|
1193
|
-
* Wires the 3-stage template cascade for the
|
|
1194
|
-
*
|
|
2285
|
+
* Wires the 3-stage template cascade for the `<cngx-tab-group>` skin
|
|
2286
|
+
* slots (errorBadge / rejectionIcon / busySpinner / icon / closeIcon /
|
|
2287
|
+
* addIcon):
|
|
1195
2288
|
* per-instance directive >
|
|
1196
2289
|
* `CNGX_TABS_CONFIG.templates.<key>` >
|
|
1197
|
-
* `null
|
|
2290
|
+
* `null`.
|
|
2291
|
+
*
|
|
2292
|
+
* `null` means the organism renders its built-in default - a default
|
|
2293
|
+
* span for the state decorations, the `CNGX_TABS_GLYPHS` glyph for
|
|
2294
|
+
* `closeIcon` / `addIcon`, and nothing for `icon`.
|
|
1198
2295
|
*
|
|
1199
2296
|
* Pure — no DI, no side effects. Safe in field-init. Sibling to
|
|
1200
2297
|
* `createStepperTemplateBindings` and `createTabOverflowTemplateBindings`.
|
|
@@ -1203,7 +2300,21 @@ interface CngxTabGroupTemplateBindings {
|
|
|
1203
2300
|
* Material owns the rendered tab-button chrome via its own MDC
|
|
1204
2301
|
* template, leaving no DOM seam. See `tabs-accepted-debt §9`.
|
|
1205
2302
|
*
|
|
2303
|
+
* **UX / a11y**
|
|
2304
|
+
* - The cascade is presentation-only; the accessibility contract is
|
|
2305
|
+
* invariant under it. Overriding a slot never strips its accessible
|
|
2306
|
+
* default (fallthrough to a built-in or the organism default).
|
|
2307
|
+
* - The screen-reader channel (descriptor / `aria-busy` / live region)
|
|
2308
|
+
* lives on the organism, not the slot template, so swapping a decoration
|
|
2309
|
+
* template changes only the visual.
|
|
2310
|
+
* - An unbound `icon` slot resolves to nothing, which is correct - the
|
|
2311
|
+
* icon is decorative and the label carries the accessible name.
|
|
2312
|
+
*
|
|
1206
2313
|
* @category common/tabs/slots
|
|
2314
|
+
* @wcag AA
|
|
2315
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-group-template-cascade.ts
|
|
2316
|
+
* @since 0.1.0
|
|
2317
|
+
* @relatedTo CngxTabGroup, CngxTabErrorBadge, CngxTabBusySpinner, CngxTabRejectionIcon
|
|
1207
2318
|
*/
|
|
1208
2319
|
declare function createTabGroupTemplateBindings(opts: CngxTabGroupTemplateBindingsOptions): CngxTabGroupTemplateBindings;
|
|
1209
2320
|
|
|
@@ -1265,11 +2376,13 @@ interface CngxTabGroupAnnouncements {
|
|
|
1265
2376
|
*/
|
|
1266
2377
|
readonly liveAnnouncement: Signal<string>;
|
|
1267
2378
|
/**
|
|
1268
|
-
* SR descriptor phrase for a tab's `cngx-sr-only` span.
|
|
1269
|
-
* `
|
|
1270
|
-
*
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
2379
|
+
* SR descriptor phrase for a tab's `cngx-sr-only` span. Gated on the
|
|
2380
|
+
* folded `tab.hasError()` so a direct `[error]` tab announces without
|
|
2381
|
+
* an aggregator. Resolution: `aggregator.announcement()` →
|
|
2382
|
+
* `tab.errorMessage()` (the direct-channel message) →
|
|
2383
|
+
* `i18n.tabHasErrors(errorCount)`. Empty string when the tab has no
|
|
2384
|
+
* error. The span itself is always rendered (cngx ARIA-by-value
|
|
2385
|
+
* rule); this returns its content.
|
|
1273
2386
|
*/
|
|
1274
2387
|
statusPhrase(tab: CngxTabHandle): string;
|
|
1275
2388
|
/**
|
|
@@ -1287,7 +2400,29 @@ interface CngxTabGroupAnnouncements {
|
|
|
1287
2400
|
* lazy by `linkedSignal` semantics, so the organism reads
|
|
1288
2401
|
* `liveAnnouncement` once at construction to seed it.
|
|
1289
2402
|
*
|
|
2403
|
+
* **UX / a11y**
|
|
2404
|
+
* - The live region is declarative, never imperative: `liveAnnouncement`
|
|
2405
|
+
* is a signal the polite region renders, empty between transitions so
|
|
2406
|
+
* AT stays silent on no-op ticks.
|
|
2407
|
+
* - Direction is spoken on every change: a move carries a previous/next
|
|
2408
|
+
* prefix plus the landing tab; a rollback announces the safe-harbour tab
|
|
2409
|
+
* or a retry, so the outcome is never silent.
|
|
2410
|
+
* - Accessible names carry position ("Tab 2 of 5: Settings") so AT does
|
|
2411
|
+
* not infer it from tablist enumeration.
|
|
2412
|
+
* - Role descriptions stay distinct from the label: the tablist
|
|
2413
|
+
* `aria-roledescription` is separate from the region `aria-label`, so AT
|
|
2414
|
+
* never reads the same word twice.
|
|
2415
|
+
* - `aria-label` and `aria-labelledby` stay mutually exclusive
|
|
2416
|
+
* (`resolvedAriaLabel` returns `null` when labelledby is bound).
|
|
2417
|
+
* - The per-tab descriptor is ARIA-by-value: the `cngx-sr-only` span is
|
|
2418
|
+
* always in the DOM; `statusPhrase` only fills its content, keeping the
|
|
2419
|
+
* `aria-describedby` reference stable.
|
|
2420
|
+
*
|
|
1290
2421
|
* @category common/tabs/announcements
|
|
2422
|
+
* @wcag AA
|
|
2423
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/announcements/tab-group-announcements.ts
|
|
2424
|
+
* @since 0.1.0
|
|
2425
|
+
* @relatedTo CngxTabGroup, CngxLiveRegion, createTabKeyboardNav
|
|
1291
2426
|
*/
|
|
1292
2427
|
declare function createTabGroupAnnouncements(options: CngxTabGroupAnnouncementsOptions): CngxTabGroupAnnouncements;
|
|
1293
2428
|
|
|
@@ -1308,10 +2443,14 @@ declare const CNGX_TABS_GLYPHS: {
|
|
|
1308
2443
|
readonly errorBadge: "!";
|
|
1309
2444
|
/** Default visual for `*cngxTabRejectionIcon` when no override is bound. */
|
|
1310
2445
|
readonly rejectionIcon: "!";
|
|
2446
|
+
/** Default visual for a tab's close button when no override is bound. */
|
|
2447
|
+
readonly closeIcon: "×";
|
|
2448
|
+
/** Default visual for the add-tab button when no override is bound. */
|
|
2449
|
+
readonly addIcon: "+";
|
|
1311
2450
|
};
|
|
1312
2451
|
|
|
1313
2452
|
/**
|
|
1314
|
-
* DOM `id` for a hidden-tab option row in the overflow listbox.
|
|
2453
|
+
* DOM `id` for a hidden-tab option row in the overflow listbox. \
|
|
1315
2454
|
* Stable across CD passes so `aria-activedescendant` resolves to
|
|
1316
2455
|
* the same `<li>`. `-overflow-option` suffix avoids collision with
|
|
1317
2456
|
* the strip-button (`-header`) and per-tab descriptor (`-desc`).
|
|
@@ -1320,8 +2459,8 @@ declare const CNGX_TABS_GLYPHS: {
|
|
|
1320
2459
|
*/
|
|
1321
2460
|
declare function tabOverflowOptionId(tab: CngxTabHandle): string;
|
|
1322
2461
|
/**
|
|
1323
|
-
* Inputs to {@link createTabOverflowTemplateBindings}.
|
|
1324
|
-
* runs the `contentChild()` queries (injection-context-only) and
|
|
2462
|
+
* Inputs to {@link createTabOverflowTemplateBindings}. \
|
|
2463
|
+
* The molecule runs the `contentChild()` queries (injection-context-only) and
|
|
1325
2464
|
* supplies the reactive sources; the factory owns cascade
|
|
1326
2465
|
* resolution and per-context builders.
|
|
1327
2466
|
*
|
|
@@ -1355,12 +2494,13 @@ interface CngxTabOverflowTemplateBindings {
|
|
|
1355
2494
|
readonly buildItemContext: (tab: CngxTabHandle, index: number) => CngxTabOverflowItemContext;
|
|
1356
2495
|
/**
|
|
1357
2496
|
* `ActiveDescendantItem[]` projection of `hiddenTabs()` for
|
|
1358
|
-
* `CngxActiveDescendant.items`.
|
|
2497
|
+
* `CngxActiveDescendant.items`. \
|
|
2498
|
+
* Each entry's `id` matches the
|
|
1359
2499
|
* row's `<li>` (see {@link tabOverflowOptionId}); `value` carries
|
|
1360
2500
|
* the tab handle so AD's `(activated)` payload casts back without
|
|
1361
2501
|
* a registry lookup. Structural equal guards against no-op IO
|
|
1362
|
-
* cascades.
|
|
1363
|
-
* `CngxActiveDescendant.items` declares the input that way; the
|
|
2502
|
+
* cascades. \
|
|
2503
|
+
* Mutable array shape because `CngxActiveDescendant.items` declares the input that way; the
|
|
1364
2504
|
* array is rebuilt each computed run so callers can't mutate the
|
|
1365
2505
|
* live source.
|
|
1366
2506
|
*/
|
|
@@ -1368,9 +2508,9 @@ interface CngxTabOverflowTemplateBindings {
|
|
|
1368
2508
|
}
|
|
1369
2509
|
/**
|
|
1370
2510
|
* Wires the 3-stage template cascade for the overflow molecule's
|
|
1371
|
-
* two visible regions:
|
|
1372
|
-
* `CNGX_TABS_CONFIG.templates.overflow*` > built-in markup
|
|
1373
|
-
* (template-outlet returns `null`).
|
|
2511
|
+
* two visible regions: \
|
|
2512
|
+
* per-instance directive > `CNGX_TABS_CONFIG.templates.overflow*` > built-in markup
|
|
2513
|
+
* (template-outlet returns `null`). \
|
|
1374
2514
|
*
|
|
1375
2515
|
* Pure - no DI, no side effects, no destroy hooks. Safe to call
|
|
1376
2516
|
* from a component's field-init block. Mirrors the select-family
|
|
@@ -1380,16 +2520,28 @@ interface CngxTabOverflowTemplateBindings {
|
|
|
1380
2520
|
*/
|
|
1381
2521
|
declare function createTabOverflowTemplateBindings(opts: CngxTabOverflowTemplateBindingsOptions): CngxTabOverflowTemplateBindings;
|
|
1382
2522
|
/**
|
|
1383
|
-
* Resets the AD highlight on popover close.
|
|
2523
|
+
* Resets the AD highlight on popover close. \
|
|
2524
|
+
* Keyboard-open paths
|
|
1384
2525
|
* (ArrowDown / End / typeahead on the closed trigger) set
|
|
1385
2526
|
* `activeIndex` via AD's own keydown listener before opening -
|
|
1386
2527
|
* unaffected. Mouse-open leaves `activeIndex === -1` so the popover
|
|
1387
|
-
* renders unhighlighted.
|
|
2528
|
+
* renders unhighlighted. \
|
|
2529
|
+
* Without this reset, the next open would
|
|
1388
2530
|
* inherit a stale index from the prior keyboard session.
|
|
1389
2531
|
*
|
|
1390
|
-
* Must run in injection context
|
|
2532
|
+
* **Must run in injection context.**
|
|
2533
|
+
*
|
|
2534
|
+
* ### UX / a11y
|
|
2535
|
+
* - Closing the popover resets the highlight, so a keyboard session never
|
|
2536
|
+
* leaves a stale `aria-activedescendant` for the next open.
|
|
2537
|
+
* - Each row has a stable descendant id (`tabOverflowOptionId`), so the SR
|
|
2538
|
+
* focus reference never dangles across re-renders.
|
|
2539
|
+
* - Highlight is virtual focus, not DOM focus: keyboard nav moves
|
|
2540
|
+
* `aria-activedescendant` while real focus stays on the trigger (APG
|
|
2541
|
+
* menu-button); the rows are never tab stops.
|
|
1391
2542
|
*
|
|
1392
2543
|
* @category common/tabs/overflow
|
|
2544
|
+
* @wcag AA
|
|
1393
2545
|
*/
|
|
1394
2546
|
declare function createOverflowPopoverHighlightSync(popover: Signal<CngxPopover>, ad: Signal<CngxActiveDescendant>): void;
|
|
1395
2547
|
/**
|
|
@@ -1399,12 +2551,13 @@ declare function createOverflowPopoverHighlightSync(popover: Signal<CngxPopover>
|
|
|
1399
2551
|
*/
|
|
1400
2552
|
type CngxOverflowPopoverHighlightSyncFactory = (popover: Signal<CngxPopover>, ad: Signal<CngxActiveDescendant>) => void;
|
|
1401
2553
|
/**
|
|
1402
|
-
* DI token for the overflow popover highlight-sync policy.
|
|
2554
|
+
* DI token for the overflow popover highlight-sync policy. \
|
|
1403
2555
|
* Default {@link createOverflowPopoverHighlightSync}. Override via
|
|
1404
2556
|
* `providers` / `viewProviders` for last-index preservation,
|
|
1405
|
-
* telemetry on close, custom highlight rules.
|
|
1406
|
-
*
|
|
1407
|
-
* `
|
|
2557
|
+
* telemetry on close, custom highlight rules. \
|
|
2558
|
+
* Symmetric to
|
|
2559
|
+
* - `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY` and
|
|
2560
|
+
* - `CNGX_TABS_COMMIT_HANDLER_FACTORY`.
|
|
1408
2561
|
*
|
|
1409
2562
|
* @category common/tabs/overflow
|
|
1410
2563
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/overflow/overflow-template-cascade.ts
|
|
@@ -1436,13 +2589,41 @@ interface CngxOrganismScrollSyncOptions {
|
|
|
1436
2589
|
}
|
|
1437
2590
|
/**
|
|
1438
2591
|
* Scroll-into-view effect for any strip-based organism (tabs,
|
|
1439
|
-
* stepper headers, future scrolling lists).
|
|
1440
|
-
* scrolls the matching `[id="<itemId>-header"]` into view.
|
|
2592
|
+
* stepper headers, future scrolling lists). \
|
|
2593
|
+
* Tracks `activeId` and scrolls the matching `[id="<itemId>-header"]` into view.
|
|
1441
2594
|
*
|
|
1442
|
-
* The DOM call sits in `untracked()` (only `activeId` is tracked).
|
|
2595
|
+
* The DOM call sits in `untracked()` (only `activeId` is tracked). \
|
|
1443
2596
|
* `scrollIntoView` is missing in jsdom - guarded with optional chain.
|
|
1444
2597
|
*
|
|
2598
|
+
* ### UX / a11y
|
|
2599
|
+
* - The active tab is never stranded off-screen: when activation moves to
|
|
2600
|
+
* a tab clipped by overflow (keyboard arrow, deep link, programmatic
|
|
2601
|
+
* select), its header scrolls into view, so the focused and selected
|
|
2602
|
+
* tab is always visible (WCAG 2.4.7 Focus Visible).
|
|
2603
|
+
* - Pairs with the overflow surface: picking a hidden tab from the "More"
|
|
2604
|
+
* popover scrolls it back into the strip, and the overflow recompute
|
|
2605
|
+
* then self-trims - keyboard navigation and the overflow list stay in
|
|
2606
|
+
* sync.
|
|
2607
|
+
* - Motion is overridable for reduced motion: the default is smooth-center
|
|
2608
|
+
* along the inline axis; pass `scrollOptions` (e.g. `behavior: 'auto'`)
|
|
2609
|
+
* to honour `prefers-reduced-motion` or to scroll vertically.
|
|
2610
|
+
*
|
|
2611
|
+
* ```ts
|
|
2612
|
+
* // Install once from the organism's field-init (needs an injection context).
|
|
2613
|
+
* createOrganismScrollSync({
|
|
2614
|
+
* activeId: this.presenter.activeId, // Signal<string | null>
|
|
2615
|
+
* hostElement: this.hostElement, // holds the [id="<tabId>-header"] buttons
|
|
2616
|
+
* injector: this.injector,
|
|
2617
|
+
* // scrollOptions omitted -> smooth-center; override for reduced motion:
|
|
2618
|
+
* // scrollOptions: { behavior: 'auto' },
|
|
2619
|
+
* });
|
|
2620
|
+
* ```
|
|
2621
|
+
*
|
|
1445
2622
|
* @category common/tabs/scroll-sync
|
|
2623
|
+
* @wcag AA
|
|
2624
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/scroll-sync/organism-scroll-sync.ts
|
|
2625
|
+
* @since 0.1.0
|
|
2626
|
+
* @relatedTo CngxTabGroup, CngxTabOverflow, CNGX_ORGANISM_SCROLL_SYNC_FACTORY
|
|
1446
2627
|
*/
|
|
1447
2628
|
declare function createOrganismScrollSync(opts: CngxOrganismScrollSyncOptions): void;
|
|
1448
2629
|
/**
|
|
@@ -1452,15 +2633,37 @@ declare function createOrganismScrollSync(opts: CngxOrganismScrollSyncOptions):
|
|
|
1452
2633
|
*/
|
|
1453
2634
|
type CngxOrganismScrollSyncFactory = (opts: CngxOrganismScrollSyncOptions) => void;
|
|
1454
2635
|
/**
|
|
1455
|
-
* DI token for the active-item scroll-into-view policy.
|
|
1456
|
-
* {@link createOrganismScrollSync}
|
|
1457
|
-
*
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
2636
|
+
* DI token for the active-item scroll-into-view policy. \
|
|
2637
|
+
* The default, {@link createOrganismScrollSync}, scrolls the active tab's header into
|
|
2638
|
+
* view on every `activeId` change. \
|
|
2639
|
+
* Override the whole policy to swap the
|
|
2640
|
+
* scroll behaviour, target a different selector, add telemetry, opt out
|
|
2641
|
+
* of motion, or disable it entirely.
|
|
2642
|
+
*
|
|
2643
|
+
* Provided in root with the default factory, so consumers override only
|
|
2644
|
+
* when they need to. \
|
|
2645
|
+
*
|
|
2646
|
+
* Sibling to
|
|
2647
|
+
* - `CNGX_DOM_ANCHOR_RETRY_FACTORY` and
|
|
2648
|
+
* - `CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY`.
|
|
2649
|
+
*
|
|
2650
|
+
* ```ts
|
|
2651
|
+
* // Honour prefers-reduced-motion app-wide:
|
|
2652
|
+
* providers: [
|
|
2653
|
+
* {
|
|
2654
|
+
* provide: CNGX_ORGANISM_SCROLL_SYNC_FACTORY,
|
|
2655
|
+
* useValue: (opts) =>
|
|
2656
|
+
* createOrganismScrollSync({ ...opts, scrollOptions: { behavior: 'auto' } }),
|
|
2657
|
+
* },
|
|
2658
|
+
* ];
|
|
2659
|
+
* // Or disable scroll-into-view entirely: useValue: () => {}
|
|
2660
|
+
* ```
|
|
1460
2661
|
*
|
|
1461
2662
|
* @category common/tabs/scroll-sync
|
|
2663
|
+
* @wcag AA
|
|
1462
2664
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/scroll-sync/organism-scroll-sync.ts
|
|
1463
2665
|
* @since 0.1.0
|
|
2666
|
+
* @relatedTo createOrganismScrollSync, CngxOrganismScrollSyncFactory
|
|
1464
2667
|
*/
|
|
1465
2668
|
declare const CNGX_ORGANISM_SCROLL_SYNC_FACTORY: InjectionToken<CngxOrganismScrollSyncFactory>;
|
|
1466
2669
|
|
|
@@ -1495,11 +2698,12 @@ type CngxDirectiveByIdMapFactory = <T extends {
|
|
|
1495
2698
|
id: () => string;
|
|
1496
2699
|
}>(opts: CngxDirectiveByIdMapOptions<T>) => Signal<Map<string, T>>;
|
|
1497
2700
|
/**
|
|
1498
|
-
* DI token for the per-id directive-resolution policy.
|
|
1499
|
-
* {@link createDirectiveByIdMap}. Override for WeakMap resolution,
|
|
1500
|
-
* telemetry, or custom equality.
|
|
1501
|
-
*
|
|
1502
|
-
* `
|
|
2701
|
+
* DI token for the per-id directive-resolution policy. \
|
|
2702
|
+
* Defaults to {@link createDirectiveByIdMap}. Override for WeakMap resolution,
|
|
2703
|
+
* telemetry, or custom equality. \
|
|
2704
|
+
* Sibling to
|
|
2705
|
+
* - `CNGX_DOM_ANCHOR_RETRY_FACTORY` and
|
|
2706
|
+
* - `CNGX_ORGANISM_SCROLL_SYNC_FACTORY`.
|
|
1503
2707
|
*
|
|
1504
2708
|
* @category common/tabs/registry
|
|
1505
2709
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/registry/directive-by-id-map.ts
|
|
@@ -1507,5 +2711,5 @@ type CngxDirectiveByIdMapFactory = <T extends {
|
|
|
1507
2711
|
*/
|
|
1508
2712
|
declare const CNGX_DIRECTIVE_BY_ID_MAP_FACTORY: InjectionToken<CngxDirectiveByIdMapFactory>;
|
|
1509
2713
|
|
|
1510
|
-
export { CNGX_DIRECTIVE_BY_ID_MAP_FACTORY, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_ORGANISM_SCROLL_SYNC_FACTORY, CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY, CNGX_TABS_COMMIT_HANDLER_FACTORY, CNGX_TABS_CONFIG, CNGX_TABS_GLYPHS, CNGX_TABS_I18N, CNGX_TAB_GROUP_HOST, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTab, CngxTabBusySpinner, CngxTabContent, CngxTabErrorBadge, CngxTabGroupPresenter, CngxTabLabel, CngxTabOverflowItem, CngxTabOverflowTrigger, CngxTabRejectionIcon, CngxTabsFragmentSync, createCngxTabOverflowDefaultDomAdapter, createDirectiveByIdMap, createDomAnchorRetry, createOrganismScrollSync, createOverflowPopoverHighlightSync, createTabGroupAnnouncements, createTabGroupTemplateBindings, createTabOverflowTemplateBindings, createTabsCommitHandler, injectTabsConfig, injectTabsI18n, provideCngxTabs, provideCngxTabsAt, provideTabsConfig, provideTabsConfigAt, provideTabsI18n, tabOverflowOptionId, withDefaultOrientation, withTabBusySpinnerTemplate, withTabErrorBadgeTemplate, withTabOverflowItemTemplate, withTabOverflowMaxDeferMs, withTabOverflowStabilizeMs, withTabOverflowTriggerTemplate, withTabRejectionIconTemplate, withTabsAriaLabels, withTabsCommitMode, withTabsDefaultOrientation, withTabsFallbackLabels, withTabsI18nLabels, withTabsRouterSync, withTabsRovingLoop };
|
|
1511
|
-
export type { CngxDirectiveByIdMapFactory, CngxDirectiveByIdMapOptions, CngxDomAnchorRetryFactory, CngxDomAnchorRetryHandle, CngxDomAnchorRetryOptions, CngxDomAnchorRetryResult, CngxOrganismScrollSyncFactory, CngxOrganismScrollSyncOptions, CngxOverflowPopoverHighlightSyncFactory, CngxTabBusySpinnerContext, CngxTabErrorBadgeContext, CngxTabGroupAnnouncements, CngxTabGroupAnnouncementsOptions, CngxTabGroupHost, CngxTabGroupTemplateBindings, CngxTabGroupTemplateBindingsOptions, CngxTabHandle, CngxTabOverflowDomAdapter, CngxTabOverflowDomAdapterFactory, CngxTabOverflowItemContext, CngxTabOverflowTemplateBindings, CngxTabOverflowTemplateBindingsOptions, CngxTabOverflowTriggerContext, CngxTabPanelHost, CngxTabRejectionIconContext, CngxTabsAriaLabels, CngxTabsCommitAction, CngxTabsCommitHandler, CngxTabsCommitHandlerFactory, CngxTabsCommitHandlerOptions, CngxTabsConfig, CngxTabsConfigFeature, CngxTabsFallbackLabels, CngxTabsFeature, CngxTabsI18n, CngxTabsI18nFeature, CngxTabsTemplates };
|
|
2714
|
+
export { CNGX_DIRECTIVE_BY_ID_MAP_FACTORY, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_ORGANISM_SCROLL_SYNC_FACTORY, CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY, CNGX_TABS_COMMIT_ACTION, CNGX_TABS_COMMIT_HANDLER_FACTORY, CNGX_TABS_CONFIG, CNGX_TABS_GLYPHS, CNGX_TABS_I18N, CNGX_TAB_GROUP_HOST, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTab, CngxTabAddIcon, CngxTabBusySpinner, CngxTabCloseIcon, CngxTabContent, CngxTabErrorBadge, CngxTabGroupPresenter, CngxTabIcon, CngxTabLabel, CngxTabLink, CngxTabOverflowItem, CngxTabOverflowTrigger, CngxTabRejectionIcon, CngxTabSubLabel, CngxTabsFragmentSync, CngxTabsRouteSync, createCngxTabOverflowDefaultDomAdapter, createDirectiveByIdMap, createDomAnchorRetry, createOrganismScrollSync, createOverflowPopoverHighlightSync, createTabDismissals, createTabGroupAnnouncements, createTabGroupTemplateBindings, createTabKeyboardNav, createTabOverflowTemplateBindings, createTabRouterCommit, createTabsCommitHandler, createTabsHostAttrs, injectTabsConfig, injectTabsI18n, provideCngxTabs, provideCngxTabsAt, provideTabsConfig, provideTabsConfigAt, provideTabsI18n, tabOverflowOptionId, withDefaultOrientation, withTabAddIconTemplate, withTabBusySpinnerTemplate, withTabCloseIconTemplate, withTabErrorBadgeTemplate, withTabIconTemplate, withTabOverflowItemTemplate, withTabOverflowMaxDeferMs, withTabOverflowStabilizeMs, withTabOverflowTriggerTemplate, withTabRejectionIconTemplate, withTabsAddable, withTabsAlign, withTabsAriaLabels, withTabsClosable, withTabsCommitMode, withTabsDefaultOrientation, withTabsFallbackLabels, withTabsFitted, withTabsFragmentSync, withTabsI18nLabels, withTabsIconLayout, withTabsPanelMode, withTabsRouterSync, withTabsRovingLoop, withTabsSkin };
|
|
2715
|
+
export type { CngxDirectiveByIdMapFactory, CngxDirectiveByIdMapOptions, CngxDomAnchorRetryFactory, CngxDomAnchorRetryHandle, CngxDomAnchorRetryOptions, CngxDomAnchorRetryResult, CngxOrganismScrollSyncFactory, CngxOrganismScrollSyncOptions, CngxOverflowPopoverHighlightSyncFactory, CngxTabAlign, CngxTabBusySpinnerContext, CngxTabCloseEvent, CngxTabCloseIconContext, CngxTabDismissals, CngxTabDismissalsOptions, CngxTabErrorBadgeContext, CngxTabGroupAnnouncements, CngxTabGroupAnnouncementsOptions, CngxTabGroupHost, CngxTabGroupTemplateBindings, CngxTabGroupTemplateBindingsOptions, CngxTabHandle, CngxTabIconContext, CngxTabIconLayout, CngxTabKeyboardNav, CngxTabKeyboardNavOptions, CngxTabOverflowDomAdapter, CngxTabOverflowDomAdapterFactory, CngxTabOverflowItemContext, CngxTabOverflowTemplateBindings, CngxTabOverflowTemplateBindingsOptions, CngxTabOverflowTriggerContext, CngxTabPanelHost, CngxTabRejectionIconContext, CngxTabRouterCommitOptions, CngxTabsAriaLabels, CngxTabsCommitAction, CngxTabsCommitActionSource, CngxTabsCommitHandler, CngxTabsCommitHandlerFactory, CngxTabsCommitHandlerOptions, CngxTabsConfig, CngxTabsConfigFeature, CngxTabsFallbackLabels, CngxTabsFeature, CngxTabsHostAttrs, CngxTabsHostAttrsInputs, CngxTabsI18n, CngxTabsI18nFeature, CngxTabsPanelMode, CngxTabsSkin, CngxTabsTemplates };
|