@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +22 -48
  2. package/action-button/README.md +9 -11
  3. package/empty-state/README.md +11 -26
  4. package/feedback/README.md +3 -3
  5. package/fesm2022/cngx-ui-action-button.mjs +30 -26
  6. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  7. package/fesm2022/cngx-ui-empty-state.mjs +26 -21
  8. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  9. package/fesm2022/cngx-ui-feedback.mjs +498 -261
  10. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  11. package/fesm2022/cngx-ui-layout.mjs +32 -5
  12. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  13. package/fesm2022/cngx-ui-mat-stepper.mjs +119 -297
  14. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  15. package/fesm2022/cngx-ui-mat-tabs.mjs +455 -120
  16. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-material.mjs +14 -3
  18. package/fesm2022/cngx-ui-material.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-overlay.mjs +22 -3
  20. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  21. package/fesm2022/cngx-ui-sidenav.mjs +107 -28
  22. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  23. package/fesm2022/cngx-ui-skeleton.mjs +61 -20
  24. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  25. package/fesm2022/cngx-ui-speak.mjs +14 -5
  26. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-stepper.mjs +659 -163
  28. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  29. package/fesm2022/cngx-ui-tabs.mjs +306 -55
  30. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  31. package/fesm2022/cngx-ui.mjs +2 -1
  32. package/fesm2022/cngx-ui.mjs.map +1 -1
  33. package/layout/README.md +9 -44
  34. package/mat-stepper/README.md +37 -17
  35. package/mat-tabs/README.md +13 -13
  36. package/mat-tabs/styles/mat-tabs.css +357 -213
  37. package/material/README.md +19 -19
  38. package/overlay/README.md +11 -11
  39. package/package.json +7 -6
  40. package/sidenav/README.md +4 -19
  41. package/skeleton/README.md +3 -17
  42. package/speak/README.md +15 -15
  43. package/stepper/README.md +213 -5
  44. package/tabs/README.md +22 -4
  45. package/theming/system-tokens.css +29 -0
  46. package/types/cngx-ui-action-button.d.ts +28 -13
  47. package/types/cngx-ui-empty-state.d.ts +21 -9
  48. package/types/cngx-ui-feedback.d.ts +437 -121
  49. package/types/cngx-ui-layout.d.ts +38 -8
  50. package/types/cngx-ui-mat-stepper.d.ts +100 -134
  51. package/types/cngx-ui-mat-tabs.d.ts +291 -84
  52. package/types/cngx-ui-material.d.ts +12 -1
  53. package/types/cngx-ui-overlay.d.ts +25 -4
  54. package/types/cngx-ui-sidenav.d.ts +106 -12
  55. package/types/cngx-ui-skeleton.d.ts +62 -8
  56. package/types/cngx-ui-speak.d.ts +10 -2
  57. package/types/cngx-ui-stepper.d.ts +390 -57
  58. package/types/cngx-ui-tabs.d.ts +182 -18
  59. package/types/cngx-ui.d.ts +1 -0
  60. package/speak/speak-button-theme.scss +0 -78
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { runInInjectionContext, effect, untracked, afterNextRender, isDevMode, InjectionToken, makeEnvironmentProviders, inject, TemplateRef, Directive, computed, signal, DestroyRef, EnvironmentInjector, contentChildren, createEnvironmentInjector, Injectable, Injector, Renderer2, ElementRef, ViewContainerRef, contentChild, input } from '@angular/core';
3
- import { MatTab, MatTabGroup } from '@angular/material/tabs';
2
+ import { runInInjectionContext, effect, untracked, afterNextRender, isDevMode, computed, InjectionToken, makeEnvironmentProviders, inject, TemplateRef, Directive, signal, DestroyRef, EnvironmentInjector, contentChildren, createEnvironmentInjector, Injectable, Injector, Renderer2, ElementRef, ViewContainerRef, contentChild, input } from '@angular/core';
3
+ import { MatTab, MatTabGroup, MatTabLink } from '@angular/material/tabs';
4
4
  import { createMaterialBidirectionalSync } from '@cngx/common/data';
5
5
  import * as i1 from '@cngx/common/tabs';
6
6
  import { CNGX_TAB_GROUP_HOST, injectTabsI18n, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter } from '@cngx/common/tabs';
@@ -19,21 +19,10 @@ import { toSignal } from '@angular/core/rxjs-interop';
19
19
  * Every leading-underscore field cngx reaches into and every
20
20
  * Material-internal CSS selector cngx queries against has its
21
21
  * declaration here. A Material-version upgrade audit only needs to
22
- * grep this file plus the matching tracked-debt entries — that grep
23
- * value is the consumer-facing benefit, so this namespace is part
24
- * of the published surface of `@cngx/ui/mat-tabs` (re-exported from
25
- * the package barrel) rather than a private implementation detail.
26
- *
27
- * Tracked-debt cross-links:
28
- * - tabs-accepted-debt §5 — `MatTab._stateChanges` plus the three
29
- * `.mat-mdc-tab*` selectors used by `[cngxMatTabs]` and the
30
- * Material-twin overflow adapter. The closing paragraph of §5
31
- * explicitly names this namespace as the family-shared
32
- * upgrade-watch surface.
33
- * - stepper-accepted-debt §4 — `MatStepper._iconOverrides` reach
34
- * from `<cngx-mat-stepper>`.
35
- * - stepper-accepted-debt §1, handle.ts JSDoc — `CdkStep._completedOverride`
36
- * read from `createMatStepHandle`'s `state` computed.
22
+ * grep this file. The grep value is the consumer-facing benefit, so
23
+ * this namespace is part of the published surface of
24
+ * `@cngx/ui/mat-tabs` (re-exported from the package barrel) rather
25
+ * than a private implementation detail.
37
26
  *
38
27
  * The grouping uses a TypeScript `namespace` so a single
39
28
  * `MaterialPrivateSurfaces.<member>` access path covers both the
@@ -42,6 +31,8 @@ import { toSignal } from '@angular/core/rxjs-interop';
42
31
  * grouped name through ESLint's `@typescript-eslint` type resolver
43
32
  * — a flat `export * as` re-export from `public-api.ts` does not
44
33
  * resolve nested members through the path-alias.
34
+ *
35
+ * @category ui/mat-tabs
45
36
  */
46
37
  // eslint-disable-next-line @typescript-eslint/no-namespace
47
38
  var MaterialPrivateSurfaces;
@@ -92,8 +83,6 @@ var MaterialPrivateSurfaces;
92
83
  * projectors stack on the same target without collision; the shared
93
84
  * token-list append preserves consumer-supplied tokens.
94
85
  *
95
- * Index-based DOM lookup tracks `tabs-accepted-debt §5`.
96
- *
97
86
  * @internal package-private — consumers bind `[cngxMatTabError]` on
98
87
  * each `<mat-tab>`; the directive owns the projection mechanics.
99
88
  */
@@ -493,6 +482,55 @@ function defaultRetryCeilingWarn(max) {
493
482
  };
494
483
  }
495
484
 
485
+ /**
486
+ * Builds the reactive list of tabs whose bound error-aggregator wants
487
+ * reveal, in registration (DOM) order. Feeds
488
+ * {@link createMatTabAggregatorDecoration} for both the
489
+ * `[cngxMatTabs]` (`<mat-tab-group>`) and `[cngxMatTabNav]`
490
+ * (`<nav mat-tab-nav-bar>`) bridges - one body, two hosts (Pillar 3).
491
+ *
492
+ * Structural `equal` drops re-runs whose entry list is shape-identical
493
+ * so the projector does not churn on no-op aggregator re-emissions.
494
+ *
495
+ * @internal
496
+ */
497
+ function createAggregatedErrorTabs(presenter) {
498
+ return computed(() => {
499
+ const tabs = presenter.tabs();
500
+ const acc = [];
501
+ for (let i = 0; i < tabs.length; i++) {
502
+ const handle = tabs[i];
503
+ const aggregator = handle.errorAggregator();
504
+ if (aggregator?.shouldShow()) {
505
+ acc.push({
506
+ idx: i,
507
+ id: handle.id,
508
+ announcement: aggregator.announcement(),
509
+ count: aggregator.errorCount(),
510
+ label: handle.label() ?? '',
511
+ });
512
+ }
513
+ }
514
+ return acc;
515
+ }, {
516
+ equal: (a, b) => {
517
+ if (a.length !== b.length) {
518
+ return false;
519
+ }
520
+ for (let i = 0; i < a.length; i++) {
521
+ if (a[i].idx !== b[i].idx ||
522
+ a[i].id !== b[i].id ||
523
+ a[i].announcement !== b[i].announcement ||
524
+ a[i].count !== b[i].count ||
525
+ a[i].label !== b[i].label) {
526
+ return false;
527
+ }
528
+ }
529
+ return true;
530
+ },
531
+ });
532
+ }
533
+
496
534
  /**
497
535
  * Default sink — gated on dev-mode. Production callers see no
498
536
  * output; production telemetry lands only when a consumer overrides
@@ -531,6 +569,10 @@ const CNGX_MAT_TABS_CONFIG_DEFAULTS = {
531
569
  * {@link provideMatTabsConfigAt} (component scope). Read via
532
570
  * {@link injectMatTabsConfig}, which merges with the library
533
571
  * defaults so callers never see `undefined`.
572
+ *
573
+ * @category ui/mat-tabs
574
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-config.ts
575
+ * @since 0.1.0
534
576
  */
535
577
  const CNGX_MAT_TABS_CONFIG = new InjectionToken('CngxMatTabsConfig');
536
578
  function feature(config) {
@@ -539,6 +581,8 @@ function feature(config) {
539
581
  /**
540
582
  * Cap on the `[cngxMatTabs]` overflow-anchor retry loop.
541
583
  * See {@link CngxMatTabsConfig.anchorMaxAttempts} for default + rationale.
584
+ *
585
+ * @category ui/mat-tabs
542
586
  */
543
587
  function withAnchorRetryAttempts(n) {
544
588
  return feature({ anchorMaxAttempts: n });
@@ -546,6 +590,8 @@ function withAnchorRetryAttempts(n) {
546
590
  /**
547
591
  * Override the half-wired-slot diagnostic sink.
548
592
  * See {@link CngxMatTabsConfig.halfWiredSlotSink}.
593
+ *
594
+ * @category ui/mat-tabs
549
595
  */
550
596
  function withHalfWiredSlotSink(sink) {
551
597
  return feature({ halfWiredSlotSink: sink });
@@ -572,6 +618,8 @@ function mergeFeatures(features) {
572
618
  * ],
573
619
  * });
574
620
  * ```
621
+ *
622
+ * @category ui/mat-tabs
575
623
  */
576
624
  function provideMatTabsConfig(...features) {
577
625
  return makeEnvironmentProviders([
@@ -593,6 +641,8 @@ function provideMatTabsConfig(...features) {
593
641
  * ...
594
642
  * })
595
643
  * ```
644
+ *
645
+ * @category ui/mat-tabs
596
646
  */
597
647
  function provideMatTabsConfigAt(...features) {
598
648
  return [{ provide: CNGX_MAT_TABS_CONFIG, useValue: mergeFeatures(features) }];
@@ -606,6 +656,8 @@ function provideMatTabsConfigAt(...features) {
606
656
  * 1. `CNGX_MAT_TABS_CONFIG` value (set via
607
657
  * {@link provideMatTabsConfig} / {@link provideMatTabsConfigAt}).
608
658
  * 2. {@link CNGX_MAT_TABS_CONFIG_DEFAULTS} (library default).
659
+ *
660
+ * @category ui/mat-tabs
609
661
  */
610
662
  function injectMatTabsConfig() {
611
663
  const user = inject(CNGX_MAT_TABS_CONFIG, { optional: true }) ?? {};
@@ -622,18 +674,14 @@ function injectMatTabsConfig() {
622
674
  * this template into the SR-only descriptor span instead of writing
623
675
  * the aggregator's `announcement()` string verbatim.
624
676
  *
625
- * Pure marker — zero logic. Holds only a typed
677
+ * Pure marker - zero logic. Holds only a typed
626
678
  * {@link TemplateRef} reference. Mirrors the family-standard slot
627
679
  * pattern (`CngxStepBadge`, `CngxTabErrorBadge`, `CngxTabOverflowItem`).
628
680
  *
629
- * Single-consumer note: tracked as `tabs-accepted-debt §9`
630
- * (sibling to `stepper-accepted-debt §4` for the mat-stepper
631
- * twin's similar Material-binding asymmetry). Material owns the
632
- * tab-button chrome; the cngx descriptor span is the only
633
- * consumer-visible decoration seam, so this slot directive lands
634
- * with one consumer (the package-private aggregator-decoration
635
- * projector). The shape is uniform with the rest of the family
636
- * pattern; the staging is acknowledged debt.
681
+ * Material owns the tab-button chrome; the cngx descriptor span is
682
+ * the only consumer-visible decoration seam, so this slot directive
683
+ * lands with one in-package consumer (the package-private
684
+ * aggregator-decoration projector).
637
685
  *
638
686
  * ```html
639
687
  * <mat-tab-group cngxMatTabs>
@@ -647,6 +695,12 @@ function injectMatTabsConfig() {
647
695
  * <mat-tab label="Profile" cngxMatTabError="profile">…</mat-tab>
648
696
  * </mat-tab-group>
649
697
  * ```
698
+ *
699
+ * @category ui/mat-tabs
700
+ * @wcag AA
701
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/decorations/mat-tab-aggregator-content.directive.ts
702
+ * @since 0.1.0
703
+ * @relatedTo CngxMatTabs, CngxMatTabError, CngxMatTabRejectionContent
650
704
  */
651
705
  class CngxMatTabAggregatorContent {
652
706
  templateRef = inject(TemplateRef);
@@ -669,22 +723,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
669
723
  * this template into the SR-only descriptor span instead of writing
670
724
  * the resolved fallback string verbatim.
671
725
  *
672
- * Pure marker — zero logic. Holds only a typed
726
+ * Pure marker - zero logic. Holds only a typed
673
727
  * {@link TemplateRef} reference. Mirrors the family-standard slot
674
728
  * pattern (`CngxMatTabAggregatorContent`, `CngxStepBadge`,
675
729
  * `CngxTabErrorBadge`).
676
730
  *
677
- * Cascade resolution (per
678
- * `architecture-summary.md` slot-cascade rule):
731
+ * Cascade resolution:
679
732
  * 1. Per-instance `*cngxMatTabRejectionContent` template wins
680
733
  * via `contentChild(CngxMatTabRejectionContent)`.
681
- * 2. When Phase 2's `CNGX_MAT_TABS_CONFIG` infrastructure
682
- * lands on main, the config-tier
683
- * `CNGX_MAT_TABS_CONFIG.templates.rejection` slot fills the
684
- * middle tier (planned follow-up — gated by Phase 2 merge;
685
- * `tabs-accepted-debt §12` binds the staging with
686
- * Re-Eval Triggers).
687
- * 3. Library default — imperative `Renderer2.createElement('span')`
734
+ * 2. Library default - imperative `Renderer2.createElement('span')`
688
735
  * with `textContent = fallbackText` (the resolved
689
736
  * `commitRolledBackTo(originLabel)` / `commitFailedRetry`
690
737
  * phrase from `injectTabsI18n()`).
@@ -706,6 +753,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
706
753
  * <mat-tab label="Profile">…</mat-tab>
707
754
  * </mat-tab-group>
708
755
  * ```
756
+ *
757
+ * @category ui/mat-tabs
758
+ * @wcag AA
759
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/decorations/mat-tab-rejection-content.directive.ts
760
+ * @since 0.1.0
761
+ * @relatedTo CngxMatTabs, CngxMatTabAggregatorContent, CngxMatTabError
709
762
  */
710
763
  class CngxMatTabRejectionContent {
711
764
  templateRef = inject(TemplateRef);
@@ -733,12 +786,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
733
786
  * live-region never lands inside Material's component DOM. The
734
787
  * element's host bindings replicate {@link CngxLiveRegion}
735
788
  * imperatively (this attribute directive owns no template, so the
736
- * declarative `cngxLiveRegion` selector is unreachable). The
737
- * duplication of `CngxLiveRegion`'s host-binding shape is
738
- * acknowledged debt — `tabs-accepted-debt §12` covers the
739
- * single-consumer family-uniformity staging and the Re-Eval
740
- * Triggers that would graduate this helper to a
741
- * `CNGX_MAT_TAB_LIVE_ANNOUNCER_FACTORY` swap surface.
789
+ * declarative `cngxLiveRegion` selector is unreachable).
742
790
  * Cleaned up via the supplied `DestroyRef`.
743
791
  *
744
792
  * @internal — package-private helper for `[cngxMatTabs]`. Not
@@ -817,25 +865,30 @@ function createRejectionState(presenter, i18n) {
817
865
  * plus a writable `errorAggregator` slot the `[cngxMatTabError]`
818
866
  * directive binds.
819
867
  *
820
- * - `id` — fresh `idSeed()` value; a label-keyed id would collide
868
+ * - `id` - fresh `idSeed()` value; a label-keyed id would collide
821
869
  * when two tabs share a label.
822
- * - `label` / `disabled` — `computed` signals retriggered by
870
+ * - `label` / `disabled` - `computed` signals retriggered by
823
871
  * `toSignal(matTab._stateChanges)`. Bridge lifetime is tied to
824
872
  * the supplied `injector` (typically a per-tab child
825
873
  * `EnvironmentInjector`). `_stateChanges` is a Material-internal
826
- * surface — see `tabs-accepted-debt §5`.
827
- * - `errorAggregator` — writable seeded at `undefined`;
874
+ * surface.
875
+ * - `errorAggregator` - writable seeded at `undefined`;
828
876
  * `[cngxMatTabError]` writes its bound aggregator in and resets
829
877
  * on teardown. The handle exposes `.asReadonly()` to preserve the
830
878
  * `CngxTabHandle` contract.
879
+ * - `directError` - writable seeded at `false`;
880
+ * `[cngxMatTabErrorFlag]` writes its `string | boolean` value in
881
+ * and resets on teardown. Folds into `hasError` / `errorMessage`.
882
+ *
883
+ * @category ui/mat-tabs
831
884
  */
832
885
  function createMatTabHandle(matTab, idSeed, injector) {
833
- // Typed local — anchors `MaterialPrivateSurfaces.StateChangeSource`
886
+ // Typed local - anchors `MaterialPrivateSurfaces.StateChangeSource`
834
887
  // at the consumer site so an upgrade-watch grep lands here too.
835
888
  // Documentation-only at runtime; MatTab's public typing already
836
- // exposes `_stateChanges`. tabs-accepted-debt §5.
889
+ // exposes `_stateChanges`.
837
890
  const stateChangeSource = matTab;
838
- // `equal: () => false` is load-bearing — `_stateChanges` is a
891
+ // `equal: () => false` is load-bearing - `_stateChanges` is a
839
892
  // `Subject<void>`, so `Object.is(undefined, undefined)` would dedup
840
893
  // every emission and the dependent computeds would never recompute.
841
894
  const stateChangeTrigger = toSignal(stateChangeSource._stateChanges, {
@@ -852,6 +905,30 @@ function createMatTabHandle(matTab, idSeed, injector) {
852
905
  return matTab.disabled;
853
906
  }, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
854
907
  const errorAggregator = signal(undefined, ...(ngDevMode ? [{ debugName: "errorAggregator" }] : /* istanbul ignore next */ []));
908
+ // Direct invalid flag written by `[cngxMatTabErrorFlag]` - the
909
+ // Material-side author surface mirroring `CngxTab.error`.
910
+ const directError = signal(false, ...(ngDevMode ? [{ debugName: "directError" }] : /* istanbul ignore next */ []));
911
+ // Folded error state for the widened `CngxTabHandle` contract. Direct
912
+ // flag OR the aggregator's reveal-gated `shouldShow()` (so deferred-
913
+ // reveal validation stays silent until revealed).
914
+ const hasError = computed(() => {
915
+ const direct = directError();
916
+ return (direct !== false && direct !== '') || (errorAggregator()?.shouldShow?.() ?? false);
917
+ }, { ...(ngDevMode ? { debugName: "hasError" } : /* istanbul ignore next */ {}), equal: Object.is });
918
+ // Resolved direct-error message: the flag string when non-empty, else
919
+ // `undefined`. The aggregator carries its own announcement separately.
920
+ const errorMessage = computed(() => {
921
+ const direct = directError();
922
+ return typeof direct === 'string' && direct !== '' ? direct : undefined;
923
+ }, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
924
+ // Material owns its own tab lifecycle - the cngx dismissable/addable
925
+ // affordances are native-only by design, so the Material handle pins
926
+ // `closable` to `undefined` (group-default, never a close button).
927
+ const closable = signal(undefined, ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
928
+ // Material owns its tab-button chrome (no DOM seam for a stacked
929
+ // second line), so the bridge pins `subLabel` to `undefined` - same
930
+ // native-only staging as `closable`.
931
+ const subLabel = signal(undefined, ...(ngDevMode ? [{ debugName: "subLabel" }] : /* istanbul ignore next */ []));
855
932
  // `nextUid` is process-wide monotonic, so `${id}-errors` descriptor
856
933
  // ids stay unique across coexisting `[cngxMatTabs]` instances.
857
934
  const id = idSeed();
@@ -859,12 +936,17 @@ function createMatTabHandle(matTab, idSeed, injector) {
859
936
  handle: {
860
937
  id,
861
938
  label,
939
+ subLabel: subLabel.asReadonly(),
862
940
  disabled,
863
941
  errorAggregator: errorAggregator.asReadonly(),
942
+ hasError,
943
+ errorMessage,
944
+ closable: closable.asReadonly(),
864
945
  },
865
946
  label,
866
947
  disabled,
867
948
  errorAggregator,
949
+ directError,
868
950
  };
869
951
  }
870
952
  /**
@@ -875,11 +957,8 @@ function createMatTabHandle(matTab, idSeed, injector) {
875
957
  *
876
958
  * The seam separates handle shape (factory body) from id keying
877
959
  * (the supplied `idSeed` closure). Overrides may call, ignore, or
878
- * replace `idSeed` — server-synced ids, deterministic test ids,
879
- * consumer-domain ids — without touching the factory body.
880
- *
881
- * Tracked-debt: family-uniformity staging, single in-package
882
- * consumer today. See `tabs-accepted-debt §10`.
960
+ * replace `idSeed` - server-synced ids, deterministic test ids,
961
+ * consumer-domain ids - without touching the factory body.
883
962
  *
884
963
  * ```ts
885
964
  * providers: [
@@ -893,6 +972,11 @@ function createMatTabHandle(matTab, idSeed, injector) {
893
972
  * },
894
973
  * ]
895
974
  * ```
975
+ *
976
+ * @category ui/mat-tabs
977
+ * @wcag AA
978
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/material-bridge/handle.ts
979
+ * @since 0.1.0
896
980
  */
897
981
  const CNGX_MAT_TAB_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_TAB_HANDLE_FACTORY', {
898
982
  providedIn: 'root',
@@ -904,13 +988,18 @@ const CNGX_MAT_TAB_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_TAB_HANDLE_FACT
904
988
  * `useExisting`. Sibling per-tab directives inject this with
905
989
  * `{ host: true }` to reach per-handle slots without walking the
906
990
  * concrete registry class.
991
+ *
992
+ * @category ui/mat-tabs
993
+ * @wcag AA
994
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-registry.directive.ts
995
+ * @since 0.1.0
907
996
  */
908
997
  const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost');
909
998
  /**
910
999
  * Sibling host-directive that owns the per-MatTab handle registry
911
- * for `[cngxMatTabs]`. Extracted in Phase 7.1 so the parent stays
912
- * under the level-4 organism LOC guard and per-tab decoration
913
- * directives reach the registry through a typed token.
1000
+ * for `[cngxMatTabs]`. Keeps the parent under the level-4 organism
1001
+ * LOC guard and lets per-tab decoration directives reach the
1002
+ * registry through a typed token.
914
1003
  *
915
1004
  * Owns: `contentChildren(MatTab)` query, the `setupsByTab` map
916
1005
  * (per-tab cngx setup paired with a child `EnvironmentInjector`
@@ -920,8 +1009,14 @@ const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost'
920
1009
  *
921
1010
  * Composition: `[cngxMatTabs]` declares this in `hostDirectives`;
922
1011
  * both share the parent's `CngxTabGroupPresenter` and the same
923
- * `<mat-tab-group>` content-children scope. Standalone use is
924
- * exported but staged — see `tabs-accepted-debt §11`.
1012
+ * `<mat-tab-group>` content-children scope.
1013
+ *
1014
+ * @category ui/mat-tabs
1015
+ * @docsKind primary
1016
+ * @wcag AA
1017
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-registry.directive.ts
1018
+ * @since 0.1.0
1019
+ * @relatedTo CngxMatTabs, CngxMatTabError, CNGX_MAT_TABS_REGISTRY_HOST
925
1020
  */
926
1021
  class CngxMatTabsRegistry {
927
1022
  presenter = inject(CNGX_TAB_GROUP_HOST);
@@ -957,8 +1052,8 @@ class CngxMatTabsRegistry {
957
1052
  continue;
958
1053
  }
959
1054
  // Per-tab child injector scopes the `toSignal(_stateChanges)`
960
- // bridge inside createMatTabHandle — destroying it on tab
961
- // removal fires `takeUntilDestroyed`. tabs-accepted-debt §5.
1055
+ // bridge inside createMatTabHandle - destroying it on tab
1056
+ // removal fires `takeUntilDestroyed`.
962
1057
  const childInjector = createEnvironmentInjector([], this.envInjector);
963
1058
  const idSeed = () => nextUid('cngx-mat-tab-');
964
1059
  const setup = this.createHandle(tab, idSeed, childInjector);
@@ -1005,7 +1100,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1005
1100
  * `resolveStripRoot` walks from host up to `<mat-tab-header>` and
1006
1101
  * locates `.mat-mdc-tab-label-container` via any rendered
1007
1102
  * `.mat-mdc-tab` descendant — Material's IO-friendly scroll
1008
- * container (`tabs-accepted-debt §5`).
1103
+ * container.
1009
1104
  *
1010
1105
  * `resolveTabButton` indexes positionally; Material owns the DOM
1011
1106
  * and cngx handle ids never reach the button elements. Index
@@ -1020,6 +1115,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1020
1115
  * useValue: createCngxMatTabOverflowDomAdapter }
1021
1116
  * ]
1022
1117
  * ```
1118
+ *
1119
+ * @category ui/mat-tabs
1023
1120
  */
1024
1121
  function createCngxMatTabOverflowDomAdapter() {
1025
1122
  return {
@@ -1074,20 +1171,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1074
1171
  }] });
1075
1172
  /**
1076
1173
  * Attaches to an existing `<mat-tab-group>` and wires it to a
1077
- * {@link CngxTabGroupPresenter} — consumers get the commit-action
1174
+ * {@link CngxTabGroupPresenter} - consumers get the commit-action
1078
1175
  * lifecycle, `CNGX_STATEFUL` (so `<cngx-toast-on />` and
1079
1176
  * `<cngx-banner-on />` compose as children), and the tab-handle
1080
1177
  * registry from one attribute.
1081
1178
  *
1082
1179
  * Topology inverts `<cngx-mat-stepper>`: Material is the host, cngx
1083
1180
  * is the instrumentation layer. `inject(MatTabGroup, { self: true })`
1084
- * resolves on the consumer's own element — no content projection
1085
- * blocker (`stepper-accepted-debt §1` does not apply here).
1181
+ * resolves on the consumer's own element - no content projection
1182
+ * blocker applies here.
1086
1183
  *
1087
1184
  * Rejection (`--error`) and aggregator (`--has-errors`) visuals
1088
1185
  * live in the package-private projector factories under
1089
1186
  * `./decorations/`; this directive supplies their reactive triggers
1090
1187
  * and the delegators consumer templates call.
1188
+ *
1189
+ * @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
1190
+ *
1191
+ * @category ui/mat-tabs
1192
+ * @docsKind primary
1193
+ * @wcag AA
1194
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs.directive.ts
1195
+ * @since 0.1.0
1196
+ * @relatedTo CngxMatTabsRegistry, CngxMatTabError, CngxMatStepper
1091
1197
  */
1092
1198
  class CngxMatTabs {
1093
1199
  matTabGroup = inject(MatTabGroup, { self: true });
@@ -1096,12 +1202,12 @@ class CngxMatTabs {
1096
1202
  injector = inject(Injector);
1097
1203
  renderer = inject(Renderer2);
1098
1204
  hostEl = inject(ElementRef).nativeElement;
1099
- // Field order matters — `overflowRef` reads `viewContainerRef` at
1205
+ // Field order matters - `overflowRef` reads `viewContainerRef` at
1100
1206
  // class-init time. The VCR also feeds the aggregator-decoration
1101
1207
  // slot path further down.
1102
1208
  viewContainerRef = inject(ViewContainerRef);
1103
1209
  // Programmatic mount of the cngx overflow molecule.
1104
- // `injector: this.injector` is load-bearing — without it,
1210
+ // `injector: this.injector` is load-bearing - without it,
1105
1211
  // `vcr.createComponent` walks the host-template's parent VCR for
1106
1212
  // DI resolution, missing this directive's `CNGX_TAB_PANEL_HOST`
1107
1213
  // and `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY` providers, and the
@@ -1116,11 +1222,8 @@ class CngxMatTabs {
1116
1222
  aggregatorContentTemplate = computed(() => this.aggregatorContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "aggregatorContentTemplate" }] : /* istanbul ignore next */ []));
1117
1223
  rejectionContentSlot = contentChild(CngxMatTabRejectionContent, ...(ngDevMode ? [{ debugName: "rejectionContentSlot" }] : /* istanbul ignore next */ []));
1118
1224
  rejectionContentTemplate = computed(() => this.rejectionContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "rejectionContentTemplate" }] : /* istanbul ignore next */ []));
1119
- // Per-tab registry lives on the `[cngxMatTabsRegistry]` host-
1120
- // directive — sibling per-tab directives reach the per-handle
1121
- // slots via `CNGX_MAT_TABS_REGISTRY_HOST`.
1122
1225
  i18n = injectTabsI18n();
1123
- // Identity equal on `string | null` — collapses `tabs()` re-emits
1226
+ // Identity equal on `string | null` - collapses `tabs()` re-emits
1124
1227
  // that don't change the failed-target id.
1125
1228
  failedHandleId = computed(() => {
1126
1229
  const idx = this.presenter.lastFailedIndex();
@@ -1130,46 +1233,15 @@ class CngxMatTabs {
1130
1233
  return this.presenter.tabs()[idx]?.id ?? null;
1131
1234
  }, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
1132
1235
  // Bundle shares one source-walk across descriptorText / originLabel
1133
- // / liveAnnouncement — pillar-2 phrasing parity with cngx-native.
1236
+ // / liveAnnouncement - pillar-2 phrasing parity with cngx-native.
1134
1237
  rejectionState = createRejectionState(this.presenter, this.i18n);
1135
- // Structural equal — drops re-runs whose entry list is shape-
1136
- // identical so the projector doesn't churn on no-op aggregator
1137
- // re-emissions.
1138
- aggregatedErrorTabs = computed(() => {
1139
- const tabs = this.presenter.tabs();
1140
- const acc = [];
1141
- for (let i = 0; i < tabs.length; i++) {
1142
- const handle = tabs[i];
1143
- const aggregator = handle.errorAggregator();
1144
- if (aggregator?.shouldShow()) {
1145
- acc.push({
1146
- idx: i,
1147
- id: handle.id,
1148
- announcement: aggregator.announcement(),
1149
- count: aggregator.errorCount(),
1150
- label: handle.label() ?? '',
1151
- });
1152
- }
1153
- }
1154
- return acc;
1155
- }, { ...(ngDevMode ? { debugName: "aggregatedErrorTabs" } : /* istanbul ignore next */ {}), equal: (a, b) => {
1156
- if (a.length !== b.length) {
1157
- return false;
1158
- }
1159
- for (let i = 0; i < a.length; i++) {
1160
- if (a[i].idx !== b[i].idx ||
1161
- a[i].id !== b[i].id ||
1162
- a[i].announcement !== b[i].announcement ||
1163
- a[i].count !== b[i].count ||
1164
- a[i].label !== b[i].label) {
1165
- return false;
1166
- }
1167
- }
1168
- return true;
1169
- } });
1238
+ // Shared with `[cngxMatTabNav]` - one body, two hosts (Pillar 3).
1239
+ // Structural equal lives in the factory so the projector doesn't
1240
+ // churn on no-op aggregator re-emissions.
1241
+ aggregatedErrorTabs = createAggregatedErrorTabs(this.presenter);
1170
1242
  constructor() {
1171
1243
  const matTabsConfig = injectMatTabsConfig();
1172
- // Polite live region — attribute directive owns no template, so
1244
+ // Polite live region - attribute directive owns no template, so
1173
1245
  // the helper attaches the span at document.body (CDK
1174
1246
  // LiveAnnouncer convention) and mirrors `CngxLiveRegion`'s host
1175
1247
  // bindings imperatively.
@@ -1209,7 +1281,7 @@ class CngxMatTabs {
1209
1281
  // `createDomAnchorRetry` covers the deferred-host case
1210
1282
  // (`<mat-tab-group>` gated behind `*ngIf` / `@defer`); the cap
1211
1283
  // dev-warns when consumer DOM never materialises. The
1212
- // flex-layout skin in `mat-tabs.css` handles positioning — no
1284
+ // flex-layout skin in `mat-tabs.css` handles positioning - no
1213
1285
  // imperative layout work needed.
1214
1286
  const anchorMaxAttempts = matTabsConfig.anchorMaxAttempts;
1215
1287
  const anchorRetry = inject(CNGX_DOM_ANCHOR_RETRY_FACTORY)({
@@ -1231,7 +1303,7 @@ class CngxMatTabs {
1231
1303
  onGiveUp: () => {
1232
1304
  if (isDevMode()) {
1233
1305
  console.warn(`[CngxMatTabs] Could not anchor <cngx-tab-overflow> after ${anchorMaxAttempts} ` +
1234
- 'attempts — .mat-mdc-tab-header was not found inside the ' +
1306
+ 'attempts - .mat-mdc-tab-header was not found inside the ' +
1235
1307
  'host. The More popover will fall back to a sibling-of-' +
1236
1308
  '<mat-tab-group> position; verify Material rendered the ' +
1237
1309
  'strip (e.g. consumer is not gating <mat-tab-group> behind ' +
@@ -1256,7 +1328,7 @@ class CngxMatTabs {
1256
1328
  /**
1257
1329
  * Clears `presenter.lastFailedIndex`, dismissing the rejection
1258
1330
  * decoration. Mirrors `CngxTabGroup.clearLastFailed()` so a
1259
- * template ref (`#mt="cngxMatTabs"`) is enough — no host-token
1331
+ * template ref (`#mt="cngxMatTabs"`) is enough - no host-token
1260
1332
  * injection needed.
1261
1333
  */
1262
1334
  clearLastFailed() {
@@ -1276,7 +1348,7 @@ class CngxMatTabs {
1276
1348
  // molecule. `useExisting` binding below ensures every injection
1277
1349
  // resolves to the single per-host instance. The cngx-native
1278
1350
  // `<cngx-tab-group>` path keeps its own `useExisting:
1279
- // CngxTabGroup` provider — sits one injector layer closer.
1351
+ // CngxTabGroup` provider - sits one injector layer closer.
1280
1352
  CngxMatTabsPanelHostAdapter,
1281
1353
  {
1282
1354
  provide: CNGX_TAB_PANEL_HOST,
@@ -1314,7 +1386,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1314
1386
  // molecule. `useExisting` binding below ensures every injection
1315
1387
  // resolves to the single per-host instance. The cngx-native
1316
1388
  // `<cngx-tab-group>` path keeps its own `useExisting:
1317
- // CngxTabGroup` provider — sits one injector layer closer.
1389
+ // CngxTabGroup` provider - sits one injector layer closer.
1318
1390
  CngxMatTabsPanelHostAdapter,
1319
1391
  {
1320
1392
  provide: CNGX_TAB_PANEL_HOST,
@@ -1324,20 +1396,212 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1324
1396
  }]
1325
1397
  }], ctorParameters: () => [], propDecorators: { aggregatorContentSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxMatTabAggregatorContent), { isSignal: true }] }], rejectionContentSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxMatTabRejectionContent), { isSignal: true }] }] } });
1326
1398
 
1399
+ /**
1400
+ * Layers the cngx error / rejection / announcement layer onto
1401
+ * Material's native router tabs (`<nav mat-tab-nav-bar>` /
1402
+ * `<a mat-tab-link>` / `<mat-tab-nav-panel>`). The parallel bridge to
1403
+ * {@link CngxMatTabs}: `MatTabNav` has no `MatTab` and no
1404
+ * `selectedIndex`, so handles register per `<a mat-tab-link>` via
1405
+ * {@link CngxMatTabLink}, and the decoration projectors target
1406
+ * `.mat-mdc-tab-link` instead of `.mat-mdc-tab`.
1407
+ *
1408
+ * Gating is **native**: each link is a `routerLink`, so the router runs
1409
+ * `CanDeactivate` directly and this directive installs no
1410
+ * commit-action. The active index follows the route - add
1411
+ * `[cngxTabsRouteSync]` to the same `<nav>` and give each
1412
+ * `[cngxMatTabLink]` an `id` matching its route segment; route-sync
1413
+ * reflects `NavigationEnd` onto `activeIndex` (its commit-action stays
1414
+ * dormant because link clicks navigate natively, never through
1415
+ * `presenter.select`). Ableitung statt Verwaltung - the route-active
1416
+ * link is the single source of the active index.
1417
+ *
1418
+ * Composes {@link CngxTabGroupPresenter} via `hostDirectives` so the
1419
+ * `CNGX_STATEFUL` producer, the `lastFailedIndex` rejection slot, and
1420
+ * the live-region announcer come for free, identical to the cngx
1421
+ * organism (Pillar 2 - same communication across skins).
1422
+ *
1423
+ * Decoration content-template slots (`*cngxMatTabRejectionContent` /
1424
+ * `*cngxMatTabAggregatorContent`) are not forwarded on this bridge yet -
1425
+ * the projectors render their built-in `cngx-sr-only` spans. The slot
1426
+ * inputs that `[cngxMatTabs]` exposes are a deferred follow-up.
1427
+ *
1428
+ * @category ui/mat-tabs
1429
+ * @docsKind primary
1430
+ * @wcag AA
1431
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-nav.directive.ts
1432
+ * @since 0.1.0
1433
+ * @relatedTo CngxMatTabLink, CngxMatTabs, CngxTabsRouteSync
1434
+ */
1435
+ class CngxMatTabNav {
1436
+ presenter = inject(CNGX_TAB_GROUP_HOST);
1437
+ destroyRef = inject(DestroyRef);
1438
+ injector = inject(Injector);
1439
+ renderer = inject(Renderer2);
1440
+ hostEl = inject(ElementRef).nativeElement;
1441
+ i18n = injectTabsI18n();
1442
+ // Stable id of the rejected link, or null. Identity equal collapses
1443
+ // tabs() re-emits that don't change the failed-target id.
1444
+ failedHandleId = computed(() => {
1445
+ const idx = this.presenter.lastFailedIndex();
1446
+ if (idx === undefined) {
1447
+ return null;
1448
+ }
1449
+ return this.presenter.tabs()[idx]?.id ?? null;
1450
+ }, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
1451
+ rejectionState = createRejectionState(this.presenter, this.i18n);
1452
+ aggregatedErrorTabs = createAggregatedErrorTabs(this.presenter);
1453
+ constructor() {
1454
+ mountLiveRegionAnnouncer({
1455
+ announcement: this.rejectionState.liveAnnouncement,
1456
+ renderer: this.renderer,
1457
+ injector: this.injector,
1458
+ destroyRef: this.destroyRef,
1459
+ });
1460
+ // Same projector bodies as `[cngxMatTabs]`; only the per-tab element
1461
+ // selector differs (`.mat-mdc-tab-link` vs `.mat-mdc-tab`).
1462
+ createMatTabRejectionDecoration({
1463
+ hostEl: this.hostEl,
1464
+ failedHandleId: this.failedHandleId,
1465
+ failedIndex: this.presenter.lastFailedIndex,
1466
+ descriptorText: this.rejectionState.descriptorText,
1467
+ renderer: this.renderer,
1468
+ injector: this.injector,
1469
+ destroyRef: this.destroyRef,
1470
+ originLabel: this.rejectionState.originLabel,
1471
+ buttonSelector: '.mat-mdc-tab-link',
1472
+ });
1473
+ createMatTabAggregatorDecoration({
1474
+ hostEl: this.hostEl,
1475
+ errorTabs: this.aggregatedErrorTabs,
1476
+ renderer: this.renderer,
1477
+ injector: this.injector,
1478
+ destroyRef: this.destroyRef,
1479
+ buttonSelector: '.mat-mdc-tab-link',
1480
+ });
1481
+ }
1482
+ /**
1483
+ * Clears `presenter.lastFailedIndex`, dismissing the rejection
1484
+ * decoration. Mirrors {@link CngxMatTabs.clearLastFailed} so a
1485
+ * template ref (`#nav="cngxMatTabNav"`) is enough.
1486
+ */
1487
+ clearLastFailed() {
1488
+ this.presenter.clearLastFailed();
1489
+ }
1490
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1491
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabNav, isStandalone: true, selector: "[cngxMatTabNav]", exportAs: ["cngxMatTabNav"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter }], ngImport: i0 });
1492
+ }
1493
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, decorators: [{
1494
+ type: Directive,
1495
+ args: [{
1496
+ selector: '[cngxMatTabNav]',
1497
+ exportAs: 'cngxMatTabNav',
1498
+ standalone: true,
1499
+ hostDirectives: [CngxTabGroupPresenter],
1500
+ }]
1501
+ }], ctorParameters: () => [] });
1502
+
1503
+ /**
1504
+ * Registers an `<a mat-tab-link>` anchor as a {@link CngxTabHandle}
1505
+ * with the enclosing {@link CngxMatTabNav} presenter. `mat-tab-nav-bar`
1506
+ * has no `MatTab` to hang a handle on (the links are the tabs), so this
1507
+ * per-link directive is the registration seam - symmetric with how
1508
+ * `CngxTab` registers in the cngx-native path and how
1509
+ * {@link CngxMatTabsRegistry} registers each `<mat-tab>`.
1510
+ *
1511
+ * Registration order follows DOM order (Angular instantiates content
1512
+ * directives top-to-bottom), so the presenter's `tabs()` index aligns
1513
+ * with `nav.querySelectorAll('.mat-mdc-tab-link')` - the index the
1514
+ * decoration projectors correlate against.
1515
+ *
1516
+ * Gating is native: the link's `routerLink` runs `CanDeactivate`
1517
+ * directly, so this directive installs no commit-action. The active
1518
+ * index follows the route through `[cngxTabsRouteSync]` on the nav,
1519
+ * which matches each handle's `id` (set to the route segment) against
1520
+ * the URL.
1521
+ *
1522
+ * @category ui/mat-tabs
1523
+ * @docsKind primary
1524
+ * @wcag AA
1525
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-link.directive.ts
1526
+ * @since 0.1.0
1527
+ * @relatedTo CngxMatTabNav, CngxMatTabs, CngxTab
1528
+ */
1529
+ class CngxMatTabLink {
1530
+ matLink = inject(MatTabLink, { self: true });
1531
+ host = inject(CNGX_TAB_GROUP_HOST);
1532
+ destroyRef = inject(DestroyRef);
1533
+ /**
1534
+ * Handle id. Set it to the link's route segment so the nav's
1535
+ * `[cngxTabsRouteSync]` reflects the active route onto this tab via
1536
+ * the default `(h) => [h.id]` mapping. Defaults to a fresh uid when
1537
+ * route-sync is not used.
1538
+ */
1539
+ id = input(nextUid('cngx-mat-tab-link-'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
1540
+ /** Accessible label fed to the live-region announcer. */
1541
+ label = input(undefined, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1542
+ /**
1543
+ * Direct error flag for the link - `true` or a non-empty string marks
1544
+ * it invalid (the string doubles as the message). Mirrors
1545
+ * `CngxTab.error` and `[cngxMatTabErrorFlag]`.
1546
+ */
1547
+ error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
1548
+ /** Optional rich error aggregator for the link. */
1549
+ errorAggregator = input(undefined, ...(ngDevMode ? [{ debugName: "errorAggregator" }] : /* istanbul ignore next */ []));
1550
+ errorMessage = computed(() => {
1551
+ const value = this.error();
1552
+ return typeof value === 'string' && value !== '' ? value : undefined;
1553
+ }, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
1554
+ hasError = computed(() => {
1555
+ const direct = this.error();
1556
+ return ((direct !== false && direct !== '') ||
1557
+ (this.errorAggregator()?.shouldShow?.() ?? false));
1558
+ }, { ...(ngDevMode ? { debugName: "hasError" } : /* istanbul ignore next */ {}), equal: Object.is });
1559
+ // Material's MatTabLink.disabled is a plain property, not a signal;
1560
+ // nav links rarely toggle disabled at runtime, so snapshot it onto a
1561
+ // signal at registration. A live binding would need a Material
1562
+ // reactive surface MatTabLink does not expose.
1563
+ disabledState = signal(false, ...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
1564
+ ngOnInit() {
1565
+ this.disabledState.set(this.matLink.disabled);
1566
+ const handle = {
1567
+ id: this.id(),
1568
+ label: this.label,
1569
+ subLabel: signal(undefined),
1570
+ disabled: this.disabledState.asReadonly(),
1571
+ errorAggregator: this.errorAggregator,
1572
+ hasError: this.hasError,
1573
+ errorMessage: this.errorMessage,
1574
+ closable: signal(undefined),
1575
+ };
1576
+ this.host.register(handle);
1577
+ this.destroyRef.onDestroy(() => this.host.unregister(handle.id));
1578
+ }
1579
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabLink, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1580
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMatTabLink, isStandalone: true, selector: "[cngxMatTabLink]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorAggregator: { classPropertyName: "errorAggregator", publicName: "errorAggregator", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxMatTabLink"], ngImport: i0 });
1581
+ }
1582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabLink, decorators: [{
1583
+ type: Directive,
1584
+ args: [{
1585
+ selector: '[cngxMatTabLink]',
1586
+ exportAs: 'cngxMatTabLink',
1587
+ standalone: true,
1588
+ }]
1589
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], errorAggregator: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorAggregator", required: false }] }] } });
1590
+
1327
1591
  /**
1328
1592
  * Per-tab error-aggregator binding for `[cngxMatTabs]`. Attach to a
1329
1593
  * `<mat-tab>`; the bound aggregator's `shouldShow()` projects onto
1330
1594
  * the matching Material tab button (badge + descriptor span) via
1331
1595
  * the Renderer2 effect inside {@link CngxMatTabs}.
1332
1596
  *
1333
- * Material owns `<mat-tab>` declarations — `[cngxTab]` cannot host
1334
- * here — so a sibling attribute directive carries the input.
1597
+ * Material owns `<mat-tab>` declarations - `[cngxTab]` cannot host
1598
+ * here - so a sibling attribute directive carries the input.
1335
1599
  * Empty-string transform handles the bare-attribute case per
1336
1600
  * `feedback_bridge_input_not_required` (a developer typing
1337
1601
  * `cngxMatTabError` without `[]` brackets must not poison the
1338
1602
  * slot).
1339
1603
  *
1340
- * Locates its target via {@link CNGX_MAT_TABS_REGISTRY_HOST} —
1604
+ * Locates its target via {@link CNGX_MAT_TABS_REGISTRY_HOST} -
1341
1605
  * the registry provides the token with `useExisting`, so sibling
1342
1606
  * directives reach per-handle slots through a typed contract
1343
1607
  * instead of the concrete class. Tracks `presenter.tabs()` to
@@ -1345,6 +1609,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1345
1609
  * before the registry's sync runs. `destroyRef.onDestroy` clears
1346
1610
  * the slot so an `*ngIf`-toggled binding returns to the
1347
1611
  * no-aggregator default.
1612
+ *
1613
+ * @category ui/mat-tabs
1614
+ * @wcag AA
1615
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-error.directive.ts
1616
+ * @since 0.1.0
1617
+ * @relatedTo CngxMatTabs, CngxMatTabsRegistry, CngxMatTabRejectionContent
1348
1618
  */
1349
1619
  class CngxMatTabError {
1350
1620
  matTab = inject(MatTab, { self: true });
@@ -1364,7 +1634,7 @@ class CngxMatTabError {
1364
1634
  // pre-empts a future regression where `getHandleSetup` reads a
1365
1635
  // signal and self-triggers the aggregator pump.
1366
1636
  const aggregator = this.aggregator();
1367
- // Race-recovery dependency — tracks `setupsByTab` population so
1637
+ // Race-recovery dependency - tracks `setupsByTab` population so
1368
1638
  // the effect re-fires once our `MatTab` is registered. The bare
1369
1639
  // read is intentional; full rationale lives in the effect's
1370
1640
  // opening comment above. Do NOT tag as dead code.
@@ -1391,6 +1661,71 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1391
1661
  }]
1392
1662
  }], ctorParameters: () => [], propDecorators: { aggregator: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxMatTabError", required: false }] }] } });
1393
1663
 
1664
+ /**
1665
+ * Per-tab direct invalid flag for `[cngxMatTabs]` - the simple-case
1666
+ * sibling to `[cngxMatTabError]`. Attach to a `<mat-tab>`; the bound
1667
+ * `string | boolean` writes the per-handle `directError` slot, which
1668
+ * folds into the handle's `hasError` / `errorMessage`. A non-empty
1669
+ * string doubles as the SR descriptor message; `true` marks the tab
1670
+ * invalid with no message; `false` / `''` clear it.
1671
+ *
1672
+ * Symmetric with `[cngxMatTabError]` (one directive, one
1673
+ * responsibility - Pillar 3): the aggregator stays the rich
1674
+ * multi-source path, this is the "this tab is invalid" marker that
1675
+ * needs no aggregator boilerplate. A bare `cngxMatTabErrorFlag`
1676
+ * attribute (no brackets) binds the empty string and is coerced to
1677
+ * `true` so presence alone marks the tab invalid.
1678
+ *
1679
+ * Locates its target via {@link CNGX_MAT_TABS_REGISTRY_HOST}, tracks
1680
+ * `presenter.tabs()` to recover from the content-init race, and
1681
+ * clears the slot on destroy - exactly as {@link CngxMatTabError}.
1682
+ *
1683
+ * @category ui/mat-tabs
1684
+ * @wcag AA
1685
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-error-flag.directive.ts
1686
+ * @since 0.1.0
1687
+ * @relatedTo CngxMatTabs, CngxMatTabError, CngxMatTabsRegistry
1688
+ */
1689
+ class CngxMatTabErrorFlag {
1690
+ matTab = inject(MatTab, { self: true });
1691
+ registry = inject(CNGX_MAT_TABS_REGISTRY_HOST, {
1692
+ host: true,
1693
+ });
1694
+ presenter = inject(CNGX_TAB_GROUP_HOST);
1695
+ destroyRef = inject(DestroyRef);
1696
+ error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), alias: 'cngxMatTabErrorFlag',
1697
+ transform: (value) => (value === '' ? true : value) });
1698
+ constructor() {
1699
+ effect(() => {
1700
+ // Same content-init race as `[cngxMatTabError]` - the registry's
1701
+ // `contentChildren(MatTab)` query and our injection land in the
1702
+ // same microtask, so tracking `presenter.tabs()` re-fires the
1703
+ // effect once our handle is registered. `untracked` around the
1704
+ // write keeps the slot pump out of the reactive graph.
1705
+ const error = this.error();
1706
+ this.presenter.tabs();
1707
+ untracked(() => {
1708
+ const setup = this.registry.getHandleSetup(this.matTab);
1709
+ setup?.directError.set(error);
1710
+ });
1711
+ });
1712
+ this.destroyRef.onDestroy(() => {
1713
+ const setup = this.registry.getHandleSetup(this.matTab);
1714
+ setup?.directError.set(false);
1715
+ });
1716
+ }
1717
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabErrorFlag, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1718
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMatTabErrorFlag, isStandalone: true, selector: "[cngxMatTabErrorFlag]", inputs: { error: { classPropertyName: "error", publicName: "cngxMatTabErrorFlag", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxMatTabErrorFlag"], ngImport: i0 });
1719
+ }
1720
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabErrorFlag, decorators: [{
1721
+ type: Directive,
1722
+ args: [{
1723
+ selector: '[cngxMatTabErrorFlag]',
1724
+ exportAs: 'cngxMatTabErrorFlag',
1725
+ standalone: true,
1726
+ }]
1727
+ }], ctorParameters: () => [], propDecorators: { error: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxMatTabErrorFlag", required: false }] }] } });
1728
+
1394
1729
  /**
1395
1730
  * @module @cngx/ui/mat-tabs
1396
1731
  *
@@ -1401,5 +1736,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1401
1736
  * Generated bundle index. Do not edit.
1402
1737
  */
1403
1738
 
1404
- export { CNGX_MAT_TABS_CONFIG, CNGX_MAT_TABS_REGISTRY_HOST, CNGX_MAT_TAB_HANDLE_FACTORY, CngxMatTabAggregatorContent, CngxMatTabError, CngxMatTabRejectionContent, CngxMatTabs, CngxMatTabsRegistry, MaterialPrivateSurfaces, createCngxMatTabOverflowDomAdapter, createMatTabHandle, injectMatTabsConfig, provideMatTabsConfig, provideMatTabsConfigAt, withAnchorRetryAttempts, withHalfWiredSlotSink };
1739
+ export { CNGX_MAT_TABS_CONFIG, CNGX_MAT_TABS_REGISTRY_HOST, CNGX_MAT_TAB_HANDLE_FACTORY, CngxMatTabAggregatorContent, CngxMatTabError, CngxMatTabErrorFlag, CngxMatTabLink, CngxMatTabNav, CngxMatTabRejectionContent, CngxMatTabs, CngxMatTabsRegistry, MaterialPrivateSurfaces, createCngxMatTabOverflowDomAdapter, createMatTabHandle, injectMatTabsConfig, provideMatTabsConfig, provideMatTabsConfigAt, withAnchorRetryAttempts, withHalfWiredSlotSink };
1405
1740
  //# sourceMappingURL=cngx-ui-mat-tabs.mjs.map