@cngx/ui 0.1.0-rc.7 → 0.1.0-rc.9
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 +0 -1
- package/a11y/README.md +11 -5
- package/accordion/README.md +4 -2
- package/breadcrumb/README.md +262 -0
- package/collection/README.md +6 -0
- package/command-palette/README.md +227 -0
- package/data-grid-accordion/README.md +76 -2
- package/feedback/README.md +40 -0
- package/fesm2022/cngx-ui-a11y.mjs +189 -57
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
- package/fesm2022/cngx-ui-accordion.mjs +120 -36
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +121 -56
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +228 -108
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +180 -23
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
- package/fesm2022/cngx-ui-collection.mjs +204 -62
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +395 -119
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
- package/fesm2022/cngx-ui-context-menu.mjs +209 -40
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -101
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +16 -6
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +1074 -460
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +76 -7
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +555 -204
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +69 -13
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +553 -198
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +344 -109
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +4 -16
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +107 -8
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +146 -46
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +234 -99
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +88 -25
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +98 -23
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
- package/fesm2022/cngx-ui-toc.mjs +101 -33
- package/fesm2022/cngx-ui-toc.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +15 -20
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-paginator/README.md +9 -2
- package/mat-tabs/README.md +30 -6
- package/mat-tabs/styles/mat-tabs.css +188 -42
- package/overlay/README.md +9 -4
- package/package.json +31 -7
- package/paginator/README.md +8 -4
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +91 -0
- package/schematics/package.json +3 -0
- package/sidenav/README.md +33 -11
- package/speak/README.md +3 -2
- package/stepper/README.md +14 -2
- package/timeline/README.md +1 -1
- package/toc/README.md +4 -1
- package/types/cngx-ui-a11y.d.ts +121 -30
- package/types/cngx-ui-accordion.d.ts +100 -28
- package/types/cngx-ui-action-button.d.ts +44 -3
- package/types/cngx-ui-breadcrumb.d.ts +167 -60
- package/types/cngx-ui-chart-panel.d.ts +122 -18
- package/types/cngx-ui-collection.d.ts +157 -55
- package/types/cngx-ui-command-palette.d.ts +297 -183
- package/types/cngx-ui-context-menu.d.ts +140 -10
- package/types/cngx-ui-data-grid-accordion.d.ts +278 -39
- package/types/cngx-ui-empty-state.d.ts +9 -2
- package/types/cngx-ui-feedback.d.ts +605 -59
- package/types/cngx-ui-mat-accordion.d.ts +30 -1
- package/types/cngx-ui-mat-paginator.d.ts +37 -8
- package/types/cngx-ui-mat-stepper.d.ts +23 -11
- package/types/cngx-ui-mat-tabs.d.ts +250 -34
- package/types/cngx-ui-overlay.d.ts +56 -10
- package/types/cngx-ui-paginator.d.ts +425 -136
- package/types/cngx-ui-sidenav.d.ts +248 -74
- package/types/cngx-ui-skeleton.d.ts +6 -7
- package/types/cngx-ui-speak.d.ts +118 -5
- package/types/cngx-ui-stat-card.d.ts +117 -33
- package/types/cngx-ui-stepper.d.ts +88 -49
- package/types/cngx-ui-tabs.d.ts +6 -4
- package/types/cngx-ui-timeline.d.ts +35 -11
- package/types/cngx-ui-toc.d.ts +93 -16
- package/types/cngx-ui.d.ts +7 -4
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { TemplateRef, InjectionToken, Type, Provider, EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { TemplateRef, InjectionToken, Type, Provider, EnvironmentProviders, Signal } from '@angular/core';
|
|
3
3
|
import { CngxAsyncState } from '@cngx/core/utils';
|
|
4
|
+
import { CngxMessage } from '@cngx/core/i18n';
|
|
4
5
|
import { Observable, Subject } from 'rxjs';
|
|
6
|
+
import * as _cngx_ui_feedback from '@cngx/ui/feedback';
|
|
5
7
|
import { AsyncView } from '@cngx/common/data';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -46,14 +48,15 @@ type LoadingIndicatorVariant = 'spinner' | 'bar';
|
|
|
46
48
|
declare class CngxLoadingIndicator {
|
|
47
49
|
private readonly config;
|
|
48
50
|
private readonly loadingConfig;
|
|
51
|
+
private readonly i18n;
|
|
49
52
|
/** Bind an async state - shows indicator when `isBusy()`. */
|
|
50
53
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
51
54
|
/** Direct boolean control - alternative to `[state]`. */
|
|
52
55
|
readonly loading: _angular_core.InputSignal<boolean>;
|
|
53
56
|
/** Visual variant. */
|
|
54
57
|
readonly variant: _angular_core.InputSignal<LoadingIndicatorVariant>;
|
|
55
|
-
/** Screen reader label. */
|
|
56
|
-
readonly label: _angular_core.InputSignal<string>;
|
|
58
|
+
/** Screen reader label. Unbound, `CNGX_FEEDBACK_I18N.loadingLabel` applies. */
|
|
59
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
57
60
|
/** Delay in ms before showing the indicator. Defaults to `CNGX_LOADING_CONFIG.showDelay`. */
|
|
58
61
|
readonly delay: _angular_core.InputSignal<number>;
|
|
59
62
|
/** Minimum display time in ms once visible. Defaults to `CNGX_LOADING_CONFIG.minDwell`. */
|
|
@@ -71,6 +74,13 @@ declare class CngxLoadingIndicator {
|
|
|
71
74
|
protected readonly effectiveMinDwell: _angular_core.Signal<number>;
|
|
72
75
|
/** @internal - final visibility after delay + minDwell. */
|
|
73
76
|
readonly visible: _angular_core.Signal<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* @internal - accessible name of the status host. A bound `label` applies at
|
|
79
|
+
* once; the i18n default is read untracked and keyed on visibility, so a
|
|
80
|
+
* language switch never renames a showing indicator and its next appearance
|
|
81
|
+
* speaks the new language.
|
|
82
|
+
*/
|
|
83
|
+
protected readonly resolvedLabel: _angular_core.Signal<string>;
|
|
74
84
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLoadingIndicator, never>;
|
|
75
85
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxLoadingIndicator, "cngx-loading-indicator", never, { "state": { "alias": "state"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "delay": { "alias": "delay"; "required": false; "isSignal": true; }; "minDwell": { "alias": "minDwell"; "required": false; "isSignal": true; }; "minDuration": { "alias": "minDuration"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
76
86
|
}
|
|
@@ -118,12 +128,16 @@ declare class CngxLoadingIndicator {
|
|
|
118
128
|
declare class CngxLoadingOverlay {
|
|
119
129
|
private readonly doc;
|
|
120
130
|
private readonly loadingConfig;
|
|
131
|
+
private readonly i18n;
|
|
121
132
|
/** Bind an async state - shows overlay when `isBusy()`. */
|
|
122
133
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
123
134
|
/** Direct boolean control - alternative to `[state]`. */
|
|
124
135
|
readonly loading: _angular_core.InputSignal<boolean>;
|
|
125
|
-
/**
|
|
126
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Screen reader label for the spinner. Unbound,
|
|
138
|
+
* `CNGX_FEEDBACK_I18N.loadingLabel` applies.
|
|
139
|
+
*/
|
|
140
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
127
141
|
/** Delay in ms before showing the overlay. Defaults to `CNGX_LOADING_CONFIG.showDelay`. */
|
|
128
142
|
readonly delay: _angular_core.InputSignal<number>;
|
|
129
143
|
/** Minimum display time in ms once visible. Defaults to `CNGX_LOADING_CONFIG.minDwell`. */
|
|
@@ -145,7 +159,13 @@ declare class CngxLoadingOverlay {
|
|
|
145
159
|
protected readonly effectiveMinDwell: _angular_core.Signal<number>;
|
|
146
160
|
/** @internal - debounced visibility via shared gate factory. */
|
|
147
161
|
protected readonly visible: _angular_core.Signal<boolean>;
|
|
148
|
-
|
|
162
|
+
/**
|
|
163
|
+
* @internal - accessible name of the spinner status region. A bound `label`
|
|
164
|
+
* applies at once; the i18n default is read untracked and keyed on
|
|
165
|
+
* visibility, so a language switch never renames a showing spinner.
|
|
166
|
+
*/
|
|
167
|
+
protected readonly resolvedLabel: _angular_core.Signal<string>;
|
|
168
|
+
private savedFocus;
|
|
149
169
|
private readonly contentWrapper;
|
|
150
170
|
private readonly spinnerEl;
|
|
151
171
|
constructor();
|
|
@@ -192,6 +212,8 @@ type ProgressVariant = 'linear' | 'circular';
|
|
|
192
212
|
* <example-url>http://localhost:4200/#/ui/feedback/progress/linear-indeterminate</example-url>
|
|
193
213
|
*/
|
|
194
214
|
declare class CngxProgress {
|
|
215
|
+
private readonly i18n;
|
|
216
|
+
private readonly locale;
|
|
195
217
|
/** Bind an async state - reads `progress()` for determinate mode. */
|
|
196
218
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
197
219
|
/** Direct progress value (0–100). `undefined` = indeterminate. */
|
|
@@ -200,14 +222,21 @@ declare class CngxProgress {
|
|
|
200
222
|
readonly variant: _angular_core.InputSignal<ProgressVariant>;
|
|
201
223
|
/** Show percentage label next to the bar. */
|
|
202
224
|
readonly showLabel: _angular_core.InputSignal<boolean>;
|
|
203
|
-
/**
|
|
204
|
-
|
|
225
|
+
/**
|
|
226
|
+
* Screen reader label describing *what* is progressing. Unbound,
|
|
227
|
+
* `CNGX_FEEDBACK_I18N.progressLabel` applies.
|
|
228
|
+
*/
|
|
229
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
230
|
+
/** @internal */
|
|
231
|
+
protected readonly resolvedLabel: _angular_core.Signal<string>;
|
|
205
232
|
/** @internal */
|
|
206
233
|
protected readonly effectiveProgress: _angular_core.Signal<number | undefined>;
|
|
207
234
|
/** @internal */
|
|
208
235
|
protected readonly isDeterminate: _angular_core.Signal<boolean>;
|
|
209
236
|
/** @internal - `null` removes the attribute from the DOM for indeterminate mode. */
|
|
210
237
|
protected readonly ariaValueNow: _angular_core.Signal<number | null>;
|
|
238
|
+
/** @internal - the rounded percent formatted in the app locale (`42%`, `42 %`). */
|
|
239
|
+
protected readonly formattedPercent: _angular_core.Signal<string | null>;
|
|
211
240
|
/** @internal */
|
|
212
241
|
protected readonly ariaValueText: _angular_core.Signal<string | null>;
|
|
213
242
|
/** @internal */
|
|
@@ -307,7 +336,10 @@ declare class CngxAlertAction {
|
|
|
307
336
|
*/
|
|
308
337
|
declare class CngxAlert {
|
|
309
338
|
private readonly config;
|
|
339
|
+
private readonly i18n;
|
|
310
340
|
private readonly destroyRef;
|
|
341
|
+
private readonly announcer;
|
|
342
|
+
private readonly hostElement;
|
|
311
343
|
/** Alert severity - determines visual style, default icon, and ARIA role. */
|
|
312
344
|
readonly severity: _angular_core.InputSignal<AlertSeverity>;
|
|
313
345
|
/** Optional title displayed above the content. */
|
|
@@ -344,12 +376,22 @@ declare class CngxAlert {
|
|
|
344
376
|
private readonly manualDismissed;
|
|
345
377
|
private readonly autoDismissed;
|
|
346
378
|
private readonly collapsedState;
|
|
347
|
-
private readonly announcementState;
|
|
348
379
|
/** @internal - animation phase, drives host CSS classes. */
|
|
349
380
|
protected readonly visibilityPhase: _angular_core.WritableSignal<AlertVisibilityPhase>;
|
|
350
381
|
private readonly autoDismissTimer;
|
|
351
382
|
private readonly collapseTimer;
|
|
352
383
|
private animationFallbackId;
|
|
384
|
+
/**
|
|
385
|
+
* Reduced-motion via the shared kernel; environments without matchMedia
|
|
386
|
+
* (SSR, bare jsdom) count as reduced so the fallback settles immediately.
|
|
387
|
+
*/
|
|
388
|
+
private readonly motionWindow;
|
|
389
|
+
private readonly canQueryMotion;
|
|
390
|
+
private readonly prefersReducedMotion;
|
|
391
|
+
/** Active pause holds - pointer hover and focus-within count independently. */
|
|
392
|
+
private interactionHolds;
|
|
393
|
+
/** Set when interaction expanded an already-collapsed alert; release re-arms. */
|
|
394
|
+
private reCollapseOnRelease;
|
|
353
395
|
/** @internal - global icon component for the current severity (from provideFeedback config). */
|
|
354
396
|
protected readonly globalIcon: _angular_core.Signal<_angular_core.Type<unknown> | null>;
|
|
355
397
|
/** @internal - merged closable from new and deprecated input. */
|
|
@@ -369,8 +411,13 @@ declare class CngxAlert {
|
|
|
369
411
|
protected readonly isVisible: _angular_core.Signal<boolean>;
|
|
370
412
|
/** @internal - collapsed state (read-only public view). */
|
|
371
413
|
protected readonly collapsed: _angular_core.Signal<boolean>;
|
|
372
|
-
/**
|
|
373
|
-
|
|
414
|
+
/**
|
|
415
|
+
* @internal - dismiss-button name inside the alert/status host. Visibility is
|
|
416
|
+
* the only tracked source; the copy is read untracked, so a language switch
|
|
417
|
+
* never rewrites a shown alert and its next appearance speaks the new
|
|
418
|
+
* language.
|
|
419
|
+
*/
|
|
420
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
374
421
|
private readonly effectiveCollapseDelay;
|
|
375
422
|
constructor();
|
|
376
423
|
private beginEnter;
|
|
@@ -391,6 +438,13 @@ declare class CngxAlert {
|
|
|
391
438
|
protected handleFocusIn(): void;
|
|
392
439
|
/** @internal - resume timers on focus out. */
|
|
393
440
|
protected handleFocusOut(): void;
|
|
441
|
+
/**
|
|
442
|
+
* Hold-counted pause: hover and focus-within are independent holds on the
|
|
443
|
+
* same timers - leaving with the mouse must not resume auto-dismiss while
|
|
444
|
+
* keyboard focus is still inside, and vice versa.
|
|
445
|
+
*/
|
|
446
|
+
private handleInteractionStart;
|
|
447
|
+
private handleInteractionEnd;
|
|
394
448
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlert, never>;
|
|
395
449
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAlert, "cngx-alert", never, { "severity": { "alias": "severity"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "when": { "alias": "when"; "required": false; "isSignal": true; }; "autoDismissDelay": { "alias": "autoDismissDelay"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; "collapseDelay": { "alias": "collapseDelay"; "required": false; "isSignal": true; }; }, { "dismissed": "dismissed"; }, ["customIcon", "hasActions"], ["[cngxAlertIcon]", "*", "[cngxAlertAction]"], true, never>;
|
|
396
450
|
}
|
|
@@ -432,7 +486,18 @@ interface FeedbackConfig {
|
|
|
432
486
|
alertDedupWindow?: number;
|
|
433
487
|
/** Default max visible alerts per stack. */
|
|
434
488
|
alertMaxVisible?: number;
|
|
489
|
+
/**
|
|
490
|
+
* Maps a failure to the detail the state bridges and `CngxActionButton`
|
|
491
|
+
* append to their error message. Set through {@link withErrorDetail}.
|
|
492
|
+
*/
|
|
493
|
+
errorDetail?: CngxErrorDetailFn;
|
|
435
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Maps a failure to user-facing detail text, or `undefined` for none.
|
|
497
|
+
*
|
|
498
|
+
* @category ui/feedback
|
|
499
|
+
*/
|
|
500
|
+
type CngxErrorDetailFn = (error: unknown) => string | undefined;
|
|
436
501
|
/**
|
|
437
502
|
* Injection token for the global feedback configuration.
|
|
438
503
|
* Components read this with `inject(CNGX_FEEDBACK_CONFIG, { optional: true })`.
|
|
@@ -446,6 +511,10 @@ declare const CNGX_FEEDBACK_CONFIG: InjectionToken<FeedbackConfig>;
|
|
|
446
511
|
/**
|
|
447
512
|
* A feature configuration function returned by `withXxx()` helpers.
|
|
448
513
|
*
|
|
514
|
+
* Merge rule (all features): an explicitly passed option wins; an omitted
|
|
515
|
+
* option preserves the value an earlier feature wrote. No feature clears
|
|
516
|
+
* fields it was not given.
|
|
517
|
+
*
|
|
449
518
|
* @category ui/feedback
|
|
450
519
|
*/
|
|
451
520
|
interface FeedbackFeature {
|
|
@@ -615,6 +684,297 @@ declare function withAlerts(opts?: {
|
|
|
615
684
|
* @category ui/feedback
|
|
616
685
|
*/
|
|
617
686
|
declare function withBanners(): FeedbackFeature;
|
|
687
|
+
/**
|
|
688
|
+
* Map a failure to the detail text `CngxAlertOn`, `CngxToastOn`,
|
|
689
|
+
* `CngxBannerOn` (with their `*ErrorDetail` input set) and
|
|
690
|
+
* `CngxActionButton` append to the error message, through the
|
|
691
|
+
* `errorWithDetail` message of `CNGX_FEEDBACK_I18N`. Return `undefined` to
|
|
692
|
+
* show the message alone.
|
|
693
|
+
*
|
|
694
|
+
* Without this feature, development builds show the raw `Error.message` (or
|
|
695
|
+
* a thrown string) and warn once that production builds show no detail, so
|
|
696
|
+
* no untranslated server text reaches a user.
|
|
697
|
+
*
|
|
698
|
+
* ```ts
|
|
699
|
+
* provideFeedback(
|
|
700
|
+
* withToasts(),
|
|
701
|
+
* withErrorDetail((error) =>
|
|
702
|
+
* error instanceof HttpErrorResponse ? translate(`http.${error.status}`) : undefined,
|
|
703
|
+
* ),
|
|
704
|
+
* )
|
|
705
|
+
* ```
|
|
706
|
+
*
|
|
707
|
+
* @category ui/feedback
|
|
708
|
+
* @since 0.1.0
|
|
709
|
+
*/
|
|
710
|
+
declare function withErrorDetail(map: CngxErrorDetailFn): FeedbackFeature;
|
|
711
|
+
/**
|
|
712
|
+
* Inject the error-detail mapping set by {@link withErrorDetail}, or the
|
|
713
|
+
* default: the raw text in development, with one warning per app the first
|
|
714
|
+
* time it shows, and nothing in production. Call it in an injection context,
|
|
715
|
+
* then call the returned function with the error.
|
|
716
|
+
*
|
|
717
|
+
* @category ui/feedback
|
|
718
|
+
* @since 0.1.0
|
|
719
|
+
*/
|
|
720
|
+
declare function injectErrorDetail(): CngxErrorDetailFn;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Live-region copy the feedback family announces on its own behalf. Separate
|
|
724
|
+
* from the region names: these describe a transition rather than naming a
|
|
725
|
+
* landmark, so they change on a different cadence and a consumer usually
|
|
726
|
+
* translates them as one block.
|
|
727
|
+
*
|
|
728
|
+
* @category ui/feedback/i18n
|
|
729
|
+
*/
|
|
730
|
+
interface CngxFeedbackAnnouncements {
|
|
731
|
+
/** Announced when a user dismisses an alert. */
|
|
732
|
+
readonly alertDismissed: string;
|
|
733
|
+
/**
|
|
734
|
+
* Accessible name of the alert-stack overflow trigger. Receives the hidden
|
|
735
|
+
* count. Must contain the visible label from
|
|
736
|
+
* {@link CngxFeedbackAnnouncements.alertOverflowVisible} for the same count
|
|
737
|
+
* (WCAG 2.5.3 Label in Name, compared case-insensitively): a speech-input
|
|
738
|
+
* user says what they see. A dev-mode warning fires when a translated pair
|
|
739
|
+
* breaks containment.
|
|
740
|
+
*/
|
|
741
|
+
readonly alertOverflow: (count: number) => string;
|
|
742
|
+
/**
|
|
743
|
+
* Visible text of the alert-stack overflow trigger. Receives the hidden
|
|
744
|
+
* count; its output must be contained in
|
|
745
|
+
* {@link CngxFeedbackAnnouncements.alertOverflow} for the same count.
|
|
746
|
+
*/
|
|
747
|
+
readonly alertOverflowVisible: (count: number) => string;
|
|
748
|
+
/** `idle -> loading` on `CngxAsyncContainer`. */
|
|
749
|
+
readonly asyncLoading: string;
|
|
750
|
+
/** `loading -> success`. */
|
|
751
|
+
readonly asyncLoaded: string;
|
|
752
|
+
/** `loading -> error`. */
|
|
753
|
+
readonly asyncError: string;
|
|
754
|
+
/** Entering `refreshing`. */
|
|
755
|
+
readonly asyncRefreshing: string;
|
|
756
|
+
/** `refreshing -> success`. */
|
|
757
|
+
readonly asyncRefreshed: string;
|
|
758
|
+
/** `refreshing -> error`. */
|
|
759
|
+
readonly asyncRefreshFailed: string;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Feedback i18n surface. The defaults come from the `feedback` section of the
|
|
763
|
+
* language pack (English without one); {@link withFeedbackI18nLabels} inside
|
|
764
|
+
* `provideFeedback()` or {@link provideFeedbackI18n} override single keys on top.
|
|
765
|
+
* Sibling to `CNGX_STEPPER_I18N`, `CNGX_TABS_I18N` and `CNGX_CHART_I18N`.
|
|
766
|
+
*
|
|
767
|
+
* Two region names and one announcement sub-bundle. The banner outlet carries
|
|
768
|
+
* no region `aria-label`, so it gets no key - a key with no Wirkungsort is
|
|
769
|
+
* configuration for its own sake.
|
|
770
|
+
*
|
|
771
|
+
* @category ui/feedback/i18n
|
|
772
|
+
*/
|
|
773
|
+
interface CngxFeedbackI18n {
|
|
774
|
+
/** Accessible name of the `role="region"` host on `CngxAlertStack`. */
|
|
775
|
+
readonly alertsRegionLabel: string;
|
|
776
|
+
/** Accessible name of the `role="region"` host on `CngxToastOutlet`. */
|
|
777
|
+
readonly notificationsRegionLabel: string;
|
|
778
|
+
/** Live-region copy - see {@link CngxFeedbackAnnouncements}. */
|
|
779
|
+
readonly announcements: CngxFeedbackAnnouncements;
|
|
780
|
+
/** Accessible name of the dismiss button on alerts, stacked alerts, toasts and banners. */
|
|
781
|
+
readonly dismissLabel: string;
|
|
782
|
+
/** Shown in the banner's `role="alert"` slot when its action rejects. */
|
|
783
|
+
readonly bannerActionFailed: string;
|
|
784
|
+
/** Visible repeat marker on a toast raised more than once. Receives the repeat count. */
|
|
785
|
+
readonly toastRepeatCount: (count: number) => string;
|
|
786
|
+
/**
|
|
787
|
+
* Default accessible name of `CngxLoadingIndicator` and `CngxLoadingOverlay`
|
|
788
|
+
* while their `label` input is unbound.
|
|
789
|
+
*/
|
|
790
|
+
readonly loadingLabel: string;
|
|
791
|
+
/** Default accessible name of `CngxProgress` while its `label` input is unbound. */
|
|
792
|
+
readonly progressLabel: string;
|
|
793
|
+
/**
|
|
794
|
+
* `aria-valuetext` of a determinate `CngxProgress`. Receives the rounded
|
|
795
|
+
* percent (0-100) and that value already formatted as a percent in the app
|
|
796
|
+
* locale; the default returns the formatted string.
|
|
797
|
+
*/
|
|
798
|
+
readonly progressValueText: (percent: number, formatted: string) => string;
|
|
799
|
+
/**
|
|
800
|
+
* The message a state bridge (`CngxAlertOn`, `CngxToastOn`, `CngxBannerOn`)
|
|
801
|
+
* and `CngxActionButton` show for a failure with a detail: the bound error
|
|
802
|
+
* message followed by the detail `withErrorDetail` mapped from the error.
|
|
803
|
+
* One message, so a locale owns the joiner and the order.
|
|
804
|
+
*/
|
|
805
|
+
readonly errorWithDetail: (message: string, detail: string) => string;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Override shape: every top-level key optional, and `announcements` overridable
|
|
809
|
+
* key by key rather than all-or-nothing.
|
|
810
|
+
*
|
|
811
|
+
* @category ui/feedback/i18n
|
|
812
|
+
*/
|
|
813
|
+
type CngxFeedbackI18nOverrides = Partial<Omit<CngxFeedbackI18n, 'announcements'>> & {
|
|
814
|
+
readonly announcements?: Partial<CngxFeedbackAnnouncements>;
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* DI token for the feedback i18n bundle, a `Signal` so region names, labels
|
|
818
|
+
* and announcements follow a runtime language switch. `providedIn: 'root'`:
|
|
819
|
+
* the feedback section of the active language pack over the English
|
|
820
|
+
* defaults, formatted for the app locale, so a consumer who provides nothing
|
|
821
|
+
* still gets named regions.
|
|
822
|
+
*
|
|
823
|
+
* @category ui/feedback/i18n
|
|
824
|
+
* @wcag AA
|
|
825
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/config/feedback-i18n.ts
|
|
826
|
+
* @since 0.1.0
|
|
827
|
+
* @relatedTo CngxAlertStack, CngxToastOutlet
|
|
828
|
+
*/
|
|
829
|
+
declare const CNGX_FEEDBACK_I18N: InjectionToken<Signal<CngxFeedbackI18n>>;
|
|
830
|
+
/**
|
|
831
|
+
* Override the feedback region names from inside `provideFeedback()`. Unset
|
|
832
|
+
* keys keep the language pack's copy, or the English default, and
|
|
833
|
+
* `announcements` merges key by key. Pass
|
|
834
|
+
* a `Signal` to switch the language at runtime.
|
|
835
|
+
*
|
|
836
|
+
* ```ts
|
|
837
|
+
* provideFeedback(
|
|
838
|
+
* withToasts(),
|
|
839
|
+
* withAlerts(),
|
|
840
|
+
* withFeedbackI18nLabels({ alertsRegionLabel: 'Hinweise' }),
|
|
841
|
+
* )
|
|
842
|
+
* ```
|
|
843
|
+
*
|
|
844
|
+
* Contributes the token through the feature's `_providers`, so - like
|
|
845
|
+
* {@link withCloseIcon} - a second call in the same `provideFeedback()` wins
|
|
846
|
+
* over the first rather than merging with it. Pass every key in one call.
|
|
847
|
+
*
|
|
848
|
+
* @category ui/feedback/i18n
|
|
849
|
+
*/
|
|
850
|
+
declare function withFeedbackI18nLabels(overrides: CngxFeedbackI18nOverrides | Signal<CngxFeedbackI18nOverrides>): FeedbackFeature;
|
|
851
|
+
/**
|
|
852
|
+
* Provider for the feedback i18n bundle on its own, without the rest of
|
|
853
|
+
* `provideFeedback()`. This is the entry point a consumer-composed language
|
|
854
|
+
* file uses - `provideFeedback()` replaces the whole `CNGX_FEEDBACK_CONFIG`
|
|
855
|
+
* value, so routing a translation through it would reset unrelated feedback
|
|
856
|
+
* defaults the app set elsewhere. Unset keys keep the language pack's copy,
|
|
857
|
+
* or the English default, `announcements` merges key by key, and a `Signal`
|
|
858
|
+
* switches the language at runtime. For a whole language prefer the
|
|
859
|
+
* `feedback` section of a language pack (`provideCngxI18n` from
|
|
860
|
+
* `@cngx/core/i18n`); this provider overrides single keys on top of it.
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* ```ts
|
|
864
|
+
* // src/i18n/de.ts - the app's language file: every per-lib provider it uses,
|
|
865
|
+
* // composed in one const. See the "Localisation" core-concepts page for the
|
|
866
|
+
* // full recipe and the per-area entry points.
|
|
867
|
+
* export const DE: Provider[] = [
|
|
868
|
+
* provideFeedbackI18n({
|
|
869
|
+
* alertsRegionLabel: 'Hinweise',
|
|
870
|
+
* notificationsRegionLabel: 'Meldungen',
|
|
871
|
+
* announcements: { alertDismissed: 'Hinweis verworfen' },
|
|
872
|
+
* }),
|
|
873
|
+
* provideTabsI18n(withTabsI18nLabels({ tabsLabel: 'Reiter' })),
|
|
874
|
+
* provideCardI18n(withCardI18nLabels({ selected: 'Ausgewählt' })),
|
|
875
|
+
* ];
|
|
876
|
+
*
|
|
877
|
+
* bootstrapApplication(App, { providers: [...DE] });
|
|
878
|
+
* ```
|
|
879
|
+
*
|
|
880
|
+
* @category ui/feedback/i18n
|
|
881
|
+
* @since 0.1.0
|
|
882
|
+
*/
|
|
883
|
+
declare function provideFeedbackI18n(overrides: CngxFeedbackI18nOverrides | Signal<CngxFeedbackI18nOverrides>): Provider;
|
|
884
|
+
/**
|
|
885
|
+
* Inject the resolved feedback i18n bundle in an injection context: every key
|
|
886
|
+
* left at its default follows the locale of the reading site (a
|
|
887
|
+
* `provideLocaleAt` subtree), every key an override set stays. Read it inside
|
|
888
|
+
* a `computed()`, template or handler so a language switch reaches the label.
|
|
889
|
+
* One Signal per injector, bundle and locale, so row-level readers (alerts,
|
|
890
|
+
* toasts, banners) share it.
|
|
891
|
+
*
|
|
892
|
+
* @category ui/feedback/i18n
|
|
893
|
+
*/
|
|
894
|
+
declare function injectFeedbackI18n(): Signal<CngxFeedbackI18n>;
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* The live-region words of the feedback section: transitions the feedback
|
|
898
|
+
* family announces on its own behalf.
|
|
899
|
+
*
|
|
900
|
+
* @category ui/feedback/i18n
|
|
901
|
+
* @since 0.1.0
|
|
902
|
+
*/
|
|
903
|
+
interface CngxFeedbackAnnouncementsLanguage {
|
|
904
|
+
/** Announced when a user dismisses an alert. */
|
|
905
|
+
readonly alertDismissed: string;
|
|
906
|
+
/**
|
|
907
|
+
* Plural on `{count}`: accessible name of the alert-stack overflow trigger.
|
|
908
|
+
* Must contain {@link CngxFeedbackAnnouncementsLanguage.alertOverflowVisible}
|
|
909
|
+
* for the same count (WCAG 2.5.3 Label in Name).
|
|
910
|
+
*/
|
|
911
|
+
readonly alertOverflow: CngxMessage;
|
|
912
|
+
/** `{count}`: visible text of the alert-stack overflow trigger. */
|
|
913
|
+
readonly alertOverflowVisible: CngxMessage;
|
|
914
|
+
/** `idle -> loading` on `CngxAsyncContainer`. */
|
|
915
|
+
readonly asyncLoading: string;
|
|
916
|
+
/** `loading -> success`. */
|
|
917
|
+
readonly asyncLoaded: string;
|
|
918
|
+
/** `loading -> error`. */
|
|
919
|
+
readonly asyncError: string;
|
|
920
|
+
/** Entering `refreshing`. */
|
|
921
|
+
readonly asyncRefreshing: string;
|
|
922
|
+
/** `refreshing -> success`. */
|
|
923
|
+
readonly asyncRefreshed: string;
|
|
924
|
+
/** `refreshing -> error`. */
|
|
925
|
+
readonly asyncRefreshFailed: string;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* The feedback section of a {@link CngxLanguagePack}: the copy of
|
|
929
|
+
* `@cngx/ui/feedback` (alerts, toasts, banners, loading surfaces, the async
|
|
930
|
+
* container and the state bridges). It feeds `CNGX_FEEDBACK_I18N`. Messages
|
|
931
|
+
* use `{name}` placeholders; a plural message picks its form from `{count}`.
|
|
932
|
+
*
|
|
933
|
+
* @category ui/feedback/i18n
|
|
934
|
+
* @since 0.1.0
|
|
935
|
+
* @relatedTo CNGX_FEEDBACK_I18N
|
|
936
|
+
*/
|
|
937
|
+
interface CngxFeedbackLanguageSection {
|
|
938
|
+
/** Accessible name of the alert-stack region. */
|
|
939
|
+
readonly alertsRegionLabel: string;
|
|
940
|
+
/** Accessible name of the toast-outlet region. */
|
|
941
|
+
readonly notificationsRegionLabel: string;
|
|
942
|
+
/** Accessible name of every dismiss button. */
|
|
943
|
+
readonly dismissLabel: string;
|
|
944
|
+
/** Shown in the banner's alert slot when its action rejects. */
|
|
945
|
+
readonly bannerActionFailed: string;
|
|
946
|
+
/** `{count}`: visible repeat marker on a toast raised more than once. */
|
|
947
|
+
readonly toastRepeatCount: CngxMessage;
|
|
948
|
+
/** Default accessible name of the loading indicator and overlay. */
|
|
949
|
+
readonly loadingLabel: string;
|
|
950
|
+
/** Default accessible name of `CngxProgress`. */
|
|
951
|
+
readonly progressLabel: string;
|
|
952
|
+
/**
|
|
953
|
+
* `{value}` (the percent formatted in the locale, `42%`), `{percent}` (the
|
|
954
|
+
* rounded number): `aria-valuetext` of a determinate `CngxProgress`.
|
|
955
|
+
*/
|
|
956
|
+
readonly progressValueText: CngxMessage;
|
|
957
|
+
/**
|
|
958
|
+
* `{message}`, `{detail}`: an error message of a state bridge followed by
|
|
959
|
+
* the mapped error detail.
|
|
960
|
+
*/
|
|
961
|
+
readonly errorWithDetail: CngxMessage;
|
|
962
|
+
readonly announcements: CngxFeedbackAnnouncementsLanguage;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* The English feedback section: the single source of the feedback family's
|
|
966
|
+
* English copy. `CNGX_FEEDBACK_I18N` defaults to it.
|
|
967
|
+
*
|
|
968
|
+
* @category ui/feedback/i18n
|
|
969
|
+
* @since 0.1.0
|
|
970
|
+
* @relatedTo CNGX_FEEDBACK_I18N
|
|
971
|
+
*/
|
|
972
|
+
declare const CNGX_FEEDBACK_LANGUAGE_EN: CngxFeedbackLanguageSection;
|
|
973
|
+
declare module '@cngx/core/i18n' {
|
|
974
|
+
interface CngxLanguagePack {
|
|
975
|
+
readonly feedback: CngxFeedbackLanguageSection;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
618
978
|
|
|
619
979
|
/**
|
|
620
980
|
* Configuration for a programmatic alert.
|
|
@@ -628,9 +988,19 @@ interface AlertConfig {
|
|
|
628
988
|
severity?: AlertSeverity;
|
|
629
989
|
/** Optional bold title above the message. */
|
|
630
990
|
title?: string;
|
|
631
|
-
/**
|
|
991
|
+
/**
|
|
992
|
+
* Whether the alert persists until explicitly dismissed.
|
|
993
|
+
* Defaults to `true` unless a `duration` is passed or
|
|
994
|
+
* `withAlerts({ defaultDuration })` is configured. `error` alerts always
|
|
995
|
+
* default to persistent (matching the toaster) - opt out with an explicit
|
|
996
|
+
* `duration` or `persistent: false`.
|
|
997
|
+
*/
|
|
632
998
|
persistent?: boolean;
|
|
633
|
-
/**
|
|
999
|
+
/**
|
|
1000
|
+
* Auto-dismiss duration in ms. Setting it implies `persistent: false`.
|
|
1001
|
+
* Non-persistent alerts without a duration fall back to
|
|
1002
|
+
* `withAlerts({ defaultDuration })`, then 5000ms.
|
|
1003
|
+
*/
|
|
634
1004
|
duration?: number;
|
|
635
1005
|
/** Show a dismiss button. Default `true`. */
|
|
636
1006
|
dismissible?: boolean;
|
|
@@ -649,7 +1019,8 @@ interface AlertRef {
|
|
|
649
1019
|
afterDismissed(): Observable<void>;
|
|
650
1020
|
}
|
|
651
1021
|
/**
|
|
652
|
-
*
|
|
1022
|
+
* Tracked state for a single alert - the element type of the public
|
|
1023
|
+
* `CngxAlerter.alerts` signal. Immutable per slot; treat as read-only.
|
|
653
1024
|
*
|
|
654
1025
|
* @category ui/feedback/alert
|
|
655
1026
|
*/
|
|
@@ -657,6 +1028,10 @@ interface AlertState {
|
|
|
657
1028
|
readonly id: number;
|
|
658
1029
|
readonly config: Required<Pick<AlertConfig, 'message' | 'severity' | 'dismissible' | 'persistent'>> & Pick<AlertConfig, 'title' | 'duration' | 'scope'>;
|
|
659
1030
|
readonly createdAt: number;
|
|
1031
|
+
/**
|
|
1032
|
+
* @internal - library-owned dismissal lifecycle. Never call `next()` or
|
|
1033
|
+
* `complete()` from consumer code; observe via `AlertRef.afterDismissed()`.
|
|
1034
|
+
*/
|
|
660
1035
|
readonly dismissed$: Subject<void>;
|
|
661
1036
|
}
|
|
662
1037
|
/**
|
|
@@ -686,26 +1061,54 @@ declare class CngxAlerter {
|
|
|
686
1061
|
readonly alerts: _angular_core.WritableSignal<readonly AlertState[]>;
|
|
687
1062
|
private readonly dedupWindow;
|
|
688
1063
|
private readonly defaultDuration;
|
|
1064
|
+
/** Auto-dismiss timers keyed by alert id - not part of the public state shape. */
|
|
1065
|
+
private readonly timers;
|
|
689
1066
|
constructor();
|
|
690
1067
|
/** Show an alert. Returns a ref for programmatic dismiss. */
|
|
691
1068
|
show(config: AlertConfig): AlertRef;
|
|
1069
|
+
/**
|
|
1070
|
+
* @internal - called by `CngxAlertStack` on hover/focus (WCAG 2.2.1).
|
|
1071
|
+
* Hold-counted: hover and focus-within pause independently; the timer
|
|
1072
|
+
* resumes only when the last hold releases.
|
|
1073
|
+
*/
|
|
1074
|
+
pauseTimer(id: number): void;
|
|
1075
|
+
/** @internal - called by `CngxAlertStack` on pointer-leave/focus-out. */
|
|
1076
|
+
resumeTimer(id: number): void;
|
|
692
1077
|
/** Dismiss a single alert by id. */
|
|
693
1078
|
dismiss(id: number): void;
|
|
694
1079
|
/** Dismiss all alerts (optionally filtered by scope). */
|
|
695
1080
|
dismissAll(scope?: string): void;
|
|
1081
|
+
private startTimer;
|
|
1082
|
+
private clearTimer;
|
|
696
1083
|
private createRef;
|
|
697
1084
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlerter, never>;
|
|
698
1085
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxAlerter>;
|
|
699
1086
|
}
|
|
700
1087
|
|
|
1088
|
+
/** @internal - one rendered alert plus the service instance that owns it. */
|
|
1089
|
+
interface StackEntry {
|
|
1090
|
+
/** Render-stable key - service-local ids collide across instances. */
|
|
1091
|
+
readonly key: string;
|
|
1092
|
+
readonly state: AlertState;
|
|
1093
|
+
readonly owner: CngxAlerter;
|
|
1094
|
+
}
|
|
701
1095
|
/**
|
|
702
|
-
* Scoped alert stack - renders alerts from its own `CngxAlerter` instance
|
|
1096
|
+
* Scoped alert stack - renders alerts from its own `CngxAlerter` instance
|
|
1097
|
+
* merged with the nearest ancestor/environment instance.
|
|
1098
|
+
*
|
|
1099
|
+
* Provides `CngxAlerter` via `viewProviders` - the stack's own instance is
|
|
1100
|
+
* private to its view. Alerts shown through an ancestor-provided alerter or
|
|
1101
|
+
* the environment alerter from `provideFeedback(withAlerts())` (the instance
|
|
1102
|
+
* `CngxAlertOn` and sibling components resolve) render here too, filtered by
|
|
1103
|
+
* `[scope]`. Nesting is supported - each stack stays independent.
|
|
703
1104
|
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
1105
|
+
* Scope your stacks when more than one is mounted: two unscoped stacks
|
|
1106
|
+
* under the same environment alerter both render (and announce) every
|
|
1107
|
+
* shared alert.
|
|
707
1108
|
*
|
|
708
1109
|
* ### In a dialog
|
|
1110
|
+
* The dialog component and the stack resolve the same environment alerter,
|
|
1111
|
+
* so programmatic alerts land in the stack below:
|
|
709
1112
|
* ```html
|
|
710
1113
|
* <dialog cngxDialog [submitAction]="save">
|
|
711
1114
|
* <header cngxDialogTitle>Edit user</header>
|
|
@@ -715,12 +1118,16 @@ declare class CngxAlerter {
|
|
|
715
1118
|
* ```
|
|
716
1119
|
*
|
|
717
1120
|
* ### Programmatic usage
|
|
1121
|
+
* Requires `provideFeedback(withAlerts())` (or an ancestor component that
|
|
1122
|
+
* provides `CngxAlerter`):
|
|
718
1123
|
* ```typescript
|
|
719
1124
|
* private readonly alerter = inject(CngxAlerter);
|
|
720
1125
|
*
|
|
721
1126
|
* handleErrors(errors: string[]) {
|
|
722
|
-
* this.alerter.dismissAll();
|
|
723
|
-
* errors.forEach(e =>
|
|
1127
|
+
* this.alerter.dismissAll('user-form');
|
|
1128
|
+
* errors.forEach(e =>
|
|
1129
|
+
* this.alerter.show({ message: e, severity: 'error', scope: 'user-form' }),
|
|
1130
|
+
* );
|
|
724
1131
|
* }
|
|
725
1132
|
* ```
|
|
726
1133
|
*
|
|
@@ -738,30 +1145,64 @@ declare class CngxAlerter {
|
|
|
738
1145
|
declare class CngxAlertStack {
|
|
739
1146
|
/** The scoped alerter instance - use to add/dismiss alerts programmatically. */
|
|
740
1147
|
readonly alerter: CngxAlerter;
|
|
1148
|
+
/**
|
|
1149
|
+
* Nearest ancestor/environment alerter - the instance `CngxAlertOn` and
|
|
1150
|
+
* sibling components resolve. Merged into the rendered stack so the
|
|
1151
|
+
* documented `withAlerts()` routing actually lands somewhere.
|
|
1152
|
+
*/
|
|
1153
|
+
private readonly parentAlerter;
|
|
741
1154
|
private readonly config;
|
|
1155
|
+
private readonly i18n;
|
|
1156
|
+
/** @internal - region name of the plain `role="region"` host; follows a switch at once. */
|
|
1157
|
+
protected readonly regionLabel: _angular_core.Signal<string>;
|
|
1158
|
+
private readonly host;
|
|
1159
|
+
private readonly injector;
|
|
742
1160
|
/** Scope filter - only shows alerts matching this scope. */
|
|
743
1161
|
readonly scope: _angular_core.InputSignal<string | undefined>;
|
|
744
|
-
/** Maximum visible alerts before collapse overflow. */
|
|
745
|
-
readonly maxVisible: _angular_core.InputSignal<number>;
|
|
1162
|
+
/** Maximum visible alerts before collapse overflow. Defaults to `withAlerts({ maxVisible })`, then 5. */
|
|
1163
|
+
readonly maxVisible: _angular_core.InputSignal<number | undefined>;
|
|
746
1164
|
/** Where new alerts appear. */
|
|
747
1165
|
readonly position: _angular_core.InputSignal<"top" | "bottom">;
|
|
748
1166
|
/** Reserve min-height for one alert to prevent layout shift. */
|
|
749
1167
|
readonly reserveSpace: _angular_core.InputSignal<boolean>;
|
|
750
1168
|
/** Auto-scroll stack into view when new alert appears. */
|
|
751
1169
|
readonly autoScroll: _angular_core.InputSignal<boolean>;
|
|
1170
|
+
/** @internal - maxVisible input, then withAlerts({ maxVisible }), then 5. */
|
|
1171
|
+
private readonly effectiveMaxVisible;
|
|
752
1172
|
/** @internal - expanded state. Resets when alert count drops to maxVisible or below. */
|
|
753
1173
|
private readonly expanded;
|
|
754
|
-
/** @internal - alerts filtered
|
|
755
|
-
private readonly
|
|
756
|
-
/** @internal -
|
|
757
|
-
protected readonly
|
|
1174
|
+
/** @internal - own + ancestor alerts, scope-filtered, newest first. */
|
|
1175
|
+
private readonly entries;
|
|
1176
|
+
/** @internal - entries within maxVisible, ordered per [position]. */
|
|
1177
|
+
protected readonly visibleEntries: _angular_core.Signal<readonly StackEntry[]>;
|
|
1178
|
+
/**
|
|
1179
|
+
* @internal - dismiss-button name inside the alert/status items. The visible
|
|
1180
|
+
* entries are the only tracked source; the copy is read untracked, so a
|
|
1181
|
+
* language switch never rewrites a shown item and the next stack change
|
|
1182
|
+
* picks it up.
|
|
1183
|
+
*/
|
|
1184
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
758
1185
|
/** @internal - number of hidden overflow alerts. */
|
|
759
1186
|
protected readonly overflowCount: _angular_core.Signal<number>;
|
|
760
|
-
/** @internal -
|
|
761
|
-
protected readonly
|
|
1187
|
+
/** @internal - accessible name of the overflow trigger. */
|
|
1188
|
+
protected readonly overflowLabel: _angular_core.Signal<string>;
|
|
1189
|
+
/** @internal - visible text of the overflow trigger, contained in its accessible name. */
|
|
1190
|
+
protected readonly overflowVisibleLabel: _angular_core.Signal<string>;
|
|
1191
|
+
/**
|
|
1192
|
+
* @internal - arrival detection derived via linkedSignal (not managed in
|
|
1193
|
+
* the effect). `arrived` is true only when a key shows up that was not
|
|
1194
|
+
* rendered before - a dismissal exposing an older neighbour is not an
|
|
1195
|
+
* arrival. The initial computation (mount with pre-existing alerts) never
|
|
1196
|
+
* counts as one.
|
|
1197
|
+
*/
|
|
1198
|
+
private readonly arrivalTransition;
|
|
1199
|
+
constructor();
|
|
762
1200
|
/** @internal - resolve icon component from global config. */
|
|
763
1201
|
protected iconFor(alert: AlertState): _angular_core.Type<unknown> | null;
|
|
764
|
-
/**
|
|
1202
|
+
/**
|
|
1203
|
+
* @internal - the overflow button removes itself on expansion, so focus is
|
|
1204
|
+
* handed to the first newly revealed alert item instead of falling to body.
|
|
1205
|
+
*/
|
|
765
1206
|
protected handleExpandOverflow(): void;
|
|
766
1207
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlertStack, never>;
|
|
767
1208
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAlertStack, "cngx-alert-stack", never, { "scope": { "alias": "scope"; "required": false; "isSignal": true; }; "maxVisible": { "alias": "maxVisible"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "reserveSpace": { "alias": "reserveSpace"; "required": false; "isSignal": true; }; "autoScroll": { "alias": "autoScroll"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -770,9 +1211,14 @@ declare class CngxAlertStack {
|
|
|
770
1211
|
/**
|
|
771
1212
|
* Declarative state-to-alert bridge for scoped alert stacks.
|
|
772
1213
|
*
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
1214
|
+
* Fires an alert when the bound `CngxAsyncState` transitions to `error`
|
|
1215
|
+
* (or optionally `success`). Only fires on actual transitions, not on
|
|
1216
|
+
* initial `idle` state.
|
|
1217
|
+
*
|
|
1218
|
+
* Alerts route through the injected `CngxAlerter` - the environment
|
|
1219
|
+
* instance from `provideFeedback(withAlerts())` or one provided by an
|
|
1220
|
+
* ancestor component. Every `CngxAlertStack` that resolves the same
|
|
1221
|
+
* instance renders them, filtered by scope:
|
|
776
1222
|
*
|
|
777
1223
|
* ```html
|
|
778
1224
|
* <cngx-alert-stack scope="form" />
|
|
@@ -780,6 +1226,7 @@ declare class CngxAlertStack {
|
|
|
780
1226
|
* <button [cngxAsyncClick]="save"
|
|
781
1227
|
* [cngxAlertOn]="saveState"
|
|
782
1228
|
* alertError="Save failed"
|
|
1229
|
+
* alertScope="form"
|
|
783
1230
|
* [alertErrorDetail]="true">
|
|
784
1231
|
* Save
|
|
785
1232
|
* </button>
|
|
@@ -795,6 +1242,8 @@ declare class CngxAlertStack {
|
|
|
795
1242
|
declare class CngxAlertOn {
|
|
796
1243
|
private readonly alerter;
|
|
797
1244
|
private readonly statefulFallback;
|
|
1245
|
+
private readonly errorDetail;
|
|
1246
|
+
private readonly i18n;
|
|
798
1247
|
/**
|
|
799
1248
|
* The async state to watch. Optional - when omitted, falls back to
|
|
800
1249
|
* `CNGX_STATEFUL` from an ancestor/self component. A bare `cngxAlertOn`
|
|
@@ -807,7 +1256,11 @@ declare class CngxAlertOn {
|
|
|
807
1256
|
readonly alertSuccess: _angular_core.InputSignal<string | undefined>;
|
|
808
1257
|
/** Alert message on error. If not set, no error alert fires. */
|
|
809
1258
|
readonly alertError: _angular_core.InputSignal<string | undefined>;
|
|
810
|
-
/**
|
|
1259
|
+
/**
|
|
1260
|
+
* Append the error detail to the alert message, as mapped by
|
|
1261
|
+
* `withErrorDetail` (default: the raw error text in development builds,
|
|
1262
|
+
* nothing in production).
|
|
1263
|
+
*/
|
|
811
1264
|
readonly alertErrorDetail: _angular_core.InputSignal<boolean>;
|
|
812
1265
|
/** Scope for the alert - matches against `CngxAlertStack`'s `[scope]` input. */
|
|
813
1266
|
readonly alertScope: _angular_core.InputSignal<string | undefined>;
|
|
@@ -948,6 +1401,18 @@ declare class CngxBanner {
|
|
|
948
1401
|
declare class CngxBannerOutlet {
|
|
949
1402
|
protected readonly service: CngxBanner;
|
|
950
1403
|
private readonly config;
|
|
1404
|
+
private readonly i18n;
|
|
1405
|
+
/**
|
|
1406
|
+
* @internal - action-error copy for the `role="alert"` slot. The banner list is the
|
|
1407
|
+
* only tracked source; the copy is read untracked, so a copy flip never rewrites a
|
|
1408
|
+
* shown alert and the next banner transition picks the new language up.
|
|
1409
|
+
*/
|
|
1410
|
+
protected readonly actionFailedCopy: _angular_core.Signal<string>;
|
|
1411
|
+
/**
|
|
1412
|
+
* @internal - dismiss-button name inside the banner live regions, keyed on the
|
|
1413
|
+
* banner list like {@link actionFailedCopy}.
|
|
1414
|
+
*/
|
|
1415
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
951
1416
|
/**
|
|
952
1417
|
* @internal - skip enter animation for banners present at first render.
|
|
953
1418
|
* Prevents layout jump when banners are known before first paint (e.g., offline state).
|
|
@@ -986,6 +1451,8 @@ declare class CngxBannerOutlet {
|
|
|
986
1451
|
declare class CngxBannerOn {
|
|
987
1452
|
private readonly bannerService;
|
|
988
1453
|
private readonly statefulFallback;
|
|
1454
|
+
private readonly errorDetail;
|
|
1455
|
+
private readonly i18n;
|
|
989
1456
|
/**
|
|
990
1457
|
* The async state to watch. Optional - when omitted, falls back to
|
|
991
1458
|
* `CNGX_STATEFUL` from an ancestor/self component. A bare `cngxBannerOn`
|
|
@@ -1000,7 +1467,11 @@ declare class CngxBannerOn {
|
|
|
1000
1467
|
readonly bannerError: _angular_core.InputSignal<string | undefined>;
|
|
1001
1468
|
/** Banner severity on error. Default `'error'`. */
|
|
1002
1469
|
readonly bannerSeverity: _angular_core.InputSignal<"warning" | "error">;
|
|
1003
|
-
/**
|
|
1470
|
+
/**
|
|
1471
|
+
* Append the error detail to the banner message, as mapped by
|
|
1472
|
+
* `withErrorDetail` (default: the raw error text in development builds,
|
|
1473
|
+
* nothing in production).
|
|
1474
|
+
*/
|
|
1004
1475
|
readonly bannerErrorDetail: _angular_core.InputSignal<boolean>;
|
|
1005
1476
|
constructor();
|
|
1006
1477
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBannerOn, never>;
|
|
@@ -1047,7 +1518,12 @@ declare class CngxBannerTrigger {
|
|
|
1047
1518
|
readonly when: _angular_core.InputSignal<boolean>;
|
|
1048
1519
|
/** Banner message text. */
|
|
1049
1520
|
readonly message: _angular_core.InputSignal<string>;
|
|
1050
|
-
/**
|
|
1521
|
+
/**
|
|
1522
|
+
* Required unique id - dedup key, shared by design. Any code (or another
|
|
1523
|
+
* trigger) using the same id updates and dismisses the same banner; there
|
|
1524
|
+
* is no per-instance guard. Namespace ids (`net:offline`, `auth:session`)
|
|
1525
|
+
* to avoid unintended collisions.
|
|
1526
|
+
*/
|
|
1051
1527
|
readonly id: _angular_core.InputSignal<string>;
|
|
1052
1528
|
/** Visual severity. */
|
|
1053
1529
|
readonly severity: _angular_core.InputSignal<AlertSeverity>;
|
|
@@ -1057,6 +1533,8 @@ declare class CngxBannerTrigger {
|
|
|
1057
1533
|
readonly actionLabel: _angular_core.InputSignal<string | undefined>;
|
|
1058
1534
|
/** Action button handler. */
|
|
1059
1535
|
readonly actionHandler: _angular_core.InputSignal<(() => void | Promise<void>) | undefined>;
|
|
1536
|
+
/** @internal - id transition derived via linkedSignal, not managed in the effect. */
|
|
1537
|
+
private readonly idTransition;
|
|
1060
1538
|
constructor();
|
|
1061
1539
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBannerTrigger, never>;
|
|
1062
1540
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxBannerTrigger, "cngx-banner-trigger", never, { "when": { "alias": "when"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": true; "isSignal": true; }; "id": { "alias": "id"; "required": true; "isSignal": true; }; "severity": { "alias": "severity"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "actionLabel": { "alias": "actionLabel"; "required": false; "isSignal": true; }; "actionHandler": { "alias": "actionHandler"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -1094,7 +1572,7 @@ interface ToastConfig {
|
|
|
1094
1572
|
/** Show dismiss button. */
|
|
1095
1573
|
dismissible?: boolean;
|
|
1096
1574
|
/**
|
|
1097
|
-
* Custom component rendered as the toast body
|
|
1575
|
+
* Custom component rendered as the toast body.
|
|
1098
1576
|
* Replaces the default `message`/`description` text.
|
|
1099
1577
|
* `title` is still rendered above the component if set.
|
|
1100
1578
|
*
|
|
@@ -1104,6 +1582,13 @@ interface ToastConfig {
|
|
|
1104
1582
|
content?: Type<unknown>;
|
|
1105
1583
|
/** Inputs passed to the `content` component via `NgComponentOutlet`. */
|
|
1106
1584
|
contentInputs?: Record<string, unknown>;
|
|
1585
|
+
/**
|
|
1586
|
+
* Template rendered as the toast body - takes precedence over `content`
|
|
1587
|
+
* and `message`. `CngxToast` passes its projected content through here.
|
|
1588
|
+
*
|
|
1589
|
+
* A11y: same rule as `content` - avoid focusable elements inside.
|
|
1590
|
+
*/
|
|
1591
|
+
contentTemplate?: TemplateRef<unknown>;
|
|
1107
1592
|
}
|
|
1108
1593
|
/**
|
|
1109
1594
|
* Handle to a displayed toast - allows programmatic dismiss.
|
|
@@ -1117,25 +1602,23 @@ interface ToastRef {
|
|
|
1117
1602
|
afterDismissed(): Observable<void>;
|
|
1118
1603
|
}
|
|
1119
1604
|
/**
|
|
1120
|
-
*
|
|
1605
|
+
* Tracked state for a single toast - the element type of the public
|
|
1606
|
+
* `CngxToaster.toasts` signal. Immutable per slot; treat as read-only.
|
|
1121
1607
|
*
|
|
1122
1608
|
* @category ui/feedback/toast
|
|
1123
1609
|
*/
|
|
1124
1610
|
interface ToastState {
|
|
1125
1611
|
readonly id: number;
|
|
1126
|
-
readonly config: Required<Pick<ToastConfig, 'message' | 'severity' | 'dismissible'>> & Pick<ToastConfig, 'action' | 'title' | 'description' | 'content' | 'contentInputs'> & {
|
|
1612
|
+
readonly config: Required<Pick<ToastConfig, 'message' | 'severity' | 'dismissible'>> & Pick<ToastConfig, 'action' | 'title' | 'description' | 'content' | 'contentInputs' | 'contentTemplate'> & {
|
|
1127
1613
|
duration: number | 'persistent';
|
|
1128
1614
|
};
|
|
1129
1615
|
readonly createdAt: number;
|
|
1130
|
-
/** Timestamp when the current timer started (created or last resumed). */
|
|
1131
|
-
readonly timerStartedAt: number;
|
|
1132
1616
|
/** Dedup counter - incremented when identical toast fires again. */
|
|
1133
1617
|
readonly count: number;
|
|
1134
|
-
/**
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
/** Subject that emits on dismiss. */
|
|
1618
|
+
/**
|
|
1619
|
+
* @internal - library-owned dismissal lifecycle. Never call `next()` or
|
|
1620
|
+
* `complete()` from consumer code; observe via `ToastRef.afterDismissed()`.
|
|
1621
|
+
*/
|
|
1139
1622
|
readonly dismissed$: Subject<void>;
|
|
1140
1623
|
}
|
|
1141
1624
|
/**
|
|
@@ -1165,14 +1648,20 @@ declare class CngxToaster {
|
|
|
1165
1648
|
private nextId;
|
|
1166
1649
|
/** Reactive toast stack - read by `CngxToastOutlet`. */
|
|
1167
1650
|
readonly toasts: _angular_core.WritableSignal<readonly ToastState[]>;
|
|
1168
|
-
/** Default duration for non-error toasts
|
|
1169
|
-
readonly defaultDuration
|
|
1170
|
-
/** Dedup window in ms -
|
|
1171
|
-
readonly dedupWindow
|
|
1651
|
+
/** Default duration for non-error toasts - configure via `withToasts({ defaultDuration })`. */
|
|
1652
|
+
private readonly defaultDuration;
|
|
1653
|
+
/** Dedup window in ms - configure via `withToasts({ dedupWindow })`. */
|
|
1654
|
+
private readonly dedupWindow;
|
|
1655
|
+
/** Auto-dismiss timers keyed by toast id - not part of the public state shape. */
|
|
1656
|
+
private readonly timers;
|
|
1172
1657
|
constructor();
|
|
1173
1658
|
/** Show a toast. Returns a ref for programmatic control. */
|
|
1174
1659
|
show(config: ToastConfig): ToastRef;
|
|
1175
|
-
/**
|
|
1660
|
+
/**
|
|
1661
|
+
* @internal - called by toast-outlet on hover/focus (WCAG 2.2.1).
|
|
1662
|
+
* Hold-counted: hover and focus-within pause independently; the timer
|
|
1663
|
+
* resumes only when the last hold releases.
|
|
1664
|
+
*/
|
|
1176
1665
|
pauseTimer(id: number): void;
|
|
1177
1666
|
/** @internal - called by toast-outlet on mouse-leave/focus-out. */
|
|
1178
1667
|
resumeTimer(id: number): void;
|
|
@@ -1181,6 +1670,7 @@ declare class CngxToaster {
|
|
|
1181
1670
|
/** Dismiss all toasts. */
|
|
1182
1671
|
dismissAll(): void;
|
|
1183
1672
|
private startTimer;
|
|
1673
|
+
private clearTimer;
|
|
1184
1674
|
private createRef;
|
|
1185
1675
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxToaster, never>;
|
|
1186
1676
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxToaster>;
|
|
@@ -1211,6 +1701,10 @@ type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | '
|
|
|
1211
1701
|
* Place once in the app shell. Reads from `CngxToaster` reactively.
|
|
1212
1702
|
* Requires `provideToasts()` or `provideFeedback(withToasts())`.
|
|
1213
1703
|
*
|
|
1704
|
+
* One outlet per toaster instance: projected toast bodies (`CngxToast`
|
|
1705
|
+
* content) are captured as templates whose DOM nodes exist exactly once -
|
|
1706
|
+
* a second outlet on the same toaster renders those bodies empty.
|
|
1707
|
+
*
|
|
1214
1708
|
* ```html
|
|
1215
1709
|
* <cngx-toast-outlet position="bottom-end" [maxVisible]="5" />
|
|
1216
1710
|
* ```
|
|
@@ -1233,15 +1727,29 @@ type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | '
|
|
|
1233
1727
|
declare class CngxToastOutlet {
|
|
1234
1728
|
protected readonly service: CngxToaster;
|
|
1235
1729
|
private readonly config;
|
|
1730
|
+
private readonly i18n;
|
|
1731
|
+
/**
|
|
1732
|
+
* @internal - repeat-marker formatter for toasts, which are live regions. The toast
|
|
1733
|
+
* list is the only tracked source; the formatter is read untracked, so a copy flip
|
|
1734
|
+
* never rewrites a shown toast and the next toast transition picks it up.
|
|
1735
|
+
*/
|
|
1736
|
+
protected readonly repeatCount: _angular_core.Signal<(count: number) => string>;
|
|
1737
|
+
/**
|
|
1738
|
+
* @internal - dismiss-button name inside the toast live regions, keyed on the
|
|
1739
|
+
* toast list like {@link repeatCount}.
|
|
1740
|
+
*/
|
|
1741
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
1742
|
+
/** @internal - region name of the plain `role="region"` host; follows a switch at once. */
|
|
1743
|
+
protected readonly regionLabel: _angular_core.Signal<string>;
|
|
1236
1744
|
/** Stack position. */
|
|
1237
1745
|
readonly position: _angular_core.InputSignal<ToastPosition>;
|
|
1238
1746
|
/** Maximum visible toasts - oldest are evicted. */
|
|
1239
1747
|
readonly maxVisible: _angular_core.InputSignal<number>;
|
|
1240
1748
|
/** Insert new toasts at start or end of the stack. */
|
|
1241
|
-
readonly insertPosition: _angular_core.InputSignal<"
|
|
1749
|
+
readonly insertPosition: _angular_core.InputSignal<"end" | "start">;
|
|
1242
1750
|
/** @internal */
|
|
1243
1751
|
protected readonly positionClass: _angular_core.Signal<string>;
|
|
1244
|
-
/** @internal - slice to maxVisible, respecting insert position. */
|
|
1752
|
+
/** @internal - slice to maxVisible, respecting insert position. ToastState is immutable per slot. */
|
|
1245
1753
|
protected readonly visibleToasts: _angular_core.Signal<readonly ToastState[]>;
|
|
1246
1754
|
/** @internal - resolve icon component from global config or null. */
|
|
1247
1755
|
protected iconFor(toast: ToastState): _angular_core.Type<unknown> | null;
|
|
@@ -1293,6 +1801,8 @@ declare class CngxToastOutlet {
|
|
|
1293
1801
|
declare class CngxToastOn {
|
|
1294
1802
|
private readonly toast;
|
|
1295
1803
|
private readonly statefulFallback;
|
|
1804
|
+
private readonly errorDetail;
|
|
1805
|
+
private readonly i18n;
|
|
1296
1806
|
private readonly toastService;
|
|
1297
1807
|
/**
|
|
1298
1808
|
* The async state to watch. Optional - when omitted, the bridge falls back
|
|
@@ -1307,7 +1817,11 @@ declare class CngxToastOn {
|
|
|
1307
1817
|
readonly toastSuccess: _angular_core.InputSignal<string | undefined>;
|
|
1308
1818
|
/** Toast message on error. If not set, no error toast fires. */
|
|
1309
1819
|
readonly toastError: _angular_core.InputSignal<string | undefined>;
|
|
1310
|
-
/**
|
|
1820
|
+
/**
|
|
1821
|
+
* Append the error detail to the toast message, as mapped by
|
|
1822
|
+
* `withErrorDetail` (default: the raw error text in development builds,
|
|
1823
|
+
* nothing in production).
|
|
1824
|
+
*/
|
|
1311
1825
|
readonly toastErrorDetail: _angular_core.InputSignal<boolean>;
|
|
1312
1826
|
/** Duration for success toasts in ms. */
|
|
1313
1827
|
readonly toastSuccessDuration: _angular_core.InputSignal<number>;
|
|
@@ -1332,9 +1846,14 @@ declare class CngxToastOn {
|
|
|
1332
1846
|
* ```
|
|
1333
1847
|
*
|
|
1334
1848
|
* ### With custom content
|
|
1849
|
+
* Projected content replaces `message` as the toast body. Keep it
|
|
1850
|
+
* non-interactive - the toast renders inside a live region, where focusable
|
|
1851
|
+
* elements are unreachable for screen reader users. For a button, use
|
|
1852
|
+
* `actionLabel`/`actionHandler` instead.
|
|
1335
1853
|
* ```html
|
|
1336
|
-
* <cngx-toast severity="error" [when]="hasError()"
|
|
1337
|
-
*
|
|
1854
|
+
* <cngx-toast severity="error" [when]="hasError()"
|
|
1855
|
+
* actionLabel="Retry" [actionHandler]="retry">
|
|
1856
|
+
* Something went <strong>wrong</strong>.
|
|
1338
1857
|
* </cngx-toast>
|
|
1339
1858
|
* ```
|
|
1340
1859
|
*
|
|
@@ -1373,12 +1892,29 @@ declare class CngxToast {
|
|
|
1373
1892
|
/** Action button config. */
|
|
1374
1893
|
readonly actionLabel: _angular_core.InputSignal<string | undefined>;
|
|
1375
1894
|
readonly actionHandler: _angular_core.InputSignal<(() => void) | undefined>;
|
|
1895
|
+
/** Emitted when the shown toast is dismissed (auto, manual, or falling edge). */
|
|
1896
|
+
readonly dismissed: _angular_core.OutputEmitterRef<void>;
|
|
1376
1897
|
/** @internal */
|
|
1377
1898
|
private readonly action;
|
|
1899
|
+
private readonly projectedContent;
|
|
1378
1900
|
private activeRef;
|
|
1901
|
+
/**
|
|
1902
|
+
* @internal - edge detection derived via linkedSignal, not managed in the
|
|
1903
|
+
* effect. The pre-bind baseline is `false`, so an initial `[when]="true"`
|
|
1904
|
+
* counts as a rising edge.
|
|
1905
|
+
*/
|
|
1906
|
+
private readonly whenEdge;
|
|
1379
1907
|
constructor();
|
|
1908
|
+
/**
|
|
1909
|
+
* Returns the content template when something was actually projected,
|
|
1910
|
+
* `undefined` otherwise (then `message` renders). Presence is probed per
|
|
1911
|
+
* show via a throwaway embedded view - conditional content may appear
|
|
1912
|
+
* between edges, so the result is never cached. Deferred projection
|
|
1913
|
+
* re-attaches the nodes wherever the template instantiates next.
|
|
1914
|
+
*/
|
|
1915
|
+
private captureProjectedContent;
|
|
1380
1916
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxToast, never>;
|
|
1381
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxToast, "cngx-toast", never, { "when": { "alias": "when"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "severity": { "alias": "severity"; "required": false; "isSignal": true; }; "duration": { "alias": "duration"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "actionLabel": { "alias": "actionLabel"; "required": false; "isSignal": true; }; "actionHandler": { "alias": "actionHandler"; "required": false; "isSignal": true; }; }, {}, never,
|
|
1917
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxToast, "cngx-toast", never, { "when": { "alias": "when"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "severity": { "alias": "severity"; "required": false; "isSignal": true; }; "duration": { "alias": "duration"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "actionLabel": { "alias": "actionLabel"; "required": false; "isSignal": true; }; "actionHandler": { "alias": "actionHandler"; "required": false; "isSignal": true; }; }, { "dismissed": "dismissed"; }, never, ["*"], true, never>;
|
|
1382
1918
|
}
|
|
1383
1919
|
|
|
1384
1920
|
/**
|
|
@@ -1476,7 +2012,7 @@ declare class CngxAsyncErrorTpl {
|
|
|
1476
2012
|
* @slot cngxAsyncContent Rendered on success; gets the resolved value.
|
|
1477
2013
|
* @slot cngxAsyncSkeleton Rendered during the first load.
|
|
1478
2014
|
* @slot cngxAsyncEmpty Rendered when the value resolves to nothing.
|
|
1479
|
-
* @slot cngxAsyncError Rendered on failure; gets the error
|
|
2015
|
+
* @slot cngxAsyncError Rendered on failure; gets the error as `$implicit` (use `let-err`).
|
|
1480
2016
|
*
|
|
1481
2017
|
* <example-url>http://localhost:4200/#/forms/filter-builder/filter-builder-async-state/loading-error-content-branches-via-cngx-async-container</example-url>
|
|
1482
2018
|
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngx-async-container-full-control-toast</example-url>
|
|
@@ -1488,6 +2024,7 @@ declare class CngxAsyncErrorTpl {
|
|
|
1488
2024
|
*/
|
|
1489
2025
|
declare class CngxAsyncContainer<T> {
|
|
1490
2026
|
private readonly toaster;
|
|
2027
|
+
protected readonly i18n: _angular_core.Signal<_cngx_ui_feedback.CngxFeedbackI18n>;
|
|
1491
2028
|
private readonly loadingConfig;
|
|
1492
2029
|
/** The async state to render. */
|
|
1493
2030
|
readonly state: _angular_core.InputSignal<CngxAsyncState<T>>;
|
|
@@ -1519,8 +2056,17 @@ declare class CngxAsyncContainer<T> {
|
|
|
1519
2056
|
* @internal - flash-suppressed first-load skeleton view. A sub-`showDelay` first
|
|
1520
2057
|
* load never renders the skeleton outlet; once shown it holds for `minDwell`. The
|
|
1521
2058
|
* region `aria-busy` stays truthful (`state().isBusy()`); only the visual is gated.
|
|
2059
|
+
* See {@link renderedView} for which exits wait for the hold.
|
|
1522
2060
|
*/
|
|
1523
2061
|
protected readonly skeletonVisible: _angular_core.Signal<boolean>;
|
|
2062
|
+
/**
|
|
2063
|
+
* @internal - the view the template renders. While a shown first-load skeleton
|
|
2064
|
+
* is still inside its `minDwell`, a `content` or `empty` result waits and swaps
|
|
2065
|
+
* in when the dwell ends. An `error` replaces the skeleton immediately, and a
|
|
2066
|
+
* reset to idle (`none`) clears it immediately. The live-region announcement
|
|
2067
|
+
* follows the status, not this view, so AT hears the result without the delay.
|
|
2068
|
+
*/
|
|
2069
|
+
protected readonly renderedView: _angular_core.Signal<AsyncView>;
|
|
1524
2070
|
/** @internal - flash-suppressed refresh bar, gated by the same showDelay + minDwell. */
|
|
1525
2071
|
protected readonly refreshVisible: _angular_core.Signal<boolean>;
|
|
1526
2072
|
/** @internal */
|
|
@@ -1539,5 +2085,5 @@ declare class CngxAsyncContainer<T> {
|
|
|
1539
2085
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAsyncContainer<any>, "cngx-async-container", never, { "state": { "alias": "state"; "required": true; "isSignal": true; }; "showDelay": { "alias": "showDelay"; "required": false; "isSignal": true; }; "minDwell": { "alias": "minDwell"; "required": false; "isSignal": true; }; "refreshIndicator": { "alias": "refreshIndicator"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "toastSuccess": { "alias": "toastSuccess"; "required": false; "isSignal": true; }; "toastError": { "alias": "toastError"; "required": false; "isSignal": true; }; }, {}, ["skeletonTpl", "contentTpl", "emptyTpl", "errorTpl"], never, true, never>;
|
|
1540
2086
|
}
|
|
1541
2087
|
|
|
1542
|
-
export { CNGX_FEEDBACK_CONFIG, CngxAlert, CngxAlertAction, CngxAlertIcon, CngxAlertOn, CngxAlertStack, CngxAlerter, CngxAsyncContainer, CngxAsyncContentTpl, CngxAsyncEmptyTpl, CngxAsyncErrorTpl, CngxAsyncSkeletonTpl, CngxBanner, CngxBannerOn, CngxBannerOutlet, CngxBannerTrigger, CngxLoadingIndicator, CngxLoadingOverlay, CngxProgress, CngxToast, CngxToastOn, CngxToastOutlet, CngxToaster, provideFeedback, provideToasts, withAlertIcons, withAlerts, withBanners, withCloseIcon, withLoadingDefaults, withSpinnerTemplate, withToasts };
|
|
1543
|
-
export type { AlertConfig, AlertRef, AlertSeverity, AlertState, AlertVisibilityPhase, BannerConfig, BannerRef, BannerState, FeedbackConfig, FeedbackFeature, LoadingIndicatorVariant, ProgressVariant, ToastConfig, ToastPosition, ToastRef };
|
|
2088
|
+
export { CNGX_FEEDBACK_CONFIG, CNGX_FEEDBACK_I18N, CNGX_FEEDBACK_LANGUAGE_EN, CngxAlert, CngxAlertAction, CngxAlertIcon, CngxAlertOn, CngxAlertStack, CngxAlerter, CngxAsyncContainer, CngxAsyncContentTpl, CngxAsyncEmptyTpl, CngxAsyncErrorTpl, CngxAsyncSkeletonTpl, CngxBanner, CngxBannerOn, CngxBannerOutlet, CngxBannerTrigger, CngxLoadingIndicator, CngxLoadingOverlay, CngxProgress, CngxToast, CngxToastOn, CngxToastOutlet, CngxToaster, injectErrorDetail, injectFeedbackI18n, provideFeedback, provideFeedbackI18n, provideToasts, withAlertIcons, withAlerts, withBanners, withCloseIcon, withErrorDetail, withFeedbackI18nLabels, withLoadingDefaults, withSpinnerTemplate, withToasts };
|
|
2089
|
+
export type { AlertConfig, AlertRef, AlertSeverity, AlertState, AlertVisibilityPhase, BannerConfig, BannerRef, BannerState, CngxErrorDetailFn, CngxFeedbackAnnouncements, CngxFeedbackAnnouncementsLanguage, CngxFeedbackI18n, CngxFeedbackI18nOverrides, CngxFeedbackLanguageSection, FeedbackConfig, FeedbackFeature, LoadingIndicatorVariant, ProgressVariant, ToastConfig, ToastPosition, ToastRef, ToastState };
|