source: trip-planner-front/node_modules/@angular/cdk/a11y/focus-trap/focus-trap.d.ts.__ivy_ngcc_bak

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 6.6 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { BooleanInput } from '@angular/cdk/coercion';
9import { AfterContentInit, ElementRef, NgZone, OnDestroy, DoCheck, SimpleChanges, OnChanges } from '@angular/core';
10import { InteractivityChecker } from '../interactivity-checker/interactivity-checker';
11/**
12 * Class that allows for trapping focus within a DOM element.
13 *
14 * This class currently uses a relatively simple approach to focus trapping.
15 * It assumes that the tab order is the same as DOM order, which is not necessarily true.
16 * Things like `tabIndex > 0`, flex `order`, and shadow roots can cause the two to be misaligned.
17 *
18 * @deprecated Use `ConfigurableFocusTrap` instead.
19 * @breaking-change 11.0.0
20 */
21export declare class FocusTrap {
22 readonly _element: HTMLElement;
23 private _checker;
24 readonly _ngZone: NgZone;
25 readonly _document: Document;
26 private _startAnchor;
27 private _endAnchor;
28 private _hasAttached;
29 protected startAnchorListener: () => boolean;
30 protected endAnchorListener: () => boolean;
31 /** Whether the focus trap is active. */
32 get enabled(): boolean;
33 set enabled(value: boolean);
34 protected _enabled: boolean;
35 constructor(_element: HTMLElement, _checker: InteractivityChecker, _ngZone: NgZone, _document: Document, deferAnchors?: boolean);
36 /** Destroys the focus trap by cleaning up the anchors. */
37 destroy(): void;
38 /**
39 * Inserts the anchors into the DOM. This is usually done automatically
40 * in the constructor, but can be deferred for cases like directives with `*ngIf`.
41 * @returns Whether the focus trap managed to attach successfully. This may not be the case
42 * if the target element isn't currently in the DOM.
43 */
44 attachAnchors(): boolean;
45 /**
46 * Waits for the zone to stabilize, then either focuses the first element that the
47 * user specified, or the first tabbable element.
48 * @returns Returns a promise that resolves with a boolean, depending
49 * on whether focus was moved successfully.
50 */
51 focusInitialElementWhenReady(options?: FocusOptions): Promise<boolean>;
52 /**
53 * Waits for the zone to stabilize, then focuses
54 * the first tabbable element within the focus trap region.
55 * @returns Returns a promise that resolves with a boolean, depending
56 * on whether focus was moved successfully.
57 */
58 focusFirstTabbableElementWhenReady(options?: FocusOptions): Promise<boolean>;
59 /**
60 * Waits for the zone to stabilize, then focuses
61 * the last tabbable element within the focus trap region.
62 * @returns Returns a promise that resolves with a boolean, depending
63 * on whether focus was moved successfully.
64 */
65 focusLastTabbableElementWhenReady(options?: FocusOptions): Promise<boolean>;
66 /**
67 * Get the specified boundary element of the trapped region.
68 * @param bound The boundary to get (start or end of trapped region).
69 * @returns The boundary element.
70 */
71 private _getRegionBoundary;
72 /**
73 * Focuses the element that should be focused when the focus trap is initialized.
74 * @returns Whether focus was moved successfully.
75 */
76 focusInitialElement(options?: FocusOptions): boolean;
77 /**
78 * Focuses the first tabbable element within the focus trap region.
79 * @returns Whether focus was moved successfully.
80 */
81 focusFirstTabbableElement(options?: FocusOptions): boolean;
82 /**
83 * Focuses the last tabbable element within the focus trap region.
84 * @returns Whether focus was moved successfully.
85 */
86 focusLastTabbableElement(options?: FocusOptions): boolean;
87 /**
88 * Checks whether the focus trap has successfully been attached.
89 */
90 hasAttached(): boolean;
91 /** Get the first tabbable element from a DOM subtree (inclusive). */
92 private _getFirstTabbableElement;
93 /** Get the last tabbable element from a DOM subtree (inclusive). */
94 private _getLastTabbableElement;
95 /** Creates an anchor element. */
96 private _createAnchor;
97 /**
98 * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
99 * @param isEnabled Whether the focus trap is enabled.
100 * @param anchor Anchor on which to toggle the tabindex.
101 */
102 private _toggleAnchorTabIndex;
103 /**
104 * Toggles the`tabindex` of both anchors to either trap Tab focus or allow it to escape.
105 * @param enabled: Whether the anchors should trap Tab.
106 */
107 protected toggleAnchors(enabled: boolean): void;
108 /** Executes a function when the zone is stable. */
109 private _executeOnStable;
110}
111/**
112 * Factory that allows easy instantiation of focus traps.
113 * @deprecated Use `ConfigurableFocusTrapFactory` instead.
114 * @breaking-change 11.0.0
115 */
116export declare class FocusTrapFactory {
117 private _checker;
118 private _ngZone;
119 private _document;
120 constructor(_checker: InteractivityChecker, _ngZone: NgZone, _document: any);
121 /**
122 * Creates a focus-trapped region around the given element.
123 * @param element The element around which focus will be trapped.
124 * @param deferCaptureElements Defers the creation of focus-capturing elements to be done
125 * manually by the user.
126 * @returns The created focus trap instance.
127 */
128 create(element: HTMLElement, deferCaptureElements?: boolean): FocusTrap;
129}
130/** Directive for trapping focus within a region. */
131export declare class CdkTrapFocus implements OnDestroy, AfterContentInit, OnChanges, DoCheck {
132 private _elementRef;
133 private _focusTrapFactory;
134 /** Underlying FocusTrap instance. */
135 focusTrap: FocusTrap;
136 /** Previously focused element to restore focus to upon destroy when using autoCapture. */
137 private _previouslyFocusedElement;
138 /** Whether the focus trap is active. */
139 get enabled(): boolean;
140 set enabled(value: boolean);
141 /**
142 * Whether the directive should automatically move focus into the trapped region upon
143 * initialization and return focus to the previous activeElement upon destruction.
144 */
145 get autoCapture(): boolean;
146 set autoCapture(value: boolean);
147 private _autoCapture;
148 constructor(_elementRef: ElementRef<HTMLElement>, _focusTrapFactory: FocusTrapFactory,
149 /**
150 * @deprecated No longer being used. To be removed.
151 * @breaking-change 13.0.0
152 */
153 _document: any);
154 ngOnDestroy(): void;
155 ngAfterContentInit(): void;
156 ngDoCheck(): void;
157 ngOnChanges(changes: SimpleChanges): void;
158 private _captureFocus;
159 static ngAcceptInputType_enabled: BooleanInput;
160 static ngAcceptInputType_autoCapture: BooleanInput;
161}
Note: See TracBrowser for help on using the repository browser.