@cngx/ui 0.1.0-rc.6 → 0.1.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -1
- package/a11y/README.md +87 -0
- package/accordion/README.md +4 -2
- package/breadcrumb/README.md +262 -0
- package/collection/README.md +6 -0
- package/command-palette/README.md +224 -0
- package/context-menu/README.md +98 -0
- package/data-grid-accordion/README.md +103 -2
- package/feedback/README.md +42 -0
- package/fesm2022/cngx-ui-a11y.mjs +452 -0
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
- package/fesm2022/cngx-ui-accordion.mjs +116 -38
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +115 -50
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +181 -96
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +586 -0
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
- package/fesm2022/cngx-ui-collection.mjs +207 -66
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +1281 -0
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
- package/fesm2022/cngx-ui-context-menu.mjs +857 -0
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -111
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +16 -6
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +1095 -521
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +18 -9
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +84 -16
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +370 -203
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +69 -13
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +501 -182
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +327 -106
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +22 -21
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +107 -8
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +718 -0
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
- package/fesm2022/cngx-ui-stepper.mjs +217 -76
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +40 -19
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +548 -0
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
- package/fesm2022/cngx-ui-toc.mjs +748 -0
- package/fesm2022/cngx-ui-toc.mjs.map +1 -0
- package/fesm2022/cngx-ui.mjs +16 -21
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-accordion/README.md +1 -1
- package/mat-paginator/README.md +9 -2
- package/mat-tabs/styles/mat-tabs.css +29 -27
- package/overlay/README.md +9 -4
- package/package.json +32 -1
- package/paginator/README.md +8 -4
- package/sidenav/README.md +33 -11
- package/skeleton/README.md +2 -0
- package/speak/README.md +3 -2
- package/stepper/README.md +15 -3
- package/timeline/README.md +350 -0
- package/toc/README.md +186 -0
- package/types/cngx-ui-a11y.d.ts +394 -0
- package/types/cngx-ui-accordion.d.ts +100 -30
- package/types/cngx-ui-action-button.d.ts +47 -3
- package/types/cngx-ui-breadcrumb.d.ts +159 -58
- package/types/cngx-ui-chart-panel.d.ts +382 -0
- package/types/cngx-ui-collection.d.ts +159 -58
- package/types/cngx-ui-command-palette.d.ts +565 -0
- package/types/cngx-ui-context-menu.d.ts +559 -0
- package/types/cngx-ui-data-grid-accordion.d.ts +344 -51
- package/types/cngx-ui-empty-state.d.ts +9 -2
- package/types/cngx-ui-feedback.d.ts +664 -73
- package/types/cngx-ui-layout.d.ts +8 -3
- package/types/cngx-ui-mat-accordion.d.ts +32 -4
- package/types/cngx-ui-mat-paginator.d.ts +37 -8
- package/types/cngx-ui-mat-stepper.d.ts +23 -11
- package/types/cngx-ui-mat-tabs.d.ts +218 -23
- package/types/cngx-ui-overlay.d.ts +56 -10
- package/types/cngx-ui-paginator.d.ts +416 -132
- package/types/cngx-ui-sidenav.d.ts +248 -74
- package/types/cngx-ui-skeleton.d.ts +18 -7
- package/types/cngx-ui-speak.d.ts +118 -5
- package/types/cngx-ui-stat-card.d.ts +411 -0
- package/types/cngx-ui-stepper.d.ts +81 -29
- package/types/cngx-ui-tabs.d.ts +22 -6
- package/types/cngx-ui-timeline.d.ts +495 -0
- package/types/cngx-ui-toc.d.ts +581 -0
- package/types/cngx-ui.d.ts +8 -5
package/types/cngx-ui-speak.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, Provider } from '@angular/core';
|
|
2
3
|
import { CngxSpeak } from '@cngx/common';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -30,10 +31,122 @@ import { CngxSpeak } from '@cngx/common';
|
|
|
30
31
|
* <example-url>http://localhost:4200/#/ui/speak/speak-button/styled-speaker-icon</example-url>
|
|
31
32
|
*/
|
|
32
33
|
declare class CngxSpeakButton {
|
|
34
|
+
private readonly i18n;
|
|
33
35
|
/** The `CngxSpeak` directive instance to connect to. */
|
|
34
|
-
readonly speakRef:
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
readonly speakRef: _angular_core.InputSignal<CngxSpeak>;
|
|
37
|
+
/**
|
|
38
|
+
* Accessible label while idle - the action the button offers. Unbound,
|
|
39
|
+
* `CNGX_SPEAK_I18N.readAloud` applies.
|
|
40
|
+
*/
|
|
41
|
+
readonly readAloudLabel: _angular_core.InputSignal<string | undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* Accessible label while speaking - the action the button offers to
|
|
44
|
+
* interrupt playback. Unbound, `CNGX_SPEAK_I18N.stopSpeaking` applies.
|
|
45
|
+
*/
|
|
46
|
+
readonly stopLabel: _angular_core.InputSignal<string | undefined>;
|
|
47
|
+
/** @internal - the label for the current playback state. */
|
|
48
|
+
protected readonly resolvedLabel: _angular_core.Signal<string>;
|
|
49
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxSpeakButton, never>;
|
|
50
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxSpeakButton, "cngx-speak-button", never, { "speakRef": { "alias": "speakRef"; "required": true; "isSignal": true; }; "readAloudLabel": { "alias": "readAloudLabel"; "required": false; "isSignal": true; }; "stopLabel": { "alias": "stopLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
37
51
|
}
|
|
38
52
|
|
|
39
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The speak section of a {@link CngxLanguagePack}: the accessible names of
|
|
55
|
+
* `CngxSpeakButton`. It feeds `CNGX_SPEAK_I18N`; a key set through
|
|
56
|
+
* `withSpeakI18nLabels` still wins.
|
|
57
|
+
*
|
|
58
|
+
* @category ui/speak/i18n
|
|
59
|
+
* @since 0.1.0
|
|
60
|
+
* @relatedTo CNGX_SPEAK_I18N, withSpeakI18nLabels
|
|
61
|
+
*/
|
|
62
|
+
interface CngxSpeakLanguageSection {
|
|
63
|
+
/** Accessible name of the speak button while idle. */
|
|
64
|
+
readonly readAloud: string;
|
|
65
|
+
/** Accessible name of the speak button while speaking. */
|
|
66
|
+
readonly stopSpeaking: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The English speak section: the single source of the speak button's English
|
|
70
|
+
* copy. `CNGX_SPEAK_I18N` defaults to it.
|
|
71
|
+
*
|
|
72
|
+
* @category ui/speak/i18n
|
|
73
|
+
* @since 0.1.0
|
|
74
|
+
* @relatedTo CNGX_SPEAK_I18N
|
|
75
|
+
*/
|
|
76
|
+
declare const CNGX_SPEAK_LANGUAGE_EN: CngxSpeakLanguageSection;
|
|
77
|
+
declare module '@cngx/core/i18n' {
|
|
78
|
+
interface CngxLanguagePack {
|
|
79
|
+
readonly speak: CngxSpeakLanguageSection;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Speak i18n surface: the `speak` section of the language pack (English
|
|
85
|
+
* without one); override single keys via {@link provideSpeakI18n}. Reactive
|
|
86
|
+
* from birth: the token carries a `Signal`, and {@link withSpeakI18nLabels}
|
|
87
|
+
* accepts a `Signal` of a partial bundle.
|
|
88
|
+
*
|
|
89
|
+
* `CngxSpeakButton` reads both keys inside a `computed()` while its
|
|
90
|
+
* `readAloudLabel` / `stopLabel` inputs are unbound, so the label follows a
|
|
91
|
+
* language switch.
|
|
92
|
+
*
|
|
93
|
+
* @category ui/speak/i18n
|
|
94
|
+
*/
|
|
95
|
+
type CngxSpeakI18n = CngxSpeakLanguageSection;
|
|
96
|
+
/**
|
|
97
|
+
* DI token for the speak i18n bundle. `providedIn: 'root'`: the `speak`
|
|
98
|
+
* section of the active language pack over the English defaults. The value is
|
|
99
|
+
* a `Signal`, shared by every reader under one injector.
|
|
100
|
+
*
|
|
101
|
+
* @category ui/speak/i18n
|
|
102
|
+
* @wcag AA
|
|
103
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/speak/speak-i18n.ts
|
|
104
|
+
* @since 0.1.0
|
|
105
|
+
* @relatedTo CngxSpeakButton
|
|
106
|
+
*/
|
|
107
|
+
declare const CNGX_SPEAK_I18N: InjectionToken<Signal<CngxSpeakLanguageSection>>;
|
|
108
|
+
/**
|
|
109
|
+
* Branded feature-fn for {@link provideSpeakI18n}.
|
|
110
|
+
*
|
|
111
|
+
* @category ui/speak/i18n
|
|
112
|
+
* @since 0.1.0
|
|
113
|
+
*/
|
|
114
|
+
type CngxSpeakI18nFeature = ((bundle: Signal<CngxSpeakI18n>) => Signal<CngxSpeakI18n>) & {
|
|
115
|
+
readonly _target: 'i18n';
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Override i18n labels via a partial bundle - unset keys, and keys set to
|
|
119
|
+
* `null` or `undefined`, keep the language pack's copy, or the English
|
|
120
|
+
* default, so the button never loses its accessible name. Pass a `Signal` of a
|
|
121
|
+
* partial bundle to switch languages at runtime.
|
|
122
|
+
*
|
|
123
|
+
* @category ui/speak/i18n
|
|
124
|
+
* @since 0.1.0
|
|
125
|
+
*/
|
|
126
|
+
declare function withSpeakI18nLabels(overrides: Partial<CngxSpeakI18n> | Signal<Partial<CngxSpeakI18n>>): CngxSpeakI18nFeature;
|
|
127
|
+
/**
|
|
128
|
+
* Provider for the speak i18n bundle. Returns a plain `Provider`, so it also
|
|
129
|
+
* scopes a subtree through `viewProviders`.
|
|
130
|
+
*
|
|
131
|
+
* ```ts
|
|
132
|
+
* bootstrapApplication(AppComponent, {
|
|
133
|
+
* providers: [
|
|
134
|
+
* provideSpeakI18n(withSpeakI18nLabels({ readAloud: 'Vorlesen', stopSpeaking: 'Vorlesen beenden' })),
|
|
135
|
+
* ],
|
|
136
|
+
* });
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @category ui/speak/i18n
|
|
140
|
+
* @since 0.1.0
|
|
141
|
+
*/
|
|
142
|
+
declare function provideSpeakI18n(...features: readonly CngxSpeakI18nFeature[]): Provider;
|
|
143
|
+
/**
|
|
144
|
+
* Inject the resolved speak i18n bundle signal.
|
|
145
|
+
*
|
|
146
|
+
* @category ui/speak/i18n
|
|
147
|
+
* @since 0.1.0
|
|
148
|
+
*/
|
|
149
|
+
declare function injectSpeakI18n(): Signal<CngxSpeakI18n>;
|
|
150
|
+
|
|
151
|
+
export { CNGX_SPEAK_I18N, CNGX_SPEAK_LANGUAGE_EN, CngxSpeakButton, injectSpeakI18n, provideSpeakI18n, withSpeakI18nLabels };
|
|
152
|
+
export type { CngxSpeakI18n, CngxSpeakI18nFeature, CngxSpeakLanguageSection };
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import * as _cngx_common_data from '@cngx/common/data';
|
|
2
|
+
import { CngxStatCoordinator, CngxStatSlotKind } from '@cngx/common/data';
|
|
3
|
+
export { CNGX_STAT, CngxStatCaption, CngxStatDelta, CngxStatLabel, CngxStatRegistry, CngxStatValue } from '@cngx/common/data';
|
|
4
|
+
import * as _angular_core from '@angular/core';
|
|
5
|
+
import { Signal, InjectionToken, EnvironmentProviders, Provider } from '@angular/core';
|
|
6
|
+
import { CngxAsyncState, CngxLoadingTreatment } from '@cngx/core/utils';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Card-framed KPI tile: one `<cngx-stat-card>` renders a complete dashboard
|
|
10
|
+
* metric - card surface, coordinated stat slots, an inline visualisation, a
|
|
11
|
+
* footer, and the async view switch - from a single `[state]`.
|
|
12
|
+
*
|
|
13
|
+
* The stat slots are the existing `cngxStatLabel` / `cngxStatValue` /
|
|
14
|
+
* `cngxStatDelta` / `cngxStatCaption` atoms from `@cngx/common/data`, not
|
|
15
|
+
* copies. They resolve `CNGX_STAT` against their declaration site, so the card
|
|
16
|
+
* hosts the same {@link CngxStatCoordinator} brain `CngxStat` hosts and
|
|
17
|
+
* re-points the token at it - the shape `CngxIncrementalList` uses for
|
|
18
|
+
* `CNGX_PAGINATOR_HOST`. A screen reader therefore reads the tile as one
|
|
19
|
+
* phrase, not four fragments (Pillar 2).
|
|
20
|
+
*
|
|
21
|
+
* The view switch is a pure `computed()` off `[state]` via `resolveAsyncView`
|
|
22
|
+
* (Pillar 1) - there is no second state machine and no boolean fallback inputs.
|
|
23
|
+
*
|
|
24
|
+
* Like `cngx-chart`, the card does **not** provide `CNGX_STATEFUL`: the
|
|
25
|
+
* consumer already holds the state object it bound, so transition bridges take
|
|
26
|
+
* it directly, e.g. `<cngx-toast-on [state]="revenue" />`.
|
|
27
|
+
*
|
|
28
|
+
* ```html
|
|
29
|
+
* <cngx-stat-card [state]="revenue">
|
|
30
|
+
* <span cngxStatLabel>Revenue</span>
|
|
31
|
+
* <cngx-metric cngxStatValue [value]="1.2" unit="M EUR" />
|
|
32
|
+
* <cngx-delta cngxStatDelta [value]="5.3" />
|
|
33
|
+
* <span cngxStatCaption>vs. last quarter</span>
|
|
34
|
+
* <cngx-sparkline cngxStatCardViz [data]="trend()" />
|
|
35
|
+
* </cngx-stat-card>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @category ui/stat-card
|
|
39
|
+
* @docsKind primary
|
|
40
|
+
* @wcag AA
|
|
41
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/stat-card.component.ts
|
|
42
|
+
* @since 0.1.0
|
|
43
|
+
* @relatedTo CngxStat, CngxStatCoordinator, CngxStatCardViz, CngxStatCardFooter, CngxCard
|
|
44
|
+
*
|
|
45
|
+
* <example-url>http://localhost:4200/#/ui/stat-card/basic/composed-kpi-tile</example-url>
|
|
46
|
+
* <example-url>http://localhost:4200/#/ui/stat-card/async/latency-aware-loading</example-url>
|
|
47
|
+
* <example-url>http://localhost:4200/#/ui/stat-card/async/error-and-refresh</example-url>
|
|
48
|
+
*/
|
|
49
|
+
declare class CngxStatCard {
|
|
50
|
+
/** @internal The shared slot-id brain, applied as a host directive. */
|
|
51
|
+
protected readonly coordinator: CngxStatCoordinator;
|
|
52
|
+
private readonly config;
|
|
53
|
+
private readonly ariaLabels;
|
|
54
|
+
/**
|
|
55
|
+
* The tile's async envelope. Every view decision derives from it; there are
|
|
56
|
+
* no discrete `loading` / `error` boolean fallbacks. Optional per the
|
|
57
|
+
* bridge-input rule, so `[state]` may be bound conditionally.
|
|
58
|
+
*/
|
|
59
|
+
readonly state: _angular_core.InputSignalWithTransform<CngxAsyncState<unknown> | undefined, "" | CngxAsyncState<unknown> | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* What the card shows while it loads. `'auto'` (default) picks from the
|
|
62
|
+
* latency the tile itself observed: a tile whose last load was quick shows a
|
|
63
|
+
* spinner blip, one whose last load dragged shows a skeleton. `'spinner'` and
|
|
64
|
+
* `'skeleton'` pin the choice.
|
|
65
|
+
*/
|
|
66
|
+
readonly loadingTreatment: _angular_core.InputSignal<CngxLoadingTreatment>;
|
|
67
|
+
/**
|
|
68
|
+
* Accessible label announced while the card is loading. Unbound
|
|
69
|
+
* (`undefined`), each copy input falls back to the config cascade and the
|
|
70
|
+
* `statCard` section of the language pack.
|
|
71
|
+
*/
|
|
72
|
+
readonly busyLabel: _angular_core.InputSignal<string | undefined>;
|
|
73
|
+
/** Headline of the error state shown instead of the stat when the first load failed. */
|
|
74
|
+
readonly errorText: _angular_core.InputSignal<string | undefined>;
|
|
75
|
+
/** Supporting detail under {@link errorText}. Omitted when unset. */
|
|
76
|
+
readonly errorDescription: _angular_core.InputSignal<string | undefined>;
|
|
77
|
+
/** Note appended below the stat when a refresh failed but stale data is still shown. */
|
|
78
|
+
readonly staleText: _angular_core.InputSignal<string | undefined>;
|
|
79
|
+
/** Headline of the empty state shown when a load settled with no data. */
|
|
80
|
+
readonly emptyText: _angular_core.InputSignal<string | undefined>;
|
|
81
|
+
/**
|
|
82
|
+
* Politeness of the tile's live region. `off` (default) for a static KPI;
|
|
83
|
+
* `polite` for a tile that refreshes on a timer, so the new figure is
|
|
84
|
+
* announced instead of changing silently. Mirrors `CngxStat.live`.
|
|
85
|
+
*/
|
|
86
|
+
readonly live: _angular_core.InputSignal<"off" | "polite" | "assertive">;
|
|
87
|
+
/** @internal Whether any operation is running. Drives `aria-busy` (Pillar 2). */
|
|
88
|
+
protected readonly busy: _angular_core.Signal<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* @internal Which bars the placeholder draws. Mirrors the slots the consumer
|
|
91
|
+
* actually projected, so a tile without a delta gets no delta bar. Falls back
|
|
92
|
+
* to the common label / value / caption shape when nothing has registered -
|
|
93
|
+
* a card with no stat slots at all still needs a plausible placeholder.
|
|
94
|
+
*/
|
|
95
|
+
protected readonly skeletonSlots: _angular_core.Signal<readonly CngxStatSlotKind[]>;
|
|
96
|
+
/**
|
|
97
|
+
* @internal A refresh over content the user can still read. The skeleton and
|
|
98
|
+
* spinner branches already carry their own busy signal, so the bar would be
|
|
99
|
+
* redundant there.
|
|
100
|
+
*/
|
|
101
|
+
protected readonly showRefreshIndicator: _angular_core.Signal<boolean>;
|
|
102
|
+
private readonly loadingConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Measures how long this tile's own busy windows last. The measurement is a
|
|
105
|
+
* wall-clock sample the probe writes from an effect; the selection below stays
|
|
106
|
+
* a pure `computed()`, so nothing in the reactive graph writes state.
|
|
107
|
+
*/
|
|
108
|
+
private readonly probe;
|
|
109
|
+
/**
|
|
110
|
+
* Spinner or skeleton for the current load, from the observed latency and the
|
|
111
|
+
* cascaded cutoff. Never a hardcoded millisecond threshold - the cutoff always
|
|
112
|
+
* comes from `CNGX_LOADING_CONFIG`, so one `provideLoadingConfig(...)` retunes
|
|
113
|
+
* every tile in the app.
|
|
114
|
+
*/
|
|
115
|
+
protected readonly resolvedTreatment: _angular_core.Signal<"spinner" | "skeleton">;
|
|
116
|
+
/**
|
|
117
|
+
* @internal The card element carries the accessible name, so the tile is one
|
|
118
|
+
* named region instead of an unnamed `article` wrapped around a named group.
|
|
119
|
+
* Null while the stat is not rendered: the slot ids live inside the content
|
|
120
|
+
* branch, and pointing at ids that are out of the DOM reads as unnamed anyway.
|
|
121
|
+
*/
|
|
122
|
+
protected readonly cardLabelledBy: _angular_core.Signal<string | null>;
|
|
123
|
+
/**
|
|
124
|
+
* @internal Which body the card renders. Delegates to the shared
|
|
125
|
+
* `resolveAsyncView` lookup table so the tile cannot drift from every other
|
|
126
|
+
* async surface. Without a bound `[state]` the card always shows its content.
|
|
127
|
+
*/
|
|
128
|
+
protected readonly activeView: _angular_core.Signal<_cngx_common_data.AsyncView>;
|
|
129
|
+
protected readonly resolvedBusyLabel: _angular_core.Signal<string>;
|
|
130
|
+
protected readonly resolvedErrorText: _angular_core.Signal<string>;
|
|
131
|
+
protected readonly resolvedErrorDescription: _angular_core.Signal<string | undefined>;
|
|
132
|
+
protected readonly resolvedStaleText: _angular_core.Signal<string>;
|
|
133
|
+
protected readonly resolvedEmptyText: _angular_core.Signal<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Keys the untracked cascade reads above on the view and busy phase, read
|
|
136
|
+
* straight from the signals the template polls (so a phase that returns to an
|
|
137
|
+
* earlier value still re-reads). The whole card can be a live region, so a
|
|
138
|
+
* language switch must not re-render its text; the next view or busy change
|
|
139
|
+
* speaks the new language. A bound input stays tracked.
|
|
140
|
+
*/
|
|
141
|
+
private trackPhase;
|
|
142
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatCard, never>;
|
|
143
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxStatCard, "cngx-stat-card", never, { "state": { "alias": "state"; "required": false; "isSignal": true; }; "loadingTreatment": { "alias": "loadingTreatment"; "required": false; "isSignal": true; }; "busyLabel": { "alias": "busyLabel"; "required": false; "isSignal": true; }; "errorText": { "alias": "errorText"; "required": false; "isSignal": true; }; "errorDescription": { "alias": "errorDescription"; "required": false; "isSignal": true; }; "staleText": { "alias": "staleText"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "live": { "alias": "live"; "required": false; "isSignal": true; }; }, {}, never, ["[cngxStatLabel]", "[cngxStatValue]", "[cngxStatDelta]", "[cngxStatCaption]", "[cngxStatCardViz]", "[cngxStatCardFooter]"], true, [{ directive: typeof _cngx_common_data.CngxStatCoordinator; inputs: {}; outputs: {}; }]>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Marks the inline visualisation of a {@link CngxStatCard} - a `cngx-sparkline`,
|
|
148
|
+
* `cngx-mini-area`, `cngx-deviation-bar`, or any other compact chart preset.
|
|
149
|
+
*
|
|
150
|
+
* Rendered beside the stat block and outside its `aria-labelledby` chain: the
|
|
151
|
+
* accessible name stays the numbers a screen reader can actually read, while
|
|
152
|
+
* the viz stays decorative unless the projected preset carries its own
|
|
153
|
+
* accessible name.
|
|
154
|
+
*
|
|
155
|
+
* @category ui/stat-card
|
|
156
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/stat-card-slots.ts
|
|
157
|
+
* @since 0.1.0
|
|
158
|
+
* @relatedTo CngxStatCard, CngxStatCardFooter
|
|
159
|
+
*/
|
|
160
|
+
declare class CngxStatCardViz {
|
|
161
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatCardViz, never>;
|
|
162
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxStatCardViz, "[cngxStatCardViz]", never, {}, {}, never, never, true, never>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Marks the footer row of a {@link CngxStatCard} - a timestamp, a drill-down
|
|
166
|
+
* link, a `cngx-tag` row. Rendered below the stat block and the viz slot.
|
|
167
|
+
*
|
|
168
|
+
* @category ui/stat-card
|
|
169
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/stat-card-slots.ts
|
|
170
|
+
* @since 0.1.0
|
|
171
|
+
* @relatedTo CngxStatCard, CngxStatCardViz
|
|
172
|
+
*/
|
|
173
|
+
declare class CngxStatCardFooter {
|
|
174
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStatCardFooter, never>;
|
|
175
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxStatCardFooter, "[cngxStatCardFooter]", never, {}, {}, never, never, true, never>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The stat-card section of a {@link CngxLanguagePack}: the state copy of
|
|
180
|
+
* `CngxStatCard`. It feeds the `ariaLabels` of `CNGX_STAT_CARD_CONFIG`; a key
|
|
181
|
+
* set through `withStatCardAriaLabels` or a bound copy input still wins.
|
|
182
|
+
*
|
|
183
|
+
* @category ui/stat-card/i18n
|
|
184
|
+
* @since 0.1.0
|
|
185
|
+
* @relatedTo CNGX_STAT_CARD_CONFIG, withStatCardAriaLabels
|
|
186
|
+
*/
|
|
187
|
+
interface CngxStatCardLanguageSection {
|
|
188
|
+
/** Accessible name announced while the tile is loading. */
|
|
189
|
+
readonly busy: string;
|
|
190
|
+
/** Headline of the error state shown when the first load failed. */
|
|
191
|
+
readonly errorFallback: string;
|
|
192
|
+
/** Note shown below stale numbers when a refresh failed. */
|
|
193
|
+
readonly staleFallback: string;
|
|
194
|
+
/** Headline of the empty state shown when a load settled with no data. */
|
|
195
|
+
readonly emptyFallback: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The English stat-card section: the single source of the stat card's English
|
|
199
|
+
* copy. The `CNGX_STAT_CARD_CONFIG` labels default to it.
|
|
200
|
+
*
|
|
201
|
+
* @category ui/stat-card/i18n
|
|
202
|
+
* @since 0.1.0
|
|
203
|
+
* @relatedTo CNGX_STAT_CARD_CONFIG
|
|
204
|
+
*/
|
|
205
|
+
declare const CNGX_STAT_CARD_LANGUAGE_EN: CngxStatCardLanguageSection;
|
|
206
|
+
declare module '@cngx/core/i18n' {
|
|
207
|
+
interface CngxLanguagePack {
|
|
208
|
+
readonly statCard: CngxStatCardLanguageSection;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* String fallbacks for the stat-card's non-content states: a partial of the
|
|
214
|
+
* `statCard` language section (declared once there; an unset key reads the
|
|
215
|
+
* section, English without a pack) plus `errorDescription`, the supporting
|
|
216
|
+
* detail under the error headline, which has no default and is omitted when
|
|
217
|
+
* unset.
|
|
218
|
+
*
|
|
219
|
+
* @category ui/stat-card
|
|
220
|
+
* @since 0.1.0
|
|
221
|
+
*/
|
|
222
|
+
interface CngxStatCardAriaLabels extends Partial<CngxStatCardLanguageSection> {
|
|
223
|
+
/** Supporting detail under the error headline. Omitted when unset. */
|
|
224
|
+
readonly errorDescription?: string;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The resolved stat-card strings: every key of the `statCard` section is set.
|
|
228
|
+
*
|
|
229
|
+
* @category ui/stat-card
|
|
230
|
+
* @since 0.1.0
|
|
231
|
+
*/
|
|
232
|
+
type CngxStatCardResolvedAriaLabels = CngxStatCardAriaLabels & CngxStatCardLanguageSection;
|
|
233
|
+
/**
|
|
234
|
+
* App-wide cascade for the stat-card's ARIA/message strings and its default
|
|
235
|
+
* loading treatment.
|
|
236
|
+
*
|
|
237
|
+
* Resolution priority (high -> low):
|
|
238
|
+
* 1. Per-instance Input binding (e.g. `[errorText]`, `[loadingTreatment]`).
|
|
239
|
+
* 2. `provideStatCardConfigAt(...)` in a parent component's `viewProviders`.
|
|
240
|
+
* 3. `provideStatCardConfig(...)` at the application root.
|
|
241
|
+
* 4. Library defaults (`CNGX_STAT_CARD_DEFAULTS`; the strings come from the
|
|
242
|
+
* `statCard` section of the language pack).
|
|
243
|
+
*
|
|
244
|
+
* Every key is optional - partial overrides deep-merge with the library
|
|
245
|
+
* defaults, so consumers declare only the keys they want to override.
|
|
246
|
+
*
|
|
247
|
+
* @category ui/stat-card
|
|
248
|
+
* @since 0.1.0
|
|
249
|
+
*/
|
|
250
|
+
interface CngxStatCardConfig {
|
|
251
|
+
/**
|
|
252
|
+
* String fallbacks for the tile's non-content states. Per-instance
|
|
253
|
+
* `[busyLabel]` / `[errorText]` / `[staleText]` bindings still win. Accepts
|
|
254
|
+
* a `Signal` so the strings follow a runtime language switch; read the
|
|
255
|
+
* resolved bundle through {@link injectStatCardAriaLabels}.
|
|
256
|
+
*/
|
|
257
|
+
readonly ariaLabels?: CngxStatCardAriaLabels | Signal<CngxStatCardAriaLabels>;
|
|
258
|
+
/**
|
|
259
|
+
* App-wide default loading treatment. Per-instance `[loadingTreatment]`
|
|
260
|
+
* still wins; this only moves the cascade default. A flat top-level scalar,
|
|
261
|
+
* not a nested sub-tree.
|
|
262
|
+
*/
|
|
263
|
+
readonly loadingTreatment?: CngxLoadingTreatment;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* App-wide configuration cascade for the stat-card. Resolves in priority
|
|
268
|
+
* order:
|
|
269
|
+
*
|
|
270
|
+
* 1. Per-instance Input binding.
|
|
271
|
+
* 2. `provideStatCardConfigAt(...)` in a parent component's `viewProviders`.
|
|
272
|
+
* 3. `provideStatCardConfig(...)` at the application root.
|
|
273
|
+
* 4. Library defaults (this token's `factory`).
|
|
274
|
+
*
|
|
275
|
+
* `providedIn: 'root'` with a default factory means consumers never need to
|
|
276
|
+
* provide the token explicitly - `inject(CNGX_STAT_CARD_CONFIG)` always
|
|
277
|
+
* resolves.
|
|
278
|
+
*
|
|
279
|
+
* @category ui/stat-card
|
|
280
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/config/stat-card.config.defaults.ts
|
|
281
|
+
* @since 0.1.0
|
|
282
|
+
* @relatedTo provideStatCardConfig, provideStatCardConfigAt, injectStatCardConfig
|
|
283
|
+
*/
|
|
284
|
+
declare const CNGX_STAT_CARD_CONFIG: InjectionToken<CngxStatCardConfig>;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Discriminated-union shape returned by the stat-card config features -
|
|
288
|
+
* `withStatCardAriaLabels` and `withStatCardLoadingTreatment`. The reducer in
|
|
289
|
+
* `provideStatCardConfig` / `provideStatCardConfigAt` matches on `kind` and
|
|
290
|
+
* merges `payload` into the corresponding config sub-tree. Mirrors
|
|
291
|
+
* `CngxBreadcrumbConfigFeature` so the consumer's mental model is one across
|
|
292
|
+
* feature areas.
|
|
293
|
+
*
|
|
294
|
+
* @category ui/stat-card
|
|
295
|
+
* @since 0.1.0
|
|
296
|
+
*/
|
|
297
|
+
type CngxStatCardConfigFeature = {
|
|
298
|
+
readonly kind: 'ariaLabels';
|
|
299
|
+
readonly payload: CngxStatCardAriaLabels | Signal<CngxStatCardAriaLabels>;
|
|
300
|
+
} | {
|
|
301
|
+
readonly kind: 'loadingTreatment';
|
|
302
|
+
readonly payload: {
|
|
303
|
+
readonly loadingTreatment: NonNullable<CngxStatCardConfig['loadingTreatment']>;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Application-root configuration cascade for the stat-card. Pass any
|
|
308
|
+
* combination of `withStatCardAriaLabels` and `withStatCardLoadingTreatment`
|
|
309
|
+
* in `bootstrapApplication`'s providers array.
|
|
310
|
+
*
|
|
311
|
+
* ```ts
|
|
312
|
+
* bootstrapApplication(AppComponent, {
|
|
313
|
+
* providers: [
|
|
314
|
+
* provideStatCardConfig(
|
|
315
|
+
* withStatCardAriaLabels({ errorFallback: 'Kennzahl nicht verfügbar' }),
|
|
316
|
+
* withStatCardLoadingTreatment('skeleton'),
|
|
317
|
+
* ),
|
|
318
|
+
* ],
|
|
319
|
+
* });
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @category ui/stat-card
|
|
323
|
+
* @since 0.1.0
|
|
324
|
+
*/
|
|
325
|
+
declare function provideStatCardConfig(...features: CngxStatCardConfigFeature[]): EnvironmentProviders;
|
|
326
|
+
/**
|
|
327
|
+
* Component-scoped configuration cascade for the stat-card. Pass any
|
|
328
|
+
* combination of feature factories in a parent component's `viewProviders`.
|
|
329
|
+
*
|
|
330
|
+
* Unlike `provideStatCardConfig` (root-only), this injects the parent
|
|
331
|
+
* injector's `CNGX_STAT_CARD_CONFIG` value and deep-merges the supplied
|
|
332
|
+
* features on top. Descendant tiles see the merged config; sibling sub-trees
|
|
333
|
+
* keep the inherited value untouched.
|
|
334
|
+
*
|
|
335
|
+
* ```ts
|
|
336
|
+
* @Component({
|
|
337
|
+
* viewProviders: [provideStatCardConfigAt(withStatCardLoadingTreatment('spinner'))],
|
|
338
|
+
* template: '<cngx-stat-card [state]="s" />',
|
|
339
|
+
* })
|
|
340
|
+
* class LiveTiles {}
|
|
341
|
+
* ```
|
|
342
|
+
*
|
|
343
|
+
* @category ui/stat-card
|
|
344
|
+
* @since 0.1.0
|
|
345
|
+
*/
|
|
346
|
+
declare function provideStatCardConfigAt(...features: CngxStatCardConfigFeature[]): Provider[];
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Override the stat-card's string fallbacks - the busy announcement, the
|
|
350
|
+
* first-load error message, and the stale-data note. Per-instance
|
|
351
|
+
* `[busyLabel]` / `[errorText]` / `[staleText]` bindings still win.
|
|
352
|
+
*
|
|
353
|
+
* The defaults come from the `statCard` section of the language pack (English
|
|
354
|
+
* without one); this overrides single keys on top of it. Pass a
|
|
355
|
+
* `Signal` to switch the language at runtime; a tile with a live region speaks
|
|
356
|
+
* the new language with its next state change.
|
|
357
|
+
*
|
|
358
|
+
* ```ts
|
|
359
|
+
* provideStatCardConfig(
|
|
360
|
+
* withStatCardAriaLabels({ busy: 'Lädt', errorFallback: 'Nicht verfügbar' }),
|
|
361
|
+
* );
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* @category ui/stat-card
|
|
365
|
+
* @since 0.1.0
|
|
366
|
+
*/
|
|
367
|
+
declare function withStatCardAriaLabels(labels: CngxStatCardAriaLabels | Signal<CngxStatCardAriaLabels>): CngxStatCardConfigFeature;
|
|
368
|
+
/**
|
|
369
|
+
* Move the cascade default for what a tile renders while it loads. `'auto'`
|
|
370
|
+
* (the library default) picks spinner vs skeleton from the latency the tile
|
|
371
|
+
* observed; `'spinner'` and `'skeleton'` pin it app-wide. Per-instance
|
|
372
|
+
* `[loadingTreatment]` still wins.
|
|
373
|
+
*
|
|
374
|
+
* @category ui/stat-card
|
|
375
|
+
* @since 0.1.0
|
|
376
|
+
*/
|
|
377
|
+
declare function withStatCardLoadingTreatment(treatment: CngxLoadingTreatment): CngxStatCardConfigFeature;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Convenience accessor for the stat-card configuration cascade. Runs in
|
|
381
|
+
* injection context; resolves through the priority chain (per-instance Input
|
|
382
|
+
* -> `provideStatCardConfigAt` -> `provideStatCardConfig` -> library
|
|
383
|
+
* defaults). Equivalent to `inject(CNGX_STAT_CARD_CONFIG)` - the helper exists
|
|
384
|
+
* so consumers don't import the token directly.
|
|
385
|
+
*
|
|
386
|
+
* ```ts
|
|
387
|
+
* export class CngxStatCard {
|
|
388
|
+
* private readonly cfg = injectStatCardConfig();
|
|
389
|
+
* readonly errorText = input<string>(this.cfg.ariaLabels?.errorFallback ?? 'Could not load');
|
|
390
|
+
* }
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @category ui/stat-card
|
|
394
|
+
* @since 0.1.0
|
|
395
|
+
*/
|
|
396
|
+
declare function injectStatCardConfig(): CngxStatCardConfig;
|
|
397
|
+
/**
|
|
398
|
+
* The resolved strings of the stat-card config in scope, every key the config
|
|
399
|
+
* leaves unset (also a key an override sets to `undefined`) filled from the
|
|
400
|
+
* `statCard` section of the active pack, as a Signal that follows a runtime
|
|
401
|
+
* language switch. Runs
|
|
402
|
+
* in injection context; read it inside a `computed()`, a template or a
|
|
403
|
+
* handler, and untracked where it builds live-region text.
|
|
404
|
+
*
|
|
405
|
+
* @category ui/stat-card
|
|
406
|
+
* @since 0.1.0
|
|
407
|
+
*/
|
|
408
|
+
declare function injectStatCardAriaLabels(): Signal<CngxStatCardResolvedAriaLabels>;
|
|
409
|
+
|
|
410
|
+
export { CNGX_STAT_CARD_CONFIG, CNGX_STAT_CARD_LANGUAGE_EN, CngxStatCard, CngxStatCardFooter, CngxStatCardViz, injectStatCardAriaLabels, injectStatCardConfig, provideStatCardConfig, provideStatCardConfigAt, withStatCardAriaLabels, withStatCardLoadingTreatment };
|
|
411
|
+
export type { CngxStatCardAriaLabels, CngxStatCardConfig, CngxStatCardConfigFeature, CngxStatCardLanguageSection, CngxStatCardResolvedAriaLabels };
|