@cngx/ui 0.1.0-rc.6 → 0.1.0-rc.8
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 +112 -1
- package/a11y/README.md +87 -0
- package/accordion/README.md +4 -2
- package/breadcrumb/README.md +262 -0
- package/collection/README.md +6 -0
- package/command-palette/README.md +224 -0
- package/context-menu/README.md +98 -0
- package/data-grid-accordion/README.md +103 -2
- package/feedback/README.md +42 -0
- package/fesm2022/cngx-ui-a11y.mjs +452 -0
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
- package/fesm2022/cngx-ui-accordion.mjs +116 -38
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +115 -50
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +181 -96
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +586 -0
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
- package/fesm2022/cngx-ui-collection.mjs +207 -66
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +1281 -0
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
- package/fesm2022/cngx-ui-context-menu.mjs +857 -0
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -111
- 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 +1095 -521
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +18 -9
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +84 -16
- 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 +370 -203
- 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 +501 -182
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +327 -106
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +22 -21
- 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 +718 -0
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
- package/fesm2022/cngx-ui-stepper.mjs +217 -76
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +40 -19
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +548 -0
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
- package/fesm2022/cngx-ui-toc.mjs +748 -0
- package/fesm2022/cngx-ui-toc.mjs.map +1 -0
- package/fesm2022/cngx-ui.mjs +16 -21
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-accordion/README.md +1 -1
- package/mat-paginator/README.md +9 -2
- package/mat-tabs/styles/mat-tabs.css +29 -27
- package/overlay/README.md +9 -4
- package/package.json +32 -1
- package/paginator/README.md +8 -4
- package/sidenav/README.md +33 -11
- package/skeleton/README.md +2 -0
- package/speak/README.md +3 -2
- package/stepper/README.md +15 -3
- package/timeline/README.md +350 -0
- package/toc/README.md +186 -0
- package/types/cngx-ui-a11y.d.ts +394 -0
- package/types/cngx-ui-accordion.d.ts +100 -30
- package/types/cngx-ui-action-button.d.ts +47 -3
- package/types/cngx-ui-breadcrumb.d.ts +159 -58
- package/types/cngx-ui-chart-panel.d.ts +382 -0
- package/types/cngx-ui-collection.d.ts +159 -58
- package/types/cngx-ui-command-palette.d.ts +565 -0
- package/types/cngx-ui-context-menu.d.ts +559 -0
- package/types/cngx-ui-data-grid-accordion.d.ts +344 -51
- package/types/cngx-ui-empty-state.d.ts +9 -2
- package/types/cngx-ui-feedback.d.ts +664 -73
- package/types/cngx-ui-layout.d.ts +8 -3
- package/types/cngx-ui-mat-accordion.d.ts +32 -4
- 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 +218 -23
- package/types/cngx-ui-overlay.d.ts +56 -10
- package/types/cngx-ui-paginator.d.ts +416 -132
- package/types/cngx-ui-sidenav.d.ts +248 -74
- package/types/cngx-ui-skeleton.d.ts +18 -7
- package/types/cngx-ui-speak.d.ts +118 -5
- package/types/cngx-ui-stat-card.d.ts +411 -0
- package/types/cngx-ui-stepper.d.ts +81 -29
- package/types/cngx-ui-tabs.d.ts +22 -6
- package/types/cngx-ui-timeline.d.ts +495 -0
- package/types/cngx-ui-toc.d.ts +581 -0
- package/types/cngx-ui.d.ts +8 -5
|
@@ -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
|
/**
|
|
@@ -17,9 +19,9 @@ type LoadingIndicatorVariant = 'spinner' | 'bar';
|
|
|
17
19
|
* - `spinner` - rotating circle, inline or centered
|
|
18
20
|
* - `bar` - thin line at the top of the container (YouTube-style)
|
|
19
21
|
*
|
|
20
|
-
* Timing:
|
|
21
|
-
* - `delay` (default
|
|
22
|
-
* - `
|
|
22
|
+
* Timing (defaults from `CNGX_LOADING_CONFIG`):
|
|
23
|
+
* - `delay` (default 120ms): operations faster than this never show the indicator
|
|
24
|
+
* - `minDwell` (default 400ms): once visible, stays for at least this long
|
|
23
25
|
*
|
|
24
26
|
* For content-blocking overlays, use `cngx-loading-overlay` instead.
|
|
25
27
|
*
|
|
@@ -45,26 +47,42 @@ type LoadingIndicatorVariant = 'spinner' | 'bar';
|
|
|
45
47
|
*/
|
|
46
48
|
declare class CngxLoadingIndicator {
|
|
47
49
|
private readonly config;
|
|
50
|
+
private readonly loadingConfig;
|
|
51
|
+
private readonly i18n;
|
|
48
52
|
/** Bind an async state - shows indicator when `isBusy()`. */
|
|
49
53
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
50
54
|
/** Direct boolean control - alternative to `[state]`. */
|
|
51
55
|
readonly loading: _angular_core.InputSignal<boolean>;
|
|
52
56
|
/** Visual variant. */
|
|
53
57
|
readonly variant: _angular_core.InputSignal<LoadingIndicatorVariant>;
|
|
54
|
-
/** Screen reader label. */
|
|
55
|
-
readonly label: _angular_core.InputSignal<string>;
|
|
56
|
-
/** Delay in ms before showing the indicator.
|
|
58
|
+
/** Screen reader label. Unbound, `CNGX_FEEDBACK_I18N.loadingLabel` applies. */
|
|
59
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
60
|
+
/** Delay in ms before showing the indicator. Defaults to `CNGX_LOADING_CONFIG.showDelay`. */
|
|
57
61
|
readonly delay: _angular_core.InputSignal<number>;
|
|
58
|
-
/** Minimum display time in ms once visible.
|
|
59
|
-
readonly
|
|
62
|
+
/** Minimum display time in ms once visible. Defaults to `CNGX_LOADING_CONFIG.minDwell`. */
|
|
63
|
+
readonly minDwell: _angular_core.InputSignal<number>;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `minDwell`. Kept one release for migration; when set, it
|
|
66
|
+
* takes precedence over `minDwell`.
|
|
67
|
+
*/
|
|
68
|
+
readonly minDuration: _angular_core.InputSignal<number | undefined>;
|
|
60
69
|
/** @internal - true when the underlying source says "loading". */
|
|
61
70
|
protected readonly isActive: _angular_core.Signal<boolean>;
|
|
62
71
|
/** @internal - custom spinner component from global config. */
|
|
63
72
|
protected readonly customSpinner: _angular_core.Signal<_angular_core.Type<unknown> | null>;
|
|
64
|
-
/** @internal -
|
|
73
|
+
/** @internal - deprecated `minDuration` alias forwards to `minDwell`. */
|
|
74
|
+
protected readonly effectiveMinDwell: _angular_core.Signal<number>;
|
|
75
|
+
/** @internal - final visibility after delay + minDwell. */
|
|
65
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>;
|
|
66
84
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLoadingIndicator, never>;
|
|
67
|
-
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; }; "minDuration": { "alias": "minDuration"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
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>;
|
|
68
86
|
}
|
|
69
87
|
|
|
70
88
|
/**
|
|
@@ -109,17 +127,26 @@ declare class CngxLoadingIndicator {
|
|
|
109
127
|
*/
|
|
110
128
|
declare class CngxLoadingOverlay {
|
|
111
129
|
private readonly doc;
|
|
112
|
-
private readonly
|
|
130
|
+
private readonly loadingConfig;
|
|
131
|
+
private readonly i18n;
|
|
113
132
|
/** Bind an async state - shows overlay when `isBusy()`. */
|
|
114
133
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
115
134
|
/** Direct boolean control - alternative to `[state]`. */
|
|
116
135
|
readonly loading: _angular_core.InputSignal<boolean>;
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Screen reader label for the spinner. Unbound,
|
|
138
|
+
* `CNGX_FEEDBACK_I18N.loadingLabel` applies.
|
|
139
|
+
*/
|
|
140
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
141
|
+
/** Delay in ms before showing the overlay. Defaults to `CNGX_LOADING_CONFIG.showDelay`. */
|
|
120
142
|
readonly delay: _angular_core.InputSignal<number>;
|
|
121
|
-
/** Minimum display time in ms once visible.
|
|
122
|
-
readonly
|
|
143
|
+
/** Minimum display time in ms once visible. Defaults to `CNGX_LOADING_CONFIG.minDwell`. */
|
|
144
|
+
readonly minDwell: _angular_core.InputSignal<number>;
|
|
145
|
+
/**
|
|
146
|
+
* @deprecated Use `minDwell`. Kept one release for migration; when set, it
|
|
147
|
+
* takes precedence over `minDwell`.
|
|
148
|
+
*/
|
|
149
|
+
readonly minDuration: _angular_core.InputSignal<number | undefined>;
|
|
123
150
|
/**
|
|
124
151
|
* When `true`, the overlay only activates during the first load (`isFirstLoad()`),
|
|
125
152
|
* not during refreshes. Use the async container's built-in refresh bar for
|
|
@@ -128,14 +155,22 @@ declare class CngxLoadingOverlay {
|
|
|
128
155
|
readonly firstLoadOnly: _angular_core.InputSignal<boolean>;
|
|
129
156
|
/** @internal */
|
|
130
157
|
protected readonly isActive: _angular_core.Signal<boolean>;
|
|
131
|
-
/** @internal -
|
|
158
|
+
/** @internal - deprecated `minDuration` alias forwards to `minDwell`. */
|
|
159
|
+
protected readonly effectiveMinDwell: _angular_core.Signal<number>;
|
|
160
|
+
/** @internal - debounced visibility via shared gate factory. */
|
|
132
161
|
protected readonly visible: _angular_core.Signal<boolean>;
|
|
133
|
-
|
|
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;
|
|
134
169
|
private readonly contentWrapper;
|
|
135
170
|
private readonly spinnerEl;
|
|
136
171
|
constructor();
|
|
137
172
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLoadingOverlay, never>;
|
|
138
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxLoadingOverlay, "cngx-loading-overlay", never, { "state": { "alias": "state"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "delay": { "alias": "delay"; "required": false; "isSignal": true; }; "minDuration": { "alias": "minDuration"; "required": false; "isSignal": true; }; "firstLoadOnly": { "alias": "firstLoadOnly"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
173
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxLoadingOverlay, "cngx-loading-overlay", never, { "state": { "alias": "state"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "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; }; "firstLoadOnly": { "alias": "firstLoadOnly"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
139
174
|
}
|
|
140
175
|
|
|
141
176
|
/**
|
|
@@ -177,6 +212,8 @@ type ProgressVariant = 'linear' | 'circular';
|
|
|
177
212
|
* <example-url>http://localhost:4200/#/ui/feedback/progress/linear-indeterminate</example-url>
|
|
178
213
|
*/
|
|
179
214
|
declare class CngxProgress {
|
|
215
|
+
private readonly i18n;
|
|
216
|
+
private readonly locale;
|
|
180
217
|
/** Bind an async state - reads `progress()` for determinate mode. */
|
|
181
218
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
182
219
|
/** Direct progress value (0–100). `undefined` = indeterminate. */
|
|
@@ -185,14 +222,21 @@ declare class CngxProgress {
|
|
|
185
222
|
readonly variant: _angular_core.InputSignal<ProgressVariant>;
|
|
186
223
|
/** Show percentage label next to the bar. */
|
|
187
224
|
readonly showLabel: _angular_core.InputSignal<boolean>;
|
|
188
|
-
/**
|
|
189
|
-
|
|
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>;
|
|
190
232
|
/** @internal */
|
|
191
233
|
protected readonly effectiveProgress: _angular_core.Signal<number | undefined>;
|
|
192
234
|
/** @internal */
|
|
193
235
|
protected readonly isDeterminate: _angular_core.Signal<boolean>;
|
|
194
236
|
/** @internal - `null` removes the attribute from the DOM for indeterminate mode. */
|
|
195
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>;
|
|
196
240
|
/** @internal */
|
|
197
241
|
protected readonly ariaValueText: _angular_core.Signal<string | null>;
|
|
198
242
|
/** @internal */
|
|
@@ -292,6 +336,7 @@ declare class CngxAlertAction {
|
|
|
292
336
|
*/
|
|
293
337
|
declare class CngxAlert {
|
|
294
338
|
private readonly config;
|
|
339
|
+
private readonly i18n;
|
|
295
340
|
private readonly destroyRef;
|
|
296
341
|
/** Alert severity - determines visual style, default icon, and ARIA role. */
|
|
297
342
|
readonly severity: _angular_core.InputSignal<AlertSeverity>;
|
|
@@ -335,6 +380,17 @@ declare class CngxAlert {
|
|
|
335
380
|
private readonly autoDismissTimer;
|
|
336
381
|
private readonly collapseTimer;
|
|
337
382
|
private animationFallbackId;
|
|
383
|
+
/**
|
|
384
|
+
* Reduced-motion via the shared kernel; environments without matchMedia
|
|
385
|
+
* (SSR, bare jsdom) count as reduced so the fallback settles immediately.
|
|
386
|
+
*/
|
|
387
|
+
private readonly motionWindow;
|
|
388
|
+
private readonly canQueryMotion;
|
|
389
|
+
private readonly prefersReducedMotion;
|
|
390
|
+
/** Active pause holds - pointer hover and focus-within count independently. */
|
|
391
|
+
private interactionHolds;
|
|
392
|
+
/** Set when interaction expanded an already-collapsed alert; release re-arms. */
|
|
393
|
+
private reCollapseOnRelease;
|
|
338
394
|
/** @internal - global icon component for the current severity (from provideFeedback config). */
|
|
339
395
|
protected readonly globalIcon: _angular_core.Signal<_angular_core.Type<unknown> | null>;
|
|
340
396
|
/** @internal - merged closable from new and deprecated input. */
|
|
@@ -354,6 +410,13 @@ declare class CngxAlert {
|
|
|
354
410
|
protected readonly isVisible: _angular_core.Signal<boolean>;
|
|
355
411
|
/** @internal - collapsed state (read-only public view). */
|
|
356
412
|
protected readonly collapsed: _angular_core.Signal<boolean>;
|
|
413
|
+
/**
|
|
414
|
+
* @internal - dismiss-button name inside the alert/status host. Visibility is
|
|
415
|
+
* the only tracked source; the copy is read untracked, so a language switch
|
|
416
|
+
* never rewrites a shown alert and its next appearance speaks the new
|
|
417
|
+
* language.
|
|
418
|
+
*/
|
|
419
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
357
420
|
/** @internal - SR announcement text for state transitions. */
|
|
358
421
|
protected readonly announcement: _angular_core.Signal<string>;
|
|
359
422
|
private readonly effectiveCollapseDelay;
|
|
@@ -376,6 +439,13 @@ declare class CngxAlert {
|
|
|
376
439
|
protected handleFocusIn(): void;
|
|
377
440
|
/** @internal - resume timers on focus out. */
|
|
378
441
|
protected handleFocusOut(): void;
|
|
442
|
+
/**
|
|
443
|
+
* Hold-counted pause: hover and focus-within are independent holds on the
|
|
444
|
+
* same timers - leaving with the mouse must not resume auto-dismiss while
|
|
445
|
+
* keyboard focus is still inside, and vice versa.
|
|
446
|
+
*/
|
|
447
|
+
private handleInteractionStart;
|
|
448
|
+
private handleInteractionEnd;
|
|
379
449
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlert, never>;
|
|
380
450
|
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>;
|
|
381
451
|
}
|
|
@@ -391,9 +461,19 @@ interface FeedbackConfig {
|
|
|
391
461
|
spinnerComponent?: Type<unknown>;
|
|
392
462
|
/** Custom icon components per alert severity. Replaces built-in SVG icons. */
|
|
393
463
|
alertIcons?: Partial<Record<AlertSeverity, Type<unknown>>>;
|
|
394
|
-
/**
|
|
464
|
+
/**
|
|
465
|
+
* Default delay in ms before showing loading indicators.
|
|
466
|
+
*
|
|
467
|
+
* @deprecated Use `provideLoadingConfig(withShowDelay(...))` from `@cngx/core/utils`.
|
|
468
|
+
* Kept one release as a forwarder; `withLoadingDefaults` still writes it.
|
|
469
|
+
*/
|
|
395
470
|
loadingDelay?: number;
|
|
396
|
-
/**
|
|
471
|
+
/**
|
|
472
|
+
* Default minimum display time in ms for loading indicators.
|
|
473
|
+
*
|
|
474
|
+
* @deprecated Use `provideLoadingConfig(withMinDwell(...))` from `@cngx/core/utils`.
|
|
475
|
+
* Kept one release as a forwarder; `withLoadingDefaults` still writes it.
|
|
476
|
+
*/
|
|
397
477
|
loadingMinDuration?: number;
|
|
398
478
|
/** Custom close/dismiss icon component - replaces default X SVG globally. */
|
|
399
479
|
closeIconComponent?: Type<unknown>;
|
|
@@ -407,7 +487,18 @@ interface FeedbackConfig {
|
|
|
407
487
|
alertDedupWindow?: number;
|
|
408
488
|
/** Default max visible alerts per stack. */
|
|
409
489
|
alertMaxVisible?: number;
|
|
490
|
+
/**
|
|
491
|
+
* Maps a failure to the detail the state bridges and `CngxActionButton`
|
|
492
|
+
* append to their error message. Set through {@link withErrorDetail}.
|
|
493
|
+
*/
|
|
494
|
+
errorDetail?: CngxErrorDetailFn;
|
|
410
495
|
}
|
|
496
|
+
/**
|
|
497
|
+
* Maps a failure to user-facing detail text, or `undefined` for none.
|
|
498
|
+
*
|
|
499
|
+
* @category ui/feedback
|
|
500
|
+
*/
|
|
501
|
+
type CngxErrorDetailFn = (error: unknown) => string | undefined;
|
|
411
502
|
/**
|
|
412
503
|
* Injection token for the global feedback configuration.
|
|
413
504
|
* Components read this with `inject(CNGX_FEEDBACK_CONFIG, { optional: true })`.
|
|
@@ -421,6 +512,10 @@ declare const CNGX_FEEDBACK_CONFIG: InjectionToken<FeedbackConfig>;
|
|
|
421
512
|
/**
|
|
422
513
|
* A feature configuration function returned by `withXxx()` helpers.
|
|
423
514
|
*
|
|
515
|
+
* Merge rule (all features): an explicitly passed option wins; an omitted
|
|
516
|
+
* option preserves the value an earlier feature wrote. No feature clears
|
|
517
|
+
* fields it was not given.
|
|
518
|
+
*
|
|
424
519
|
* @category ui/feedback
|
|
425
520
|
*/
|
|
426
521
|
interface FeedbackFeature {
|
|
@@ -481,7 +576,18 @@ declare function withAlertIcons(icons: Partial<Record<AlertSeverity, Type<unknow
|
|
|
481
576
|
/**
|
|
482
577
|
* Set default timing for all loading indicators and overlays.
|
|
483
578
|
*
|
|
484
|
-
*
|
|
579
|
+
* Forwards into the Level-1 `CNGX_LOADING_CONFIG` cascade so the gated
|
|
580
|
+
* surfaces (indicator, overlay, async-container, skeleton) all read the same
|
|
581
|
+
* defaults. Prefer `provideLoadingConfig(withShowDelay(...), withMinDwell(...))`
|
|
582
|
+
* from `@cngx/core/utils` directly; this feature is kept for back-compat.
|
|
583
|
+
*
|
|
584
|
+
* Note: this forwarder provides a full `CNGX_LOADING_CONFIG` value, so under
|
|
585
|
+
* DI last-wins it replaces the whole config - including `spinnerVsSkeletonCutoff`,
|
|
586
|
+
* which resets to its default. Set the cutoff through
|
|
587
|
+
* `provideLoadingConfig(withSpinnerVsSkeletonCutoff(...))` rather than combining
|
|
588
|
+
* it with this back-compat forwarder.
|
|
589
|
+
*
|
|
590
|
+
* Individual components can still override via their `[delay]` and `[minDwell]` inputs.
|
|
485
591
|
*
|
|
486
592
|
* ```ts
|
|
487
593
|
* provideFeedback(withLoadingDefaults({ delay: 300, minDuration: 600 }))
|
|
@@ -579,6 +685,297 @@ declare function withAlerts(opts?: {
|
|
|
579
685
|
* @category ui/feedback
|
|
580
686
|
*/
|
|
581
687
|
declare function withBanners(): FeedbackFeature;
|
|
688
|
+
/**
|
|
689
|
+
* Map a failure to the detail text `CngxAlertOn`, `CngxToastOn`,
|
|
690
|
+
* `CngxBannerOn` (with their `*ErrorDetail` input set) and
|
|
691
|
+
* `CngxActionButton` append to the error message, through the
|
|
692
|
+
* `errorWithDetail` message of `CNGX_FEEDBACK_I18N`. Return `undefined` to
|
|
693
|
+
* show the message alone.
|
|
694
|
+
*
|
|
695
|
+
* Without this feature, development builds show the raw `Error.message` (or
|
|
696
|
+
* a thrown string) and warn once that production builds show no detail, so
|
|
697
|
+
* no untranslated server text reaches a user.
|
|
698
|
+
*
|
|
699
|
+
* ```ts
|
|
700
|
+
* provideFeedback(
|
|
701
|
+
* withToasts(),
|
|
702
|
+
* withErrorDetail((error) =>
|
|
703
|
+
* error instanceof HttpErrorResponse ? translate(`http.${error.status}`) : undefined,
|
|
704
|
+
* ),
|
|
705
|
+
* )
|
|
706
|
+
* ```
|
|
707
|
+
*
|
|
708
|
+
* @category ui/feedback
|
|
709
|
+
* @since 0.1.0
|
|
710
|
+
*/
|
|
711
|
+
declare function withErrorDetail(map: CngxErrorDetailFn): FeedbackFeature;
|
|
712
|
+
/**
|
|
713
|
+
* Inject the error-detail mapping set by {@link withErrorDetail}, or the
|
|
714
|
+
* default: the raw text in development, with one warning per app the first
|
|
715
|
+
* time it shows, and nothing in production. Call it in an injection context,
|
|
716
|
+
* then call the returned function with the error.
|
|
717
|
+
*
|
|
718
|
+
* @category ui/feedback
|
|
719
|
+
* @since 0.1.0
|
|
720
|
+
*/
|
|
721
|
+
declare function injectErrorDetail(): CngxErrorDetailFn;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Live-region copy the feedback family announces on its own behalf. Separate
|
|
725
|
+
* from the region names: these describe a transition rather than naming a
|
|
726
|
+
* landmark, so they change on a different cadence and a consumer usually
|
|
727
|
+
* translates them as one block.
|
|
728
|
+
*
|
|
729
|
+
* @category ui/feedback/i18n
|
|
730
|
+
*/
|
|
731
|
+
interface CngxFeedbackAnnouncements {
|
|
732
|
+
/** Announced when a user dismisses an alert. */
|
|
733
|
+
readonly alertDismissed: string;
|
|
734
|
+
/**
|
|
735
|
+
* Accessible name of the alert-stack overflow trigger. Receives the hidden
|
|
736
|
+
* count. Must contain the visible label from
|
|
737
|
+
* {@link CngxFeedbackAnnouncements.alertOverflowVisible} for the same count
|
|
738
|
+
* (WCAG 2.5.3 Label in Name, compared case-insensitively): a speech-input
|
|
739
|
+
* user says what they see. A dev-mode warning fires when a translated pair
|
|
740
|
+
* breaks containment.
|
|
741
|
+
*/
|
|
742
|
+
readonly alertOverflow: (count: number) => string;
|
|
743
|
+
/**
|
|
744
|
+
* Visible text of the alert-stack overflow trigger. Receives the hidden
|
|
745
|
+
* count; its output must be contained in
|
|
746
|
+
* {@link CngxFeedbackAnnouncements.alertOverflow} for the same count.
|
|
747
|
+
*/
|
|
748
|
+
readonly alertOverflowVisible: (count: number) => string;
|
|
749
|
+
/** `idle -> loading` on `CngxAsyncContainer`. */
|
|
750
|
+
readonly asyncLoading: string;
|
|
751
|
+
/** `loading -> success`. */
|
|
752
|
+
readonly asyncLoaded: string;
|
|
753
|
+
/** `loading -> error`. */
|
|
754
|
+
readonly asyncError: string;
|
|
755
|
+
/** Entering `refreshing`. */
|
|
756
|
+
readonly asyncRefreshing: string;
|
|
757
|
+
/** `refreshing -> success`. */
|
|
758
|
+
readonly asyncRefreshed: string;
|
|
759
|
+
/** `refreshing -> error`. */
|
|
760
|
+
readonly asyncRefreshFailed: string;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Feedback i18n surface. The defaults come from the `feedback` section of the
|
|
764
|
+
* language pack (English without one); {@link withFeedbackI18nLabels} inside
|
|
765
|
+
* `provideFeedback()` or {@link provideFeedbackI18n} override single keys on top.
|
|
766
|
+
* Sibling to `CNGX_STEPPER_I18N`, `CNGX_TABS_I18N` and `CNGX_CHART_I18N`.
|
|
767
|
+
*
|
|
768
|
+
* Two region names and one announcement sub-bundle. The banner outlet carries
|
|
769
|
+
* no region `aria-label`, so it gets no key - a key with no Wirkungsort is
|
|
770
|
+
* configuration for its own sake.
|
|
771
|
+
*
|
|
772
|
+
* @category ui/feedback/i18n
|
|
773
|
+
*/
|
|
774
|
+
interface CngxFeedbackI18n {
|
|
775
|
+
/** Accessible name of the `role="region"` host on `CngxAlertStack`. */
|
|
776
|
+
readonly alertsRegionLabel: string;
|
|
777
|
+
/** Accessible name of the `role="region"` host on `CngxToastOutlet`. */
|
|
778
|
+
readonly notificationsRegionLabel: string;
|
|
779
|
+
/** Live-region copy - see {@link CngxFeedbackAnnouncements}. */
|
|
780
|
+
readonly announcements: CngxFeedbackAnnouncements;
|
|
781
|
+
/** Accessible name of the dismiss button on alerts, stacked alerts, toasts and banners. */
|
|
782
|
+
readonly dismissLabel: string;
|
|
783
|
+
/** Shown in the banner's `role="alert"` slot when its action rejects. */
|
|
784
|
+
readonly bannerActionFailed: string;
|
|
785
|
+
/** Visible repeat marker on a toast raised more than once. Receives the repeat count. */
|
|
786
|
+
readonly toastRepeatCount: (count: number) => string;
|
|
787
|
+
/**
|
|
788
|
+
* Default accessible name of `CngxLoadingIndicator` and `CngxLoadingOverlay`
|
|
789
|
+
* while their `label` input is unbound.
|
|
790
|
+
*/
|
|
791
|
+
readonly loadingLabel: string;
|
|
792
|
+
/** Default accessible name of `CngxProgress` while its `label` input is unbound. */
|
|
793
|
+
readonly progressLabel: string;
|
|
794
|
+
/**
|
|
795
|
+
* `aria-valuetext` of a determinate `CngxProgress`. Receives the rounded
|
|
796
|
+
* percent (0-100) and that value already formatted as a percent in the app
|
|
797
|
+
* locale; the default returns the formatted string.
|
|
798
|
+
*/
|
|
799
|
+
readonly progressValueText: (percent: number, formatted: string) => string;
|
|
800
|
+
/**
|
|
801
|
+
* The message a state bridge (`CngxAlertOn`, `CngxToastOn`, `CngxBannerOn`)
|
|
802
|
+
* and `CngxActionButton` show for a failure with a detail: the bound error
|
|
803
|
+
* message followed by the detail `withErrorDetail` mapped from the error.
|
|
804
|
+
* One message, so a locale owns the joiner and the order.
|
|
805
|
+
*/
|
|
806
|
+
readonly errorWithDetail: (message: string, detail: string) => string;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Override shape: every top-level key optional, and `announcements` overridable
|
|
810
|
+
* key by key rather than all-or-nothing.
|
|
811
|
+
*
|
|
812
|
+
* @category ui/feedback/i18n
|
|
813
|
+
*/
|
|
814
|
+
type CngxFeedbackI18nOverrides = Partial<Omit<CngxFeedbackI18n, 'announcements'>> & {
|
|
815
|
+
readonly announcements?: Partial<CngxFeedbackAnnouncements>;
|
|
816
|
+
};
|
|
817
|
+
/**
|
|
818
|
+
* DI token for the feedback i18n bundle, a `Signal` so region names, labels
|
|
819
|
+
* and announcements follow a runtime language switch. `providedIn: 'root'`:
|
|
820
|
+
* the feedback section of the active language pack over the English
|
|
821
|
+
* defaults, formatted for the app locale, so a consumer who provides nothing
|
|
822
|
+
* still gets named regions.
|
|
823
|
+
*
|
|
824
|
+
* @category ui/feedback/i18n
|
|
825
|
+
* @wcag AA
|
|
826
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/config/feedback-i18n.ts
|
|
827
|
+
* @since 0.1.0
|
|
828
|
+
* @relatedTo CngxAlertStack, CngxToastOutlet
|
|
829
|
+
*/
|
|
830
|
+
declare const CNGX_FEEDBACK_I18N: InjectionToken<Signal<CngxFeedbackI18n>>;
|
|
831
|
+
/**
|
|
832
|
+
* Override the feedback region names from inside `provideFeedback()`. Unset
|
|
833
|
+
* keys keep the language pack's copy, or the English default, and
|
|
834
|
+
* `announcements` merges key by key. Pass
|
|
835
|
+
* a `Signal` to switch the language at runtime.
|
|
836
|
+
*
|
|
837
|
+
* ```ts
|
|
838
|
+
* provideFeedback(
|
|
839
|
+
* withToasts(),
|
|
840
|
+
* withAlerts(),
|
|
841
|
+
* withFeedbackI18nLabels({ alertsRegionLabel: 'Hinweise' }),
|
|
842
|
+
* )
|
|
843
|
+
* ```
|
|
844
|
+
*
|
|
845
|
+
* Contributes the token through the feature's `_providers`, so - like
|
|
846
|
+
* {@link withCloseIcon} - a second call in the same `provideFeedback()` wins
|
|
847
|
+
* over the first rather than merging with it. Pass every key in one call.
|
|
848
|
+
*
|
|
849
|
+
* @category ui/feedback/i18n
|
|
850
|
+
*/
|
|
851
|
+
declare function withFeedbackI18nLabels(overrides: CngxFeedbackI18nOverrides | Signal<CngxFeedbackI18nOverrides>): FeedbackFeature;
|
|
852
|
+
/**
|
|
853
|
+
* Provider for the feedback i18n bundle on its own, without the rest of
|
|
854
|
+
* `provideFeedback()`. This is the entry point a consumer-composed language
|
|
855
|
+
* file uses - `provideFeedback()` replaces the whole `CNGX_FEEDBACK_CONFIG`
|
|
856
|
+
* value, so routing a translation through it would reset unrelated feedback
|
|
857
|
+
* defaults the app set elsewhere. Unset keys keep the language pack's copy,
|
|
858
|
+
* or the English default, `announcements` merges key by key, and a `Signal`
|
|
859
|
+
* switches the language at runtime. For a whole language prefer the
|
|
860
|
+
* `feedback` section of a language pack (`provideCngxI18n` from
|
|
861
|
+
* `@cngx/core/i18n`); this provider overrides single keys on top of it.
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* ```ts
|
|
865
|
+
* // src/i18n/de.ts - the app's language file: every per-lib provider it uses,
|
|
866
|
+
* // composed in one const. See the "Localisation" core-concepts page for the
|
|
867
|
+
* // full recipe and the per-area entry points.
|
|
868
|
+
* export const DE: Provider[] = [
|
|
869
|
+
* provideFeedbackI18n({
|
|
870
|
+
* alertsRegionLabel: 'Hinweise',
|
|
871
|
+
* notificationsRegionLabel: 'Meldungen',
|
|
872
|
+
* announcements: { alertDismissed: 'Hinweis verworfen' },
|
|
873
|
+
* }),
|
|
874
|
+
* provideTabsI18n(withTabsI18nLabels({ tabsLabel: 'Reiter' })),
|
|
875
|
+
* provideCardI18n(withCardI18nLabels({ selected: 'Ausgewählt' })),
|
|
876
|
+
* ];
|
|
877
|
+
*
|
|
878
|
+
* bootstrapApplication(App, { providers: [...DE] });
|
|
879
|
+
* ```
|
|
880
|
+
*
|
|
881
|
+
* @category ui/feedback/i18n
|
|
882
|
+
* @since 0.1.0
|
|
883
|
+
*/
|
|
884
|
+
declare function provideFeedbackI18n(overrides: CngxFeedbackI18nOverrides | Signal<CngxFeedbackI18nOverrides>): Provider;
|
|
885
|
+
/**
|
|
886
|
+
* Inject the resolved feedback i18n bundle in an injection context: every key
|
|
887
|
+
* left at its default follows the locale of the reading site (a
|
|
888
|
+
* `provideLocaleAt` subtree), every key an override set stays. Read it inside
|
|
889
|
+
* a `computed()`, template or handler so a language switch reaches the label.
|
|
890
|
+
* One Signal per injector, bundle and locale, so row-level readers (alerts,
|
|
891
|
+
* toasts, banners) share it.
|
|
892
|
+
*
|
|
893
|
+
* @category ui/feedback/i18n
|
|
894
|
+
*/
|
|
895
|
+
declare function injectFeedbackI18n(): Signal<CngxFeedbackI18n>;
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* The live-region words of the feedback section: transitions the feedback
|
|
899
|
+
* family announces on its own behalf.
|
|
900
|
+
*
|
|
901
|
+
* @category ui/feedback/i18n
|
|
902
|
+
* @since 0.1.0
|
|
903
|
+
*/
|
|
904
|
+
interface CngxFeedbackAnnouncementsLanguage {
|
|
905
|
+
/** Announced when a user dismisses an alert. */
|
|
906
|
+
readonly alertDismissed: string;
|
|
907
|
+
/**
|
|
908
|
+
* Plural on `{count}`: accessible name of the alert-stack overflow trigger.
|
|
909
|
+
* Must contain {@link CngxFeedbackAnnouncementsLanguage.alertOverflowVisible}
|
|
910
|
+
* for the same count (WCAG 2.5.3 Label in Name).
|
|
911
|
+
*/
|
|
912
|
+
readonly alertOverflow: CngxMessage;
|
|
913
|
+
/** `{count}`: visible text of the alert-stack overflow trigger. */
|
|
914
|
+
readonly alertOverflowVisible: CngxMessage;
|
|
915
|
+
/** `idle -> loading` on `CngxAsyncContainer`. */
|
|
916
|
+
readonly asyncLoading: string;
|
|
917
|
+
/** `loading -> success`. */
|
|
918
|
+
readonly asyncLoaded: string;
|
|
919
|
+
/** `loading -> error`. */
|
|
920
|
+
readonly asyncError: string;
|
|
921
|
+
/** Entering `refreshing`. */
|
|
922
|
+
readonly asyncRefreshing: string;
|
|
923
|
+
/** `refreshing -> success`. */
|
|
924
|
+
readonly asyncRefreshed: string;
|
|
925
|
+
/** `refreshing -> error`. */
|
|
926
|
+
readonly asyncRefreshFailed: string;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* The feedback section of a {@link CngxLanguagePack}: the copy of
|
|
930
|
+
* `@cngx/ui/feedback` (alerts, toasts, banners, loading surfaces, the async
|
|
931
|
+
* container and the state bridges). It feeds `CNGX_FEEDBACK_I18N`. Messages
|
|
932
|
+
* use `{name}` placeholders; a plural message picks its form from `{count}`.
|
|
933
|
+
*
|
|
934
|
+
* @category ui/feedback/i18n
|
|
935
|
+
* @since 0.1.0
|
|
936
|
+
* @relatedTo CNGX_FEEDBACK_I18N
|
|
937
|
+
*/
|
|
938
|
+
interface CngxFeedbackLanguageSection {
|
|
939
|
+
/** Accessible name of the alert-stack region. */
|
|
940
|
+
readonly alertsRegionLabel: string;
|
|
941
|
+
/** Accessible name of the toast-outlet region. */
|
|
942
|
+
readonly notificationsRegionLabel: string;
|
|
943
|
+
/** Accessible name of every dismiss button. */
|
|
944
|
+
readonly dismissLabel: string;
|
|
945
|
+
/** Shown in the banner's alert slot when its action rejects. */
|
|
946
|
+
readonly bannerActionFailed: string;
|
|
947
|
+
/** `{count}`: visible repeat marker on a toast raised more than once. */
|
|
948
|
+
readonly toastRepeatCount: CngxMessage;
|
|
949
|
+
/** Default accessible name of the loading indicator and overlay. */
|
|
950
|
+
readonly loadingLabel: string;
|
|
951
|
+
/** Default accessible name of `CngxProgress`. */
|
|
952
|
+
readonly progressLabel: string;
|
|
953
|
+
/**
|
|
954
|
+
* `{value}` (the percent formatted in the locale, `42%`), `{percent}` (the
|
|
955
|
+
* rounded number): `aria-valuetext` of a determinate `CngxProgress`.
|
|
956
|
+
*/
|
|
957
|
+
readonly progressValueText: CngxMessage;
|
|
958
|
+
/**
|
|
959
|
+
* `{message}`, `{detail}`: an error message of a state bridge followed by
|
|
960
|
+
* the mapped error detail.
|
|
961
|
+
*/
|
|
962
|
+
readonly errorWithDetail: CngxMessage;
|
|
963
|
+
readonly announcements: CngxFeedbackAnnouncementsLanguage;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* The English feedback section: the single source of the feedback family's
|
|
967
|
+
* English copy. `CNGX_FEEDBACK_I18N` defaults to it.
|
|
968
|
+
*
|
|
969
|
+
* @category ui/feedback/i18n
|
|
970
|
+
* @since 0.1.0
|
|
971
|
+
* @relatedTo CNGX_FEEDBACK_I18N
|
|
972
|
+
*/
|
|
973
|
+
declare const CNGX_FEEDBACK_LANGUAGE_EN: CngxFeedbackLanguageSection;
|
|
974
|
+
declare module '@cngx/core/i18n' {
|
|
975
|
+
interface CngxLanguagePack {
|
|
976
|
+
readonly feedback: CngxFeedbackLanguageSection;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
582
979
|
|
|
583
980
|
/**
|
|
584
981
|
* Configuration for a programmatic alert.
|
|
@@ -592,9 +989,19 @@ interface AlertConfig {
|
|
|
592
989
|
severity?: AlertSeverity;
|
|
593
990
|
/** Optional bold title above the message. */
|
|
594
991
|
title?: string;
|
|
595
|
-
/**
|
|
992
|
+
/**
|
|
993
|
+
* Whether the alert persists until explicitly dismissed.
|
|
994
|
+
* Defaults to `true` unless a `duration` is passed or
|
|
995
|
+
* `withAlerts({ defaultDuration })` is configured. `error` alerts always
|
|
996
|
+
* default to persistent (matching the toaster) - opt out with an explicit
|
|
997
|
+
* `duration` or `persistent: false`.
|
|
998
|
+
*/
|
|
596
999
|
persistent?: boolean;
|
|
597
|
-
/**
|
|
1000
|
+
/**
|
|
1001
|
+
* Auto-dismiss duration in ms. Setting it implies `persistent: false`.
|
|
1002
|
+
* Non-persistent alerts without a duration fall back to
|
|
1003
|
+
* `withAlerts({ defaultDuration })`, then 5000ms.
|
|
1004
|
+
*/
|
|
598
1005
|
duration?: number;
|
|
599
1006
|
/** Show a dismiss button. Default `true`. */
|
|
600
1007
|
dismissible?: boolean;
|
|
@@ -613,7 +1020,8 @@ interface AlertRef {
|
|
|
613
1020
|
afterDismissed(): Observable<void>;
|
|
614
1021
|
}
|
|
615
1022
|
/**
|
|
616
|
-
*
|
|
1023
|
+
* Tracked state for a single alert - the element type of the public
|
|
1024
|
+
* `CngxAlerter.alerts` signal. Immutable per slot; treat as read-only.
|
|
617
1025
|
*
|
|
618
1026
|
* @category ui/feedback/alert
|
|
619
1027
|
*/
|
|
@@ -621,6 +1029,10 @@ interface AlertState {
|
|
|
621
1029
|
readonly id: number;
|
|
622
1030
|
readonly config: Required<Pick<AlertConfig, 'message' | 'severity' | 'dismissible' | 'persistent'>> & Pick<AlertConfig, 'title' | 'duration' | 'scope'>;
|
|
623
1031
|
readonly createdAt: number;
|
|
1032
|
+
/**
|
|
1033
|
+
* @internal - library-owned dismissal lifecycle. Never call `next()` or
|
|
1034
|
+
* `complete()` from consumer code; observe via `AlertRef.afterDismissed()`.
|
|
1035
|
+
*/
|
|
624
1036
|
readonly dismissed$: Subject<void>;
|
|
625
1037
|
}
|
|
626
1038
|
/**
|
|
@@ -650,26 +1062,54 @@ declare class CngxAlerter {
|
|
|
650
1062
|
readonly alerts: _angular_core.WritableSignal<readonly AlertState[]>;
|
|
651
1063
|
private readonly dedupWindow;
|
|
652
1064
|
private readonly defaultDuration;
|
|
1065
|
+
/** Auto-dismiss timers keyed by alert id - not part of the public state shape. */
|
|
1066
|
+
private readonly timers;
|
|
653
1067
|
constructor();
|
|
654
1068
|
/** Show an alert. Returns a ref for programmatic dismiss. */
|
|
655
1069
|
show(config: AlertConfig): AlertRef;
|
|
1070
|
+
/**
|
|
1071
|
+
* @internal - called by `CngxAlertStack` on hover/focus (WCAG 2.2.1).
|
|
1072
|
+
* Hold-counted: hover and focus-within pause independently; the timer
|
|
1073
|
+
* resumes only when the last hold releases.
|
|
1074
|
+
*/
|
|
1075
|
+
pauseTimer(id: number): void;
|
|
1076
|
+
/** @internal - called by `CngxAlertStack` on pointer-leave/focus-out. */
|
|
1077
|
+
resumeTimer(id: number): void;
|
|
656
1078
|
/** Dismiss a single alert by id. */
|
|
657
1079
|
dismiss(id: number): void;
|
|
658
1080
|
/** Dismiss all alerts (optionally filtered by scope). */
|
|
659
1081
|
dismissAll(scope?: string): void;
|
|
1082
|
+
private startTimer;
|
|
1083
|
+
private clearTimer;
|
|
660
1084
|
private createRef;
|
|
661
1085
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlerter, never>;
|
|
662
1086
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxAlerter>;
|
|
663
1087
|
}
|
|
664
1088
|
|
|
1089
|
+
/** @internal - one rendered alert plus the service instance that owns it. */
|
|
1090
|
+
interface StackEntry {
|
|
1091
|
+
/** Render-stable key - service-local ids collide across instances. */
|
|
1092
|
+
readonly key: string;
|
|
1093
|
+
readonly state: AlertState;
|
|
1094
|
+
readonly owner: CngxAlerter;
|
|
1095
|
+
}
|
|
665
1096
|
/**
|
|
666
|
-
* Scoped alert stack - renders alerts from its own `CngxAlerter` instance
|
|
1097
|
+
* Scoped alert stack - renders alerts from its own `CngxAlerter` instance
|
|
1098
|
+
* merged with the nearest ancestor/environment instance.
|
|
667
1099
|
*
|
|
668
|
-
* Provides `CngxAlerter` via `viewProviders` -
|
|
669
|
-
*
|
|
670
|
-
*
|
|
1100
|
+
* Provides `CngxAlerter` via `viewProviders` - the stack's own instance is
|
|
1101
|
+
* private to its view. Alerts shown through an ancestor-provided alerter or
|
|
1102
|
+
* the environment alerter from `provideFeedback(withAlerts())` (the instance
|
|
1103
|
+
* `CngxAlertOn` and sibling components resolve) render here too, filtered by
|
|
1104
|
+
* `[scope]`. Nesting is supported - each stack stays independent.
|
|
1105
|
+
*
|
|
1106
|
+
* Scope your stacks when more than one is mounted: two unscoped stacks
|
|
1107
|
+
* under the same environment alerter both render (and announce) every
|
|
1108
|
+
* shared alert.
|
|
671
1109
|
*
|
|
672
1110
|
* ### In a dialog
|
|
1111
|
+
* The dialog component and the stack resolve the same environment alerter,
|
|
1112
|
+
* so programmatic alerts land in the stack below:
|
|
673
1113
|
* ```html
|
|
674
1114
|
* <dialog cngxDialog [submitAction]="save">
|
|
675
1115
|
* <header cngxDialogTitle>Edit user</header>
|
|
@@ -679,12 +1119,16 @@ declare class CngxAlerter {
|
|
|
679
1119
|
* ```
|
|
680
1120
|
*
|
|
681
1121
|
* ### Programmatic usage
|
|
1122
|
+
* Requires `provideFeedback(withAlerts())` (or an ancestor component that
|
|
1123
|
+
* provides `CngxAlerter`):
|
|
682
1124
|
* ```typescript
|
|
683
1125
|
* private readonly alerter = inject(CngxAlerter);
|
|
684
1126
|
*
|
|
685
1127
|
* handleErrors(errors: string[]) {
|
|
686
|
-
* this.alerter.dismissAll();
|
|
687
|
-
* errors.forEach(e =>
|
|
1128
|
+
* this.alerter.dismissAll('user-form');
|
|
1129
|
+
* errors.forEach(e =>
|
|
1130
|
+
* this.alerter.show({ message: e, severity: 'error', scope: 'user-form' }),
|
|
1131
|
+
* );
|
|
688
1132
|
* }
|
|
689
1133
|
* ```
|
|
690
1134
|
*
|
|
@@ -702,30 +1146,64 @@ declare class CngxAlerter {
|
|
|
702
1146
|
declare class CngxAlertStack {
|
|
703
1147
|
/** The scoped alerter instance - use to add/dismiss alerts programmatically. */
|
|
704
1148
|
readonly alerter: CngxAlerter;
|
|
1149
|
+
/**
|
|
1150
|
+
* Nearest ancestor/environment alerter - the instance `CngxAlertOn` and
|
|
1151
|
+
* sibling components resolve. Merged into the rendered stack so the
|
|
1152
|
+
* documented `withAlerts()` routing actually lands somewhere.
|
|
1153
|
+
*/
|
|
1154
|
+
private readonly parentAlerter;
|
|
705
1155
|
private readonly config;
|
|
1156
|
+
private readonly i18n;
|
|
1157
|
+
/** @internal - region name of the plain `role="region"` host; follows a switch at once. */
|
|
1158
|
+
protected readonly regionLabel: _angular_core.Signal<string>;
|
|
1159
|
+
private readonly host;
|
|
1160
|
+
private readonly injector;
|
|
706
1161
|
/** Scope filter - only shows alerts matching this scope. */
|
|
707
1162
|
readonly scope: _angular_core.InputSignal<string | undefined>;
|
|
708
|
-
/** Maximum visible alerts before collapse overflow. */
|
|
709
|
-
readonly maxVisible: _angular_core.InputSignal<number>;
|
|
1163
|
+
/** Maximum visible alerts before collapse overflow. Defaults to `withAlerts({ maxVisible })`, then 5. */
|
|
1164
|
+
readonly maxVisible: _angular_core.InputSignal<number | undefined>;
|
|
710
1165
|
/** Where new alerts appear. */
|
|
711
1166
|
readonly position: _angular_core.InputSignal<"top" | "bottom">;
|
|
712
1167
|
/** Reserve min-height for one alert to prevent layout shift. */
|
|
713
1168
|
readonly reserveSpace: _angular_core.InputSignal<boolean>;
|
|
714
1169
|
/** Auto-scroll stack into view when new alert appears. */
|
|
715
1170
|
readonly autoScroll: _angular_core.InputSignal<boolean>;
|
|
1171
|
+
/** @internal - maxVisible input, then withAlerts({ maxVisible }), then 5. */
|
|
1172
|
+
private readonly effectiveMaxVisible;
|
|
716
1173
|
/** @internal - expanded state. Resets when alert count drops to maxVisible or below. */
|
|
717
1174
|
private readonly expanded;
|
|
718
|
-
/** @internal - alerts filtered
|
|
719
|
-
private readonly
|
|
720
|
-
/** @internal -
|
|
721
|
-
protected readonly
|
|
1175
|
+
/** @internal - own + ancestor alerts, scope-filtered, newest first. */
|
|
1176
|
+
private readonly entries;
|
|
1177
|
+
/** @internal - entries within maxVisible, ordered per [position]. */
|
|
1178
|
+
protected readonly visibleEntries: _angular_core.Signal<readonly StackEntry[]>;
|
|
1179
|
+
/**
|
|
1180
|
+
* @internal - dismiss-button name inside the alert/status items. The visible
|
|
1181
|
+
* entries are the only tracked source; the copy is read untracked, so a
|
|
1182
|
+
* language switch never rewrites a shown item and the next stack change
|
|
1183
|
+
* picks it up.
|
|
1184
|
+
*/
|
|
1185
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
722
1186
|
/** @internal - number of hidden overflow alerts. */
|
|
723
1187
|
protected readonly overflowCount: _angular_core.Signal<number>;
|
|
724
|
-
/** @internal -
|
|
725
|
-
protected readonly
|
|
1188
|
+
/** @internal - accessible name of the overflow trigger. */
|
|
1189
|
+
protected readonly overflowLabel: _angular_core.Signal<string>;
|
|
1190
|
+
/** @internal - visible text of the overflow trigger, contained in its accessible name. */
|
|
1191
|
+
protected readonly overflowVisibleLabel: _angular_core.Signal<string>;
|
|
1192
|
+
/**
|
|
1193
|
+
* @internal - arrival detection derived via linkedSignal (not managed in
|
|
1194
|
+
* the effect). `arrived` is true only when a key shows up that was not
|
|
1195
|
+
* rendered before - a dismissal exposing an older neighbour is not an
|
|
1196
|
+
* arrival. The initial computation (mount with pre-existing alerts) never
|
|
1197
|
+
* counts as one.
|
|
1198
|
+
*/
|
|
1199
|
+
private readonly arrivalTransition;
|
|
1200
|
+
constructor();
|
|
726
1201
|
/** @internal - resolve icon component from global config. */
|
|
727
1202
|
protected iconFor(alert: AlertState): _angular_core.Type<unknown> | null;
|
|
728
|
-
/**
|
|
1203
|
+
/**
|
|
1204
|
+
* @internal - the overflow button removes itself on expansion, so focus is
|
|
1205
|
+
* handed to the first newly revealed alert item instead of falling to body.
|
|
1206
|
+
*/
|
|
729
1207
|
protected handleExpandOverflow(): void;
|
|
730
1208
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlertStack, never>;
|
|
731
1209
|
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>;
|
|
@@ -734,9 +1212,14 @@ declare class CngxAlertStack {
|
|
|
734
1212
|
/**
|
|
735
1213
|
* Declarative state-to-alert bridge for scoped alert stacks.
|
|
736
1214
|
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
1215
|
+
* Fires an alert when the bound `CngxAsyncState` transitions to `error`
|
|
1216
|
+
* (or optionally `success`). Only fires on actual transitions, not on
|
|
1217
|
+
* initial `idle` state.
|
|
1218
|
+
*
|
|
1219
|
+
* Alerts route through the injected `CngxAlerter` - the environment
|
|
1220
|
+
* instance from `provideFeedback(withAlerts())` or one provided by an
|
|
1221
|
+
* ancestor component. Every `CngxAlertStack` that resolves the same
|
|
1222
|
+
* instance renders them, filtered by scope:
|
|
740
1223
|
*
|
|
741
1224
|
* ```html
|
|
742
1225
|
* <cngx-alert-stack scope="form" />
|
|
@@ -744,6 +1227,7 @@ declare class CngxAlertStack {
|
|
|
744
1227
|
* <button [cngxAsyncClick]="save"
|
|
745
1228
|
* [cngxAlertOn]="saveState"
|
|
746
1229
|
* alertError="Save failed"
|
|
1230
|
+
* alertScope="form"
|
|
747
1231
|
* [alertErrorDetail]="true">
|
|
748
1232
|
* Save
|
|
749
1233
|
* </button>
|
|
@@ -759,6 +1243,8 @@ declare class CngxAlertStack {
|
|
|
759
1243
|
declare class CngxAlertOn {
|
|
760
1244
|
private readonly alerter;
|
|
761
1245
|
private readonly statefulFallback;
|
|
1246
|
+
private readonly errorDetail;
|
|
1247
|
+
private readonly i18n;
|
|
762
1248
|
/**
|
|
763
1249
|
* The async state to watch. Optional - when omitted, falls back to
|
|
764
1250
|
* `CNGX_STATEFUL` from an ancestor/self component. A bare `cngxAlertOn`
|
|
@@ -771,7 +1257,11 @@ declare class CngxAlertOn {
|
|
|
771
1257
|
readonly alertSuccess: _angular_core.InputSignal<string | undefined>;
|
|
772
1258
|
/** Alert message on error. If not set, no error alert fires. */
|
|
773
1259
|
readonly alertError: _angular_core.InputSignal<string | undefined>;
|
|
774
|
-
/**
|
|
1260
|
+
/**
|
|
1261
|
+
* Append the error detail to the alert message, as mapped by
|
|
1262
|
+
* `withErrorDetail` (default: the raw error text in development builds,
|
|
1263
|
+
* nothing in production).
|
|
1264
|
+
*/
|
|
775
1265
|
readonly alertErrorDetail: _angular_core.InputSignal<boolean>;
|
|
776
1266
|
/** Scope for the alert - matches against `CngxAlertStack`'s `[scope]` input. */
|
|
777
1267
|
readonly alertScope: _angular_core.InputSignal<string | undefined>;
|
|
@@ -912,6 +1402,18 @@ declare class CngxBanner {
|
|
|
912
1402
|
declare class CngxBannerOutlet {
|
|
913
1403
|
protected readonly service: CngxBanner;
|
|
914
1404
|
private readonly config;
|
|
1405
|
+
private readonly i18n;
|
|
1406
|
+
/**
|
|
1407
|
+
* @internal - action-error copy for the `role="alert"` slot. The banner list is the
|
|
1408
|
+
* only tracked source; the copy is read untracked, so a copy flip never rewrites a
|
|
1409
|
+
* shown alert and the next banner transition picks the new language up.
|
|
1410
|
+
*/
|
|
1411
|
+
protected readonly actionFailedCopy: _angular_core.Signal<string>;
|
|
1412
|
+
/**
|
|
1413
|
+
* @internal - dismiss-button name inside the banner live regions, keyed on the
|
|
1414
|
+
* banner list like {@link actionFailedCopy}.
|
|
1415
|
+
*/
|
|
1416
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
915
1417
|
/**
|
|
916
1418
|
* @internal - skip enter animation for banners present at first render.
|
|
917
1419
|
* Prevents layout jump when banners are known before first paint (e.g., offline state).
|
|
@@ -950,6 +1452,8 @@ declare class CngxBannerOutlet {
|
|
|
950
1452
|
declare class CngxBannerOn {
|
|
951
1453
|
private readonly bannerService;
|
|
952
1454
|
private readonly statefulFallback;
|
|
1455
|
+
private readonly errorDetail;
|
|
1456
|
+
private readonly i18n;
|
|
953
1457
|
/**
|
|
954
1458
|
* The async state to watch. Optional - when omitted, falls back to
|
|
955
1459
|
* `CNGX_STATEFUL` from an ancestor/self component. A bare `cngxBannerOn`
|
|
@@ -964,7 +1468,11 @@ declare class CngxBannerOn {
|
|
|
964
1468
|
readonly bannerError: _angular_core.InputSignal<string | undefined>;
|
|
965
1469
|
/** Banner severity on error. Default `'error'`. */
|
|
966
1470
|
readonly bannerSeverity: _angular_core.InputSignal<"warning" | "error">;
|
|
967
|
-
/**
|
|
1471
|
+
/**
|
|
1472
|
+
* Append the error detail to the banner message, as mapped by
|
|
1473
|
+
* `withErrorDetail` (default: the raw error text in development builds,
|
|
1474
|
+
* nothing in production).
|
|
1475
|
+
*/
|
|
968
1476
|
readonly bannerErrorDetail: _angular_core.InputSignal<boolean>;
|
|
969
1477
|
constructor();
|
|
970
1478
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBannerOn, never>;
|
|
@@ -1011,7 +1519,12 @@ declare class CngxBannerTrigger {
|
|
|
1011
1519
|
readonly when: _angular_core.InputSignal<boolean>;
|
|
1012
1520
|
/** Banner message text. */
|
|
1013
1521
|
readonly message: _angular_core.InputSignal<string>;
|
|
1014
|
-
/**
|
|
1522
|
+
/**
|
|
1523
|
+
* Required unique id - dedup key, shared by design. Any code (or another
|
|
1524
|
+
* trigger) using the same id updates and dismisses the same banner; there
|
|
1525
|
+
* is no per-instance guard. Namespace ids (`net:offline`, `auth:session`)
|
|
1526
|
+
* to avoid unintended collisions.
|
|
1527
|
+
*/
|
|
1015
1528
|
readonly id: _angular_core.InputSignal<string>;
|
|
1016
1529
|
/** Visual severity. */
|
|
1017
1530
|
readonly severity: _angular_core.InputSignal<AlertSeverity>;
|
|
@@ -1021,6 +1534,8 @@ declare class CngxBannerTrigger {
|
|
|
1021
1534
|
readonly actionLabel: _angular_core.InputSignal<string | undefined>;
|
|
1022
1535
|
/** Action button handler. */
|
|
1023
1536
|
readonly actionHandler: _angular_core.InputSignal<(() => void | Promise<void>) | undefined>;
|
|
1537
|
+
/** @internal - id transition derived via linkedSignal, not managed in the effect. */
|
|
1538
|
+
private readonly idTransition;
|
|
1024
1539
|
constructor();
|
|
1025
1540
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBannerTrigger, never>;
|
|
1026
1541
|
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>;
|
|
@@ -1058,7 +1573,7 @@ interface ToastConfig {
|
|
|
1058
1573
|
/** Show dismiss button. */
|
|
1059
1574
|
dismissible?: boolean;
|
|
1060
1575
|
/**
|
|
1061
|
-
* Custom component rendered as the toast body
|
|
1576
|
+
* Custom component rendered as the toast body.
|
|
1062
1577
|
* Replaces the default `message`/`description` text.
|
|
1063
1578
|
* `title` is still rendered above the component if set.
|
|
1064
1579
|
*
|
|
@@ -1068,6 +1583,13 @@ interface ToastConfig {
|
|
|
1068
1583
|
content?: Type<unknown>;
|
|
1069
1584
|
/** Inputs passed to the `content` component via `NgComponentOutlet`. */
|
|
1070
1585
|
contentInputs?: Record<string, unknown>;
|
|
1586
|
+
/**
|
|
1587
|
+
* Template rendered as the toast body - takes precedence over `content`
|
|
1588
|
+
* and `message`. `CngxToast` passes its projected content through here.
|
|
1589
|
+
*
|
|
1590
|
+
* A11y: same rule as `content` - avoid focusable elements inside.
|
|
1591
|
+
*/
|
|
1592
|
+
contentTemplate?: TemplateRef<unknown>;
|
|
1071
1593
|
}
|
|
1072
1594
|
/**
|
|
1073
1595
|
* Handle to a displayed toast - allows programmatic dismiss.
|
|
@@ -1081,25 +1603,23 @@ interface ToastRef {
|
|
|
1081
1603
|
afterDismissed(): Observable<void>;
|
|
1082
1604
|
}
|
|
1083
1605
|
/**
|
|
1084
|
-
*
|
|
1606
|
+
* Tracked state for a single toast - the element type of the public
|
|
1607
|
+
* `CngxToaster.toasts` signal. Immutable per slot; treat as read-only.
|
|
1085
1608
|
*
|
|
1086
1609
|
* @category ui/feedback/toast
|
|
1087
1610
|
*/
|
|
1088
1611
|
interface ToastState {
|
|
1089
1612
|
readonly id: number;
|
|
1090
|
-
readonly config: Required<Pick<ToastConfig, 'message' | 'severity' | 'dismissible'>> & Pick<ToastConfig, 'action' | 'title' | 'description' | 'content' | 'contentInputs'> & {
|
|
1613
|
+
readonly config: Required<Pick<ToastConfig, 'message' | 'severity' | 'dismissible'>> & Pick<ToastConfig, 'action' | 'title' | 'description' | 'content' | 'contentInputs' | 'contentTemplate'> & {
|
|
1091
1614
|
duration: number | 'persistent';
|
|
1092
1615
|
};
|
|
1093
1616
|
readonly createdAt: number;
|
|
1094
|
-
/** Timestamp when the current timer started (created or last resumed). */
|
|
1095
|
-
readonly timerStartedAt: number;
|
|
1096
1617
|
/** Dedup counter - incremented when identical toast fires again. */
|
|
1097
1618
|
readonly count: number;
|
|
1098
|
-
/**
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
/** Subject that emits on dismiss. */
|
|
1619
|
+
/**
|
|
1620
|
+
* @internal - library-owned dismissal lifecycle. Never call `next()` or
|
|
1621
|
+
* `complete()` from consumer code; observe via `ToastRef.afterDismissed()`.
|
|
1622
|
+
*/
|
|
1103
1623
|
readonly dismissed$: Subject<void>;
|
|
1104
1624
|
}
|
|
1105
1625
|
/**
|
|
@@ -1129,14 +1649,20 @@ declare class CngxToaster {
|
|
|
1129
1649
|
private nextId;
|
|
1130
1650
|
/** Reactive toast stack - read by `CngxToastOutlet`. */
|
|
1131
1651
|
readonly toasts: _angular_core.WritableSignal<readonly ToastState[]>;
|
|
1132
|
-
/** Default duration for non-error toasts
|
|
1133
|
-
readonly defaultDuration
|
|
1134
|
-
/** Dedup window in ms -
|
|
1135
|
-
readonly dedupWindow
|
|
1652
|
+
/** Default duration for non-error toasts - configure via `withToasts({ defaultDuration })`. */
|
|
1653
|
+
private readonly defaultDuration;
|
|
1654
|
+
/** Dedup window in ms - configure via `withToasts({ dedupWindow })`. */
|
|
1655
|
+
private readonly dedupWindow;
|
|
1656
|
+
/** Auto-dismiss timers keyed by toast id - not part of the public state shape. */
|
|
1657
|
+
private readonly timers;
|
|
1136
1658
|
constructor();
|
|
1137
1659
|
/** Show a toast. Returns a ref for programmatic control. */
|
|
1138
1660
|
show(config: ToastConfig): ToastRef;
|
|
1139
|
-
/**
|
|
1661
|
+
/**
|
|
1662
|
+
* @internal - called by toast-outlet on hover/focus (WCAG 2.2.1).
|
|
1663
|
+
* Hold-counted: hover and focus-within pause independently; the timer
|
|
1664
|
+
* resumes only when the last hold releases.
|
|
1665
|
+
*/
|
|
1140
1666
|
pauseTimer(id: number): void;
|
|
1141
1667
|
/** @internal - called by toast-outlet on mouse-leave/focus-out. */
|
|
1142
1668
|
resumeTimer(id: number): void;
|
|
@@ -1145,6 +1671,7 @@ declare class CngxToaster {
|
|
|
1145
1671
|
/** Dismiss all toasts. */
|
|
1146
1672
|
dismissAll(): void;
|
|
1147
1673
|
private startTimer;
|
|
1674
|
+
private clearTimer;
|
|
1148
1675
|
private createRef;
|
|
1149
1676
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxToaster, never>;
|
|
1150
1677
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxToaster>;
|
|
@@ -1175,6 +1702,10 @@ type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | '
|
|
|
1175
1702
|
* Place once in the app shell. Reads from `CngxToaster` reactively.
|
|
1176
1703
|
* Requires `provideToasts()` or `provideFeedback(withToasts())`.
|
|
1177
1704
|
*
|
|
1705
|
+
* One outlet per toaster instance: projected toast bodies (`CngxToast`
|
|
1706
|
+
* content) are captured as templates whose DOM nodes exist exactly once -
|
|
1707
|
+
* a second outlet on the same toaster renders those bodies empty.
|
|
1708
|
+
*
|
|
1178
1709
|
* ```html
|
|
1179
1710
|
* <cngx-toast-outlet position="bottom-end" [maxVisible]="5" />
|
|
1180
1711
|
* ```
|
|
@@ -1197,15 +1728,29 @@ type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | '
|
|
|
1197
1728
|
declare class CngxToastOutlet {
|
|
1198
1729
|
protected readonly service: CngxToaster;
|
|
1199
1730
|
private readonly config;
|
|
1731
|
+
private readonly i18n;
|
|
1732
|
+
/**
|
|
1733
|
+
* @internal - repeat-marker formatter for toasts, which are live regions. The toast
|
|
1734
|
+
* list is the only tracked source; the formatter is read untracked, so a copy flip
|
|
1735
|
+
* never rewrites a shown toast and the next toast transition picks it up.
|
|
1736
|
+
*/
|
|
1737
|
+
protected readonly repeatCount: _angular_core.Signal<(count: number) => string>;
|
|
1738
|
+
/**
|
|
1739
|
+
* @internal - dismiss-button name inside the toast live regions, keyed on the
|
|
1740
|
+
* toast list like {@link repeatCount}.
|
|
1741
|
+
*/
|
|
1742
|
+
protected readonly dismissLabel: _angular_core.Signal<string>;
|
|
1743
|
+
/** @internal - region name of the plain `role="region"` host; follows a switch at once. */
|
|
1744
|
+
protected readonly regionLabel: _angular_core.Signal<string>;
|
|
1200
1745
|
/** Stack position. */
|
|
1201
1746
|
readonly position: _angular_core.InputSignal<ToastPosition>;
|
|
1202
1747
|
/** Maximum visible toasts - oldest are evicted. */
|
|
1203
1748
|
readonly maxVisible: _angular_core.InputSignal<number>;
|
|
1204
1749
|
/** Insert new toasts at start or end of the stack. */
|
|
1205
|
-
readonly insertPosition: _angular_core.InputSignal<"
|
|
1750
|
+
readonly insertPosition: _angular_core.InputSignal<"end" | "start">;
|
|
1206
1751
|
/** @internal */
|
|
1207
1752
|
protected readonly positionClass: _angular_core.Signal<string>;
|
|
1208
|
-
/** @internal - slice to maxVisible, respecting insert position. */
|
|
1753
|
+
/** @internal - slice to maxVisible, respecting insert position. ToastState is immutable per slot. */
|
|
1209
1754
|
protected readonly visibleToasts: _angular_core.Signal<readonly ToastState[]>;
|
|
1210
1755
|
/** @internal - resolve icon component from global config or null. */
|
|
1211
1756
|
protected iconFor(toast: ToastState): _angular_core.Type<unknown> | null;
|
|
@@ -1257,6 +1802,8 @@ declare class CngxToastOutlet {
|
|
|
1257
1802
|
declare class CngxToastOn {
|
|
1258
1803
|
private readonly toast;
|
|
1259
1804
|
private readonly statefulFallback;
|
|
1805
|
+
private readonly errorDetail;
|
|
1806
|
+
private readonly i18n;
|
|
1260
1807
|
private readonly toastService;
|
|
1261
1808
|
/**
|
|
1262
1809
|
* The async state to watch. Optional - when omitted, the bridge falls back
|
|
@@ -1271,7 +1818,11 @@ declare class CngxToastOn {
|
|
|
1271
1818
|
readonly toastSuccess: _angular_core.InputSignal<string | undefined>;
|
|
1272
1819
|
/** Toast message on error. If not set, no error toast fires. */
|
|
1273
1820
|
readonly toastError: _angular_core.InputSignal<string | undefined>;
|
|
1274
|
-
/**
|
|
1821
|
+
/**
|
|
1822
|
+
* Append the error detail to the toast message, as mapped by
|
|
1823
|
+
* `withErrorDetail` (default: the raw error text in development builds,
|
|
1824
|
+
* nothing in production).
|
|
1825
|
+
*/
|
|
1275
1826
|
readonly toastErrorDetail: _angular_core.InputSignal<boolean>;
|
|
1276
1827
|
/** Duration for success toasts in ms. */
|
|
1277
1828
|
readonly toastSuccessDuration: _angular_core.InputSignal<number>;
|
|
@@ -1296,9 +1847,14 @@ declare class CngxToastOn {
|
|
|
1296
1847
|
* ```
|
|
1297
1848
|
*
|
|
1298
1849
|
* ### With custom content
|
|
1850
|
+
* Projected content replaces `message` as the toast body. Keep it
|
|
1851
|
+
* non-interactive - the toast renders inside a live region, where focusable
|
|
1852
|
+
* elements are unreachable for screen reader users. For a button, use
|
|
1853
|
+
* `actionLabel`/`actionHandler` instead.
|
|
1299
1854
|
* ```html
|
|
1300
|
-
* <cngx-toast severity="error" [when]="hasError()"
|
|
1301
|
-
*
|
|
1855
|
+
* <cngx-toast severity="error" [when]="hasError()"
|
|
1856
|
+
* actionLabel="Retry" [actionHandler]="retry">
|
|
1857
|
+
* Something went <strong>wrong</strong>.
|
|
1302
1858
|
* </cngx-toast>
|
|
1303
1859
|
* ```
|
|
1304
1860
|
*
|
|
@@ -1337,12 +1893,29 @@ declare class CngxToast {
|
|
|
1337
1893
|
/** Action button config. */
|
|
1338
1894
|
readonly actionLabel: _angular_core.InputSignal<string | undefined>;
|
|
1339
1895
|
readonly actionHandler: _angular_core.InputSignal<(() => void) | undefined>;
|
|
1896
|
+
/** Emitted when the shown toast is dismissed (auto, manual, or falling edge). */
|
|
1897
|
+
readonly dismissed: _angular_core.OutputEmitterRef<void>;
|
|
1340
1898
|
/** @internal */
|
|
1341
1899
|
private readonly action;
|
|
1900
|
+
private readonly projectedContent;
|
|
1342
1901
|
private activeRef;
|
|
1902
|
+
/**
|
|
1903
|
+
* @internal - edge detection derived via linkedSignal, not managed in the
|
|
1904
|
+
* effect. The pre-bind baseline is `false`, so an initial `[when]="true"`
|
|
1905
|
+
* counts as a rising edge.
|
|
1906
|
+
*/
|
|
1907
|
+
private readonly whenEdge;
|
|
1343
1908
|
constructor();
|
|
1909
|
+
/**
|
|
1910
|
+
* Returns the content template when something was actually projected,
|
|
1911
|
+
* `undefined` otherwise (then `message` renders). Presence is probed per
|
|
1912
|
+
* show via a throwaway embedded view - conditional content may appear
|
|
1913
|
+
* between edges, so the result is never cached. Deferred projection
|
|
1914
|
+
* re-attaches the nodes wherever the template instantiates next.
|
|
1915
|
+
*/
|
|
1916
|
+
private captureProjectedContent;
|
|
1344
1917
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxToast, never>;
|
|
1345
|
-
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,
|
|
1918
|
+
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>;
|
|
1346
1919
|
}
|
|
1347
1920
|
|
|
1348
1921
|
/**
|
|
@@ -1437,6 +2010,10 @@ declare class CngxAsyncErrorTpl {
|
|
|
1437
2010
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/async-container/async-container.ts
|
|
1438
2011
|
* @since 0.1.0
|
|
1439
2012
|
* @relatedTo CngxLoadingIndicator, CngxLoadingOverlay, CngxAlert, CngxToaster
|
|
2013
|
+
* @slot cngxAsyncContent Rendered on success; gets the resolved value.
|
|
2014
|
+
* @slot cngxAsyncSkeleton Rendered during the first load.
|
|
2015
|
+
* @slot cngxAsyncEmpty Rendered when the value resolves to nothing.
|
|
2016
|
+
* @slot cngxAsyncError Rendered on failure; gets the error as `$implicit` (use `let-err`).
|
|
1440
2017
|
*
|
|
1441
2018
|
* <example-url>http://localhost:4200/#/forms/filter-builder/filter-builder-async-state/loading-error-content-branches-via-cngx-async-container</example-url>
|
|
1442
2019
|
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngx-async-container-full-control-toast</example-url>
|
|
@@ -1448,8 +2025,14 @@ declare class CngxAsyncErrorTpl {
|
|
|
1448
2025
|
*/
|
|
1449
2026
|
declare class CngxAsyncContainer<T> {
|
|
1450
2027
|
private readonly toaster;
|
|
2028
|
+
protected readonly i18n: _angular_core.Signal<_cngx_ui_feedback.CngxFeedbackI18n>;
|
|
2029
|
+
private readonly loadingConfig;
|
|
1451
2030
|
/** The async state to render. */
|
|
1452
2031
|
readonly state: _angular_core.InputSignal<CngxAsyncState<T>>;
|
|
2032
|
+
/** Delay in ms before the skeleton view / refresh bar shows. Defaults to `CNGX_LOADING_CONFIG.showDelay`. */
|
|
2033
|
+
readonly showDelay: _angular_core.InputSignal<number>;
|
|
2034
|
+
/** Minimum time in ms the skeleton view / refresh bar stays once shown. Defaults to `CNGX_LOADING_CONFIG.minDwell`. */
|
|
2035
|
+
readonly minDwell: _angular_core.InputSignal<number>;
|
|
1453
2036
|
/** Show refresh indicator bar during refresh/re-query. */
|
|
1454
2037
|
readonly refreshIndicator: _angular_core.InputSignal<boolean>;
|
|
1455
2038
|
/** ARIA label for the region. */
|
|
@@ -1470,6 +2053,14 @@ declare class CngxAsyncContainer<T> {
|
|
|
1470
2053
|
protected readonly activeView: _angular_core.Signal<AsyncView>;
|
|
1471
2054
|
/** @internal */
|
|
1472
2055
|
protected readonly showRefreshIndicator: _angular_core.Signal<boolean>;
|
|
2056
|
+
/**
|
|
2057
|
+
* @internal - flash-suppressed first-load skeleton view. A sub-`showDelay` first
|
|
2058
|
+
* load never renders the skeleton outlet; once shown it holds for `minDwell`. The
|
|
2059
|
+
* region `aria-busy` stays truthful (`state().isBusy()`); only the visual is gated.
|
|
2060
|
+
*/
|
|
2061
|
+
protected readonly skeletonVisible: _angular_core.Signal<boolean>;
|
|
2062
|
+
/** @internal - flash-suppressed refresh bar, gated by the same showDelay + minDwell. */
|
|
2063
|
+
protected readonly refreshVisible: _angular_core.Signal<boolean>;
|
|
1473
2064
|
/** @internal */
|
|
1474
2065
|
protected readonly contentContext: _angular_core.Signal<{
|
|
1475
2066
|
$implicit: T;
|
|
@@ -1483,8 +2074,8 @@ declare class CngxAsyncContainer<T> {
|
|
|
1483
2074
|
constructor();
|
|
1484
2075
|
private fireToast;
|
|
1485
2076
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAsyncContainer<any>, never>;
|
|
1486
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAsyncContainer<any>, "cngx-async-container", never, { "state": { "alias": "state"; "required": true; "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>;
|
|
2077
|
+
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>;
|
|
1487
2078
|
}
|
|
1488
2079
|
|
|
1489
|
-
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 };
|
|
1490
|
-
export type { AlertConfig, AlertRef, AlertSeverity, AlertState, AlertVisibilityPhase, BannerConfig, BannerRef, BannerState, FeedbackConfig, FeedbackFeature, LoadingIndicatorVariant, ProgressVariant, ToastConfig, ToastPosition, ToastRef };
|
|
2080
|
+
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 };
|
|
2081
|
+
export type { AlertConfig, AlertRef, AlertSeverity, AlertState, AlertVisibilityPhase, BannerConfig, BannerRef, BannerState, CngxErrorDetailFn, CngxFeedbackAnnouncements, CngxFeedbackAnnouncementsLanguage, CngxFeedbackI18n, CngxFeedbackI18nOverrides, CngxFeedbackLanguageSection, FeedbackConfig, FeedbackFeature, LoadingIndicatorVariant, ProgressVariant, ToastConfig, ToastPosition, ToastRef, ToastState };
|