@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,616 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ElementRef, InjectionToken, Signal } from '@angular/core';
3
+
4
+ /**
5
+ * Manages `aria-expanded` and optionally `aria-controls` on the host element.
6
+ *
7
+ * Pairs a disclosure trigger (button) with its controlled region via standard
8
+ * WAI-ARIA attributes. Supports accordions, dropdowns, tree items, and any
9
+ * disclosure pattern where a control toggles visibility of another element.
10
+ *
11
+ * Unlike manual `[attr.aria-expanded]` binding, this directive couples both
12
+ * attributes (`aria-expanded` + `aria-controls`) in a single declaration,
13
+ * preventing mismatches where one is set without the other.
14
+ *
15
+ * ### Simple disclosure
16
+ * ```html
17
+ * <button [cngxAriaExpanded]="open()" [controls]="'panel-id'" (click)="open.set(!open())">
18
+ * Toggle
19
+ * </button>
20
+ * <div id="panel-id" role="region" [hidden]="!open()">Panel content</div>
21
+ * ```
22
+ *
23
+ * ### Accordion with multiple panels
24
+ * ```html
25
+ * @for (panel of panels(); track panel.id) {
26
+ * <button [cngxAriaExpanded]="panel.open" [controls]="panel.id" (click)="toggle(panel)">
27
+ * {{ panel.label }}
28
+ * </button>
29
+ * @if (panel.open) {
30
+ * <div [id]="panel.id" role="region">{{ panel.content }}</div>
31
+ * }
32
+ * }
33
+ * ```
34
+ */
35
+ declare class CngxAriaExpanded {
36
+ /** Whether the controlled element is currently expanded. Sets `aria-expanded`. */
37
+ readonly expanded: _angular_core.InputSignal<boolean>;
38
+ /** The `id` of the controlled element. Sets `aria-controls`. */
39
+ readonly controls: _angular_core.InputSignal<string | undefined>;
40
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAriaExpanded, never>;
41
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAriaExpanded, "[cngxAriaExpanded]", ["cngxAriaExpanded"], { "expanded": { "alias": "cngxAriaExpanded"; "required": false; "isSignal": true; }; "controls": { "alias": "controls"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
42
+ }
43
+
44
+ /**
45
+ * Configures the host element as an ARIA live region.
46
+ *
47
+ * Screen readers monitor live regions and announce content changes automatically.
48
+ * `polite` announcements are queued after the current utterance finishes;
49
+ * `assertive` announcements interrupt immediately. `off` disables announcements.
50
+ *
51
+ * Sets `role="alert"` for assertive regions and `role="status"` for polite regions
52
+ * via a host binding — no manual attribute wiring needed.
53
+ *
54
+ * Unlike CDK's `LiveAnnouncer` service (which creates a hidden DOM element and
55
+ * requires imperative `announce()` calls), this directive decorates your own
56
+ * element declaratively — the content you render IS the announcement.
57
+ *
58
+ * ### Status message
59
+ * ```html
60
+ * <div cngxLiveRegion [politeness]="'polite'">
61
+ * {{ statusMessage() }}
62
+ * </div>
63
+ * ```
64
+ *
65
+ * ### Form validation error (assertive)
66
+ * ```html
67
+ * <div cngxLiveRegion [politeness]="'assertive'"
68
+ * [style.color]="error() ? 'red' : 'transparent'">
69
+ * {{ error() }}
70
+ * </div>
71
+ * ```
72
+ */
73
+ declare class CngxLiveRegion {
74
+ /**
75
+ * Controls the urgency of announcements.
76
+ * - `'polite'` — queued after current speech (default)
77
+ * - `'assertive'` — interrupts immediately
78
+ * - `'off'` — no announcements
79
+ */
80
+ readonly politeness: _angular_core.InputSignal<"polite" | "assertive" | "off">;
81
+ /** Whether the entire region should be announced as a whole. */
82
+ readonly atomic: _angular_core.InputSignal<boolean>;
83
+ /** Which types of content changes to announce. Space-separated: `additions`, `removals`, `text`. */
84
+ readonly relevant: _angular_core.InputSignal<string>;
85
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxLiveRegion, never>;
86
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxLiveRegion, "[cngxLiveRegion]", ["cngxLiveRegion"], { "politeness": { "alias": "politeness"; "required": false; "isSignal": true; }; "atomic": { "alias": "atomic"; "required": false; "isSignal": true; }; "relevant": { "alias": "relevant"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
87
+ }
88
+
89
+ /**
90
+ * Reactive autofocus for dynamically inserted elements.
91
+ *
92
+ * The native `autofocus` HTML attribute only works on initial page load.
93
+ * This directive handles dynamic content: dialogs, panels, stepper steps,
94
+ * and any element that appears after the initial render.
95
+ *
96
+ * Focuses the host element after the next render frame using `afterNextRender`.
97
+ * When `when` changes to `true`, focus is re-applied.
98
+ *
99
+ * ### Focus on insertion
100
+ * ```html
101
+ * @if (showSearch()) {
102
+ * <input cngxAutofocus placeholder="Search…" />
103
+ * }
104
+ * ```
105
+ *
106
+ * ### Conditional focus
107
+ * ```html
108
+ * <input [cngxAutofocus]="isActive()" />
109
+ * ```
110
+ *
111
+ * ### With delay for transitions
112
+ * ```html
113
+ * <input cngxAutofocus [autofocusDelay]="200" />
114
+ * ```
115
+ */
116
+ declare class CngxAutofocus {
117
+ /** Whether to focus the element. Defaults to `true` (always focus on render). */
118
+ readonly when: _angular_core.InputSignal<boolean>;
119
+ /** Delay in ms before focusing — useful when the element appears during a transition. */
120
+ readonly delay: _angular_core.InputSignal<number>;
121
+ /** `FocusOptions` passed to `element.focus()`. */
122
+ readonly options: _angular_core.InputSignal<FocusOptions>;
123
+ private readonly el;
124
+ private readonly injector;
125
+ private pendingTimer;
126
+ private initialized;
127
+ constructor();
128
+ private scheduleFocus;
129
+ private applyFocus;
130
+ private clearPending;
131
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAutofocus, never>;
132
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAutofocus, "[cngxAutofocus]", ["cngxAutofocus"], { "when": { "alias": "cngxAutofocus"; "required": false; "isSignal": true; }; "delay": { "alias": "autofocusDelay"; "required": false; "isSignal": true; }; "options": { "alias": "autofocusOptions"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
133
+ }
134
+
135
+ /**
136
+ * Stores the previously focused element and restores focus on destroy.
137
+ *
138
+ * Prevents focus from falling to `<body>` when dynamic content is removed
139
+ * (dialogs closing, panels collapsing, tabs switching). The directive captures
140
+ * `document.activeElement` at initialization time and restores it when the
141
+ * host element is destroyed.
142
+ *
143
+ * Fallback chain: stored element → provided fallback → nearest focusable ancestor → body.
144
+ *
145
+ * ### Panel that restores focus on close
146
+ * ```html
147
+ * @if (panelOpen()) {
148
+ * <div cngxFocusRestore>
149
+ * Panel content…
150
+ * <button (click)="panelOpen.set(false)">Close</button>
151
+ * </div>
152
+ * }
153
+ * ```
154
+ *
155
+ * ### With explicit fallback
156
+ * ```html
157
+ * <div cngxFocusRestore [focusRestoreFallback]="fallbackBtn">
158
+ * Dynamic content…
159
+ * </div>
160
+ * <button #fallbackBtn>Fallback target</button>
161
+ * ```
162
+ */
163
+ declare class CngxFocusRestore {
164
+ /** Whether to restore focus when the host element is destroyed. */
165
+ readonly restoreOnDestroy: _angular_core.InputSignal<boolean>;
166
+ /** Explicit fallback element if the stored element is no longer in the DOM. */
167
+ readonly fallback: _angular_core.InputSignal<HTMLElement | null>;
168
+ private readonly doc;
169
+ private readonly el;
170
+ private readonly storedElement;
171
+ constructor();
172
+ /** Manually store the current focus target for later restoration. */
173
+ capture(): void;
174
+ /** Manually restore focus to the stored element. */
175
+ restore(): void;
176
+ /**
177
+ * Walks the fallback chain:
178
+ * 1. Stored element (if still in DOM and not body/self)
179
+ * 2. Explicit fallback input
180
+ * 3. Nearest focusable ancestor
181
+ */
182
+ private resolveTarget;
183
+ /** Traverses up the DOM tree looking for the first natively focusable element. */
184
+ private findFocusableAncestor;
185
+ /** Checks if an element is natively focusable (tabindex, links, form controls). */
186
+ private isFocusable;
187
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxFocusRestore, never>;
188
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxFocusRestore, "[cngxFocusRestore]", ["cngxFocusRestore"], { "restoreOnDestroy": { "alias": "restoreOnDestroy"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
189
+ }
190
+
191
+ /**
192
+ * Traps keyboard focus within the host element using the CDK `FocusTrap`.
193
+ *
194
+ * When enabled, Tab and Shift+Tab cycle only within the host element's
195
+ * focusable children. When `autoFocus` is `true` (default), focus moves to
196
+ * the first tabbable element automatically on activation.
197
+ *
198
+ * Wraps CDK's `FocusTrapFactory` with a declarative, Signal-driven API.
199
+ * The CDK's imperative `create()` / `destroy()` / `enabled` setter lifecycle
200
+ * is handled internally via `effect()` and `DestroyRef`.
201
+ *
202
+ * ### Modal dialog
203
+ * ```html
204
+ * <div cngxFocusTrap [enabled]="isOpen()" [autoFocus]="true"
205
+ * tabindex="-1" role="dialog" aria-modal="true"
206
+ * (keydown.escape)="isOpen.set(false)">
207
+ * <input placeholder="First input" />
208
+ * <button (click)="isOpen.set(false)">Close</button>
209
+ * </div>
210
+ * ```
211
+ *
212
+ * ### Drawer / sidebar
213
+ * ```html
214
+ * <nav cngxFocusTrap [enabled]="drawerOpen()" tabindex="-1">
215
+ * <a href="/home">Home</a>
216
+ * <a href="/settings">Settings</a>
217
+ * </nav>
218
+ * ```
219
+ */
220
+ declare class CngxFocusTrap {
221
+ /** Whether the focus trap is active. When `false`, Tab navigates normally. */
222
+ readonly enabled: _angular_core.InputSignal<boolean>;
223
+ /** Whether to auto-focus the first tabbable element when the trap activates. */
224
+ readonly autoFocus: _angular_core.InputSignal<boolean>;
225
+ /** Computed signal reflecting the current trap state. */
226
+ readonly isActive: _angular_core.Signal<boolean>;
227
+ private readonly trap;
228
+ constructor();
229
+ /** Programmatically focus the first tabbable element within the trap. */
230
+ focusFirst(): void;
231
+ /** Programmatically focus the last tabbable element within the trap. */
232
+ focusLast(): void;
233
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxFocusTrap, never>;
234
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxFocusTrap, "[cngxFocusTrap]", ["cngxFocusTrap"], { "enabled": { "alias": "enabled"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
235
+ }
236
+
237
+ /**
238
+ * Tracks keyboard-initiated focus on the host element.
239
+ *
240
+ * Adds `cngx-focus-visible` CSS class when the element receives focus via keyboard
241
+ * and removes it on blur or when focus was initiated by pointer interaction.
242
+ *
243
+ *
244
+ * ```html
245
+ * <button cngxFocusVisible #fv="cngxFocusVisible">
246
+ * @if (fv.focusVisible()) { Focus ring visible }
247
+ * </button>
248
+ * ```
249
+ */
250
+ declare class CngxFocusVisible {
251
+ private readonly focusVisibleState;
252
+ /** `true` when focus was initiated via keyboard (not pointer). */
253
+ readonly focusVisible: _angular_core.Signal<boolean>;
254
+ /** @internal Cleared on `focusin` after being set by `pointerdown`. */
255
+ pointerActive: boolean;
256
+ /** @internal Sets focus-visible state; clears pointer flag. */
257
+ protected handleFocus(): void;
258
+ /** @internal Clears focus-visible state on blur. */
259
+ protected handleBlur(): void;
260
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxFocusVisible, never>;
261
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxFocusVisible, "[cngxFocusVisible]", ["cngxFocusVisible"], {}, {}, never, never, true, never>;
262
+ }
263
+
264
+ /**
265
+ * Marker directive for items managed by `CngxRovingTabindex`.
266
+ *
267
+ * Place on each focusable child inside a `[cngxRovingTabindex]` container.
268
+ * The roving tabindex controller sets `tabindex="0"` on the active item
269
+ * and `tabindex="-1"` on all others.
270
+ *
271
+ * ```html
272
+ * <div cngxRovingTabindex>
273
+ * <button cngxRovingItem>One</button>
274
+ * <button cngxRovingItem>Two</button>
275
+ * <button cngxRovingItem>Three</button>
276
+ * </div>
277
+ * ```
278
+ */
279
+ declare class CngxRovingItem {
280
+ /** @internal Reference used by the parent `CngxRovingTabindex` to set `tabindex`. */
281
+ readonly elementRef: ElementRef<any>;
282
+ /** Whether this item is disabled and should be skipped during navigation. */
283
+ readonly disabled: _angular_core.InputSignal<boolean>;
284
+ /** Programmatically focus this item. Called by the parent on arrow-key navigation. */
285
+ focus(): void;
286
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxRovingItem, never>;
287
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxRovingItem, "[cngxRovingItem]", ["cngxRovingItem"], { "disabled": { "alias": "cngxRovingItemDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
288
+ }
289
+ /**
290
+ * Implements the WAI-ARIA roving tabindex pattern for composite widgets.
291
+ *
292
+ * Only the active item in the group has `tabindex="0"` — all others get
293
+ * `tabindex="-1"`. Arrow keys move focus within the group; Tab leaves it.
294
+ * Home/End jump to first/last item.
295
+ *
296
+ * Works for toolbars, tab lists, card grids, menu bars, and any composite
297
+ * widget where only one item should be in the tab order at a time.
298
+ *
299
+ * ### Virtual mode
300
+ *
301
+ * When `virtualCount` is set, `activeIndex` ranges from 0 to `virtualCount - 1`
302
+ * instead of being bounded by `contentChildren.length`. Items are matched by
303
+ * `data-cngx-recycle-index` attribute. When the target item is not in the DOM
304
+ * (out of rendered range), `pendingFocus` is set so a wiring function like
305
+ * `connectRecyclerToRoving()` can scroll it into view.
306
+ *
307
+ * ### Horizontal toolbar
308
+ * ```html
309
+ * <div cngxRovingTabindex orientation="horizontal" #rv="cngxRovingTabindex">
310
+ * <button cngxRovingItem>Cut</button>
311
+ * <button cngxRovingItem>Copy</button>
312
+ * <button cngxRovingItem>Paste</button>
313
+ * </div>
314
+ * ```
315
+ *
316
+ * ### Vertical menu with controlled index
317
+ * ```html
318
+ * <ul cngxRovingTabindex orientation="vertical" [(activeIndex)]="selectedIdx">
319
+ * @for (item of items(); track item.id) {
320
+ * <li cngxRovingItem>{{ item.label }}</li>
321
+ * }
322
+ * </ul>
323
+ * ```
324
+ *
325
+ * ### Virtual scroll integration
326
+ * ```html
327
+ * <div cngxRovingTabindex orientation="vertical" [virtualCount]="recycler.ariaSetSize()">
328
+ * @for (item of visibleItems(); track item.id; let i = $index) {
329
+ * <div cngxRovingItem [cngxVirtualItem]="recycler" [cngxVirtualItemIndex]="recycler.start() + i">
330
+ * {{ item.name }}
331
+ * </div>
332
+ * }
333
+ * </div>
334
+ * ```
335
+ */
336
+ declare class CngxRovingTabindex {
337
+ /** Arrow key navigation axis. `'both'` enables both horizontal and vertical arrows. */
338
+ readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical" | "both">;
339
+ /** Whether navigation wraps from last to first and vice versa. */
340
+ readonly loop: _angular_core.InputSignal<boolean>;
341
+ /** Index of the currently active (focusable) item. Supports two-way `[(activeIndex)]` binding. */
342
+ readonly activeIndex: _angular_core.ModelSignal<number>;
343
+ /**
344
+ * Total item count for virtual mode. When set, `activeIndex` ranges from 0 to
345
+ * `virtualCount - 1` and items are matched by `data-cngx-recycle-index` attribute.
346
+ * When not set, standard `contentChildren`-based navigation is used.
347
+ */
348
+ readonly virtualCount: _angular_core.InputSignal<number | undefined>;
349
+ /** All `CngxRovingItem` children discovered via `contentChildren`. */
350
+ private readonly items;
351
+ /** Guards against setting `tabindex` before the DOM is ready. */
352
+ private readonly initialized;
353
+ /** Host element for `data-cngx-recycle-index` queries in virtual mode. */
354
+ private readonly hostEl;
355
+ private readonly pendingFocusState;
356
+ /**
357
+ * Index of the item that should receive focus but is not currently in the DOM.
358
+ * Non-null when virtual navigation targets an out-of-range item.
359
+ * Used by `connectRecyclerToRoving()` to scroll the item into view and focus it.
360
+ */
361
+ readonly pendingFocus: _angular_core.Signal<number | null>;
362
+ constructor();
363
+ /**
364
+ * Clears the pending focus target. Called by `connectRecyclerToRoving()`
365
+ * after the item has been scrolled into view and focused.
366
+ */
367
+ clearPendingFocus(): void;
368
+ /**
369
+ * Handles arrow-key, Home, and End navigation within the group.
370
+ * Prevents default scrolling on arrow keys.
371
+ *
372
+ * Unified handler — delegates to virtual or contentChildren navigation
373
+ * based on whether `virtualCount` is set.
374
+ */
375
+ protected handleKeyDown(event: KeyboardEvent): void;
376
+ /**
377
+ * Attempts to focus a virtual item by querying `data-cngx-recycle-index`.
378
+ * If the element is not in the DOM, sets `pendingFocus` for external resolution.
379
+ */
380
+ private focusVirtualItem;
381
+ /**
382
+ * Finds the next index in virtual mode. No disabled-item skipping — can't check
383
+ * disabled state of items not in the DOM.
384
+ */
385
+ private findNextVirtual;
386
+ private enabledItems;
387
+ private isHorizontal;
388
+ private isVertical;
389
+ /**
390
+ * Searches for the next enabled item starting from `current + direction`.
391
+ * Respects `loop` — wraps around or stops at the boundary.
392
+ * Skips disabled items.
393
+ */
394
+ private findNext;
395
+ private findFirst;
396
+ private findLast;
397
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxRovingTabindex, never>;
398
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxRovingTabindex, "[cngxRovingTabindex]", ["cngxRovingTabindex"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "virtualCount": { "alias": "virtualCount"; "required": false; "isSignal": true; }; }, { "activeIndex": "activeIndexChange"; }, ["items"], never, true, never>;
399
+ }
400
+
401
+ /**
402
+ * Descriptor of an item managed by `CngxActiveDescendant`.
403
+ *
404
+ * `id` must be unique and stable across change detection runs (use `nextUid()`
405
+ * from `@cngx/core/utils`). `label` is used by typeahead matching.
406
+ */
407
+ interface ActiveDescendantItem {
408
+ /** Unique DOM `id` on the element — required for `aria-activedescendant`. */
409
+ readonly id: string;
410
+ /** Opaque value emitted on `activated`. Compared with `Object.is` by default. */
411
+ readonly value: unknown;
412
+ /** Human-readable text used by typeahead. Falls back to empty string. */
413
+ readonly label: string;
414
+ /** Disabled items are skipped during navigation when `skipDisabled` is true. */
415
+ readonly disabled?: boolean;
416
+ }
417
+ /**
418
+ * DI token for content-projected items that should register with the
419
+ * surrounding `CngxActiveDescendant`.
420
+ *
421
+ * Consumers like `CngxOption` and `CngxMenuItem` expose themselves via:
422
+ *
423
+ * ```typescript
424
+ * providers: [{ provide: CNGX_AD_ITEM, useExisting: MyItem }]
425
+ * ```
426
+ *
427
+ * The contained directive must expose `id`, `value`, `label`, and optionally
428
+ * `disabled` as signals — the AD reads them reactively.
429
+ */
430
+ declare const CNGX_AD_ITEM: InjectionToken<CngxAdItemHandle>;
431
+ /**
432
+ * Minimum shape an AD-registered directive must expose.
433
+ *
434
+ * The shape is signal-based so the AD recomputes when any field changes.
435
+ */
436
+ interface CngxAdItemHandle {
437
+ readonly id: string;
438
+ readonly value: Signal<unknown>;
439
+ /**
440
+ * Label accessor. Typically a signal, but may be a plain getter when the
441
+ * label derives from runtime DOM state (e.g. `textContent` fallback).
442
+ */
443
+ readonly label: Signal<string> | (() => string);
444
+ readonly disabled?: Signal<boolean>;
445
+ }
446
+
447
+ /**
448
+ * Implements the WAI-ARIA active-descendant keyboard pattern for composite
449
+ * widgets where focus stays on a single host element and the currently active
450
+ * option is communicated via `aria-activedescendant`.
451
+ *
452
+ * ### When to use this vs. `CngxRovingTabindex`
453
+ *
454
+ * - **Active-descendant** when focus should stay on one container and you need
455
+ * `role="listbox"`, `role="menu"`, combobox inputs, or any widget where
456
+ * individual options should not be tab-stops. Screen readers announce the
457
+ * referenced option while keeping the focus ring on the host.
458
+ * - **Roving tabindex** when individual items should be tab-stops (toolbar,
459
+ * tab list, grid cells). See `CngxRovingTabindex`.
460
+ *
461
+ * ### Item registration
462
+ *
463
+ * Items register either by providing `CNGX_AD_ITEM` via `hostDirectives` or
464
+ * `providers`, or by passing a `Signal<ActiveDescendantItem[]>` through the
465
+ * `items` input. The latter takes precedence and is intended for combobox-style
466
+ * consumers driven by a dynamic data source.
467
+ *
468
+ * ### Virtualization
469
+ *
470
+ * When `virtualCount` is set, navigation targets can address indices not
471
+ * currently in the DOM. `pendingHighlight` signals the consumer to scroll the
472
+ * missing item into view; after scroll, the consumer calls
473
+ * `clearPendingHighlight()`.
474
+ *
475
+ * ### Material/CDK equivalent
476
+ *
477
+ * Mirrors the model used by `cdk-listbox` and `mat-select` but exposes it as a
478
+ * standalone primitive — not coupled to any visual shell, signal-reactive end
479
+ * to end, and unified across listbox/menu/combobox stacks.
480
+ */
481
+ declare class CngxActiveDescendant {
482
+ /**
483
+ * Optional explicit item list. When provided, takes precedence over items
484
+ * registered via `CNGX_AD_ITEM`. Useful for combobox-style consumers that
485
+ * drive the menu from a dynamic data source — pass the unwrapped array
486
+ * (typically the result of a `computed()`), Angular's signal inputs make it
487
+ * reactive automatically.
488
+ */
489
+ readonly items: _angular_core.InputSignal<ActiveDescendantItem[] | undefined>;
490
+ /** Arrow-key navigation axis. Defaults to `'vertical'` (listbox/menu style). */
491
+ readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
492
+ /** Whether navigation wraps from last to first and vice versa. */
493
+ readonly loop: _angular_core.InputSignal<boolean>;
494
+ /** Whether alphanumeric typeahead navigation is enabled. */
495
+ readonly typeahead: _angular_core.InputSignal<boolean>;
496
+ /** Buffer reset window for typeahead, in milliseconds. */
497
+ readonly typeaheadDebounce: _angular_core.InputSignal<number>;
498
+ /** Whether the first non-disabled item is highlighted automatically. */
499
+ readonly autoHighlightFirst: _angular_core.InputSignal<boolean>;
500
+ /** Whether disabled items are skipped during navigation and value lookup. */
501
+ readonly skipDisabled: _angular_core.InputSignal<boolean>;
502
+ /**
503
+ * When set, navigation treats the range `[0, virtualCount)` as the item
504
+ * space even if only a subset is rendered. Targets outside the rendered
505
+ * range surface as `pendingHighlight` for scroll-and-retry protocols.
506
+ */
507
+ readonly virtualCount: _angular_core.InputSignal<number | undefined>;
508
+ /** Emitted when `activateCurrent()` is called with an active item. */
509
+ readonly activated: _angular_core.OutputEmitterRef<unknown>;
510
+ /** Emitted whenever the highlighted item changes. */
511
+ readonly highlighted: _angular_core.OutputEmitterRef<ActiveDescendantItem | null>;
512
+ private readonly hostEl;
513
+ private readonly registered;
514
+ /** Guards host attribute writes until after first render. */
515
+ private readonly initialized;
516
+ /** -1 means "no active item". Range is [0, resolvedItems().length). */
517
+ private readonly activeIndexState;
518
+ /** Index of an item that should be highlighted but is not in the DOM. */
519
+ private readonly pendingHighlightState;
520
+ readonly pendingHighlight: _angular_core.Signal<number | null>;
521
+ /**
522
+ * Resolved item list. Input `items` wins; otherwise the contentChildren
523
+ * handles are projected into `ActiveDescendantItem` shape.
524
+ */
525
+ readonly resolvedItems: _angular_core.Signal<ActiveDescendantItem[]>;
526
+ /** Current active index. `-1` when no item is highlighted. */
527
+ readonly activeIndex: _angular_core.Signal<number>;
528
+ /**
529
+ * `activeIndex` always mapped back to an item. `null` when no active index
530
+ * or the item is out of rendered range (virtual mode).
531
+ */
532
+ readonly activeItem: _angular_core.Signal<ActiveDescendantItem | null>;
533
+ readonly activeId: _angular_core.Signal<string | null>;
534
+ readonly activeValue: _angular_core.Signal<unknown>;
535
+ private readonly typeaheadBuffer;
536
+ private typeaheadTimer;
537
+ constructor();
538
+ highlightNext(): void;
539
+ highlightPrev(): void;
540
+ highlightFirst(): void;
541
+ highlightLast(): void;
542
+ /**
543
+ * Highlight by zero-based index. Out-of-range indices are ignored.
544
+ * Disabled items are rejected when `skipDisabled()` is true.
545
+ */
546
+ highlightByIndex(index: number): void;
547
+ /**
548
+ * Highlight the first item whose value matches (via `Object.is`). No-op if
549
+ * no match. Disabled items are rejected when `skipDisabled()` is true.
550
+ */
551
+ highlightByValue(value: unknown): void;
552
+ /** Clear the highlight. */
553
+ resetHighlight(): void;
554
+ /** Emit `activated` with the current item's value. No-op if nothing active. */
555
+ activateCurrent(): void;
556
+ /** Called by recycler bridges after scrolling the pending index into view. */
557
+ clearPendingHighlight(): void;
558
+ protected handleKeydown(event: KeyboardEvent): void;
559
+ private isNavKey;
560
+ private dispatchNav;
561
+ /**
562
+ * Push a printable character into the typeahead buffer and jump to the next
563
+ * matching option. Exposed for external keyboard hosts (e.g. a select
564
+ * trigger) that keep focus on themselves while using active-descendant
565
+ * semantics on a separate listbox.
566
+ *
567
+ * Consumers should only forward single-character printable keys (`length === 1`,
568
+ * non-whitespace). Navigation keys and non-printables must not be forwarded.
569
+ */
570
+ typeaheadChar(ch: string): void;
571
+ private handleTypeahead;
572
+ private findFrom;
573
+ private findBoundary;
574
+ private totalCount;
575
+ private isDisabledAt;
576
+ private isRendered;
577
+ private scrollActiveIntoView;
578
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxActiveDescendant, never>;
579
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxActiveDescendant, "[cngxActiveDescendant]", ["cngxActiveDescendant"], { "items": { "alias": "items"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "typeahead": { "alias": "typeahead"; "required": false; "isSignal": true; }; "typeaheadDebounce": { "alias": "typeaheadDebounce"; "required": false; "isSignal": true; }; "autoHighlightFirst": { "alias": "autoHighlightFirst"; "required": false; "isSignal": true; }; "skipDisabled": { "alias": "skipDisabled"; "required": false; "isSignal": true; }; "virtualCount": { "alias": "virtualCount"; "required": false; "isSignal": true; }; }, { "activated": "activated"; "highlighted": "highlighted"; }, ["registered"], never, true, never>;
580
+ }
581
+
582
+ /**
583
+ * Reflects the user's `prefers-reduced-motion` media query as a reactive signal.
584
+ *
585
+ * Adds the `cngx-reduced-motion` CSS class to the host when the user prefers
586
+ * reduced motion. The `prefersReducedMotion()` signal updates live when the
587
+ * OS preference changes — use it in TypeScript to skip animations, disable
588
+ * auto-playing media, or choose between animated and instant transitions.
589
+ *
590
+ * Unlike a CSS-only `@media (prefers-reduced-motion: reduce)` approach, this
591
+ * directive makes the preference available in component logic (e.g., to pick
592
+ * a different animation strategy or suppress requestAnimationFrame loops).
593
+ *
594
+ * ### Conditional animation
595
+ * ```html
596
+ * <div cngxReducedMotion #rm="cngxReducedMotion"
597
+ * [style.animation]="rm.prefersReducedMotion() ? 'none' : 'spin 2s linear infinite'">
598
+ * </div>
599
+ * ```
600
+ *
601
+ * ### TypeScript logic
602
+ * ```typescript
603
+ * readonly rm = viewChild(CngxReducedMotion);
604
+ * readonly duration = computed(() => this.rm()?.prefersReducedMotion() ? 0 : 300);
605
+ * ```
606
+ */
607
+ declare class CngxReducedMotion {
608
+ /** `true` when the user's OS is set to prefer reduced motion. Updates reactively. */
609
+ readonly prefersReducedMotion: Signal<boolean>;
610
+ constructor();
611
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxReducedMotion, never>;
612
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxReducedMotion, "[cngxReducedMotion]", ["cngxReducedMotion"], {}, {}, never, never, true, never>;
613
+ }
614
+
615
+ export { CNGX_AD_ITEM, CngxActiveDescendant, CngxAriaExpanded, CngxAutofocus, CngxFocusRestore, CngxFocusTrap, CngxFocusVisible, CngxLiveRegion, CngxReducedMotion, CngxRovingItem, CngxRovingTabindex };
616
+ export type { ActiveDescendantItem, CngxAdItemHandle };