@cngx/common 0.1.0-rc.7 → 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.
Files changed (63) hide show
  1. package/card/README.md +2 -1
  2. package/data/README.md +10 -1
  3. package/dialog/README.md +23 -1
  4. package/fesm2022/cngx-common-a11y.mjs +125 -111
  5. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  6. package/fesm2022/cngx-common-audio.mjs +47 -5
  7. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  8. package/fesm2022/cngx-common-card.mjs +300 -46
  9. package/fesm2022/cngx-common-card.mjs.map +1 -1
  10. package/fesm2022/cngx-common-chart.mjs +1176 -453
  11. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  12. package/fesm2022/cngx-common-command.mjs +37 -10
  13. package/fesm2022/cngx-common-command.mjs.map +1 -1
  14. package/fesm2022/cngx-common-data.mjs +1318 -469
  15. package/fesm2022/cngx-common-data.mjs.map +1 -1
  16. package/fesm2022/cngx-common-dialog.mjs +151 -14
  17. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  18. package/fesm2022/cngx-common-display.mjs +340 -73
  19. package/fesm2022/cngx-common-display.mjs.map +1 -1
  20. package/fesm2022/cngx-common-interactive.mjs +1744 -952
  21. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  22. package/fesm2022/cngx-common-layout.mjs +841 -114
  23. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  24. package/fesm2022/cngx-common-popover.mjs +350 -60
  25. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  26. package/fesm2022/cngx-common-stepper.mjs +727 -317
  27. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  28. package/fesm2022/cngx-common-tabs.mjs +1601 -1243
  29. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  30. package/fesm2022/cngx-common-timeline.mjs +137 -53
  31. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  32. package/fesm2022/cngx-common.mjs +1 -1
  33. package/interactive/README.md +15 -4
  34. package/layout/README.md +21 -1
  35. package/package.json +3 -3
  36. package/popover/README.md +18 -2
  37. package/stepper/README.md +6 -4
  38. package/theming/components/cngx-accordion.css +1 -1
  39. package/theming/components/cngx-backdrop.css +12 -0
  40. package/theming/components/cngx-button-toggle.css +29 -3
  41. package/theming/components/cngx-data-grid.css +168 -1
  42. package/theming/components/cngx-dialog.css +13 -0
  43. package/theming/components/cngx-listbox.css +21 -12
  44. package/theming/components/cngx-menu.css +56 -16
  45. package/theming/components/cngx-popover.css +24 -0
  46. package/theming/components/cngx-recycler-placeholder.css +196 -0
  47. package/theming/components/cngx-ripple.css +1 -1
  48. package/theming/components/cngx-slider.css +32 -1
  49. package/theming/components/cngx-tooltip.css +12 -0
  50. package/timeline/README.md +155 -0
  51. package/types/cngx-common-a11y.d.ts +42 -18
  52. package/types/cngx-common-card.d.ts +201 -17
  53. package/types/cngx-common-chart.d.ts +343 -47
  54. package/types/cngx-common-command.d.ts +31 -8
  55. package/types/cngx-common-data.d.ts +581 -68
  56. package/types/cngx-common-dialog.d.ts +158 -3
  57. package/types/cngx-common-display.d.ts +356 -142
  58. package/types/cngx-common-interactive.d.ts +859 -210
  59. package/types/cngx-common-layout.d.ts +567 -28
  60. package/types/cngx-common-popover.d.ts +262 -39
  61. package/types/cngx-common-stepper.d.ts +366 -116
  62. package/types/cngx-common-tabs.d.ts +214 -50
  63. package/types/cngx-common-timeline.d.ts +82 -16
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { TemplateRef } from '@angular/core';
2
+ import { InjectionToken, Signal, Provider, TemplateRef } from '@angular/core';
3
3
  import * as i1 from '@cngx/common/a11y';
4
4
  import { CngxAsyncState } from '@cngx/core/utils';
5
5
 
@@ -52,10 +52,30 @@ type EmptyReason = 'first-use' | 'no-results' | 'cleared';
52
52
  declare class CngxCard {
53
53
  private readonly uid;
54
54
  private readonly rovingParent;
55
+ private readonly router;
56
+ private readonly i18n;
55
57
  /** Semantic archetype: `'article'` (display), `'button'` (action), or `'link'` (navigation). */
56
58
  readonly cardType: _angular_core.InputSignal<"article" | "link" | "button">;
57
- /** Navigation URL when `as="link"`. Applied as `href` on the host. */
59
+ /**
60
+ * Navigation target when `as="link"`. Activation (click / Enter)
61
+ * navigates: internal URLs go through the app `Router` when one is
62
+ * provided, everything else (schemes, protocol-relative, router-less
63
+ * apps) through `window.location.assign`. The value is also mirrored
64
+ * as an `href` attribute on the host as a styling/testing hook - the
65
+ * host is not a native anchor, so browser-native link affordances
66
+ * (modifier-click new tab, context-menu link actions) do not apply.
67
+ */
58
68
  readonly href: _angular_core.InputSignal<string | undefined>;
69
+ /**
70
+ * Explicit ARIA role override for the host. Wins over the
71
+ * archetype-derived role. The primary use is `role="listitem"` on
72
+ * cards inside `<cngx-card-grid [semanticList]="true">` - the grid's
73
+ * `role="list"` requires listitem children, which the archetype
74
+ * binding would otherwise overwrite. Overriding the role on an
75
+ * interactive card replaces its button/link semantics; pair with an
76
+ * inner interactive element when both are needed.
77
+ */
78
+ readonly role: _angular_core.InputSignal<string | undefined>;
59
79
  /** Accessible label for the card. Overrides the default screen reader announcement. */
60
80
  readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
61
81
  /** Two-way selection state. Only relevant when `selectable` is `true`. */
@@ -72,8 +92,8 @@ declare class CngxCard {
72
92
  readonly interactive: _angular_core.Signal<boolean>;
73
93
  /** @internal Host href for link cards. */
74
94
  protected readonly hostHref: _angular_core.Signal<string | null>;
75
- /** @internal Host element ARIA role. */
76
- protected readonly hostRole: _angular_core.Signal<"article" | "link" | "button">;
95
+ /** @internal Host element ARIA role. Explicit `role` input wins over the archetype. */
96
+ protected readonly hostRole: _angular_core.Signal<string>;
77
97
  /**
78
98
  * @internal Tabindex management.
79
99
  * When inside a CngxRovingTabindex parent (e.g. CngxCardGrid), the roving
@@ -94,18 +114,145 @@ declare class CngxCard {
94
114
  * set while `disabled` is false would read as "locked").
95
115
  */
96
116
  protected readonly describedByIds: _angular_core.Signal<string | null>;
97
- /** @internal SR live announcement for state changes. */
98
- protected readonly liveAnnouncement: _angular_core.Signal<"Loading" | "Selected" | "Deselected" | "">;
117
+ /**
118
+ * @internal Selection phrase with loading-start expiry: a real
119
+ * `selected` change (re)arms the phrase; a loading START spends an
120
+ * already-voiced phrase so the loading-clear content change cannot
121
+ * re-announce it (the region is `aria-atomic`). A toggle DURING
122
+ * loading keeps its phrase across the clear, so the change is voiced
123
+ * exactly once when the loading phrase yields.
124
+ */
125
+ private readonly selectionPhrase;
126
+ /**
127
+ * @internal SR live announcement, driven by transitions rather than
128
+ * persistent state (Pillar 2: voice the change, not the standing
129
+ * state). Loading owns the region while active; otherwise the armed
130
+ * selection phrase renders (empty between transitions, so AT stays
131
+ * silent on no-op ticks).
132
+ */
133
+ protected readonly liveAnnouncement: _angular_core.Signal<string>;
99
134
  /** Emits when an interactive card is clicked or activated via keyboard. */
100
135
  readonly clicked: _angular_core.OutputEmitterRef<void>;
101
136
  /** @internal */
102
137
  protected handleHostClick(e: MouseEvent): void;
103
138
  /** @internal */
104
139
  protected handleHostKeydown(e: Event): void;
140
+ /**
141
+ * Navigation for the link archetype. Internal URLs prefer the app
142
+ * `Router` (SPA navigation, no full reload); external URLs and
143
+ * router-less apps fall back to `window.location.assign`.
144
+ */
145
+ private navigateToHref;
105
146
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxCard, never>;
106
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxCard, "cngx-card", never, { "cardType": { "alias": "as"; "required": false; "isSignal": true; }; "href": { "alias": "href"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "disabledReason": { "alias": "disabledReason"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; "clicked": "clicked"; }, never, ["[cngxCardMedia]", "header[cngxCardHeader]", "[cngxCardBody]", "footer[cngxCardFooter]", "[cngxCardActions]", "*"], true, [{ directive: typeof i1.CngxRovingItem; inputs: {}; outputs: {}; }]>;
147
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxCard, "cngx-card", never, { "cardType": { "alias": "as"; "required": false; "isSignal": true; }; "href": { "alias": "href"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "disabledReason": { "alias": "disabledReason"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; "clicked": "clicked"; }, never, ["[cngxCardMedia]", "header[cngxCardHeader]", "[cngxCardBody]", "footer[cngxCardFooter]", "[cngxCardActions]", "*"], true, [{ directive: typeof i1.CngxRovingItem; inputs: {}; outputs: {}; }]>;
107
148
  }
108
149
 
150
+ /**
151
+ * The card section of a {@link CngxLanguagePack}. Same keys as
152
+ * {@link CngxCardI18n}: the phrases a selectable card announces and the
153
+ * order of a {@link CngxCardTimestamp} prefix and its date.
154
+ *
155
+ * @category common/card/i18n
156
+ * @since 0.1.0
157
+ * @relatedTo CngxCard, CngxCardTimestamp
158
+ */
159
+ interface CngxCardLanguageSection {
160
+ /** Announced when a selectable card becomes selected. */
161
+ readonly selected: string;
162
+ /** Announced when a selectable card becomes deselected. */
163
+ readonly deselected: string;
164
+ /** Owns the live region while the card loads, pre-empting the selection phrase. */
165
+ readonly loading: string;
166
+ /**
167
+ * Places a timestamp's prefix and its date: `{prefix}` and `{date}`, in the
168
+ * order the language reads them. Text around them renders as written, as a
169
+ * piece of its own with the host's gap on both sides - use it for words,
170
+ * not for punctuation that has to touch the prefix or the date. A plain
171
+ * string only: the timestamp renders the placeholders as elements, so a
172
+ * function value cannot place them.
173
+ */
174
+ readonly timestamp: string;
175
+ }
176
+ /**
177
+ * The English card section: the single source of the card's English copy.
178
+ * `CNGX_CARD_I18N` defaults to it, and the shipped English pack is built from it.
179
+ *
180
+ * @category common/card/i18n
181
+ * @since 0.1.0
182
+ * @relatedTo CNGX_CARD_I18N
183
+ */
184
+ declare const CNGX_CARD_LANGUAGE_EN: CngxCardLanguageSection;
185
+ declare module '@cngx/core/i18n' {
186
+ interface CngxLanguagePack {
187
+ readonly card: CngxCardLanguageSection;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Card i18n surface. Library defaults are English; consumers override via
193
+ * {@link provideCardI18n}. Sibling to `CNGX_STEPPER_I18N`, `CNGX_TABS_I18N`
194
+ * and `CNGX_CHART_I18N`.
195
+ *
196
+ * `selected`, `deselected` and `loading` are live-region copy. A selectable
197
+ * card announces the transition it just made, never the state it is standing
198
+ * in - so these are armed phrases, spent once per change, not a label the
199
+ * card carries. `timestamp` orders a {@link CngxCardTimestamp} prefix and its
200
+ * date. The same shape as the card section of a language pack, declared once
201
+ * as {@link CngxCardLanguageSection}.
202
+ *
203
+ * @category common/card/i18n
204
+ */
205
+ type CngxCardI18n = CngxCardLanguageSection;
206
+ /**
207
+ * DI token for the card i18n bundle, a `Signal` so the phrases follow a
208
+ * runtime language switch. `providedIn: 'root'`: the card section of the
209
+ * active language pack over the English defaults.
210
+ *
211
+ * @category common/card/i18n
212
+ * @wcag AA
213
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/card/i18n/card-i18n.ts
214
+ * @since 0.1.0
215
+ * @relatedTo CngxCard
216
+ */
217
+ declare const CNGX_CARD_I18N: InjectionToken<Signal<CngxCardLanguageSection>>;
218
+ /**
219
+ * Branded feature-fn for {@link provideCardI18n}.
220
+ *
221
+ * @category common/card/i18n
222
+ */
223
+ type CngxCardI18nFeature = ((bundle: Signal<CngxCardI18n>) => Signal<CngxCardI18n>) & {
224
+ readonly _target: 'i18n';
225
+ };
226
+ /**
227
+ * Override i18n labels via a partial bundle - unset keys keep the language
228
+ * pack's phrase, or the English default. Pass a `Signal` to switch the
229
+ * language at runtime.
230
+ *
231
+ * @category common/card/i18n
232
+ */
233
+ declare function withCardI18nLabels(overrides: Partial<CngxCardI18n> | Signal<Partial<CngxCardI18n>>): CngxCardI18nFeature;
234
+ /**
235
+ * Provider for the card i18n bundle. The features apply on top of the active
236
+ * language pack, so a subtree can override single keys of the app's language.
237
+ *
238
+ * ```ts
239
+ * bootstrapApplication(AppComponent, {
240
+ * providers: [
241
+ * provideCardI18n(withCardI18nLabels({ selected: 'Ausgewählt', deselected: 'Abgewählt' })),
242
+ * ],
243
+ * });
244
+ * ```
245
+ *
246
+ * @category common/card/i18n
247
+ */
248
+ declare function provideCardI18n(...features: readonly CngxCardI18nFeature[]): Provider;
249
+ /**
250
+ * Inject the resolved card i18n bundle.
251
+ *
252
+ * @category common/card/i18n
253
+ */
254
+ declare function injectCardI18n(): Signal<CngxCardI18n>;
255
+
109
256
  /**
110
257
  * Structural slot directive for the card header region.
111
258
  *
@@ -222,8 +369,15 @@ declare class CngxCardMedia {
222
369
  readonly decorative: _angular_core.InputSignal<boolean>;
223
370
  /** Aspect ratio applied via CSS `aspect-ratio` property. */
224
371
  readonly aspectRatio: _angular_core.InputSignal<"16/9" | "4/3" | "1/1" | "auto">;
372
+ /**
373
+ * Native `loading` attribute for `<img>`/`<iframe>` hosts. Defaults to
374
+ * `lazy` - right for below-the-fold card lists; set `eager` on
375
+ * above-the-fold cards where lazy decoding costs LCP. `null` removes
376
+ * the attribute (non-loadable hosts like `<div>` backgrounds).
377
+ */
378
+ readonly loading: _angular_core.InputSignal<"lazy" | "eager" | null>;
225
379
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxCardMedia, never>;
226
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxCardMedia, "[cngxCardMedia]", never, { "decorative": { "alias": "decorative"; "required": false; "isSignal": true; }; "aspectRatio": { "alias": "aspectRatio"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
380
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxCardMedia, "[cngxCardMedia]", never, { "decorative": { "alias": "decorative"; "required": false; "isSignal": true; }; "aspectRatio": { "alias": "aspectRatio"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
227
381
  }
228
382
 
229
383
  /**
@@ -465,7 +619,11 @@ declare class CngxCardGrid {
465
619
  readonly gap: _angular_core.InputSignal<string>;
466
620
  /** Grid density level - controls gap and card padding via CSS custom properties. */
467
621
  readonly density: _angular_core.InputSignal<"compact" | "default" | "comfortable">;
468
- /** Whether the grid should have `role="list"`. Requires `role="listitem"` on each card. */
622
+ /**
623
+ * Whether the grid should have `role="list"`. Requires
624
+ * `role="listitem"` on each child - on `<cngx-card>` set it via the
625
+ * card's `role` input, which overrides the archetype-derived role.
626
+ */
469
627
  readonly semanticList: _angular_core.InputSignal<boolean>;
470
628
  /**
471
629
  * Optional data source. When provided and empty, the grid shows the matching
@@ -495,10 +653,18 @@ declare class CngxCardGrid {
495
653
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxCardGrid, "cngx-card-grid", never, { "minWidth": { "alias": "minWidth"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "semanticList": { "alias": "semanticList"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "emptyReason": { "alias": "emptyReason"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; }, {}, ["emptyTemplates"], ["*"], true, [{ directive: typeof i1.CngxRovingTabindex; inputs: { "orientation": "orientation"; "loop": "loop"; "activeIndex": "activeIndex"; "virtualCount": "virtualCount"; }; outputs: {}; }]>;
496
654
  }
497
655
 
656
+ /** @internal One piece of the timestamp message, in reading order. */
657
+ interface TimestampSegment {
658
+ readonly kind: 'text' | 'prefix' | 'date';
659
+ readonly text: string;
660
+ }
498
661
  /**
499
662
  * Displays a formatted date/timestamp, typically in a card footer.
500
663
  *
501
- * Uses `Intl.DateTimeFormat` with the injected `LOCALE_ID`.
664
+ * Uses `Intl.DateTimeFormat` with the app locale (`CNGX_LOCALE`, falling back
665
+ * to the nearest `LOCALE_ID`); a locale flip re-formats. The order of the
666
+ * prefix and the date comes from the `timestamp` message of the card
667
+ * language section (English `'{prefix} {date}'`).
502
668
  *
503
669
  * ```html
504
670
  * <cngx-card>
@@ -515,21 +681,39 @@ declare class CngxCardGrid {
515
681
  */
516
682
  declare class CngxCardTimestamp {
517
683
  private readonly locale;
684
+ private readonly i18n;
518
685
  /** Date to display. Accepts Date objects or ISO strings. */
519
686
  readonly date: _angular_core.InputSignal<string | Date>;
520
- /** Optional prefix text before the date (e.g. "Evaluierung am:"). */
687
+ /**
688
+ * Optional prefix text (e.g. "Evaluierung am:"). Placed before or after the
689
+ * date by the `timestamp` message of the card language section.
690
+ */
521
691
  readonly prefix: _angular_core.InputSignal<string | undefined>;
522
692
  /** `Intl.DateTimeFormatOptions` for the date. */
523
693
  readonly format: _angular_core.InputSignal<Intl.DateTimeFormatOptions | undefined>;
524
- /** @internal */
694
+ /** @internal Prefix, date and message text in the language's reading order. */
695
+ protected readonly segments: _angular_core.Signal<readonly TimestampSegment[]>;
696
+ /**
697
+ * @internal Coerced instant, deduped by time value so a fresh-ref
698
+ * `[date]` rebind of the same instant does not cascade the render
699
+ * graph. NaN pairs compare equal - two Invalid Dates must dedupe too
700
+ * (NaN !== NaN would defeat the arm). Mirrors `CngxTime.instant`.
701
+ */
525
702
  protected readonly dateObj: _angular_core.Signal<Date>;
526
- /** @internal */
527
- protected readonly isoDate: _angular_core.Signal<string>;
528
- /** @internal */
703
+ /**
704
+ * @internal Invalid Date guard. `toISOString()` throws and
705
+ * `Intl.format` renders garbage on an invalid instant - a bad ISO
706
+ * string must degrade to an empty render, not crash change detection.
707
+ */
708
+ protected readonly isValidDate: _angular_core.Signal<boolean>;
709
+ /** @internal `null` (attribute removed) when the instant is invalid. */
710
+ protected readonly isoDate: _angular_core.Signal<string | null>;
711
+ /** @internal Empty string when the instant is invalid. */
529
712
  protected readonly formattedDate: _angular_core.Signal<string>;
713
+ constructor();
530
714
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxCardTimestamp, never>;
531
715
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxCardTimestamp, "cngx-card-timestamp", never, { "date": { "alias": "date"; "required": true; "isSignal": true; }; "prefix": { "alias": "prefix"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
532
716
  }
533
717
 
534
- export { CngxCard, CngxCardAccent, CngxCardActions, CngxCardBadge, CngxCardBody, CngxCardFooter, CngxCardGrid, CngxCardGridEmpty, CngxCardHeader, CngxCardMedia, CngxCardSkeleton, CngxCardSubtitle, CngxCardTimestamp, CngxCardTitle };
535
- export type { EmptyReason };
718
+ export { CNGX_CARD_I18N, CNGX_CARD_LANGUAGE_EN, CngxCard, CngxCardAccent, CngxCardActions, CngxCardBadge, CngxCardBody, CngxCardFooter, CngxCardGrid, CngxCardGridEmpty, CngxCardHeader, CngxCardMedia, CngxCardSkeleton, CngxCardSubtitle, CngxCardTimestamp, CngxCardTitle, injectCardI18n, provideCardI18n, withCardI18nLabels };
719
+ export type { CngxCardI18n, CngxCardI18nFeature, CngxCardLanguageSection, EmptyReason };