@cngx/ui 0.1.0-rc.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -59
- package/action-button/README.md +170 -53
- package/breadcrumb/README.md +5 -6
- package/collection/README.md +1 -1
- package/command-palette/README.md +4 -3
- package/data-grid-accordion/README.md +1 -1
- package/empty-state/README.md +2 -3
- package/feedback/README.md +1 -1
- package/fesm2022/cngx-ui-a11y.mjs +13 -23
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
- package/fesm2022/cngx-ui-accordion.mjs +44 -66
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +213 -335
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +60 -80
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +18 -31
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
- package/fesm2022/cngx-ui-collection.mjs +28 -44
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +29 -51
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
- package/fesm2022/cngx-ui-context-menu.mjs +78 -83
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +52 -74
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +17 -44
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +589 -467
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +17 -13
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +3 -5
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +5 -9
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +6 -9
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +71 -68
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-nav-rail.mjs +440 -0
- package/fesm2022/cngx-ui-nav-rail.mjs.map +1 -0
- package/fesm2022/cngx-ui-overlay.mjs +9 -10
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +149 -171
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +858 -721
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +17 -19
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +21 -74
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +39 -62
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +207 -90
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +71 -32
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +21 -27
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
- package/fesm2022/cngx-ui-toc.mjs +27 -40
- package/fesm2022/cngx-ui-toc.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +5 -5
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-tabs/README.md +28 -14
- package/mat-tabs/styles/mat-tabs.css +233 -258
- package/nav-rail/README.md +325 -0
- package/package.json +10 -5
- package/paginator/README.md +10 -0
- package/schematics/ng-add/index.js +7 -7
- package/schematics/ng-add/schema.json +5 -0
- package/sidenav/README.md +150 -55
- package/skeleton/README.md +1 -1
- package/speak/README.md +1 -2
- package/stepper/README.md +20 -5
- package/tabs/README.md +13 -0
- package/timeline/README.md +1 -1
- package/toc/README.md +1 -1
- package/types/cngx-ui-a11y.d.ts +20 -38
- package/types/cngx-ui-accordion.d.ts +45 -77
- package/types/cngx-ui-action-button.d.ts +113 -151
- package/types/cngx-ui-breadcrumb.d.ts +58 -94
- package/types/cngx-ui-chart-panel.d.ts +22 -40
- package/types/cngx-ui-collection.d.ts +30 -53
- package/types/cngx-ui-command-palette.d.ts +40 -64
- package/types/cngx-ui-context-menu.d.ts +67 -44
- package/types/cngx-ui-data-grid-accordion.d.ts +49 -77
- package/types/cngx-ui-empty-state.d.ts +18 -8
- package/types/cngx-ui-feedback.d.ts +264 -289
- package/types/cngx-ui-layout.d.ts +4 -12
- package/types/cngx-ui-mat-accordion.d.ts +2 -3
- package/types/cngx-ui-mat-paginator.d.ts +4 -10
- package/types/cngx-ui-mat-stepper.d.ts +5 -10
- package/types/cngx-ui-mat-tabs.d.ts +43 -69
- package/types/cngx-ui-nav-rail.d.ts +416 -0
- package/types/cngx-ui-overlay.d.ts +4 -13
- package/types/cngx-ui-paginator.d.ts +164 -154
- package/types/cngx-ui-sidenav.d.ts +557 -437
- package/types/cngx-ui-skeleton.d.ts +7 -13
- package/types/cngx-ui-speak.d.ts +40 -24
- package/types/cngx-ui-stat-card.d.ts +45 -36
- package/types/cngx-ui-stepper.d.ts +183 -62
- package/types/cngx-ui-tabs.d.ts +101 -27
- package/types/cngx-ui-timeline.d.ts +20 -48
- package/types/cngx-ui-toc.d.ts +30 -51
- package/types/cngx-ui.d.ts +1 -1
|
@@ -3,9 +3,10 @@ import { afterNextRender, runInInjectionContext, effect, untracked, computed, In
|
|
|
3
3
|
import { MatTabGroup, MatTab } from '@angular/material/tabs';
|
|
4
4
|
import { createRefusedPhrase, createMaterialBidirectionalSync } from '@cngx/common/data';
|
|
5
5
|
import * as i1 from '@cngx/common/tabs';
|
|
6
|
-
import {
|
|
6
|
+
import { CNGX_TAB_GROUP_HOST, injectTabsI18n, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter, createTabNavAnnouncement, CNGX_TAB_NAV_HOST } from '@cngx/common/tabs';
|
|
7
7
|
import { CngxTabOverflow } from '@cngx/ui/tabs';
|
|
8
|
-
import { cngxDevWarn, CngxRuntimeError } from '@cngx/utils';
|
|
8
|
+
import { cngxDevWarn, CNGX_ICON_BAN, CNGX_ICON_ALERT, CngxRuntimeError } from '@cngx/utils';
|
|
9
|
+
import { createIconSvgElement } from '@cngx/common/display';
|
|
9
10
|
import { CngxLiveAnnouncer } from '@cngx/common/a11y';
|
|
10
11
|
import { nextUid } from '@cngx/core/utils';
|
|
11
12
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
@@ -53,8 +54,6 @@ const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
|
|
|
53
54
|
* grouped name through ESLint's `@typescript-eslint` type resolver
|
|
54
55
|
* - a flat `export * as` re-export from `public-api.ts` does not
|
|
55
56
|
* resolve nested members through the path-alias.
|
|
56
|
-
*
|
|
57
|
-
* @category ui/mat-tabs
|
|
58
57
|
*/
|
|
59
58
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
60
59
|
var MaterialPrivateSurfaces;
|
|
@@ -99,8 +98,9 @@ var MaterialPrivateSurfaces;
|
|
|
99
98
|
* `aria-describedby`. `aria-invalid` is intentionally absent: ARIA
|
|
100
99
|
* 1.2 scopes it to form-field vocabulary, not `role="tab"`.
|
|
101
100
|
* - {@link createMatTabAggregatorDecoration} - projects each handle's
|
|
102
|
-
* `shouldShow()` flag onto the matching button as a class
|
|
103
|
-
* descriptor span
|
|
101
|
+
* `shouldShow()` flag onto the matching button as a class, an
|
|
102
|
+
* `aria-hidden` alert icon and a descriptor span, same
|
|
103
|
+
* `aria-describedby` token-append pattern.
|
|
104
104
|
*
|
|
105
105
|
* Distinct descriptor-id suffixes (`-rejected` vs `-errors`) let both
|
|
106
106
|
* projectors stack on the same target without collision; the shared
|
|
@@ -138,6 +138,17 @@ function restoreAriaDescribedbyExceptToken(el, tokenToRemove, renderer, priorAri
|
|
|
138
138
|
}
|
|
139
139
|
renderer.setAttribute(el, 'aria-describedby', remaining.join(' '));
|
|
140
140
|
}
|
|
141
|
+
/** Class of the `<svg>` the projectors build from the shared icon data. */
|
|
142
|
+
const ICON_SVG_CLASS = 'cngx-mat-tab__icon-svg';
|
|
143
|
+
/** @internal */
|
|
144
|
+
function createIconGlyph(renderer, className, icon) {
|
|
145
|
+
const span = renderer.createElement('span');
|
|
146
|
+
renderer.addClass(span, className);
|
|
147
|
+
renderer.setAttribute(span, 'aria-hidden', 'true');
|
|
148
|
+
const svg = createIconSvgElement(renderer, icon, ICON_SVG_CLASS);
|
|
149
|
+
renderer.appendChild(span, svg.element);
|
|
150
|
+
return { span, icon: svg };
|
|
151
|
+
}
|
|
141
152
|
/**
|
|
142
153
|
* Mounts the sticky-rejection decoration projector. Class +
|
|
143
154
|
* descriptor span follow `failedHandleId` reactively; cleared on
|
|
@@ -176,8 +187,8 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
176
187
|
// Cached across the projector's lifetime - reusing the same node
|
|
177
188
|
// keeps AT-reader / observer references live across A→B→A flips.
|
|
178
189
|
let cachedSpan = null;
|
|
179
|
-
// The visible glyph rides its own `aria-hidden` span
|
|
180
|
-
//
|
|
190
|
+
// The visible glyph rides its own `aria-hidden` span, built once; a
|
|
191
|
+
// kind change rewrites its path in place.
|
|
181
192
|
let cachedGlyph = null;
|
|
182
193
|
let priorAriaDescribedby = null;
|
|
183
194
|
// Pillar 1 - short-circuits structurally-identical re-emissions of
|
|
@@ -231,8 +242,8 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
231
242
|
const writeReason = (target, glyph) => {
|
|
232
243
|
const reason = currentReason();
|
|
233
244
|
opts.renderer.setAttribute(target, 'data-reason', reason);
|
|
234
|
-
opts.renderer.setAttribute(glyph, 'data-reason', reason);
|
|
235
|
-
|
|
245
|
+
opts.renderer.setAttribute(glyph.span, 'data-reason', reason);
|
|
246
|
+
glyph.icon.setIcon(reason === 'refused' ? CNGX_ICON_BAN : CNGX_ICON_ALERT);
|
|
236
247
|
};
|
|
237
248
|
const clearDecoration = () => {
|
|
238
249
|
if (!decoratedEl || !cachedSpan) {
|
|
@@ -242,8 +253,8 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
242
253
|
destroyEmbeddedView();
|
|
243
254
|
opts.renderer.removeClass(decoratedEl, className);
|
|
244
255
|
opts.renderer.removeAttribute(decoratedEl, 'data-reason');
|
|
245
|
-
if (cachedGlyph?.parentNode) {
|
|
246
|
-
opts.renderer.removeChild(cachedGlyph.parentNode, cachedGlyph);
|
|
256
|
+
if (cachedGlyph?.span.parentNode) {
|
|
257
|
+
opts.renderer.removeChild(cachedGlyph.span.parentNode, cachedGlyph.span);
|
|
247
258
|
}
|
|
248
259
|
opts.renderer.removeChild(decoratedEl, cachedSpan);
|
|
249
260
|
// `cachedSpan` deliberately retained - reused on the next apply.
|
|
@@ -259,17 +270,12 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
259
270
|
return false;
|
|
260
271
|
}
|
|
261
272
|
opts.renderer.addClass(targetEl, className);
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
glyph = opts.renderer.createElement('span');
|
|
265
|
-
opts.renderer.addClass(glyph, glyphClassName);
|
|
266
|
-
opts.renderer.setAttribute(glyph, 'aria-hidden', 'true');
|
|
267
|
-
cachedGlyph = glyph;
|
|
268
|
-
}
|
|
273
|
+
const glyph = cachedGlyph ?? createIconGlyph(opts.renderer, glyphClassName, CNGX_ICON_ALERT);
|
|
274
|
+
cachedGlyph = glyph;
|
|
269
275
|
writeReason(targetEl, glyph);
|
|
270
|
-
// On the tab itself
|
|
271
|
-
//
|
|
272
|
-
opts.renderer.appendChild(targetEl, glyph);
|
|
276
|
+
// On the tab itself, a flex item after `.mdc-tab__content`, so the
|
|
277
|
+
// icon follows the label.
|
|
278
|
+
opts.renderer.appendChild(targetEl, glyph.span);
|
|
273
279
|
const spanId = `${handleId}-${descriptorIdSuffix}`;
|
|
274
280
|
let span = cachedSpan;
|
|
275
281
|
if (!span) {
|
|
@@ -385,7 +391,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
385
391
|
opts.destroyRef.onDestroy(clearDecoration);
|
|
386
392
|
}
|
|
387
393
|
/**
|
|
388
|
-
* Mounts the per-tab aggregator decoration projector. Class
|
|
394
|
+
* Mounts the per-tab aggregator decoration projector. Class, alert icon,
|
|
389
395
|
* descriptor span + `aria-describedby` token follow `errorTabs`
|
|
390
396
|
* reactively; pruned on entry drop and on directive destroy.
|
|
391
397
|
*
|
|
@@ -399,6 +405,7 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
399
405
|
const buttonSelector = opts.buttonSelector ?? MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR;
|
|
400
406
|
const className = opts.className ?? 'cngx-mat-tab--has-errors';
|
|
401
407
|
const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
|
|
408
|
+
const badgeClassName = opts.badgeClassName ?? 'cngx-mat-tab__error-badge';
|
|
402
409
|
const maxRetryAttempts = opts.maxRetryAttempts ?? 5;
|
|
403
410
|
// Slot path needs both halves; either alone degrades to imperative
|
|
404
411
|
// textContent. Re-evaluated per fire so a lazy-mounted template
|
|
@@ -461,12 +468,16 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
461
468
|
const ownTokenId = entry.descriptorSpan.id;
|
|
462
469
|
destroyEmbeddedView(entry);
|
|
463
470
|
opts.renderer.removeClass(entry.el, className);
|
|
471
|
+
opts.renderer.removeChild(entry.el, entry.badge);
|
|
464
472
|
opts.renderer.removeChild(entry.el, entry.descriptorSpan);
|
|
465
473
|
restoreAriaDescribedbyExceptToken(entry.el, ownTokenId, opts.renderer, entry.priorAriaDescribedby);
|
|
466
474
|
decorated.delete(id);
|
|
467
475
|
};
|
|
468
476
|
const applyDecoration = (targetEl, entry) => {
|
|
469
477
|
opts.renderer.addClass(targetEl, className);
|
|
478
|
+
// A flex item after `.mdc-tab__content`, so the icon follows the label.
|
|
479
|
+
const badge = createIconGlyph(opts.renderer, badgeClassName, CNGX_ICON_ALERT);
|
|
480
|
+
opts.renderer.appendChild(targetEl, badge.span);
|
|
470
481
|
const spanId = `${entry.id}-errors`;
|
|
471
482
|
const descriptorSpan = opts.renderer.createElement('span');
|
|
472
483
|
opts.renderer.addClass(descriptorSpan, srOnlyClassName);
|
|
@@ -483,7 +494,7 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
483
494
|
tokens.push(spanId);
|
|
484
495
|
}
|
|
485
496
|
opts.renderer.setAttribute(targetEl, 'aria-describedby', tokens.join(' '));
|
|
486
|
-
const decoratedEntry = { el: targetEl, descriptorSpan, priorAriaDescribedby };
|
|
497
|
+
const decoratedEntry = { el: targetEl, descriptorSpan, badge: badge.span, priorAriaDescribedby };
|
|
487
498
|
writeDescriptorContent(decoratedEntry, entry.announcement, {
|
|
488
499
|
count: entry.count,
|
|
489
500
|
label: entry.label,
|
|
@@ -679,9 +690,8 @@ const CNGX_MAT_TABS_CONFIG_DEFAULTS = {
|
|
|
679
690
|
* {@link injectMatTabsConfig}, which merges with the library
|
|
680
691
|
* defaults so callers never see `undefined`.
|
|
681
692
|
*
|
|
682
|
-
* @category ui/mat-tabs
|
|
683
693
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-config.ts
|
|
684
|
-
* @since 0.
|
|
694
|
+
* @since 0.3.0
|
|
685
695
|
*/
|
|
686
696
|
const CNGX_MAT_TABS_CONFIG = new InjectionToken('CngxMatTabsConfig');
|
|
687
697
|
function feature(config) {
|
|
@@ -690,8 +700,6 @@ function feature(config) {
|
|
|
690
700
|
/**
|
|
691
701
|
* Cap on the `[cngxMatTabs]` overflow-anchor retry loop.
|
|
692
702
|
* See {@link CngxMatTabsConfig.anchorMaxAttempts} for default + rationale.
|
|
693
|
-
*
|
|
694
|
-
* @category ui/mat-tabs
|
|
695
703
|
*/
|
|
696
704
|
function withAnchorRetryAttempts(n) {
|
|
697
705
|
return feature({ anchorMaxAttempts: n });
|
|
@@ -699,8 +707,6 @@ function withAnchorRetryAttempts(n) {
|
|
|
699
707
|
/**
|
|
700
708
|
* Override the half-wired-slot diagnostic sink.
|
|
701
709
|
* See {@link CngxMatTabsConfig.halfWiredSlotSink}.
|
|
702
|
-
*
|
|
703
|
-
* @category ui/mat-tabs
|
|
704
710
|
*/
|
|
705
711
|
function withHalfWiredSlotSink(sink) {
|
|
706
712
|
return feature({ halfWiredSlotSink: sink });
|
|
@@ -710,8 +716,6 @@ function withHalfWiredSlotSink(sink) {
|
|
|
710
716
|
* tier; per-instance `*cngxMatTabRejectionContent` still wins.
|
|
711
717
|
* Sibling of {@link withTabRejectionIconTemplate} in the cngx-native
|
|
712
718
|
* family.
|
|
713
|
-
*
|
|
714
|
-
* @category ui/mat-tabs
|
|
715
719
|
*/
|
|
716
720
|
function withMatTabRejectionTemplate(template) {
|
|
717
721
|
return feature({ templates: { rejection: template } });
|
|
@@ -744,8 +748,6 @@ function mergeFeatures(features) {
|
|
|
744
748
|
* ],
|
|
745
749
|
* });
|
|
746
750
|
* ```
|
|
747
|
-
*
|
|
748
|
-
* @category ui/mat-tabs
|
|
749
751
|
*/
|
|
750
752
|
function provideMatTabsConfig(...features) {
|
|
751
753
|
return makeEnvironmentProviders([
|
|
@@ -772,8 +774,6 @@ function provideMatTabsConfig(...features) {
|
|
|
772
774
|
* ...
|
|
773
775
|
* })
|
|
774
776
|
* ```
|
|
775
|
-
*
|
|
776
|
-
* @category ui/mat-tabs
|
|
777
777
|
*/
|
|
778
778
|
function provideMatTabsConfigAt(...features) {
|
|
779
779
|
return [
|
|
@@ -802,8 +802,6 @@ function provideMatTabsConfigAt(...features) {
|
|
|
802
802
|
* 1. `CNGX_MAT_TABS_CONFIG` value (set via
|
|
803
803
|
* {@link provideMatTabsConfig} / {@link provideMatTabsConfigAt}).
|
|
804
804
|
* 2. {@link CNGX_MAT_TABS_CONFIG_DEFAULTS} (library default).
|
|
805
|
-
*
|
|
806
|
-
* @category ui/mat-tabs
|
|
807
805
|
*/
|
|
808
806
|
function injectMatTabsConfig() {
|
|
809
807
|
const user = inject(CNGX_MAT_TABS_CONFIG, { optional: true }) ?? {};
|
|
@@ -857,10 +855,9 @@ function createDecorationTemplates(aggregatorSlot, rejectionSlot, config) {
|
|
|
857
855
|
* </mat-tab-group>
|
|
858
856
|
* ```
|
|
859
857
|
*
|
|
860
|
-
* @category ui/mat-tabs
|
|
861
858
|
* @wcag AA
|
|
862
859
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/decorations/mat-tab-aggregator-content.directive.ts
|
|
863
|
-
* @since 0.
|
|
860
|
+
* @since 0.3.0
|
|
864
861
|
* @relatedTo CngxMatTabs, CngxMatTabError, CngxMatTabRejectionContent
|
|
865
862
|
*/
|
|
866
863
|
class CngxMatTabAggregatorContent {
|
|
@@ -917,10 +914,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
917
914
|
* </mat-tab-group>
|
|
918
915
|
* ```
|
|
919
916
|
*
|
|
920
|
-
* @category ui/mat-tabs
|
|
921
917
|
* @wcag AA
|
|
922
918
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/decorations/mat-tab-rejection-content.directive.ts
|
|
923
|
-
* @since 0.
|
|
919
|
+
* @since 0.3.0
|
|
924
920
|
* @relatedTo CngxMatTabs, CngxMatTabAggregatorContent, CngxMatTabError
|
|
925
921
|
*/
|
|
926
922
|
class CngxMatTabRejectionContent {
|
|
@@ -1169,8 +1165,6 @@ function createOrderedRegistrationSeam(options) {
|
|
|
1169
1165
|
* - `directError` - writable seeded at `false`;
|
|
1170
1166
|
* `[cngxMatTabErrorFlag]` writes its `string | boolean` value in
|
|
1171
1167
|
* and resets on teardown. Folds into `hasError` / `errorMessage`.
|
|
1172
|
-
*
|
|
1173
|
-
* @category ui/mat-tabs
|
|
1174
1168
|
*/
|
|
1175
1169
|
function createMatTabHandle(matTab, idSeed, injector) {
|
|
1176
1170
|
// Typed local - anchors `MaterialPrivateSurfaces.StateChangeSource`
|
|
@@ -1263,10 +1257,9 @@ function createMatTabHandle(matTab, idSeed, injector) {
|
|
|
1263
1257
|
* ]
|
|
1264
1258
|
* ```
|
|
1265
1259
|
*
|
|
1266
|
-
* @category ui/mat-tabs
|
|
1267
1260
|
* @wcag AA
|
|
1268
1261
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/material-bridge/handle.ts
|
|
1269
|
-
* @since 0.
|
|
1262
|
+
* @since 0.3.0
|
|
1270
1263
|
*/
|
|
1271
1264
|
const CNGX_MAT_TAB_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_TAB_HANDLE_FACTORY', {
|
|
1272
1265
|
providedIn: 'root',
|
|
@@ -1279,10 +1272,9 @@ const CNGX_MAT_TAB_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_TAB_HANDLE_FACT
|
|
|
1279
1272
|
* `{ host: true }` to reach per-handle slots without walking the
|
|
1280
1273
|
* concrete registry class.
|
|
1281
1274
|
*
|
|
1282
|
-
* @category ui/mat-tabs
|
|
1283
1275
|
* @wcag AA
|
|
1284
1276
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-registry.directive.ts
|
|
1285
|
-
* @since 0.
|
|
1277
|
+
* @since 0.3.0
|
|
1286
1278
|
*/
|
|
1287
1279
|
const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost');
|
|
1288
1280
|
/**
|
|
@@ -1310,11 +1302,9 @@ const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost'
|
|
|
1310
1302
|
* both share the parent's `CngxTabGroupPresenter` and the same
|
|
1311
1303
|
* `<mat-tab-group>` content-children scope.
|
|
1312
1304
|
*
|
|
1313
|
-
* @category ui/mat-tabs
|
|
1314
|
-
* @docsKind primary
|
|
1315
1305
|
* @wcag AA
|
|
1316
1306
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-registry.directive.ts
|
|
1317
|
-
* @since 0.
|
|
1307
|
+
* @since 0.3.0
|
|
1318
1308
|
* @relatedTo CngxMatTabs, CngxMatTabError, CNGX_MAT_TABS_REGISTRY_HOST
|
|
1319
1309
|
*/
|
|
1320
1310
|
class CngxMatTabsRegistry {
|
|
@@ -1352,6 +1342,12 @@ class CngxMatTabsRegistry {
|
|
|
1352
1342
|
});
|
|
1353
1343
|
this.destroyRef.onDestroy(() => this.seam.clear());
|
|
1354
1344
|
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Returns the writable `errorAggregator` and `directError` slots of the given `<mat-tab>`, or
|
|
1347
|
+
* `undefined` while the tab is not registered yet. Implements `CngxMatTabsRegistryHost`, which
|
|
1348
|
+
* `CngxMatTabError` and `CngxMatTabErrorFlag` call to write their value and to reset it on
|
|
1349
|
+
* destroy.
|
|
1350
|
+
*/
|
|
1355
1351
|
getHandleSetup(matTab) {
|
|
1356
1352
|
return this.seam.get(matTab)?.setup;
|
|
1357
1353
|
}
|
|
@@ -1400,9 +1396,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1400
1396
|
* ]
|
|
1401
1397
|
* ```
|
|
1402
1398
|
*
|
|
1403
|
-
* @category ui/mat-tabs
|
|
1404
1399
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/overflow/mat-tab-overflow-dom-adapter.ts
|
|
1405
|
-
* @since 0.
|
|
1400
|
+
* @since 0.3.0
|
|
1406
1401
|
* @relatedTo CngxTabOverflow, CngxMatTabs, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY
|
|
1407
1402
|
*/
|
|
1408
1403
|
function createCngxMatTabOverflowDomAdapter() {
|
|
@@ -1487,14 +1482,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1487
1482
|
*
|
|
1488
1483
|
* @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
|
|
1489
1484
|
*
|
|
1490
|
-
* @category ui/mat-tabs
|
|
1491
|
-
* @docsKind primary
|
|
1492
1485
|
* @wcag AA
|
|
1493
1486
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs.directive.ts
|
|
1494
|
-
* @since 0.
|
|
1487
|
+
* @since 0.3.0
|
|
1495
1488
|
* @relatedTo CngxMatTabsRegistry, CngxMatTabError, CngxMatStepper
|
|
1496
1489
|
* @slot cngxMatTabAggregatorContent Replaces the aggregated error summary projected into a Material tab.
|
|
1497
1490
|
* @slot cngxMatTabRejectionContent Replaces the rejection notice on a rolled-back Material tab.
|
|
1491
|
+
* @axis level organism
|
|
1498
1492
|
*/
|
|
1499
1493
|
class CngxMatTabs {
|
|
1500
1494
|
matTabGroup = inject(MatTabGroup, { self: true });
|
|
@@ -1750,14 +1744,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1750
1744
|
*
|
|
1751
1745
|
* @playground Native router tabs with a CanDeactivate guard ./examples/router-nav/router-nav.component.ts
|
|
1752
1746
|
*
|
|
1753
|
-
* @category ui/mat-tabs
|
|
1754
|
-
* @docsKind primary
|
|
1755
1747
|
* @wcag AA
|
|
1756
1748
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-nav.directive.ts
|
|
1757
|
-
* @since 0.
|
|
1749
|
+
* @since 0.3.0
|
|
1758
1750
|
* @relatedTo CngxMatTabLink, CngxMatTabs, CngxTabsRouteSync
|
|
1759
1751
|
* @slot cngxMatTabAggregatorContent Replaces the aggregated error summary projected into a Material tab.
|
|
1760
1752
|
* @slot cngxMatTabRejectionContent Replaces the rejection notice on a rolled-back Material tab.
|
|
1753
|
+
* @axis level organism
|
|
1761
1754
|
*/
|
|
1762
1755
|
class CngxMatTabNav {
|
|
1763
1756
|
presenter = inject(CNGX_TAB_GROUP_HOST);
|
|
@@ -1865,11 +1858,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1865
1858
|
* which matches each handle's `id` (set to the route segment) against
|
|
1866
1859
|
* the URL.
|
|
1867
1860
|
*
|
|
1868
|
-
* @category ui/mat-tabs
|
|
1869
|
-
* @docsKind primary
|
|
1870
1861
|
* @wcag AA
|
|
1871
1862
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-link.directive.ts
|
|
1872
|
-
* @since 0.
|
|
1863
|
+
* @since 0.3.0
|
|
1873
1864
|
* @relatedTo CngxMatTabNav, CngxMatTabs, CngxTab
|
|
1874
1865
|
*/
|
|
1875
1866
|
class CngxMatTabLink {
|
|
@@ -1978,15 +1969,20 @@ function injectMatTabErrorTarget(selector) {
|
|
|
1978
1969
|
* the slot so an `*ngIf`-toggled binding returns to the
|
|
1979
1970
|
* no-aggregator default.
|
|
1980
1971
|
*
|
|
1981
|
-
* @category ui/mat-tabs
|
|
1982
1972
|
* @wcag AA
|
|
1983
1973
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-error.directive.ts
|
|
1984
|
-
* @since 0.
|
|
1974
|
+
* @since 0.3.0
|
|
1985
1975
|
* @relatedTo CngxMatTabs, CngxMatTabsRegistry, CngxMatTabRejectionContent
|
|
1986
1976
|
*/
|
|
1987
1977
|
class CngxMatTabError {
|
|
1988
1978
|
target = injectMatTabErrorTarget('cngxMatTabError');
|
|
1989
1979
|
destroyRef = inject(DestroyRef);
|
|
1980
|
+
/**
|
|
1981
|
+
* Error aggregator for this tab, bound as `[cngxMatTabError]`. Its `shouldShow()` decides
|
|
1982
|
+
* whether the tab header shows the error badge, and it is written into the tab's aggregator
|
|
1983
|
+
* slot in the registry. A string value (the bare attribute) and `undefined` both mean no
|
|
1984
|
+
* aggregator, and the slot is reset to `undefined` when the directive is destroyed.
|
|
1985
|
+
*/
|
|
1990
1986
|
aggregator = input(undefined, { ...(ngDevMode ? { debugName: "aggregator" } : /* istanbul ignore next */ {}), alias: 'cngxMatTabError',
|
|
1991
1987
|
transform: (value) => (typeof value === 'string' ? undefined : value) });
|
|
1992
1988
|
constructor() {
|
|
@@ -2031,7 +2027,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2031
2027
|
* `string | boolean` writes the per-handle `directError` slot, which
|
|
2032
2028
|
* folds into the handle's `hasError` / `errorMessage`. A non-empty
|
|
2033
2029
|
* string doubles as the SR descriptor message; `true` marks the tab
|
|
2034
|
-
* invalid with no message; `false`
|
|
2030
|
+
* invalid with no message; `false` clears it. The folded state
|
|
2035
2031
|
* drives the same header decoration as the aggregator: the
|
|
2036
2032
|
* `cngx-mat-tab--has-errors` badge plus an SR-only descriptor span
|
|
2037
2033
|
* referenced through `aria-describedby` (message, else the
|
|
@@ -2048,15 +2044,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2048
2044
|
* `presenter.tabs()` to recover from the content-init race, and
|
|
2049
2045
|
* clears the slot on destroy - exactly as {@link CngxMatTabError}.
|
|
2050
2046
|
*
|
|
2051
|
-
* @category ui/mat-tabs
|
|
2052
2047
|
* @wcag AA
|
|
2053
2048
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-error-flag.directive.ts
|
|
2054
|
-
* @since 0.
|
|
2049
|
+
* @since 0.3.0
|
|
2055
2050
|
* @relatedTo CngxMatTabs, CngxMatTabError, CngxMatTabsRegistry
|
|
2051
|
+
* @axis level atom
|
|
2056
2052
|
*/
|
|
2057
2053
|
class CngxMatTabErrorFlag {
|
|
2058
2054
|
target = injectMatTabErrorTarget('cngxMatTabErrorFlag');
|
|
2059
2055
|
destroyRef = inject(DestroyRef);
|
|
2056
|
+
/**
|
|
2057
|
+
* Direct invalid flag for this tab, bound as `[cngxMatTabErrorFlag]`. `true` marks the tab
|
|
2058
|
+
* invalid, a non-empty string also serves as the screen-reader message, and `false` (the
|
|
2059
|
+
* default) clears the flag. The empty string (the bare attribute) is coerced to `true`. The
|
|
2060
|
+
* value is written into the tab's direct-error slot in the registry, which is reset to `false`
|
|
2061
|
+
* when the directive is destroyed.
|
|
2062
|
+
*/
|
|
2060
2063
|
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), alias: 'cngxMatTabErrorFlag',
|
|
2061
2064
|
transform: (value) => (value === '' ? true : value) });
|
|
2062
2065
|
constructor() {
|
|
@@ -2091,7 +2094,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2091
2094
|
}], ctorParameters: () => [], propDecorators: { error: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxMatTabErrorFlag", required: false }] }] } });
|
|
2092
2095
|
|
|
2093
2096
|
/**
|
|
2094
|
-
* @module
|
|
2097
|
+
* @module `@cngx/ui/mat-tabs`
|
|
2095
2098
|
*
|
|
2096
2099
|
* Material instrumentation directive for `<mat-tab-group>`.
|
|
2097
2100
|
*/
|