@cngx/common 0.0.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -0
  3. package/a11y/README.md +77 -0
  4. package/card/README.md +79 -0
  5. package/chart/README.md +31 -0
  6. package/data/README.md +883 -0
  7. package/dialog/README.md +84 -0
  8. package/display/README.md +30 -0
  9. package/fesm2022/cngx-common-a11y.mjs +1260 -0
  10. package/fesm2022/cngx-common-a11y.mjs.map +1 -0
  11. package/fesm2022/cngx-common-card.mjs +765 -0
  12. package/fesm2022/cngx-common-card.mjs.map +1 -0
  13. package/fesm2022/cngx-common-chart.mjs +2943 -0
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -0
  15. package/fesm2022/cngx-common-data.mjs +2886 -0
  16. package/fesm2022/cngx-common-data.mjs.map +1 -0
  17. package/fesm2022/cngx-common-dialog.mjs +1366 -0
  18. package/fesm2022/cngx-common-dialog.mjs.map +1 -0
  19. package/fesm2022/cngx-common-display.mjs +1603 -0
  20. package/fesm2022/cngx-common-display.mjs.map +1 -0
  21. package/fesm2022/cngx-common-interactive.mjs +8185 -0
  22. package/fesm2022/cngx-common-interactive.mjs.map +1 -0
  23. package/fesm2022/cngx-common-layout.mjs +1335 -0
  24. package/fesm2022/cngx-common-layout.mjs.map +1 -0
  25. package/fesm2022/cngx-common-popover.mjs +1200 -0
  26. package/fesm2022/cngx-common-popover.mjs.map +1 -0
  27. package/fesm2022/cngx-common-stepper.mjs +1350 -0
  28. package/fesm2022/cngx-common-stepper.mjs.map +1 -0
  29. package/fesm2022/cngx-common-tabs.mjs +1551 -0
  30. package/fesm2022/cngx-common-tabs.mjs.map +1 -0
  31. package/fesm2022/cngx-common.mjs +34 -0
  32. package/fesm2022/cngx-common.mjs.map +1 -0
  33. package/interactive/README.md +211 -0
  34. package/layout/README.md +117 -0
  35. package/package.json +100 -0
  36. package/popover/README.md +218 -0
  37. package/stepper/README.md +102 -0
  38. package/tabs/README.md +32 -0
  39. package/types/cngx-common-a11y.d.ts +616 -0
  40. package/types/cngx-common-card.d.ts +413 -0
  41. package/types/cngx-common-chart.d.ts +1081 -0
  42. package/types/cngx-common-data.d.ts +1460 -0
  43. package/types/cngx-common-dialog.d.ts +772 -0
  44. package/types/cngx-common-display.d.ts +1136 -0
  45. package/types/cngx-common-interactive.d.ts +5013 -0
  46. package/types/cngx-common-layout.d.ts +737 -0
  47. package/types/cngx-common-popover.d.ts +520 -0
  48. package/types/cngx-common-stepper.d.ts +982 -0
  49. package/types/cngx-common-tabs.d.ts +1237 -0
  50. package/types/cngx-common.d.ts +13 -0
@@ -0,0 +1,765 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, input, model, computed, output, ViewEncapsulation, ChangeDetectionStrategy, Component, Directive, TemplateRef, contentChildren, LOCALE_ID } from '@angular/core';
3
+ import { nextUid } from '@cngx/core/utils';
4
+ import * as i1 from '@cngx/common/a11y';
5
+ import { CngxRovingTabindex, CngxRovingItem } from '@cngx/common/a11y';
6
+ import { NgTemplateOutlet } from '@angular/common';
7
+
8
+ /**
9
+ * Semantic card component that adapts its host element role based on the `as` input.
10
+ *
11
+ * Three archetypes:
12
+ * - `'article'` (default) — display card, no primary action
13
+ * - `'button'` — the entire card is a clickable button
14
+ * - `'link'` — the entire card is a navigation link
15
+ *
16
+ * The host element **is** the semantic element — no inner wrapper.
17
+ * This eliminates double focus rings and wrapper problems for screen readers.
18
+ *
19
+ * ### Action card with selection
20
+ * ```html
21
+ * <cngx-card as="button" [selectable]="true" [(selected)]="isSelected">
22
+ * <header cngxCardHeader><h3>Patient</h3></header>
23
+ * <div cngxCardBody>Details here</div>
24
+ * </cngx-card>
25
+ * ```
26
+ *
27
+ * ### Link card
28
+ * ```html
29
+ * <cngx-card as="link" href="/patients/42" ariaLabel="View patient">
30
+ * <img cngxCardMedia alt="Photo" />
31
+ * </cngx-card>
32
+ * ```
33
+ */
34
+ class CngxCard {
35
+ uid = nextUid('cngx-card');
36
+ rovingParent = inject(CngxRovingTabindex, {
37
+ optional: true,
38
+ skipSelf: true,
39
+ });
40
+ /** Semantic archetype: `'article'` (display), `'button'` (action), or `'link'` (navigation). */
41
+ cardType = input('article', { ...(ngDevMode ? { debugName: "cardType" } : /* istanbul ignore next */ {}), alias: 'as' });
42
+ /** Navigation URL when `as="link"`. Applied as `href` on the host. */
43
+ href = input(undefined, ...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
44
+ /** Accessible label for the card. Overrides the default screen reader announcement. */
45
+ ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
46
+ /** Two-way selection state. Only relevant when `selectable` is `true`. */
47
+ selected = model(false, ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
48
+ /** Whether the card supports selection toggling. */
49
+ selectable = input(false, ...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
50
+ /** Whether the card is in a loading state. Sets `aria-busy` and shows SR announcement. */
51
+ loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
52
+ /** Whether the card is disabled. Prevents interaction and sets `aria-disabled`. */
53
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
54
+ /** Explanation for why the card is disabled. Communicated to SR via `aria-describedby`. */
55
+ disabledReason = input(undefined, ...(ngDevMode ? [{ debugName: "disabledReason" }] : /* istanbul ignore next */ []));
56
+ /** Whether this card is interactive (button or link). */
57
+ interactive = computed(() => this.cardType() !== 'article', ...(ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []));
58
+ /** @internal Host href for link cards. */
59
+ hostHref = computed(() => this.cardType() === 'link' ? (this.href() ?? null) : null, ...(ngDevMode ? [{ debugName: "hostHref" }] : /* istanbul ignore next */ []));
60
+ /** @internal Host element ARIA role. */
61
+ hostRole = computed(() => {
62
+ switch (this.cardType()) {
63
+ case 'button':
64
+ return 'button';
65
+ case 'link':
66
+ return 'link';
67
+ default:
68
+ return 'article';
69
+ }
70
+ }, ...(ngDevMode ? [{ debugName: "hostRole" }] : /* istanbul ignore next */ []));
71
+ /**
72
+ * @internal Tabindex management.
73
+ * When inside a CngxRovingTabindex parent (e.g. CngxCardGrid), the roving
74
+ * controller manages tabindex via CngxRovingItem — card does not set its own.
75
+ * When standalone, interactive cards get tabindex="0".
76
+ */
77
+ hostTabindex = computed(() => {
78
+ if (this.rovingParent) {
79
+ return null;
80
+ }
81
+ return this.interactive() ? 0 : null;
82
+ }, ...(ngDevMode ? [{ debugName: "hostTabindex" }] : /* istanbul ignore next */ []));
83
+ /** @internal */
84
+ disabledReasonId = `${this.uid}-disabled-reason`;
85
+ /** @internal */
86
+ liveRegionId = `${this.uid}-live`;
87
+ /** @internal IDs for `aria-describedby` — always present, aria-hidden controls what SR reads. */
88
+ describedByIds = computed(() => {
89
+ const ids = [this.disabledReasonId];
90
+ return ids.join(' ');
91
+ }, ...(ngDevMode ? [{ debugName: "describedByIds" }] : /* istanbul ignore next */ []));
92
+ /** @internal SR live announcement for state changes. */
93
+ liveAnnouncement = computed(() => {
94
+ if (this.loading()) {
95
+ return 'Loading';
96
+ }
97
+ if (this.selectable() && this.selected()) {
98
+ return 'Selected';
99
+ }
100
+ if (this.selectable() && !this.selected()) {
101
+ return 'Deselected';
102
+ }
103
+ return '';
104
+ }, ...(ngDevMode ? [{ debugName: "liveAnnouncement" }] : /* istanbul ignore next */ []));
105
+ /** Emits when an interactive card is clicked or activated via keyboard. */
106
+ clicked = output();
107
+ /** @internal */
108
+ handleHostClick(e) {
109
+ if (!this.interactive()) {
110
+ return;
111
+ }
112
+ if (this.disabled()) {
113
+ e.preventDefault();
114
+ return;
115
+ }
116
+ if (this.selectable()) {
117
+ this.selected.update((v) => !v);
118
+ }
119
+ this.clicked.emit();
120
+ }
121
+ /** @internal */
122
+ handleHostKeydown(e) {
123
+ if (!this.interactive()) {
124
+ return;
125
+ }
126
+ if (this.disabled()) {
127
+ e.preventDefault();
128
+ return;
129
+ }
130
+ if (e.key === ' ') {
131
+ e.preventDefault();
132
+ }
133
+ if (this.selectable()) {
134
+ this.selected.update((v) => !v);
135
+ }
136
+ this.clicked.emit();
137
+ }
138
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
139
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxCard, isStandalone: true, selector: "cngx-card", inputs: { cardType: { classPropertyName: "cardType", publicName: "as", isSignal: true, isRequired: false, transformFunction: null }, href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReason: { classPropertyName: "disabledReason", publicName: "disabledReason", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", clicked: "clicked" }, host: { listeners: { "click": "handleHostClick($event)", "keydown.enter": "handleHostKeydown($event)", "keydown.space": "handleHostKeydown($event)" }, properties: { "attr.role": "hostRole()", "attr.tabindex": "hostTabindex()", "attr.href": "hostHref()", "attr.aria-label": "ariaLabel() || null", "attr.aria-busy": "loading() || null", "attr.aria-selected": "interactive() && selectable() ? selected() : null", "attr.aria-disabled": "disabled() || null", "attr.aria-describedby": "describedByIds()", "class.cngx-card--interactive": "interactive()", "class.cngx-card--selected": "selected()", "class.cngx-card--loading": "loading()", "class.cngx-card--disabled": "disabled()" }, classAttribute: "cngx-card" }, hostDirectives: [{ directive: i1.CngxRovingItem }], ngImport: i0, template: `
140
+ <ng-content select="[cngxCardMedia]" />
141
+ <ng-content select="header[cngxCardHeader]" />
142
+ <ng-content select="[cngxCardBody]" />
143
+ <ng-content select="footer[cngxCardFooter]" />
144
+ <ng-content select="[cngxCardActions]" />
145
+ <ng-content />
146
+
147
+ <span
148
+ [id]="disabledReasonId"
149
+ [attr.aria-hidden]="disabled() && disabledReason() ? null : true"
150
+ class="cngx-sr-only"
151
+ >
152
+ {{ disabledReason() }}
153
+ </span>
154
+
155
+ <span [id]="liveRegionId" aria-live="polite" aria-atomic="true" class="cngx-sr-only">
156
+ {{ liveAnnouncement() }}
157
+ </span>
158
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
159
+ }
160
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCard, decorators: [{
161
+ type: Component,
162
+ args: [{
163
+ selector: 'cngx-card',
164
+ standalone: true,
165
+ changeDetection: ChangeDetectionStrategy.OnPush,
166
+ encapsulation: ViewEncapsulation.None,
167
+ hostDirectives: [{ directive: CngxRovingItem, inputs: [], outputs: [] }],
168
+ host: {
169
+ class: 'cngx-card',
170
+ '[attr.role]': 'hostRole()',
171
+ '[attr.tabindex]': 'hostTabindex()',
172
+ '[attr.href]': 'hostHref()',
173
+ '[attr.aria-label]': 'ariaLabel() || null',
174
+ '[attr.aria-busy]': 'loading() || null',
175
+ '[attr.aria-selected]': 'interactive() && selectable() ? selected() : null',
176
+ '[attr.aria-disabled]': 'disabled() || null',
177
+ '[attr.aria-describedby]': 'describedByIds()',
178
+ '[class.cngx-card--interactive]': 'interactive()',
179
+ '[class.cngx-card--selected]': 'selected()',
180
+ '[class.cngx-card--loading]': 'loading()',
181
+ '[class.cngx-card--disabled]': 'disabled()',
182
+ '(click)': 'handleHostClick($event)',
183
+ '(keydown.enter)': 'handleHostKeydown($event)',
184
+ '(keydown.space)': 'handleHostKeydown($event)',
185
+ },
186
+ template: `
187
+ <ng-content select="[cngxCardMedia]" />
188
+ <ng-content select="header[cngxCardHeader]" />
189
+ <ng-content select="[cngxCardBody]" />
190
+ <ng-content select="footer[cngxCardFooter]" />
191
+ <ng-content select="[cngxCardActions]" />
192
+ <ng-content />
193
+
194
+ <span
195
+ [id]="disabledReasonId"
196
+ [attr.aria-hidden]="disabled() && disabledReason() ? null : true"
197
+ class="cngx-sr-only"
198
+ >
199
+ {{ disabledReason() }}
200
+ </span>
201
+
202
+ <span [id]="liveRegionId" aria-live="polite" aria-atomic="true" class="cngx-sr-only">
203
+ {{ liveAnnouncement() }}
204
+ </span>
205
+ `,
206
+ }]
207
+ }], propDecorators: { cardType: [{ type: i0.Input, args: [{ isSignal: true, alias: "as", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], disabledReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReason", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }] } });
208
+
209
+ /**
210
+ * Structural slot directive for the card header region.
211
+ *
212
+ * Must be placed on a native `<header>` element — the selector enforces
213
+ * semantic correctness at compile time.
214
+ *
215
+ * ```html
216
+ * <cngx-card>
217
+ * <header cngxCardHeader>
218
+ * <h3 cngxCardTitle>Title</h3>
219
+ * </header>
220
+ * </cngx-card>
221
+ * ```
222
+ */
223
+ class CngxCardHeader {
224
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
225
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxCardHeader, isStandalone: true, selector: "header[cngxCardHeader]", host: { classAttribute: "cngx-card__header" }, ngImport: i0 });
226
+ }
227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardHeader, decorators: [{
228
+ type: Directive,
229
+ args: [{
230
+ selector: 'header[cngxCardHeader]',
231
+ standalone: true,
232
+ host: { class: 'cngx-card__header' },
233
+ }]
234
+ }] });
235
+
236
+ /**
237
+ * Marks an element as the card's primary title.
238
+ *
239
+ * Provides consistent font sizing and weight. Typically placed on
240
+ * a heading element inside `[cngxCardHeader]`.
241
+ *
242
+ * ```html
243
+ * <cngx-card>
244
+ * <header cngxCardHeader>
245
+ * <h3 cngxCardTitle>Patient Overview</h3>
246
+ * <span cngxCardSubtitle>Room 12</span>
247
+ * </header>
248
+ * </cngx-card>
249
+ * ```
250
+ */
251
+ class CngxCardTitle {
252
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
253
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxCardTitle, isStandalone: true, selector: "[cngxCardTitle]", host: { classAttribute: "cngx-card__title" }, ngImport: i0 });
254
+ }
255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardTitle, decorators: [{
256
+ type: Directive,
257
+ args: [{
258
+ selector: '[cngxCardTitle]',
259
+ standalone: true,
260
+ host: { class: 'cngx-card__title' },
261
+ }]
262
+ }] });
263
+
264
+ /**
265
+ * Marks an element as the card's subtitle — secondary text below the title.
266
+ *
267
+ * ```html
268
+ * <cngx-card>
269
+ * <header cngxCardHeader>
270
+ * <h3 cngxCardTitle>Maria Muster</h3>
271
+ * <span cngxCardSubtitle>Zimmer 12, Station 3A</span>
272
+ * </header>
273
+ * </cngx-card>
274
+ * ```
275
+ */
276
+ class CngxCardSubtitle {
277
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardSubtitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
278
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxCardSubtitle, isStandalone: true, selector: "[cngxCardSubtitle]", host: { classAttribute: "cngx-card__subtitle" }, ngImport: i0 });
279
+ }
280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardSubtitle, decorators: [{
281
+ type: Directive,
282
+ args: [{
283
+ selector: '[cngxCardSubtitle]',
284
+ standalone: true,
285
+ host: { class: 'cngx-card__subtitle' },
286
+ }]
287
+ }] });
288
+
289
+ /**
290
+ * Structural slot directive for the card body region.
291
+ *
292
+ * ```html
293
+ * <cngx-card>
294
+ * <div cngxCardBody>Main content here</div>
295
+ * </cngx-card>
296
+ * ```
297
+ */
298
+ class CngxCardBody {
299
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardBody, deps: [], target: i0.ɵɵFactoryTarget.Directive });
300
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxCardBody, isStandalone: true, selector: "[cngxCardBody]", host: { classAttribute: "cngx-card__body" }, ngImport: i0 });
301
+ }
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardBody, decorators: [{
303
+ type: Directive,
304
+ args: [{
305
+ selector: '[cngxCardBody]',
306
+ standalone: true,
307
+ host: { class: 'cngx-card__body' },
308
+ }]
309
+ }] });
310
+
311
+ /**
312
+ * Structural slot directive for the card media region (images, videos, icons).
313
+ *
314
+ * When `decorative` is `true` (default), the media is hidden from screen readers
315
+ * via `aria-hidden`. Set to `false` when the image carries meaningful information.
316
+ *
317
+ * ```html
318
+ * <cngx-card>
319
+ * <img cngxCardMedia [decorative]="false" alt="Photo of patient" />
320
+ * </cngx-card>
321
+ * ```
322
+ */
323
+ class CngxCardMedia {
324
+ /** Whether this media is purely decorative (hidden from SR). */
325
+ decorative = input(true, ...(ngDevMode ? [{ debugName: "decorative" }] : /* istanbul ignore next */ []));
326
+ /** Aspect ratio applied via CSS `aspect-ratio` property. */
327
+ aspectRatio = input('auto', ...(ngDevMode ? [{ debugName: "aspectRatio" }] : /* istanbul ignore next */ []));
328
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardMedia, deps: [], target: i0.ɵɵFactoryTarget.Directive });
329
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxCardMedia, isStandalone: true, selector: "[cngxCardMedia]", inputs: { decorative: { classPropertyName: "decorative", publicName: "decorative", isSignal: true, isRequired: false, transformFunction: null }, aspectRatio: { classPropertyName: "aspectRatio", publicName: "aspectRatio", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.aspect-ratio": "aspectRatio() !== \"auto\" ? aspectRatio() : null", "attr.aria-hidden": "decorative() || null", "attr.loading": "\"lazy\"" }, classAttribute: "cngx-card__media" }, ngImport: i0 });
330
+ }
331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardMedia, decorators: [{
332
+ type: Directive,
333
+ args: [{
334
+ selector: '[cngxCardMedia]',
335
+ standalone: true,
336
+ host: {
337
+ class: 'cngx-card__media',
338
+ '[style.aspect-ratio]': 'aspectRatio() !== "auto" ? aspectRatio() : null',
339
+ '[attr.aria-hidden]': 'decorative() || null',
340
+ '[attr.loading]': '"lazy"',
341
+ },
342
+ }]
343
+ }], propDecorators: { decorative: [{ type: i0.Input, args: [{ isSignal: true, alias: "decorative", required: false }] }], aspectRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "aspectRatio", required: false }] }] } });
344
+
345
+ /**
346
+ * Structural slot directive for the card footer region.
347
+ *
348
+ * Must be placed on a native `<footer>` element — the selector enforces
349
+ * semantic correctness at compile time.
350
+ *
351
+ * ```html
352
+ * <cngx-card>
353
+ * <footer cngxCardFooter>Footer content</footer>
354
+ * </cngx-card>
355
+ * ```
356
+ */
357
+ class CngxCardFooter {
358
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
359
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxCardFooter, isStandalone: true, selector: "footer[cngxCardFooter]", host: { classAttribute: "cngx-card__footer" }, ngImport: i0 });
360
+ }
361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardFooter, decorators: [{
362
+ type: Directive,
363
+ args: [{
364
+ selector: 'footer[cngxCardFooter]',
365
+ standalone: true,
366
+ host: { class: 'cngx-card__footer' },
367
+ }]
368
+ }] });
369
+
370
+ /**
371
+ * Structural slot directive for the card actions region.
372
+ *
373
+ * Contains independent action buttons within an interactive card.
374
+ * Actions are separated from the card body by a divider.
375
+ *
376
+ * ```html
377
+ * <cngx-card>
378
+ * <div cngxCardActions align="end">
379
+ * <button>Edit</button>
380
+ * <button>Delete</button>
381
+ * </div>
382
+ * </cngx-card>
383
+ * ```
384
+ */
385
+ class CngxCardActions {
386
+ /** Horizontal alignment of actions. */
387
+ align = input('start', ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
388
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardActions, deps: [], target: i0.ɵɵFactoryTarget.Directive });
389
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxCardActions, isStandalone: true, selector: "[cngxCardActions]", inputs: { align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-card__actions--end": "align() === \"end\"" }, classAttribute: "cngx-card__actions" }, ngImport: i0 });
390
+ }
391
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardActions, decorators: [{
392
+ type: Directive,
393
+ args: [{
394
+ selector: '[cngxCardActions]',
395
+ standalone: true,
396
+ host: {
397
+ class: 'cngx-card__actions',
398
+ '[class.cngx-card__actions--end]': 'align() === "end"',
399
+ },
400
+ }]
401
+ }], propDecorators: { align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }] } });
402
+
403
+ /**
404
+ * Positions a badge element at a corner of its parent card.
405
+ *
406
+ * Typically used for status indicators (P-badges, notification dots)
407
+ * that float in the card's top-right corner.
408
+ *
409
+ * ```html
410
+ * <cngx-card>
411
+ * <cngx-status-badge cngxCardBadge status="pending" variant="dot" />
412
+ * <header cngxCardHeader>Pflegeplan</header>
413
+ * </cngx-card>
414
+ * ```
415
+ */
416
+ class CngxCardBadge {
417
+ /** Corner position using logical properties. */
418
+ position = input('top-end', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
419
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardBadge, deps: [], target: i0.ɵɵFactoryTarget.Directive });
420
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxCardBadge, isStandalone: true, selector: "[cngxCardBadge]", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-card__badge--top-start": "position() === \"top-start\"", "class.cngx-card__badge--top-end": "position() === \"top-end\"", "class.cngx-card__badge--bottom-start": "position() === \"bottom-start\"", "class.cngx-card__badge--bottom-end": "position() === \"bottom-end\"" }, classAttribute: "cngx-card__badge" }, ngImport: i0 });
421
+ }
422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardBadge, decorators: [{
423
+ type: Directive,
424
+ args: [{
425
+ selector: '[cngxCardBadge]',
426
+ standalone: true,
427
+ host: {
428
+ class: 'cngx-card__badge',
429
+ '[class.cngx-card__badge--top-start]': 'position() === "top-start"',
430
+ '[class.cngx-card__badge--top-end]': 'position() === "top-end"',
431
+ '[class.cngx-card__badge--bottom-start]': 'position() === "bottom-start"',
432
+ '[class.cngx-card__badge--bottom-end]': 'position() === "bottom-end"',
433
+ },
434
+ }]
435
+ }], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }] } });
436
+
437
+ /**
438
+ * Adds a color-coded severity accent to a card.
439
+ *
440
+ * Renders as a colored top border + tinted background to communicate
441
+ * status visually. Differentiates by both color and border width
442
+ * (not just color — WCAG 1.4.1).
443
+ *
444
+ * ```html
445
+ * <cngx-card cngxCardAccent="warning">
446
+ * <header cngxCardHeader>
447
+ * <h3 cngxCardTitle>Blutzucker</h3>
448
+ * </header>
449
+ * </cngx-card>
450
+ * ```
451
+ */
452
+ class CngxCardAccent {
453
+ /** Severity level controlling the accent color. */
454
+ severity = input('neutral', { ...(ngDevMode ? { debugName: "severity" } : /* istanbul ignore next */ {}), alias: 'cngxCardAccent' });
455
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardAccent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
456
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxCardAccent, isStandalone: true, selector: "[cngxCardAccent]", inputs: { severity: { classPropertyName: "severity", publicName: "cngxCardAccent", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-card--accent": "true", "class.cngx-card--accent-info": "severity() === \"info\"", "class.cngx-card--accent-success": "severity() === \"success\"", "class.cngx-card--accent-warning": "severity() === \"warning\"", "class.cngx-card--accent-danger": "severity() === \"danger\"", "class.cngx-card--accent-neutral": "severity() === \"neutral\"" } }, ngImport: i0 });
457
+ }
458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardAccent, decorators: [{
459
+ type: Directive,
460
+ args: [{
461
+ selector: '[cngxCardAccent]',
462
+ standalone: true,
463
+ host: {
464
+ '[class.cngx-card--accent]': 'true',
465
+ '[class.cngx-card--accent-info]': 'severity() === "info"',
466
+ '[class.cngx-card--accent-success]': 'severity() === "success"',
467
+ '[class.cngx-card--accent-warning]': 'severity() === "warning"',
468
+ '[class.cngx-card--accent-danger]': 'severity() === "danger"',
469
+ '[class.cngx-card--accent-neutral]': 'severity() === "neutral"',
470
+ },
471
+ }]
472
+ }], propDecorators: { severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxCardAccent", required: false }] }] } });
473
+
474
+ /**
475
+ * Skeleton placeholder for card content during loading.
476
+ *
477
+ * Renders shimmer rectangles that match typical card layout patterns.
478
+ * Use alongside `@if (loading())` to swap real content with the skeleton.
479
+ *
480
+ * ```html
481
+ * <cngx-card [loading]="loading()">
482
+ * @if (loading()) {
483
+ * <cngx-card-skeleton [lines]="3" [showMedia]="true" />
484
+ * } @else {
485
+ * <header cngxCardHeader>...</header>
486
+ * <div cngxCardBody>...</div>
487
+ * }
488
+ * </cngx-card>
489
+ * ```
490
+ */
491
+ class CngxCardSkeleton {
492
+ /** Number of body text lines to show. */
493
+ lines = input(3, ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
494
+ /** Whether to show a media placeholder block. */
495
+ showMedia = input(false, ...(ngDevMode ? [{ debugName: "showMedia" }] : /* istanbul ignore next */ []));
496
+ /** @internal */
497
+ lineArray = computed(() => Array.from({ length: this.lines() }), ...(ngDevMode ? [{ debugName: "lineArray" }] : /* istanbul ignore next */ []));
498
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardSkeleton, deps: [], target: i0.ɵɵFactoryTarget.Component });
499
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxCardSkeleton, isStandalone: true, selector: "cngx-card-skeleton", inputs: { lines: { classPropertyName: "lines", publicName: "lines", isSignal: true, isRequired: false, transformFunction: null }, showMedia: { classPropertyName: "showMedia", publicName: "showMedia", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, classAttribute: "cngx-card-skeleton" }, ngImport: i0, template: `
500
+ @if (showMedia()) {
501
+ <div class="cngx-card-skeleton__media"></div>
502
+ }
503
+ <div class="cngx-card-skeleton__title"></div>
504
+ @for (_ of lineArray(); track $index; let last = $last) {
505
+ <div class="cngx-card-skeleton__line" [style.width]="last ? '60%' : '100%'"></div>
506
+ }
507
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
508
+ }
509
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardSkeleton, decorators: [{
510
+ type: Component,
511
+ args: [{
512
+ selector: 'cngx-card-skeleton',
513
+ standalone: true,
514
+ changeDetection: ChangeDetectionStrategy.OnPush,
515
+ encapsulation: ViewEncapsulation.None,
516
+ host: {
517
+ class: 'cngx-card-skeleton',
518
+ 'aria-hidden': 'true',
519
+ },
520
+ template: `
521
+ @if (showMedia()) {
522
+ <div class="cngx-card-skeleton__media"></div>
523
+ }
524
+ <div class="cngx-card-skeleton__title"></div>
525
+ @for (_ of lineArray(); track $index; let last = $last) {
526
+ <div class="cngx-card-skeleton__line" [style.width]="last ? '60%' : '100%'"></div>
527
+ }
528
+ `,
529
+ }]
530
+ }], propDecorators: { lines: [{ type: i0.Input, args: [{ isSignal: true, alias: "lines", required: false }] }], showMedia: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMedia", required: false }] }] } });
531
+
532
+ /**
533
+ * Marker directive placed on `<ng-template>` inside a `<cngx-card-grid>`.
534
+ *
535
+ * The grid selects the template whose `reason` matches the grid's `emptyReason` input.
536
+ * A template without a reason acts as the default fallback.
537
+ *
538
+ * ```html
539
+ * <cngx-card-grid [items]="items()" [emptyReason]="emptyReason()">
540
+ * <ng-template cngxCardGridEmpty="no-results">
541
+ * No results found.
542
+ * </ng-template>
543
+ * <ng-template cngxCardGridEmpty>
544
+ * Nothing here yet.
545
+ * </ng-template>
546
+ * </cngx-card-grid>
547
+ * ```
548
+ */
549
+ class CngxCardGridEmpty {
550
+ /** Empty-state reason this template handles. Omit for a default fallback. */
551
+ reason = input(undefined, { ...(ngDevMode ? { debugName: "reason" } : /* istanbul ignore next */ {}), alias: 'cngxCardGridEmpty' });
552
+ /** @internal Template reference used by `CngxCardGrid` to render the empty state. */
553
+ templateRef = inject(TemplateRef);
554
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardGridEmpty, deps: [], target: i0.ɵɵFactoryTarget.Directive });
555
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxCardGridEmpty, isStandalone: true, selector: "[cngxCardGridEmpty]", inputs: { reason: { classPropertyName: "reason", publicName: "cngxCardGridEmpty", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
556
+ }
557
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardGridEmpty, decorators: [{
558
+ type: Directive,
559
+ args: [{
560
+ selector: '[cngxCardGridEmpty]',
561
+ standalone: true,
562
+ }]
563
+ }], propDecorators: { reason: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxCardGridEmpty", required: false }] }] } });
564
+
565
+ /**
566
+ * Responsive card grid layout with intrinsic sizing, keyboard navigation,
567
+ * and reason-based empty-state template selection.
568
+ *
569
+ * Uses CSS Grid with `auto-fill` + `minmax` for intrinsic responsiveness —
570
+ * no breakpoint management required.
571
+ *
572
+ * Keyboard navigation is provided by `CngxRovingTabindex` as a host directive.
573
+ * Arrow keys navigate between cards; Enter/Space activates.
574
+ *
575
+ * ### Basic grid
576
+ * ```html
577
+ * <cngx-card-grid minWidth="280px">
578
+ * <cngx-card>...</cngx-card>
579
+ * <cngx-card>...</cngx-card>
580
+ * </cngx-card-grid>
581
+ * ```
582
+ *
583
+ * ### With empty state
584
+ * ```html
585
+ * <cngx-card-grid [items]="items()" [emptyReason]="emptyReason()">
586
+ * @for (item of items(); track item.id) {
587
+ * <cngx-card>...</cngx-card>
588
+ * }
589
+ * <ng-template cngxCardGridEmpty="no-results">
590
+ * <cngx-empty-state title="No results" />
591
+ * </ng-template>
592
+ * <ng-template cngxCardGridEmpty>
593
+ * <cngx-empty-state title="Nothing here yet" />
594
+ * </ng-template>
595
+ * </cngx-card-grid>
596
+ * ```
597
+ */
598
+ class CngxCardGrid {
599
+ /** Minimum card width for the CSS Grid `minmax()` function. */
600
+ minWidth = input('280px', ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
601
+ /** Gap between grid items. */
602
+ gap = input('var(--cngx-gap-md, 16px)', ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
603
+ /** Grid density level — controls gap and card padding via CSS custom properties. */
604
+ density = input('default', ...(ngDevMode ? [{ debugName: "density" }] : /* istanbul ignore next */ []));
605
+ /** Whether the grid should have `role="list"`. Requires `role="listitem"` on each card. */
606
+ semanticList = input(false, ...(ngDevMode ? [{ debugName: "semanticList" }] : /* istanbul ignore next */ []));
607
+ /**
608
+ * Optional data source. When provided and empty, the grid shows the matching
609
+ * empty-state template. When omitted, the grid is a pure layout tool.
610
+ */
611
+ items = input(undefined, ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
612
+ /** Reason why items are empty — selects the matching `cngxCardGridEmpty` template. */
613
+ emptyReason = input(undefined, ...(ngDevMode ? [{ debugName: "emptyReason" }] : /* istanbul ignore next */ []));
614
+ /**
615
+ * Bind an async state — drives loading and empty from a single source.
616
+ * When set, `isLoading` derives from `state.isFirstLoad()` and
617
+ * `empty` derives from `state.isEmpty()` (overrides `[items]`).
618
+ */
619
+ state = input(undefined, ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
620
+ /** `true` during initial data load (skeleton phase). */
621
+ isLoading = computed(() => this.state()?.isFirstLoad() ?? false, ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
622
+ /** Whether the grid should show an empty state. */
623
+ empty = computed(() => {
624
+ const s = this.state();
625
+ if (s) {
626
+ return s.isEmpty();
627
+ }
628
+ const i = this.items();
629
+ return i?.length === 0;
630
+ }, ...(ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []));
631
+ /** @internal All `ng-template[cngxCardGridEmpty]` instances projected by the consumer. */
632
+ emptyTemplates = contentChildren(CngxCardGridEmpty, ...(ngDevMode ? [{ debugName: "emptyTemplates" }] : /* istanbul ignore next */ []));
633
+ /**
634
+ * @internal Selects the template matching `emptyReason`.
635
+ * Falls back to a template without a reason as default.
636
+ */
637
+ activeEmptyTemplate = computed(() => {
638
+ const reason = this.emptyReason();
639
+ const templates = this.emptyTemplates();
640
+ const fallback = templates.find((t) => !t.reason());
641
+ if (!reason) {
642
+ return fallback;
643
+ }
644
+ return templates.find((t) => t.reason() === reason) ?? fallback;
645
+ }, ...(ngDevMode ? [{ debugName: "activeEmptyTemplate" }] : /* istanbul ignore next */ []));
646
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardGrid, deps: [], target: i0.ɵɵFactoryTarget.Component });
647
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxCardGrid, isStandalone: true, selector: "cngx-card-grid", inputs: { minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, semanticList: { classPropertyName: "semanticList", publicName: "semanticList", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, emptyReason: { classPropertyName: "emptyReason", publicName: "emptyReason", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.role": "semanticList() ? \"list\" : null", "attr.aria-busy": "isLoading() || null", "style.--cngx-card-grid-min": "minWidth()", "style.--cngx-card-grid-gap": "density() === \"default\" ? gap() : null", "class.cngx-card-grid--compact": "density() === \"compact\"", "class.cngx-card-grid--comfortable": "density() === \"comfortable\"" }, classAttribute: "cngx-card-grid" }, queries: [{ propertyName: "emptyTemplates", predicate: CngxCardGridEmpty, isSignal: true }], hostDirectives: [{ directive: i1.CngxRovingTabindex, inputs: ["orientation", "orientation", "loop", "loop", "activeIndex", "activeIndex", "virtualCount", "virtualCount"] }], ngImport: i0, template: `
648
+ @if (!empty()) {
649
+ <ng-content />
650
+ } @else if (activeEmptyTemplate()) {
651
+ <ng-container [ngTemplateOutlet]="activeEmptyTemplate()!.templateRef" />
652
+ }
653
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
654
+ }
655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardGrid, decorators: [{
656
+ type: Component,
657
+ args: [{
658
+ selector: 'cngx-card-grid',
659
+ standalone: true,
660
+ imports: [NgTemplateOutlet],
661
+ changeDetection: ChangeDetectionStrategy.OnPush,
662
+ encapsulation: ViewEncapsulation.None,
663
+ hostDirectives: [
664
+ {
665
+ directive: CngxRovingTabindex,
666
+ inputs: ['orientation', 'loop', 'activeIndex', 'virtualCount'],
667
+ },
668
+ ],
669
+ host: {
670
+ class: 'cngx-card-grid',
671
+ '[attr.role]': 'semanticList() ? "list" : null',
672
+ '[attr.aria-busy]': 'isLoading() || null',
673
+ '[style.--cngx-card-grid-min]': 'minWidth()',
674
+ '[style.--cngx-card-grid-gap]': 'density() === "default" ? gap() : null',
675
+ '[class.cngx-card-grid--compact]': 'density() === "compact"',
676
+ '[class.cngx-card-grid--comfortable]': 'density() === "comfortable"',
677
+ },
678
+ template: `
679
+ @if (!empty()) {
680
+ <ng-content />
681
+ } @else if (activeEmptyTemplate()) {
682
+ <ng-container [ngTemplateOutlet]="activeEmptyTemplate()!.templateRef" />
683
+ }
684
+ `,
685
+ }]
686
+ }], propDecorators: { minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], semanticList: [{ type: i0.Input, args: [{ isSignal: true, alias: "semanticList", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], emptyReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyReason", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], emptyTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxCardGridEmpty), { isSignal: true }] }] } });
687
+
688
+ /**
689
+ * Displays a formatted date/timestamp, typically in a card footer.
690
+ *
691
+ * Uses `Intl.DateTimeFormat` with the injected `LOCALE_ID`.
692
+ *
693
+ * ```html
694
+ * <cngx-card>
695
+ * <footer cngxCardFooter>
696
+ * <cngx-card-timestamp [date]="evaluationDate()" prefix="Evaluierung am:" />
697
+ * </footer>
698
+ * </cngx-card>
699
+ * ```
700
+ */
701
+ class CngxCardTimestamp {
702
+ locale = inject(LOCALE_ID);
703
+ /** Date to display. Accepts Date objects or ISO strings. */
704
+ date = input.required(...(ngDevMode ? [{ debugName: "date" }] : /* istanbul ignore next */ []));
705
+ /** Optional prefix text before the date (e.g. "Evaluierung am:"). */
706
+ prefix = input(undefined, ...(ngDevMode ? [{ debugName: "prefix" }] : /* istanbul ignore next */ []));
707
+ /** `Intl.DateTimeFormatOptions` for the date. */
708
+ format = input(undefined, ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
709
+ /** @internal */
710
+ dateObj = computed(() => {
711
+ const d = this.date();
712
+ return typeof d === 'string' ? new Date(d) : d;
713
+ }, ...(ngDevMode ? [{ debugName: "dateObj" }] : /* istanbul ignore next */ []));
714
+ /** @internal */
715
+ isoDate = computed(() => this.dateObj().toISOString(), ...(ngDevMode ? [{ debugName: "isoDate" }] : /* istanbul ignore next */ []));
716
+ /** @internal */
717
+ formattedDate = computed(() => {
718
+ const fmt = this.format() ?? {
719
+ year: 'numeric',
720
+ month: '2-digit',
721
+ day: '2-digit',
722
+ };
723
+ return new Intl.DateTimeFormat(this.locale, fmt).format(this.dateObj());
724
+ }, ...(ngDevMode ? [{ debugName: "formattedDate" }] : /* istanbul ignore next */ []));
725
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardTimestamp, deps: [], target: i0.ɵɵFactoryTarget.Component });
726
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxCardTimestamp, isStandalone: true, selector: "cngx-card-timestamp", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: true, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-card-timestamp" }, ngImport: i0, template: `
727
+ @if (prefix()) {
728
+ <span class="cngx-card-timestamp__prefix">{{ prefix() }}</span>
729
+ }
730
+ <time [attr.datetime]="isoDate()" class="cngx-card-timestamp__date">
731
+ {{ formattedDate() }}
732
+ </time>
733
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
734
+ }
735
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCardTimestamp, decorators: [{
736
+ type: Component,
737
+ args: [{
738
+ selector: 'cngx-card-timestamp',
739
+ standalone: true,
740
+ changeDetection: ChangeDetectionStrategy.OnPush,
741
+ encapsulation: ViewEncapsulation.None,
742
+ host: {
743
+ class: 'cngx-card-timestamp',
744
+ },
745
+ template: `
746
+ @if (prefix()) {
747
+ <span class="cngx-card-timestamp__prefix">{{ prefix() }}</span>
748
+ }
749
+ <time [attr.datetime]="isoDate()" class="cngx-card-timestamp__date">
750
+ {{ formattedDate() }}
751
+ </time>
752
+ `,
753
+ }]
754
+ }], propDecorators: { date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: true }] }], prefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "prefix", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }] } });
755
+
756
+ /**
757
+ * @module @cngx/common/card
758
+ */
759
+
760
+ /**
761
+ * Generated bundle index. Do not edit.
762
+ */
763
+
764
+ export { CngxCard, CngxCardAccent, CngxCardActions, CngxCardBadge, CngxCardBody, CngxCardFooter, CngxCardGrid, CngxCardGridEmpty, CngxCardHeader, CngxCardMedia, CngxCardSkeleton, CngxCardSubtitle, CngxCardTimestamp, CngxCardTitle };
765
+ //# sourceMappingURL=cngx-common-card.mjs.map