1 | import { AfterContentInit } from '@angular/core';
|
2 | import { AfterViewInit } from '@angular/core';
|
3 | import { BooleanInput } from '@angular/cdk/coercion';
|
4 | import { ContentObserver } from '@angular/cdk/observers';
|
5 | import { DoCheck } from '@angular/core';
|
6 | import { ElementRef } from '@angular/core';
|
7 | import { EventEmitter } from '@angular/core';
|
8 | import * as i0 from '@angular/core';
|
9 | import * as i4 from '@angular/cdk/observers';
|
10 | import { InjectionToken } from '@angular/core';
|
11 | import { NgZone } from '@angular/core';
|
12 | import { Observable } from 'rxjs';
|
13 | import { OnChanges } from '@angular/core';
|
14 | import { OnDestroy } from '@angular/core';
|
15 | import { Platform } from '@angular/cdk/platform';
|
16 | import { QueryList } from '@angular/core';
|
17 | import { SimpleChanges } from '@angular/core';
|
18 | import { Subject } from 'rxjs';
|
19 |
|
20 | export declare class A11yModule {
|
21 | constructor(highContrastModeDetector: HighContrastModeDetector);
|
22 | static ɵfac: i0.ɵɵFactoryDeclaration<A11yModule, never>;
|
23 | static ɵmod: i0.ɵɵNgModuleDeclaration<A11yModule, [typeof i1.CdkAriaLive, typeof i2.CdkTrapFocus, typeof i3.CdkMonitorFocus], [typeof i4.ObserversModule], [typeof i1.CdkAriaLive, typeof i2.CdkTrapFocus, typeof i3.CdkMonitorFocus]>;
|
24 | static ɵinj: i0.ɵɵInjectorDeclaration<A11yModule>;
|
25 | }
|
26 |
|
27 | export declare class ActiveDescendantKeyManager<T> extends ListKeyManager<Highlightable & T> {
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | setActiveItem(index: number): void;
|
35 | |
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | setActiveItem(item: T): void;
|
42 | }
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export declare class AriaDescriber implements OnDestroy {
|
50 | |
51 |
|
52 |
|
53 |
|
54 | private _platform?;
|
55 | private _document;
|
56 |
|
57 | private _messageRegistry;
|
58 |
|
59 | private _messagesContainer;
|
60 |
|
61 | private readonly _id;
|
62 | constructor(_document: any,
|
63 | |
64 |
|
65 |
|
66 |
|
67 | _platform?: Platform | undefined);
|
68 | /**
|
69 | * Adds to the host element an aria-describedby reference to a hidden element that contains
|
70 | * the message. If the same message has already been registered, then it will reuse the created
|
71 | * message element.
|
72 | */
|
73 | describe(hostElement: Element, message: string, role?: string): void;
|
74 | /**
|
75 | * Adds to the host element an aria-describedby reference to an already-existing message element.
|
76 | */
|
77 | describe(hostElement: Element, message: HTMLElement): void;
|
78 | /** Removes the host element's aria-describedby reference to the message. */
|
79 | removeDescription(hostElement: Element, message: string, role?: string): void;
|
80 | /** Removes the host element's aria-describedby reference to the message element. */
|
81 | removeDescription(hostElement: Element, message: HTMLElement): void;
|
82 | /** Unregisters all created message elements and removes the message container. */
|
83 | ngOnDestroy(): void;
|
84 | /**
|
85 | * Creates a new element in the visually hidden message container element with the message
|
86 | * as its content and adds it to the message registry.
|
87 | */
|
88 | private _createMessageElement;
|
89 | /** Deletes the message element from the global messages container. */
|
90 | private _deleteMessageElement;
|
91 | /** Creates the global container for all aria-describedby messages. */
|
92 | private _createMessagesContainer;
|
93 | /** Removes all cdk-describedby messages that are hosted through the element. */
|
94 | private _removeCdkDescribedByReferenceIds;
|
95 | /**
|
96 | * Adds a message reference to the element using aria-describedby and increments the registered
|
97 | * message's reference count.
|
98 | */
|
99 | private _addMessageReference;
|
100 | /**
|
101 | * Removes a message reference from the element using aria-describedby
|
102 | * and decrements the registered message's reference count.
|
103 | */
|
104 | private _removeMessageReference;
|
105 | /** Returns true if the element has been described by the provided message ID. */
|
106 | private _isElementDescribedByMessage;
|
107 | /** Determines whether a message can be described on a particular element. */
|
108 | private _canBeDescribed;
|
109 | /** Checks whether a node is an Element node. */
|
110 | private _isElementNode;
|
111 | static ɵfac: i0.ɵɵFactoryDeclaration<AriaDescriber, never>;
|
112 | static ɵprov: i0.ɵɵInjectableDeclaration<AriaDescriber>;
|
113 | }
|
114 |
|
115 | /** Possible politeness levels. */
|
116 | export declare type AriaLivePoliteness = 'off' | 'polite' | 'assertive';
|
117 |
|
118 | /**
|
119 | * Attribute given to each host element that is described by a message element.
|
120 | * @deprecated To be turned into a private variable.
|
121 | * @breaking-change 14.0.0
|
122 | */
|
123 | export declare const CDK_DESCRIBEDBY_HOST_ATTRIBUTE = "cdk-describedby-host";
|
124 |
|
125 | /**
|
126 | * ID prefix used for each created message element.
|
127 | * @deprecated To be turned into a private variable.
|
128 | * @breaking-change 14.0.0
|
129 | */
|
130 | export declare const CDK_DESCRIBEDBY_ID_PREFIX = "cdk-describedby-message";
|
131 |
|
132 | /**
|
133 | * A directive that works similarly to aria-live, but uses the LiveAnnouncer to ensure compatibility
|
134 | * with a wider range of browsers and screen readers.
|
135 | */
|
136 | export declare class CdkAriaLive implements OnDestroy {
|
137 | private _elementRef;
|
138 | private _liveAnnouncer;
|
139 | private _contentObserver;
|
140 | private _ngZone;
|
141 |
|
142 | get politeness(): AriaLivePoliteness;
|
143 | set politeness(value: AriaLivePoliteness);
|
144 | private _politeness;
|
145 |
|
146 | duration: number;
|
147 | private _previousAnnouncedText?;
|
148 | private _subscription;
|
149 | constructor(_elementRef: ElementRef, _liveAnnouncer: LiveAnnouncer, _contentObserver: ContentObserver, _ngZone: NgZone);
|
150 | ngOnDestroy(): void;
|
151 | static ɵfac: i0.ɵɵFactoryDeclaration<CdkAriaLive, never>;
|
152 | static ɵdir: i0.ɵɵDirectiveDeclaration<CdkAriaLive, "[cdkAriaLive]", ["cdkAriaLive"], { "politeness": { "alias": "cdkAriaLive"; "required": false; }; "duration": { "alias": "cdkAriaLiveDuration"; "required": false; }; }, {}, never, never, false, never>;
|
153 | }
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 | export declare class CdkMonitorFocus implements AfterViewInit, OnDestroy {
|
165 | private _elementRef;
|
166 | private _focusMonitor;
|
167 | private _monitorSubscription;
|
168 | private _focusOrigin;
|
169 | readonly cdkFocusChange: EventEmitter<FocusOrigin>;
|
170 | constructor(_elementRef: ElementRef<HTMLElement>, _focusMonitor: FocusMonitor);
|
171 | get focusOrigin(): FocusOrigin;
|
172 | ngAfterViewInit(): void;
|
173 | ngOnDestroy(): void;
|
174 | static ɵfac: i0.ɵɵFactoryDeclaration<CdkMonitorFocus, never>;
|
175 | static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMonitorFocus, "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", ["cdkMonitorFocus"], {}, { "cdkFocusChange": "cdkFocusChange"; }, never, never, false, never>;
|
176 | }
|
177 |
|
178 |
|
179 | export declare class CdkTrapFocus implements OnDestroy, AfterContentInit, OnChanges, DoCheck {
|
180 | private _elementRef;
|
181 | private _focusTrapFactory;
|
182 |
|
183 | focusTrap: FocusTrap;
|
184 |
|
185 | private _previouslyFocusedElement;
|
186 |
|
187 | get enabled(): boolean;
|
188 | set enabled(value: BooleanInput);
|
189 | |
190 |
|
191 |
|
192 |
|
193 | get autoCapture(): boolean;
|
194 | set autoCapture(value: BooleanInput);
|
195 | private _autoCapture;
|
196 | constructor(_elementRef: ElementRef<HTMLElement>, _focusTrapFactory: FocusTrapFactory,
|
197 | |
198 |
|
199 |
|
200 |
|
201 | _document: any);
|
202 | ngOnDestroy(): void;
|
203 | ngAfterContentInit(): void;
|
204 | ngDoCheck(): void;
|
205 | ngOnChanges(changes: SimpleChanges): void;
|
206 | private _captureFocus;
|
207 | static ɵfac: i0.ɵɵFactoryDeclaration<CdkTrapFocus, never>;
|
208 | static ɵdir: i0.ɵɵDirectiveDeclaration<CdkTrapFocus, "[cdkTrapFocus]", ["cdkTrapFocus"], { "enabled": { "alias": "cdkTrapFocus"; "required": false; }; "autoCapture": { "alias": "cdkTrapFocusAutoCapture"; "required": false; }; }, {}, never, never, false, never>;
|
209 | }
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 | export declare class ConfigurableFocusTrap extends FocusTrap implements ManagedFocusTrap {
|
218 | private _focusTrapManager;
|
219 | private _inertStrategy;
|
220 |
|
221 | get enabled(): boolean;
|
222 | set enabled(value: boolean);
|
223 | constructor(_element: HTMLElement, _checker: InteractivityChecker, _ngZone: NgZone, _document: Document, _focusTrapManager: FocusTrapManager, _inertStrategy: FocusTrapInertStrategy, config: ConfigurableFocusTrapConfig);
|
224 | /** Notifies the FocusTrapManager that this FocusTrap will be destroyed. */
|
225 | destroy(): void;
|
226 | /** @docs-private Implemented as part of ManagedFocusTrap. */
|
227 | _enable(): void;
|
228 | /** @docs-private Implemented as part of ManagedFocusTrap. */
|
229 | _disable(): void;
|
230 | }
|
231 |
|
232 |
|
233 | /**
|
234 | * Options for creating a ConfigurableFocusTrap.
|
235 | */
|
236 | export declare interface ConfigurableFocusTrapConfig {
|
237 | |
238 |
|
239 |
|
240 | defer: boolean;
|
241 | }
|
242 |
|
243 |
|
244 | export declare class ConfigurableFocusTrapFactory {
|
245 | private _checker;
|
246 | private _ngZone;
|
247 | private _focusTrapManager;
|
248 | private _document;
|
249 | private _inertStrategy;
|
250 | constructor(_checker: InteractivityChecker, _ngZone: NgZone, _focusTrapManager: FocusTrapManager, _document: any, _inertStrategy?: FocusTrapInertStrategy);
|
251 | /**
|
252 | * Creates a focus-trapped region around the given element.
|
253 | * @param element The element around which focus will be trapped.
|
254 | * @param config The focus trap configuration.
|
255 | * @returns The created focus trap instance.
|
256 | */
|
257 | create(element: HTMLElement, config?: ConfigurableFocusTrapConfig): ConfigurableFocusTrap;
|
258 | /**
|
259 | * @deprecated Pass a config object instead of the `deferCaptureElements` flag.
|
260 | * @breaking-change 11.0.0
|
261 | */
|
262 | create(element: HTMLElement, deferCaptureElements: boolean): ConfigurableFocusTrap;
|
263 | static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurableFocusTrapFactory, [null, null, null, null, { optional: true; }]>;
|
264 | static ɵprov: i0.ɵɵInjectableDeclaration<ConfigurableFocusTrapFactory>;
|
265 | }
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 | export declare class EventListenerFocusTrapInertStrategy implements FocusTrapInertStrategy {
|
272 |
|
273 | private _listener;
|
274 |
|
275 | preventFocus(focusTrap: ConfigurableFocusTrap): void;
|
276 |
|
277 | allowFocus(focusTrap: ConfigurableFocusTrap): void;
|
278 | |
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 | private _trapFocus;
|
286 | }
|
287 |
|
288 |
|
289 | export declare const FOCUS_MONITOR_DEFAULT_OPTIONS: InjectionToken<FocusMonitorOptions>;
|
290 |
|
291 |
|
292 | export declare const FOCUS_TRAP_INERT_STRATEGY: InjectionToken<FocusTrapInertStrategy>;
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 | export declare interface FocusableOption extends ListKeyManagerOption {
|
300 |
|
301 | focus(origin?: FocusOrigin): void;
|
302 | }
|
303 |
|
304 | export declare class FocusKeyManager<T> extends ListKeyManager<FocusableOption & T> {
|
305 | private _origin;
|
306 | |
307 |
|
308 |
|
309 |
|
310 | setFocusOrigin(origin: FocusOrigin): this;
|
311 | |
312 |
|
313 |
|
314 |
|
315 |
|
316 | setActiveItem(index: number): void;
|
317 | |
318 |
|
319 |
|
320 |
|
321 | setActiveItem(item: T): void;
|
322 | }
|
323 |
|
324 |
|
325 | export declare class FocusMonitor implements OnDestroy {
|
326 | private _ngZone;
|
327 | private _platform;
|
328 | private readonly _inputModalityDetector;
|
329 |
|
330 | private _origin;
|
331 |
|
332 | private _lastFocusOrigin;
|
333 |
|
334 | private _windowFocused;
|
335 |
|
336 | private _windowFocusTimeoutId;
|
337 |
|
338 | private _originTimeoutId;
|
339 | |
340 |
|
341 |
|
342 |
|
343 | private _originFromTouchInteraction;
|
344 |
|
345 | private _elementInfo;
|
346 |
|
347 | private _monitoredElementCount;
|
348 | |
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 | private _rootNodeFocusListenerCount;
|
355 | |
356 |
|
357 |
|
358 |
|
359 | private readonly _detectionMode;
|
360 | |
361 |
|
362 |
|
363 |
|
364 | private _windowFocusListener;
|
365 |
|
366 | protected _document?: Document;
|
367 |
|
368 | private readonly _stopInputModalityDetector;
|
369 | constructor(_ngZone: NgZone, _platform: Platform, _inputModalityDetector: InputModalityDetector,
|
370 |
|
371 | document: any | null, options: FocusMonitorOptions | null);
|
372 | /**
|
373 | * Event listener for `focus` and 'blur' events on the document.
|
374 | * Needs to be an arrow function in order to preserve the context when it gets bound.
|
375 | */
|
376 | private _rootNodeFocusAndBlurListener;
|
377 | /**
|
378 | * Monitors focus on an element and applies appropriate CSS classes.
|
379 | * @param element The element to monitor
|
380 | * @param checkChildren Whether to count the element as focused when its children are focused.
|
381 | * @returns An observable that emits when the focus state of the element changes.
|
382 | * When the element is blurred, null will be emitted.
|
383 | */
|
384 | monitor(element: HTMLElement, checkChildren?: boolean): Observable<FocusOrigin>;
|
385 | /**
|
386 | * Monitors focus on an element and applies appropriate CSS classes.
|
387 | * @param element The element to monitor
|
388 | * @param checkChildren Whether to count the element as focused when its children are focused.
|
389 | * @returns An observable that emits when the focus state of the element changes.
|
390 | * When the element is blurred, null will be emitted.
|
391 | */
|
392 | monitor(element: ElementRef<HTMLElement>, checkChildren?: boolean): Observable<FocusOrigin>;
|
393 | /**
|
394 | * Stops monitoring an element and removes all focus classes.
|
395 | * @param element The element to stop monitoring.
|
396 | */
|
397 | stopMonitoring(element: HTMLElement): void;
|
398 | /**
|
399 | * Stops monitoring an element and removes all focus classes.
|
400 | * @param element The element to stop monitoring.
|
401 | */
|
402 | stopMonitoring(element: ElementRef<HTMLElement>): void;
|
403 | /**
|
404 | * Focuses the element via the specified focus origin.
|
405 | * @param element Element to focus.
|
406 | * @param origin Focus origin.
|
407 | * @param options Options that can be used to configure the focus behavior.
|
408 | */
|
409 | focusVia(element: HTMLElement, origin: FocusOrigin, options?: FocusOptions_2): void;
|
410 | /**
|
411 | * Focuses the element via the specified focus origin.
|
412 | * @param element Element to focus.
|
413 | * @param origin Focus origin.
|
414 | * @param options Options that can be used to configure the focus behavior.
|
415 | */
|
416 | focusVia(element: ElementRef<HTMLElement>, origin: FocusOrigin, options?: FocusOptions_2): void;
|
417 | ngOnDestroy(): void;
|
418 | /** Access injected document if available or fallback to global document reference */
|
419 | private _getDocument;
|
420 | /** Use defaultView of injected document if available or fallback to global window reference */
|
421 | private _getWindow;
|
422 | private _getFocusOrigin;
|
423 | /**
|
424 | * Returns whether the focus event should be attributed to touch. Recall that in IMMEDIATE mode, a
|
425 | * touch origin isn't immediately reset at the next tick (see _setOrigin). This means that when we
|
426 | * handle a focus event following a touch interaction, we need to determine whether (1) the focus
|
427 | * event was directly caused by the touch interaction or (2) the focus event was caused by a
|
428 | * subsequent programmatic focus call triggered by the touch interaction.
|
429 | * @param focusEventTarget The target of the focus event under examination.
|
430 | */
|
431 | private _shouldBeAttributedToTouch;
|
432 | /**
|
433 | * Sets the focus classes on the element based on the given focus origin.
|
434 | * @param element The element to update the classes on.
|
435 | * @param origin The focus origin.
|
436 | */
|
437 | private _setClasses;
|
438 | /**
|
439 | * Updates the focus origin. If we're using immediate detection mode, we schedule an async
|
440 | * function to clear the origin at the end of a timeout. The duration of the timeout depends on
|
441 | * the origin being set.
|
442 | * @param origin The origin to set.
|
443 | * @param isFromInteraction Whether we are setting the origin from an interaction event.
|
444 | */
|
445 | private _setOrigin;
|
446 | /**
|
447 | * Handles focus events on a registered element.
|
448 | * @param event The focus event.
|
449 | * @param element The monitored element.
|
450 | */
|
451 | private _onFocus;
|
452 | /**
|
453 | * Handles blur events on a registered element.
|
454 | * @param event The blur event.
|
455 | * @param element The monitored element.
|
456 | */
|
457 | _onBlur(event: FocusEvent, element: HTMLElement): void;
|
458 | private _emitOrigin;
|
459 | private _registerGlobalListeners;
|
460 | private _removeGlobalListeners;
|
461 | /** Updates all the state on an element once its focus origin has changed. */
|
462 | private _originChanged;
|
463 | /**
|
464 | * Collects the `MonitoredElementInfo` of a particular element and
|
465 | * all of its ancestors that have enabled `checkChildren`.
|
466 | * @param element Element from which to start the search.
|
467 | */
|
468 | private _getClosestElementsInfo;
|
469 | /**
|
470 | * Returns whether an interaction is likely to have come from the user clicking the `label` of
|
471 | * an `input` or `textarea` in order to focus it.
|
472 | * @param focusEventTarget Target currently receiving focus.
|
473 | */
|
474 | private _isLastInteractionFromInputLabel;
|
475 | static ɵfac: i0.ɵɵFactoryDeclaration<FocusMonitor, [null, null, null, { optional: true; }, { optional: true; }]>;
|
476 | static ɵprov: i0.ɵɵInjectableDeclaration<FocusMonitor>;
|
477 | }
|
478 |
|
479 |
|
480 | export declare const enum FocusMonitorDetectionMode {
|
481 | |
482 |
|
483 |
|
484 |
|
485 |
|
486 | IMMEDIATE = 0,
|
487 | |
488 |
|
489 |
|
490 |
|
491 | EVENTUAL = 1
|
492 | }
|
493 |
|
494 |
|
495 | export declare interface FocusMonitorOptions {
|
496 | detectionMode?: FocusMonitorDetectionMode;
|
497 | }
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 | declare interface FocusOptions_2 {
|
504 |
|
505 | preventScroll?: boolean;
|
506 | }
|
507 | export { FocusOptions_2 as FocusOptions }
|
508 |
|
509 | export declare type FocusOrigin = 'touch' | 'mouse' | 'keyboard' | 'program' | null;
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 | export declare class FocusTrap {
|
522 | readonly _element: HTMLElement;
|
523 | private _checker;
|
524 | readonly _ngZone: NgZone;
|
525 | readonly _document: Document;
|
526 | private _startAnchor;
|
527 | private _endAnchor;
|
528 | private _hasAttached;
|
529 | protected startAnchorListener: () => boolean;
|
530 | protected endAnchorListener: () => boolean;
|
531 |
|
532 | get enabled(): boolean;
|
533 | set enabled(value: boolean);
|
534 | protected _enabled: boolean;
|
535 | constructor(_element: HTMLElement, _checker: InteractivityChecker, _ngZone: NgZone, _document: Document, deferAnchors?: boolean);
|
536 | /** Destroys the focus trap by cleaning up the anchors. */
|
537 | destroy(): void;
|
538 | /**
|
539 | * Inserts the anchors into the DOM. This is usually done automatically
|
540 | * in the constructor, but can be deferred for cases like directives with `*ngIf`.
|
541 | * @returns Whether the focus trap managed to attach successfully. This may not be the case
|
542 | * if the target element isn't currently in the DOM.
|
543 | */
|
544 | attachAnchors(): boolean;
|
545 | /**
|
546 | * Waits for the zone to stabilize, then focuses the first tabbable element.
|
547 | * @returns Returns a promise that resolves with a boolean, depending
|
548 | * on whether focus was moved successfully.
|
549 | */
|
550 | focusInitialElementWhenReady(options?: FocusOptions): Promise<boolean>;
|
551 | /**
|
552 | * Waits for the zone to stabilize, then focuses
|
553 | * the first tabbable element within the focus trap region.
|
554 | * @returns Returns a promise that resolves with a boolean, depending
|
555 | * on whether focus was moved successfully.
|
556 | */
|
557 | focusFirstTabbableElementWhenReady(options?: FocusOptions): Promise<boolean>;
|
558 | /**
|
559 | * Waits for the zone to stabilize, then focuses
|
560 | * the last tabbable element within the focus trap region.
|
561 | * @returns Returns a promise that resolves with a boolean, depending
|
562 | * on whether focus was moved successfully.
|
563 | */
|
564 | focusLastTabbableElementWhenReady(options?: FocusOptions): Promise<boolean>;
|
565 | /**
|
566 | * Get the specified boundary element of the trapped region.
|
567 | * @param bound The boundary to get (start or end of trapped region).
|
568 | * @returns The boundary element.
|
569 | */
|
570 | private _getRegionBoundary;
|
571 | /**
|
572 | * Focuses the element that should be focused when the focus trap is initialized.
|
573 | * @returns Whether focus was moved successfully.
|
574 | */
|
575 | focusInitialElement(options?: FocusOptions): boolean;
|
576 | /**
|
577 | * Focuses the first tabbable element within the focus trap region.
|
578 | * @returns Whether focus was moved successfully.
|
579 | */
|
580 | focusFirstTabbableElement(options?: FocusOptions): boolean;
|
581 | /**
|
582 | * Focuses the last tabbable element within the focus trap region.
|
583 | * @returns Whether focus was moved successfully.
|
584 | */
|
585 | focusLastTabbableElement(options?: FocusOptions): boolean;
|
586 | /**
|
587 | * Checks whether the focus trap has successfully been attached.
|
588 | */
|
589 | hasAttached(): boolean;
|
590 | /** Get the first tabbable element from a DOM subtree (inclusive). */
|
591 | private _getFirstTabbableElement;
|
592 | /** Get the last tabbable element from a DOM subtree (inclusive). */
|
593 | private _getLastTabbableElement;
|
594 | /** Creates an anchor element. */
|
595 | private _createAnchor;
|
596 | /**
|
597 | * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
|
598 | * @param isEnabled Whether the focus trap is enabled.
|
599 | * @param anchor Anchor on which to toggle the tabindex.
|
600 | */
|
601 | private _toggleAnchorTabIndex;
|
602 | /**
|
603 | * Toggles the`tabindex` of both anchors to either trap Tab focus or allow it to escape.
|
604 | * @param enabled: Whether the anchors should trap Tab.
|
605 | */
|
606 | protected toggleAnchors(enabled: boolean): void;
|
607 | /** Executes a function when the zone is stable. */
|
608 | private _executeOnStable;
|
609 | }
|
610 |
|
611 | /**
|
612 | * Factory that allows easy instantiation of focus traps.
|
613 | * @deprecated Use `ConfigurableFocusTrapFactory` instead.
|
614 | * @breaking-change 11.0.0
|
615 | */
|
616 | export declare class FocusTrapFactory {
|
617 | private _checker;
|
618 | private _ngZone;
|
619 | private _document;
|
620 | constructor(_checker: InteractivityChecker, _ngZone: NgZone, _document: any);
|
621 | /**
|
622 | * Creates a focus-trapped region around the given element.
|
623 | * @param element The element around which focus will be trapped.
|
624 | * @param deferCaptureElements Defers the creation of focus-capturing elements to be done
|
625 | * manually by the user.
|
626 | * @returns The created focus trap instance.
|
627 | */
|
628 | create(element: HTMLElement, deferCaptureElements?: boolean): FocusTrap;
|
629 | static ɵfac: i0.ɵɵFactoryDeclaration<FocusTrapFactory, never>;
|
630 | static ɵprov: i0.ɵɵInjectableDeclaration<FocusTrapFactory>;
|
631 | }
|
632 |
|
633 | /**
|
634 | * A strategy that dictates how FocusTrap should prevent elements
|
635 | * outside of the FocusTrap from being focused.
|
636 | */
|
637 | export declare interface FocusTrapInertStrategy {
|
638 | /** Makes all elements outside focusTrap unfocusable. */
|
639 | preventFocus(focusTrap: FocusTrap): void;
|
640 | /** Reverts elements made unfocusable by preventFocus to their previous state. */
|
641 | allowFocus(focusTrap: FocusTrap): void;
|
642 | }
|
643 |
|
644 | /** Injectable that ensures only the most recently enabled FocusTrap is active. */
|
645 | declare class FocusTrapManager {
|
646 | private _focusTrapStack;
|
647 | |
648 |
|
649 |
|
650 |
|
651 | register(focusTrap: ManagedFocusTrap): void;
|
652 | |
653 |
|
654 |
|
655 |
|
656 | deregister(focusTrap: ManagedFocusTrap): void;
|
657 | static ɵfac: i0.ɵɵFactoryDeclaration<FocusTrapManager, never>;
|
658 | static ɵprov: i0.ɵɵInjectableDeclaration<FocusTrapManager>;
|
659 | }
|
660 |
|
661 |
|
662 | export declare const enum HighContrastMode {
|
663 | NONE = 0,
|
664 | BLACK_ON_WHITE = 1,
|
665 | WHITE_ON_BLACK = 2
|
666 | }
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 | export declare class HighContrastModeDetector implements OnDestroy {
|
680 | private _platform;
|
681 | |
682 |
|
683 |
|
684 |
|
685 | private _hasCheckedHighContrastMode;
|
686 | private _document;
|
687 | private _breakpointSubscription;
|
688 | constructor(_platform: Platform, document: any);
|
689 | /** Gets the current high-contrast-mode for the page. */
|
690 | getHighContrastMode(): HighContrastMode;
|
691 | ngOnDestroy(): void;
|
692 | /** Applies CSS classes indicating high-contrast mode to document body (browser-only). */
|
693 | _applyBodyHighContrastModeCssClasses(): void;
|
694 | static ɵfac: i0.ɵɵFactoryDeclaration<HighContrastModeDetector, never>;
|
695 | static ɵprov: i0.ɵɵInjectableDeclaration<HighContrastModeDetector>;
|
696 | }
|
697 |
|
698 | /**
|
699 | * This is the interface for highlightable items (used by the ActiveDescendantKeyManager).
|
700 | * Each item must know how to style itself as active or inactive and whether or not it is
|
701 | * currently disabled.
|
702 | */
|
703 | export declare interface Highlightable extends ListKeyManagerOption {
|
704 |
|
705 | setActiveStyles(): void;
|
706 |
|
707 | setInactiveStyles(): void;
|
708 | }
|
709 |
|
710 | declare namespace i1 {
|
711 | export {
|
712 | LiveAnnouncer,
|
713 | CdkAriaLive
|
714 | }
|
715 | }
|
716 |
|
717 | declare namespace i2 {
|
718 | export {
|
719 | FocusTrap,
|
720 | FocusTrapFactory,
|
721 | CdkTrapFocus
|
722 | }
|
723 | }
|
724 |
|
725 | declare namespace i3 {
|
726 | export {
|
727 | FocusOrigin,
|
728 | FocusOptions_2 as FocusOptions,
|
729 | FocusMonitorDetectionMode,
|
730 | FocusMonitorOptions,
|
731 | FOCUS_MONITOR_DEFAULT_OPTIONS,
|
732 | FocusMonitor,
|
733 | CdkMonitorFocus
|
734 | }
|
735 | }
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 | export declare const INPUT_MODALITY_DETECTOR_DEFAULT_OPTIONS: InputModalityDetectorOptions;
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 | export declare const INPUT_MODALITY_DETECTOR_OPTIONS: InjectionToken<InputModalityDetectorOptions>;
|
760 |
|
761 |
|
762 |
|
763 |
|
764 | export declare type InputModality = 'keyboard' | 'mouse' | 'touch' | null;
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 | export declare class InputModalityDetector implements OnDestroy {
|
781 | private readonly _platform;
|
782 |
|
783 | readonly modalityDetected: Observable<InputModality>;
|
784 |
|
785 | readonly modalityChanged: Observable<InputModality>;
|
786 |
|
787 | get mostRecentModality(): InputModality;
|
788 | |
789 |
|
790 |
|
791 |
|
792 | _mostRecentTarget: HTMLElement | null;
|
793 |
|
794 | private readonly _modality;
|
795 |
|
796 | private readonly _options;
|
797 | |
798 |
|
799 |
|
800 |
|
801 | private _lastTouchMs;
|
802 | |
803 |
|
804 |
|
805 |
|
806 | private _onKeydown;
|
807 | |
808 |
|
809 |
|
810 |
|
811 | private _onMousedown;
|
812 | |
813 |
|
814 |
|
815 |
|
816 | private _onTouchstart;
|
817 | constructor(_platform: Platform, ngZone: NgZone, document: Document, options?: InputModalityDetectorOptions);
|
818 | ngOnDestroy(): void;
|
819 | static ɵfac: i0.ɵɵFactoryDeclaration<InputModalityDetector, [null, null, null, { optional: true; }]>;
|
820 | static ɵprov: i0.ɵɵInjectableDeclaration<InputModalityDetector>;
|
821 | }
|
822 |
|
823 |
|
824 | export declare interface InputModalityDetectorOptions {
|
825 |
|
826 | ignoreKeys?: number[];
|
827 | }
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 | export declare class InteractivityChecker {
|
834 | private _platform;
|
835 | constructor(_platform: Platform);
|
836 | /**
|
837 | * Gets whether an element is disabled.
|
838 | *
|
839 | * @param element Element to be checked.
|
840 | * @returns Whether the element is disabled.
|
841 | */
|
842 | isDisabled(element: HTMLElement): boolean;
|
843 | /**
|
844 | * Gets whether an element is visible for the purposes of interactivity.
|
845 | *
|
846 | * This will capture states like `display: none` and `visibility: hidden`, but not things like
|
847 | * being clipped by an `overflow: hidden` parent or being outside the viewport.
|
848 | *
|
849 | * @returns Whether the element is visible.
|
850 | */
|
851 | isVisible(element: HTMLElement): boolean;
|
852 | /**
|
853 | * Gets whether an element can be reached via Tab key.
|
854 | * Assumes that the element has already been checked with isFocusable.
|
855 | *
|
856 | * @param element Element to be checked.
|
857 | * @returns Whether the element is tabbable.
|
858 | */
|
859 | isTabbable(element: HTMLElement): boolean;
|
860 | /**
|
861 | * Gets whether an element can be focused by the user.
|
862 | *
|
863 | * @param element Element to be checked.
|
864 | * @param config The config object with options to customize this method's behavior
|
865 | * @returns Whether the element is focusable.
|
866 | */
|
867 | isFocusable(element: HTMLElement, config?: IsFocusableConfig): boolean;
|
868 | static ɵfac: i0.ɵɵFactoryDeclaration<InteractivityChecker, never>;
|
869 | static ɵprov: i0.ɵɵInjectableDeclaration<InteractivityChecker>;
|
870 | }
|
871 |
|
872 |
|
873 | /** Gets whether an event could be a faked `mousedown` event dispatched by a screen reader. */
|
874 | export declare function isFakeMousedownFromScreenReader(event: MouseEvent): boolean;
|
875 |
|
876 | /** Gets whether an event could be a faked `touchstart` event dispatched by a screen reader. */
|
877 | export declare function isFakeTouchstartFromScreenReader(event: TouchEvent): boolean;
|
878 |
|
879 | /**
|
880 | * Configuration for the isFocusable method.
|
881 | */
|
882 | export declare class IsFocusableConfig {
|
883 | |
884 |
|
885 |
|
886 | ignoreVisibility: boolean;
|
887 | }
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 | export declare class ListKeyManager<T extends ListKeyManagerOption> {
|
894 | private _items;
|
895 | private _activeItemIndex;
|
896 | private _activeItem;
|
897 | private _wrap;
|
898 | private readonly _letterKeyStream;
|
899 | private _typeaheadSubscription;
|
900 | private _itemChangesSubscription?;
|
901 | private _vertical;
|
902 | private _horizontal;
|
903 | private _allowedModifierKeys;
|
904 | private _homeAndEnd;
|
905 | private _pageUpAndDown;
|
906 | |
907 |
|
908 |
|
909 |
|
910 | private _skipPredicateFn;
|
911 | private _pressedLetters;
|
912 | constructor(_items: QueryList<T> | T[]);
|
913 | /**
|
914 | * Stream that emits any time the TAB key is pressed, so components can react
|
915 | * when focus is shifted off of the list.
|
916 | */
|
917 | readonly tabOut: Subject<void>;
|
918 | /** Stream that emits whenever the active item of the list manager changes. */
|
919 | readonly change: Subject<number>;
|
920 | /**
|
921 | * Sets the predicate function that determines which items should be skipped by the
|
922 | * list key manager.
|
923 | * @param predicate Function that determines whether the given item should be skipped.
|
924 | */
|
925 | skipPredicate(predicate: (item: T) => boolean): this;
|
926 | /**
|
927 | * Configures wrapping mode, which determines whether the active item will wrap to
|
928 | * the other end of list when there are no more items in the given direction.
|
929 | * @param shouldWrap Whether the list should wrap when reaching the end.
|
930 | */
|
931 | withWrap(shouldWrap?: boolean): this;
|
932 | /**
|
933 | * Configures whether the key manager should be able to move the selection vertically.
|
934 | * @param enabled Whether vertical selection should be enabled.
|
935 | */
|
936 | withVerticalOrientation(enabled?: boolean): this;
|
937 | /**
|
938 | * Configures the key manager to move the selection horizontally.
|
939 | * Passing in `null` will disable horizontal movement.
|
940 | * @param direction Direction in which the selection can be moved.
|
941 | */
|
942 | withHorizontalOrientation(direction: 'ltr' | 'rtl' | null): this;
|
943 | /**
|
944 | * Modifier keys which are allowed to be held down and whose default actions will be prevented
|
945 | * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
|
946 | */
|
947 | withAllowedModifierKeys(keys: ListKeyManagerModifierKey[]): this;
|
948 | /**
|
949 | * Turns on typeahead mode which allows users to set the active item by typing.
|
950 | * @param debounceInterval Time to wait after the last keystroke before setting the active item.
|
951 | */
|
952 | withTypeAhead(debounceInterval?: number): this;
|
953 | /** Cancels the current typeahead sequence. */
|
954 | cancelTypeahead(): this;
|
955 | /**
|
956 | * Configures the key manager to activate the first and last items
|
957 | * respectively when the Home or End key is pressed.
|
958 | * @param enabled Whether pressing the Home or End key activates the first/last item.
|
959 | */
|
960 | withHomeAndEnd(enabled?: boolean): this;
|
961 | /**
|
962 | * Configures the key manager to activate every 10th, configured or first/last element in up/down direction
|
963 | * respectively when the Page-Up or Page-Down key is pressed.
|
964 | * @param enabled Whether pressing the Page-Up or Page-Down key activates the first/last item.
|
965 | * @param delta Whether pressing the Home or End key activates the first/last item.
|
966 | */
|
967 | withPageUpDown(enabled?: boolean, delta?: number): this;
|
968 | /**
|
969 | * Sets the active item to the item at the index specified.
|
970 | * @param index The index of the item to be set as active.
|
971 | */
|
972 | setActiveItem(index: number): void;
|
973 | /**
|
974 | * Sets the active item to the specified item.
|
975 | * @param item The item to be set as active.
|
976 | */
|
977 | setActiveItem(item: T): void;
|
978 | /**
|
979 | * Sets the active item depending on the key event passed in.
|
980 | * @param event Keyboard event to be used for determining which element should be active.
|
981 | */
|
982 | onKeydown(event: KeyboardEvent): void;
|
983 | /** Index of the currently active item. */
|
984 | get activeItemIndex(): number | null;
|
985 | /** The active item. */
|
986 | get activeItem(): T | null;
|
987 | /** Gets whether the user is currently typing into the manager using the typeahead feature. */
|
988 | isTyping(): boolean;
|
989 | /** Sets the active item to the first enabled item in the list. */
|
990 | setFirstItemActive(): void;
|
991 | /** Sets the active item to the last enabled item in the list. */
|
992 | setLastItemActive(): void;
|
993 | /** Sets the active item to the next enabled item in the list. */
|
994 | setNextItemActive(): void;
|
995 | /** Sets the active item to a previous enabled item in the list. */
|
996 | setPreviousItemActive(): void;
|
997 | /**
|
998 | * Allows setting the active without any other effects.
|
999 | * @param index Index of the item to be set as active.
|
1000 | */
|
1001 | updateActiveItem(index: number): void;
|
1002 | /**
|
1003 | * Allows setting the active item without any other effects.
|
1004 | * @param item Item to be set as active.
|
1005 | */
|
1006 | updateActiveItem(item: T): void;
|
1007 | /** Cleans up the key manager. */
|
1008 | destroy(): void;
|
1009 | /**
|
1010 | * This method sets the active item, given a list of items and the delta between the
|
1011 | * currently active item and the new active item. It will calculate differently
|
1012 | * depending on whether wrap mode is turned on.
|
1013 | */
|
1014 | private _setActiveItemByDelta;
|
1015 | /**
|
1016 | * Sets the active item properly given "wrap" mode. In other words, it will continue to move
|
1017 | * down the list until it finds an item that is not disabled, and it will wrap if it
|
1018 | * encounters either end of the list.
|
1019 | */
|
1020 | private _setActiveInWrapMode;
|
1021 | /**
|
1022 | * Sets the active item properly given the default mode. In other words, it will
|
1023 | * continue to move down the list until it finds an item that is not disabled. If
|
1024 | * it encounters either end of the list, it will stop and not wrap.
|
1025 | */
|
1026 | private _setActiveInDefaultMode;
|
1027 | /**
|
1028 | * Sets the active item to the first enabled item starting at the index specified. If the
|
1029 | * item is disabled, it will move in the fallbackDelta direction until it either
|
1030 | * finds an enabled item or encounters the end of the list.
|
1031 | */
|
1032 | private _setActiveItemByIndex;
|
1033 | /** Returns the items as an array. */
|
1034 | private _getItemsArray;
|
1035 | }
|
1036 |
|
1037 | /** Modifier keys handled by the ListKeyManager. */
|
1038 | export declare type ListKeyManagerModifierKey = 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey';
|
1039 |
|
1040 | /** This interface is for items that can be passed to a ListKeyManager. */
|
1041 | export declare interface ListKeyManagerOption {
|
1042 |
|
1043 | disabled?: boolean;
|
1044 |
|
1045 | getLabel?(): string;
|
1046 | }
|
1047 |
|
1048 |
|
1049 | export declare const LIVE_ANNOUNCER_DEFAULT_OPTIONS: InjectionToken<LiveAnnouncerDefaultOptions>;
|
1050 |
|
1051 | export declare const LIVE_ANNOUNCER_ELEMENT_TOKEN: InjectionToken<HTMLElement | null>;
|
1052 |
|
1053 |
|
1054 | export declare function LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY(): null;
|
1055 |
|
1056 | export declare class LiveAnnouncer implements OnDestroy {
|
1057 | private _ngZone;
|
1058 | private _defaultOptions?;
|
1059 | private _liveElement;
|
1060 | private _document;
|
1061 | private _previousTimeout;
|
1062 | private _currentPromise;
|
1063 | private _currentResolve;
|
1064 | constructor(elementToken: any, _ngZone: NgZone, _document: any, _defaultOptions?: LiveAnnouncerDefaultOptions | undefined);
|
1065 | /**
|
1066 | * Announces a message to screen readers.
|
1067 | * @param message Message to be announced to the screen reader.
|
1068 | * @returns Promise that will be resolved when the message is added to the DOM.
|
1069 | */
|
1070 | announce(message: string): Promise<void>;
|
1071 | /**
|
1072 | * Announces a message to screen readers.
|
1073 | * @param message Message to be announced to the screen reader.
|
1074 | * @param politeness The politeness of the announcer element.
|
1075 | * @returns Promise that will be resolved when the message is added to the DOM.
|
1076 | */
|
1077 | announce(message: string, politeness?: AriaLivePoliteness): Promise<void>;
|
1078 | /**
|
1079 | * Announces a message to screen readers.
|
1080 | * @param message Message to be announced to the screen reader.
|
1081 | * @param duration Time in milliseconds after which to clear out the announcer element. Note
|
1082 | * that this takes effect after the message has been added to the DOM, which can be up to
|
1083 | * 100ms after `announce` has been called.
|
1084 | * @returns Promise that will be resolved when the message is added to the DOM.
|
1085 | */
|
1086 | announce(message: string, duration?: number): Promise<void>;
|
1087 | /**
|
1088 | * Announces a message to screen readers.
|
1089 | * @param message Message to be announced to the screen reader.
|
1090 | * @param politeness The politeness of the announcer element.
|
1091 | * @param duration Time in milliseconds after which to clear out the announcer element. Note
|
1092 | * that this takes effect after the message has been added to the DOM, which can be up to
|
1093 | * 100ms after `announce` has been called.
|
1094 | * @returns Promise that will be resolved when the message is added to the DOM.
|
1095 | */
|
1096 | announce(message: string, politeness?: AriaLivePoliteness, duration?: number): Promise<void>;
|
1097 | /**
|
1098 | * Clears the current text from the announcer element. Can be used to prevent
|
1099 | * screen readers from reading the text out again while the user is going
|
1100 | * through the page landmarks.
|
1101 | */
|
1102 | clear(): void;
|
1103 | ngOnDestroy(): void;
|
1104 | private _createLiveElement;
|
1105 | /**
|
1106 | * Some browsers won't expose the accessibility node of the live announcer element if there is an
|
1107 | * `aria-modal` and the live announcer is outside of it. This method works around the issue by
|
1108 | * pointing the `aria-owns` of all modals to the live announcer element.
|
1109 | */
|
1110 | private _exposeAnnouncerToModals;
|
1111 | static ɵfac: i0.ɵɵFactoryDeclaration<LiveAnnouncer, [{ optional: true; }, null, null, { optional: true; }]>;
|
1112 | static ɵprov: i0.ɵɵInjectableDeclaration<LiveAnnouncer>;
|
1113 | }
|
1114 |
|
1115 |
|
1116 | export declare interface LiveAnnouncerDefaultOptions {
|
1117 |
|
1118 | politeness?: AriaLivePoliteness;
|
1119 |
|
1120 | duration?: number;
|
1121 | }
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 | declare interface ManagedFocusTrap {
|
1128 | _enable(): void;
|
1129 | _disable(): void;
|
1130 | focusInitialElementWhenReady(): Promise<boolean>;
|
1131 | }
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 | export declare const MESSAGES_CONTAINER_ID = "cdk-describedby-message-container";
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 | export declare interface RegisteredMessage {
|
1145 |
|
1146 | messageElement: Element;
|
1147 |
|
1148 | referenceCount: number;
|
1149 | }
|
1150 |
|
1151 | export { }
|