@cngx/common 0.1.0-rc.0 → 0.1.0-rc.2
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-common-a11y.mjs +24 -11
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +64 -48
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +45 -11
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +559 -38
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1394 -160
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/package.json +3 -3
- package/stepper/README.md +16 -9
- package/theming/components/cngx-badge.css +1 -1
- package/theming/components/cngx-menu.css +1 -1
- package/types/cngx-common-a11y.d.ts +23 -2
- package/types/cngx-common-data.d.ts +46 -33
- package/types/cngx-common-interactive.d.ts +20 -2
- package/types/cngx-common-stepper.d.ts +604 -17
- package/types/cngx-common-tabs.d.ts +1363 -159
- package/tabs/README.md +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Signal, InjectionToken, TemplateRef, EnvironmentProviders, Provider, DestroyRef } from '@angular/core';
|
|
2
|
+
import { Signal, InjectionToken, TemplateRef, EnvironmentProviders, Provider, DestroyRef, Injector } from '@angular/core';
|
|
3
3
|
import { CngxAsyncState, StatusTransition } from '@cngx/core/utils';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import * as i1 from '@cngx/common/interactive';
|
|
@@ -28,6 +28,13 @@ interface CngxStepNode {
|
|
|
28
28
|
readonly state: Signal<CngxStepStatus>;
|
|
29
29
|
/** Optional error aggregator signal for badge / SR phrasing. */
|
|
30
30
|
readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Message carried by a direct `[error]` string input on the step, or
|
|
33
|
+
* `undefined` when `[error]` is boolean / absent. Pure data carrier
|
|
34
|
+
* read by the `*cngxStepError` slot + the mini-skin aggregate line -
|
|
35
|
+
* not a swap surface.
|
|
36
|
+
*/
|
|
37
|
+
readonly errorMessage?: Signal<string | undefined>;
|
|
31
38
|
/** Direct children for group nodes; empty for step nodes. */
|
|
32
39
|
readonly children: readonly CngxStepNode[];
|
|
33
40
|
/** DFS depth (root = 0). */
|
|
@@ -50,6 +57,12 @@ interface CngxStepRegistration {
|
|
|
50
57
|
readonly disabled: Signal<boolean>;
|
|
51
58
|
readonly state: Signal<CngxStepStatus>;
|
|
52
59
|
readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Resolved message from a direct `[error]` string input, or
|
|
62
|
+
* `undefined` for boolean / absent. Pure data carrier (not a swap
|
|
63
|
+
* token); surfaced on {@link CngxStepNode.errorMessage}.
|
|
64
|
+
*/
|
|
65
|
+
readonly errorMessage?: Signal<string | undefined>;
|
|
53
66
|
}
|
|
54
67
|
/**
|
|
55
68
|
* Contract atoms see via {@link CNGX_STEPPER_HOST}. Mirrors the
|
|
@@ -76,8 +89,32 @@ interface CngxStepperHost {
|
|
|
76
89
|
* @category common/stepper
|
|
77
90
|
*/
|
|
78
91
|
readonly stepsOnly: Signal<readonly CngxStepNode[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Flat strip projection under the focus-driven group-collapse policy:
|
|
94
|
+
* identical to {@link flatSteps} when `groupCollapse` is `'off'`, and
|
|
95
|
+
* with every non-active root-level group's children dropped (header
|
|
96
|
+
* node alone) under `'expand-active'`. The strip `@for` reads this;
|
|
97
|
+
* `stepsOnly` stays the single counting / announcement source.
|
|
98
|
+
*
|
|
99
|
+
* **Contract:** variant and skin organisms drive the strip off this
|
|
100
|
+
* projection, never re-derive it. Structural-equal via `flatStepsEqual`
|
|
101
|
+
* (each retained node keeps its `flatSteps` `flatIndex`), so a
|
|
102
|
+
* shape-stable re-emit short-circuits the strip render.
|
|
103
|
+
*
|
|
104
|
+
* @category common/stepper
|
|
105
|
+
*/
|
|
106
|
+
readonly visibleStripNodes: Signal<readonly CngxStepNode[]>;
|
|
79
107
|
readonly activeStepIndex: Signal<number>;
|
|
80
108
|
readonly activeStepId: Signal<string | null>;
|
|
109
|
+
/**
|
|
110
|
+
* Root-level group whose subtree contains the active step, or `null`
|
|
111
|
+
* when the active step is a root-level step (e.g. a trailing
|
|
112
|
+
* `Finish`). The single focus-driven-collapse source: atoms read it
|
|
113
|
+
* via this contract, never the concrete presenter. Drives
|
|
114
|
+
* `CngxStepGroup.isCollapsed`, the strip `aria-expanded` binding, and
|
|
115
|
+
* {@link visibleStripNodes}.
|
|
116
|
+
*/
|
|
117
|
+
readonly activeGroupId: Signal<string | null>;
|
|
81
118
|
/** Step-only count - the length of {@link stepsOnly}. */
|
|
82
119
|
readonly stepCount: Signal<number>;
|
|
83
120
|
/** `true` when the active step is the first one (no earlier step). */
|
|
@@ -142,6 +179,14 @@ interface CngxStepperHost {
|
|
|
142
179
|
* success; retained on rejection through the persistence window.
|
|
143
180
|
*/
|
|
144
181
|
readonly originIndexDuringCommit: Signal<number | undefined>;
|
|
182
|
+
/**
|
|
183
|
+
* `true` when the header at the given step-only index may be
|
|
184
|
+
* navigated to: the step is enabled and not blocked by the `linear`
|
|
185
|
+
* gate. The single reachability predicate a header affordance reads -
|
|
186
|
+
* the organism MUST call this rather than reaching the presenter's
|
|
187
|
+
* private linear-block check. Out-of-range indices return `false`.
|
|
188
|
+
*/
|
|
189
|
+
canNavigateTo(index: number): boolean;
|
|
145
190
|
select(index: number): void;
|
|
146
191
|
selectNext(): void;
|
|
147
192
|
selectPrevious(): void;
|
|
@@ -244,6 +289,30 @@ declare class CngxStepperPresenter implements CngxStepperHost {
|
|
|
244
289
|
readonly stepsOnly: Signal<readonly CngxStepNode[]>;
|
|
245
290
|
private readonly clampedIndex;
|
|
246
291
|
readonly activeStepId: Signal<string | null>;
|
|
292
|
+
/**
|
|
293
|
+
* {@inheritDoc CngxStepperHost.activeGroupId}
|
|
294
|
+
*
|
|
295
|
+
* Single derivation over `activeStepId` and `stepTree` - the root-level
|
|
296
|
+
* group whose subtree holds the active step, or `null` for a
|
|
297
|
+
* root-level active step (e.g. a trailing `Finish`). Walked once here;
|
|
298
|
+
* `CngxStepGroup.isCollapsed`, the strip `aria-expanded` binding, and
|
|
299
|
+
* `visibleStripNodes` read this rather than re-walking the tree.
|
|
300
|
+
*/
|
|
301
|
+
readonly activeGroupId: Signal<string | null>;
|
|
302
|
+
/**
|
|
303
|
+
* {@inheritDoc CngxStepperHost.visibleStripNodes}
|
|
304
|
+
*
|
|
305
|
+
* Flat strip projection honouring the focus-driven group-collapse
|
|
306
|
+
* policy. Under `'off'` it returns `flatSteps()` verbatim (same
|
|
307
|
+
* reference, so the `equal` short-circuits). Under `'expand-active'`
|
|
308
|
+
* every non-active root-level group's subtree is dropped, leaving the
|
|
309
|
+
* group header node alone - the active group and all root-level steps
|
|
310
|
+
* stay. Each retained node keeps its canonical `flatIndex` from
|
|
311
|
+
* `flatSteps`, so per-step state/announcement lookups are unaffected.
|
|
312
|
+
* Returns a fresh array, so it MUST carry `{ equal: flatStepsEqual }`
|
|
313
|
+
* or every re-emit cascades the strip `@for`.
|
|
314
|
+
*/
|
|
315
|
+
readonly visibleStripNodes: Signal<readonly CngxStepNode[]>;
|
|
247
316
|
readonly commitState: CngxAsyncState<number | undefined>;
|
|
248
317
|
/**
|
|
249
318
|
* Next enabled step-only index after the active one, skipping
|
|
@@ -297,6 +366,15 @@ declare class CngxStepperPresenter implements CngxStepperHost {
|
|
|
297
366
|
* affordance.
|
|
298
367
|
*/
|
|
299
368
|
private isLinearBlocked;
|
|
369
|
+
/**
|
|
370
|
+
* {@inheritDoc CngxStepperHost.canNavigateTo}
|
|
371
|
+
*
|
|
372
|
+
* Wraps the private {@link isLinearBlocked} predicate plus the
|
|
373
|
+
* per-step `disabled` check. The header-reachability contract surface;
|
|
374
|
+
* `isLinearBlocked` stays private so the organism reads this method,
|
|
375
|
+
* never the internal gate.
|
|
376
|
+
*/
|
|
377
|
+
canNavigateTo(index: number): boolean;
|
|
300
378
|
select(index: number): void;
|
|
301
379
|
selectNext(): void;
|
|
302
380
|
selectPrevious(): void;
|
|
@@ -422,7 +500,7 @@ declare function flatStepsEqual(a: readonly CngxStepNode[], b: readonly CngxStep
|
|
|
422
500
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-content.directive.ts
|
|
423
501
|
* @since 0.1.0
|
|
424
502
|
* @relatedTo CngxStep, CngxStepLabel
|
|
425
|
-
* <example-url>http://localhost:4200/#/ui/stepper/stepper-
|
|
503
|
+
* <example-url>http://localhost:4200/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>
|
|
426
504
|
*/
|
|
427
505
|
declare class CngxStepContent {
|
|
428
506
|
readonly templateRef: TemplateRef<CngxStepContentContext>;
|
|
@@ -469,7 +547,7 @@ declare class CngxStepLabel {
|
|
|
469
547
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step.directive.ts
|
|
470
548
|
* @since 0.1.0
|
|
471
549
|
* @relatedTo CngxStepGroup, CngxStepperPresenter, CngxStepLabel, CngxStepContent
|
|
472
|
-
* <example-url>http://localhost:4200/#/ui/stepper/stepper-
|
|
550
|
+
* <example-url>http://localhost:4200/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>
|
|
473
551
|
*/
|
|
474
552
|
declare class CngxStep {
|
|
475
553
|
readonly id: i0.InputSignal<string>;
|
|
@@ -477,6 +555,22 @@ declare class CngxStep {
|
|
|
477
555
|
readonly completed: i0.InputSignal<boolean>;
|
|
478
556
|
readonly label: i0.InputSignal<string>;
|
|
479
557
|
readonly errorAggregator: i0.InputSignal<CngxErrorAggregatorContract | undefined>;
|
|
558
|
+
/**
|
|
559
|
+
* Direct error flag for the common "this step is invalid" case - no
|
|
560
|
+
* `errorAggregator` boilerplate required. `true` or a non-empty string
|
|
561
|
+
* drives the error state; a string doubles as the inline message
|
|
562
|
+
* (surfaced via the `*cngxStepError` slot and the mini-skin aggregate
|
|
563
|
+
* line). `false` / `''` clear it. The aggregator stays the rich
|
|
564
|
+
* multi-source forms path; the two channels compose (either errors).
|
|
565
|
+
*/
|
|
566
|
+
readonly error: i0.InputSignal<string | boolean>;
|
|
567
|
+
/**
|
|
568
|
+
* Resolved direct-error message: the `[error]` string when non-empty,
|
|
569
|
+
* else `undefined`. Carried onto the registration / node so the error
|
|
570
|
+
* slot + aggregate line can render it. `computed` over the input -
|
|
571
|
+
* never written.
|
|
572
|
+
*/
|
|
573
|
+
readonly errorMessage: Signal<string | undefined>;
|
|
480
574
|
protected readonly labelSlot: Signal<CngxStepLabel | undefined>;
|
|
481
575
|
protected readonly contentSlot: Signal<CngxStepContent | undefined>;
|
|
482
576
|
readonly labelTemplate: Signal<CngxStepLabel | undefined>;
|
|
@@ -488,7 +582,7 @@ declare class CngxStep {
|
|
|
488
582
|
readonly state: Signal<CngxStepStatus>;
|
|
489
583
|
constructor();
|
|
490
584
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStep, never>;
|
|
491
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStep, "[cngxStep]", ["cngxStep"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "completed": { "alias": "completed"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; }, {}, ["labelSlot", "contentSlot"], never, true, never>;
|
|
585
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStep, "[cngxStep]", ["cngxStep"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "completed": { "alias": "completed"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; }, {}, ["labelSlot", "contentSlot"], never, true, never>;
|
|
492
586
|
}
|
|
493
587
|
|
|
494
588
|
/**
|
|
@@ -507,14 +601,31 @@ declare class CngxStep {
|
|
|
507
601
|
* @since 0.1.0
|
|
508
602
|
* @relatedTo CngxStep, CngxStepperPresenter, CngxStepGroupHeader
|
|
509
603
|
* <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/group-nested-steps-trailing-root-step</example-url>
|
|
604
|
+
* <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/expand-active-group-collapse</example-url>
|
|
605
|
+
* <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/group-collapse-summary-count</example-url>
|
|
510
606
|
*/
|
|
511
607
|
declare class CngxStepGroup implements CngxStepGroupHost {
|
|
512
608
|
readonly id: i0.InputSignal<string>;
|
|
513
609
|
readonly disabled: i0.InputSignal<boolean>;
|
|
514
610
|
readonly label: i0.InputSignal<string>;
|
|
611
|
+
private readonly config;
|
|
515
612
|
private readonly childRegistry;
|
|
516
613
|
readonly aggregatedStatus: Signal<CngxStepStatus>;
|
|
517
614
|
private readonly stepperHost;
|
|
615
|
+
/**
|
|
616
|
+
* `true` when this group's children are collapsed to the header node:
|
|
617
|
+
* the focus-driven policy is `'expand-active'`, this group does not
|
|
618
|
+
* hold the active step, and it has at least one child. Pure
|
|
619
|
+
* `computed()` over the host's `activeGroupId` + the resolved policy -
|
|
620
|
+
* never toggled in an event handler (Pillar 1).
|
|
621
|
+
*
|
|
622
|
+
* Consumer-readable via `exportAs: 'cngxStepGroup'` (e.g.
|
|
623
|
+
* `#g="cngxStepGroup"` then `g.isCollapsed()`). The rendered strip
|
|
624
|
+
* group header owns the reactive `aria-expanded` disclosure attribute
|
|
625
|
+
* (`<cngx-stepper>` `groupAriaExpanded`); the projected `[cngxStepGroup]`
|
|
626
|
+
* host element is not rendered in the strip, so it carries no ARIA.
|
|
627
|
+
*/
|
|
628
|
+
readonly isCollapsed: Signal<boolean>;
|
|
518
629
|
constructor();
|
|
519
630
|
register(handle: CngxStepRegistration): void;
|
|
520
631
|
unregister(id: string): void;
|
|
@@ -717,6 +828,65 @@ declare class CngxStepRejection {
|
|
|
717
828
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepRejection, "ng-template[cngxStepRejection]", ["cngxStepRejection"], {}, {}, never, never, true, never>;
|
|
718
829
|
}
|
|
719
830
|
|
|
831
|
+
/**
|
|
832
|
+
* Context passed to the `*cngxStepError` template. Renders the
|
|
833
|
+
* validation-error reason for a step in the error state - sibling of
|
|
834
|
+
* the commit-channel `*cngxStepRejection` slot. The two channels stay
|
|
835
|
+
* distinct: rejection decorates the step a commit rolled back FROM;
|
|
836
|
+
* this slot surfaces the per-step validation message.
|
|
837
|
+
*
|
|
838
|
+
* `message` resolves the direct `[error]` string > the first
|
|
839
|
+
* aggregator label > the i18n `errored` status phrase, so a template
|
|
840
|
+
* that renders `{{ message }}` always shows a non-empty reason.
|
|
841
|
+
* `errorLabels` / `announcement` expose the richer aggregator surface
|
|
842
|
+
* for consumers that want a list or the full SR phrase.
|
|
843
|
+
*
|
|
844
|
+
* @category common/stepper/slots
|
|
845
|
+
*/
|
|
846
|
+
interface CngxStepErrorContext {
|
|
847
|
+
/** The errored step node carrying id / label / state signals. */
|
|
848
|
+
readonly node: CngxStepNode;
|
|
849
|
+
/** Resolved error reason (direct `[error]` string > aggregator label > i18n). */
|
|
850
|
+
readonly message: string;
|
|
851
|
+
/** Aggregator error labels, or an empty array when none. */
|
|
852
|
+
readonly errorLabels: readonly string[];
|
|
853
|
+
/** Aggregator SR announcement phrase, or an empty string when none. */
|
|
854
|
+
readonly announcement: string;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Slot directive for the per-step error-message template on
|
|
858
|
+
* `<cngx-stepper>`. Discovered via `contentChild`; cascades through
|
|
859
|
+
* `CNGX_STEPPER_CONFIG.templates.stepError` before falling back to the
|
|
860
|
+
* built-in `{{ message }}` text. Mirrors {@link CngxStepRejection} so
|
|
861
|
+
* consumer-authored templates read the same way across both channels.
|
|
862
|
+
*
|
|
863
|
+
* ```html
|
|
864
|
+
* <cngx-stepper>
|
|
865
|
+
* <ng-template cngxStepError let-message="message" let-errorLabels="errorLabels">
|
|
866
|
+
* <strong>{{ message }}</strong>
|
|
867
|
+
* @if (errorLabels.length > 1) {
|
|
868
|
+
* <ul>
|
|
869
|
+
* @for (label of errorLabels; track label) {
|
|
870
|
+
* <li>{{ label }}</li>
|
|
871
|
+
* }
|
|
872
|
+
* </ul>
|
|
873
|
+
* }
|
|
874
|
+
* </ng-template>
|
|
875
|
+
* </cngx-stepper>
|
|
876
|
+
* ```
|
|
877
|
+
*
|
|
878
|
+
* @category common/stepper/slots
|
|
879
|
+
* @wcag AA
|
|
880
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-error.directive.ts
|
|
881
|
+
* @since 0.1.0
|
|
882
|
+
* @relatedTo CngxStepRejection, CngxStepBadge, CngxStep
|
|
883
|
+
*/
|
|
884
|
+
declare class CngxStepError {
|
|
885
|
+
readonly templateRef: TemplateRef<CngxStepErrorContext>;
|
|
886
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxStepError, never>;
|
|
887
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxStepError, "ng-template[cngxStepError]", ["cngxStepError"], {}, {}, never, never, true, never>;
|
|
888
|
+
}
|
|
889
|
+
|
|
720
890
|
/**
|
|
721
891
|
* Context passed to the `*cngxStepGroupHeader` template. Drives the
|
|
722
892
|
* group-row landmark for `kind === 'group'` nodes. The `role="group"`
|
|
@@ -847,7 +1017,6 @@ interface CngxDotStepperDotContext {
|
|
|
847
1017
|
* @since 0.1.0
|
|
848
1018
|
* @relatedTo CngxStepIndicator, CngxStepBadge, CngxStepBusySpinner, CngxStepRejection
|
|
849
1019
|
* <example-url>http://localhost:4200/#/ui/stepper/dot-stepper/icon-dots-via-code-cngxdotstepperdot-code</example-url>
|
|
850
|
-
* <example-url>http://localhost:4200/#/ui/stepper/dot-stepper/mobile-carousel</example-url>
|
|
851
1020
|
*/
|
|
852
1021
|
declare class CngxDotStepperDot {
|
|
853
1022
|
readonly templateRef: TemplateRef<CngxDotStepperDotContext>;
|
|
@@ -890,6 +1059,7 @@ interface CngxStepperTemplates {
|
|
|
890
1059
|
readonly badge?: TemplateRef<CngxStepBadgeContext>;
|
|
891
1060
|
readonly busySpinner?: TemplateRef<CngxStepBusySpinnerContext>;
|
|
892
1061
|
readonly rejection?: TemplateRef<CngxStepRejectionContext>;
|
|
1062
|
+
readonly stepError?: TemplateRef<CngxStepErrorContext>;
|
|
893
1063
|
readonly groupHeader?: TemplateRef<CngxStepGroupHeaderContext>;
|
|
894
1064
|
readonly empty?: TemplateRef<void>;
|
|
895
1065
|
readonly dotStepperDot?: TemplateRef<CngxDotStepperDotContext>;
|
|
@@ -913,6 +1083,63 @@ type CngxStepperSkin = 'classic' | 'linear-minimal' | 'stripe-status-rich' | 'pa
|
|
|
913
1083
|
* @category common/stepper
|
|
914
1084
|
*/
|
|
915
1085
|
type CngxStepperMobileCollapse = 'text' | 'dots' | 'off';
|
|
1086
|
+
/**
|
|
1087
|
+
* Header-navigation policy for `<cngx-stepper>`. `'none'` renders the
|
|
1088
|
+
* step headers as inert labels - the footer is the sole navigation
|
|
1089
|
+
* control. `'visited'` (default) keeps the headers as focusable
|
|
1090
|
+
* buttons; reachability folds into the `linear` axis (`linear=false`
|
|
1091
|
+
* is free click-through, `linear=true` is backward-to-visited only,
|
|
1092
|
+
* with linear-unreachable headers marked `aria-disabled`). There is no
|
|
1093
|
+
* discrete `'free'` value - `'free'` is `'visited'` + `linear=false`.
|
|
1094
|
+
*
|
|
1095
|
+
* @category common/stepper
|
|
1096
|
+
*/
|
|
1097
|
+
type CngxStepperHeaderNavigation = 'none' | 'visited';
|
|
1098
|
+
/**
|
|
1099
|
+
* Focus-driven group-collapse policy for grouped `<cngx-stepper>` flows.
|
|
1100
|
+
* `'expand-active'` collapses every non-active `cngxStepGroup` branch to
|
|
1101
|
+
* its header node and expands only the group holding the active step;
|
|
1102
|
+
* `'off'` (default) keeps every group's children rendered in the strip -
|
|
1103
|
+
* the browser-native baseline. Orthogonal to the `mobileCollapse` axis;
|
|
1104
|
+
* the two never edit each other. The Material twin (`[cngxMatStepper]`)
|
|
1105
|
+
* ignores this setting.
|
|
1106
|
+
*
|
|
1107
|
+
* @category common/stepper
|
|
1108
|
+
*/
|
|
1109
|
+
type CngxStepperGroupCollapse = 'expand-active' | 'off';
|
|
1110
|
+
/**
|
|
1111
|
+
* What a collapsed `cngxStepGroup` header shows next to its label under
|
|
1112
|
+
* `groupCollapse: 'expand-active'`. `'progress'` (default) shows
|
|
1113
|
+
* completed/total steps; `'count'` shows the step count; `'status'`
|
|
1114
|
+
* shows a status dot coloured by the group's rolled-up state; `'off'`
|
|
1115
|
+
* shows the bare label. Only ever rendered on a collapsed group header.
|
|
1116
|
+
*
|
|
1117
|
+
* @category common/stepper
|
|
1118
|
+
*/
|
|
1119
|
+
type CngxStepperGroupSummary = 'progress' | 'count' | 'status' | 'off';
|
|
1120
|
+
/**
|
|
1121
|
+
* Space-driven density policy for the classic `<cngx-stepper>` strip.
|
|
1122
|
+
* `'auto'` degrades the strip on its own container width
|
|
1123
|
+
* (full labels -> ellipsis-truncated -> indicators-only with the active
|
|
1124
|
+
* label kept); `'comfortable'` (default) keeps full labels at every
|
|
1125
|
+
* width. Orthogonal to `mobileCollapse` and `groupCollapse`; the
|
|
1126
|
+
* Material twin ignores this setting.
|
|
1127
|
+
*
|
|
1128
|
+
* @category common/stepper
|
|
1129
|
+
*/
|
|
1130
|
+
type CngxStepperDensity = 'comfortable' | 'auto';
|
|
1131
|
+
/**
|
|
1132
|
+
* Per-step px thresholds the `density: 'auto'` ladder reacts to.
|
|
1133
|
+
* `compact` is the minimum px per step that keeps full labels; below
|
|
1134
|
+
* `minimal` px per step the strip drops to indicators-only. `compact`
|
|
1135
|
+
* must exceed `minimal`.
|
|
1136
|
+
*
|
|
1137
|
+
* @category common/stepper
|
|
1138
|
+
*/
|
|
1139
|
+
interface CngxStepperDensityBreakpoints {
|
|
1140
|
+
readonly compact: number;
|
|
1141
|
+
readonly minimal: number;
|
|
1142
|
+
}
|
|
916
1143
|
/**
|
|
917
1144
|
* Where the mobile auto-collapse indicator (text caption or dot row)
|
|
918
1145
|
* sits relative to the active step's panel content under narrow
|
|
@@ -933,6 +1160,15 @@ type CngxStepperMobileIndicatorPosition = 'top' | 'bottom';
|
|
|
933
1160
|
* @category common/stepper
|
|
934
1161
|
*/
|
|
935
1162
|
declare const STEPPER_DEFAULT_MOBILE_BREAKPOINT = "(max-width: 480px)";
|
|
1163
|
+
/**
|
|
1164
|
+
* Default per-step px thresholds for the `density: 'auto'` ladder. The
|
|
1165
|
+
* literal lives on a single exported const so the runtime resolver, the
|
|
1166
|
+
* config default, and any JSDoc cross-references stay in lockstep.
|
|
1167
|
+
* Consumers override via {@link withStepperDensity}'s second argument.
|
|
1168
|
+
*
|
|
1169
|
+
* @category common/stepper
|
|
1170
|
+
*/
|
|
1171
|
+
declare const STEPPER_DEFAULT_DENSITY_BREAKPOINTS: CngxStepperDensityBreakpoints;
|
|
936
1172
|
/**
|
|
937
1173
|
* Stepper config surface. Resolution priority: per-instance Input
|
|
938
1174
|
* > `provideStepperConfigAt` (viewProviders) > `provideStepperConfig`
|
|
@@ -947,6 +1183,41 @@ interface CngxStepperConfig {
|
|
|
947
1183
|
readonly routerSyncMode?: 'fragment' | 'queryParam';
|
|
948
1184
|
readonly routerSyncParam?: string;
|
|
949
1185
|
readonly skin?: CngxStepperSkin;
|
|
1186
|
+
/**
|
|
1187
|
+
* Header-navigation policy. `'none'` makes the step headers inert
|
|
1188
|
+
* labels (footer-only navigation); `'visited'` (default) keeps them
|
|
1189
|
+
* focusable buttons whose reachability folds into the `linear` axis.
|
|
1190
|
+
* Per-instance `[headerNavigation]` Input still wins.
|
|
1191
|
+
*/
|
|
1192
|
+
readonly headerNavigation?: CngxStepperHeaderNavigation;
|
|
1193
|
+
/**
|
|
1194
|
+
* Focus-driven group-collapse policy. `'expand-active'` collapses
|
|
1195
|
+
* non-active `cngxStepGroup` branches to their header node and expands
|
|
1196
|
+
* only the active group; `'off'` (default) keeps the full strip.
|
|
1197
|
+
* Orthogonal to `mobileCollapse`. Apply app-wide via
|
|
1198
|
+
* {@link withStepperGroupCollapse}.
|
|
1199
|
+
*/
|
|
1200
|
+
readonly groupCollapse?: CngxStepperGroupCollapse;
|
|
1201
|
+
/**
|
|
1202
|
+
* What a collapsed `cngxStepGroup` header shows beside its label.
|
|
1203
|
+
* Default `'progress'` (completed/total). Only applies when
|
|
1204
|
+
* `groupCollapse` is `'expand-active'`. Set via
|
|
1205
|
+
* {@link withStepperGroupCollapseSummary}.
|
|
1206
|
+
*/
|
|
1207
|
+
readonly groupCollapseSummary?: CngxStepperGroupSummary;
|
|
1208
|
+
/**
|
|
1209
|
+
* Space-driven density policy for the classic strip. `'auto'`
|
|
1210
|
+
* degrades labels on the strip's own container width; `'comfortable'`
|
|
1211
|
+
* (default) keeps full labels. Orthogonal to `mobileCollapse`. Apply
|
|
1212
|
+
* app-wide via {@link withStepperDensity}.
|
|
1213
|
+
*/
|
|
1214
|
+
readonly density?: CngxStepperDensity;
|
|
1215
|
+
/**
|
|
1216
|
+
* Per-step px thresholds for the `density: 'auto'` ladder. Default
|
|
1217
|
+
* {@link STEPPER_DEFAULT_DENSITY_BREAKPOINTS}. Override via
|
|
1218
|
+
* {@link withStepperDensity}'s second argument.
|
|
1219
|
+
*/
|
|
1220
|
+
readonly densityBreakpoints?: CngxStepperDensityBreakpoints;
|
|
950
1221
|
/**
|
|
951
1222
|
* Opt-in connector rail between adjacent step indicators on the
|
|
952
1223
|
* classic skin. Off by default. The rule is double-scoped on
|
|
@@ -1094,6 +1365,49 @@ declare function withStepperMobileIndicatorPosition(position: CngxStepperMobileI
|
|
|
1094
1365
|
* @category common/stepper
|
|
1095
1366
|
*/
|
|
1096
1367
|
declare function withStepperMobileSwipe(enabled: boolean): CngxStepperConfigFeature;
|
|
1368
|
+
/**
|
|
1369
|
+
* Set the app-wide default header-navigation policy for
|
|
1370
|
+
* `<cngx-stepper>`. `'none'` renders inert label headers (footer-only
|
|
1371
|
+
* navigation); `'visited'` (library default) keeps the headers as
|
|
1372
|
+
* focusable buttons whose reachability folds into the `linear` axis.
|
|
1373
|
+
* Per-instance `[headerNavigation]` Input still wins.
|
|
1374
|
+
*
|
|
1375
|
+
* @category common/stepper
|
|
1376
|
+
*/
|
|
1377
|
+
declare function withStepperHeaderNavigation(mode: CngxStepperHeaderNavigation): CngxStepperConfigFeature;
|
|
1378
|
+
/**
|
|
1379
|
+
* Set the app-wide focus-driven group-collapse policy for grouped
|
|
1380
|
+
* `<cngx-stepper>` flows. `'expand-active'` collapses every non-active
|
|
1381
|
+
* `cngxStepGroup` branch to its header node and expands only the group
|
|
1382
|
+
* holding the active step; `'off'` (library default) keeps the full
|
|
1383
|
+
* strip. Orthogonal to the `mobileCollapse` axis. The Material twin
|
|
1384
|
+
* ignores this setting.
|
|
1385
|
+
*
|
|
1386
|
+
* @category common/stepper
|
|
1387
|
+
*/
|
|
1388
|
+
declare function withStepperGroupCollapse(mode: CngxStepperGroupCollapse): CngxStepperConfigFeature;
|
|
1389
|
+
/**
|
|
1390
|
+
* Choose what a collapsed `cngxStepGroup` header shows beside its label
|
|
1391
|
+
* under `groupCollapse: 'expand-active'`. `'progress'` (library default)
|
|
1392
|
+
* shows completed/total steps; `'count'` the step count; `'status'` a
|
|
1393
|
+
* status dot coloured by the group's rolled-up state; `'off'` the bare
|
|
1394
|
+
* label. No effect unless `groupCollapse` is `'expand-active'`.
|
|
1395
|
+
*
|
|
1396
|
+
* @category common/stepper
|
|
1397
|
+
*/
|
|
1398
|
+
declare function withStepperGroupCollapseSummary(mode: CngxStepperGroupSummary): CngxStepperConfigFeature;
|
|
1399
|
+
/**
|
|
1400
|
+
* Set the app-wide space-driven density policy for the classic
|
|
1401
|
+
* `<cngx-stepper>` strip. `'auto'` degrades labels on the strip's own
|
|
1402
|
+
* container width (full -> compact -> minimal); `'comfortable'`
|
|
1403
|
+
* (library default) keeps full labels at every width. The optional
|
|
1404
|
+
* second argument overrides the per-step px thresholds (default
|
|
1405
|
+
* {@link STEPPER_DEFAULT_DENSITY_BREAKPOINTS}). Orthogonal to the
|
|
1406
|
+
* `mobileCollapse` axis; the Material twin ignores this setting.
|
|
1407
|
+
*
|
|
1408
|
+
* @category common/stepper
|
|
1409
|
+
*/
|
|
1410
|
+
declare function withStepperDensity(mode: CngxStepperDensity, breakpoints?: CngxStepperDensityBreakpoints): CngxStepperConfigFeature;
|
|
1097
1411
|
/**
|
|
1098
1412
|
* Merge ARIA labels into the cascade. Keys not provided keep their
|
|
1099
1413
|
* library defaults; per-instance overrides on the stepper still win.
|
|
@@ -1135,6 +1449,15 @@ declare function withStepBusySpinnerTemplate(template: TemplateRef<CngxStepBusyS
|
|
|
1135
1449
|
* @category common/stepper
|
|
1136
1450
|
*/
|
|
1137
1451
|
declare function withStepRejectionTemplate(template: TemplateRef<CngxStepRejectionContext>): CngxStepperConfigFeature;
|
|
1452
|
+
/**
|
|
1453
|
+
* Override the default `*cngxStepError` template app-wide. The slot
|
|
1454
|
+
* renders the per-step validation reason on the skins with a label area
|
|
1455
|
+
* (classic / stripe-status-rich). Per-instance directive still wins;
|
|
1456
|
+
* this moves the cascade middle tier.
|
|
1457
|
+
*
|
|
1458
|
+
* @category common/stepper
|
|
1459
|
+
*/
|
|
1460
|
+
declare function withStepErrorTemplate(template: TemplateRef<CngxStepErrorContext>): CngxStepperConfigFeature;
|
|
1138
1461
|
/**
|
|
1139
1462
|
* Override the default `*cngxStepGroupHeader` template app-wide.
|
|
1140
1463
|
*
|
|
@@ -1191,7 +1514,7 @@ declare function injectStepperConfig(): CngxStepperConfig;
|
|
|
1191
1514
|
|
|
1192
1515
|
/**
|
|
1193
1516
|
* Inputs to {@link createStepperTemplateBindings}. The organism owns
|
|
1194
|
-
* the `contentChild()` queries (NG8110
|
|
1517
|
+
* the `contentChild()` queries (NG8110 - must run in component
|
|
1195
1518
|
* injection context) and the resolved {@link CngxStepperConfig}; this
|
|
1196
1519
|
* factory absorbs the 3-stage cascade per slot key.
|
|
1197
1520
|
*
|
|
@@ -1202,13 +1525,15 @@ interface CngxStepperTemplateBindingsOptions {
|
|
|
1202
1525
|
readonly badgeSlot: Signal<CngxStepBadge | undefined>;
|
|
1203
1526
|
readonly busySpinnerSlot: Signal<CngxStepBusySpinner | undefined>;
|
|
1204
1527
|
readonly rejectionSlot: Signal<CngxStepRejection | undefined>;
|
|
1528
|
+
/** Optional - the error slot is desktop-label-area only; absent on variants that have no label region. */
|
|
1529
|
+
readonly errorSlot?: Signal<CngxStepError | undefined>;
|
|
1205
1530
|
readonly groupHeaderSlot: Signal<CngxStepGroupHeader | undefined>;
|
|
1206
1531
|
readonly emptySlot: Signal<CngxStepperEmpty | undefined>;
|
|
1207
1532
|
readonly config: CngxStepperConfig;
|
|
1208
1533
|
}
|
|
1209
1534
|
/**
|
|
1210
1535
|
* Output of {@link createStepperTemplateBindings}. One resolved
|
|
1211
|
-
* `Signal<TemplateRef | null>` per slot
|
|
1536
|
+
* `Signal<TemplateRef | null>` per slot - `null` falls through to the
|
|
1212
1537
|
* organism's built-in default markup.
|
|
1213
1538
|
*
|
|
1214
1539
|
* @category common/stepper/slots
|
|
@@ -1218,19 +1543,20 @@ interface CngxStepperTemplateBindings {
|
|
|
1218
1543
|
readonly badge: Signal<TemplateRef<CngxStepBadgeContext> | null>;
|
|
1219
1544
|
readonly busySpinner: Signal<TemplateRef<CngxStepBusySpinnerContext> | null>;
|
|
1220
1545
|
readonly rejection: Signal<TemplateRef<CngxStepRejectionContext> | null>;
|
|
1546
|
+
readonly stepError: Signal<TemplateRef<CngxStepErrorContext> | null>;
|
|
1221
1547
|
readonly groupHeader: Signal<TemplateRef<CngxStepGroupHeaderContext> | null>;
|
|
1222
1548
|
readonly empty: Signal<TemplateRef<void> | null>;
|
|
1223
1549
|
}
|
|
1224
1550
|
/**
|
|
1225
|
-
* Wires the 3-stage template cascade for the
|
|
1226
|
-
*
|
|
1551
|
+
* Wires the 3-stage template cascade for the `<cngx-stepper>` skin
|
|
1552
|
+
* slots: per-instance directive > `CNGX_STEPPER_CONFIG.templates.<key>`
|
|
1227
1553
|
* > `null` (built-in default).
|
|
1228
1554
|
*
|
|
1229
|
-
* Pure
|
|
1555
|
+
* Pure - no DI, no side effects. Safe to call from a field-init
|
|
1230
1556
|
* block. Sibling of `createTabOverflowTemplateBindings` and the
|
|
1231
1557
|
* family-wide `createTemplateRegistry`.
|
|
1232
1558
|
*
|
|
1233
|
-
* Tabs has no parallel slot surface yet
|
|
1559
|
+
* Tabs has no parallel slot surface yet - see
|
|
1234
1560
|
* `stepper-accepted-debt §3` for the planned Phase-4 closure.
|
|
1235
1561
|
*
|
|
1236
1562
|
* @category common/stepper/slots
|
|
@@ -1478,6 +1804,162 @@ declare function createMobileViewportSignal(mediaQuery: string, destroyRef: Dest
|
|
|
1478
1804
|
*/
|
|
1479
1805
|
declare function createStepperDisplayMode(mediaQuery: string, mobileCollapse: () => CngxStepperMobileCollapse | undefined, destroyRef: DestroyRef): Signal<'classic' | 'text' | 'dots'>;
|
|
1480
1806
|
|
|
1807
|
+
/**
|
|
1808
|
+
* Resolved density rung for the classic `<cngx-stepper>` strip.
|
|
1809
|
+
* `'full'` shows every label; `'compact'` ellipsis-truncates labels;
|
|
1810
|
+
* `'minimal'` drops to indicators-only (the active step keeps its
|
|
1811
|
+
* label). Orthogonal to the `mobileCollapse` display-mode union.
|
|
1812
|
+
*
|
|
1813
|
+
* @category common/stepper
|
|
1814
|
+
*/
|
|
1815
|
+
type CngxStripDensity = 'full' | 'compact' | 'minimal';
|
|
1816
|
+
/**
|
|
1817
|
+
* Options for {@link createStripDensity}.
|
|
1818
|
+
*
|
|
1819
|
+
* @internal
|
|
1820
|
+
*/
|
|
1821
|
+
interface CngxStripDensityOptions {
|
|
1822
|
+
/** Strip container element whose width drives the density rung. */
|
|
1823
|
+
readonly element: HTMLElement;
|
|
1824
|
+
/** Current step-only count - the width budget is split across these. */
|
|
1825
|
+
readonly stepCount: () => number;
|
|
1826
|
+
/**
|
|
1827
|
+
* Resolved density policy. Only `'auto'` degrades; `'comfortable'`
|
|
1828
|
+
* (or `undefined`) short-circuits to `'full'`, preserving today's
|
|
1829
|
+
* behaviour.
|
|
1830
|
+
*/
|
|
1831
|
+
readonly density: () => 'comfortable' | 'auto' | undefined;
|
|
1832
|
+
/**
|
|
1833
|
+
* Per-step width thresholds in px. At or above `compact` px per step
|
|
1834
|
+
* the strip stays `'full'`; at or above `minimal` it is `'compact'`;
|
|
1835
|
+
* below `minimal` it is `'minimal'`. `compact` must exceed `minimal`.
|
|
1836
|
+
*/
|
|
1837
|
+
readonly breakpoints: () => {
|
|
1838
|
+
readonly compact: number;
|
|
1839
|
+
readonly minimal: number;
|
|
1840
|
+
};
|
|
1841
|
+
readonly destroyRef: DestroyRef;
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Resolves the classic strip's density rung from its own container
|
|
1845
|
+
* width against the step count and two per-step px thresholds. Pure
|
|
1846
|
+
* `create*` factory, sibling to `createStepperDisplayMode` - it owns a
|
|
1847
|
+
* `ResizeObserver` the way the display-mode factory owns a
|
|
1848
|
+
* `matchMedia` listener, and returns a single derived `Signal`.
|
|
1849
|
+
*
|
|
1850
|
+
* `'comfortable'` density short-circuits to `'full'` (no measurement
|
|
1851
|
+
* dependency). Before the first measurement (`width === 0`) and for an
|
|
1852
|
+
* empty strip the rung is `'full'`, so the strip never flashes
|
|
1853
|
+
* `'minimal'` on mount.
|
|
1854
|
+
*
|
|
1855
|
+
* @category common/stepper
|
|
1856
|
+
*/
|
|
1857
|
+
declare function createStripDensity(options: CngxStripDensityOptions): Signal<CngxStripDensity>;
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* Collapsed-group summary view consumed by `<cngx-stepper>`. Resolves
|
|
1861
|
+
* the `groupCollapseSummary` mode and the per-group `progress` / `count`
|
|
1862
|
+
* text, the `status`-dot gate, and the SR phrase. Pure derivation over
|
|
1863
|
+
* the group's subtree step states; rendered only on collapsed groups.
|
|
1864
|
+
*
|
|
1865
|
+
* @category common/stepper
|
|
1866
|
+
*/
|
|
1867
|
+
interface CngxStepperGroupSummaryView {
|
|
1868
|
+
/** Resolved summary mode (config cascade, default `'progress'`). */
|
|
1869
|
+
readonly mode: Signal<CngxStepperGroupSummary>;
|
|
1870
|
+
/** Visible badge text for `progress`/`count`, else `null`. */
|
|
1871
|
+
text(node: CngxStepNode): string | null;
|
|
1872
|
+
/** `true` when a status dot should render (mode `status`, group collapsed). */
|
|
1873
|
+
showStatus(node: CngxStepNode): boolean;
|
|
1874
|
+
/** Screen-reader phrase for `progress`/`count`, else `null`. */
|
|
1875
|
+
srText(node: CngxStepNode): string | null;
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Options for {@link createStepperGroupSummary}.
|
|
1879
|
+
*
|
|
1880
|
+
* @internal
|
|
1881
|
+
*/
|
|
1882
|
+
interface CngxStepperGroupSummaryOptions {
|
|
1883
|
+
/** Raw `groupCollapseSummary` config value (may be undefined). */
|
|
1884
|
+
readonly summaryMode: () => CngxStepperGroupSummary | undefined;
|
|
1885
|
+
/** Whether a given group node is currently collapsed. */
|
|
1886
|
+
readonly isCollapsed: (node: CngxStepNode) => boolean;
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Builds the collapsed-group summary view. Level-2 helper so the
|
|
1890
|
+
* organism stays a thin renderer. `status` mode defers its SR phrasing
|
|
1891
|
+
* to the group's existing status-phrase span, so {@link srText} returns
|
|
1892
|
+
* `null` there. English defaults (locale via the i18n cascade is a
|
|
1893
|
+
* follow-up).
|
|
1894
|
+
*
|
|
1895
|
+
* @category common/stepper
|
|
1896
|
+
*/
|
|
1897
|
+
declare function createStepperGroupSummary(options: CngxStepperGroupSummaryOptions): CngxStepperGroupSummaryView;
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* Collapsed-group pointer-navigation view consumed by `<cngx-stepper>`
|
|
1901
|
+
* under `groupCollapse: 'expand-active'`. A folded group header becomes a
|
|
1902
|
+
* click shortcut into its branch: activating it selects the group's first
|
|
1903
|
+
* navigable step, which then becomes the active group and expands as a
|
|
1904
|
+
* consequence (no in-place disclosure). Keyboard users reach the same
|
|
1905
|
+
* steps via the arrow-key contract, which already steps into a collapsed
|
|
1906
|
+
* group, so this is a supplementary pointer affordance.
|
|
1907
|
+
*
|
|
1908
|
+
* @category common/stepper
|
|
1909
|
+
*/
|
|
1910
|
+
interface CngxStepperGroupNavigationView {
|
|
1911
|
+
/**
|
|
1912
|
+
* `true` when a collapsed group header offers a click shortcut: header
|
|
1913
|
+
* navigation is on, the group is folded, and at least one descendant
|
|
1914
|
+
* step is navigable right now. The expanded (active) group header is
|
|
1915
|
+
* never navigable - its steps are already on screen and clickable.
|
|
1916
|
+
*/
|
|
1917
|
+
isNavigable(node: CngxStepNode): boolean;
|
|
1918
|
+
/**
|
|
1919
|
+
* Selects the group's first navigable step. No-op for an expanded
|
|
1920
|
+
* header, a navigation-off header, or a group with no reachable step.
|
|
1921
|
+
*/
|
|
1922
|
+
select(node: CngxStepNode): void;
|
|
1923
|
+
/**
|
|
1924
|
+
* `true` when the group owns the active step (`activeGroupId`). Drives
|
|
1925
|
+
* the active-branch chip treatment on the header, independent of
|
|
1926
|
+
* `groupCollapse`, so the branch in focus reads distinctly even when
|
|
1927
|
+
* every group stays expanded.
|
|
1928
|
+
*/
|
|
1929
|
+
isActive(node: CngxStepNode): boolean;
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Options for {@link createStepperGroupNavigation}.
|
|
1933
|
+
*
|
|
1934
|
+
* @internal
|
|
1935
|
+
*/
|
|
1936
|
+
interface CngxStepperGroupNavigationOptions {
|
|
1937
|
+
/**
|
|
1938
|
+
* Host slice owning the flat projection (`flatSteps`, DFS order with
|
|
1939
|
+
* live `flatIndex`), the reachability predicate (`canNavigateTo`), the
|
|
1940
|
+
* commit-in-flight gate (`busy`), and the selection method (`select`).
|
|
1941
|
+
*/
|
|
1942
|
+
readonly presenter: Pick<CngxStepperHost, 'flatSteps' | 'canNavigateTo' | 'busy' | 'select' | 'activeGroupId'>;
|
|
1943
|
+
/** Whether a given group node is currently folded. */
|
|
1944
|
+
readonly isCollapsed: (node: CngxStepNode) => boolean;
|
|
1945
|
+
/** `false` when `headerNavigation: 'none'` keeps every header inert. */
|
|
1946
|
+
readonly navigationEnabled: () => boolean;
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Builds the collapsed-group pointer-navigation view. Level-2 helper so
|
|
1950
|
+
* the organism stays a thin renderer.
|
|
1951
|
+
*
|
|
1952
|
+
* Indices resolve against `flatSteps` (DFS order, live `flatIndex`) rather
|
|
1953
|
+
* than `group.children` - the flattener spreads group nodes but leaves
|
|
1954
|
+
* their `children` as the tree projection where every step still carries
|
|
1955
|
+
* the seeded `-1`. Each candidate is gated by `canNavigateTo` + `busy`
|
|
1956
|
+
* (mirroring the step-header reachability), so a linear-blocked leading
|
|
1957
|
+
* step is skipped to the first reachable one.
|
|
1958
|
+
*
|
|
1959
|
+
* @category common/stepper
|
|
1960
|
+
*/
|
|
1961
|
+
declare function createStepperGroupNavigation(options: CngxStepperGroupNavigationOptions): CngxStepperGroupNavigationView;
|
|
1962
|
+
|
|
1481
1963
|
/**
|
|
1482
1964
|
* Input bundle for {@link createStepperHostAttrs}: the three per-instance
|
|
1483
1965
|
* inputs (each `Signal<T | undefined>`) and the resolved config (read
|
|
@@ -1543,6 +2025,22 @@ interface CngxStepperStripKeyboardNavOptions {
|
|
|
1543
2025
|
* through untouched.
|
|
1544
2026
|
*/
|
|
1545
2027
|
readonly stepClassName?: string;
|
|
2028
|
+
/**
|
|
2029
|
+
* Optional gate - when supplied and returning `false`, the handler is
|
|
2030
|
+
* a complete no-op. Used to switch arrow-key navigation off in the
|
|
2031
|
+
* `headerNavigation: 'none'` mode, where the step headers are inert
|
|
2032
|
+
* labels rather than focusable buttons. Omitted defaults to enabled.
|
|
2033
|
+
*/
|
|
2034
|
+
readonly enabled?: () => boolean;
|
|
2035
|
+
/**
|
|
2036
|
+
* Injector used to defer the post-move focus to `afterNextRender`.
|
|
2037
|
+
* Required when the strip can re-render its node set on navigation
|
|
2038
|
+
* (focus-driven group collapse: crossing a group boundary removes the
|
|
2039
|
+
* old button and adds the target's), so the focus lands after the new
|
|
2040
|
+
* DOM exists. Omitted, focus falls back to a `queueMicrotask` defer -
|
|
2041
|
+
* correct for a static strip where every button is always present.
|
|
2042
|
+
*/
|
|
2043
|
+
readonly injector?: Injector;
|
|
1546
2044
|
}
|
|
1547
2045
|
/**
|
|
1548
2046
|
* Builds the WAI-ARIA APG arrow-key handler for a stepper strip. The
|
|
@@ -1560,6 +2058,90 @@ interface CngxStepperStripKeyboardNavOptions {
|
|
|
1560
2058
|
*/
|
|
1561
2059
|
declare function createStepperStripKeyboardNav(options: CngxStepperStripKeyboardNavOptions): (event: KeyboardEvent) => void;
|
|
1562
2060
|
|
|
2061
|
+
/**
|
|
2062
|
+
* Per-step + aggregate state derivations shared by every stepper skin.
|
|
2063
|
+
*
|
|
2064
|
+
* The classic organism historically derived "is this step errored / busy /
|
|
2065
|
+
* rejected" inline in {@link createStepperSlotContextBuilders}; the dot,
|
|
2066
|
+
* text, and progress-bar variants derived nothing, so a step error (per-step
|
|
2067
|
+
* `state`, an error aggregator, or a commit rejection) was structurally
|
|
2068
|
+
* invisible in those three. This view is the single source those four skins
|
|
2069
|
+
* read from - "Ableitung statt Verwaltung" - so the error contract can never
|
|
2070
|
+
* drift between them.
|
|
2071
|
+
*
|
|
2072
|
+
* @internal
|
|
2073
|
+
*/
|
|
2074
|
+
interface CngxStepperStateView {
|
|
2075
|
+
/** Raw step status. Group nodes still report their own `state()`. */
|
|
2076
|
+
readonly statusOf: (node: CngxStepNode) => CngxStepStatus;
|
|
2077
|
+
/**
|
|
2078
|
+
* `true` while a commit is in flight AND targets this step. Mirrors the
|
|
2079
|
+
* classic `isStepBusy` predicate.
|
|
2080
|
+
*/
|
|
2081
|
+
readonly isBusy: (node: CngxStepNode) => boolean;
|
|
2082
|
+
/**
|
|
2083
|
+
* `true` when this step is the one a commit just rejected
|
|
2084
|
+
* (`flatIndex === lastFailedIndex`). The commit-rejection arm your
|
|
2085
|
+
* pessimistic / optimistic flows hit.
|
|
2086
|
+
*/
|
|
2087
|
+
readonly isRejected: (node: CngxStepNode) => boolean;
|
|
2088
|
+
/**
|
|
2089
|
+
* Badge-level error: per-step `state === 'error'` OR the bound error
|
|
2090
|
+
* aggregator's `shouldShow()`. Deliberately excludes commit rejection -
|
|
2091
|
+
* the classic skin renders rejection through its own dedicated slot, so
|
|
2092
|
+
* folding it in here would double-render the icon.
|
|
2093
|
+
*/
|
|
2094
|
+
readonly hasErrorBadge: (node: CngxStepNode) => boolean;
|
|
2095
|
+
/**
|
|
2096
|
+
* Unified error predicate - the contract the minimal skins (dot / text /
|
|
2097
|
+
* progress-bar) read. `true` when ANY of the three error sources fires:
|
|
2098
|
+
* {@link hasErrorBadge} OR a commit rejection ({@link isRejected}). Those
|
|
2099
|
+
* skins have no separate rejection slot, so they treat every error source
|
|
2100
|
+
* as one "errored" state.
|
|
2101
|
+
*/
|
|
2102
|
+
readonly hasError: (node: CngxStepNode) => boolean;
|
|
2103
|
+
/** Count of step-only nodes where {@link hasError} is `true`. */
|
|
2104
|
+
readonly errorCount: Signal<number>;
|
|
2105
|
+
/** Flat index of the first errored step, or `-1` when none. */
|
|
2106
|
+
readonly firstErrorIndex: Signal<number>;
|
|
2107
|
+
/** `true` when `errorCount() > 0`. Drives skin-level `aria-invalid`. */
|
|
2108
|
+
readonly hasAnyError: Signal<boolean>;
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Build the shared {@link CngxStepperStateView} over a presenter host and its
|
|
2112
|
+
* step-only projection. Pure factory - `computed()` only, no injection
|
|
2113
|
+
* context required, so any skin can allocate it in a field initializer.
|
|
2114
|
+
*
|
|
2115
|
+
* @category common/stepper
|
|
2116
|
+
* @since 0.1.0
|
|
2117
|
+
* @relatedTo CngxStepperHost, createStepperSlotContextBuilders
|
|
2118
|
+
*/
|
|
2119
|
+
declare function createStepperStateView(inputs: {
|
|
2120
|
+
presenter: CngxStepperHost;
|
|
2121
|
+
stepsOnly: Signal<readonly CngxStepNode[]>;
|
|
2122
|
+
}): CngxStepperStateView;
|
|
2123
|
+
/**
|
|
2124
|
+
* Aggregate error phrase shared by the minimal skins (text / progress-bar)
|
|
2125
|
+
* and the classic mobile-collapse text branch. A single errored step names
|
|
2126
|
+
* itself (`"Payment: Errored"`); several collapse to the i18n count phrase
|
|
2127
|
+
* (`"2 errors"`). Returns `''` when no step errored - callers gate on
|
|
2128
|
+
* `view.hasAnyError()` so the empty string never reaches the DOM.
|
|
2129
|
+
*
|
|
2130
|
+
* The optional `messageOf` resolver lets callers surface a per-step
|
|
2131
|
+
* reason (a direct `[error]` string or the first aggregator label) in the
|
|
2132
|
+
* single-error case instead of the generic `errored` status word. When
|
|
2133
|
+
* omitted - or when it returns `undefined`/`''` - the helper produces
|
|
2134
|
+
* byte-identical output to the no-resolver form, so existing callers
|
|
2135
|
+
* (the classic mobile-collapse summary) are a guaranteed no-op.
|
|
2136
|
+
*
|
|
2137
|
+
* Pure helper - reads signals at call time, intended to be wrapped in the
|
|
2138
|
+
* caller's `computed()`.
|
|
2139
|
+
*
|
|
2140
|
+
* @category common/stepper
|
|
2141
|
+
* @since 0.1.0
|
|
2142
|
+
*/
|
|
2143
|
+
declare function resolveStepperErrorSummary(view: Pick<CngxStepperStateView, 'errorCount' | 'firstErrorIndex'>, stepsOnly: Signal<readonly CngxStepNode[]>, i18n: CngxStepperI18n, messageOf?: (node: CngxStepNode) => string | undefined): string;
|
|
2144
|
+
|
|
1563
2145
|
/**
|
|
1564
2146
|
* Input bundle for {@link createStepperSlotContextBuilders}: the presenter
|
|
1565
2147
|
* surface and the step-only flat projection. Builders read both reactively
|
|
@@ -1570,6 +2152,8 @@ declare function createStepperStripKeyboardNav(options: CngxStepperStripKeyboard
|
|
|
1570
2152
|
interface CngxStepperSlotContextBuildersInputs {
|
|
1571
2153
|
readonly presenter: CngxStepperHost;
|
|
1572
2154
|
readonly stepsOnly: Signal<readonly CngxStepNode[]>;
|
|
2155
|
+
/** i18n bundle - supplies the `errored` status label as the message fallback. */
|
|
2156
|
+
readonly i18n: CngxStepperI18n;
|
|
1573
2157
|
}
|
|
1574
2158
|
/**
|
|
1575
2159
|
* Per-step status / activity / rejection / labelling derivations shared by
|
|
@@ -1583,19 +2167,22 @@ interface CngxStepperSlotContextBuilders {
|
|
|
1583
2167
|
readonly isStepBusy: (node: CngxStepNode) => boolean;
|
|
1584
2168
|
readonly showRejection: (node: CngxStepNode) => boolean;
|
|
1585
2169
|
readonly showErrorBadge: (node: CngxStepNode) => boolean;
|
|
2170
|
+
/** Validation-channel error gate - mirrors the error badge, independent of commit rejection. */
|
|
2171
|
+
readonly showStepError: (node: CngxStepNode) => boolean;
|
|
1586
2172
|
readonly indicatorContextFor: (node: CngxStepNode) => CngxStepIndicatorContext;
|
|
1587
2173
|
readonly badgeContextFor: (node: CngxStepNode) => CngxStepBadgeContext;
|
|
1588
2174
|
readonly busySpinnerContextFor: (node: CngxStepNode) => CngxStepBusySpinnerContext;
|
|
1589
2175
|
readonly rejectionContextFor: (node: CngxStepNode) => CngxStepRejectionContext;
|
|
2176
|
+
readonly stepErrorContextFor: (node: CngxStepNode) => CngxStepErrorContext;
|
|
1590
2177
|
readonly groupHeaderContextFor: (node: CngxStepNode) => CngxStepGroupHeaderContext;
|
|
1591
2178
|
readonly stepLabelContextFor: (node: CngxStepNode) => CngxStepLabelContext;
|
|
1592
2179
|
readonly stepContentContextFor: (node: CngxStepNode) => CngxStepContentContext;
|
|
1593
2180
|
}
|
|
1594
2181
|
/**
|
|
1595
|
-
* Bundle the
|
|
1596
|
-
* `isActive` / `isStepBusy` / `showRejection` / `showErrorBadge`
|
|
1597
|
-
* the organism's template reads. Lives at
|
|
1598
|
-
* organism stays a thin shell
|
|
2182
|
+
* Bundle the `*ContextFor` slot-context builders plus the small
|
|
2183
|
+
* `isActive` / `isStepBusy` / `showRejection` / `showErrorBadge` /
|
|
2184
|
+
* `showStepError` predicates the organism's template reads. Lives at
|
|
2185
|
+
* Level 2 so the `<cngx-stepper>` organism stays a thin shell.
|
|
1599
2186
|
*
|
|
1600
2187
|
* @internal
|
|
1601
2188
|
*/
|
|
@@ -2050,5 +2637,5 @@ declare function provideCngxStepper(...features: readonly CngxStepperFeature[]):
|
|
|
2050
2637
|
*/
|
|
2051
2638
|
declare function provideCngxStepperAt(...features: readonly CngxStepperFeature[]): Provider[];
|
|
2052
2639
|
|
|
2053
|
-
export { CNGX_STEPPER_COMMIT_HANDLER_FACTORY, CNGX_STEPPER_CONFIG, CNGX_STEPPER_GLYPHS, CNGX_STEPPER_HOST, CNGX_STEPPER_I18N, CNGX_STEP_GROUP_HOST, CNGX_STEP_PANEL_HOST, CngxDotStepperDot, CngxStep, CngxStepBadge, CngxStepBusySpinner, CngxStepContent, CngxStepGroup, CngxStepGroupHeader, CngxStepIndicator, CngxStepLabel, CngxStepRejection, CngxStepperComplete, CngxStepperCount, CngxStepperEmpty, CngxStepperNext, CngxStepperPresenter, CngxStepperPrevious, CngxStepperRouterSync, CngxStepperSwipeNav, STEPPER_DEFAULT_MOBILE_BREAKPOINT, createMobileViewportSignal, createStepperAnnouncementBuilders, createStepperCommitHandler, createStepperDisplayMode, createStepperHostAttrs, createStepperHostProxy, createStepperSlotContextBuilders, createStepperStripKeyboardNav, createStepperTemplateBindings, flatStepsEqual, injectStepperConfig, injectStepperI18n, provideCngxStepper, provideCngxStepperAt, provideStepperConfig, provideStepperConfigAt, provideStepperI18n, resolveStepperStatusLabel, withDotStepperDotTemplate, withStepBadgeTemplate, withStepBusySpinnerTemplate, withStepGroupHeaderTemplate, withStepIndicatorTemplate, withStepRejectionTemplate, withStepperAriaLabels, withStepperCommitMode, withStepperConnectors, withStepperDefaultOrientation, withStepperEmptyTemplate, withStepperFallbackLabels, withStepperI18nLabels, withStepperLinear, withStepperMobileBreakpoint, withStepperMobileCollapse, withStepperMobileIndicatorPosition, withStepperMobileSwipe, withStepperRouterSync, withStepperSkin };
|
|
2054
|
-
export type { CngxDotStepperDotContext, CngxStepBadgeContext, CngxStepBusySpinnerContext, CngxStepContentContext, CngxStepGroupHeaderContext, CngxStepGroupHost, CngxStepIndicatorContext, CngxStepLabelContext, CngxStepNode, CngxStepPanelHost, CngxStepRegistration, CngxStepRejectionContext, CngxStepStatus, CngxStepperAnnouncementBuilders, CngxStepperAnnouncementBuildersInputs, CngxStepperAriaLabels, CngxStepperCommitAction, CngxStepperCommitHandler, CngxStepperCommitHandlerFactory, CngxStepperCommitHandlerOptions, CngxStepperConfig, CngxStepperConfigFeature, CngxStepperCountHost, CngxStepperFallbackLabels, CngxStepperFeature, CngxStepperHost, CngxStepperHostAttrs, CngxStepperHostAttrsInputs, CngxStepperI18n, CngxStepperI18nFeature, CngxStepperI18nOverrides, CngxStepperMobileCollapse, CngxStepperMobileIndicatorPosition, CngxStepperSkin, CngxStepperSlotContextBuilders, CngxStepperSlotContextBuildersInputs, CngxStepperStatusLabels, CngxStepperStripKeyboardNavOptions, CngxStepperTemplateBindings, CngxStepperTemplateBindingsOptions, CngxStepperTemplates };
|
|
2640
|
+
export { CNGX_STEPPER_COMMIT_HANDLER_FACTORY, CNGX_STEPPER_CONFIG, CNGX_STEPPER_GLYPHS, CNGX_STEPPER_HOST, CNGX_STEPPER_I18N, CNGX_STEP_GROUP_HOST, CNGX_STEP_PANEL_HOST, CngxDotStepperDot, CngxStep, CngxStepBadge, CngxStepBusySpinner, CngxStepContent, CngxStepError, CngxStepGroup, CngxStepGroupHeader, CngxStepIndicator, CngxStepLabel, CngxStepRejection, CngxStepperComplete, CngxStepperCount, CngxStepperEmpty, CngxStepperNext, CngxStepperPresenter, CngxStepperPrevious, CngxStepperRouterSync, CngxStepperSwipeNav, STEPPER_DEFAULT_DENSITY_BREAKPOINTS, STEPPER_DEFAULT_MOBILE_BREAKPOINT, createMobileViewportSignal, createStepperAnnouncementBuilders, createStepperCommitHandler, createStepperDisplayMode, createStepperGroupNavigation, createStepperGroupSummary, createStepperHostAttrs, createStepperHostProxy, createStepperSlotContextBuilders, createStepperStateView, createStepperStripKeyboardNav, createStepperTemplateBindings, createStripDensity, flatStepsEqual, injectStepperConfig, injectStepperI18n, provideCngxStepper, provideCngxStepperAt, provideStepperConfig, provideStepperConfigAt, provideStepperI18n, resolveStepperErrorSummary, resolveStepperStatusLabel, withDotStepperDotTemplate, withStepBadgeTemplate, withStepBusySpinnerTemplate, withStepErrorTemplate, withStepGroupHeaderTemplate, withStepIndicatorTemplate, withStepRejectionTemplate, withStepperAriaLabels, withStepperCommitMode, withStepperConnectors, withStepperDefaultOrientation, withStepperDensity, withStepperEmptyTemplate, withStepperFallbackLabels, withStepperGroupCollapse, withStepperGroupCollapseSummary, withStepperHeaderNavigation, withStepperI18nLabels, withStepperLinear, withStepperMobileBreakpoint, withStepperMobileCollapse, withStepperMobileIndicatorPosition, withStepperMobileSwipe, withStepperRouterSync, withStepperSkin };
|
|
2641
|
+
export type { CngxDotStepperDotContext, CngxStepBadgeContext, CngxStepBusySpinnerContext, CngxStepContentContext, CngxStepErrorContext, CngxStepGroupHeaderContext, CngxStepGroupHost, CngxStepIndicatorContext, CngxStepLabelContext, CngxStepNode, CngxStepPanelHost, CngxStepRegistration, CngxStepRejectionContext, CngxStepStatus, CngxStepperAnnouncementBuilders, CngxStepperAnnouncementBuildersInputs, CngxStepperAriaLabels, CngxStepperCommitAction, CngxStepperCommitHandler, CngxStepperCommitHandlerFactory, CngxStepperCommitHandlerOptions, CngxStepperConfig, CngxStepperConfigFeature, CngxStepperCountHost, CngxStepperDensity, CngxStepperDensityBreakpoints, CngxStepperFallbackLabels, CngxStepperFeature, CngxStepperGroupCollapse, CngxStepperGroupNavigationOptions, CngxStepperGroupNavigationView, CngxStepperGroupSummary, CngxStepperGroupSummaryOptions, CngxStepperGroupSummaryView, CngxStepperHeaderNavigation, CngxStepperHost, CngxStepperHostAttrs, CngxStepperHostAttrsInputs, CngxStepperI18n, CngxStepperI18nFeature, CngxStepperI18nOverrides, CngxStepperMobileCollapse, CngxStepperMobileIndicatorPosition, CngxStepperSkin, CngxStepperSlotContextBuilders, CngxStepperSlotContextBuildersInputs, CngxStepperStateView, CngxStepperStatusLabels, CngxStepperStripKeyboardNavOptions, CngxStepperTemplateBindings, CngxStepperTemplateBindingsOptions, CngxStepperTemplates, CngxStripDensity, CngxStripDensityOptions };
|