@cngx/common 0.1.0-rc.1 → 0.1.0-rc.3
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/data/README.md +10 -3
- package/fesm2022/cngx-common-data.mjs +379 -57
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +318 -5
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +532 -151
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/package.json +2 -2
- package/stepper/README.md +0 -13
- package/types/cngx-common-data.d.ts +446 -41
- package/types/cngx-common-stepper.d.ts +350 -6
- package/types/cngx-common-tabs.d.ts +586 -191
- package/tabs/README.md +0 -32
|
@@ -141,8 +141,8 @@ interface CngxTabGroupHost {
|
|
|
141
141
|
clearLastFailed(): void;
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
|
-
* DI token for the tab presenter's contract.
|
|
145
|
-
* `useExisting`; `CngxTab` injects to register; the organism injects
|
|
144
|
+
* DI token for the tab presenter's contract. \
|
|
145
|
+
* Presenter provides via `useExisting`; `CngxTab` injects to register; the organism injects
|
|
146
146
|
* to drive the APG tablist keyboard model (automatic activation via
|
|
147
147
|
* `select()`, roving stop derived from `activeId`) through
|
|
148
148
|
* `createTabKeyboardNav`.
|
|
@@ -155,24 +155,24 @@ interface CngxTabGroupHost {
|
|
|
155
155
|
declare const CNGX_TAB_GROUP_HOST: InjectionToken<CngxTabGroupHost>;
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* Async-commit action shape for tab transitions.
|
|
159
|
-
* and target indices; resolves `true` to commit, `false` to refuse.
|
|
160
|
-
* `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
|
|
161
161
|
* commit-action family.
|
|
162
162
|
*
|
|
163
163
|
* @category common/tabs
|
|
164
164
|
*/
|
|
165
165
|
type CngxTabsCommitAction = (fromIndex: number, toIndex: number) => boolean | Promise<boolean> | Observable<boolean>;
|
|
166
166
|
/**
|
|
167
|
-
* Tab-group presenter - brain of every
|
|
168
|
-
* active-index model, the tab registry, orientation, loop policy,
|
|
169
|
-
* and the commit-controller lifecycle.
|
|
170
|
-
* {@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}
|
|
171
171
|
* so `<cngx-toast-on />` / `<cngx-banner-on />` compose without
|
|
172
172
|
* `[state]` wiring.
|
|
173
173
|
*
|
|
174
|
-
* **Layer:** `@cngx/common/tabs
|
|
175
|
-
* organisms compose via `hostDirectives`, consumers attach
|
|
174
|
+
* **Layer:** `@cngx/common/tabs`. \
|
|
175
|
+
* Directive-only - organisms compose via `hostDirectives`, consumers attach
|
|
176
176
|
* `[cngxTabGroup]` directly.
|
|
177
177
|
*
|
|
178
178
|
* @category common/tabs
|
|
@@ -188,8 +188,8 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
188
188
|
readonly orientation: i0.InputSignal<"horizontal" | "vertical">;
|
|
189
189
|
readonly loop: i0.InputSignal<boolean>;
|
|
190
190
|
/**
|
|
191
|
-
* Async-commit action gating the transition.
|
|
192
|
-
* `select(...)` routes through {@link CngxTabsCommitHandler}; the
|
|
191
|
+
* Async-commit action gating the transition.
|
|
192
|
+
* When non-null, `select(...)` routes through {@link CngxTabsCommitHandler}; the
|
|
193
193
|
* action's resolution decides whether the change lands. Supersede
|
|
194
194
|
* semantics come from the commit-controller - a rapid second
|
|
195
195
|
* `select(...)` cancels the in-flight runner.
|
|
@@ -283,8 +283,8 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
283
283
|
|
|
284
284
|
/**
|
|
285
285
|
* Read-mostly panel-surface contract for the overflow molecule, skin
|
|
286
|
-
* sub-components, and future panel-level helpers.
|
|
287
|
-
* {@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.
|
|
288
288
|
*
|
|
289
289
|
* The single write path is `selectById`; routing back through the
|
|
290
290
|
* presenter preserves clamping, disabled-skip, and commit-action
|
|
@@ -305,8 +305,8 @@ interface CngxTabPanelHost {
|
|
|
305
305
|
contentTemplateFor(id: string): TemplateRef<unknown> | null;
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
|
-
* DI token the organism provides via `useExisting
|
|
309
|
-
* 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
|
|
310
310
|
* instead of the concrete component class.
|
|
311
311
|
*
|
|
312
312
|
* @category common/tabs
|
|
@@ -317,13 +317,12 @@ interface CngxTabPanelHost {
|
|
|
317
317
|
declare const CNGX_TAB_PANEL_HOST: InjectionToken<CngxTabPanelHost>;
|
|
318
318
|
|
|
319
319
|
/**
|
|
320
|
-
* Structural slot directive marking the per-tab panel-body template.
|
|
320
|
+
* Structural slot directive marking the per-tab panel-body template. \
|
|
321
321
|
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
322
322
|
* `CngxTab` and projected into the matching `role="tabpanel"`.
|
|
323
323
|
*
|
|
324
324
|
* ```html
|
|
325
|
-
* <div cngxTab
|
|
326
|
-
* <ng-template cngxTabLabel>Settings</ng-template>
|
|
325
|
+
* <div cngxTab [label]="'Settings'">
|
|
327
326
|
* <ng-template cngxTabContent>
|
|
328
327
|
* <p>Settings panel body…</p>
|
|
329
328
|
* </ng-template>
|
|
@@ -335,14 +334,6 @@ declare const CNGX_TAB_PANEL_HOST: InjectionToken<CngxTabPanelHost>;
|
|
|
335
334
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-content.directive.ts
|
|
336
335
|
* @since 0.1.0
|
|
337
336
|
* @relatedTo CngxTab, CngxTabLabel
|
|
338
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
339
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
|
|
340
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
341
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
342
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
343
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
344
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
345
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
346
337
|
*/
|
|
347
338
|
declare class CngxTabContent {
|
|
348
339
|
readonly templateRef: TemplateRef<any>;
|
|
@@ -351,14 +342,14 @@ declare class CngxTabContent {
|
|
|
351
342
|
}
|
|
352
343
|
|
|
353
344
|
/**
|
|
354
|
-
* Structural slot directive marking the per-tab label template.
|
|
345
|
+
* Structural slot directive marking the per-tab label template. \
|
|
355
346
|
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
356
347
|
* `CngxTab` and projected into the tab strip.
|
|
357
348
|
*
|
|
358
349
|
* ```html
|
|
359
350
|
* <div cngxTab id="settings">
|
|
360
351
|
* <ng-template cngxTabLabel>Settings</ng-template>
|
|
361
|
-
*
|
|
352
|
+
* ... tab content ...
|
|
362
353
|
* </div>
|
|
363
354
|
* ```
|
|
364
355
|
*
|
|
@@ -367,8 +358,6 @@ declare class CngxTabContent {
|
|
|
367
358
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-label.directive.ts
|
|
368
359
|
* @since 0.1.0
|
|
369
360
|
* @relatedTo CngxTab, CngxTabContent
|
|
370
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
371
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
372
361
|
*/
|
|
373
362
|
declare class CngxTabLabel {
|
|
374
363
|
readonly templateRef: TemplateRef<any>;
|
|
@@ -377,10 +366,12 @@ declare class CngxTabLabel {
|
|
|
377
366
|
}
|
|
378
367
|
|
|
379
368
|
/**
|
|
380
|
-
* Structural slot directive marking a tab's secondary label template.
|
|
369
|
+
* Structural slot directive marking a tab's secondary label template. \
|
|
381
370
|
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
382
371
|
* `CngxTab` and rendered as a stacked second line under the primary
|
|
383
|
-
* label.
|
|
372
|
+
* label. \
|
|
373
|
+
*
|
|
374
|
+
* Per-tab content, mirroring `CngxTabLabel` - the convenience
|
|
384
375
|
* `[subLabel]` string input on `CngxTab` covers the plain-text case.
|
|
385
376
|
*
|
|
386
377
|
* ```html
|
|
@@ -391,7 +382,7 @@ declare class CngxTabLabel {
|
|
|
391
382
|
* </div>
|
|
392
383
|
* ```
|
|
393
384
|
*
|
|
394
|
-
* @category common/tabs
|
|
385
|
+
* @category common/tabs/slots
|
|
395
386
|
* @wcag AA
|
|
396
387
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-sub-label.directive.ts
|
|
397
388
|
* @since 0.1.0
|
|
@@ -399,33 +390,37 @@ declare class CngxTabLabel {
|
|
|
399
390
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-sub-label/label-with-count</example-url>
|
|
400
391
|
*/
|
|
401
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
|
+
*/
|
|
402
397
|
readonly templateRef: TemplateRef<any>;
|
|
403
398
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabSubLabel, never>;
|
|
404
399
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabSubLabel, "ng-template[cngxTabSubLabel]", ["cngxTabSubLabel"], {}, {}, never, never, true, never>;
|
|
405
400
|
}
|
|
406
401
|
|
|
407
402
|
/**
|
|
408
|
-
* Single-tab atom.
|
|
403
|
+
* Single-tab atom. \
|
|
404
|
+
* Registers with the enclosing presenter via
|
|
409
405
|
* {@link CNGX_TAB_GROUP_HOST} on construction; deregisters via
|
|
410
|
-
* {@link DestroyRef} on teardown.
|
|
406
|
+
* {@link DestroyRef} on teardown. \
|
|
407
|
+
* The presenter holds the atom's
|
|
411
408
|
* input signals by reference, so input changes propagate without
|
|
412
|
-
* re-registration.
|
|
409
|
+
* re-registration. \
|
|
410
|
+
* `labelTemplate` / `contentTemplate` are projected
|
|
413
411
|
* by the organism - the atom carries no rendering logic.
|
|
414
412
|
*
|
|
413
|
+
* ```html
|
|
414
|
+
* <div cngxTab [label]="'Settings'">
|
|
415
|
+
* ... content templates here ...
|
|
416
|
+
* </div>
|
|
417
|
+
* ```
|
|
415
418
|
* @category common/tabs
|
|
416
419
|
* @docsKind primary
|
|
417
420
|
* @wcag AA
|
|
418
421
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab.directive.ts
|
|
419
422
|
* @since 0.1.0
|
|
420
423
|
* @relatedTo CngxTabGroupPresenter, CngxTabLabel, CngxTabContent, CngxTabErrorBadge
|
|
421
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
422
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
|
|
423
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
424
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-group/three-tab-navigation</example-url>
|
|
425
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-overflow/8-tabs-in-a-narrow-container</example-url>
|
|
426
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
427
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
428
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
429
424
|
*/
|
|
430
425
|
declare class CngxTab implements OnInit {
|
|
431
426
|
readonly id: i0.InputSignal<string>;
|
|
@@ -486,16 +481,122 @@ declare class CngxTab implements OnInit {
|
|
|
486
481
|
}
|
|
487
482
|
|
|
488
483
|
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
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>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* URL deep-linking for tab groups. \
|
|
577
|
+
* Bidirectional sync between `activeId` and a URL fragment or query-param. Opt-in via
|
|
491
578
|
* `[cngxTabsFragmentSync]` on the presenter element.
|
|
492
579
|
*
|
|
493
580
|
* - `mode = 'fragment'` (default) → `#tab=settings`
|
|
494
581
|
* - `mode = 'queryParam'` with `paramName = 'tab'` → `?tab=settings`
|
|
495
582
|
*
|
|
496
583
|
* `Router` is optional - without it the directive logs a dev warning
|
|
497
|
-
* via `afterNextRender` and becomes a no-op.
|
|
498
|
-
* 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
|
+
* ```
|
|
499
600
|
*
|
|
500
601
|
* @category common/tabs
|
|
501
602
|
* @docsKind primary
|
|
@@ -517,10 +618,12 @@ declare class CngxTabsFragmentSync {
|
|
|
517
618
|
}
|
|
518
619
|
|
|
519
620
|
/**
|
|
520
|
-
* Source supplied through {@link CNGX_TABS_COMMIT_ACTION}.
|
|
521
|
-
* directive (e.g. `[cngxTabsRouteSync]`) provides one so the presenter
|
|
621
|
+
* Source supplied through {@link CNGX_TABS_COMMIT_ACTION}. \
|
|
622
|
+
* A sync directive (e.g. `[cngxTabsRouteSync]`) provides one so the presenter
|
|
522
623
|
* picks up a commit-action without the consumer hand-binding
|
|
523
|
-
* `[commitAction]`.
|
|
624
|
+
* `[commitAction]`.
|
|
625
|
+
*
|
|
626
|
+
* Carries `mode` alongside `action` so the routed
|
|
524
627
|
* path can pin pessimistic - the active tab must follow the *resolved*
|
|
525
628
|
* route, and a stray `[commitMode]="'optimistic'"` must not override
|
|
526
629
|
* that invariant.
|
|
@@ -528,7 +631,18 @@ declare class CngxTabsFragmentSync {
|
|
|
528
631
|
* @category common/tabs
|
|
529
632
|
*/
|
|
530
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
|
+
*/
|
|
531
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
|
+
*/
|
|
532
646
|
readonly mode: Signal<'optimistic' | 'pessimistic'>;
|
|
533
647
|
}
|
|
534
648
|
/**
|
|
@@ -545,8 +659,8 @@ interface CngxTabsCommitActionSource {
|
|
|
545
659
|
declare const CNGX_TABS_COMMIT_ACTION: InjectionToken<CngxTabsCommitActionSource>;
|
|
546
660
|
|
|
547
661
|
/**
|
|
548
|
-
* Router-outlet integration for tab groups.
|
|
549
|
-
* `[cngxTabsRouteSync]` on the presenter element. Each tab is an
|
|
662
|
+
* Router-outlet integration for tab groups. \
|
|
663
|
+
* Opt-in via `[cngxTabsRouteSync]` on the presenter element. Each tab is an
|
|
550
664
|
* Angular child route whose component renders into a `<router-outlet>`;
|
|
551
665
|
* switching tabs navigates, and a `CanDeactivate` guard can gate the
|
|
552
666
|
* leave.
|
|
@@ -568,12 +682,69 @@ declare const CNGX_TABS_COMMIT_ACTION: InjectionToken<CngxTabsCommitActionSource
|
|
|
568
682
|
* no-op. Mirrors {@link CngxTabsFragmentSync}; every `activeIndex`
|
|
569
683
|
* write inside an effect sits in `untracked()`.
|
|
570
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
|
+
*
|
|
571
742
|
* @category common/tabs
|
|
572
743
|
* @docsKind primary
|
|
573
744
|
* @wcag AA
|
|
574
745
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/route-sync.directive.ts
|
|
575
746
|
* @since 0.1.0
|
|
576
|
-
* @relatedTo CngxTabGroupPresenter, CngxTabsFragmentSync, createTabRouterCommit
|
|
747
|
+
* @relatedTo CngxTabGroupPresenter, CngxTabsFragmentSync, createTabRouterCommit, CngxTabNav, CngxTabLink
|
|
577
748
|
*/
|
|
578
749
|
declare class CngxTabsRouteSync implements CngxTabsCommitActionSource {
|
|
579
750
|
/**
|
|
@@ -650,8 +821,8 @@ interface CngxTabRouterCommitOptions {
|
|
|
650
821
|
* - `NavigationError` (guard/resolver threw) → `false`
|
|
651
822
|
*
|
|
652
823
|
* Routed tabs reuse the presenter's commit lifecycle verbatim - the
|
|
653
|
-
* router navigation is simply the async op.
|
|
654
|
-
* active tab follows the *resolved* route, so a cancelled guard keeps
|
|
824
|
+
* router navigation is simply the async op. \
|
|
825
|
+
* In pessimistic mode the active tab follows the *resolved* route, so a cancelled guard keeps
|
|
655
826
|
* the old tab with zero extra gate machinery. The events subscription
|
|
656
827
|
* is opened *before* `navigate(...)` so a synchronously-resolving
|
|
657
828
|
* navigation cannot emit before the action is listening; the commit
|
|
@@ -790,8 +961,6 @@ interface CngxTabBusySpinnerContext {
|
|
|
790
961
|
* @since 0.1.0
|
|
791
962
|
* @relatedTo CngxTabErrorBadge, CngxTabRejectionIcon, CngxTab
|
|
792
963
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
793
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
794
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
795
964
|
*/
|
|
796
965
|
declare class CngxTabBusySpinner {
|
|
797
966
|
readonly templateRef: TemplateRef<CngxTabBusySpinnerContext>;
|
|
@@ -828,6 +997,7 @@ interface CngxTabCloseIconContext {
|
|
|
828
997
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-close-icon.directive.ts
|
|
829
998
|
* @since 0.1.0
|
|
830
999
|
* @relatedTo CngxTabAddIcon, CngxTabGroup
|
|
1000
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-dismissable/dismissable-and-addable</example-url>
|
|
831
1001
|
*/
|
|
832
1002
|
declare class CngxTabCloseIcon {
|
|
833
1003
|
readonly templateRef: TemplateRef<CngxTabCloseIconContext>;
|
|
@@ -867,9 +1037,7 @@ interface CngxTabErrorBadgeContext {
|
|
|
867
1037
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-error-badge.directive.ts
|
|
868
1038
|
* @since 0.1.0
|
|
869
1039
|
* @relatedTo CngxTabRejectionIcon, CngxTabBusySpinner, CngxTab
|
|
870
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
871
1040
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
872
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
873
1041
|
*/
|
|
874
1042
|
declare class CngxTabErrorBadge {
|
|
875
1043
|
readonly templateRef: TemplateRef<CngxTabErrorBadgeContext>;
|
|
@@ -878,11 +1046,13 @@ declare class CngxTabErrorBadge {
|
|
|
878
1046
|
}
|
|
879
1047
|
|
|
880
1048
|
/**
|
|
881
|
-
* Context for the `*cngxTabIcon` template.
|
|
882
|
-
* header, ahead of the label.
|
|
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
|
|
883
1052
|
* per-tab signals a consumer icon usually keys off - whether the tab is
|
|
884
|
-
* the active one and its positional index.
|
|
885
|
-
*
|
|
1053
|
+
* the active one and its positional index.
|
|
1054
|
+
*
|
|
1055
|
+
* Richer than {@link CngxTabErrorBadgeContext} (which only needs `tab`) because an
|
|
886
1056
|
* icon commonly swaps glyph on the active tab.
|
|
887
1057
|
*
|
|
888
1058
|
* @category common/tabs/slots
|
|
@@ -896,17 +1066,15 @@ interface CngxTabIconContext {
|
|
|
896
1066
|
readonly index: number;
|
|
897
1067
|
}
|
|
898
1068
|
/**
|
|
899
|
-
* Structural slot for the tab-icon template.
|
|
900
|
-
* per-tab context (stepper-slot parity), not a per-`CngxTab` input
|
|
901
|
-
* 3-stage cascade:
|
|
902
|
-
* `CNGX_TABS_CONFIG.templates.icon` > none (no icon rendered).
|
|
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).
|
|
903
1073
|
*
|
|
904
1074
|
* ```html
|
|
905
|
-
* <
|
|
906
|
-
* <
|
|
907
|
-
*
|
|
908
|
-
* </ng-template>
|
|
909
|
-
* </cngx-tab-group>
|
|
1075
|
+
* <ng-template cngxTabIcon let-active="active">
|
|
1076
|
+
* <cngx-icon [name]="active ? 'folder-open' : 'folder'" />
|
|
1077
|
+
* </ng-template>
|
|
910
1078
|
* ```
|
|
911
1079
|
*
|
|
912
1080
|
* @category common/tabs/slots
|
|
@@ -914,6 +1082,11 @@ interface CngxTabIconContext {
|
|
|
914
1082
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-icon.directive.ts
|
|
915
1083
|
* @since 0.1.0
|
|
916
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>
|
|
917
1090
|
*/
|
|
918
1091
|
declare class CngxTabIcon {
|
|
919
1092
|
readonly templateRef: TemplateRef<CngxTabIconContext>;
|
|
@@ -963,8 +1136,6 @@ interface CngxTabRejectionIconContext {
|
|
|
963
1136
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-rejection-icon.directive.ts
|
|
964
1137
|
* @since 0.1.0
|
|
965
1138
|
* @relatedTo CngxTabErrorBadge, CngxTabBusySpinner, CngxTab
|
|
966
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-busy-spinner-via-code-cngxtabbusyspinner-code</example-url>
|
|
967
|
-
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/custom-error-badge-via-code-cngxtaberrorbadge-code</example-url>
|
|
968
1139
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-slot-overrides/rejection-decoration-via-code-cngxtabrejectionicon-code</example-url>
|
|
969
1140
|
*/
|
|
970
1141
|
declare class CngxTabRejectionIcon {
|
|
@@ -974,8 +1145,8 @@ declare class CngxTabRejectionIcon {
|
|
|
974
1145
|
}
|
|
975
1146
|
|
|
976
1147
|
/**
|
|
977
|
-
* Aria-label overrides for the tab-group landmark region.
|
|
978
|
-
* defaults are English; consumers override via
|
|
1148
|
+
* Aria-label overrides for the tab-group landmark region. \
|
|
1149
|
+
* Library defaults are English; consumers override via
|
|
979
1150
|
* {@link withTabsAriaLabels}.
|
|
980
1151
|
*
|
|
981
1152
|
* Per-tab nav phrasing (`previousTab`, `nextTab`) lives in
|
|
@@ -985,6 +1156,12 @@ declare class CngxTabRejectionIcon {
|
|
|
985
1156
|
* @category common/tabs
|
|
986
1157
|
*/
|
|
987
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
|
+
*/
|
|
988
1165
|
readonly tabsRegion?: string;
|
|
989
1166
|
}
|
|
990
1167
|
/**
|
|
@@ -995,13 +1172,22 @@ interface CngxTabsAriaLabels {
|
|
|
995
1172
|
* @category common/tabs
|
|
996
1173
|
*/
|
|
997
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
|
+
*/
|
|
998
1180
|
readonly tabRoleDescription?: string;
|
|
1181
|
+
/**
|
|
1182
|
+
* `aria-roledescription` for each tab panel. Default `'tab panel'`.
|
|
1183
|
+
*/
|
|
999
1184
|
readonly tabPanelRoleDescription?: string;
|
|
1000
1185
|
}
|
|
1001
1186
|
/**
|
|
1002
1187
|
* App-wide template overrides for `<cngx-tab-group>` and
|
|
1003
|
-
* `<cngx-tab-overflow>` skin regions.
|
|
1004
|
-
*
|
|
1188
|
+
* `<cngx-tab-overflow>` skin regions. \
|
|
1189
|
+
* Middle tier of the 3-stage cascade -
|
|
1190
|
+
* per-instance directive > this field > built-in markup. \
|
|
1005
1191
|
* Apply via the matching `with*Template` builders. Shape mirrors
|
|
1006
1192
|
* `CngxStepperTemplates` so consumer templates port across
|
|
1007
1193
|
* families.
|
|
@@ -1009,18 +1195,26 @@ interface CngxTabsFallbackLabels {
|
|
|
1009
1195
|
* @category common/tabs
|
|
1010
1196
|
*/
|
|
1011
1197
|
interface CngxTabsTemplates {
|
|
1198
|
+
/** Default for the overflow "More" button label (`*cngxTabOverflowTrigger`). */
|
|
1012
1199
|
readonly overflowTrigger?: TemplateRef<CngxTabOverflowTriggerContext>;
|
|
1200
|
+
/** Default for each row inside the overflow popover (`*cngxTabOverflowItem`). */
|
|
1013
1201
|
readonly overflowItem?: TemplateRef<CngxTabOverflowItemContext>;
|
|
1202
|
+
/** Default for the per-tab error badge (`*cngxTabErrorBadge`). */
|
|
1014
1203
|
readonly errorBadge?: TemplateRef<CngxTabErrorBadgeContext>;
|
|
1204
|
+
/** Default for the per-tab rejection decoration (`*cngxTabRejectionIcon`). */
|
|
1015
1205
|
readonly rejectionIcon?: TemplateRef<CngxTabRejectionIconContext>;
|
|
1206
|
+
/** Default for the commit-pending busy spinner (`*cngxTabBusySpinner`). */
|
|
1016
1207
|
readonly busySpinner?: TemplateRef<CngxTabBusySpinnerContext>;
|
|
1208
|
+
/** Default for the per-tab icon ahead of the label (`*cngxTabIcon`). */
|
|
1017
1209
|
readonly icon?: TemplateRef<CngxTabIconContext>;
|
|
1210
|
+
/** Default for a tab's close-button glyph (`*cngxTabCloseIcon`). */
|
|
1018
1211
|
readonly closeIcon?: TemplateRef<CngxTabCloseIconContext>;
|
|
1212
|
+
/** Default for the add-tab button glyph (`*cngxTabAddIcon`). */
|
|
1019
1213
|
readonly addIcon?: TemplateRef<void>;
|
|
1020
1214
|
}
|
|
1021
1215
|
/**
|
|
1022
|
-
* Selectable visual skin for `<cngx-tab-group>`.
|
|
1023
|
-
* thematic concern - every value renders the same `tablist` / `tab` /
|
|
1216
|
+
* Selectable visual skin for `<cngx-tab-group>`. \
|
|
1217
|
+
* The skin is a pure thematic concern - every value renders the same `tablist` / `tab` /
|
|
1024
1218
|
* `tabpanel` structure, slots, ARIA, and keyboard behaviour, and only
|
|
1025
1219
|
* redirects CSS via the `[data-skin]` host attribute. `'line'`
|
|
1026
1220
|
* (default) is the underline indicator; `'contained'` fuses the active
|
|
@@ -1028,7 +1222,9 @@ interface CngxTabsTemplates {
|
|
|
1028
1222
|
* track and lifts the active tab onto a raised surface; `'pill'`
|
|
1029
1223
|
* renders rounded solid fills; `'pill-outline'` renders the same pill
|
|
1030
1224
|
* geometry with a tinted, outlined active state instead of a solid
|
|
1031
|
-
* fill.
|
|
1225
|
+
* fill.
|
|
1226
|
+
*
|
|
1227
|
+
* Sized to the tab use cases - not a 1:1 copy of the stepper's
|
|
1032
1228
|
* seven skins. The Material twin (`[cngxMatTabs]`) ignores this setting.
|
|
1033
1229
|
*
|
|
1034
1230
|
* @category common/tabs
|
|
@@ -1036,19 +1232,22 @@ interface CngxTabsTemplates {
|
|
|
1036
1232
|
type CngxTabsSkin = 'line' | 'contained' | 'segmented' | 'pill' | 'pill-outline';
|
|
1037
1233
|
/**
|
|
1038
1234
|
* Icon-layout axis for `<cngx-tab-group>`, orthogonal to both skin and
|
|
1039
|
-
* orientation.
|
|
1235
|
+
* orientation. \
|
|
1236
|
+
* Positions the `*cngxTabIcon` slot relative to the tab
|
|
1040
1237
|
* label: `'start'` (default) places the icon before the label in a row;
|
|
1041
1238
|
* `'end'` places it after the label in a row; `'top'` stacks the icon
|
|
1042
1239
|
* above the label in a column; `'only'` hides the label visually while
|
|
1043
|
-
* keeping it in the DOM as the accessible name.
|
|
1240
|
+
* keeping it in the DOM as the accessible name.
|
|
1241
|
+
*
|
|
1242
|
+
* Redirected purely via
|
|
1044
1243
|
* the `[data-icon-layout]` host attribute.
|
|
1045
1244
|
*
|
|
1046
1245
|
* @category common/tabs
|
|
1047
1246
|
*/
|
|
1048
1247
|
type CngxTabIconLayout = 'start' | 'end' | 'top' | 'only';
|
|
1049
1248
|
/**
|
|
1050
|
-
* Panel render strategy for `<cngx-tab-group>`.
|
|
1051
|
-
* `aria-controls` target) always stays in the DOM; only its content is
|
|
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
|
|
1052
1251
|
* rendered per mode. `'eager'` (default) renders every panel's content
|
|
1053
1252
|
* up front and toggles visibility via `[hidden]` - today's behaviour,
|
|
1054
1253
|
* byte-identical. `'lazy'` renders a panel's content the first time it
|
|
@@ -1069,27 +1268,62 @@ type CngxTabsPanelMode = 'eager' | 'lazy' | 'lazy-destroy';
|
|
|
1069
1268
|
*/
|
|
1070
1269
|
type CngxTabAlign = 'start' | 'center' | 'end';
|
|
1071
1270
|
/**
|
|
1072
|
-
* Tab-group config surface. Resolution priority:
|
|
1073
|
-
* → `provideTabsConfigAt` (viewProviders) → `provideTabsConfig`
|
|
1271
|
+
* Tab-group config surface. Resolution priority: \
|
|
1272
|
+
* per-instance Input → `provideTabsConfigAt` (viewProviders) → `provideTabsConfig`
|
|
1074
1273
|
* (root) → library default.
|
|
1075
1274
|
*
|
|
1076
1275
|
* @category common/tabs
|
|
1077
1276
|
*/
|
|
1078
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
|
+
*/
|
|
1079
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
|
+
*/
|
|
1080
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
|
+
*/
|
|
1081
1301
|
readonly defaultCommitMode?: 'optimistic' | 'pessimistic';
|
|
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
|
+
*/
|
|
1082
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
|
+
*/
|
|
1083
1315
|
readonly fragmentSyncParam?: string;
|
|
1084
1316
|
/**
|
|
1085
|
-
* App-wide default visual skin.
|
|
1317
|
+
* App-wide default visual skin. \
|
|
1318
|
+
* Default `'line'`. Per-instance
|
|
1086
1319
|
* `[skin]` Input still wins; the cascade default itself lives in
|
|
1087
1320
|
* `createTabsHostAttrs`, not here (mirrors the stepper). Override via
|
|
1088
1321
|
* {@link withTabsSkin}.
|
|
1089
1322
|
*/
|
|
1090
1323
|
readonly skin?: CngxTabsSkin;
|
|
1091
1324
|
/**
|
|
1092
|
-
* App-wide default icon layout.
|
|
1325
|
+
* App-wide default icon layout. \
|
|
1326
|
+
* Default `'start'`. Per-instance
|
|
1093
1327
|
* `[iconLayout]` Input still wins; the cascade default lives in
|
|
1094
1328
|
* `createTabsHostAttrs`. Override via {@link withTabsIconLayout}.
|
|
1095
1329
|
*/
|
|
@@ -1140,20 +1374,19 @@ interface CngxTabsConfig {
|
|
|
1140
1374
|
* Hard ceiling (ms) on commit deferral while IO bursts keep
|
|
1141
1375
|
* arriving - without it, sustained churn (momentum scroll,
|
|
1142
1376
|
* continuous resize) would clear the stabilize timer forever and
|
|
1143
|
-
* the More counter would freeze on a stale value
|
|
1144
|
-
* Pillar 2. Default 250ms.
|
|
1377
|
+
* the More counter would freeze on a stale value. Default 250ms.
|
|
1145
1378
|
*/
|
|
1146
1379
|
readonly overflowMaxDeferMs?: number;
|
|
1147
1380
|
/**
|
|
1148
|
-
* App-wide template overrides for `<cngx-tab-overflow>` regions.
|
|
1381
|
+
* App-wide template overrides for `<cngx-tab-overflow>` regions. \
|
|
1149
1382
|
* Middle tier of the family-standard 3-stage cascade. See
|
|
1150
1383
|
* {@link CngxTabsTemplates}.
|
|
1151
1384
|
*/
|
|
1152
1385
|
readonly templates?: CngxTabsTemplates;
|
|
1153
1386
|
}
|
|
1154
1387
|
/**
|
|
1155
|
-
* DI token for the resolved tabs config.
|
|
1156
|
-
* 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}
|
|
1157
1390
|
* (root) or {@link provideTabsConfigAt} (component scope).
|
|
1158
1391
|
*
|
|
1159
1392
|
* @category common/tabs
|
|
@@ -1163,8 +1396,8 @@ interface CngxTabsConfig {
|
|
|
1163
1396
|
*/
|
|
1164
1397
|
declare const CNGX_TABS_CONFIG: InjectionToken<CngxTabsConfig>;
|
|
1165
1398
|
/**
|
|
1166
|
-
* Feature signature for `with*` config builders.
|
|
1167
|
-
* `_target` discriminator lets {@link provideCngxTabs} dispatch
|
|
1399
|
+
* Feature signature for `with*` config builders. \
|
|
1400
|
+
* The hidden `_target` discriminator lets {@link provideCngxTabs} dispatch
|
|
1168
1401
|
* config features to {@link provideTabsConfig} while i18n features
|
|
1169
1402
|
* route to {@link provideTabsI18n}.
|
|
1170
1403
|
*
|
|
@@ -1207,8 +1440,8 @@ declare function withTabsRovingLoop(loop: boolean): CngxTabsConfigFeature;
|
|
|
1207
1440
|
declare function withTabsCommitMode(mode: 'optimistic' | 'pessimistic'): CngxTabsConfigFeature;
|
|
1208
1441
|
/**
|
|
1209
1442
|
* Configure URL fragment / query-param deep-linking for the active tab
|
|
1210
|
-
* (the {@link CngxTabsFragmentSync} directive).
|
|
1211
|
-
* surface (URL fragment or query parameter); `param` names the key
|
|
1443
|
+
* (the {@link CngxTabsFragmentSync} directive). \
|
|
1444
|
+
* `mode` chooses the URL surface (URL fragment or query parameter); `param` names the key
|
|
1212
1445
|
* (default `'tab'`).
|
|
1213
1446
|
*
|
|
1214
1447
|
* Not to be confused with `[cngxTabsRouteSync]`, the router-outlet
|
|
@@ -1227,7 +1460,7 @@ declare function withTabsFragmentSync(mode: 'fragment' | 'queryParam', param?: s
|
|
|
1227
1460
|
*/
|
|
1228
1461
|
declare const withTabsRouterSync: typeof withTabsFragmentSync;
|
|
1229
1462
|
/**
|
|
1230
|
-
* Select the app-wide default visual skin for `<cngx-tab-group>`.
|
|
1463
|
+
* Select the app-wide default visual skin for `<cngx-tab-group>`. \
|
|
1231
1464
|
* Default `'line'`. Per-instance `[skin]` Input still wins; this moves
|
|
1232
1465
|
* the cascade default. Structure, slots, ARIA, and keyboard behaviour
|
|
1233
1466
|
* are identical across skins - only the `[data-skin]` host attribute
|
|
@@ -1237,8 +1470,8 @@ declare const withTabsRouterSync: typeof withTabsFragmentSync;
|
|
|
1237
1470
|
*/
|
|
1238
1471
|
declare function withTabsSkin(skin: CngxTabsSkin): CngxTabsConfigFeature;
|
|
1239
1472
|
/**
|
|
1240
|
-
* Set the app-wide default icon layout for `<cngx-tab-group>`.
|
|
1241
|
-
* `'start'`. Per-instance `[iconLayout]` Input still wins. Orthogonal to
|
|
1473
|
+
* Set the app-wide default icon layout for `<cngx-tab-group>`. \
|
|
1474
|
+
* Default`'start'`. Per-instance `[iconLayout]` Input still wins. Orthogonal to
|
|
1242
1475
|
* skin and orientation - only the `[data-icon-layout]` host attribute
|
|
1243
1476
|
* changes.
|
|
1244
1477
|
*
|
|
@@ -1246,7 +1479,7 @@ declare function withTabsSkin(skin: CngxTabsSkin): CngxTabsConfigFeature;
|
|
|
1246
1479
|
*/
|
|
1247
1480
|
declare function withTabsIconLayout(layout: CngxTabIconLayout): CngxTabsConfigFeature;
|
|
1248
1481
|
/**
|
|
1249
|
-
* Set the app-wide default panel render strategy for `<cngx-tab-group>`.
|
|
1482
|
+
* Set the app-wide default panel render strategy for `<cngx-tab-group>`. \
|
|
1250
1483
|
* Default `'eager'` (every panel's content rendered up front, toggled
|
|
1251
1484
|
* via `[hidden]`). `'lazy'` keep-alives content after first activation;
|
|
1252
1485
|
* `'lazy-destroy'` renders only the active panel's content. Per-instance
|
|
@@ -1258,14 +1491,15 @@ declare function withTabsIconLayout(layout: CngxTabIconLayout): CngxTabsConfigFe
|
|
|
1258
1491
|
declare function withTabsPanelMode(mode: CngxTabsPanelMode): CngxTabsConfigFeature;
|
|
1259
1492
|
/**
|
|
1260
1493
|
* Set the app-wide default for stretching tabs to the full strip width
|
|
1261
|
-
* (horizontal only).
|
|
1494
|
+
* (horizontal only). \
|
|
1495
|
+
* Default `false`. Per-instance `[fitted]` Input still
|
|
1262
1496
|
* wins. No effect under `orientation="vertical"`.
|
|
1263
1497
|
*
|
|
1264
1498
|
* @category common/tabs
|
|
1265
1499
|
*/
|
|
1266
1500
|
declare function withTabsFitted(fitted: boolean): CngxTabsConfigFeature;
|
|
1267
1501
|
/**
|
|
1268
|
-
* Set the app-wide default tab-cluster alignment (horizontal only).
|
|
1502
|
+
* Set the app-wide default tab-cluster alignment (horizontal only). \
|
|
1269
1503
|
* Default `'start'`. Per-instance `[tabAlign]` Input still wins. Ignored
|
|
1270
1504
|
* under `orientation="vertical"` and when the group is `fitted`.
|
|
1271
1505
|
*
|
|
@@ -1273,7 +1507,7 @@ declare function withTabsFitted(fitted: boolean): CngxTabsConfigFeature;
|
|
|
1273
1507
|
*/
|
|
1274
1508
|
declare function withTabsAlign(align: CngxTabAlign): CngxTabsConfigFeature;
|
|
1275
1509
|
/**
|
|
1276
|
-
* Set the app-wide default for whether tabs render a close affordance.
|
|
1510
|
+
* Set the app-wide default for whether tabs render a close affordance. \
|
|
1277
1511
|
* Default `false`. Per-instance `[closable]` Input wins; a per-`CngxTab`
|
|
1278
1512
|
* `[closable]` override wins over both.
|
|
1279
1513
|
*
|
|
@@ -1282,7 +1516,8 @@ declare function withTabsAlign(align: CngxTabAlign): CngxTabsConfigFeature;
|
|
|
1282
1516
|
declare function withTabsClosable(closable: boolean): CngxTabsConfigFeature;
|
|
1283
1517
|
/**
|
|
1284
1518
|
* Set the app-wide default for whether the group renders an add-tab
|
|
1285
|
-
* button.
|
|
1519
|
+
* button. \
|
|
1520
|
+
* Default `false`. Per-instance `[addable]` Input wins.
|
|
1286
1521
|
*
|
|
1287
1522
|
* @category common/tabs
|
|
1288
1523
|
*/
|
|
@@ -1316,21 +1551,23 @@ declare function withTabOverflowStabilizeMs(ms: number): CngxTabsConfigFeature;
|
|
|
1316
1551
|
*/
|
|
1317
1552
|
declare function withTabOverflowMaxDeferMs(ms: number): CngxTabsConfigFeature;
|
|
1318
1553
|
/**
|
|
1319
|
-
* App-wide override for the More-button label. Middle tier;
|
|
1554
|
+
* App-wide override for the More-button label. Middle tier; \
|
|
1320
1555
|
* per-instance `*cngxTabOverflowTrigger` still wins.
|
|
1321
1556
|
*
|
|
1322
1557
|
* ```ts
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1558
|
+
* readonly moreTrigger = viewChild.required<TemplateRef<CngxTabOverflowTriggerContext>>(
|
|
1559
|
+
* 'moreTrigger',
|
|
1560
|
+
* { read: TemplateRef },
|
|
1561
|
+
* );
|
|
1325
1562
|
*
|
|
1326
|
-
* providers: [provideTabsConfig(withTabOverflowTriggerTemplate(this.moreTrigger))]
|
|
1563
|
+
* providers: [provideTabsConfig(withTabOverflowTriggerTemplate(this.moreTrigger()))]
|
|
1327
1564
|
* ```
|
|
1328
1565
|
*
|
|
1329
1566
|
* @category common/tabs
|
|
1330
1567
|
*/
|
|
1331
1568
|
declare function withTabOverflowTriggerTemplate(template: TemplateRef<CngxTabOverflowTriggerContext>): CngxTabsConfigFeature;
|
|
1332
1569
|
/**
|
|
1333
|
-
* App-wide override for each row inside the overflow popover.
|
|
1570
|
+
* App-wide override for each row inside the overflow popover. \
|
|
1334
1571
|
* Middle tier; per-instance `*cngxTabOverflowItem` still wins.
|
|
1335
1572
|
*
|
|
1336
1573
|
* @category common/tabs
|
|
@@ -1346,7 +1583,8 @@ declare function withTabOverflowItemTemplate(template: TemplateRef<CngxTabOverfl
|
|
|
1346
1583
|
declare function withTabErrorBadgeTemplate(template: TemplateRef<CngxTabErrorBadgeContext>): CngxTabsConfigFeature;
|
|
1347
1584
|
/**
|
|
1348
1585
|
* App-wide override for the rejection-icon decoration. Middle
|
|
1349
|
-
* tier;
|
|
1586
|
+
* tier; \
|
|
1587
|
+
* per-instance `*cngxTabRejectionIcon` still wins. Sibling
|
|
1350
1588
|
* of {@link withStepRejectionTemplate}.
|
|
1351
1589
|
*
|
|
1352
1590
|
* @category common/tabs
|
|
@@ -1442,13 +1680,13 @@ interface CngxTabsHostAttrs {
|
|
|
1442
1680
|
readonly resolvedTabAlign: Signal<CngxTabAlign>;
|
|
1443
1681
|
}
|
|
1444
1682
|
/**
|
|
1445
|
-
*
|
|
1683
|
+
* Helper resolving the host-attribute cascades for
|
|
1446
1684
|
* `<cngx-tab-group>` (skin / iconLayout). Keeps the organism class
|
|
1447
1685
|
* under the LOC guard while making the cascade pattern reusable. Sibling
|
|
1448
1686
|
* shape to `createStepperHostAttrs`; the resolved-type unions differ per
|
|
1449
1687
|
* family, so the helpers are siblings, not shared code.
|
|
1450
1688
|
*
|
|
1451
|
-
* Each computed honors
|
|
1689
|
+
* Each computed honors the cascade:
|
|
1452
1690
|
* per-instance input wins over root config wins over library default. No
|
|
1453
1691
|
* manual sync. The library defaults (`'line'` / `'start'`) live here,
|
|
1454
1692
|
* not in `TABS_CONFIG_DEFAULTS` - mirroring the stepper.
|
|
@@ -1560,20 +1798,23 @@ declare function provideTabsI18n(...features: readonly CngxTabsI18nFeature[]): P
|
|
|
1560
1798
|
declare function injectTabsI18n(): CngxTabsI18n;
|
|
1561
1799
|
|
|
1562
1800
|
/**
|
|
1563
|
-
* Union of feature kinds the tabs aggregator accepts.
|
|
1564
|
-
*
|
|
1801
|
+
* Union of feature kinds the tabs aggregator accepts. \
|
|
1802
|
+
* Today: config and i18n; future surfaces widen the union and dispatch via the
|
|
1565
1803
|
* hidden `_target` discriminator.
|
|
1566
1804
|
*
|
|
1567
1805
|
* @category common/tabs
|
|
1568
1806
|
*/
|
|
1569
1807
|
type CngxTabsFeature = CngxTabsConfigFeature | CngxTabsI18nFeature;
|
|
1570
1808
|
/**
|
|
1571
|
-
* Unified aggregator for tabs configuration.
|
|
1572
|
-
* `_target` to {@link provideTabsConfig} and {@link provideTabsI18n}.
|
|
1573
|
-
* Sibling to
|
|
1574
|
-
*
|
|
1575
|
-
* `
|
|
1576
|
-
*
|
|
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.
|
|
1577
1818
|
*
|
|
1578
1819
|
* ```ts
|
|
1579
1820
|
* bootstrapApplication(AppComponent, {
|
|
@@ -1589,11 +1830,14 @@ type CngxTabsFeature = CngxTabsConfigFeature | CngxTabsI18nFeature;
|
|
|
1589
1830
|
* ```
|
|
1590
1831
|
*
|
|
1591
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
|
|
1592
1836
|
*/
|
|
1593
1837
|
declare function provideCngxTabs(...features: readonly CngxTabsFeature[]): EnvironmentProviders;
|
|
1594
1838
|
/**
|
|
1595
|
-
* Component-scoped twin of {@link provideCngxTabs}.
|
|
1596
|
-
* `Provider[]` for `viewProviders`/`providers`; same dispatch
|
|
1839
|
+
* Component-scoped twin of {@link provideCngxTabs}. \
|
|
1840
|
+
* Returns `Provider[]` for `viewProviders`/`providers`; same dispatch
|
|
1597
1841
|
* semantics, different scope.
|
|
1598
1842
|
*
|
|
1599
1843
|
* ```ts
|
|
@@ -1608,19 +1852,23 @@ declare function provideCngxTabs(...features: readonly CngxTabsFeature[]): Envir
|
|
|
1608
1852
|
* ```
|
|
1609
1853
|
*
|
|
1610
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
|
|
1611
1858
|
*/
|
|
1612
1859
|
declare function provideCngxTabsAt(...features: readonly CngxTabsFeature[]): Provider[];
|
|
1613
1860
|
|
|
1614
1861
|
/**
|
|
1615
|
-
* Adapts the shared commit-controller to the tabs action shape.
|
|
1616
|
-
* 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`
|
|
1617
1864
|
* is bound.
|
|
1618
1865
|
*
|
|
1619
1866
|
* @category common/tabs
|
|
1620
1867
|
*/
|
|
1621
1868
|
interface CngxTabsCommitHandler {
|
|
1622
1869
|
/**
|
|
1623
|
-
* Start a tab-transition commit.
|
|
1870
|
+
* Start a tab-transition commit. \
|
|
1871
|
+
* Returns synchronously - read the
|
|
1624
1872
|
* controller's `state` signal for in-flight status. `onResolve`
|
|
1625
1873
|
* fires once with `accept = true` on success or `false` on
|
|
1626
1874
|
* rejection; skipped on supersede.
|
|
@@ -1656,10 +1904,11 @@ declare function createTabsCommitHandler(opts: CngxTabsCommitHandlerOptions): Cn
|
|
|
1656
1904
|
*/
|
|
1657
1905
|
type CngxTabsCommitHandlerFactory = (opts: CngxTabsCommitHandlerOptions) => CngxTabsCommitHandler;
|
|
1658
1906
|
/**
|
|
1659
|
-
* DI token for the commit-handler factory.
|
|
1660
|
-
* {@link createTabsCommitHandler}.
|
|
1661
|
-
*
|
|
1662
|
-
* `
|
|
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`.
|
|
1663
1912
|
*
|
|
1664
1913
|
* @category common/tabs
|
|
1665
1914
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/commit-handler.ts
|
|
@@ -1668,10 +1917,12 @@ type CngxTabsCommitHandlerFactory = (opts: CngxTabsCommitHandlerOptions) => Cngx
|
|
|
1668
1917
|
declare const CNGX_TABS_COMMIT_HANDLER_FACTORY: InjectionToken<CngxTabsCommitHandlerFactory>;
|
|
1669
1918
|
|
|
1670
1919
|
/**
|
|
1671
|
-
* Resolves the DOM elements `<cngx-tab-overflow>` observes.
|
|
1672
|
-
* 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
|
|
1673
1922
|
* positional index into `.mat-mdc-tab` (handle ids never appear on
|
|
1674
|
-
* Material's rendered DOM).
|
|
1923
|
+
* Material's rendered DOM). \
|
|
1924
|
+
*
|
|
1925
|
+
* The molecule is variant-agnostic and
|
|
1675
1926
|
* consumes whichever adapter
|
|
1676
1927
|
* {@link CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY} provides.
|
|
1677
1928
|
*
|
|
@@ -1680,7 +1931,8 @@ declare const CNGX_TABS_COMMIT_HANDLER_FACTORY: InjectionToken<CngxTabsCommitHan
|
|
|
1680
1931
|
interface CngxTabOverflowDomAdapter {
|
|
1681
1932
|
/**
|
|
1682
1933
|
* Resolve the IntersectionObserver root - the scroll viewport the
|
|
1683
|
-
* molecule observes.
|
|
1934
|
+
* molecule observes. \
|
|
1935
|
+
* Returning `null` short-circuits the attach;
|
|
1684
1936
|
* the molecule's rAF retry loop polls again next frame.
|
|
1685
1937
|
*/
|
|
1686
1938
|
resolveStripRoot(panelHost: CngxTabPanelHost, host: HTMLElement): HTMLElement | null;
|
|
@@ -1697,7 +1949,7 @@ interface CngxTabOverflowDomAdapter {
|
|
|
1697
1949
|
*/
|
|
1698
1950
|
type CngxTabOverflowDomAdapterFactory = () => CngxTabOverflowDomAdapter;
|
|
1699
1951
|
/**
|
|
1700
|
-
* Default adapter for the cngx-native `<cngx-tab-group>` strip:
|
|
1952
|
+
* Default adapter for the cngx-native `<cngx-tab-group>` strip: \
|
|
1701
1953
|
* walks `host.closest('.cngx-tabs__strip-wrapper')` for the IO root,
|
|
1702
1954
|
* then `[id="${handle.id}-header"]` for each button.
|
|
1703
1955
|
*
|
|
@@ -1705,7 +1957,7 @@ type CngxTabOverflowDomAdapterFactory = () => CngxTabOverflowDomAdapter;
|
|
|
1705
1957
|
*/
|
|
1706
1958
|
declare function createCngxTabOverflowDefaultDomAdapter(): CngxTabOverflowDomAdapter;
|
|
1707
1959
|
/**
|
|
1708
|
-
* DI token for the overflow molecule's DOM-resolution strategy.
|
|
1960
|
+
* DI token for the overflow molecule's DOM-resolution strategy. \
|
|
1709
1961
|
* Override at directive `providers` or component `viewProviders` to
|
|
1710
1962
|
* swap in a Material, custom-skin, or test-double adapter without
|
|
1711
1963
|
* forking the molecule. Defaults to
|
|
@@ -1763,9 +2015,12 @@ interface CngxDomAnchorRetryHandle {
|
|
|
1763
2015
|
}
|
|
1764
2016
|
/**
|
|
1765
2017
|
* Bounded retry loop for DOM-anchoring patterns - shared
|
|
1766
|
-
* attempt-counter
|
|
2018
|
+
* attempt-counter and give-up and cancellation contract. \
|
|
2019
|
+
* Used by
|
|
1767
2020
|
* `<cngx-tab-overflow>`'s rAF strip-attach loop and `[cngxMatTabs]`'s
|
|
1768
|
-
* `afterNextRender` header-anchor loop.
|
|
2021
|
+
* `afterNextRender` header-anchor loop.
|
|
2022
|
+
*
|
|
2023
|
+
* Consumer-supplied scheduler
|
|
1769
2024
|
* lets different timing primitives flow through one counter.
|
|
1770
2025
|
*
|
|
1771
2026
|
* ```ts
|
|
@@ -1798,15 +2053,16 @@ declare function createDomAnchorRetry(options: CngxDomAnchorRetryOptions): CngxD
|
|
|
1798
2053
|
*/
|
|
1799
2054
|
type CngxDomAnchorRetryFactory = (options: CngxDomAnchorRetryOptions) => CngxDomAnchorRetryHandle;
|
|
1800
2055
|
/**
|
|
1801
|
-
* DI token for the DOM-anchor retry policy.
|
|
1802
|
-
* {@link createDomAnchorRetry}. Two real consumers today -
|
|
2056
|
+
* DI token for the DOM-anchor retry policy. \
|
|
2057
|
+
* Default {@link createDomAnchorRetry}. Two real consumers today -
|
|
1803
2058
|
* `<cngx-tab-overflow>`'s rAF strip-attach loop and
|
|
1804
2059
|
* `[cngxMatTabs]`'s `afterNextRender` header-anchor loop. Override
|
|
1805
2060
|
* via `providers` / `viewProviders` for retry-with-backoff,
|
|
1806
|
-
* telemetry on give-up, etc.
|
|
1807
|
-
*
|
|
1808
|
-
* `
|
|
1809
|
-
* `
|
|
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`.
|
|
1810
2066
|
*
|
|
1811
2067
|
* @category common/tabs/overflow
|
|
1812
2068
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/overflow/dom-anchor-retry.ts
|
|
@@ -1832,6 +2088,8 @@ declare const CNGX_DOM_ANCHOR_RETRY_FACTORY: InjectionToken<CngxDomAnchorRetryFa
|
|
|
1832
2088
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/slots/tab-add-icon.directive.ts
|
|
1833
2089
|
* @since 0.1.0
|
|
1834
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>
|
|
1835
2093
|
*/
|
|
1836
2094
|
declare class CngxTabAddIcon {
|
|
1837
2095
|
readonly templateRef: TemplateRef<void>;
|
|
@@ -1840,10 +2098,13 @@ declare class CngxTabAddIcon {
|
|
|
1840
2098
|
}
|
|
1841
2099
|
|
|
1842
2100
|
/**
|
|
1843
|
-
* Inputs to {@link createTabDismissals}.
|
|
2101
|
+
* Inputs to {@link createTabDismissals}. \
|
|
2102
|
+
* The organism owns the
|
|
1844
2103
|
* `[closable]` / `[addable]` inputs and the DOM handle; the factory runs
|
|
1845
|
-
* the cascade
|
|
1846
|
-
* under the LOC guard.
|
|
2104
|
+
* the cascade and the close/add interaction so the organism class stays
|
|
2105
|
+
* under the LOC guard. \
|
|
2106
|
+
*
|
|
2107
|
+
* Sibling shape to `createTabGroupAnnouncements`.
|
|
1847
2108
|
*
|
|
1848
2109
|
* @category common/tabs
|
|
1849
2110
|
*/
|
|
@@ -1857,8 +2118,8 @@ interface CngxTabDismissalsOptions {
|
|
|
1857
2118
|
readonly injector: Injector;
|
|
1858
2119
|
}
|
|
1859
2120
|
/**
|
|
1860
|
-
* Resolved dismissable/addable surface for `<cngx-tab-group>`.
|
|
1861
|
-
* organism holds this as one field and the template reads it.
|
|
2121
|
+
* Resolved dismissable/addable surface for `<cngx-tab-group>`. \
|
|
2122
|
+
* The organism holds this as one field and the template reads it.
|
|
1862
2123
|
*
|
|
1863
2124
|
* @category common/tabs
|
|
1864
2125
|
*/
|
|
@@ -1881,15 +2142,43 @@ interface CngxTabDismissals {
|
|
|
1881
2142
|
handleAdd(): void;
|
|
1882
2143
|
}
|
|
1883
2144
|
/**
|
|
1884
|
-
*
|
|
1885
|
-
* `<cngx-tab-group>`.
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
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 -
|
|
1888
2151
|
* `handleClose` only routes through the presenter's `requestClose`, which
|
|
1889
2152
|
* moves the active index, and restores focus once the consumer's removal
|
|
1890
2153
|
* has rendered.
|
|
1891
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
|
+
*
|
|
1892
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
|
|
1893
2182
|
*/
|
|
1894
2183
|
declare function createTabDismissals(opts: CngxTabDismissalsOptions): CngxTabDismissals;
|
|
1895
2184
|
|
|
@@ -1949,15 +2238,20 @@ interface CngxTabKeyboardNav {
|
|
|
1949
2238
|
* active index is the correct origin.
|
|
1950
2239
|
*
|
|
1951
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
|
|
1952
2244
|
*/
|
|
1953
2245
|
declare function createTabKeyboardNav(opts: CngxTabKeyboardNavOptions): CngxTabKeyboardNav;
|
|
1954
2246
|
|
|
1955
2247
|
/**
|
|
1956
|
-
* Inputs to {@link createTabGroupTemplateBindings}.
|
|
1957
|
-
* the `contentChild()` queries (NG8110 — must run in component
|
|
2248
|
+
* Inputs to {@link createTabGroupTemplateBindings}. \
|
|
2249
|
+
* The organism owns the `contentChild()` queries (NG8110 — must run in component
|
|
1958
2250
|
* injection context) and the resolved {@link CngxTabsConfig}; the
|
|
1959
|
-
* factory runs the 3-stage cascade per slot key.
|
|
1960
|
-
*
|
|
2251
|
+
* factory runs the 3-stage cascade per slot key.
|
|
2252
|
+
*
|
|
2253
|
+
* Sibling shape to
|
|
2254
|
+
* - `createStepperTemplateBindings`.
|
|
1961
2255
|
*
|
|
1962
2256
|
* @category common/tabs/slots
|
|
1963
2257
|
*/
|
|
@@ -2006,7 +2300,21 @@ interface CngxTabGroupTemplateBindings {
|
|
|
2006
2300
|
* Material owns the rendered tab-button chrome via its own MDC
|
|
2007
2301
|
* template, leaving no DOM seam. See `tabs-accepted-debt §9`.
|
|
2008
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
|
+
*
|
|
2009
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
|
|
2010
2318
|
*/
|
|
2011
2319
|
declare function createTabGroupTemplateBindings(opts: CngxTabGroupTemplateBindingsOptions): CngxTabGroupTemplateBindings;
|
|
2012
2320
|
|
|
@@ -2092,7 +2400,29 @@ interface CngxTabGroupAnnouncements {
|
|
|
2092
2400
|
* lazy by `linkedSignal` semantics, so the organism reads
|
|
2093
2401
|
* `liveAnnouncement` once at construction to seed it.
|
|
2094
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
|
+
*
|
|
2095
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
|
|
2096
2426
|
*/
|
|
2097
2427
|
declare function createTabGroupAnnouncements(options: CngxTabGroupAnnouncementsOptions): CngxTabGroupAnnouncements;
|
|
2098
2428
|
|
|
@@ -2120,7 +2450,7 @@ declare const CNGX_TABS_GLYPHS: {
|
|
|
2120
2450
|
};
|
|
2121
2451
|
|
|
2122
2452
|
/**
|
|
2123
|
-
* 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. \
|
|
2124
2454
|
* Stable across CD passes so `aria-activedescendant` resolves to
|
|
2125
2455
|
* the same `<li>`. `-overflow-option` suffix avoids collision with
|
|
2126
2456
|
* the strip-button (`-header`) and per-tab descriptor (`-desc`).
|
|
@@ -2129,8 +2459,8 @@ declare const CNGX_TABS_GLYPHS: {
|
|
|
2129
2459
|
*/
|
|
2130
2460
|
declare function tabOverflowOptionId(tab: CngxTabHandle): string;
|
|
2131
2461
|
/**
|
|
2132
|
-
* Inputs to {@link createTabOverflowTemplateBindings}.
|
|
2133
|
-
* runs the `contentChild()` queries (injection-context-only) and
|
|
2462
|
+
* Inputs to {@link createTabOverflowTemplateBindings}. \
|
|
2463
|
+
* The molecule runs the `contentChild()` queries (injection-context-only) and
|
|
2134
2464
|
* supplies the reactive sources; the factory owns cascade
|
|
2135
2465
|
* resolution and per-context builders.
|
|
2136
2466
|
*
|
|
@@ -2164,12 +2494,13 @@ interface CngxTabOverflowTemplateBindings {
|
|
|
2164
2494
|
readonly buildItemContext: (tab: CngxTabHandle, index: number) => CngxTabOverflowItemContext;
|
|
2165
2495
|
/**
|
|
2166
2496
|
* `ActiveDescendantItem[]` projection of `hiddenTabs()` for
|
|
2167
|
-
* `CngxActiveDescendant.items`.
|
|
2497
|
+
* `CngxActiveDescendant.items`. \
|
|
2498
|
+
* Each entry's `id` matches the
|
|
2168
2499
|
* row's `<li>` (see {@link tabOverflowOptionId}); `value` carries
|
|
2169
2500
|
* the tab handle so AD's `(activated)` payload casts back without
|
|
2170
2501
|
* a registry lookup. Structural equal guards against no-op IO
|
|
2171
|
-
* cascades.
|
|
2172
|
-
* `CngxActiveDescendant.items` declares the input that way; the
|
|
2502
|
+
* cascades. \
|
|
2503
|
+
* Mutable array shape because `CngxActiveDescendant.items` declares the input that way; the
|
|
2173
2504
|
* array is rebuilt each computed run so callers can't mutate the
|
|
2174
2505
|
* live source.
|
|
2175
2506
|
*/
|
|
@@ -2177,9 +2508,9 @@ interface CngxTabOverflowTemplateBindings {
|
|
|
2177
2508
|
}
|
|
2178
2509
|
/**
|
|
2179
2510
|
* Wires the 3-stage template cascade for the overflow molecule's
|
|
2180
|
-
* two visible regions:
|
|
2181
|
-
* `CNGX_TABS_CONFIG.templates.overflow*` > built-in markup
|
|
2182
|
-
* (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`). \
|
|
2183
2514
|
*
|
|
2184
2515
|
* Pure - no DI, no side effects, no destroy hooks. Safe to call
|
|
2185
2516
|
* from a component's field-init block. Mirrors the select-family
|
|
@@ -2189,16 +2520,28 @@ interface CngxTabOverflowTemplateBindings {
|
|
|
2189
2520
|
*/
|
|
2190
2521
|
declare function createTabOverflowTemplateBindings(opts: CngxTabOverflowTemplateBindingsOptions): CngxTabOverflowTemplateBindings;
|
|
2191
2522
|
/**
|
|
2192
|
-
* Resets the AD highlight on popover close.
|
|
2523
|
+
* Resets the AD highlight on popover close. \
|
|
2524
|
+
* Keyboard-open paths
|
|
2193
2525
|
* (ArrowDown / End / typeahead on the closed trigger) set
|
|
2194
2526
|
* `activeIndex` via AD's own keydown listener before opening -
|
|
2195
2527
|
* unaffected. Mouse-open leaves `activeIndex === -1` so the popover
|
|
2196
|
-
* renders unhighlighted.
|
|
2528
|
+
* renders unhighlighted. \
|
|
2529
|
+
* Without this reset, the next open would
|
|
2197
2530
|
* inherit a stale index from the prior keyboard session.
|
|
2198
2531
|
*
|
|
2199
|
-
* 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.
|
|
2200
2542
|
*
|
|
2201
2543
|
* @category common/tabs/overflow
|
|
2544
|
+
* @wcag AA
|
|
2202
2545
|
*/
|
|
2203
2546
|
declare function createOverflowPopoverHighlightSync(popover: Signal<CngxPopover>, ad: Signal<CngxActiveDescendant>): void;
|
|
2204
2547
|
/**
|
|
@@ -2208,12 +2551,13 @@ declare function createOverflowPopoverHighlightSync(popover: Signal<CngxPopover>
|
|
|
2208
2551
|
*/
|
|
2209
2552
|
type CngxOverflowPopoverHighlightSyncFactory = (popover: Signal<CngxPopover>, ad: Signal<CngxActiveDescendant>) => void;
|
|
2210
2553
|
/**
|
|
2211
|
-
* DI token for the overflow popover highlight-sync policy.
|
|
2554
|
+
* DI token for the overflow popover highlight-sync policy. \
|
|
2212
2555
|
* Default {@link createOverflowPopoverHighlightSync}. Override via
|
|
2213
2556
|
* `providers` / `viewProviders` for last-index preservation,
|
|
2214
|
-
* telemetry on close, custom highlight rules.
|
|
2215
|
-
*
|
|
2216
|
-
* `
|
|
2557
|
+
* telemetry on close, custom highlight rules. \
|
|
2558
|
+
* Symmetric to
|
|
2559
|
+
* - `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY` and
|
|
2560
|
+
* - `CNGX_TABS_COMMIT_HANDLER_FACTORY`.
|
|
2217
2561
|
*
|
|
2218
2562
|
* @category common/tabs/overflow
|
|
2219
2563
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/overflow/overflow-template-cascade.ts
|
|
@@ -2245,13 +2589,41 @@ interface CngxOrganismScrollSyncOptions {
|
|
|
2245
2589
|
}
|
|
2246
2590
|
/**
|
|
2247
2591
|
* Scroll-into-view effect for any strip-based organism (tabs,
|
|
2248
|
-
* stepper headers, future scrolling lists).
|
|
2249
|
-
* 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.
|
|
2250
2594
|
*
|
|
2251
|
-
* The DOM call sits in `untracked()` (only `activeId` is tracked).
|
|
2595
|
+
* The DOM call sits in `untracked()` (only `activeId` is tracked). \
|
|
2252
2596
|
* `scrollIntoView` is missing in jsdom - guarded with optional chain.
|
|
2253
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
|
+
*
|
|
2254
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
|
|
2255
2627
|
*/
|
|
2256
2628
|
declare function createOrganismScrollSync(opts: CngxOrganismScrollSyncOptions): void;
|
|
2257
2629
|
/**
|
|
@@ -2261,15 +2633,37 @@ declare function createOrganismScrollSync(opts: CngxOrganismScrollSyncOptions):
|
|
|
2261
2633
|
*/
|
|
2262
2634
|
type CngxOrganismScrollSyncFactory = (opts: CngxOrganismScrollSyncOptions) => void;
|
|
2263
2635
|
/**
|
|
2264
|
-
* DI token for the active-item scroll-into-view policy.
|
|
2265
|
-
* {@link createOrganismScrollSync}
|
|
2266
|
-
*
|
|
2267
|
-
*
|
|
2268
|
-
*
|
|
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
|
+
* ```
|
|
2269
2661
|
*
|
|
2270
2662
|
* @category common/tabs/scroll-sync
|
|
2663
|
+
* @wcag AA
|
|
2271
2664
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/scroll-sync/organism-scroll-sync.ts
|
|
2272
2665
|
* @since 0.1.0
|
|
2666
|
+
* @relatedTo createOrganismScrollSync, CngxOrganismScrollSyncFactory
|
|
2273
2667
|
*/
|
|
2274
2668
|
declare const CNGX_ORGANISM_SCROLL_SYNC_FACTORY: InjectionToken<CngxOrganismScrollSyncFactory>;
|
|
2275
2669
|
|
|
@@ -2304,11 +2698,12 @@ type CngxDirectiveByIdMapFactory = <T extends {
|
|
|
2304
2698
|
id: () => string;
|
|
2305
2699
|
}>(opts: CngxDirectiveByIdMapOptions<T>) => Signal<Map<string, T>>;
|
|
2306
2700
|
/**
|
|
2307
|
-
* DI token for the per-id directive-resolution policy.
|
|
2308
|
-
* {@link createDirectiveByIdMap}. Override for WeakMap resolution,
|
|
2309
|
-
* telemetry, or custom equality.
|
|
2310
|
-
*
|
|
2311
|
-
* `
|
|
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`.
|
|
2312
2707
|
*
|
|
2313
2708
|
* @category common/tabs/registry
|
|
2314
2709
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/registry/directive-by-id-map.ts
|
|
@@ -2316,5 +2711,5 @@ type CngxDirectiveByIdMapFactory = <T extends {
|
|
|
2316
2711
|
*/
|
|
2317
2712
|
declare const CNGX_DIRECTIVE_BY_ID_MAP_FACTORY: InjectionToken<CngxDirectiveByIdMapFactory>;
|
|
2318
2713
|
|
|
2319
|
-
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, 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 };
|
|
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 };
|
|
2320
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 };
|