@cngx/ui 0.1.0-rc.0 → 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cngx-ui-mat-stepper.mjs +76 -229
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +346 -39
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +205 -32
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +238 -23
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +1 -1
- package/mat-stepper/README.md +37 -14
- package/mat-tabs/styles/mat-tabs.css +58 -40
- package/package.json +3 -3
- package/stepper/README.md +74 -0
- package/tabs/README.md +18 -0
- package/types/cngx-ui-mat-stepper.d.ts +64 -113
- package/types/cngx-ui-mat-tabs.d.ts +170 -13
- package/types/cngx-ui-stepper.d.ts +121 -12
- package/types/cngx-ui-tabs.d.ts +145 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _cngx_common_stepper from '@cngx/common/stepper';
|
|
2
|
-
import { CngxStepPanelHost, CngxStepperSkin, CngxStepperMobileIndicatorPosition, CngxStepperSwipeNav, CngxStepNode, CngxStepLabelContext, CngxStepContentContext, CngxDotStepperDotContext, CngxStepperHost } from '@cngx/common/stepper';
|
|
2
|
+
import { CngxStepPanelHost, CngxStepperSkin, CngxStepperHeaderNavigation, CngxStepperMobileIndicatorPosition, CngxStepErrorContext, CngxStepperSwipeNav, CngxStepNode, CngxStepLabelContext, CngxStepContentContext, CngxDotStepperDotContext, CngxStepperHost } from '@cngx/common/stepper';
|
|
3
3
|
import * as _angular_core from '@angular/core';
|
|
4
4
|
import { Signal, TemplateRef } from '@angular/core';
|
|
5
5
|
import * as i2 from '@cngx/common/a11y';
|
|
@@ -42,6 +42,13 @@ declare class CngxStepper implements CngxStepPanelHost {
|
|
|
42
42
|
readonly skin: _angular_core.InputSignal<CngxStepperSkin | undefined>;
|
|
43
43
|
/** Opt the classic skin into the connector-rail presentation. Off by default, classic-scoped. */
|
|
44
44
|
readonly connectors: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Per-instance header-navigation policy. `'none'` renders inert label
|
|
47
|
+
* headers (footer-only navigation); `'visited'` keeps them as
|
|
48
|
+
* focusable buttons gated by `linear`. Cascade: Input ?? config ??
|
|
49
|
+
* `'visited'`.
|
|
50
|
+
*/
|
|
51
|
+
readonly headerNavigation: _angular_core.InputSignal<CngxStepperHeaderNavigation | undefined>;
|
|
45
52
|
/**
|
|
46
53
|
* Opt-in `Step N of M` caption under the mobile `'dots'` row. In
|
|
47
54
|
* the `'text'` collapse branch the count IS the indicator and is
|
|
@@ -61,6 +68,7 @@ declare class CngxStepper implements CngxStepPanelHost {
|
|
|
61
68
|
private readonly badgeSlot;
|
|
62
69
|
private readonly busySpinnerSlot;
|
|
63
70
|
private readonly rejectionSlot;
|
|
71
|
+
private readonly errorSlot;
|
|
64
72
|
private readonly groupHeaderSlot;
|
|
65
73
|
private readonly emptySlot;
|
|
66
74
|
/** Default-template glyph source - read by `#defaultBadge` / `#defaultRejection` outlets. */
|
|
@@ -69,7 +77,7 @@ declare class CngxStepper implements CngxStepPanelHost {
|
|
|
69
77
|
readonly rejectionIcon: "!";
|
|
70
78
|
};
|
|
71
79
|
/**
|
|
72
|
-
*
|
|
80
|
+
* Template cascade (indicator/badge/busySpinner/rejection/stepError/
|
|
73
81
|
* groupHeader/empty). Resolution: per-instance slot directive →
|
|
74
82
|
* `CNGX_STEPPER_CONFIG.templates.<key>` → `null` (built-in default).
|
|
75
83
|
*/
|
|
@@ -80,9 +88,35 @@ declare class CngxStepper implements CngxStepPanelHost {
|
|
|
80
88
|
protected readonly stepperRoleDescription: Signal<string>;
|
|
81
89
|
/** Resolved skin / connectors / mobile-indicator host attrs (Level-2 cascade helper). */
|
|
82
90
|
protected readonly hostAttrs: _cngx_common_stepper.CngxStepperHostAttrs;
|
|
91
|
+
/**
|
|
92
|
+
* Resolved header-navigation policy. Cascade mirrors `skin` /
|
|
93
|
+
* `connectors`: per-instance Input ?? config ?? `'visited'`.
|
|
94
|
+
*/
|
|
95
|
+
protected readonly resolvedHeaderNavigation: Signal<CngxStepperHeaderNavigation>;
|
|
96
|
+
/**
|
|
97
|
+
* Real error reason for a step, or `null`. A reason is the direct
|
|
98
|
+
* `[error]` string or the first `errorAggregator` label.
|
|
99
|
+
*/
|
|
100
|
+
private stepErrorMessageOf;
|
|
101
|
+
/**
|
|
102
|
+
* Errored steps that carry a real message, rendered as a row BELOW the
|
|
103
|
+
* strip (full width, wraps) rather than inline in a step - a free-text
|
|
104
|
+
* message inside a strip item widens the shrink-to-fit step and tears
|
|
105
|
+
* the row. Empty when no step has a real reason.
|
|
106
|
+
*/
|
|
107
|
+
protected readonly stepErrorEntries: Signal<readonly {
|
|
108
|
+
id: string;
|
|
109
|
+
label: string;
|
|
110
|
+
message: string;
|
|
111
|
+
context: CngxStepErrorContext;
|
|
112
|
+
}[]>;
|
|
83
113
|
/** Mobile-swipe navigation host directive (Level-2 composition). */
|
|
84
114
|
protected readonly swipeNav: CngxStepperSwipeNav;
|
|
85
115
|
protected statusLabelFor: (node: CngxStepNode) => string;
|
|
116
|
+
/** Mobile-dot `data-state`: unified error (rejection + aggregator) over the raw status. */
|
|
117
|
+
protected mobileDotState(node: CngxStepNode): string;
|
|
118
|
+
/** Mobile-dot `aria-label`, appending the errored status when the dot has an error. */
|
|
119
|
+
protected mobileDotAriaLabel(node: CngxStepNode, index: number): string;
|
|
86
120
|
protected readonly groupRoleDescription: Signal<string>;
|
|
87
121
|
/**
|
|
88
122
|
* `aria-label` cascade: input → `ariaLabels.stepperRegion` → `i18n.stepperLabel`.
|
|
@@ -101,6 +135,20 @@ declare class CngxStepper implements CngxStepPanelHost {
|
|
|
101
135
|
protected stepIndexOf(node: CngxStepNode): number;
|
|
102
136
|
/** Per-step predicates + slot-context builders (Level-2 factory). */
|
|
103
137
|
protected readonly slotContext: _cngx_common_stepper.CngxStepperSlotContextBuilders;
|
|
138
|
+
/**
|
|
139
|
+
* Shared state view - feeds the mobile-collapse `text` / `dots` branches,
|
|
140
|
+
* which otherwise rendered only `Step N of M` (text) or `node.state()`
|
|
141
|
+
* (dots) and dropped the per-step error the desktop branch shows.
|
|
142
|
+
*/
|
|
143
|
+
protected readonly stateView: _cngx_common_stepper.CngxStepperStateView;
|
|
144
|
+
/**
|
|
145
|
+
* Aggregate error phrase for the mobile-collapse text branch. Feeds the
|
|
146
|
+
* real reason (the `[error]` string / aggregator label) through the
|
|
147
|
+
* resolver so the collapsed view shows "Card declined", not the generic
|
|
148
|
+
* "errored" status word - the strip's per-step row is not on screen in
|
|
149
|
+
* collapsed mode, so this line is the only error surface.
|
|
150
|
+
*/
|
|
151
|
+
protected readonly mobileErrorSummary: Signal<string>;
|
|
104
152
|
/** Commit-in-flight flag - drives the host `aria-busy` binding. Pillar 2. */
|
|
105
153
|
protected readonly isCommitting: Signal<boolean>;
|
|
106
154
|
protected stepHeaderId(node: CngxStepNode): string;
|
|
@@ -109,6 +157,28 @@ declare class CngxStepper implements CngxStepPanelHost {
|
|
|
109
157
|
/** Live-region + per-step + group SR phrase builders (Level-2 factory). */
|
|
110
158
|
protected readonly announcement: _cngx_common_stepper.CngxStepperAnnouncementBuilders;
|
|
111
159
|
protected handleHeaderClick(node: CngxStepNode): void;
|
|
160
|
+
/**
|
|
161
|
+
* `true` when the step header at `node` may be navigated to right now:
|
|
162
|
+
* structurally reachable (`canNavigateTo` - not disabled, not
|
|
163
|
+
* linear-blocked) AND not while a commit is in flight (`busy()`). The
|
|
164
|
+
* busy gate mirrors the footer nav atoms, which disable on
|
|
165
|
+
* `!canGo* || busy()` - so the strip and the footer lock together
|
|
166
|
+
* during an async transition instead of letting a header click
|
|
167
|
+
* supersede the pending commit. Reads the host contract, never the
|
|
168
|
+
* presenter's private linear-block check.
|
|
169
|
+
*/
|
|
170
|
+
protected isHeaderReachable(node: CngxStepNode): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* `'true'` on a header that cannot be navigated to, `null` otherwise.
|
|
173
|
+
* Folds two channels into one binding: a `disabled` step and a
|
|
174
|
+
* linear-unreachable step both read as `aria-disabled`, so the gate is
|
|
175
|
+
* announced rather than silently ignored. The header stays focusable
|
|
176
|
+
* per the ARIA composite-widget disabled-focusable rule. In
|
|
177
|
+
* `'visited'` + `linear=false` this is byte-identical to the
|
|
178
|
+
* prior `node.disabled()`-only binding, since `canNavigateTo` returns
|
|
179
|
+
* `true` for every enabled step when linear is off.
|
|
180
|
+
*/
|
|
181
|
+
protected headerAriaDisabled(node: CngxStepNode): 'true' | null;
|
|
112
182
|
/** Strip-scoped arrow-key handler. See {@link createStepperStripKeyboardNav}. */
|
|
113
183
|
protected readonly handleStripKeyDown: (event: KeyboardEvent) => void;
|
|
114
184
|
/**
|
|
@@ -120,7 +190,7 @@ declare class CngxStepper implements CngxStepPanelHost {
|
|
|
120
190
|
labelTemplateFor(id: string): TemplateRef<CngxStepLabelContext> | null;
|
|
121
191
|
contentTemplateFor(id: string): TemplateRef<CngxStepContentContext> | null;
|
|
122
192
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStepper, never>;
|
|
123
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxStepper, "cngx-stepper", ["cngxStepper"], { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "skin": { "alias": "skin"; "required": false; "isSignal": true; }; "connectors": { "alias": "connectors"; "required": false; "isSignal": true; }; "showStepCount": { "alias": "showStepCount"; "required": false; "isSignal": true; }; "mobileIndicatorPosition": { "alias": "mobileIndicatorPosition"; "required": false; "isSignal": true; }; }, {}, ["stepDirectives", "indicatorSlot", "badgeSlot", "busySpinnerSlot", "rejectionSlot", "groupHeaderSlot", "emptySlot"], ["cngx-stepper-footer, [cngxStepperFooter]"], true, [{ directive: typeof _cngx_common_stepper.CngxStepperPresenter; inputs: { "activeStepIndex": "activeStepIndex"; "linear": "linear"; "orientation": "orientation"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeStepIndexChange": "activeStepIndexChange"; }; }, { directive: typeof i2.CngxRovingTabindex; inputs: { "orientation": "orientation"; }; outputs: {}; }, { directive: typeof _cngx_common_stepper.CngxStepperSwipeNav; inputs: { "mobileSwipe": "mobileSwipe"; }; outputs: {}; }, { directive: typeof i2.CngxFocusRestore; inputs: {}; outputs: {}; }]>;
|
|
193
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxStepper, "cngx-stepper", ["cngxStepper"], { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "skin": { "alias": "skin"; "required": false; "isSignal": true; }; "connectors": { "alias": "connectors"; "required": false; "isSignal": true; }; "headerNavigation": { "alias": "headerNavigation"; "required": false; "isSignal": true; }; "showStepCount": { "alias": "showStepCount"; "required": false; "isSignal": true; }; "mobileIndicatorPosition": { "alias": "mobileIndicatorPosition"; "required": false; "isSignal": true; }; }, {}, ["stepDirectives", "indicatorSlot", "badgeSlot", "busySpinnerSlot", "rejectionSlot", "errorSlot", "groupHeaderSlot", "emptySlot"], ["cngx-stepper-footer, [cngxStepperFooter]"], true, [{ directive: typeof _cngx_common_stepper.CngxStepperPresenter; inputs: { "activeStepIndex": "activeStepIndex"; "linear": "linear"; "orientation": "orientation"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeStepIndexChange": "activeStepIndexChange"; }; }, { directive: typeof i2.CngxRovingTabindex; inputs: { "orientation": "orientation"; }; outputs: {}; }, { directive: typeof _cngx_common_stepper.CngxStepperSwipeNav; inputs: { "mobileSwipe": "mobileSwipe"; }; outputs: {}; }, { directive: typeof i2.CngxFocusRestore; inputs: {}; outputs: {}; }]>;
|
|
124
194
|
}
|
|
125
195
|
|
|
126
196
|
/**
|
|
@@ -150,6 +220,10 @@ declare class CngxProgressBarStepper {
|
|
|
150
220
|
readonly showStepCount: _angular_core.InputSignal<boolean>;
|
|
151
221
|
protected readonly presenter: _cngx_common_stepper.CngxStepperHost;
|
|
152
222
|
protected readonly i18n: _cngx_common_stepper.CngxStepperI18n;
|
|
223
|
+
/** Shared per-step/aggregate state derivations - the single error source. */
|
|
224
|
+
protected readonly stateView: _cngx_common_stepper.CngxStepperStateView;
|
|
225
|
+
/** Default error glyph for the error caption. */
|
|
226
|
+
protected readonly errorGlyph: "!";
|
|
153
227
|
/** Total step count (group nodes excluded). */
|
|
154
228
|
protected readonly totalSteps: _angular_core.Signal<number>;
|
|
155
229
|
/** 1-based active position used in the caption format. */
|
|
@@ -160,6 +234,12 @@ declare class CngxProgressBarStepper {
|
|
|
160
234
|
*/
|
|
161
235
|
protected readonly completedPercent: _angular_core.Signal<number>;
|
|
162
236
|
protected readonly captionText: _angular_core.Signal<string>;
|
|
237
|
+
/**
|
|
238
|
+
* Aggregate error caption. A single errored step names itself
|
|
239
|
+
* (`"Payment: Errored"`), several collapse to the i18n count phrase.
|
|
240
|
+
* Read only when `stateView.hasAnyError()` gates the template.
|
|
241
|
+
*/
|
|
242
|
+
protected readonly errorText: _angular_core.Signal<string>;
|
|
163
243
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxProgressBarStepper, never>;
|
|
164
244
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxProgressBarStepper, "cngx-progress-bar-stepper", ["cngxProgressBarStepper"], { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "showStepCount": { "alias": "showStepCount"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof _cngx_common_stepper.CngxStepperPresenter; inputs: { "activeStepIndex": "activeStepIndex"; "linear": "linear"; }; outputs: { "activeStepIndexChange": "activeStepIndexChange"; }; }]>;
|
|
165
245
|
}
|
|
@@ -206,16 +286,33 @@ declare class CngxDotStepper {
|
|
|
206
286
|
protected readonly swipeNav: CngxStepperSwipeNav;
|
|
207
287
|
protected readonly stepNodes: Signal<readonly CngxStepNode[]>;
|
|
208
288
|
protected readonly activeIndex: Signal<number>;
|
|
289
|
+
/** Shared per-step/aggregate state derivations - the single error source. */
|
|
290
|
+
protected readonly stateView: _cngx_common_stepper.CngxStepperStateView;
|
|
291
|
+
/** Default error glyph for the aggregate error line. */
|
|
292
|
+
protected readonly errorGlyph: "!";
|
|
293
|
+
/**
|
|
294
|
+
* Aggregate error line. The dot row only colours the errored dot, so
|
|
295
|
+
* the real reason (the `[error]` string / aggregator label) needs a
|
|
296
|
+
* text surface; this is it. Falls back to the count phrase for
|
|
297
|
+
* multiple errors.
|
|
298
|
+
*/
|
|
299
|
+
protected readonly errorText: Signal<string>;
|
|
209
300
|
private readonly dotSlot;
|
|
210
301
|
/**
|
|
211
302
|
* Resolved dot-body template cascade: per-instance `*cngxDotStepperDot`
|
|
212
303
|
* directive > `CNGX_STEPPER_CONFIG.templates.dotStepperDot` > `null`
|
|
213
|
-
* (built-in empty body). Pillar 1
|
|
304
|
+
* (built-in empty body). Pillar 1 - resolution is a `computed`, not
|
|
214
305
|
* manual sync.
|
|
215
306
|
*/
|
|
216
307
|
protected readonly resolvedDotTemplate: Signal<TemplateRef<CngxDotStepperDotContext> | null>;
|
|
217
308
|
protected isActive(node: CngxStepNode, index: number): boolean;
|
|
218
309
|
protected isCompleted(index: number): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Resolved `data-state` for the dot: `'error'` whenever the unified error
|
|
312
|
+
* view fires (covers commit rejection and the error aggregator, not just a
|
|
313
|
+
* literal `state === 'error'`), otherwise the raw step status.
|
|
314
|
+
*/
|
|
315
|
+
protected dotState(node: CngxStepNode): string;
|
|
219
316
|
protected ariaLabelFor(node: CngxStepNode, index: number): string;
|
|
220
317
|
/** Build the slot context for `*cngxDotStepperDot`. */
|
|
221
318
|
protected dotContextFor(node: CngxStepNode, index: number): CngxDotStepperDotContext;
|
|
@@ -247,28 +344,40 @@ declare class CngxTextStepper {
|
|
|
247
344
|
protected readonly presenter: _cngx_common_stepper.CngxStepperHost;
|
|
248
345
|
protected readonly i18n: _cngx_common_stepper.CngxStepperI18n;
|
|
249
346
|
protected readonly stepNodes: Signal<readonly CngxStepNode[]>;
|
|
347
|
+
/** Shared per-step/aggregate state derivations - the single error source. */
|
|
348
|
+
protected readonly stateView: _cngx_common_stepper.CngxStepperStateView;
|
|
349
|
+
/** Default error glyph for the error sub-line. */
|
|
350
|
+
protected readonly errorGlyph: "!";
|
|
250
351
|
protected readonly totalSteps: Signal<number>;
|
|
251
352
|
protected readonly currentStep: Signal<number>;
|
|
252
353
|
protected readonly stepText: Signal<string>;
|
|
354
|
+
/**
|
|
355
|
+
* Aggregate error sub-line text. A single errored step names itself
|
|
356
|
+
* (`"Payment: Errored"`), several collapse to the i18n count phrase
|
|
357
|
+
* (`"2 errors"`). Empty when no step errored - the template gates on
|
|
358
|
+
* `stateView.hasAnyError()`, so this is only read when non-empty.
|
|
359
|
+
*/
|
|
360
|
+
protected readonly errorText: Signal<string>;
|
|
253
361
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTextStepper, never>;
|
|
254
362
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTextStepper, "cngx-text-stepper", ["cngxTextStepper"], { "showCurrentLabel": { "alias": "showCurrentLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof _cngx_common_stepper.CngxStepperPresenter; inputs: { "activeStepIndex": "activeStepIndex"; "linear": "linear"; }; outputs: { "activeStepIndexChange": "activeStepIndexChange"; }; }]>;
|
|
255
363
|
}
|
|
256
364
|
|
|
257
365
|
/**
|
|
258
|
-
* Navigation action-bar molecule for the stepper family.
|
|
259
|
-
* regions - start (Back), center (progress hint), end (Continue / Finish)
|
|
260
|
-
*
|
|
261
|
-
* drops inside.
|
|
366
|
+
* Navigation action-bar molecule for the stepper family. \
|
|
367
|
+
* Lays out three regions - **start** (Back), **center** (progress hint), **end** (Continue / Finish). \
|
|
368
|
+
* Wires the {@link CNGX_STEPPER_HOST} for any nav atoms a consumer drops inside.
|
|
262
369
|
*
|
|
263
|
-
* Resolves its host like `CngxStepperCount
|
|
264
|
-
* for placement outside the stepper tree, falling back to the ambient
|
|
370
|
+
* **Resolves its host like `CngxStepperCount`:** \
|
|
371
|
+
* An explicit `[host]` input for placement outside the stepper tree, falling back to the ambient
|
|
265
372
|
* host injected from an ancestor `<cngx-stepper>` / `<cngx-mat-stepper>`
|
|
266
373
|
* (`skipSelf`, so the footer reads the real presenter rather than its own
|
|
267
|
-
* re-provided proxy).
|
|
374
|
+
* re-provided proxy). \
|
|
375
|
+
* It then re-provides `CNGX_STEPPER_HOST` as a live
|
|
268
376
|
* {@link createStepperHostProxy} over the resolved host, so child
|
|
269
377
|
* `[cngxStepperPrevious]` / `[cngxStepperNext]` atoms resolve it
|
|
270
378
|
* ambiently whether the footer is nested or used standalone with
|
|
271
|
-
* `[host]`.
|
|
379
|
+
* `[host]`. \
|
|
380
|
+
* `providers` (not `viewProviders`) carries the proxy to the
|
|
272
381
|
* consumer-projected button content. With no host at all, the proxy's
|
|
273
382
|
* neutral set renders the nav buttons disabled.
|
|
274
383
|
*
|
package/types/cngx-ui-tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _cngx_common_tabs from '@cngx/common/tabs';
|
|
2
|
-
import { CngxTabPanelHost, CngxTabGroupAnnouncements, CngxTabGroupTemplateBindings, CngxTabHandle, CngxTabErrorBadgeContext, CngxTabBusySpinnerContext, CngxTabRejectionIconContext, tabOverflowOptionId } from '@cngx/common/tabs';
|
|
2
|
+
import { CngxTabPanelHost, CngxTabsSkin, CngxTabIconLayout, CngxTabsPanelMode, CngxTabAlign, CngxTabDismissals, CngxTabKeyboardNav, CngxTabGroupAnnouncements, CngxTabsHostAttrs, CngxTabGroupTemplateBindings, CngxTabHandle, CngxTabIconContext, CngxTabErrorBadgeContext, CngxTabBusySpinnerContext, CngxTabRejectionIconContext, tabOverflowOptionId } from '@cngx/common/tabs';
|
|
3
3
|
import * as _angular_core from '@angular/core';
|
|
4
4
|
import { Signal, TemplateRef } from '@angular/core';
|
|
5
5
|
import * as i2 from '@cngx/common/a11y';
|
|
@@ -7,8 +7,12 @@ import { CngxPopover } from '@cngx/common/popover';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* CNGX tab-group organism. Thin shell over {@link CngxTabGroupPresenter}
|
|
10
|
-
* + `
|
|
11
|
-
*
|
|
10
|
+
* + `CngxFocusRestore` via `hostDirectives`. The APG tablist keyboard
|
|
11
|
+
* model (automatic activation: arrow keys move focus AND select; Home/End
|
|
12
|
+
* jump to first/last; the active tab is the lone tab stop) lives in
|
|
13
|
+
* {@link createTabKeyboardNav}, deriving the roving stop from the
|
|
14
|
+
* presenter's `activeId` rather than a competing index. Material variant
|
|
15
|
+
* lives at `[cngxMatTabs]` in `@cngx/ui/mat-tabs`.
|
|
12
16
|
*
|
|
13
17
|
* All ARIA attrs are signal-driven - never one-shot bindings.
|
|
14
18
|
* `CngxLiveRegion` is mounted as a child `<span>` rather than a
|
|
@@ -23,7 +27,7 @@ import { CngxPopover } from '@cngx/common/popover';
|
|
|
23
27
|
* @wcag AA
|
|
24
28
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/tabs/tab-group.component.ts
|
|
25
29
|
* @since 0.1.0
|
|
26
|
-
* @relatedTo CngxTabOverflow, CngxTabGroupPresenter, CngxTab,
|
|
30
|
+
* @relatedTo CngxTabOverflow, CngxTabGroupPresenter, CngxTab, CngxFocusRestore
|
|
27
31
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
28
32
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-error-aggregation/per-tab-error-badges</example-url>
|
|
29
33
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-group-vertical/vertical-sidebar-tabs</example-url>
|
|
@@ -36,13 +40,57 @@ import { CngxPopover } from '@cngx/common/popover';
|
|
|
36
40
|
declare class CngxTabGroup implements CngxTabPanelHost {
|
|
37
41
|
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
38
42
|
readonly ariaLabelledBy: _angular_core.InputSignal<string | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* Visual skin. Cascade `input ?? config ?? 'line'`, resolved by
|
|
45
|
+
* {@link hostAttrs} and reflected onto `[data-skin]`. The skin is a
|
|
46
|
+
* pure CSS concern - structure, slots, ARIA, and keyboard behaviour
|
|
47
|
+
* are identical across all values. Public (consumer-facing input,
|
|
48
|
+
* like `ariaLabel`); the resolved value, not the raw input, is what
|
|
49
|
+
* the host binding reads.
|
|
50
|
+
*/
|
|
51
|
+
readonly skin: _angular_core.InputSignal<CngxTabsSkin | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Icon layout. Cascade `input ?? config ?? 'start'`, reflected onto
|
|
54
|
+
* `[data-icon-layout]`. Orthogonal to skin and orientation.
|
|
55
|
+
*/
|
|
56
|
+
readonly iconLayout: _angular_core.InputSignal<CngxTabIconLayout | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Panel render strategy. Cascade `input ?? config ?? 'eager'`,
|
|
59
|
+
* reflected onto `[data-panel-mode]`. `'eager'` (default) renders every
|
|
60
|
+
* panel's content up front (byte-identical to before this input
|
|
61
|
+
* existed); `'lazy'` keep-alives content after first activation;
|
|
62
|
+
* `'lazy-destroy'` renders only the active panel's content. The panel
|
|
63
|
+
* `<div>` always stays in the DOM regardless.
|
|
64
|
+
*/
|
|
65
|
+
readonly panelMode: _angular_core.InputSignal<CngxTabsPanelMode | undefined>;
|
|
66
|
+
/** Stretch tabs to fill the strip width (horizontal only); reflects `[data-fitted]`. Cascade `input ?? config ?? false`. */
|
|
67
|
+
readonly fitted: _angular_core.InputSignal<boolean | undefined>;
|
|
68
|
+
/** Tab-cluster alignment when not fitted (horizontal only); reflects `[data-tab-align]`. Cascade `input ?? config ?? 'start'`. */
|
|
69
|
+
readonly tabAlign: _angular_core.InputSignal<CngxTabAlign | undefined>;
|
|
70
|
+
/**
|
|
71
|
+
* Whether tabs render a close affordance. Cascade
|
|
72
|
+
* `input ?? config ?? false`. A per-`CngxTab` `[closable]` override
|
|
73
|
+
* wins over this group default. When on, each closable tab gets a
|
|
74
|
+
* close button (and Delete on the focused tab closes it); the
|
|
75
|
+
* `(tabClose)` output fires with the tab id and index for the
|
|
76
|
+
* consumer to remove from its data.
|
|
77
|
+
*/
|
|
78
|
+
readonly closable: _angular_core.InputSignal<boolean | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the group renders an add-tab button after the strip. Cascade
|
|
81
|
+
* `input ?? config ?? false`. When on, the `(tabAdd)` output fires for
|
|
82
|
+
* the consumer to append a tab to its data.
|
|
83
|
+
*/
|
|
84
|
+
readonly addable: _angular_core.InputSignal<boolean | undefined>;
|
|
39
85
|
protected readonly presenter: _cngx_common_tabs.CngxTabGroupHost;
|
|
40
86
|
protected readonly i18n: _cngx_common_tabs.CngxTabsI18n;
|
|
41
87
|
protected readonly config: _cngx_common_tabs.CngxTabsConfig;
|
|
42
|
-
/** Default-glyph table for the template's fallback spans.
|
|
88
|
+
/** Default-glyph table for the template's fallback spans. */
|
|
43
89
|
protected readonly glyphs: {
|
|
44
90
|
readonly errorBadge: "!";
|
|
45
91
|
readonly rejectionIcon: "!";
|
|
92
|
+
readonly closeIcon: "\u00D7";
|
|
93
|
+
readonly addIcon: "+";
|
|
46
94
|
};
|
|
47
95
|
private readonly hostElement;
|
|
48
96
|
private readonly injector;
|
|
@@ -56,6 +104,23 @@ declare class CngxTabGroup implements CngxTabPanelHost {
|
|
|
56
104
|
private readonly errorBadgeSlot;
|
|
57
105
|
private readonly rejectionIconSlot;
|
|
58
106
|
private readonly busySpinnerSlot;
|
|
107
|
+
private readonly iconSlot;
|
|
108
|
+
private readonly closeIconSlot;
|
|
109
|
+
private readonly addIconSlot;
|
|
110
|
+
/**
|
|
111
|
+
* Dismissable / addable affordance surface (close + add resolution,
|
|
112
|
+
* close interaction, focus restoration). Level-2 helper keeps the
|
|
113
|
+
* cascade + handlers off the organism class (LOC guard).
|
|
114
|
+
*/
|
|
115
|
+
protected readonly dismiss: CngxTabDismissals;
|
|
116
|
+
/**
|
|
117
|
+
* APG tablist keyboard model (automatic activation). Owns arrow / Home /
|
|
118
|
+
* End resolution, the `host.select()` activation, and focus movement;
|
|
119
|
+
* derives each tab's roving `tabindex` from the presenter's `activeId`
|
|
120
|
+
* (single source of truth). Level-2 helper keeps the keyboard logic off
|
|
121
|
+
* the organism class (LOC guard).
|
|
122
|
+
*/
|
|
123
|
+
protected readonly keyboard: CngxTabKeyboardNav;
|
|
59
124
|
/**
|
|
60
125
|
* AT-announcement bundle from `@cngx/common/tabs/announcements/`.
|
|
61
126
|
* Owns role descriptions, resolved aria-label, live-region phrasing,
|
|
@@ -63,11 +128,28 @@ declare class CngxTabGroup implements CngxTabPanelHost {
|
|
|
63
128
|
* direction prefix.
|
|
64
129
|
*/
|
|
65
130
|
protected readonly announcements: CngxTabGroupAnnouncements;
|
|
131
|
+
/**
|
|
132
|
+
* Resolved skin / icon-layout cascade (`input ?? config ?? default`),
|
|
133
|
+
* read by the `[data-skin]` / `[data-icon-layout]` host bindings. The
|
|
134
|
+
* Level-2 helper keeps the cascade off the organism class (LOC guard).
|
|
135
|
+
*/
|
|
136
|
+
protected readonly hostAttrs: CngxTabsHostAttrs;
|
|
137
|
+
/**
|
|
138
|
+
* Whether the active panel contains a natively-focusable descendant.
|
|
139
|
+
* Resolved by a post-render DOM probe (the only way to know - the
|
|
140
|
+
* panel content is consumer-projected). Drives {@link panelTabindex}:
|
|
141
|
+
* a panel with no focusable child earns one tab stop so keyboard users
|
|
142
|
+
* can still reach its content (APG tabpanel pattern); a panel that
|
|
143
|
+
* already has reachable content does not (no redundant stop). Boolean
|
|
144
|
+
* with default `Object.is`, so a stable probe never re-triggers CD.
|
|
145
|
+
*/
|
|
146
|
+
private readonly activePanelHasFocusable;
|
|
66
147
|
constructor();
|
|
67
148
|
private readonly tabDirectiveById;
|
|
68
149
|
/**
|
|
69
|
-
* Resolved 3-stage cascade for `errorBadge`, `rejectionIcon`,
|
|
70
|
-
* `null` -> render built-in default
|
|
150
|
+
* Resolved 3-stage cascade for `errorBadge`, `rejectionIcon`,
|
|
151
|
+
* `busySpinner`, `icon`. `null` -> render built-in default (or, for
|
|
152
|
+
* `icon`, render nothing).
|
|
71
153
|
*/
|
|
72
154
|
protected readonly templates: CngxTabGroupTemplateBindings;
|
|
73
155
|
readonly tabs: Signal<readonly CngxTabHandle[]>;
|
|
@@ -78,9 +160,50 @@ declare class CngxTabGroup implements CngxTabPanelHost {
|
|
|
78
160
|
protected isTabBusy(tab: CngxTabHandle): boolean;
|
|
79
161
|
protected tabHeaderId(tab: CngxTabHandle): string;
|
|
80
162
|
protected tabPanelId(tab: CngxTabHandle): string;
|
|
163
|
+
/**
|
|
164
|
+
* APG tabpanel `tabindex`: `0` only when the selected panel has no
|
|
165
|
+
* focusable descendant (so its content is keyboard-reachable from the
|
|
166
|
+
* tablist), else `null` - never a redundant tab stop. Inactive panels
|
|
167
|
+
* are `null` (they are `[hidden]`).
|
|
168
|
+
*/
|
|
169
|
+
protected panelTabindex(tab: CngxTabHandle): 0 | null;
|
|
170
|
+
/**
|
|
171
|
+
* Keep-alive set for `panelMode='lazy'`: the ids of every tab that has
|
|
172
|
+
* ever been activated. Derived history (Pillar 1) - a `linkedSignal`
|
|
173
|
+
* accumulating onto its own previous value as `activeId` moves, NOT an
|
|
174
|
+
* `effect` that writes a set. The structural `equal` (size + membership)
|
|
175
|
+
* means re-activating an already-seen tab returns an equal set, so the
|
|
176
|
+
* reference is stable and downstream `shouldRenderContent` reads do not
|
|
177
|
+
* churn. Unbounded by design: `lazy` trades retention (every visited
|
|
178
|
+
* panel's content stays alive for the directive's life) for keep-alive;
|
|
179
|
+
* the set is bounded by tab count, and `lazy-destroy` is the bounded
|
|
180
|
+
* alternative when retention is unwanted.
|
|
181
|
+
*/
|
|
182
|
+
private readonly seenIds;
|
|
183
|
+
/**
|
|
184
|
+
* Whether a tab's panel content should be rendered now. The panel
|
|
185
|
+
* `<div>` is always in the DOM (the `aria-controls` target); only its
|
|
186
|
+
* inner content is gated. `eager` is byte-identical to the original
|
|
187
|
+
* behaviour (everything rendered, visibility toggled via `[hidden]`).
|
|
188
|
+
*/
|
|
189
|
+
protected shouldRenderContent(tab: CngxTabHandle): boolean;
|
|
81
190
|
protected tabDescriptorId(tab: CngxTabHandle): string;
|
|
82
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* `true` when the tab is in error - the folded `hasError` (direct
|
|
193
|
+
* `[error]` flag OR the aggregator's reveal-gated `shouldShow()`), so
|
|
194
|
+
* a direct-error tab lights the badge without an aggregator while
|
|
195
|
+
* deferred-reveal aggregators stay silent until revealed.
|
|
196
|
+
*/
|
|
83
197
|
protected showErrorBadge(tab: CngxTabHandle): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Context for `*cngxTabIcon`. Allocates fresh per CD - `active` is
|
|
200
|
+
* reactive (selection), and `*ngTemplateOutlet` only re-evaluates
|
|
201
|
+
* `let-*` bindings when the context reference changes (`Object.is`
|
|
202
|
+
* input-diff); a `WeakMap`-cached object with a mutated `active`
|
|
203
|
+
* would leave consumer bindings stale. Same pattern as
|
|
204
|
+
* {@link busySpinnerContextFor}.
|
|
205
|
+
*/
|
|
206
|
+
protected iconContextFor(tab: CngxTabHandle, index: number): CngxTabIconContext;
|
|
84
207
|
/**
|
|
85
208
|
* Stable per-tab `*cngxTabErrorBadge` context cache. Context is
|
|
86
209
|
* `{ tab }` only (no reactive fields), so a `WeakMap` keeps the
|
|
@@ -107,6 +230,18 @@ declare class CngxTabGroup implements CngxTabPanelHost {
|
|
|
107
230
|
*/
|
|
108
231
|
protected rejectionIconContextFor(failedIndex: number): CngxTabRejectionIconContext;
|
|
109
232
|
protected handleHeaderClick(tab: CngxTabHandle): void;
|
|
233
|
+
/**
|
|
234
|
+
* Roving `tabindex` for a tab button: `0` for the active tab, `-1` for
|
|
235
|
+
* the rest, so the tablist is a single tab stop (APG) and `Tab` lands
|
|
236
|
+
* on the active tab. Derived in {@link keyboard} from `activeId`.
|
|
237
|
+
*/
|
|
238
|
+
protected tabTabindex(tab: CngxTabHandle): 0 | -1;
|
|
239
|
+
/**
|
|
240
|
+
* Single `(keydown)` entry for a tab button: APG navigation
|
|
241
|
+
* (arrows / Home / End, automatic activation) first, then Delete-to-close
|
|
242
|
+
* when navigation did not consume the event.
|
|
243
|
+
*/
|
|
244
|
+
protected handleTabKeydown(tab: CngxTabHandle, event: KeyboardEvent): void;
|
|
110
245
|
selectById(id: string): void;
|
|
111
246
|
/**
|
|
112
247
|
* Clear the presenter's `lastFailedIndex` rejection flag - exposed
|
|
@@ -115,9 +250,10 @@ declare class CngxTabGroup implements CngxTabPanelHost {
|
|
|
115
250
|
*/
|
|
116
251
|
clearLastFailed(): void;
|
|
117
252
|
labelTemplateFor(id: string): TemplateRef<unknown> | null;
|
|
253
|
+
subLabelTemplateFor(id: string): TemplateRef<unknown> | null;
|
|
118
254
|
contentTemplateFor(id: string): TemplateRef<unknown> | null;
|
|
119
255
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTabGroup, never>;
|
|
120
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTabGroup, "cngx-tab-group", ["cngxTabGroup"], { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; }, {}, ["tabDirectives", "errorBadgeSlot", "rejectionIconSlot", "busySpinnerSlot"], ["cngx-tab-overflow", "*"], true, [{ directive: typeof _cngx_common_tabs.CngxTabGroupPresenter; inputs: { "activeIndex": "activeIndex"; "orientation": "orientation"; "loop": "loop"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeIndexChange": "activeIndexChange";
|
|
256
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTabGroup, "cngx-tab-group", ["cngxTabGroup"], { "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "skin": { "alias": "skin"; "required": false; "isSignal": true; }; "iconLayout": { "alias": "iconLayout"; "required": false; "isSignal": true; }; "panelMode": { "alias": "panelMode"; "required": false; "isSignal": true; }; "fitted": { "alias": "fitted"; "required": false; "isSignal": true; }; "tabAlign": { "alias": "tabAlign"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "addable": { "alias": "addable"; "required": false; "isSignal": true; }; }, {}, ["tabDirectives", "errorBadgeSlot", "rejectionIconSlot", "busySpinnerSlot", "iconSlot", "closeIconSlot", "addIconSlot"], ["cngx-tab-overflow", "*"], true, [{ directive: typeof _cngx_common_tabs.CngxTabGroupPresenter; inputs: { "activeIndex": "activeIndex"; "orientation": "orientation"; "loop": "loop"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeIndexChange": "activeIndexChange"; "tabClose": "tabClose"; "tabAdd": "tabAdd"; }; }, { directive: typeof i2.CngxFocusRestore; inputs: {}; outputs: {}; }]>;
|
|
121
257
|
}
|
|
122
258
|
|
|
123
259
|
/**
|