@cngx/ui 0.1.0-rc.6 → 0.1.0-rc.7

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.
Files changed (79) hide show
  1. package/README.md +112 -0
  2. package/a11y/README.md +81 -0
  3. package/context-menu/README.md +98 -0
  4. package/data-grid-accordion/README.md +27 -0
  5. package/feedback/README.md +2 -0
  6. package/fesm2022/cngx-ui-a11y.mjs +320 -0
  7. package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
  8. package/fesm2022/cngx-ui-accordion.mjs +17 -6
  9. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  10. package/fesm2022/cngx-ui-action-button.mjs +5 -2
  11. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  12. package/fesm2022/cngx-ui-breadcrumb.mjs +11 -6
  13. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  14. package/fesm2022/cngx-ui-chart-panel.mjs +429 -0
  15. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
  16. package/fesm2022/cngx-ui-collection.mjs +15 -6
  17. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-command-palette.mjs +1005 -0
  19. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-context-menu.mjs +742 -0
  21. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
  22. package/fesm2022/cngx-ui-data-grid-accordion.mjs +88 -18
  23. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  24. package/fesm2022/cngx-ui-feedback.mjs +97 -106
  25. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  26. package/fesm2022/cngx-ui-layout.mjs +18 -9
  27. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  28. package/fesm2022/cngx-ui-mat-accordion.mjs +9 -9
  29. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  30. package/fesm2022/cngx-ui-mat-tabs.mjs +64 -70
  31. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  32. package/fesm2022/cngx-ui-paginator.mjs +18 -8
  33. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  34. package/fesm2022/cngx-ui-sidenav.mjs +2 -2
  35. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  36. package/fesm2022/cngx-ui-skeleton.mjs +20 -7
  37. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  38. package/fesm2022/cngx-ui-speak.mjs +2 -2
  39. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  40. package/fesm2022/cngx-ui-stat-card.mjs +618 -0
  41. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
  42. package/fesm2022/cngx-ui-stepper.mjs +30 -12
  43. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  44. package/fesm2022/cngx-ui-tabs.mjs +36 -19
  45. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  46. package/fesm2022/cngx-ui-timeline.mjs +495 -0
  47. package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
  48. package/fesm2022/cngx-ui-toc.mjs +704 -0
  49. package/fesm2022/cngx-ui-toc.mjs.map +1 -0
  50. package/fesm2022/cngx-ui.mjs +2 -2
  51. package/fesm2022/cngx-ui.mjs.map +1 -1
  52. package/mat-accordion/README.md +1 -1
  53. package/mat-tabs/styles/mat-tabs.css +20 -17
  54. package/package.json +32 -1
  55. package/skeleton/README.md +2 -0
  56. package/stepper/README.md +2 -2
  57. package/timeline/README.md +350 -0
  58. package/toc/README.md +183 -0
  59. package/types/cngx-ui-a11y.d.ts +303 -0
  60. package/types/cngx-ui-accordion.d.ts +9 -4
  61. package/types/cngx-ui-action-button.d.ts +3 -0
  62. package/types/cngx-ui-breadcrumb.d.ts +5 -0
  63. package/types/cngx-ui-chart-panel.d.ts +278 -0
  64. package/types/cngx-ui-collection.d.ts +12 -3
  65. package/types/cngx-ui-command-palette.d.ts +451 -0
  66. package/types/cngx-ui-context-menu.d.ts +467 -0
  67. package/types/cngx-ui-data-grid-accordion.d.ts +72 -15
  68. package/types/cngx-ui-feedback.d.ts +71 -18
  69. package/types/cngx-ui-layout.d.ts +8 -3
  70. package/types/cngx-ui-mat-accordion.d.ts +3 -3
  71. package/types/cngx-ui-mat-tabs.d.ts +11 -9
  72. package/types/cngx-ui-paginator.d.ts +13 -3
  73. package/types/cngx-ui-skeleton.d.ts +13 -1
  74. package/types/cngx-ui-stat-card.d.ts +327 -0
  75. package/types/cngx-ui-stepper.d.ts +15 -2
  76. package/types/cngx-ui-tabs.d.ts +20 -4
  77. package/types/cngx-ui-timeline.d.ts +479 -0
  78. package/types/cngx-ui-toc.d.ts +514 -0
  79. package/types/cngx-ui.d.ts +1 -1
@@ -0,0 +1,618 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, Directive, makeEnvironmentProviders } from '@angular/core';
3
+ import { CngxCard } from '@cngx/common/card';
4
+ import * as i1 from '@cngx/common/data';
5
+ import { CngxStatCoordinator, resolveAsyncView, CNGX_STAT } from '@cngx/common/data';
6
+ export { CNGX_STAT, CngxStatCaption, CngxStatDelta, CngxStatLabel, CngxStatValue } from '@cngx/common/data';
7
+ import { CngxSkeleton } from '@cngx/common/layout';
8
+ import { injectLoadingConfig, createLatencyProbe, resolveLoadingTreatment } from '@cngx/core/utils';
9
+ import { CngxEmptyState } from '@cngx/ui/empty-state';
10
+ import { CngxLoadingIndicator } from '@cngx/ui/feedback';
11
+
12
+ /**
13
+ * Library defaults for the stat-card configuration cascade. English by
14
+ * default; locale overrides ride the `withStatCardAriaLabels` feature. The
15
+ * values are byte-identical to the per-instance input defaults the component
16
+ * shipped before the cascade, so an un-configured consumer sees no change.
17
+ *
18
+ * Exported for intra-lib consumers (`provideStatCardConfig` deep-merges with
19
+ * this base) but **NOT** re-exported from `public-api.ts` - downstream
20
+ * consumers reach the defaults via `inject(CNGX_STAT_CARD_CONFIG)` so
21
+ * `provideStatCardConfig` / `provideStatCardConfigAt` overrides take
22
+ * precedence.
23
+ *
24
+ * @internal
25
+ */
26
+ const CNGX_STAT_CARD_DEFAULTS = {
27
+ ariaLabels: {
28
+ busy: 'Loading',
29
+ errorFallback: 'Could not load',
30
+ staleFallback: 'Showing last known value',
31
+ },
32
+ loadingTreatment: 'auto',
33
+ };
34
+ /**
35
+ * App-wide configuration cascade for the stat-card. Resolves in priority
36
+ * order:
37
+ *
38
+ * 1. Per-instance Input binding.
39
+ * 2. `provideStatCardConfigAt(...)` in a parent component's `viewProviders`.
40
+ * 3. `provideStatCardConfig(...)` at the application root.
41
+ * 4. Library defaults (this token's `factory`).
42
+ *
43
+ * `providedIn: 'root'` with a default factory means consumers never need to
44
+ * provide the token explicitly - `inject(CNGX_STAT_CARD_CONFIG)` always
45
+ * resolves.
46
+ *
47
+ * @category ui/stat-card
48
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/config/stat-card.config.defaults.ts
49
+ * @since 0.1.0
50
+ * @relatedTo provideStatCardConfig, provideStatCardConfigAt, injectStatCardConfig
51
+ */
52
+ const CNGX_STAT_CARD_CONFIG = new InjectionToken('CNGX_STAT_CARD_CONFIG', {
53
+ providedIn: 'root',
54
+ factory: () => CNGX_STAT_CARD_DEFAULTS,
55
+ });
56
+
57
+ /**
58
+ * Convenience accessor for the stat-card configuration cascade. Runs in
59
+ * injection context; resolves through the priority chain (per-instance Input
60
+ * -> `provideStatCardConfigAt` -> `provideStatCardConfig` -> library
61
+ * defaults). Equivalent to `inject(CNGX_STAT_CARD_CONFIG)` - the helper exists
62
+ * so consumers don't import the token directly.
63
+ *
64
+ * ```ts
65
+ * export class CngxStatCard {
66
+ * private readonly cfg = injectStatCardConfig();
67
+ * readonly errorText = input<string>(this.cfg.ariaLabels?.errorFallback ?? 'Could not load');
68
+ * }
69
+ * ```
70
+ *
71
+ * @category ui/stat-card
72
+ * @since 0.1.0
73
+ */
74
+ function injectStatCardConfig() {
75
+ return inject(CNGX_STAT_CARD_CONFIG);
76
+ }
77
+
78
+ /** Placeholder shape for a card whose consumer projected no stat slots at all. */
79
+ const DEFAULT_SKELETON_SLOTS = ['label', 'value', 'caption'];
80
+ /**
81
+ * Card-framed KPI tile: one `<cngx-stat-card>` renders a complete dashboard
82
+ * metric - card surface, coordinated stat slots, an inline visualisation, a
83
+ * footer, and the async view switch - from a single `[state]`.
84
+ *
85
+ * The stat slots are the existing `cngxStatLabel` / `cngxStatValue` /
86
+ * `cngxStatDelta` / `cngxStatCaption` atoms from `@cngx/common/data`, not
87
+ * copies. They resolve `CNGX_STAT` against their declaration site, so the card
88
+ * hosts the same {@link CngxStatCoordinator} brain `CngxStat` hosts and
89
+ * re-points the token at it - the shape `CngxIncrementalList` uses for
90
+ * `CNGX_PAGINATOR_HOST`. A screen reader therefore reads the tile as one
91
+ * phrase, not four fragments (Pillar 2).
92
+ *
93
+ * The view switch is a pure `computed()` off `[state]` via `resolveAsyncView`
94
+ * (Pillar 1) - there is no second state machine and no boolean fallback inputs.
95
+ *
96
+ * Like `cngx-chart`, the card does **not** provide `CNGX_STATEFUL`: the
97
+ * consumer already holds the state object it bound, so transition bridges take
98
+ * it directly, e.g. `<cngx-toast-on [state]="revenue" />`.
99
+ *
100
+ * ```html
101
+ * <cngx-stat-card [state]="revenue">
102
+ * <span cngxStatLabel>Revenue</span>
103
+ * <cngx-metric cngxStatValue [value]="1.2" unit="M EUR" />
104
+ * <cngx-delta cngxStatDelta [value]="5.3" />
105
+ * <span cngxStatCaption>vs. last quarter</span>
106
+ * <cngx-sparkline cngxStatCardViz [data]="trend()" />
107
+ * </cngx-stat-card>
108
+ * ```
109
+ *
110
+ * @category ui/stat-card
111
+ * @docsKind primary
112
+ * @wcag AA
113
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/stat-card.component.ts
114
+ * @since 0.1.0
115
+ * @relatedTo CngxStat, CngxStatCoordinator, CngxStatCardViz, CngxStatCardFooter, CngxCard
116
+ *
117
+ * <example-url>http://localhost:4200/#/ui/stat-card/basic/composed-kpi-tile</example-url>
118
+ * <example-url>http://localhost:4200/#/ui/stat-card/async/latency-aware-loading</example-url>
119
+ * <example-url>http://localhost:4200/#/ui/stat-card/async/error-and-refresh</example-url>
120
+ */
121
+ class CngxStatCard {
122
+ /** @internal The shared slot-id brain, applied as a host directive. */
123
+ coordinator = inject(CngxStatCoordinator, { host: true });
124
+ config = injectStatCardConfig();
125
+ /**
126
+ * The tile's async envelope. Every view decision derives from it; there are
127
+ * no discrete `loading` / `error` boolean fallbacks. Optional per the
128
+ * bridge-input rule, so `[state]` may be bound conditionally.
129
+ */
130
+ state = input(undefined, { ...(ngDevMode ? { debugName: "state" } : /* istanbul ignore next */ {}), transform: (v) => (typeof v === 'string' ? undefined : v) });
131
+ /**
132
+ * What the card shows while it loads. `'auto'` (default) picks from the
133
+ * latency the tile itself observed: a tile whose last load was quick shows a
134
+ * spinner blip, one whose last load dragged shows a skeleton. `'spinner'` and
135
+ * `'skeleton'` pin the choice.
136
+ */
137
+ loadingTreatment = input(this.config.loadingTreatment ?? 'auto', ...(ngDevMode ? [{ debugName: "loadingTreatment" }] : /* istanbul ignore next */ []));
138
+ /** Accessible label announced while the card is loading. */
139
+ busyLabel = input(this.config.ariaLabels?.busy ?? 'Loading', ...(ngDevMode ? [{ debugName: "busyLabel" }] : /* istanbul ignore next */ []));
140
+ /** Headline of the error state shown instead of the stat when the first load failed. */
141
+ errorText = input(this.config.ariaLabels?.errorFallback ?? 'Could not load', ...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
142
+ /** Supporting detail under {@link errorText}. Omitted when unset. */
143
+ errorDescription = input(this.config.ariaLabels?.errorDescription, ...(ngDevMode ? [{ debugName: "errorDescription" }] : /* istanbul ignore next */ []));
144
+ /** Note appended below the stat when a refresh failed but stale data is still shown. */
145
+ staleText = input(this.config.ariaLabels?.staleFallback ?? 'Showing last known value', ...(ngDevMode ? [{ debugName: "staleText" }] : /* istanbul ignore next */ []));
146
+ /**
147
+ * Politeness of the tile's live region. `off` (default) for a static KPI;
148
+ * `polite` for a tile that refreshes on a timer, so the new figure is
149
+ * announced instead of changing silently. Mirrors `CngxStat.live`.
150
+ */
151
+ live = input('off', ...(ngDevMode ? [{ debugName: "live" }] : /* istanbul ignore next */ []));
152
+ /** @internal Whether any operation is running. Drives `aria-busy` (Pillar 2). */
153
+ busy = computed(() => this.state()?.isBusy() ?? false, ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
154
+ /**
155
+ * @internal A refresh over content the user can still read. The skeleton and
156
+ * spinner branches already carry their own busy signal, so the bar would be
157
+ * redundant there.
158
+ */
159
+ /**
160
+ * @internal Which bars the placeholder draws. Mirrors the slots the consumer
161
+ * actually projected, so a tile without a delta gets no delta bar. Falls back
162
+ * to the common label / value / caption shape when nothing has registered -
163
+ * a card with no stat slots at all still needs a plausible placeholder.
164
+ */
165
+ skeletonSlots = computed(() => {
166
+ const present = this.coordinator.presentKinds();
167
+ return present.length > 0 ? present : DEFAULT_SKELETON_SLOTS;
168
+ }, ...(ngDevMode ? [{ debugName: "skeletonSlots" }] : /* istanbul ignore next */ []));
169
+ showRefreshIndicator = computed(() => this.busy() && this.activeView() !== 'skeleton', ...(ngDevMode ? [{ debugName: "showRefreshIndicator" }] : /* istanbul ignore next */ []));
170
+ loadingConfig = injectLoadingConfig();
171
+ /**
172
+ * Measures how long this tile's own busy windows last. The measurement is a
173
+ * wall-clock sample the probe writes from an effect; the selection below stays
174
+ * a pure `computed()`, so nothing in the reactive graph writes state.
175
+ */
176
+ probe = createLatencyProbe(() => this.busy());
177
+ /**
178
+ * Spinner or skeleton for the current load, from the observed latency and the
179
+ * cascaded cutoff. Never a hardcoded millisecond threshold - the cutoff always
180
+ * comes from `CNGX_LOADING_CONFIG`, so one `provideLoadingConfig(...)` retunes
181
+ * every tile in the app.
182
+ */
183
+ resolvedTreatment = computed(() => resolveLoadingTreatment(this.loadingTreatment(), this.probe.lastDuration(), this.loadingConfig.spinnerVsSkeletonCutoff), ...(ngDevMode ? [{ debugName: "resolvedTreatment" }] : /* istanbul ignore next */ []));
184
+ /**
185
+ * Which body the card renders. Delegates to the shared `resolveAsyncView`
186
+ * lookup table so the tile cannot drift from every other async surface.
187
+ * Without a bound `[state]` the card always shows its content.
188
+ */
189
+ /**
190
+ * @internal The card element carries the accessible name, so the tile is one
191
+ * named region instead of an unnamed `article` wrapped around a named group.
192
+ * Null while the stat is not rendered: the slot ids live inside the content
193
+ * branch, and pointing at ids that are out of the DOM reads as unnamed anyway.
194
+ */
195
+ cardLabelledBy = computed(() => {
196
+ const view = this.activeView();
197
+ return view === 'skeleton' || view === 'error' ? null : this.coordinator.labelledBy();
198
+ }, ...(ngDevMode ? [{ debugName: "cardLabelledBy" }] : /* istanbul ignore next */ []));
199
+ activeView = computed(() => {
200
+ const s = this.state();
201
+ if (!s) {
202
+ return 'content';
203
+ }
204
+ return resolveAsyncView(s.status(), s.isFirstLoad(), s.isEmpty());
205
+ }, ...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
206
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
207
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStatCard, isStandalone: true, selector: "cngx-stat-card", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, loadingTreatment: { classPropertyName: "loadingTreatment", publicName: "loadingTreatment", isSignal: true, isRequired: false, transformFunction: null }, busyLabel: { classPropertyName: "busyLabel", publicName: "busyLabel", isSignal: true, isRequired: false, transformFunction: null }, errorText: { classPropertyName: "errorText", publicName: "errorText", isSignal: true, isRequired: false, transformFunction: null }, errorDescription: { classPropertyName: "errorDescription", publicName: "errorDescription", isSignal: true, isRequired: false, transformFunction: null }, staleText: { classPropertyName: "staleText", publicName: "staleText", isSignal: true, isRequired: false, transformFunction: null }, live: { classPropertyName: "live", publicName: "live", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-busy": "busy() || null", "class.cngx-stat-card--busy": "busy()" }, classAttribute: "cngx-stat-card" }, providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }], hostDirectives: [{ directive: i1.CngxStatCoordinator }], ngImport: i0, template: `
208
+ <cngx-card
209
+ [attr.aria-labelledby]="cardLabelledBy()"
210
+ [attr.aria-live]="live() === 'off' ? null : live()"
211
+ >
212
+ <!-- A refresh over existing content would otherwise be invisible: the view
213
+ stays 'content' and only aria-busy flips, which says nothing to a
214
+ sighted user. The indicator is absolutely placed and the figure only
215
+ dims, so the tile never reflows while refreshing - a dashboard grid
216
+ would otherwise twitch on every poll. It carries the loading config's
217
+ show-delay and min-dwell, so a fast refresh never flashes. -->
218
+ @if (showRefreshIndicator()) {
219
+ <cngx-loading-indicator
220
+ class="cngx-stat-card__refresh"
221
+ [loading]="true"
222
+ variant="spinner"
223
+ [label]="busyLabel()"
224
+ />
225
+ }
226
+
227
+ @switch (activeView()) {
228
+ @case ('skeleton') {
229
+ @if (resolvedTreatment() === 'skeleton') {
230
+ <!-- Same container and same row structure as the content branch, so
231
+ each bar sits exactly where its text will, and the swap to
232
+ content does not resize the tile. -->
233
+ <div
234
+ class="cngx-stat-card__stat cngx-stat-card__stat--skeleton"
235
+ [cngxSkeleton]="true"
236
+ aria-hidden="true"
237
+ >
238
+ @if (skeletonSlots().includes('label')) {
239
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--label">
240
+ </span>
241
+ }
242
+ <div class="cngx-stat-card__row">
243
+ @if (skeletonSlots().includes('value')) {
244
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--value">
245
+ </span>
246
+ }
247
+ @if (skeletonSlots().includes('delta')) {
248
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--delta">
249
+ </span>
250
+ }
251
+ </div>
252
+ @if (skeletonSlots().includes('caption')) {
253
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--caption">
254
+ </span>
255
+ }
256
+ </div>
257
+ } @else {
258
+ <div class="cngx-stat-card__spinner">
259
+ <cngx-loading-indicator [loading]="true" variant="spinner" [label]="busyLabel()" />
260
+ </div>
261
+ }
262
+ }
263
+ @case ('error') {
264
+ <cngx-empty-state
265
+ class="cngx-stat-card__error"
266
+ [title]="errorText()"
267
+ [description]="errorDescription()"
268
+ >
269
+ <!-- The stock empty-state glyph is an archive box, which reads
270
+ "nothing here" rather than "this failed". Projecting into the
271
+ icon slot hides it. Decorative: the title carries the message. -->
272
+ <svg
273
+ cngxEmptyStateIcon
274
+ class="cngx-stat-card__error-icon"
275
+ aria-hidden="true"
276
+ viewBox="0 0 24 24"
277
+ fill="none"
278
+ stroke="currentColor"
279
+ stroke-width="1.5"
280
+ stroke-linecap="round"
281
+ stroke-linejoin="round"
282
+ >
283
+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
284
+ <path d="M12 9v4" />
285
+ <path d="M12 17h.01" />
286
+ </svg>
287
+ </cngx-empty-state>
288
+ }
289
+ @default {
290
+ <div class="cngx-stat-card__stat">
291
+ <ng-content select="[cngxStatLabel]" />
292
+ <div class="cngx-stat-card__row">
293
+ <ng-content select="[cngxStatValue]" />
294
+ <ng-content select="[cngxStatDelta]" />
295
+ </div>
296
+ <ng-content select="[cngxStatCaption]" />
297
+ </div>
298
+
299
+ <ng-content select="[cngxStatCardViz]" />
300
+
301
+ @if (activeView() === 'content+error') {
302
+ <p class="cngx-stat-card__stale">{{ staleText() }}</p>
303
+ }
304
+ }
305
+ }
306
+
307
+ <ng-content select="[cngxStatCardFooter]" />
308
+ </cngx-card>
309
+ `, isInline: true, styles: ["@layer cngx.tokens{.cngx-stat-card{display:block;position:relative;--cngx-stat-card-gap: var(--cngx-space-sm, .5rem);--cngx-stat-card-row-gap: var(--cngx-space-xs, .25rem);--cngx-stat-card-viz-margin: var(--cngx-space-sm, .5rem);--cngx-stat-card-footer-padding: var(--cngx-space-xs, .25rem);--cngx-stat-card-refresh-inset: var(--cngx-space-sm, .5rem);--cngx-stat-card-body-min-height: 6rem}}@layer cngx.components{@scope(.cngx-stat-card){.cngx-stat-card__stat,.cngx-stat-card__spinner,.cngx-stat-card__error{min-block-size:var(--cngx-stat-card-body-min-height)}.cngx-stat-card__stat{display:flex;flex-direction:column;justify-content:center;gap:var(--cngx-stat-card-gap)}.cngx-stat-card__row{display:flex;align-items:baseline;gap:var(--cngx-stat-card-row-gap);flex-wrap:wrap}.cngx-stat-card__viz{display:block;margin-block-start:var(--cngx-stat-card-viz-margin)}.cngx-stat-card__footer{display:flex;align-items:center;gap:var(--cngx-stat-card-row-gap);padding-block-start:var(--cngx-stat-card-footer-padding);font-size:var(--cngx-stat-card-footer-size, .8125rem);color:var(--cngx-stat-card-footer-color, var(--cngx-color-text-muted, oklch(.5 .01 250)))}.cngx-stat-card__footer .cngx-card-timestamp{font-size:inherit;color:inherit}.cngx-stat-card__error.cngx-empty-state{--cngx-empty-padding: 0px;--cngx-empty-gap: var(--cngx-space-xs, .25rem);--cngx-empty-title-size: var(--cngx-stat-card-error-title-size, .9375rem);display:flex;flex-direction:column;justify-content:center;text-align:center;color:var(--cngx-stat-card-error-color, var(--cngx-color-danger, oklch(.6 .18 25)))}.cngx-stat-card__error .cngx-empty-state__title{color:inherit}.cngx-stat-card__error-icon{inline-size:var(--cngx-stat-card-error-icon-size, 22px);block-size:var(--cngx-stat-card-error-icon-size, 22px);opacity:var(--cngx-stat-card-error-icon-opacity, .85)}.cngx-stat-card__refresh{position:absolute;inset-block-start:var(--cngx-stat-card-refresh-inset);inset-inline-end:var(--cngx-stat-card-refresh-inset);pointer-events:none}.cngx-stat-card__refresh .cngx-loading-indicator__spinner{--cngx-loading-indicator-size: var(--cngx-stat-card-refresh-size, 14px)}.cngx-stat-card__stale{display:flex;align-items:center;gap:var(--cngx-stat-card-row-gap);margin:0;margin-block-start:var(--cngx-stat-card-row-gap);font-size:var(--cngx-stat-card-stale-size, .8125rem);color:var(--cngx-stat-card-stale-color, var(--cngx-color-danger, oklch(.6 .18 25)))}.cngx-stat-card__stale:before{content:\"!\" / \"\";flex:none;display:grid;place-items:center;inline-size:var(--cngx-stat-card-stale-glyph-size, 1rem);block-size:var(--cngx-stat-card-stale-glyph-size, 1rem);border-radius:50%;font-size:var(--cngx-stat-card-stale-glyph-font-size, .75rem);font-weight:700;line-height:1;color:var(--cngx-stat-card-stale-glyph-color, var(--cngx-color-surface, oklch(1 0 0)));background:var(--cngx-stat-card-stale-color, var(--cngx-color-danger, oklch(.6 .18 25)))}.cngx-stat-card__spinner{display:flex;align-items:center;justify-content:center}.cngx-stat-card__skeleton-line{--cngx-stat-card-skeleton-base: var( --cngx-stat-card-skeleton-color, var(--cngx-skeleton-bg, var(--cngx-color-border, oklch(.88 .005 250))) );display:block;border-radius:var(--cngx-stat-card-skeleton-radius, var(--cngx-radius-sm, 6px));background:var(--cngx-stat-card-skeleton-base)}.cngx-stat-card__stat--skeleton.cngx-skeleton--shimmer .cngx-stat-card__skeleton-line{background-image:linear-gradient(90deg,var(--cngx-stat-card-skeleton-base) 0%,var( --cngx-skeleton-shimmer-color, color-mix(in oklch, var(--cngx-stat-card-skeleton-base), white 18%) ) 50%,var(--cngx-stat-card-skeleton-base) 100%);background-size:200% 100%;animation:cngx-stat-card-shimmer var(--cngx-skeleton-shimmer-duration, 1.5s) ease-in-out infinite}.cngx-stat-card__skeleton-line--label{inline-size:var(--cngx-stat-card-skeleton-label-width, 45%);block-size:1lh}.cngx-stat-card__skeleton-line--value{inline-size:var(--cngx-stat-card-skeleton-value-width, 55%);font-size:var(--cngx-metric-value-size, 1.75rem);line-height:1.2;block-size:1lh}.cngx-stat-card__skeleton-line--delta{inline-size:var(--cngx-stat-card-skeleton-delta-width, 3rem);block-size:1lh}.cngx-stat-card__skeleton-line--caption{inline-size:var(--cngx-stat-card-skeleton-caption-width, 65%);block-size:1lh}}}@keyframes cngx-stat-card-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}\n"], dependencies: [{ kind: "component", type: CngxCard, selector: "cngx-card", inputs: ["as", "href", "ariaLabel", "selected", "selectable", "loading", "disabled", "disabledReason"], outputs: ["selectedChange", "clicked"] }, { kind: "directive", type: CngxSkeleton, selector: "[cngxSkeleton]", inputs: ["cngxSkeleton", "shimmer", "count"], exportAs: ["cngxSkeleton"] }, { kind: "component", type: CngxLoadingIndicator, selector: "cngx-loading-indicator", inputs: ["state", "loading", "variant", "label", "delay", "minDwell", "minDuration"] }, { kind: "component", type: CngxEmptyState, selector: "cngx-empty-state", inputs: ["title", "description", "state"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
310
+ }
311
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCard, decorators: [{
312
+ type: Component,
313
+ args: [{ selector: 'cngx-stat-card', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxCard, CngxSkeleton, CngxLoadingIndicator, CngxEmptyState], hostDirectives: [CngxStatCoordinator], providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }], host: {
314
+ class: 'cngx-stat-card',
315
+ '[attr.aria-busy]': 'busy() || null',
316
+ '[class.cngx-stat-card--busy]': 'busy()',
317
+ }, template: `
318
+ <cngx-card
319
+ [attr.aria-labelledby]="cardLabelledBy()"
320
+ [attr.aria-live]="live() === 'off' ? null : live()"
321
+ >
322
+ <!-- A refresh over existing content would otherwise be invisible: the view
323
+ stays 'content' and only aria-busy flips, which says nothing to a
324
+ sighted user. The indicator is absolutely placed and the figure only
325
+ dims, so the tile never reflows while refreshing - a dashboard grid
326
+ would otherwise twitch on every poll. It carries the loading config's
327
+ show-delay and min-dwell, so a fast refresh never flashes. -->
328
+ @if (showRefreshIndicator()) {
329
+ <cngx-loading-indicator
330
+ class="cngx-stat-card__refresh"
331
+ [loading]="true"
332
+ variant="spinner"
333
+ [label]="busyLabel()"
334
+ />
335
+ }
336
+
337
+ @switch (activeView()) {
338
+ @case ('skeleton') {
339
+ @if (resolvedTreatment() === 'skeleton') {
340
+ <!-- Same container and same row structure as the content branch, so
341
+ each bar sits exactly where its text will, and the swap to
342
+ content does not resize the tile. -->
343
+ <div
344
+ class="cngx-stat-card__stat cngx-stat-card__stat--skeleton"
345
+ [cngxSkeleton]="true"
346
+ aria-hidden="true"
347
+ >
348
+ @if (skeletonSlots().includes('label')) {
349
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--label">
350
+ </span>
351
+ }
352
+ <div class="cngx-stat-card__row">
353
+ @if (skeletonSlots().includes('value')) {
354
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--value">
355
+ </span>
356
+ }
357
+ @if (skeletonSlots().includes('delta')) {
358
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--delta">
359
+ </span>
360
+ }
361
+ </div>
362
+ @if (skeletonSlots().includes('caption')) {
363
+ <span class="cngx-stat-card__skeleton-line cngx-stat-card__skeleton-line--caption">
364
+ </span>
365
+ }
366
+ </div>
367
+ } @else {
368
+ <div class="cngx-stat-card__spinner">
369
+ <cngx-loading-indicator [loading]="true" variant="spinner" [label]="busyLabel()" />
370
+ </div>
371
+ }
372
+ }
373
+ @case ('error') {
374
+ <cngx-empty-state
375
+ class="cngx-stat-card__error"
376
+ [title]="errorText()"
377
+ [description]="errorDescription()"
378
+ >
379
+ <!-- The stock empty-state glyph is an archive box, which reads
380
+ "nothing here" rather than "this failed". Projecting into the
381
+ icon slot hides it. Decorative: the title carries the message. -->
382
+ <svg
383
+ cngxEmptyStateIcon
384
+ class="cngx-stat-card__error-icon"
385
+ aria-hidden="true"
386
+ viewBox="0 0 24 24"
387
+ fill="none"
388
+ stroke="currentColor"
389
+ stroke-width="1.5"
390
+ stroke-linecap="round"
391
+ stroke-linejoin="round"
392
+ >
393
+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
394
+ <path d="M12 9v4" />
395
+ <path d="M12 17h.01" />
396
+ </svg>
397
+ </cngx-empty-state>
398
+ }
399
+ @default {
400
+ <div class="cngx-stat-card__stat">
401
+ <ng-content select="[cngxStatLabel]" />
402
+ <div class="cngx-stat-card__row">
403
+ <ng-content select="[cngxStatValue]" />
404
+ <ng-content select="[cngxStatDelta]" />
405
+ </div>
406
+ <ng-content select="[cngxStatCaption]" />
407
+ </div>
408
+
409
+ <ng-content select="[cngxStatCardViz]" />
410
+
411
+ @if (activeView() === 'content+error') {
412
+ <p class="cngx-stat-card__stale">{{ staleText() }}</p>
413
+ }
414
+ }
415
+ }
416
+
417
+ <ng-content select="[cngxStatCardFooter]" />
418
+ </cngx-card>
419
+ `, styles: ["@layer cngx.tokens{.cngx-stat-card{display:block;position:relative;--cngx-stat-card-gap: var(--cngx-space-sm, .5rem);--cngx-stat-card-row-gap: var(--cngx-space-xs, .25rem);--cngx-stat-card-viz-margin: var(--cngx-space-sm, .5rem);--cngx-stat-card-footer-padding: var(--cngx-space-xs, .25rem);--cngx-stat-card-refresh-inset: var(--cngx-space-sm, .5rem);--cngx-stat-card-body-min-height: 6rem}}@layer cngx.components{@scope(.cngx-stat-card){.cngx-stat-card__stat,.cngx-stat-card__spinner,.cngx-stat-card__error{min-block-size:var(--cngx-stat-card-body-min-height)}.cngx-stat-card__stat{display:flex;flex-direction:column;justify-content:center;gap:var(--cngx-stat-card-gap)}.cngx-stat-card__row{display:flex;align-items:baseline;gap:var(--cngx-stat-card-row-gap);flex-wrap:wrap}.cngx-stat-card__viz{display:block;margin-block-start:var(--cngx-stat-card-viz-margin)}.cngx-stat-card__footer{display:flex;align-items:center;gap:var(--cngx-stat-card-row-gap);padding-block-start:var(--cngx-stat-card-footer-padding);font-size:var(--cngx-stat-card-footer-size, .8125rem);color:var(--cngx-stat-card-footer-color, var(--cngx-color-text-muted, oklch(.5 .01 250)))}.cngx-stat-card__footer .cngx-card-timestamp{font-size:inherit;color:inherit}.cngx-stat-card__error.cngx-empty-state{--cngx-empty-padding: 0px;--cngx-empty-gap: var(--cngx-space-xs, .25rem);--cngx-empty-title-size: var(--cngx-stat-card-error-title-size, .9375rem);display:flex;flex-direction:column;justify-content:center;text-align:center;color:var(--cngx-stat-card-error-color, var(--cngx-color-danger, oklch(.6 .18 25)))}.cngx-stat-card__error .cngx-empty-state__title{color:inherit}.cngx-stat-card__error-icon{inline-size:var(--cngx-stat-card-error-icon-size, 22px);block-size:var(--cngx-stat-card-error-icon-size, 22px);opacity:var(--cngx-stat-card-error-icon-opacity, .85)}.cngx-stat-card__refresh{position:absolute;inset-block-start:var(--cngx-stat-card-refresh-inset);inset-inline-end:var(--cngx-stat-card-refresh-inset);pointer-events:none}.cngx-stat-card__refresh .cngx-loading-indicator__spinner{--cngx-loading-indicator-size: var(--cngx-stat-card-refresh-size, 14px)}.cngx-stat-card__stale{display:flex;align-items:center;gap:var(--cngx-stat-card-row-gap);margin:0;margin-block-start:var(--cngx-stat-card-row-gap);font-size:var(--cngx-stat-card-stale-size, .8125rem);color:var(--cngx-stat-card-stale-color, var(--cngx-color-danger, oklch(.6 .18 25)))}.cngx-stat-card__stale:before{content:\"!\" / \"\";flex:none;display:grid;place-items:center;inline-size:var(--cngx-stat-card-stale-glyph-size, 1rem);block-size:var(--cngx-stat-card-stale-glyph-size, 1rem);border-radius:50%;font-size:var(--cngx-stat-card-stale-glyph-font-size, .75rem);font-weight:700;line-height:1;color:var(--cngx-stat-card-stale-glyph-color, var(--cngx-color-surface, oklch(1 0 0)));background:var(--cngx-stat-card-stale-color, var(--cngx-color-danger, oklch(.6 .18 25)))}.cngx-stat-card__spinner{display:flex;align-items:center;justify-content:center}.cngx-stat-card__skeleton-line{--cngx-stat-card-skeleton-base: var( --cngx-stat-card-skeleton-color, var(--cngx-skeleton-bg, var(--cngx-color-border, oklch(.88 .005 250))) );display:block;border-radius:var(--cngx-stat-card-skeleton-radius, var(--cngx-radius-sm, 6px));background:var(--cngx-stat-card-skeleton-base)}.cngx-stat-card__stat--skeleton.cngx-skeleton--shimmer .cngx-stat-card__skeleton-line{background-image:linear-gradient(90deg,var(--cngx-stat-card-skeleton-base) 0%,var( --cngx-skeleton-shimmer-color, color-mix(in oklch, var(--cngx-stat-card-skeleton-base), white 18%) ) 50%,var(--cngx-stat-card-skeleton-base) 100%);background-size:200% 100%;animation:cngx-stat-card-shimmer var(--cngx-skeleton-shimmer-duration, 1.5s) ease-in-out infinite}.cngx-stat-card__skeleton-line--label{inline-size:var(--cngx-stat-card-skeleton-label-width, 45%);block-size:1lh}.cngx-stat-card__skeleton-line--value{inline-size:var(--cngx-stat-card-skeleton-value-width, 55%);font-size:var(--cngx-metric-value-size, 1.75rem);line-height:1.2;block-size:1lh}.cngx-stat-card__skeleton-line--delta{inline-size:var(--cngx-stat-card-skeleton-delta-width, 3rem);block-size:1lh}.cngx-stat-card__skeleton-line--caption{inline-size:var(--cngx-stat-card-skeleton-caption-width, 65%);block-size:1lh}}}@keyframes cngx-stat-card-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}\n"] }]
420
+ }], propDecorators: { state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], loadingTreatment: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingTreatment", required: false }] }], busyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "busyLabel", required: false }] }], errorText: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorText", required: false }] }], errorDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorDescription", required: false }] }], staleText: [{ type: i0.Input, args: [{ isSignal: true, alias: "staleText", required: false }] }], live: [{ type: i0.Input, args: [{ isSignal: true, alias: "live", required: false }] }] } });
421
+
422
+ /**
423
+ * Marks the inline visualisation of a {@link CngxStatCard} - a `cngx-sparkline`,
424
+ * `cngx-mini-area`, `cngx-deviation-bar`, or any other compact chart preset.
425
+ *
426
+ * Rendered beside the stat block and outside its `aria-labelledby` chain: the
427
+ * accessible name stays the numbers a screen reader can actually read, while
428
+ * the viz stays decorative unless the projected preset carries its own
429
+ * accessible name.
430
+ *
431
+ * @category ui/stat-card
432
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/stat-card-slots.ts
433
+ * @since 0.1.0
434
+ * @relatedTo CngxStatCard, CngxStatCardFooter
435
+ */
436
+ class CngxStatCardViz {
437
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCardViz, deps: [], target: i0.ɵɵFactoryTarget.Directive });
438
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxStatCardViz, isStandalone: true, selector: "[cngxStatCardViz]", host: { classAttribute: "cngx-stat-card__viz" }, ngImport: i0 });
439
+ }
440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCardViz, decorators: [{
441
+ type: Directive,
442
+ args: [{
443
+ selector: '[cngxStatCardViz]',
444
+ standalone: true,
445
+ host: { class: 'cngx-stat-card__viz' },
446
+ }]
447
+ }] });
448
+ /**
449
+ * Marks the footer row of a {@link CngxStatCard} - a timestamp, a drill-down
450
+ * link, a `cngx-tag` row. Rendered below the stat block and the viz slot.
451
+ *
452
+ * @category ui/stat-card
453
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/stat-card/stat-card-slots.ts
454
+ * @since 0.1.0
455
+ * @relatedTo CngxStatCard, CngxStatCardViz
456
+ */
457
+ class CngxStatCardFooter {
458
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCardFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
459
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxStatCardFooter, isStandalone: true, selector: "[cngxStatCardFooter]", host: { classAttribute: "cngx-stat-card__footer" }, ngImport: i0 });
460
+ }
461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCardFooter, decorators: [{
462
+ type: Directive,
463
+ args: [{
464
+ selector: '[cngxStatCardFooter]',
465
+ standalone: true,
466
+ host: { class: 'cngx-stat-card__footer' },
467
+ }]
468
+ }] });
469
+
470
+ /**
471
+ * Reduces a list of feature objects into a partial config - last write wins
472
+ * per sub-tree. Inner objects are spread-merged so partial overrides compose
473
+ * cleanly with prior writes.
474
+ *
475
+ * @internal
476
+ */
477
+ function reduceFeatures(features) {
478
+ const out = {};
479
+ for (const f of features) {
480
+ switch (f.kind) {
481
+ case 'ariaLabels':
482
+ out.ariaLabels = { ...out.ariaLabels, ...f.payload };
483
+ break;
484
+ case 'loadingTreatment':
485
+ out.loadingTreatment = f.payload.loadingTreatment;
486
+ break;
487
+ }
488
+ }
489
+ return out;
490
+ }
491
+ /**
492
+ * Two-level deep merge: the nested `ariaLabels` sub-tree is spread-merged so a
493
+ * partial fills in missing keys without nuking the rest; the flat top-level
494
+ * scalar `loadingTreatment` takes the partial when present, else the base.
495
+ *
496
+ * @internal
497
+ */
498
+ function mergeConfig(base, partial) {
499
+ return {
500
+ ariaLabels: { ...base.ariaLabels, ...partial.ariaLabels },
501
+ loadingTreatment: partial.loadingTreatment ?? base.loadingTreatment,
502
+ };
503
+ }
504
+ /**
505
+ * Application-root configuration cascade for the stat-card. Pass any
506
+ * combination of `withStatCardAriaLabels` and `withStatCardLoadingTreatment`
507
+ * in `bootstrapApplication`'s providers array.
508
+ *
509
+ * ```ts
510
+ * bootstrapApplication(AppComponent, {
511
+ * providers: [
512
+ * provideStatCardConfig(
513
+ * withStatCardAriaLabels({ errorFallback: 'Kennzahl nicht verfügbar' }),
514
+ * withStatCardLoadingTreatment('skeleton'),
515
+ * ),
516
+ * ],
517
+ * });
518
+ * ```
519
+ *
520
+ * @category ui/stat-card
521
+ * @since 0.1.0
522
+ */
523
+ function provideStatCardConfig(...features) {
524
+ // Empty-features: skip the override so the root factory's
525
+ // CNGX_STAT_CARD_DEFAULTS reference flows through untouched. A fresh
526
+ // mergeConfig(...) would allocate identical content under a new reference
527
+ // and bust downstream identity comparisons.
528
+ if (features.length === 0) {
529
+ return makeEnvironmentProviders([]);
530
+ }
531
+ const partial = reduceFeatures(features);
532
+ return makeEnvironmentProviders([
533
+ {
534
+ provide: CNGX_STAT_CARD_CONFIG,
535
+ useValue: mergeConfig(CNGX_STAT_CARD_DEFAULTS, partial),
536
+ },
537
+ ]);
538
+ }
539
+ /**
540
+ * Component-scoped configuration cascade for the stat-card. Pass any
541
+ * combination of feature factories in a parent component's `viewProviders`.
542
+ *
543
+ * Unlike `provideStatCardConfig` (root-only), this injects the parent
544
+ * injector's `CNGX_STAT_CARD_CONFIG` value and deep-merges the supplied
545
+ * features on top. Descendant tiles see the merged config; sibling sub-trees
546
+ * keep the inherited value untouched.
547
+ *
548
+ * ```ts
549
+ * @Component({
550
+ * viewProviders: [provideStatCardConfigAt(withStatCardLoadingTreatment('spinner'))],
551
+ * template: '<cngx-stat-card [state]="s" />',
552
+ * })
553
+ * class LiveTiles {}
554
+ * ```
555
+ *
556
+ * @category ui/stat-card
557
+ * @since 0.1.0
558
+ */
559
+ function provideStatCardConfigAt(...features) {
560
+ // Empty-features call: parent value flows through untouched. Skipping the
561
+ // factory preserves reference identity through the sub-tree.
562
+ if (features.length === 0) {
563
+ return [];
564
+ }
565
+ const partial = reduceFeatures(features);
566
+ return [
567
+ {
568
+ provide: CNGX_STAT_CARD_CONFIG,
569
+ useFactory: () => {
570
+ const parent = inject(CNGX_STAT_CARD_CONFIG, { skipSelf: true });
571
+ return mergeConfig(parent, partial);
572
+ },
573
+ },
574
+ ];
575
+ }
576
+
577
+ /**
578
+ * Override the stat-card's string fallbacks - the busy announcement, the
579
+ * first-load error message, and the stale-data note. Per-instance
580
+ * `[busyLabel]` / `[errorText]` / `[staleText]` bindings still win.
581
+ *
582
+ * Library defaults are English; this is the hook a localised app uses.
583
+ *
584
+ * ```ts
585
+ * provideStatCardConfig(
586
+ * withStatCardAriaLabels({ busy: 'Lädt', errorFallback: 'Nicht verfügbar' }),
587
+ * );
588
+ * ```
589
+ *
590
+ * @category ui/stat-card
591
+ * @since 0.1.0
592
+ */
593
+ function withStatCardAriaLabels(labels) {
594
+ return { kind: 'ariaLabels', payload: labels };
595
+ }
596
+ /**
597
+ * Move the cascade default for what a tile renders while it loads. `'auto'`
598
+ * (the library default) picks spinner vs skeleton from the latency the tile
599
+ * observed; `'spinner'` and `'skeleton'` pin it app-wide. Per-instance
600
+ * `[loadingTreatment]` still wins.
601
+ *
602
+ * @category ui/stat-card
603
+ * @since 0.1.0
604
+ */
605
+ function withStatCardLoadingTreatment(treatment) {
606
+ return { kind: 'loadingTreatment', payload: { loadingTreatment: treatment } };
607
+ }
608
+
609
+ /**
610
+ * @module @cngx/ui/stat-card
611
+ */
612
+
613
+ /**
614
+ * Generated bundle index. Do not edit.
615
+ */
616
+
617
+ export { CNGX_STAT_CARD_CONFIG, CngxStatCard, CngxStatCardFooter, CngxStatCardViz, injectStatCardConfig, provideStatCardConfig, provideStatCardConfigAt, withStatCardAriaLabels, withStatCardLoadingTreatment };
618
+ //# sourceMappingURL=cngx-ui-stat-card.mjs.map