@cngx/common 0.1.0-rc.9 → 0.3.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.
- package/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +19 -8
- package/data/README.md +10 -10
- package/fesm2022/cngx-common-a11y.mjs +701 -263
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +83 -64
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +135 -76
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +749 -296
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +51 -29
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +695 -405
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +112 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +668 -308
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7066 -2739
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2121 -492
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1207 -569
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +256 -261
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +202 -262
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +28 -61
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +1 -1
- package/menu-button/README.md +234 -0
- package/package.json +14 -4
- package/popover/README.md +42 -5
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/ng-add/index.js +7 -7
- package/schematics/ng-add/schema.json +5 -0
- package/stepper/README.md +0 -1
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +43 -11
- package/theming/components/cngx-popover.css +37 -13
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +343 -120
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +671 -384
- package/types/cngx-common-command.d.ts +44 -47
- package/types/cngx-common-data.d.ts +350 -342
- package/types/cngx-common-dialog.d.ts +91 -120
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4350 -1723
- package/types/cngx-common-layout.d.ts +1365 -286
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +671 -289
- package/types/cngx-common-stepper.d.ts +217 -347
- package/types/cngx-common-tabs.d.ts +173 -386
- package/types/cngx-common-timeline.d.ts +25 -104
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectionToken, Signal, OnDestroy, ElementRef } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Lets a directive that composes `CngxAriaExpanded` as a host directive drive
|
|
6
|
+
* `aria-expanded` from its own state instead of `[cngxAriaExpanded]`.
|
|
7
|
+
* Provided by the composer on the same element (`useExisting`); the ARIA
|
|
8
|
+
* directive resolves it lazily with `self: true`, because the composer
|
|
9
|
+
* constructs after its host directives. `CngxExpandable` is the in-library
|
|
10
|
+
* composer.
|
|
11
|
+
*
|
|
12
|
+
* @relatedTo CngxAriaExpanded, CNGX_ARIA_EXPANDED_DRIVER
|
|
13
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts
|
|
14
|
+
* @since 0.3.0
|
|
15
|
+
*/
|
|
16
|
+
interface CngxAriaExpandedDriver {
|
|
17
|
+
/**
|
|
18
|
+
* The `aria-expanded` value; wins over `[cngxAriaExpanded]`. `null` omits
|
|
19
|
+
* the attribute, for a host that has nothing to expand (a leaf tree item).
|
|
20
|
+
*/
|
|
21
|
+
readonly ariaExpanded: Signal<boolean | null>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Injection token for a {@link CngxAriaExpandedDriver}. A composer provides it
|
|
25
|
+
* on its own element (`useExisting`) to override `[cngxAriaExpanded]` of its
|
|
26
|
+
* `CngxAriaExpanded` host directive; `aria-controls` still follows
|
|
27
|
+
* `[controls]`. Used by `CngxExpandable`.
|
|
28
|
+
*
|
|
29
|
+
* @relatedTo CngxAriaExpanded
|
|
30
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts
|
|
31
|
+
* @since 0.3.0
|
|
32
|
+
*/
|
|
33
|
+
declare const CNGX_ARIA_EXPANDED_DRIVER: InjectionToken<CngxAriaExpandedDriver>;
|
|
4
34
|
/**
|
|
5
35
|
* Manages `aria-expanded` and optionally `aria-controls` on the host element.
|
|
6
36
|
*
|
|
@@ -32,19 +62,24 @@ import { OnDestroy, InjectionToken, Signal, ElementRef } from '@angular/core';
|
|
|
32
62
|
* }
|
|
33
63
|
* ```
|
|
34
64
|
*
|
|
35
|
-
* @category common/a11y
|
|
36
65
|
* @wcag AA
|
|
37
66
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts
|
|
38
|
-
* @since 0.
|
|
67
|
+
* @since 0.3.0
|
|
39
68
|
* @relatedTo CngxLiveRegion, CngxExpandable, CngxDisclosure
|
|
40
|
-
* <example-url
|
|
41
|
-
* <example-url
|
|
69
|
+
* <example-url>/#/common/a11y/aria-expanded/accordion-multiple-panels</example-url>
|
|
70
|
+
* <example-url>/#/common/a11y/aria-expanded/disclosure-pattern</example-url>
|
|
71
|
+
* @axis level atom
|
|
42
72
|
*/
|
|
43
73
|
declare class CngxAriaExpanded {
|
|
44
74
|
/** Whether the controlled element is currently expanded. Sets `aria-expanded`. */
|
|
45
|
-
readonly expanded: _angular_core.
|
|
75
|
+
readonly expanded: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
46
76
|
/** The `id` of the controlled element. Sets `aria-controls`. */
|
|
47
77
|
readonly controls: _angular_core.InputSignal<string | undefined>;
|
|
78
|
+
private readonly injector;
|
|
79
|
+
private resolvedDriver;
|
|
80
|
+
private driver;
|
|
81
|
+
/** @internal The written attribute value: the driver's when composed, else the input. */
|
|
82
|
+
protected readonly ariaExpanded: Signal<boolean | null>;
|
|
48
83
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAriaExpanded, never>;
|
|
49
84
|
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>;
|
|
50
85
|
}
|
|
@@ -59,9 +94,9 @@ declare class CngxAriaExpanded {
|
|
|
59
94
|
* Sets `role="alert"` for assertive regions and `role="status"` for polite regions
|
|
60
95
|
* via a host binding - no manual attribute wiring needed.
|
|
61
96
|
*
|
|
62
|
-
* Unlike
|
|
63
|
-
*
|
|
64
|
-
*
|
|
97
|
+
* Unlike `CngxLiveAnnouncer` (hidden regions it owns, imperative
|
|
98
|
+
* `announce()` calls), this directive decorates your own element
|
|
99
|
+
* declaratively - the content you render IS the announcement.
|
|
65
100
|
*
|
|
66
101
|
* ### Status message
|
|
67
102
|
* ```html
|
|
@@ -78,13 +113,13 @@ declare class CngxAriaExpanded {
|
|
|
78
113
|
* </div>
|
|
79
114
|
* ```
|
|
80
115
|
*
|
|
81
|
-
* @category common/a11y
|
|
82
116
|
* @wcag AA
|
|
83
117
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-region.directive.ts
|
|
84
|
-
* @since 0.
|
|
85
|
-
* @relatedTo
|
|
86
|
-
* <example-url
|
|
87
|
-
* <example-url
|
|
118
|
+
* @since 0.3.0
|
|
119
|
+
* @relatedTo CngxLiveAnnouncer
|
|
120
|
+
* <example-url>/#/common/a11y/live-region/form-validation-assertive-error-announcements</example-url>
|
|
121
|
+
* <example-url>/#/common/a11y/live-region/polite-vs-assertive</example-url>
|
|
122
|
+
* @axis level atom
|
|
88
123
|
*/
|
|
89
124
|
declare class CngxLiveRegion {
|
|
90
125
|
/**
|
|
@@ -105,8 +140,6 @@ declare class CngxLiveRegion {
|
|
|
105
140
|
/**
|
|
106
141
|
* Politeness channel for {@link CngxLiveAnnouncer.announce}: `'polite'` queues
|
|
107
142
|
* after the current utterance, `'assertive'` interrupts it immediately.
|
|
108
|
-
*
|
|
109
|
-
* @category common/a11y
|
|
110
143
|
*/
|
|
111
144
|
type AriaLivePoliteness = 'polite' | 'assertive';
|
|
112
145
|
/**
|
|
@@ -120,11 +153,14 @@ type AriaLivePoliteness = 'polite' | 'assertive';
|
|
|
120
153
|
* directives and event handlers (e.g. `CngxCopyValue` copy success,
|
|
121
154
|
* `CngxOtpInput` completion).
|
|
122
155
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* polite
|
|
127
|
-
*
|
|
156
|
+
* Both body regions are created when the service is created, so they are in
|
|
157
|
+
* the DOM before the first announcement (a screen reader commonly misses a
|
|
158
|
+
* change to a region inserted a frame earlier), and reused thereafter.
|
|
159
|
+
* Because polite and assertive live in separate fixed-politeness nodes, an
|
|
160
|
+
* assertive announcement never clobbers a concurrent polite one. Per region,
|
|
161
|
+
* the text is cleared and re-set one frame later so an identical consecutive
|
|
162
|
+
* message is still re-read by the screen reader. A written message is cleared
|
|
163
|
+
* again after 7 s, so no stale text stays in the region.
|
|
128
164
|
*
|
|
129
165
|
* A modal dialog hides everything outside it from assistive technology, so a
|
|
130
166
|
* body region is silent while one is open. Pass the announcing element as the
|
|
@@ -154,16 +190,17 @@ type AriaLivePoliteness = 'polite' | 'assertive';
|
|
|
154
190
|
* announcer.announce('Alert dismissed', 'polite', hostElement); // inside a modal
|
|
155
191
|
* ```
|
|
156
192
|
*
|
|
157
|
-
* @category common/a11y
|
|
158
193
|
* @wcag AA
|
|
159
194
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-announcer.ts
|
|
160
|
-
* @since 0.
|
|
195
|
+
* @since 0.3.0
|
|
161
196
|
* @relatedTo CngxLiveRegion
|
|
197
|
+
* <example-url>/#/common/a11y/live-announcer/polite-vs-assertive</example-url>
|
|
162
198
|
*/
|
|
163
199
|
declare class CngxLiveAnnouncer implements OnDestroy {
|
|
164
200
|
private readonly doc;
|
|
165
201
|
private readonly isBrowser;
|
|
166
202
|
private regions;
|
|
203
|
+
constructor();
|
|
167
204
|
/**
|
|
168
205
|
* One pair per open `aria-modal` container, released once it closes.
|
|
169
206
|
* `outer` is the container's parent at creation, the route for its unwritten
|
|
@@ -209,8 +246,6 @@ declare class CngxLiveAnnouncer implements OnDestroy {
|
|
|
209
246
|
|
|
210
247
|
/**
|
|
211
248
|
* A message whose write into its live region has not landed yet.
|
|
212
|
-
*
|
|
213
|
-
* @category common/a11y
|
|
214
249
|
*/
|
|
215
250
|
interface CngxPendingAnnouncement {
|
|
216
251
|
readonly message: string;
|
|
@@ -219,8 +254,6 @@ interface CngxPendingAnnouncement {
|
|
|
219
254
|
|
|
220
255
|
/**
|
|
221
256
|
* Polite + assertive live regions inside one host element.
|
|
222
|
-
*
|
|
223
|
-
* @category common/a11y
|
|
224
257
|
*/
|
|
225
258
|
interface CngxScopedLiveRegion {
|
|
226
259
|
/** Speak `message` from the region of `politeness` (default `'polite'`). */
|
|
@@ -244,7 +277,7 @@ interface CngxScopedLiveRegion {
|
|
|
244
277
|
* clobbers a polite status.
|
|
245
278
|
*
|
|
246
279
|
* Must run in an injection context; the regions are removed when that context
|
|
247
|
-
* is destroyed. No-op on the server.
|
|
280
|
+
* is destroyed, and later calls are no-ops. No-op on the server.
|
|
248
281
|
*
|
|
249
282
|
* ```typescript
|
|
250
283
|
* private readonly region = injectScopedLiveRegion(inject(ElementRef).nativeElement);
|
|
@@ -256,11 +289,11 @@ interface CngxScopedLiveRegion {
|
|
|
256
289
|
*
|
|
257
290
|
* @param host - Element that receives the two visually hidden regions.
|
|
258
291
|
*
|
|
259
|
-
* @category common/a11y
|
|
260
292
|
* @wcag AA
|
|
261
293
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/scoped-live-region.ts
|
|
262
|
-
* @since 0.
|
|
294
|
+
* @since 0.3.0
|
|
263
295
|
* @relatedTo CngxLiveAnnouncer, CngxLiveRegion
|
|
296
|
+
* <example-url>/#/common/a11y/live-announcer/scoped-announcing-in-a-modal</example-url>
|
|
264
297
|
*/
|
|
265
298
|
declare function injectScopedLiveRegion(host: HTMLElement): CngxScopedLiveRegion;
|
|
266
299
|
|
|
@@ -291,17 +324,17 @@ declare function injectScopedLiveRegion(host: HTMLElement): CngxScopedLiveRegion
|
|
|
291
324
|
* <input cngxAutofocus [autofocusDelay]="200" />
|
|
292
325
|
* ```
|
|
293
326
|
*
|
|
294
|
-
* @category common/a11y
|
|
295
327
|
* @wcag AA
|
|
296
328
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/autofocus.directive.ts
|
|
297
|
-
* @since 0.
|
|
329
|
+
* @since 0.3.0
|
|
298
330
|
* @relatedTo CngxFocusRestore, CngxFocusTrap, CngxFocusVisible
|
|
299
|
-
* <example-url
|
|
300
|
-
* <example-url
|
|
331
|
+
* <example-url>/#/common/a11y/autofocus/conditional-focus</example-url>
|
|
332
|
+
* <example-url>/#/common/a11y/autofocus/focus-on-insert</example-url>
|
|
333
|
+
* @axis level atom
|
|
301
334
|
*/
|
|
302
335
|
declare class CngxAutofocus {
|
|
303
336
|
/** Whether to focus the element. Defaults to `true` (always focus on render). */
|
|
304
|
-
readonly when: _angular_core.
|
|
337
|
+
readonly when: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
305
338
|
/** Delay in ms before focusing - useful when the element appears during a transition. */
|
|
306
339
|
readonly delay: _angular_core.InputSignal<number>;
|
|
307
340
|
/** `FocusOptions` passed to `element.focus()`. */
|
|
@@ -320,27 +353,62 @@ declare class CngxAutofocus {
|
|
|
320
353
|
|
|
321
354
|
/**
|
|
322
355
|
* CSS selector matching natively-focusable elements: links with an
|
|
323
|
-
* `href`, the enabled form controls,
|
|
324
|
-
* non-negative `tabindex`.
|
|
325
|
-
* a disabled control is not in
|
|
326
|
-
*
|
|
327
|
-
* could land on an unfocusable element.
|
|
328
|
-
* this focusable" - the element-level
|
|
329
|
-
* matches against it, and descendant probes
|
|
330
|
-
* contain a focusable child?") query against it.
|
|
331
|
-
* stops the two uses from drifting apart.
|
|
332
|
-
*
|
|
333
|
-
* @
|
|
334
|
-
|
|
356
|
+
* `href`, the enabled form controls, the summary of a `<details>`,
|
|
357
|
+
* editable content, and anything with an explicit non-negative `tabindex`.
|
|
358
|
+
* Form controls carry `:not(:disabled)` because a disabled control is not in
|
|
359
|
+
* the tab order - without it a descendant probe would count a disabled button
|
|
360
|
+
* as focusable and a restore target could land on an unfocusable element.
|
|
361
|
+
* Single source of truth for "is this focusable" - the element-level
|
|
362
|
+
* {@link CngxFocusRestore} predicate matches against it, and descendant probes
|
|
363
|
+
* (e.g. "does this panel contain a focusable child?") query against it.
|
|
364
|
+
* Keeping one selector stops the two uses from drifting apart.
|
|
365
|
+
*
|
|
366
|
+
* @since 0.3.0
|
|
367
|
+
*/
|
|
368
|
+
declare const CNGX_FOCUSABLE_SELECTOR = "a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), details > summary:first-of-type, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])";
|
|
369
|
+
/**
|
|
370
|
+
* Lets a directive that composes `CngxFocusRestore` as a host directive drive
|
|
371
|
+
* its capture / restore edges from its own state instead of
|
|
372
|
+
* `[cngxFocusRestoreWhile]`. Provided by the composer on the same element
|
|
373
|
+
* (`useExisting`); the restore directive resolves it lazily with
|
|
374
|
+
* `self: true`, because the composer constructs after its host directives.
|
|
375
|
+
* `CngxDrawerSurface` is the in-library composer.
|
|
376
|
+
*
|
|
377
|
+
* @relatedTo CngxFocusRestore, CNGX_FOCUS_RESTORE_DRIVER
|
|
378
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts
|
|
379
|
+
* @since 0.3.0
|
|
335
380
|
*/
|
|
336
|
-
|
|
381
|
+
interface CngxFocusRestoreDriver {
|
|
382
|
+
/** Whether the surface is engaged; wins over `[cngxFocusRestoreWhile]`. */
|
|
383
|
+
readonly focusRestoreActive: Signal<boolean>;
|
|
384
|
+
/**
|
|
385
|
+
* The fallback when the stored element cannot take focus back; wins over
|
|
386
|
+
* the `[fallback]` input. Read at restore time, so a composer can derive
|
|
387
|
+
* it from the DOM (the element that controls the host).
|
|
388
|
+
*/
|
|
389
|
+
focusRestoreFallback?(): HTMLElement | null;
|
|
390
|
+
}
|
|
337
391
|
/**
|
|
338
|
-
*
|
|
392
|
+
* Injection token for a {@link CngxFocusRestoreDriver}. A composer provides it
|
|
393
|
+
* on its own element (`useExisting`) to override `[cngxFocusRestoreWhile]`
|
|
394
|
+
* and `[fallback]` of its `CngxFocusRestore` host directive. Used by
|
|
395
|
+
* `CngxDrawerSurface`.
|
|
396
|
+
*
|
|
397
|
+
* @relatedTo CngxFocusRestore
|
|
398
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts
|
|
399
|
+
* @since 0.3.0
|
|
400
|
+
*/
|
|
401
|
+
declare const CNGX_FOCUS_RESTORE_DRIVER: InjectionToken<CngxFocusRestoreDriver>;
|
|
402
|
+
/**
|
|
403
|
+
* Stores the previously focused element and restores focus on destroy, or on
|
|
404
|
+
* the falling edge of `[cngxFocusRestoreWhile]` for a surface that stays in
|
|
405
|
+
* the DOM while closed.
|
|
339
406
|
*
|
|
340
407
|
* Prevents focus from falling to `<body>` when dynamic content is removed
|
|
341
408
|
* (dialogs closing, panels collapsing, tabs switching). The directive captures
|
|
342
409
|
* `document.activeElement` at initialization time and restores it when the
|
|
343
|
-
* host element is destroyed
|
|
410
|
+
* host element is destroyed while focus is inside it or has dropped to
|
|
411
|
+
* `<body>`. Focus the user moved elsewhere before the destroy stays put.
|
|
344
412
|
*
|
|
345
413
|
* Fallback chain: stored element → provided fallback → nearest focusable ancestor.
|
|
346
414
|
* When none resolves, focus is left where the browser put it - `<body>` is
|
|
@@ -356,39 +424,73 @@ declare const CNGX_FOCUSABLE_SELECTOR = "a[href], button:not(:disabled), input:n
|
|
|
356
424
|
* }
|
|
357
425
|
* ```
|
|
358
426
|
*
|
|
427
|
+
* ### Persistent surface (drawer, sidebar overlay)
|
|
428
|
+
* ```html
|
|
429
|
+
* <aside cngxFocusRestore [cngxFocusRestoreWhile]="open()">…</aside>
|
|
430
|
+
* ```
|
|
431
|
+
* `true` captures the focused element, `false` restores it when focus is
|
|
432
|
+
* still inside the host or has dropped to `<body>`. Focus the user moved
|
|
433
|
+
* elsewhere in the meantime stays where it is. A target that is still
|
|
434
|
+
* `inert` at the falling edge (a backdrop released in the same pass) is
|
|
435
|
+
* focused after the next render instead.
|
|
436
|
+
*
|
|
359
437
|
* ### With explicit fallback
|
|
360
438
|
* ```html
|
|
361
|
-
* <div cngxFocusRestore [
|
|
439
|
+
* <div cngxFocusRestore [fallback]="fallbackBtn">
|
|
362
440
|
* Dynamic content…
|
|
363
441
|
* </div>
|
|
364
442
|
* <button #fallbackBtn>Fallback target</button>
|
|
365
443
|
* ```
|
|
366
444
|
*
|
|
367
|
-
* @category common/a11y
|
|
368
445
|
* @wcag AA
|
|
369
446
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts
|
|
370
|
-
* @since 0.
|
|
447
|
+
* @since 0.3.0
|
|
371
448
|
* @relatedTo CngxAutofocus, CngxFocusTrap, CngxFocusVisible
|
|
372
|
-
* <example-url
|
|
373
|
-
* <example-url
|
|
449
|
+
* <example-url>/#/common/a11y/focus-restore/inline-details</example-url>
|
|
450
|
+
* <example-url>/#/common/a11y/focus-restore/panel-with-automatic-restore</example-url>
|
|
451
|
+
* <example-url>/#/common/a11y/focus-restore/persistent-panel-restore-while-open</example-url>
|
|
452
|
+
* @axis level atom
|
|
374
453
|
*/
|
|
375
454
|
declare class CngxFocusRestore {
|
|
376
|
-
/**
|
|
455
|
+
/**
|
|
456
|
+
* Whether to restore focus when the host element is destroyed. Applies only
|
|
457
|
+
* when focus is inside the host or on `<body>` at that moment.
|
|
458
|
+
*/
|
|
377
459
|
readonly restoreOnDestroy: _angular_core.InputSignal<boolean>;
|
|
378
460
|
/** Explicit fallback element if the stored element is no longer in the DOM. */
|
|
379
461
|
readonly fallback: _angular_core.InputSignal<HTMLElement | null>;
|
|
462
|
+
/**
|
|
463
|
+
* Bind to the open state of a surface that stays in the DOM while closed.
|
|
464
|
+
* The `false -> true` edge captures the focused element, the
|
|
465
|
+
* `true -> false` edge restores it when focus is inside the host or on
|
|
466
|
+
* `<body>`. While bound, destroying the host restores only when it is
|
|
467
|
+
* engaged. Unbound (`undefined`), only destroy and the manual
|
|
468
|
+
* `capture()` / `restore()` apply.
|
|
469
|
+
*/
|
|
470
|
+
readonly whileActive: _angular_core.InputSignal<boolean | undefined>;
|
|
380
471
|
private readonly doc;
|
|
381
472
|
private readonly el;
|
|
382
|
-
private readonly
|
|
473
|
+
private readonly injector;
|
|
474
|
+
private storedElement;
|
|
475
|
+
private lastParent;
|
|
476
|
+
private resolvedDriver;
|
|
477
|
+
private driver;
|
|
478
|
+
private readonly engaged;
|
|
479
|
+
private readonly engagement;
|
|
383
480
|
constructor();
|
|
384
481
|
/** Manually store the current focus target for later restoration. */
|
|
385
482
|
capture(): void;
|
|
386
483
|
/** Manually restore focus to the stored element. */
|
|
387
484
|
restore(): void;
|
|
485
|
+
private edgeDriven;
|
|
486
|
+
private captureOutside;
|
|
487
|
+
private restoreIfFocusInside;
|
|
488
|
+
private focusLost;
|
|
489
|
+
private host;
|
|
388
490
|
/**
|
|
389
491
|
* Walks the fallback chain:
|
|
390
492
|
* 1. Stored element (if still in DOM and not body/self)
|
|
391
|
-
* 2.
|
|
493
|
+
* 2. The driver's fallback, else the explicit fallback input
|
|
392
494
|
* 3. Nearest focusable ancestor
|
|
393
495
|
*/
|
|
394
496
|
private resolveTarget;
|
|
@@ -402,15 +504,19 @@ declare class CngxFocusRestore {
|
|
|
402
504
|
*/
|
|
403
505
|
private isFocusable;
|
|
404
506
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxFocusRestore, never>;
|
|
405
|
-
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>;
|
|
507
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxFocusRestore, "[cngxFocusRestore]", ["cngxFocusRestore"], { "restoreOnDestroy": { "alias": "restoreOnDestroy"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; "whileActive": { "alias": "cngxFocusRestoreWhile"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
406
508
|
}
|
|
407
509
|
|
|
408
510
|
/**
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
511
|
+
* Lets a directive that composes `CngxFocusTrap` as a host directive drive it
|
|
512
|
+
* from its own state instead of the inputs. Provided by the composer on the
|
|
513
|
+
* same element (`useExisting`); the trap resolves it lazily with
|
|
514
|
+
* `self: true`, because the composer constructs after its host directives.
|
|
515
|
+
* `CngxDrawerSurface` and `CngxPopoverSheet` are the in-library composers.
|
|
516
|
+
*
|
|
517
|
+
* @relatedTo CngxFocusTrap, CNGX_FOCUS_TRAP_DRIVER
|
|
518
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts
|
|
519
|
+
* @since 0.3.0
|
|
414
520
|
*/
|
|
415
521
|
interface CngxFocusTrapDriver {
|
|
416
522
|
/** Whether the trap is active; wins over `[enabled]`. */
|
|
@@ -418,7 +524,16 @@ interface CngxFocusTrapDriver {
|
|
|
418
524
|
/** Whether activation auto-focuses; wins over `[autoFocus]`. */
|
|
419
525
|
readonly focusTrapAutoFocus: boolean;
|
|
420
526
|
}
|
|
421
|
-
/**
|
|
527
|
+
/**
|
|
528
|
+
* Injection token for a {@link CngxFocusTrapDriver}. A composer provides it on
|
|
529
|
+
* its own element (`useExisting`) to override `[enabled]` and `[autoFocus]` of
|
|
530
|
+
* its `CngxFocusTrap` host directive. Used by `CngxDrawerSurface` and
|
|
531
|
+
* `CngxPopoverSheet`.
|
|
532
|
+
*
|
|
533
|
+
* @relatedTo CngxFocusTrap
|
|
534
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts
|
|
535
|
+
* @since 0.3.0
|
|
536
|
+
*/
|
|
422
537
|
declare const CNGX_FOCUS_TRAP_DRIVER: InjectionToken<CngxFocusTrapDriver>;
|
|
423
538
|
/**
|
|
424
539
|
* Traps keyboard focus within the host element using the CDK `FocusTrap`.
|
|
@@ -454,14 +569,13 @@ declare const CNGX_FOCUS_TRAP_DRIVER: InjectionToken<CngxFocusTrapDriver>;
|
|
|
454
569
|
* </nav>
|
|
455
570
|
* ```
|
|
456
571
|
*
|
|
457
|
-
* @category common/a11y
|
|
458
|
-
* @docsKind primary
|
|
459
572
|
* @wcag AA
|
|
460
573
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts
|
|
461
|
-
* @since 0.
|
|
574
|
+
* @since 0.3.0
|
|
462
575
|
* @relatedTo CngxAutofocus, CngxFocusRestore, CngxDialog
|
|
463
|
-
* <example-url
|
|
464
|
-
* <example-url
|
|
576
|
+
* <example-url>/#/common/a11y/focus-trap/modal-dialog</example-url>
|
|
577
|
+
* <example-url>/#/common/a11y/focus-trap/slide-out-drawer</example-url>
|
|
578
|
+
* @axis level atom
|
|
465
579
|
*/
|
|
466
580
|
declare class CngxFocusTrap {
|
|
467
581
|
/** Whether the focus trap is active. When `false`, Tab navigates normally. */
|
|
@@ -514,13 +628,13 @@ declare class CngxFocusTrap {
|
|
|
514
628
|
* </button>
|
|
515
629
|
* ```
|
|
516
630
|
*
|
|
517
|
-
* @category common/a11y
|
|
518
631
|
* @wcag AA
|
|
519
632
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-visible.directive.ts
|
|
520
|
-
* @since 0.
|
|
633
|
+
* @since 0.3.0
|
|
521
634
|
* @relatedTo CngxAutofocus, CngxFocusRestore, CngxFocusTrap
|
|
522
|
-
* <example-url
|
|
523
|
-
* <example-url
|
|
635
|
+
* <example-url>/#/common/a11y/focus-visible/form-fields-custom-focus-ring</example-url>
|
|
636
|
+
* <example-url>/#/common/a11y/focus-visible/keyboard-vs-pointer</example-url>
|
|
637
|
+
* @axis level atom
|
|
524
638
|
*/
|
|
525
639
|
declare class CngxFocusVisible {
|
|
526
640
|
private readonly doc;
|
|
@@ -529,10 +643,12 @@ declare class CngxFocusVisible {
|
|
|
529
643
|
readonly focusVisible: _angular_core.Signal<boolean>;
|
|
530
644
|
private pointerActive;
|
|
531
645
|
private pointerClearTimer;
|
|
646
|
+
private readonly releasePointer;
|
|
532
647
|
private readonly schedulePointerClear;
|
|
533
648
|
constructor();
|
|
534
649
|
/** @internal Arms the pointer flag for the imminent focusin. */
|
|
535
650
|
protected handlePointerDown(): void;
|
|
651
|
+
private removeReleaseListeners;
|
|
536
652
|
/** @internal Sets focus-visible state; clears pointer flag. */
|
|
537
653
|
protected handleFocus(): void;
|
|
538
654
|
/** @internal Clears focus-visible state on blur. */
|
|
@@ -556,13 +672,12 @@ declare class CngxFocusVisible {
|
|
|
556
672
|
* </div>
|
|
557
673
|
* ```
|
|
558
674
|
*
|
|
559
|
-
* @category common/a11y
|
|
560
675
|
* @wcag AA
|
|
561
676
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts
|
|
562
|
-
* @since 0.
|
|
677
|
+
* @since 0.3.0
|
|
563
678
|
* @relatedTo CngxRovingTabindex, CngxButtonToggle
|
|
564
|
-
* <example-url
|
|
565
|
-
* <example-url
|
|
679
|
+
* <example-url>/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>
|
|
680
|
+
* <example-url>/#/common/a11y/roving-tabindex/vertical-menu</example-url>
|
|
566
681
|
*/
|
|
567
682
|
declare class CngxRovingItem {
|
|
568
683
|
/** @internal Reference used by the parent `CngxRovingTabindex` to set `tabindex`. */
|
|
@@ -584,6 +699,17 @@ declare class CngxRovingItem {
|
|
|
584
699
|
* Works for toolbars, tab lists, card grids, menu bars, and any composite
|
|
585
700
|
* widget where only one item should be in the tab order at a time.
|
|
586
701
|
*
|
|
702
|
+
* ### Keys the group leaves alone
|
|
703
|
+
*
|
|
704
|
+
* A key from a text field (an `<input>` item, a field inside an item), a key
|
|
705
|
+
* of an IME composition, and an arrow from inside a nested widget that owns
|
|
706
|
+
* its arrows (a range input or an element with a slider, spinbutton,
|
|
707
|
+
* scrollbar, combobox, listbox, tree, treegrid, grid, menu, menubar,
|
|
708
|
+
* tablist, radiogroup or toolbar role)
|
|
709
|
+
* stays with that element. A custom widget without one of those roles keeps
|
|
710
|
+
* its arrows by calling `preventDefault()` on the keys it handles: the group
|
|
711
|
+
* skips every key that arrives already handled.
|
|
712
|
+
*
|
|
587
713
|
* ### Virtual mode
|
|
588
714
|
*
|
|
589
715
|
* When `virtualCount` is set, `activeIndex` ranges from 0 to `virtualCount - 1`
|
|
@@ -621,14 +747,13 @@ declare class CngxRovingItem {
|
|
|
621
747
|
* </div>
|
|
622
748
|
* ```
|
|
623
749
|
*
|
|
624
|
-
* @category common/a11y
|
|
625
|
-
* @docsKind primary
|
|
626
750
|
* @wcag AA
|
|
627
751
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts
|
|
628
|
-
* @since 0.
|
|
752
|
+
* @since 0.3.0
|
|
629
753
|
* @relatedTo CngxRovingItem, CngxActiveDescendant
|
|
630
|
-
* <example-url
|
|
631
|
-
* <example-url
|
|
754
|
+
* <example-url>/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>
|
|
755
|
+
* <example-url>/#/common/a11y/roving-tabindex/vertical-menu</example-url>
|
|
756
|
+
* @axis level atom
|
|
632
757
|
*/
|
|
633
758
|
declare class CngxRovingTabindex {
|
|
634
759
|
/**
|
|
@@ -651,8 +776,15 @@ declare class CngxRovingTabindex {
|
|
|
651
776
|
readonly virtualCount: _angular_core.InputSignal<number | undefined>;
|
|
652
777
|
/** All `CngxRovingItem` children discovered via `contentChildren`. */
|
|
653
778
|
private readonly items;
|
|
654
|
-
/**
|
|
655
|
-
|
|
779
|
+
/**
|
|
780
|
+
* Flips after the first browser render. Virtual mode waits for it: it reads
|
|
781
|
+
* the `data-cngx-recycle-index` attributes, which the item bindings write
|
|
782
|
+
* during that render. Standard mode writes before it (so a server render
|
|
783
|
+
* carries the tab stops) and once more after it, because an item's own
|
|
784
|
+
* `[attr.tabindex]` binding (null under a roving parent) clears the
|
|
785
|
+
* attribute during that render.
|
|
786
|
+
*/
|
|
787
|
+
private readonly rendered;
|
|
656
788
|
/** Host element for `data-cngx-recycle-index` queries in virtual mode. */
|
|
657
789
|
private readonly hostEl;
|
|
658
790
|
private readonly pendingFocusState;
|
|
@@ -694,6 +826,13 @@ declare class CngxRovingTabindex {
|
|
|
694
826
|
* based on whether `virtualCount` is set.
|
|
695
827
|
*/
|
|
696
828
|
protected handleKeyDown(event: KeyboardEvent): void;
|
|
829
|
+
/**
|
|
830
|
+
* Whether the group may take the key: not one a nested widget already
|
|
831
|
+
* handled, not part of an IME composition, not from a text field (an
|
|
832
|
+
* `<input>` item or one inside an item keeps its caret keys) and not from
|
|
833
|
+
* inside a nested widget that owns its arrows.
|
|
834
|
+
*/
|
|
835
|
+
private ownsKey;
|
|
697
836
|
/**
|
|
698
837
|
* Keeps `activeIndex` in sync with real focus (APG): when an item gains
|
|
699
838
|
* focus by any means - pointer click, script focus, assistive tech - the
|
|
@@ -731,8 +870,6 @@ declare class CngxRovingTabindex {
|
|
|
731
870
|
*
|
|
732
871
|
* `id` must be unique and stable across change detection runs (use `nextUid()`
|
|
733
872
|
* from `@cngx/core/utils`). `label` is used by typeahead matching.
|
|
734
|
-
*
|
|
735
|
-
* @category common/a11y
|
|
736
873
|
*/
|
|
737
874
|
interface ActiveDescendantItem {
|
|
738
875
|
/** Unique DOM `id` on the element - required for `aria-activedescendant`. */
|
|
@@ -757,18 +894,15 @@ interface ActiveDescendantItem {
|
|
|
757
894
|
* The contained directive must expose `id`, `value`, `label`, and optionally
|
|
758
895
|
* `disabled` as signals - the AD reads them reactively.
|
|
759
896
|
*
|
|
760
|
-
* @category common/a11y
|
|
761
897
|
* @wcag AA
|
|
762
898
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/ad-item.token.ts
|
|
763
|
-
* @since 0.
|
|
899
|
+
* @since 0.3.0
|
|
764
900
|
*/
|
|
765
901
|
declare const CNGX_AD_ITEM: InjectionToken<CngxAdItemHandle>;
|
|
766
902
|
/**
|
|
767
903
|
* Minimum shape an AD-registered directive must expose.
|
|
768
904
|
*
|
|
769
905
|
* The shape is signal-based so the AD recomputes when any field changes.
|
|
770
|
-
*
|
|
771
|
-
* @category common/a11y
|
|
772
906
|
*/
|
|
773
907
|
interface CngxAdItemHandle {
|
|
774
908
|
readonly id: string;
|
|
@@ -808,21 +942,22 @@ interface CngxAdItemHandle {
|
|
|
808
942
|
* checks, typeahead labels) map absolute indices onto the rendered subset.
|
|
809
943
|
* Targets outside the window surface as `pendingHighlight`; the consumer
|
|
810
944
|
* scrolls them into view (`connectRecyclerToActiveDescendant`) and the
|
|
811
|
-
* directive clears the pending state once the target renders
|
|
945
|
+
* directive clears the pending state once the target renders; no
|
|
946
|
+
* `clearPendingHighlight()` call is needed.
|
|
812
947
|
*
|
|
813
948
|
* ### Material/CDK equivalent
|
|
814
949
|
*
|
|
815
950
|
* Same model as `cdk-listbox` and `mat-select`, without the visual shell and
|
|
816
951
|
* driven by signals instead of `ListKeyManager`.
|
|
817
952
|
*
|
|
818
|
-
* @category common/a11y
|
|
819
|
-
* @docsKind primary
|
|
820
953
|
* @wcag AA
|
|
821
954
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/active-descendant.directive.ts
|
|
822
|
-
* @since 0.
|
|
955
|
+
* @since 0.3.0
|
|
823
956
|
* @relatedTo CngxRovingTabindex, CngxListbox, CngxMenu
|
|
824
|
-
* <example-url
|
|
825
|
-
* <example-url
|
|
957
|
+
* <example-url>/#/common/a11y/active-descendant/listbox-with-items-input</example-url>
|
|
958
|
+
* <example-url>/#/common/a11y/active-descendant/typeahead</example-url>
|
|
959
|
+
* <example-url>/#/common/a11y/active-descendant/horizontal-option-row</example-url>
|
|
960
|
+
* @axis level atom
|
|
826
961
|
*/
|
|
827
962
|
declare class CngxActiveDescendant {
|
|
828
963
|
/**
|
|
@@ -858,6 +993,14 @@ declare class CngxActiveDescendant {
|
|
|
858
993
|
* Ignored when `virtualCount` is unset.
|
|
859
994
|
*/
|
|
860
995
|
readonly windowStart: _angular_core.InputSignal<number>;
|
|
996
|
+
/**
|
|
997
|
+
* The full list in absolute index space, for a windowed list whose rendered
|
|
998
|
+
* rows are only part of it. When bound, typeahead searches this list and a
|
|
999
|
+
* match anywhere in it becomes the highlight; `typeaheadMissed` then means no
|
|
1000
|
+
* match in the whole list. Unbound, the rendered window stays the search
|
|
1001
|
+
* space. Items are read for `label` and `disabled` only, so `id` may be empty.
|
|
1002
|
+
*/
|
|
1003
|
+
readonly typeaheadItems: _angular_core.InputSignal<readonly ActiveDescendantItem[] | undefined>;
|
|
861
1004
|
/**
|
|
862
1005
|
* Equality used to find the previously active value again after the item
|
|
863
1006
|
* list changes. Defaults to `Object.is`; pass the same comparator as the
|
|
@@ -885,11 +1028,18 @@ declare class CngxActiveDescendant {
|
|
|
885
1028
|
private readonly registered;
|
|
886
1029
|
/** Document writing direction - flips the horizontal-arrow steps under `rtl` (APG). */
|
|
887
1030
|
private readonly direction;
|
|
888
|
-
/**
|
|
1031
|
+
/** Holds `autoHighlightFirst` back until after first render. */
|
|
889
1032
|
private readonly initialized;
|
|
890
|
-
/**
|
|
891
|
-
|
|
892
|
-
|
|
1033
|
+
/**
|
|
1034
|
+
* A highlight gesture that fired while the option rows were not in the DOM
|
|
1035
|
+
* (a deferred-render panel just opened, OD5): the id space does not exist
|
|
1036
|
+
* yet, so the gesture is kept as INTENT - not a resolved index, which an
|
|
1037
|
+
* empty item space resolves to nothing. It is a source of
|
|
1038
|
+
* `activeIndexState` and resolves there once the rows render. Written only
|
|
1039
|
+
* by the imperative highlight methods; every index write clears it.
|
|
1040
|
+
* Non-virtual path only; the virtual path uses `pendingHighlight`.
|
|
1041
|
+
*/
|
|
1042
|
+
private readonly pendingIntentState;
|
|
893
1043
|
/**
|
|
894
1044
|
* Resolved item list. Input `items` wins; otherwise the contentChildren
|
|
895
1045
|
* handles are projected into `ActiveDescendantItem` shape.
|
|
@@ -899,15 +1049,34 @@ declare class CngxActiveDescendant {
|
|
|
899
1049
|
* -1 means "no active item". Range is `[0, totalCount())`.
|
|
900
1050
|
*
|
|
901
1051
|
* Navigation writes the index; a change of the item space re-derives it.
|
|
902
|
-
*
|
|
903
|
-
* changes, the previously active value is looked up again with
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
*
|
|
1052
|
+
* In a plain list the highlight follows its value: after the item list
|
|
1053
|
+
* changes, the previously active value is looked up again with `compareWith`,
|
|
1054
|
+
* and gone means no highlight. In a virtual window it holds its absolute
|
|
1055
|
+
* index, because the rendered rows trail `windowStart` and cannot say where a
|
|
1056
|
+
* value sits; a window turning plain drops it. The result is clamped to the
|
|
1057
|
+
* new item space, so the next arrow press never starts from a ghost index.
|
|
1058
|
+
*
|
|
1059
|
+
* A pending open gesture (`pendingIntentState`) resolves here against every
|
|
1060
|
+
* populated item space until an index write clears it, so rows that arrive
|
|
1061
|
+
* in several passes settle on the gesture's target.
|
|
907
1062
|
*/
|
|
908
1063
|
private readonly activeIndexState;
|
|
909
1064
|
/** Current active index. `-1` when no item is highlighted. */
|
|
910
1065
|
readonly activeIndex: _angular_core.Signal<number>;
|
|
1066
|
+
/**
|
|
1067
|
+
* The highlight plus whether its row is rendered. Structural equal: a window
|
|
1068
|
+
* move that leaves both unchanged notifies nobody.
|
|
1069
|
+
*/
|
|
1070
|
+
private readonly highlightPlacement;
|
|
1071
|
+
/**
|
|
1072
|
+
* Index the highlight moved to while its row is not rendered. Armed by the
|
|
1073
|
+
* highlight change alone and cleared when the row renders; the same highlight
|
|
1074
|
+
* leaving the window later stays cleared, so scrolling a virtual list away
|
|
1075
|
+
* never asks to be scrolled back.
|
|
1076
|
+
*/
|
|
1077
|
+
private readonly pendingHighlightState;
|
|
1078
|
+
/** Index of an item that should be highlighted but is not in the DOM. */
|
|
1079
|
+
readonly pendingHighlight: _angular_core.Signal<number | null>;
|
|
911
1080
|
/**
|
|
912
1081
|
* `activeIndex` always mapped back to an item. `null` when no active index
|
|
913
1082
|
* or the item is out of rendered range (virtual mode).
|
|
@@ -922,12 +1091,51 @@ declare class CngxActiveDescendant {
|
|
|
922
1091
|
private readonly highlightedItem;
|
|
923
1092
|
readonly activeId: _angular_core.Signal<string | null>;
|
|
924
1093
|
readonly activeValue: _angular_core.Signal<unknown>;
|
|
925
|
-
private readonly
|
|
926
|
-
|
|
1094
|
+
private readonly typeaheadWalker;
|
|
1095
|
+
/**
|
|
1096
|
+
* `true` while a typeahead term is being typed (the buffer has not reset
|
|
1097
|
+
* yet). A space typed then belongs to the term ("new y" reaches "New
|
|
1098
|
+
* York") instead of activating the highlight. External keyboard hosts read
|
|
1099
|
+
* it to route Space through {@link typeaheadChar}.
|
|
1100
|
+
*/
|
|
1101
|
+
readonly typeaheadActive: _angular_core.Signal<boolean>;
|
|
927
1102
|
constructor();
|
|
1103
|
+
/**
|
|
1104
|
+
* Non-virtual path with no rendered rows yet (a deferred-render panel just
|
|
1105
|
+
* opened, OD5): the option id space does not exist, so a highlight resolves
|
|
1106
|
+
* against nothing and is lost. Remember the gesture as intent -
|
|
1107
|
+
* `activeIndexState` resolves it once the rows render - and report that it
|
|
1108
|
+
* was deferred. The virtual path never defers here; its out-of-window
|
|
1109
|
+
* targets surface through `pendingHighlight` instead.
|
|
1110
|
+
*/
|
|
1111
|
+
private deferIfUnrendered;
|
|
1112
|
+
/** Index write of a navigation step; a resolved intent never re-applies after it. */
|
|
1113
|
+
private writeIndex;
|
|
1114
|
+
/**
|
|
1115
|
+
* Moves the highlight to the next item after the active one. Disabled items
|
|
1116
|
+
* are skipped while `skipDisabled` is true; past the last item it wraps to the
|
|
1117
|
+
* first when `loop` is true and stays put otherwise. With no rows it does
|
|
1118
|
+
* nothing: a step inside an empty list is not an open gesture to keep.
|
|
1119
|
+
*/
|
|
928
1120
|
highlightNext(): void;
|
|
1121
|
+
/**
|
|
1122
|
+
* Moves the highlight to the item before the active one. Disabled items are
|
|
1123
|
+
* skipped while `skipDisabled` is true; before the first item it wraps to the
|
|
1124
|
+
* last when `loop` is true and stays put otherwise. With no rows it does
|
|
1125
|
+
* nothing.
|
|
1126
|
+
*/
|
|
929
1127
|
highlightPrev(): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Moves the highlight to the first enabled item (the first item when
|
|
1130
|
+
* `skipDisabled` is false). Does nothing when no item qualifies.
|
|
1131
|
+
*/
|
|
930
1132
|
highlightFirst(): void;
|
|
1133
|
+
/**
|
|
1134
|
+
* Moves the highlight to the last enabled item (the last item when
|
|
1135
|
+
* `skipDisabled` is false). With a virtual count it targets the last absolute
|
|
1136
|
+
* index even when that item is not rendered yet. Does nothing when no item
|
|
1137
|
+
* qualifies.
|
|
1138
|
+
*/
|
|
931
1139
|
highlightLast(): void;
|
|
932
1140
|
/**
|
|
933
1141
|
* Highlight by zero-based index. Out-of-range indices are ignored.
|
|
@@ -935,19 +1143,28 @@ declare class CngxActiveDescendant {
|
|
|
935
1143
|
*/
|
|
936
1144
|
highlightByIndex(index: number): void;
|
|
937
1145
|
/**
|
|
938
|
-
* Highlight the first rendered item whose value matches (via `
|
|
1146
|
+
* Highlight the first rendered item whose value matches (via `compareWith`).
|
|
939
1147
|
* No-op if no match. Disabled items are rejected when `skipDisabled()` is
|
|
940
1148
|
* true. In virtual mode only the rendered window is searched; the resolved
|
|
941
1149
|
* index is absolute.
|
|
942
1150
|
*/
|
|
943
1151
|
highlightByValue(value: unknown): void;
|
|
944
|
-
/** Clear the highlight. */
|
|
1152
|
+
/** Clear the highlight, including a gesture still pending a deferred render. */
|
|
945
1153
|
resetHighlight(): void;
|
|
946
1154
|
/** Emit `activated` with the current item's value. No-op if nothing active. */
|
|
947
1155
|
activateCurrent(): void;
|
|
948
|
-
/**
|
|
1156
|
+
/**
|
|
1157
|
+
* Drops `pendingHighlight` without waiting for the row to render. Optional:
|
|
1158
|
+
* the directive clears it on its own once the target row renders, and
|
|
1159
|
+
* `connectRecyclerToActiveDescendant` never calls this.
|
|
1160
|
+
*/
|
|
949
1161
|
clearPendingHighlight(): void;
|
|
950
1162
|
protected handleKeydown(event: KeyboardEvent): void;
|
|
1163
|
+
/** @internal True when `el` renders one of the host's own items. */
|
|
1164
|
+
private isOwnItemElement;
|
|
1165
|
+
/** Descendants that own Enter / Space; `CNGX_NESTED_INTERACTIVE_SELECTOR`. */
|
|
1166
|
+
private readonly nestedInteractive;
|
|
1167
|
+
private handleActivationKey;
|
|
951
1168
|
private isNavKey;
|
|
952
1169
|
private dispatchNav;
|
|
953
1170
|
/**
|
|
@@ -957,7 +1174,8 @@ declare class CngxActiveDescendant {
|
|
|
957
1174
|
* semantics on a separate listbox.
|
|
958
1175
|
*
|
|
959
1176
|
* Consumers should only forward single-character printable keys (`length === 1`,
|
|
960
|
-
* non-whitespace)
|
|
1177
|
+
* non-whitespace), plus a space while {@link typeaheadActive} is `true`.
|
|
1178
|
+
* Navigation keys and non-printables must not be forwarded.
|
|
961
1179
|
*/
|
|
962
1180
|
typeaheadChar(ch: string): void;
|
|
963
1181
|
private handleTypeahead;
|
|
@@ -978,7 +1196,7 @@ declare class CngxActiveDescendant {
|
|
|
978
1196
|
private isRendered;
|
|
979
1197
|
private scrollActiveIntoView;
|
|
980
1198
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxActiveDescendant, never>;
|
|
981
|
-
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; }; "windowStart": { "alias": "windowStart"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; }, { "activated": "activated"; "highlighted": "highlighted"; "typeaheadMissed": "typeaheadMissed"; }, ["registered"], never, true, never>;
|
|
1199
|
+
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; }; "windowStart": { "alias": "windowStart"; "required": false; "isSignal": true; }; "typeaheadItems": { "alias": "typeaheadItems"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; }, { "activated": "activated"; "highlighted": "highlighted"; "typeaheadMissed": "typeaheadMissed"; }, ["registered"], never, true, never>;
|
|
982
1200
|
}
|
|
983
1201
|
|
|
984
1202
|
/**
|
|
@@ -993,6 +1211,11 @@ declare class CngxActiveDescendant {
|
|
|
993
1211
|
* directive makes the preference available in component logic (e.g., to pick
|
|
994
1212
|
* a different animation strategy or suppress requestAnimationFrame loops).
|
|
995
1213
|
*
|
|
1214
|
+
* This is the OS preference only. An in-app pick through `provideMotion` /
|
|
1215
|
+
* `injectMotion` (`CNGX_MOTION`, `<html data-motion>`) is not seen here; to
|
|
1216
|
+
* decide on the motion the user actually gets, read `injectEffectiveMotion()`
|
|
1217
|
+
* from `@cngx/core` instead.
|
|
1218
|
+
*
|
|
996
1219
|
* ### Conditional animation
|
|
997
1220
|
* ```html
|
|
998
1221
|
* <div cngxReducedMotion #rm="cngxReducedMotion"
|
|
@@ -1006,20 +1229,20 @@ declare class CngxActiveDescendant {
|
|
|
1006
1229
|
* readonly duration = computed(() => this.rm()?.prefersReducedMotion() ? 0 : 300);
|
|
1007
1230
|
* ```
|
|
1008
1231
|
*
|
|
1009
|
-
* @category common/a11y
|
|
1010
1232
|
* @wcag AA
|
|
1011
1233
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/motion/reduced-motion.directive.ts
|
|
1012
|
-
* @since 0.
|
|
1013
|
-
* <example-url
|
|
1014
|
-
* <example-url
|
|
1234
|
+
* @since 0.3.0
|
|
1235
|
+
* <example-url>/#/common/a11y/reduced-motion/animation-toggle</example-url>
|
|
1236
|
+
* <example-url>/#/common/a11y/reduced-motion/toast-notifications-motion-aware</example-url>
|
|
1237
|
+
* @axis level atom
|
|
1015
1238
|
*/
|
|
1016
1239
|
declare class CngxReducedMotion {
|
|
1017
|
-
/** `true` when the user's OS is set to prefer reduced motion. Updates reactively. */
|
|
1240
|
+
/** `true` when the user's OS is set to prefer reduced motion (ignores `CNGX_MOTION`). Updates reactively. */
|
|
1018
1241
|
readonly prefersReducedMotion: Signal<boolean>;
|
|
1019
1242
|
constructor();
|
|
1020
1243
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxReducedMotion, never>;
|
|
1021
1244
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxReducedMotion, "[cngxReducedMotion]", ["cngxReducedMotion"], {}, {}, never, never, true, never>;
|
|
1022
1245
|
}
|
|
1023
1246
|
|
|
1024
|
-
export { CNGX_AD_ITEM, CNGX_FOCUSABLE_SELECTOR, CNGX_FOCUS_TRAP_DRIVER, CngxActiveDescendant, CngxAriaExpanded, CngxAutofocus, CngxFocusRestore, CngxFocusTrap, CngxFocusVisible, CngxLiveAnnouncer, CngxLiveRegion, CngxReducedMotion, CngxRovingItem, CngxRovingTabindex, injectScopedLiveRegion };
|
|
1025
|
-
export type { ActiveDescendantItem, AriaLivePoliteness, CngxAdItemHandle, CngxFocusTrapDriver, CngxPendingAnnouncement, CngxScopedLiveRegion };
|
|
1247
|
+
export { CNGX_AD_ITEM, CNGX_ARIA_EXPANDED_DRIVER, CNGX_FOCUSABLE_SELECTOR, CNGX_FOCUS_RESTORE_DRIVER, CNGX_FOCUS_TRAP_DRIVER, CngxActiveDescendant, CngxAriaExpanded, CngxAutofocus, CngxFocusRestore, CngxFocusTrap, CngxFocusVisible, CngxLiveAnnouncer, CngxLiveRegion, CngxReducedMotion, CngxRovingItem, CngxRovingTabindex, injectScopedLiveRegion };
|
|
1248
|
+
export type { ActiveDescendantItem, AriaLivePoliteness, CngxAdItemHandle, CngxAriaExpandedDriver, CngxFocusRestoreDriver, CngxFocusTrapDriver, CngxPendingAnnouncement, CngxScopedLiveRegion };
|