@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -48
- package/action-button/README.md +9 -11
- package/empty-state/README.md +11 -26
- package/feedback/README.md +3 -3
- package/fesm2022/cngx-ui-action-button.mjs +30 -26
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +26 -21
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +498 -261
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +32 -5
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +79 -104
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +111 -83
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-material.mjs +14 -3
- package/fesm2022/cngx-ui-material.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +22 -3
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +107 -28
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +61 -20
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +14 -5
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +484 -161
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +75 -39
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +2 -1
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/layout/README.md +9 -44
- package/mat-stepper/README.md +7 -10
- package/mat-tabs/README.md +13 -13
- package/mat-tabs/styles/mat-tabs.css +339 -213
- package/material/README.md +19 -19
- package/overlay/README.md +11 -11
- package/package.json +5 -4
- package/sidenav/README.md +4 -19
- package/skeleton/README.md +3 -17
- package/speak/README.md +15 -15
- package/stepper/README.md +139 -5
- package/tabs/README.md +4 -4
- package/theming/system-tokens.css +29 -0
- package/types/cngx-ui-action-button.d.ts +28 -13
- package/types/cngx-ui-empty-state.d.ts +21 -9
- package/types/cngx-ui-feedback.d.ts +437 -121
- package/types/cngx-ui-layout.d.ts +38 -8
- package/types/cngx-ui-mat-stepper.d.ts +58 -43
- package/types/cngx-ui-mat-tabs.d.ts +122 -72
- package/types/cngx-ui-material.d.ts +12 -1
- package/types/cngx-ui-overlay.d.ts +25 -4
- package/types/cngx-ui-sidenav.d.ts +106 -12
- package/types/cngx-ui-skeleton.d.ts +62 -8
- package/types/cngx-ui-speak.d.ts +10 -2
- package/types/cngx-ui-stepper.d.ts +280 -56
- package/types/cngx-ui-tabs.d.ts +38 -10
- package/types/cngx-ui.d.ts +1 -0
- package/speak/speak-button-theme.scss +0 -78
|
@@ -4,14 +4,18 @@ import { CngxAsyncState } from '@cngx/core/utils';
|
|
|
4
4
|
import { Observable, Subject } from 'rxjs';
|
|
5
5
|
import { AsyncView } from '@cngx/common/data';
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Visual variant for the loading indicator.
|
|
9
|
+
*
|
|
10
|
+
* @category ui/feedback/loading
|
|
11
|
+
*/
|
|
8
12
|
type LoadingIndicatorVariant = 'spinner' | 'bar';
|
|
9
13
|
/**
|
|
10
|
-
* Loading indicator atom
|
|
14
|
+
* Loading indicator atom - purely visual, blocks no interaction.
|
|
11
15
|
*
|
|
12
16
|
* Two variants:
|
|
13
|
-
* - `spinner`
|
|
14
|
-
* - `bar`
|
|
17
|
+
* - `spinner` - rotating circle, inline or centered
|
|
18
|
+
* - `bar` - thin line at the top of the container (YouTube-style)
|
|
15
19
|
*
|
|
16
20
|
* Timing:
|
|
17
21
|
* - `delay` (default 200ms): operations faster than this never show the indicator
|
|
@@ -28,12 +32,22 @@ type LoadingIndicatorVariant = 'spinner' | 'bar';
|
|
|
28
32
|
* ```html
|
|
29
33
|
* <cngx-loading-indicator [loading]="isLoading()" label="Fetching data" />
|
|
30
34
|
* ```
|
|
35
|
+
*
|
|
36
|
+
* @category ui/feedback/loading
|
|
37
|
+
* @docsKind primary
|
|
38
|
+
* @wcag AA
|
|
39
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/loading/loading-indicator.ts
|
|
40
|
+
* @since 0.1.0
|
|
41
|
+
* @relatedTo CngxLoadingOverlay, CngxProgress, CngxAsyncContainer
|
|
42
|
+
*
|
|
43
|
+
* <example-url>http://localhost:4200/#/ui/feedback/loading-indicator/bar-variant</example-url>
|
|
44
|
+
* <example-url>http://localhost:4200/#/ui/feedback/loading-indicator/spinner-variant</example-url>
|
|
31
45
|
*/
|
|
32
46
|
declare class CngxLoadingIndicator {
|
|
33
47
|
private readonly config;
|
|
34
|
-
/** Bind an async state
|
|
48
|
+
/** Bind an async state - shows indicator when `isBusy()`. */
|
|
35
49
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
36
|
-
/** Direct boolean control
|
|
50
|
+
/** Direct boolean control - alternative to `[state]`. */
|
|
37
51
|
readonly loading: _angular_core.InputSignal<boolean>;
|
|
38
52
|
/** Visual variant. */
|
|
39
53
|
readonly variant: _angular_core.InputSignal<LoadingIndicatorVariant>;
|
|
@@ -43,24 +57,24 @@ declare class CngxLoadingIndicator {
|
|
|
43
57
|
readonly delay: _angular_core.InputSignal<number>;
|
|
44
58
|
/** Minimum display time in ms once visible. Falls back to global config, then 500ms. */
|
|
45
59
|
readonly minDuration: _angular_core.InputSignal<number>;
|
|
46
|
-
/** @internal
|
|
60
|
+
/** @internal - true when the underlying source says "loading". */
|
|
47
61
|
protected readonly isActive: _angular_core.Signal<boolean>;
|
|
48
|
-
/** @internal
|
|
62
|
+
/** @internal - custom spinner component from global config. */
|
|
49
63
|
protected readonly customSpinner: _angular_core.Signal<_angular_core.Type<unknown> | null>;
|
|
50
|
-
/** @internal
|
|
64
|
+
/** @internal - final visibility after delay + minDuration. */
|
|
51
65
|
readonly visible: _angular_core.Signal<boolean>;
|
|
52
66
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLoadingIndicator, never>;
|
|
53
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>;
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
/**
|
|
57
|
-
* Loading overlay
|
|
71
|
+
* Loading overlay - content container that blocks interaction while loading.
|
|
58
72
|
*
|
|
59
73
|
* Projects content inside a wrapper that receives `inert` during loading.
|
|
60
74
|
* Renders a centered spinner over a semi-transparent backdrop.
|
|
61
75
|
* Manages focus save/restore across the inert lifecycle.
|
|
62
76
|
*
|
|
63
|
-
* Uses `display: grid` with a shared grid cell
|
|
77
|
+
* Uses `display: grid` with a shared grid cell - backdrop and content
|
|
64
78
|
* overlap naturally without `position: absolute` or `display: contents`.
|
|
65
79
|
*
|
|
66
80
|
* ### With async state
|
|
@@ -83,13 +97,22 @@ declare class CngxLoadingIndicator {
|
|
|
83
97
|
* <cngx-async-container [state]="query">...</cngx-async-container>
|
|
84
98
|
* </cngx-loading-overlay>
|
|
85
99
|
* ```
|
|
100
|
+
*
|
|
101
|
+
* @category ui/feedback/loading
|
|
102
|
+
* @docsKind primary
|
|
103
|
+
* @wcag AA
|
|
104
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/loading/loading-overlay.ts
|
|
105
|
+
* @since 0.1.0
|
|
106
|
+
* @relatedTo CngxLoadingIndicator, CngxProgress, CngxAsyncContainer
|
|
107
|
+
*
|
|
108
|
+
* <example-url>http://localhost:4200/#/ui/feedback/loading-overlay/overlay-with-form</example-url>
|
|
86
109
|
*/
|
|
87
110
|
declare class CngxLoadingOverlay {
|
|
88
111
|
private readonly doc;
|
|
89
112
|
private readonly config;
|
|
90
|
-
/** Bind an async state
|
|
113
|
+
/** Bind an async state - shows overlay when `isBusy()`. */
|
|
91
114
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
92
|
-
/** Direct boolean control
|
|
115
|
+
/** Direct boolean control - alternative to `[state]`. */
|
|
93
116
|
readonly loading: _angular_core.InputSignal<boolean>;
|
|
94
117
|
/** Screen reader label for the spinner. */
|
|
95
118
|
readonly label: _angular_core.InputSignal<string>;
|
|
@@ -105,7 +128,7 @@ declare class CngxLoadingOverlay {
|
|
|
105
128
|
readonly firstLoadOnly: _angular_core.InputSignal<boolean>;
|
|
106
129
|
/** @internal */
|
|
107
130
|
protected readonly isActive: _angular_core.Signal<boolean>;
|
|
108
|
-
/** @internal
|
|
131
|
+
/** @internal - debounced visibility via shared timer factory. */
|
|
109
132
|
protected readonly visible: _angular_core.Signal<boolean>;
|
|
110
133
|
private readonly savedFocus;
|
|
111
134
|
private readonly contentWrapper;
|
|
@@ -115,17 +138,21 @@ declare class CngxLoadingOverlay {
|
|
|
115
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>;
|
|
116
139
|
}
|
|
117
140
|
|
|
118
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Visual variant for the progress indicator.
|
|
143
|
+
*
|
|
144
|
+
* @category ui/feedback/loading
|
|
145
|
+
*/
|
|
119
146
|
type ProgressVariant = 'linear' | 'circular';
|
|
120
147
|
/**
|
|
121
|
-
* Progress indicator atom
|
|
148
|
+
* Progress indicator atom - determinate or indeterminate.
|
|
122
149
|
*
|
|
123
150
|
* Automatically switches between modes based on whether `progress` is defined:
|
|
124
|
-
* - **Indeterminate** (`progress === undefined`)
|
|
125
|
-
* - **Determinate** (`progress` 0–100)
|
|
151
|
+
* - **Indeterminate** (`progress === undefined`) - animated line, no value
|
|
152
|
+
* - **Determinate** (`progress` 0–100) - bar with percentage
|
|
126
153
|
*
|
|
127
154
|
* CSS `transition` on bar width (300ms ease-out) smooths jumpy updates.
|
|
128
|
-
* `aria-valuenow` is only present in determinate mode
|
|
155
|
+
* `aria-valuenow` is only present in determinate mode - AT uses its
|
|
129
156
|
* absence to distinguish the two modes.
|
|
130
157
|
*
|
|
131
158
|
* ### With async state
|
|
@@ -137,9 +164,20 @@ type ProgressVariant = 'linear' | 'circular';
|
|
|
137
164
|
* ```html
|
|
138
165
|
* <cngx-progress [progress]="percent()" label="Processing" />
|
|
139
166
|
* ```
|
|
167
|
+
*
|
|
168
|
+
* @category ui/feedback/loading
|
|
169
|
+
* @docsKind primary
|
|
170
|
+
* @wcag AA
|
|
171
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/loading/progress.ts
|
|
172
|
+
* @since 0.1.0
|
|
173
|
+
* @relatedTo CngxLoadingIndicator, CngxLoadingOverlay, CngxAsyncContainer
|
|
174
|
+
*
|
|
175
|
+
* <example-url>http://localhost:4200/#/ui/feedback/progress/circular-variant</example-url>
|
|
176
|
+
* <example-url>http://localhost:4200/#/ui/feedback/progress/linear-determinate</example-url>
|
|
177
|
+
* <example-url>http://localhost:4200/#/ui/feedback/progress/linear-indeterminate</example-url>
|
|
140
178
|
*/
|
|
141
179
|
declare class CngxProgress {
|
|
142
|
-
/** Bind an async state
|
|
180
|
+
/** Bind an async state - reads `progress()` for determinate mode. */
|
|
143
181
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
144
182
|
/** Direct progress value (0–100). `undefined` = indeterminate. */
|
|
145
183
|
readonly progress: _angular_core.InputSignal<number | undefined>;
|
|
@@ -153,23 +191,45 @@ declare class CngxProgress {
|
|
|
153
191
|
protected readonly effectiveProgress: _angular_core.Signal<number | undefined>;
|
|
154
192
|
/** @internal */
|
|
155
193
|
protected readonly isDeterminate: _angular_core.Signal<boolean>;
|
|
156
|
-
/** @internal
|
|
194
|
+
/** @internal - `null` removes the attribute from the DOM for indeterminate mode. */
|
|
157
195
|
protected readonly ariaValueNow: _angular_core.Signal<number | null>;
|
|
158
196
|
/** @internal */
|
|
159
197
|
protected readonly ariaValueText: _angular_core.Signal<string | null>;
|
|
160
198
|
/** @internal */
|
|
161
199
|
protected readonly circleDashArray: string;
|
|
162
|
-
/** @internal
|
|
200
|
+
/** @internal - SVG circle dash offset for determinate circular mode. */
|
|
163
201
|
protected readonly circleDashOffset: _angular_core.Signal<number>;
|
|
164
202
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxProgress, never>;
|
|
165
203
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxProgress, "cngx-progress", never, { "state": { "alias": "state"; "required": false; "isSignal": true; }; "progress": { "alias": "progress"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "showLabel": { "alias": "showLabel"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
166
204
|
}
|
|
167
205
|
|
|
168
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Severity level for the alert - determines visual style, icon, and ARIA role.
|
|
208
|
+
*
|
|
209
|
+
* @category ui/feedback/alert
|
|
210
|
+
*/
|
|
169
211
|
type AlertSeverity = 'info' | 'success' | 'warning' | 'error';
|
|
170
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Visibility phase for enter/exit CSS animations.
|
|
214
|
+
*
|
|
215
|
+
* @category ui/feedback/alert
|
|
216
|
+
*/
|
|
171
217
|
type AlertVisibilityPhase = 'hidden' | 'entering' | 'visible' | 'exiting';
|
|
172
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* Content slot directive for custom alert icons.
|
|
220
|
+
*
|
|
221
|
+
* @category ui/feedback/alert
|
|
222
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/alert/alert.ts
|
|
223
|
+
* @since 0.1.0
|
|
224
|
+
* @relatedTo CngxAlert, CngxAlertAction
|
|
225
|
+
*
|
|
226
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/action-buttons</example-url>
|
|
227
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/auto-collapse</example-url>
|
|
228
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/boolean-trigger-when</example-url>
|
|
229
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/closable</example-url>
|
|
230
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/severities</example-url>
|
|
231
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/state-driven-visibility</example-url>
|
|
232
|
+
*/
|
|
173
233
|
declare class CngxAlertIcon {
|
|
174
234
|
readonly templateRef: TemplateRef<any> | null;
|
|
175
235
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlertIcon, never>;
|
|
@@ -187,6 +247,19 @@ declare class CngxAlertIcon {
|
|
|
187
247
|
* <button cngxAlertAction (click)="retry()">Retry</button>
|
|
188
248
|
* </cngx-alert>
|
|
189
249
|
* ```
|
|
250
|
+
*
|
|
251
|
+
* @category ui/feedback/alert
|
|
252
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/alert/alert.ts
|
|
253
|
+
* @selector [cngxAlertAction]
|
|
254
|
+
* @since 0.1.0
|
|
255
|
+
* @relatedTo CngxAlert, CngxAlertIcon
|
|
256
|
+
*
|
|
257
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/action-buttons</example-url>
|
|
258
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/auto-collapse</example-url>
|
|
259
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/boolean-trigger-when</example-url>
|
|
260
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/closable</example-url>
|
|
261
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/severities</example-url>
|
|
262
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/state-driven-visibility</example-url>
|
|
190
263
|
*/
|
|
191
264
|
declare class CngxAlertAction {
|
|
192
265
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlertAction, never>;
|
|
@@ -202,11 +275,25 @@ declare class CngxAlertAction {
|
|
|
202
275
|
* - **Boolean-driven** (`[when]`): visible when true, hidden when false
|
|
203
276
|
*
|
|
204
277
|
* `[state]` takes precedence over `[when]`.
|
|
278
|
+
*
|
|
279
|
+
* @category ui/feedback/alert
|
|
280
|
+
* @docsKind primary
|
|
281
|
+
* @wcag AA
|
|
282
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/alert/alert.ts
|
|
283
|
+
* @since 0.1.0
|
|
284
|
+
* @relatedTo CngxAlertStack, CngxAlerter, CngxAlertOn, CngxAlertIcon, CngxAlertAction
|
|
285
|
+
*
|
|
286
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/action-buttons</example-url>
|
|
287
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/auto-collapse</example-url>
|
|
288
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/boolean-trigger-when</example-url>
|
|
289
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/closable</example-url>
|
|
290
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/severities</example-url>
|
|
291
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert/state-driven-visibility</example-url>
|
|
205
292
|
*/
|
|
206
293
|
declare class CngxAlert {
|
|
207
294
|
private readonly config;
|
|
208
295
|
private readonly destroyRef;
|
|
209
|
-
/** Alert severity
|
|
296
|
+
/** Alert severity - determines visual style, default icon, and ARIA role. */
|
|
210
297
|
readonly severity: _angular_core.InputSignal<AlertSeverity>;
|
|
211
298
|
/** Optional title displayed above the content. */
|
|
212
299
|
readonly title: _angular_core.InputSignal<string | undefined>;
|
|
@@ -217,7 +304,7 @@ declare class CngxAlert {
|
|
|
217
304
|
readonly dismissible: _angular_core.InputSignal<boolean>;
|
|
218
305
|
/** Shows a dismiss button. Preferred over deprecated `dismissible`. */
|
|
219
306
|
readonly closable: _angular_core.InputSignal<boolean>;
|
|
220
|
-
/** Bind an async state
|
|
307
|
+
/** Bind an async state - auto-shows on error/success/loading, auto-hides on idle. */
|
|
221
308
|
readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
|
|
222
309
|
/**
|
|
223
310
|
* Boolean visibility trigger. When set, controls alert visibility directly.
|
|
@@ -229,45 +316,45 @@ declare class CngxAlert {
|
|
|
229
316
|
* Set to `undefined` to disable auto-dismiss (persistent).
|
|
230
317
|
*/
|
|
231
318
|
readonly autoDismissDelay: _angular_core.InputSignal<number | undefined>;
|
|
232
|
-
/** Enables auto-collapse after `collapseDelay`. Visual only
|
|
319
|
+
/** Enables auto-collapse after `collapseDelay`. Visual only - SR reads full content. */
|
|
233
320
|
readonly collapsible: _angular_core.InputSignal<boolean>;
|
|
234
321
|
/** Delay in ms before auto-collapsing. Defaults to `autoDismissDelay`. */
|
|
235
322
|
readonly collapseDelay: _angular_core.InputSignal<number | undefined>;
|
|
236
323
|
/** Emitted when the dismiss button is clicked. */
|
|
237
324
|
readonly dismissed: _angular_core.OutputEmitterRef<void>;
|
|
238
|
-
/** @internal
|
|
325
|
+
/** @internal - detects projected custom icon to hide default/global icon. */
|
|
239
326
|
protected readonly customIcon: _angular_core.Signal<CngxAlertIcon | undefined>;
|
|
240
|
-
/** @internal
|
|
327
|
+
/** @internal - detects projected action buttons for aria-atomic strategy. */
|
|
241
328
|
protected readonly hasActions: _angular_core.Signal<CngxAlertAction | undefined>;
|
|
242
329
|
private readonly manualDismissed;
|
|
243
330
|
private readonly autoDismissed;
|
|
244
331
|
private readonly collapsedState;
|
|
245
332
|
private readonly announcementState;
|
|
246
|
-
/** @internal
|
|
333
|
+
/** @internal - animation phase, drives host CSS classes. */
|
|
247
334
|
protected readonly visibilityPhase: _angular_core.WritableSignal<AlertVisibilityPhase>;
|
|
248
335
|
private readonly autoDismissTimer;
|
|
249
336
|
private readonly collapseTimer;
|
|
250
337
|
private animationFallbackId;
|
|
251
|
-
/** @internal
|
|
338
|
+
/** @internal - global icon component for the current severity (from provideFeedback config). */
|
|
252
339
|
protected readonly globalIcon: _angular_core.Signal<_angular_core.Type<unknown> | null>;
|
|
253
|
-
/** @internal
|
|
340
|
+
/** @internal - merged closable from new and deprecated input. */
|
|
254
341
|
protected readonly effectiveClosable: _angular_core.Signal<boolean>;
|
|
255
|
-
/** @internal
|
|
342
|
+
/** @internal - ARIA role: 'alert' for error/warning, 'status' for info/success. */
|
|
256
343
|
protected readonly ariaRole: _angular_core.Signal<"alert" | "status">;
|
|
257
|
-
/** @internal
|
|
344
|
+
/** @internal - false when actions are projected to prevent full re-announcement. */
|
|
258
345
|
protected readonly ariaAtomic: _angular_core.Signal<"false" | "true">;
|
|
259
|
-
/** @internal
|
|
346
|
+
/** @internal - true when bound state is in a busy status. */
|
|
260
347
|
protected readonly isStateBusy: _angular_core.Signal<boolean>;
|
|
261
348
|
/**
|
|
262
|
-
* @internal
|
|
349
|
+
* @internal - whether the alert SHOULD be visible (before animation).
|
|
263
350
|
* Drives the animation effect which manages visibilityPhase.
|
|
264
351
|
*/
|
|
265
352
|
protected readonly shouldBeVisible: _angular_core.Signal<boolean>;
|
|
266
|
-
/** @internal
|
|
353
|
+
/** @internal - true when the alert is currently visible (post-animation). */
|
|
267
354
|
protected readonly isVisible: _angular_core.Signal<boolean>;
|
|
268
|
-
/** @internal
|
|
355
|
+
/** @internal - collapsed state (read-only public view). */
|
|
269
356
|
protected readonly collapsed: _angular_core.Signal<boolean>;
|
|
270
|
-
/** @internal
|
|
357
|
+
/** @internal - SR announcement text for state transitions. */
|
|
271
358
|
protected readonly announcement: _angular_core.Signal<string>;
|
|
272
359
|
private readonly effectiveCollapseDelay;
|
|
273
360
|
constructor();
|
|
@@ -281,13 +368,13 @@ declare class CngxAlert {
|
|
|
281
368
|
protected handleAnimationEnd(event: AnimationEvent): void;
|
|
282
369
|
/** @internal */
|
|
283
370
|
protected handleDismiss(): void;
|
|
284
|
-
/** @internal
|
|
371
|
+
/** @internal - WCAG 2.2.1: pause auto-dismiss on hover. */
|
|
285
372
|
protected handlePointerEnter(): void;
|
|
286
|
-
/** @internal
|
|
373
|
+
/** @internal - resume timers on pointer leave. */
|
|
287
374
|
protected handlePointerLeave(): void;
|
|
288
|
-
/** @internal
|
|
375
|
+
/** @internal - WCAG 2.2.1: pause auto-dismiss on focus. */
|
|
289
376
|
protected handleFocusIn(): void;
|
|
290
|
-
/** @internal
|
|
377
|
+
/** @internal - resume timers on focus out. */
|
|
291
378
|
protected handleFocusOut(): void;
|
|
292
379
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlert, never>;
|
|
293
380
|
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>;
|
|
@@ -296,6 +383,8 @@ declare class CngxAlert {
|
|
|
296
383
|
/**
|
|
297
384
|
* Global configuration for all feedback components.
|
|
298
385
|
* Provided via `provideFeedback()` with `with*` features.
|
|
386
|
+
*
|
|
387
|
+
* @category ui/feedback
|
|
299
388
|
*/
|
|
300
389
|
interface FeedbackConfig {
|
|
301
390
|
/** Custom spinner component to replace the built-in SVG spinner. */
|
|
@@ -306,7 +395,7 @@ interface FeedbackConfig {
|
|
|
306
395
|
loadingDelay?: number;
|
|
307
396
|
/** Default minimum display time in ms for loading indicators. */
|
|
308
397
|
loadingMinDuration?: number;
|
|
309
|
-
/** Custom close/dismiss icon component
|
|
398
|
+
/** Custom close/dismiss icon component - replaces default X SVG globally. */
|
|
310
399
|
closeIconComponent?: Type<unknown>;
|
|
311
400
|
/** Default auto-dismiss duration for toasts in ms. */
|
|
312
401
|
toastDefaultDuration?: number;
|
|
@@ -322,13 +411,22 @@ interface FeedbackConfig {
|
|
|
322
411
|
/**
|
|
323
412
|
* Injection token for the global feedback configuration.
|
|
324
413
|
* Components read this with `inject(CNGX_FEEDBACK_CONFIG, { optional: true })`.
|
|
414
|
+
*
|
|
415
|
+
* @category ui/feedback
|
|
416
|
+
* @wcag AA
|
|
417
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/config/feedback-config.ts
|
|
418
|
+
* @since 0.1.0
|
|
325
419
|
*/
|
|
326
420
|
declare const CNGX_FEEDBACK_CONFIG: InjectionToken<FeedbackConfig>;
|
|
327
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* A feature configuration function returned by `withXxx()` helpers.
|
|
423
|
+
*
|
|
424
|
+
* @category ui/feedback
|
|
425
|
+
*/
|
|
328
426
|
interface FeedbackFeature {
|
|
329
427
|
/** @internal */
|
|
330
428
|
readonly _apply: (config: FeedbackConfig) => FeedbackConfig;
|
|
331
|
-
/** @internal
|
|
429
|
+
/** @internal - additional providers contributed by this feature. */
|
|
332
430
|
readonly _providers?: Provider[];
|
|
333
431
|
}
|
|
334
432
|
/**
|
|
@@ -345,23 +443,27 @@ interface FeedbackFeature {
|
|
|
345
443
|
* ],
|
|
346
444
|
* });
|
|
347
445
|
* ```
|
|
446
|
+
*
|
|
447
|
+
* @category ui/feedback
|
|
348
448
|
*/
|
|
349
449
|
declare function provideFeedback(...features: FeedbackFeature[]): EnvironmentProviders;
|
|
350
450
|
/**
|
|
351
451
|
* Replace the built-in SVG spinner in `CngxLoadingIndicator` and `CngxLoadingOverlay`.
|
|
352
452
|
*
|
|
353
|
-
* The component receives no inputs
|
|
453
|
+
* The component receives no inputs - it should be a self-contained spinner
|
|
354
454
|
* (e.g. a Lucide `<loader-2>` with CSS animation, or a Material `<mat-spinner>`).
|
|
355
455
|
*
|
|
356
456
|
* ```ts
|
|
357
457
|
* provideFeedback(withSpinnerTemplate(MatProgressSpinner))
|
|
358
458
|
* ```
|
|
459
|
+
*
|
|
460
|
+
* @category ui/feedback/loading
|
|
359
461
|
*/
|
|
360
462
|
declare function withSpinnerTemplate(component: Type<unknown>): FeedbackFeature;
|
|
361
463
|
/**
|
|
362
464
|
* Replace the built-in SVG icons in `CngxAlert` per severity.
|
|
363
465
|
*
|
|
364
|
-
* Each component receives no inputs
|
|
466
|
+
* Each component receives no inputs - it should render a single icon.
|
|
365
467
|
* Only specified severities are replaced; others keep the built-in SVG.
|
|
366
468
|
*
|
|
367
469
|
* ```ts
|
|
@@ -372,6 +474,8 @@ declare function withSpinnerTemplate(component: Type<unknown>): FeedbackFeature;
|
|
|
372
474
|
* info: MyInfoIcon,
|
|
373
475
|
* }))
|
|
374
476
|
* ```
|
|
477
|
+
*
|
|
478
|
+
* @category ui/feedback
|
|
375
479
|
*/
|
|
376
480
|
declare function withAlertIcons(icons: Partial<Record<AlertSeverity, Type<unknown>>>): FeedbackFeature;
|
|
377
481
|
/**
|
|
@@ -382,6 +486,8 @@ declare function withAlertIcons(icons: Partial<Record<AlertSeverity, Type<unknow
|
|
|
382
486
|
* ```ts
|
|
383
487
|
* provideFeedback(withLoadingDefaults({ delay: 300, minDuration: 600 }))
|
|
384
488
|
* ```
|
|
489
|
+
*
|
|
490
|
+
* @category ui/feedback
|
|
385
491
|
*/
|
|
386
492
|
declare function withLoadingDefaults(opts: {
|
|
387
493
|
delay?: number;
|
|
@@ -390,12 +496,14 @@ declare function withLoadingDefaults(opts: {
|
|
|
390
496
|
/**
|
|
391
497
|
* Replace the built-in X SVG in all close/dismiss buttons globally.
|
|
392
498
|
*
|
|
393
|
-
* The component receives no inputs
|
|
499
|
+
* The component receives no inputs - it should render a single icon.
|
|
394
500
|
* Per-instance override via content projection on `CngxCloseButton` takes precedence.
|
|
395
501
|
*
|
|
396
502
|
* ```ts
|
|
397
503
|
* provideFeedback(withCloseIcon(MyLucideXIcon))
|
|
398
504
|
* ```
|
|
505
|
+
*
|
|
506
|
+
* @category ui/feedback
|
|
399
507
|
*/
|
|
400
508
|
declare function withCloseIcon(component: Type<unknown>): FeedbackFeature;
|
|
401
509
|
/**
|
|
@@ -413,6 +521,8 @@ declare function withCloseIcon(component: Type<unknown>): FeedbackFeature;
|
|
|
413
521
|
* withAlertIcons({ error: MyErrorIcon }),
|
|
414
522
|
* )
|
|
415
523
|
* ```
|
|
524
|
+
*
|
|
525
|
+
* @category ui/feedback
|
|
416
526
|
*/
|
|
417
527
|
declare function withToasts(opts?: {
|
|
418
528
|
/** Default auto-dismiss duration in ms. */
|
|
@@ -427,7 +537,7 @@ declare function withToasts(opts?: {
|
|
|
427
537
|
* Without this feature, `CngxAlerter` is only available via `CngxAlertStack`'s
|
|
428
538
|
* `viewProviders` (scoped injection).
|
|
429
539
|
*
|
|
430
|
-
* The token is opaque
|
|
540
|
+
* The token is opaque - always use `provideFeedback()` with feature functions,
|
|
431
541
|
* never construct the config object manually.
|
|
432
542
|
*
|
|
433
543
|
* @param opts Optional alert defaults.
|
|
@@ -438,6 +548,8 @@ declare function withToasts(opts?: {
|
|
|
438
548
|
* withAlerts(),
|
|
439
549
|
* )
|
|
440
550
|
* ```
|
|
551
|
+
*
|
|
552
|
+
* @category ui/feedback
|
|
441
553
|
*/
|
|
442
554
|
declare function withAlerts(opts?: {
|
|
443
555
|
/** Default auto-dismiss duration in ms. `undefined` = persistent. */
|
|
@@ -453,7 +565,7 @@ declare function withAlerts(opts?: {
|
|
|
453
565
|
* Provides `CngxBanner` at the environment level.
|
|
454
566
|
* Without this feature, `CngxBannerOutlet` will throw a `NullInjectorError`.
|
|
455
567
|
*
|
|
456
|
-
* Banners are always persistent
|
|
568
|
+
* Banners are always persistent - no `duration`. Dismiss programmatically
|
|
457
569
|
* via `banner.dismiss(id)` when the condition resolves.
|
|
458
570
|
*
|
|
459
571
|
* ```ts
|
|
@@ -463,14 +575,20 @@ declare function withAlerts(opts?: {
|
|
|
463
575
|
* withBanners(),
|
|
464
576
|
* )
|
|
465
577
|
* ```
|
|
578
|
+
*
|
|
579
|
+
* @category ui/feedback
|
|
466
580
|
*/
|
|
467
581
|
declare function withBanners(): FeedbackFeature;
|
|
468
582
|
|
|
469
|
-
/**
|
|
583
|
+
/**
|
|
584
|
+
* Configuration for a programmatic alert.
|
|
585
|
+
*
|
|
586
|
+
* @category ui/feedback/alert
|
|
587
|
+
*/
|
|
470
588
|
interface AlertConfig {
|
|
471
589
|
/** Alert message text (required). */
|
|
472
590
|
message: string;
|
|
473
|
-
/** Visual severity
|
|
591
|
+
/** Visual severity - determines icon, color, and ARIA role. */
|
|
474
592
|
severity?: AlertSeverity;
|
|
475
593
|
/** Optional bold title above the message. */
|
|
476
594
|
title?: string;
|
|
@@ -480,17 +598,25 @@ interface AlertConfig {
|
|
|
480
598
|
duration?: number;
|
|
481
599
|
/** Show a dismiss button. Default `true`. */
|
|
482
600
|
dismissible?: boolean;
|
|
483
|
-
/** Scope key
|
|
601
|
+
/** Scope key - only shown in stacks with matching scope. */
|
|
484
602
|
scope?: string;
|
|
485
603
|
}
|
|
486
|
-
/**
|
|
604
|
+
/**
|
|
605
|
+
* Handle to a displayed alert - allows programmatic dismiss.
|
|
606
|
+
*
|
|
607
|
+
* @category ui/feedback/alert
|
|
608
|
+
*/
|
|
487
609
|
interface AlertRef {
|
|
488
610
|
/** Programmatically dismiss this alert. */
|
|
489
611
|
dismiss(): void;
|
|
490
612
|
/** Emits after the alert is fully removed. */
|
|
491
613
|
afterDismissed(): Observable<void>;
|
|
492
614
|
}
|
|
493
|
-
/**
|
|
615
|
+
/**
|
|
616
|
+
* @internal - tracked state for a single alert in the stack.
|
|
617
|
+
*
|
|
618
|
+
* @category ui/feedback/alert
|
|
619
|
+
*/
|
|
494
620
|
interface AlertState {
|
|
495
621
|
readonly id: number;
|
|
496
622
|
readonly config: Required<Pick<AlertConfig, 'message' | 'severity' | 'dismissible' | 'persistent'>> & Pick<AlertConfig, 'title' | 'duration' | 'scope'>;
|
|
@@ -498,18 +624,29 @@ interface AlertState {
|
|
|
498
624
|
readonly dismissed$: Subject<void>;
|
|
499
625
|
}
|
|
500
626
|
/**
|
|
501
|
-
* Scoped alert service
|
|
627
|
+
* Scoped alert service - manages an alert stack as a signal array.
|
|
502
628
|
*
|
|
503
629
|
* Not `providedIn: 'root'`. Each `CngxAlertStack` provides its own instance
|
|
504
630
|
* via `viewProviders`, scoping alerts to that stack's subtree.
|
|
505
631
|
*
|
|
506
632
|
* For root-level injection, use `provideFeedback(withAlerts())`.
|
|
633
|
+
*
|
|
634
|
+
* @category ui/feedback/alert
|
|
635
|
+
* @docsKind primary
|
|
636
|
+
* @wcag AA
|
|
637
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/alert/alerter.service.ts
|
|
638
|
+
* @since 0.1.0
|
|
639
|
+
* @relatedTo CngxAlertStack, CngxAlertOn, CngxToaster, CngxBanner
|
|
640
|
+
*
|
|
641
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert-stack/basic-stack</example-url>
|
|
642
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert-stack/dialog-use-case</example-url>
|
|
643
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert-stack/overflow-collapse</example-url>
|
|
507
644
|
*/
|
|
508
645
|
declare class CngxAlerter {
|
|
509
646
|
private readonly destroyRef;
|
|
510
647
|
private readonly config;
|
|
511
648
|
private nextId;
|
|
512
|
-
/** Reactive alert stack
|
|
649
|
+
/** Reactive alert stack - read by `CngxAlertStack`. */
|
|
513
650
|
readonly alerts: _angular_core.WritableSignal<readonly AlertState[]>;
|
|
514
651
|
private readonly dedupWindow;
|
|
515
652
|
private readonly defaultDuration;
|
|
@@ -526,9 +663,9 @@ declare class CngxAlerter {
|
|
|
526
663
|
}
|
|
527
664
|
|
|
528
665
|
/**
|
|
529
|
-
* Scoped alert stack
|
|
666
|
+
* Scoped alert stack - renders alerts from its own `CngxAlerter` instance.
|
|
530
667
|
*
|
|
531
|
-
* Provides `CngxAlerter` via `viewProviders`
|
|
668
|
+
* Provides `CngxAlerter` via `viewProviders` - child components that
|
|
532
669
|
* `inject(CngxAlerter)` get this stack's instance. Supports nesting
|
|
533
670
|
* (each stack is independent).
|
|
534
671
|
*
|
|
@@ -550,12 +687,23 @@ declare class CngxAlerter {
|
|
|
550
687
|
* errors.forEach(e => this.alerter.show({ message: e, severity: 'error' }));
|
|
551
688
|
* }
|
|
552
689
|
* ```
|
|
690
|
+
*
|
|
691
|
+
* @category ui/feedback/alert
|
|
692
|
+
* @docsKind primary
|
|
693
|
+
* @wcag AA
|
|
694
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/alert/alert-stack.ts
|
|
695
|
+
* @since 0.1.0
|
|
696
|
+
* @relatedTo CngxAlerter, CngxAlert, CngxAlertOn
|
|
697
|
+
*
|
|
698
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert-stack/basic-stack</example-url>
|
|
699
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert-stack/dialog-use-case</example-url>
|
|
700
|
+
* <example-url>http://localhost:4200/#/ui/feedback/alert-stack/overflow-collapse</example-url>
|
|
553
701
|
*/
|
|
554
702
|
declare class CngxAlertStack {
|
|
555
|
-
/** The scoped alerter instance
|
|
703
|
+
/** The scoped alerter instance - use to add/dismiss alerts programmatically. */
|
|
556
704
|
readonly alerter: CngxAlerter;
|
|
557
705
|
private readonly config;
|
|
558
|
-
/** Scope filter
|
|
706
|
+
/** Scope filter - only shows alerts matching this scope. */
|
|
559
707
|
readonly scope: _angular_core.InputSignal<string | undefined>;
|
|
560
708
|
/** Maximum visible alerts before collapse overflow. */
|
|
561
709
|
readonly maxVisible: _angular_core.InputSignal<number>;
|
|
@@ -565,17 +713,17 @@ declare class CngxAlertStack {
|
|
|
565
713
|
readonly reserveSpace: _angular_core.InputSignal<boolean>;
|
|
566
714
|
/** Auto-scroll stack into view when new alert appears. */
|
|
567
715
|
readonly autoScroll: _angular_core.InputSignal<boolean>;
|
|
568
|
-
/** @internal
|
|
716
|
+
/** @internal - expanded state. Resets when alert count drops to maxVisible or below. */
|
|
569
717
|
private readonly expanded;
|
|
570
|
-
/** @internal
|
|
718
|
+
/** @internal - alerts filtered by scope. */
|
|
571
719
|
private readonly scopedAlerts;
|
|
572
|
-
/** @internal
|
|
720
|
+
/** @internal - alerts visible within maxVisible limit. */
|
|
573
721
|
protected readonly visibleAlerts: _angular_core.Signal<readonly AlertState[]>;
|
|
574
|
-
/** @internal
|
|
722
|
+
/** @internal - number of hidden overflow alerts. */
|
|
575
723
|
protected readonly overflowCount: _angular_core.Signal<number>;
|
|
576
|
-
/** @internal
|
|
724
|
+
/** @internal - IDs of overflow alerts for aria-controls. */
|
|
577
725
|
protected readonly overflowIds: _angular_core.Signal<string>;
|
|
578
|
-
/** @internal
|
|
726
|
+
/** @internal - resolve icon component from global config. */
|
|
579
727
|
protected iconFor(alert: AlertState): _angular_core.Type<unknown> | null;
|
|
580
728
|
/** @internal */
|
|
581
729
|
protected handleExpandOverflow(): void;
|
|
@@ -586,7 +734,7 @@ declare class CngxAlertStack {
|
|
|
586
734
|
/**
|
|
587
735
|
* Declarative state-to-alert bridge for scoped alert stacks.
|
|
588
736
|
*
|
|
589
|
-
* Place on any element inside a `CngxAlertStack` subtree
|
|
737
|
+
* Place on any element inside a `CngxAlertStack` subtree - fires an alert
|
|
590
738
|
* when the bound `CngxAsyncState` transitions to `error` (or optionally `success`).
|
|
591
739
|
* Only fires on actual transitions, not on initial `idle` state.
|
|
592
740
|
*
|
|
@@ -600,17 +748,24 @@ declare class CngxAlertStack {
|
|
|
600
748
|
* Save
|
|
601
749
|
* </button>
|
|
602
750
|
* ```
|
|
751
|
+
*
|
|
752
|
+
* @category ui/feedback/alert
|
|
753
|
+
* @docsKind primary
|
|
754
|
+
* @wcag AA
|
|
755
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/alert/alert-on.directive.ts
|
|
756
|
+
* @since 0.1.0
|
|
757
|
+
* @relatedTo CngxAlertStack, CngxAlerter, CngxToastOn, CngxBannerOn
|
|
603
758
|
*/
|
|
604
759
|
declare class CngxAlertOn {
|
|
605
760
|
private readonly alerter;
|
|
606
761
|
private readonly statefulFallback;
|
|
607
762
|
/**
|
|
608
|
-
* The async state to watch. Optional
|
|
763
|
+
* The async state to watch. Optional - when omitted, falls back to
|
|
609
764
|
* `CNGX_STATEFUL` from an ancestor/self component. A bare `cngxAlertOn`
|
|
610
765
|
* attribute is treated as "no input bound".
|
|
611
766
|
*/
|
|
612
767
|
readonly state: _angular_core.InputSignalWithTransform<CngxAsyncState<unknown> | undefined, "" | CngxAsyncState<unknown> | undefined>;
|
|
613
|
-
/** Effective state
|
|
768
|
+
/** Effective state - input wins over ancestor `CNGX_STATEFUL`. */
|
|
614
769
|
private readonly effectiveState;
|
|
615
770
|
/** Alert message on success. If not set, no success alert fires. */
|
|
616
771
|
readonly alertSuccess: _angular_core.InputSignal<string | undefined>;
|
|
@@ -618,20 +773,24 @@ declare class CngxAlertOn {
|
|
|
618
773
|
readonly alertError: _angular_core.InputSignal<string | undefined>;
|
|
619
774
|
/** Include the error detail message in the alert body. */
|
|
620
775
|
readonly alertErrorDetail: _angular_core.InputSignal<boolean>;
|
|
621
|
-
/** Scope for the alert
|
|
776
|
+
/** Scope for the alert - matches against `CngxAlertStack`'s `[scope]` input. */
|
|
622
777
|
readonly alertScope: _angular_core.InputSignal<string | undefined>;
|
|
623
778
|
constructor();
|
|
624
779
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAlertOn, never>;
|
|
625
780
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAlertOn, "[cngxAlertOn]", never, { "state": { "alias": "cngxAlertOn"; "required": false; "isSignal": true; }; "alertSuccess": { "alias": "alertSuccess"; "required": false; "isSignal": true; }; "alertError": { "alias": "alertError"; "required": false; "isSignal": true; }; "alertErrorDetail": { "alias": "alertErrorDetail"; "required": false; "isSignal": true; }; "alertScope": { "alias": "alertScope"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
626
781
|
}
|
|
627
782
|
|
|
628
|
-
/**
|
|
783
|
+
/**
|
|
784
|
+
* Configuration for a system-level banner.
|
|
785
|
+
*
|
|
786
|
+
* @category ui/feedback/banner
|
|
787
|
+
*/
|
|
629
788
|
interface BannerConfig {
|
|
630
789
|
/** Banner message text (required). */
|
|
631
790
|
message: string;
|
|
632
|
-
/** Required dedup key
|
|
791
|
+
/** Required dedup key - only one banner per id. `show()` with existing id calls `update()`. */
|
|
633
792
|
id: string;
|
|
634
|
-
/** Visual severity
|
|
793
|
+
/** Visual severity - determines icon, color, and ARIA role. */
|
|
635
794
|
severity?: AlertSeverity;
|
|
636
795
|
/**
|
|
637
796
|
* Action button. If `handler` returns a Promise, the button shows `aria-busy`
|
|
@@ -644,14 +803,22 @@ interface BannerConfig {
|
|
|
644
803
|
/** Show a dismiss button. Default `true`. */
|
|
645
804
|
dismissible?: boolean;
|
|
646
805
|
}
|
|
647
|
-
/**
|
|
806
|
+
/**
|
|
807
|
+
* Handle to a displayed banner.
|
|
808
|
+
*
|
|
809
|
+
* @category ui/feedback/banner
|
|
810
|
+
*/
|
|
648
811
|
interface BannerRef {
|
|
649
812
|
/** Programmatically dismiss this banner. */
|
|
650
813
|
dismiss(): void;
|
|
651
814
|
/** Emits after the banner is fully removed. */
|
|
652
815
|
afterDismissed(): Observable<void>;
|
|
653
816
|
}
|
|
654
|
-
/**
|
|
817
|
+
/**
|
|
818
|
+
* @internal - tracked state for a single banner.
|
|
819
|
+
*
|
|
820
|
+
* @category ui/feedback/banner
|
|
821
|
+
*/
|
|
655
822
|
interface BannerState {
|
|
656
823
|
readonly id: string;
|
|
657
824
|
readonly config: Required<Pick<BannerConfig, 'message' | 'id' | 'severity' | 'dismissible'>> & Pick<BannerConfig, 'action'>;
|
|
@@ -662,11 +829,11 @@ interface BannerState {
|
|
|
662
829
|
readonly dismissed$: Subject<void>;
|
|
663
830
|
}
|
|
664
831
|
/**
|
|
665
|
-
* Global banner service
|
|
832
|
+
* Global banner service - manages system-level banners as a signal array.
|
|
666
833
|
*
|
|
667
834
|
* Not `providedIn: 'root'`. Provide via `provideFeedback(withBanners())`.
|
|
668
835
|
*
|
|
669
|
-
* Banners are always persistent
|
|
836
|
+
* Banners are always persistent - no auto-dismiss. Use `dismiss(id)` to remove
|
|
670
837
|
* programmatically (e.g., on reconnect, on session extend).
|
|
671
838
|
*
|
|
672
839
|
* `id` is required and serves as the dedup key. Calling `show()` with an existing
|
|
@@ -682,10 +849,21 @@ interface BannerState {
|
|
|
682
849
|
* action: { label: 'Extend', handler: () => this.extendSession() },
|
|
683
850
|
* });
|
|
684
851
|
* ```
|
|
852
|
+
*
|
|
853
|
+
* @category ui/feedback/banner
|
|
854
|
+
* @docsKind primary
|
|
855
|
+
* @wcag AA
|
|
856
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/banner/banner.service.ts
|
|
857
|
+
* @since 0.1.0
|
|
858
|
+
* @relatedTo CngxBannerOutlet, CngxBannerTrigger, CngxBannerOn, CngxAlerter, CngxToaster
|
|
859
|
+
*
|
|
860
|
+
* <example-url>http://localhost:4200/#/ui/feedback/banner/async-action</example-url>
|
|
861
|
+
* <example-url>http://localhost:4200/#/ui/feedback/banner/dedup-update</example-url>
|
|
862
|
+
* <example-url>http://localhost:4200/#/ui/feedback/banner/system-banners</example-url>
|
|
685
863
|
*/
|
|
686
864
|
declare class CngxBanner {
|
|
687
865
|
private readonly destroyRef;
|
|
688
|
-
/** Reactive banner stack
|
|
866
|
+
/** Reactive banner stack - read by `CngxBannerOutlet`. */
|
|
689
867
|
readonly banners: _angular_core.WritableSignal<readonly BannerState[]>;
|
|
690
868
|
constructor();
|
|
691
869
|
/** Show a banner. If `id` already exists, updates it instead. */
|
|
@@ -697,7 +875,7 @@ declare class CngxBanner {
|
|
|
697
875
|
/** Dismiss all banners. */
|
|
698
876
|
dismissAll(): void;
|
|
699
877
|
/**
|
|
700
|
-
* @internal
|
|
878
|
+
* @internal - execute an action handler with async lifecycle.
|
|
701
879
|
* Sets `actionPending` during execution, `actionError` on failure.
|
|
702
880
|
*/
|
|
703
881
|
executeAction(id: string): Promise<void>;
|
|
@@ -707,7 +885,7 @@ declare class CngxBanner {
|
|
|
707
885
|
}
|
|
708
886
|
|
|
709
887
|
/**
|
|
710
|
-
* Banner outlet
|
|
888
|
+
* Banner outlet - renders the global banner stack at the top of the page.
|
|
711
889
|
*
|
|
712
890
|
* Place once in the app shell, above `<router-outlet>`.
|
|
713
891
|
* Requires `provideFeedback(withBanners())`.
|
|
@@ -719,17 +897,28 @@ declare class CngxBanner {
|
|
|
719
897
|
* <cngx-banner-outlet />
|
|
720
898
|
* <router-outlet />
|
|
721
899
|
* ```
|
|
900
|
+
*
|
|
901
|
+
* @category ui/feedback/banner
|
|
902
|
+
* @docsKind primary
|
|
903
|
+
* @wcag AA
|
|
904
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/banner/banner-outlet.ts
|
|
905
|
+
* @since 0.1.0
|
|
906
|
+
* @relatedTo CngxBanner, CngxBannerTrigger, CngxBannerOn
|
|
907
|
+
*
|
|
908
|
+
* <example-url>http://localhost:4200/#/ui/feedback/banner/async-action</example-url>
|
|
909
|
+
* <example-url>http://localhost:4200/#/ui/feedback/banner/dedup-update</example-url>
|
|
910
|
+
* <example-url>http://localhost:4200/#/ui/feedback/banner/system-banners</example-url>
|
|
722
911
|
*/
|
|
723
912
|
declare class CngxBannerOutlet {
|
|
724
913
|
protected readonly service: CngxBanner;
|
|
725
914
|
private readonly config;
|
|
726
915
|
/**
|
|
727
|
-
* @internal
|
|
916
|
+
* @internal - skip enter animation for banners present at first render.
|
|
728
917
|
* Prevents layout jump when banners are known before first paint (e.g., offline state).
|
|
729
918
|
*/
|
|
730
919
|
protected readonly pastFirstRender: _angular_core.WritableSignal<boolean>;
|
|
731
920
|
constructor();
|
|
732
|
-
/** @internal
|
|
921
|
+
/** @internal - resolve icon from global config. */
|
|
733
922
|
protected iconFor(banner: BannerState): _angular_core.Type<unknown> | null;
|
|
734
923
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBannerOutlet, never>;
|
|
735
924
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxBannerOutlet, "cngx-banner-outlet", never, {}, {}, never, never, true, never>;
|
|
@@ -738,7 +927,7 @@ declare class CngxBannerOutlet {
|
|
|
738
927
|
/**
|
|
739
928
|
* Declarative state-to-banner bridge.
|
|
740
929
|
*
|
|
741
|
-
* Place on any element
|
|
930
|
+
* Place on any element - shows a global banner when the bound `CngxAsyncState`
|
|
742
931
|
* transitions to `error`. Dismisses automatically on `success` or `idle`.
|
|
743
932
|
* Only fires on actual transitions, not on initial `idle` state.
|
|
744
933
|
*
|
|
@@ -748,19 +937,28 @@ declare class CngxBannerOutlet {
|
|
|
748
937
|
* bannerError="You are offline. Changes will sync when reconnected.">
|
|
749
938
|
* </div>
|
|
750
939
|
* ```
|
|
940
|
+
*
|
|
941
|
+
* @category ui/feedback/banner
|
|
942
|
+
* @docsKind primary
|
|
943
|
+
* @wcag AA
|
|
944
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/banner/banner-on.directive.ts
|
|
945
|
+
* @since 0.1.0
|
|
946
|
+
* @relatedTo CngxBanner, CngxBannerOutlet, CngxBannerTrigger, CngxAlertOn, CngxToastOn
|
|
947
|
+
*
|
|
948
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
751
949
|
*/
|
|
752
950
|
declare class CngxBannerOn {
|
|
753
951
|
private readonly bannerService;
|
|
754
952
|
private readonly statefulFallback;
|
|
755
953
|
/**
|
|
756
|
-
* The async state to watch. Optional
|
|
954
|
+
* The async state to watch. Optional - when omitted, falls back to
|
|
757
955
|
* `CNGX_STATEFUL` from an ancestor/self component. A bare `cngxBannerOn`
|
|
758
956
|
* attribute is treated as "no input bound".
|
|
759
957
|
*/
|
|
760
958
|
readonly state: _angular_core.InputSignalWithTransform<CngxAsyncState<unknown> | undefined, "" | CngxAsyncState<unknown> | undefined>;
|
|
761
|
-
/** Effective state
|
|
959
|
+
/** Effective state - input wins over ancestor `CNGX_STATEFUL`. */
|
|
762
960
|
private readonly effectiveState;
|
|
763
|
-
/** Required banner id
|
|
961
|
+
/** Required banner id - dedup key. */
|
|
764
962
|
readonly bannerId: _angular_core.InputSignal<string>;
|
|
765
963
|
/** Banner message on error. */
|
|
766
964
|
readonly bannerError: _angular_core.InputSignal<string | undefined>;
|
|
@@ -774,11 +972,11 @@ declare class CngxBannerOn {
|
|
|
774
972
|
}
|
|
775
973
|
|
|
776
974
|
/**
|
|
777
|
-
* Declarative banner trigger
|
|
975
|
+
* Declarative banner trigger - renders nothing, shows/dismisses a global banner
|
|
778
976
|
* when `[when]` changes.
|
|
779
977
|
*
|
|
780
978
|
* When `[when]` becomes `true`, the banner appears. When `false`, it is dismissed.
|
|
781
|
-
* The banner's lifecycle is tied to the signal
|
|
979
|
+
* The banner's lifecycle is tied to the signal - perfect for reactive system state
|
|
782
980
|
* like `isOffline()` or `sessionExpiring()`.
|
|
783
981
|
*
|
|
784
982
|
* Requires `provideFeedback(withBanners())`.
|
|
@@ -798,6 +996,13 @@ declare class CngxBannerOn {
|
|
|
798
996
|
* actionLabel="Extend"
|
|
799
997
|
* [actionHandler]="extendSession" />
|
|
800
998
|
* ```
|
|
999
|
+
*
|
|
1000
|
+
* @category ui/feedback/banner
|
|
1001
|
+
* @docsKind primary
|
|
1002
|
+
* @wcag AA
|
|
1003
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/banner/banner-trigger.ts
|
|
1004
|
+
* @since 0.1.0
|
|
1005
|
+
* @relatedTo CngxBanner, CngxBannerOutlet, CngxBannerOn
|
|
801
1006
|
*/
|
|
802
1007
|
declare class CngxBannerTrigger {
|
|
803
1008
|
private readonly banner;
|
|
@@ -806,7 +1011,7 @@ declare class CngxBannerTrigger {
|
|
|
806
1011
|
readonly when: _angular_core.InputSignal<boolean>;
|
|
807
1012
|
/** Banner message text. */
|
|
808
1013
|
readonly message: _angular_core.InputSignal<string>;
|
|
809
|
-
/** Required unique id
|
|
1014
|
+
/** Required unique id - dedup key. */
|
|
810
1015
|
readonly id: _angular_core.InputSignal<string>;
|
|
811
1016
|
/** Visual severity. */
|
|
812
1017
|
readonly severity: _angular_core.InputSignal<AlertSeverity>;
|
|
@@ -821,23 +1026,27 @@ declare class CngxBannerTrigger {
|
|
|
821
1026
|
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>;
|
|
822
1027
|
}
|
|
823
1028
|
|
|
824
|
-
/**
|
|
1029
|
+
/**
|
|
1030
|
+
* Configuration for a single toast.
|
|
1031
|
+
*
|
|
1032
|
+
* @category ui/feedback/toast
|
|
1033
|
+
*/
|
|
825
1034
|
interface ToastConfig {
|
|
826
1035
|
/** Toast message text. Used as sole text when `title` is not set. */
|
|
827
1036
|
message: string;
|
|
828
1037
|
/**
|
|
829
|
-
* Bold primary text
|
|
1038
|
+
* Bold primary text - renders above `description` or `message`.
|
|
830
1039
|
* When set, the toast switches to a two-line layout (title + description).
|
|
831
1040
|
* When not set, `message` renders as a single line (backwards-compatible).
|
|
832
1041
|
*/
|
|
833
1042
|
title?: string;
|
|
834
1043
|
/**
|
|
835
|
-
* Secondary description text
|
|
1044
|
+
* Secondary description text - renders below `title`.
|
|
836
1045
|
* Falls back to `message` when `title` is set but `description` is not.
|
|
837
1046
|
* Ignored when `title` is not set.
|
|
838
1047
|
*/
|
|
839
1048
|
description?: string;
|
|
840
|
-
/** Visual severity
|
|
1049
|
+
/** Visual severity - determines icon, color, and ARIA role. */
|
|
841
1050
|
severity?: AlertSeverity;
|
|
842
1051
|
/** Auto-dismiss duration in ms, or `'persistent'` for manual dismiss only. */
|
|
843
1052
|
duration?: number | 'persistent';
|
|
@@ -854,20 +1063,28 @@ interface ToastConfig {
|
|
|
854
1063
|
* `title` is still rendered above the component if set.
|
|
855
1064
|
*
|
|
856
1065
|
* A11y: avoid focusable elements (`<a>`, `<button>`, `<input>`) inside
|
|
857
|
-
* the component
|
|
1066
|
+
* the component - they are unreachable inside a `role="status"` live region.
|
|
858
1067
|
*/
|
|
859
1068
|
content?: Type<unknown>;
|
|
860
1069
|
/** Inputs passed to the `content` component via `NgComponentOutlet`. */
|
|
861
1070
|
contentInputs?: Record<string, unknown>;
|
|
862
1071
|
}
|
|
863
|
-
/**
|
|
1072
|
+
/**
|
|
1073
|
+
* Handle to a displayed toast - allows programmatic dismiss.
|
|
1074
|
+
*
|
|
1075
|
+
* @category ui/feedback/toast
|
|
1076
|
+
*/
|
|
864
1077
|
interface ToastRef {
|
|
865
1078
|
/** Programmatically dismiss this toast. */
|
|
866
1079
|
dismiss(): void;
|
|
867
1080
|
/** Emits after the toast is fully removed (post-animation). */
|
|
868
1081
|
afterDismissed(): Observable<void>;
|
|
869
1082
|
}
|
|
870
|
-
/**
|
|
1083
|
+
/**
|
|
1084
|
+
* Internal toast state tracked by the service.
|
|
1085
|
+
*
|
|
1086
|
+
* @category ui/feedback/toast
|
|
1087
|
+
*/
|
|
871
1088
|
interface ToastState {
|
|
872
1089
|
readonly id: number;
|
|
873
1090
|
readonly config: Required<Pick<ToastConfig, 'message' | 'severity' | 'dismissible'>> & Pick<ToastConfig, 'action' | 'title' | 'description' | 'content' | 'contentInputs'> & {
|
|
@@ -876,7 +1093,7 @@ interface ToastState {
|
|
|
876
1093
|
readonly createdAt: number;
|
|
877
1094
|
/** Timestamp when the current timer started (created or last resumed). */
|
|
878
1095
|
readonly timerStartedAt: number;
|
|
879
|
-
/** Dedup counter
|
|
1096
|
+
/** Dedup counter - incremented when identical toast fires again. */
|
|
880
1097
|
readonly count: number;
|
|
881
1098
|
/** Remaining ms when timer was paused (hover/focus). `undefined` = not paused. */
|
|
882
1099
|
readonly pausedRemaining: number | undefined;
|
|
@@ -886,29 +1103,42 @@ interface ToastState {
|
|
|
886
1103
|
readonly dismissed$: Subject<void>;
|
|
887
1104
|
}
|
|
888
1105
|
/**
|
|
889
|
-
* Feature-scoped toast service
|
|
1106
|
+
* Feature-scoped toast service - not `providedIn: 'root'`.
|
|
890
1107
|
*
|
|
891
1108
|
* Provide via `provideFeedback(withToasts())` or `provideToasts()` at the
|
|
892
1109
|
* app-shell or route level.
|
|
893
1110
|
*
|
|
894
1111
|
* Manages the toast stack as a signal array. `CngxToastOutlet` reads it reactively.
|
|
1112
|
+
*
|
|
1113
|
+
* @category ui/feedback/toast
|
|
1114
|
+
* @docsKind primary
|
|
1115
|
+
* @wcag AA
|
|
1116
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/toast/toast.service.ts
|
|
1117
|
+
* @since 0.1.0
|
|
1118
|
+
* @relatedTo CngxToastOutlet, CngxToastOn, CngxToast, CngxAlerter
|
|
1119
|
+
*
|
|
1120
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/custom-component-body</example-url>
|
|
1121
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/declarative-cngx-toast</example-url>
|
|
1122
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/programmatic-cngxtoaster</example-url>
|
|
1123
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/state-bridge-cngxtoaston</example-url>
|
|
1124
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/title-description</example-url>
|
|
895
1125
|
*/
|
|
896
1126
|
declare class CngxToaster {
|
|
897
1127
|
private readonly destroyRef;
|
|
898
1128
|
private readonly config;
|
|
899
1129
|
private nextId;
|
|
900
|
-
/** Reactive toast stack
|
|
1130
|
+
/** Reactive toast stack - read by `CngxToastOutlet`. */
|
|
901
1131
|
readonly toasts: _angular_core.WritableSignal<readonly ToastState[]>;
|
|
902
1132
|
/** Default duration for non-error toasts. */
|
|
903
1133
|
readonly defaultDuration: _angular_core.WritableSignal<number>;
|
|
904
|
-
/** Dedup window in ms
|
|
1134
|
+
/** Dedup window in ms - identical toasts within this window are merged. */
|
|
905
1135
|
readonly dedupWindow: _angular_core.WritableSignal<number>;
|
|
906
1136
|
constructor();
|
|
907
1137
|
/** Show a toast. Returns a ref for programmatic control. */
|
|
908
1138
|
show(config: ToastConfig): ToastRef;
|
|
909
|
-
/** @internal
|
|
1139
|
+
/** @internal - called by toast-outlet on hover/focus. */
|
|
910
1140
|
pauseTimer(id: number): void;
|
|
911
|
-
/** @internal
|
|
1141
|
+
/** @internal - called by toast-outlet on mouse-leave/focus-out. */
|
|
912
1142
|
resumeTimer(id: number): void;
|
|
913
1143
|
/** Dismiss a toast by id. */
|
|
914
1144
|
dismiss(id: number): void;
|
|
@@ -920,20 +1150,27 @@ declare class CngxToaster {
|
|
|
920
1150
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxToaster>;
|
|
921
1151
|
}
|
|
922
1152
|
/**
|
|
923
|
-
* Standalone provider for the toast system
|
|
1153
|
+
* Standalone provider for the toast system - use when not using `provideFeedback()`.
|
|
924
1154
|
*
|
|
925
1155
|
* ```ts
|
|
926
1156
|
* bootstrapApplication(AppComponent, {
|
|
927
1157
|
* providers: [provideToasts()],
|
|
928
1158
|
* });
|
|
929
1159
|
* ```
|
|
1160
|
+
*
|
|
1161
|
+
* @category ui/feedback/toast
|
|
1162
|
+
*
|
|
930
1163
|
*/
|
|
931
1164
|
declare function provideToasts(): EnvironmentProviders;
|
|
932
1165
|
|
|
933
|
-
/**
|
|
1166
|
+
/**
|
|
1167
|
+
* Position for the toast stack.
|
|
1168
|
+
*
|
|
1169
|
+
* @category ui/feedback/toast
|
|
1170
|
+
*/
|
|
934
1171
|
type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
935
1172
|
/**
|
|
936
|
-
* Toast outlet
|
|
1173
|
+
* Toast outlet - renders the toast stack at a fixed viewport position.
|
|
937
1174
|
*
|
|
938
1175
|
* Place once in the app shell. Reads from `CngxToaster` reactively.
|
|
939
1176
|
* Requires `provideToasts()` or `provideFeedback(withToasts())`.
|
|
@@ -941,21 +1178,36 @@ type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | '
|
|
|
941
1178
|
* ```html
|
|
942
1179
|
* <cngx-toast-outlet position="bottom-end" [maxVisible]="5" />
|
|
943
1180
|
* ```
|
|
1181
|
+
*
|
|
1182
|
+
* @playground Async state bridges ./examples/bridges/bridges-example.component.ts
|
|
1183
|
+
*
|
|
1184
|
+
* @category ui/feedback/toast
|
|
1185
|
+
* @docsKind primary
|
|
1186
|
+
* @wcag AA
|
|
1187
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/toast/toast-outlet.ts
|
|
1188
|
+
* @since 0.1.0
|
|
1189
|
+
* @relatedTo CngxToaster, CngxToast, CngxToastOn
|
|
1190
|
+
*
|
|
1191
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/custom-component-body</example-url>
|
|
1192
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/declarative-cngx-toast</example-url>
|
|
1193
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/programmatic-cngxtoaster</example-url>
|
|
1194
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/state-bridge-cngxtoaston</example-url>
|
|
1195
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/title-description</example-url>
|
|
944
1196
|
*/
|
|
945
1197
|
declare class CngxToastOutlet {
|
|
946
1198
|
protected readonly service: CngxToaster;
|
|
947
1199
|
private readonly config;
|
|
948
1200
|
/** Stack position. */
|
|
949
1201
|
readonly position: _angular_core.InputSignal<ToastPosition>;
|
|
950
|
-
/** Maximum visible toasts
|
|
1202
|
+
/** Maximum visible toasts - oldest are evicted. */
|
|
951
1203
|
readonly maxVisible: _angular_core.InputSignal<number>;
|
|
952
1204
|
/** Insert new toasts at start or end of the stack. */
|
|
953
1205
|
readonly insertPosition: _angular_core.InputSignal<"start" | "end">;
|
|
954
1206
|
/** @internal */
|
|
955
1207
|
protected readonly positionClass: _angular_core.Signal<string>;
|
|
956
|
-
/** @internal
|
|
1208
|
+
/** @internal - slice to maxVisible, respecting insert position. */
|
|
957
1209
|
protected readonly visibleToasts: _angular_core.Signal<readonly ToastState[]>;
|
|
958
|
-
/** @internal
|
|
1210
|
+
/** @internal - resolve icon component from global config or null. */
|
|
959
1211
|
protected iconFor(toast: ToastState): _angular_core.Type<unknown> | null;
|
|
960
1212
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxToastOutlet, never>;
|
|
961
1213
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxToastOutlet, "cngx-toast-outlet", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; "maxVisible": { "alias": "maxVisible"; "required": false; "isSignal": true; }; "insertPosition": { "alias": "insertPosition"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -964,7 +1216,7 @@ declare class CngxToastOutlet {
|
|
|
964
1216
|
/**
|
|
965
1217
|
* Declarative state-to-toast bridge.
|
|
966
1218
|
*
|
|
967
|
-
* Place on any element
|
|
1219
|
+
* Place on any element - fires a toast when the bound `CngxAsyncState`
|
|
968
1220
|
* transitions to `success` or `error`. Only fires on actual transitions,
|
|
969
1221
|
* not on initial `idle` state.
|
|
970
1222
|
*
|
|
@@ -987,19 +1239,33 @@ declare class CngxToastOutlet {
|
|
|
987
1239
|
* ...
|
|
988
1240
|
* </form>
|
|
989
1241
|
* ```
|
|
1242
|
+
*
|
|
1243
|
+
* @category ui/feedback/toast
|
|
1244
|
+
* @docsKind primary
|
|
1245
|
+
* @wcag AA
|
|
1246
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/toast/toast-on.directive.ts
|
|
1247
|
+
* @since 0.1.0
|
|
1248
|
+
* @relatedTo CngxToaster, CngxToastOutlet, CngxAlertOn, CngxBannerOn
|
|
1249
|
+
*
|
|
1250
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/custom-component-body</example-url>
|
|
1251
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/declarative-cngx-toast</example-url>
|
|
1252
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/programmatic-cngxtoaster</example-url>
|
|
1253
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/state-bridge-cngxtoaston</example-url>
|
|
1254
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/title-description</example-url>
|
|
1255
|
+
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
990
1256
|
*/
|
|
991
1257
|
declare class CngxToastOn {
|
|
992
1258
|
private readonly toast;
|
|
993
1259
|
private readonly statefulFallback;
|
|
994
1260
|
private readonly toastService;
|
|
995
1261
|
/**
|
|
996
|
-
* The async state to watch. Optional
|
|
1262
|
+
* The async state to watch. Optional - when omitted, the bridge falls back
|
|
997
1263
|
* to `CNGX_STATEFUL` injected from the host component (for example
|
|
998
1264
|
* `CngxSelect.commitState`). A bare `cngxToastOn` attribute (empty string)
|
|
999
1265
|
* is treated as "no input bound" so the fallback kicks in.
|
|
1000
1266
|
*/
|
|
1001
1267
|
readonly state: _angular_core.InputSignalWithTransform<CngxAsyncState<unknown> | undefined, "" | CngxAsyncState<unknown> | undefined>;
|
|
1002
|
-
/** Effective state
|
|
1268
|
+
/** Effective state - input wins over ancestor `CNGX_STATEFUL`. */
|
|
1003
1269
|
private readonly effectiveState;
|
|
1004
1270
|
/** Toast message on success. If not set, no success toast fires. */
|
|
1005
1271
|
readonly toastSuccess: _angular_core.InputSignal<string | undefined>;
|
|
@@ -1009,7 +1275,7 @@ declare class CngxToastOn {
|
|
|
1009
1275
|
readonly toastErrorDetail: _angular_core.InputSignal<boolean>;
|
|
1010
1276
|
/** Duration for success toasts in ms. */
|
|
1011
1277
|
readonly toastSuccessDuration: _angular_core.InputSignal<number>;
|
|
1012
|
-
/** Duration for error toasts
|
|
1278
|
+
/** Duration for error toasts - `'persistent'` means manual dismiss only. */
|
|
1013
1279
|
readonly toastErrorDuration: _angular_core.InputSignal<number | "persistent">;
|
|
1014
1280
|
constructor();
|
|
1015
1281
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxToastOn, never>;
|
|
@@ -1017,7 +1283,7 @@ declare class CngxToastOn {
|
|
|
1017
1283
|
}
|
|
1018
1284
|
|
|
1019
1285
|
/**
|
|
1020
|
-
* Declarative toast
|
|
1286
|
+
* Declarative toast - renders nothing at its position, pushes into the global `CngxToastOutlet`.
|
|
1021
1287
|
*
|
|
1022
1288
|
* Shows a toast when `[when]` becomes `true`. Dismisses when `[when]` becomes `false`
|
|
1023
1289
|
* (unless already auto-dismissed). Supports projected content for custom toast bodies.
|
|
@@ -1041,6 +1307,19 @@ declare class CngxToastOn {
|
|
|
1041
1307
|
* <cngx-toast severity="success" message="Item saved" [when]="saveState.status() === 'success'" />
|
|
1042
1308
|
* <cngx-toast severity="error" message="Save failed" [when]="saveState.status() === 'error'" />
|
|
1043
1309
|
* ```
|
|
1310
|
+
*
|
|
1311
|
+
* @category ui/feedback/toast
|
|
1312
|
+
* @docsKind primary
|
|
1313
|
+
* @wcag AA
|
|
1314
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/toast/toast.component.ts
|
|
1315
|
+
* @since 0.1.0
|
|
1316
|
+
* @relatedTo CngxToaster, CngxToastOutlet, CngxToastOn
|
|
1317
|
+
*
|
|
1318
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/custom-component-body</example-url>
|
|
1319
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/declarative-cngx-toast</example-url>
|
|
1320
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/programmatic-cngxtoaster</example-url>
|
|
1321
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/state-bridge-cngxtoaston</example-url>
|
|
1322
|
+
* <example-url>http://localhost:4200/#/ui/feedback/toast/title-description</example-url>
|
|
1044
1323
|
*/
|
|
1045
1324
|
declare class CngxToast {
|
|
1046
1325
|
private readonly toaster;
|
|
@@ -1066,7 +1345,13 @@ declare class CngxToast {
|
|
|
1066
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, never, true, never>;
|
|
1067
1346
|
}
|
|
1068
1347
|
|
|
1069
|
-
/**
|
|
1348
|
+
/**
|
|
1349
|
+
* Marks the skeleton template inside `cngx-async-container`.
|
|
1350
|
+
*
|
|
1351
|
+
* @category ui/feedback/async
|
|
1352
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/async-container/async-container.ts
|
|
1353
|
+
* @since 0.1.0
|
|
1354
|
+
*/
|
|
1070
1355
|
declare class CngxAsyncSkeletonTpl {
|
|
1071
1356
|
readonly templateRef: TemplateRef<any>;
|
|
1072
1357
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAsyncSkeletonTpl, never>;
|
|
@@ -1074,7 +1359,11 @@ declare class CngxAsyncSkeletonTpl {
|
|
|
1074
1359
|
}
|
|
1075
1360
|
/**
|
|
1076
1361
|
* Marks the content template inside `cngx-async-container`.
|
|
1077
|
-
* Context: `{ $implicit: T }`
|
|
1362
|
+
* Context: `{ $implicit: T }` - use `let-data` to access.
|
|
1363
|
+
*
|
|
1364
|
+
* @category ui/feedback/async
|
|
1365
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/async-container/async-container.ts
|
|
1366
|
+
* @since 0.1.0
|
|
1078
1367
|
*/
|
|
1079
1368
|
declare class CngxAsyncContentTpl<T> {
|
|
1080
1369
|
readonly templateRef: TemplateRef<{
|
|
@@ -1086,7 +1375,13 @@ declare class CngxAsyncContentTpl<T> {
|
|
|
1086
1375
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAsyncContentTpl<any>, never>;
|
|
1087
1376
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAsyncContentTpl<any>, "ng-template[cngxAsyncContent]", never, {}, {}, never, never, true, never>;
|
|
1088
1377
|
}
|
|
1089
|
-
/**
|
|
1378
|
+
/**
|
|
1379
|
+
* Marks the empty-state template inside `cngx-async-container`.
|
|
1380
|
+
*
|
|
1381
|
+
* @category ui/feedback/async
|
|
1382
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/async-container/async-container.ts
|
|
1383
|
+
* @since 0.1.0
|
|
1384
|
+
*/
|
|
1090
1385
|
declare class CngxAsyncEmptyTpl {
|
|
1091
1386
|
readonly templateRef: TemplateRef<any>;
|
|
1092
1387
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAsyncEmptyTpl, never>;
|
|
@@ -1094,7 +1389,11 @@ declare class CngxAsyncEmptyTpl {
|
|
|
1094
1389
|
}
|
|
1095
1390
|
/**
|
|
1096
1391
|
* Marks the error template inside `cngx-async-container`.
|
|
1097
|
-
* Context: `{ $implicit: unknown }`
|
|
1392
|
+
* Context: `{ $implicit: unknown }` - use `let-err` to access.
|
|
1393
|
+
*
|
|
1394
|
+
* @category ui/feedback/async
|
|
1395
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/async-container/async-container.ts
|
|
1396
|
+
* @since 0.1.0
|
|
1098
1397
|
*/
|
|
1099
1398
|
declare class CngxAsyncErrorTpl {
|
|
1100
1399
|
readonly templateRef: TemplateRef<{
|
|
@@ -1104,7 +1403,7 @@ declare class CngxAsyncErrorTpl {
|
|
|
1104
1403
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAsyncErrorTpl, "ng-template[cngxAsyncError]", never, {}, {}, never, never, true, never>;
|
|
1105
1404
|
}
|
|
1106
1405
|
/**
|
|
1107
|
-
* Async container molecule
|
|
1406
|
+
* Async container molecule - coordinates all feedback states for data loading.
|
|
1108
1407
|
*
|
|
1109
1408
|
* Projects four named templates and switches between them based on the
|
|
1110
1409
|
* `CngxAsyncState` lifecycle. Includes a built-in refresh indicator (bar)
|
|
@@ -1129,6 +1428,23 @@ declare class CngxAsyncErrorTpl {
|
|
|
1129
1428
|
* </ng-template>
|
|
1130
1429
|
* </cngx-async-container>
|
|
1131
1430
|
* ```
|
|
1431
|
+
*
|
|
1432
|
+
* @playground Data flow ./examples/data-flow/data-flow-example.component.ts
|
|
1433
|
+
*
|
|
1434
|
+
* @category ui/feedback/async
|
|
1435
|
+
* @docsKind primary
|
|
1436
|
+
* @wcag AA
|
|
1437
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/feedback/async-container/async-container.ts
|
|
1438
|
+
* @since 0.1.0
|
|
1439
|
+
* @relatedTo CngxLoadingIndicator, CngxLoadingOverlay, CngxAlert, CngxToaster
|
|
1440
|
+
*
|
|
1441
|
+
* <example-url>http://localhost:4200/#/forms/filter-builder/filter-builder-async-state/loading-error-content-branches-via-cngx-async-container</example-url>
|
|
1442
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngx-async-container-full-control-toast</example-url>
|
|
1443
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngxasync-one-line</example-url>
|
|
1444
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/cngxasync-with-custom-templates</example-url>
|
|
1445
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/composition-overlay-container-toast</example-url>
|
|
1446
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/createasyncstate-mutation</example-url>
|
|
1447
|
+
* <example-url>http://localhost:4200/#/ui/feedback/async-container/injectasyncstate-reactive-query</example-url>
|
|
1132
1448
|
*/
|
|
1133
1449
|
declare class CngxAsyncContainer<T> {
|
|
1134
1450
|
private readonly toaster;
|