@fluentui/react-tabster 9.26.16 → 9.74.3-experimental.esm.20260709-49ee7a20cf.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/dist/index.d.cts +1583 -0
  3. package/lib/focus/createCustomFocusIndicatorStyle.js +1 -1
  4. package/lib/focus/createCustomFocusIndicatorStyle.js.map +1 -1
  5. package/lib/focus/createFocusOutlineStyle.js +4 -4
  6. package/lib/focus/createFocusOutlineStyle.js.map +1 -1
  7. package/lib/focus/focusVisiblePolyfill.js +3 -3
  8. package/lib/focus/focusVisiblePolyfill.js.map +1 -1
  9. package/lib/focus/focusWithinPolyfill.js +2 -2
  10. package/lib/focus/focusWithinPolyfill.js.map +1 -1
  11. package/lib/focus/index.js +4 -4
  12. package/lib/focus/index.js.map +1 -1
  13. package/lib/hooks/index.js +19 -19
  14. package/lib/hooks/index.js.map +1 -1
  15. package/lib/hooks/useActivateModal.js +4 -4
  16. package/lib/hooks/useActivateModal.js.map +1 -1
  17. package/lib/hooks/useArrowNavigationGroup.js +3 -3
  18. package/lib/hooks/useArrowNavigationGroup.js.map +1 -1
  19. package/lib/hooks/useFocusFinders.js +3 -3
  20. package/lib/hooks/useFocusFinders.js.map +1 -1
  21. package/lib/hooks/useFocusObserved.js +3 -3
  22. package/lib/hooks/useFocusObserved.js.map +1 -1
  23. package/lib/hooks/useFocusVisible.js +3 -3
  24. package/lib/hooks/useFocusVisible.js.map +1 -1
  25. package/lib/hooks/useFocusWithin.js +3 -3
  26. package/lib/hooks/useFocusWithin.js.map +1 -1
  27. package/lib/hooks/useFocusableGroup.js +3 -3
  28. package/lib/hooks/useFocusableGroup.js.map +1 -1
  29. package/lib/hooks/useFocusedElementChange.js +5 -5
  30. package/lib/hooks/useFocusedElementChange.js.map +1 -1
  31. package/lib/hooks/useIsNavigatingWithKeyboard.js +2 -2
  32. package/lib/hooks/useIsNavigatingWithKeyboard.js.map +1 -1
  33. package/lib/hooks/useKeyboardNavAttribute.js +4 -4
  34. package/lib/hooks/useKeyboardNavAttribute.js.map +1 -1
  35. package/lib/hooks/useKeyborgRef.js +3 -3
  36. package/lib/hooks/useMergeTabsterAttributes.js +2 -2
  37. package/lib/hooks/useModalAttributes.js +5 -5
  38. package/lib/hooks/useModalAttributes.js.map +1 -1
  39. package/lib/hooks/useObservedElement.js +3 -3
  40. package/lib/hooks/useObservedElement.js.map +1 -1
  41. package/lib/hooks/useOnKeyboardNavigationChange.js +3 -3
  42. package/lib/hooks/useOnKeyboardNavigationChange.js.map +1 -1
  43. package/lib/hooks/useRestoreFocus.js +2 -2
  44. package/lib/hooks/useRestoreFocus.js.map +1 -1
  45. package/lib/hooks/useSetKeyboardNavigation.js +2 -2
  46. package/lib/hooks/useSetKeyboardNavigation.js.map +1 -1
  47. package/lib/hooks/useTabster.js +4 -4
  48. package/lib/hooks/useTabsterAttributes.js +3 -3
  49. package/lib/hooks/useTabsterAttributes.js.map +1 -1
  50. package/lib/hooks/useUncontrolledFocus.js +2 -2
  51. package/lib/hooks/useUncontrolledFocus.js.map +1 -1
  52. package/lib/index.js +6 -6
  53. package/lib/index.js.map +1 -1
  54. package/lib-commonjs/focus/{createCustomFocusIndicatorStyle.js → createCustomFocusIndicatorStyle.cjs} +1 -1
  55. package/lib-commonjs/focus/{createFocusOutlineStyle.js → createFocusOutlineStyle.cjs} +2 -2
  56. package/lib-commonjs/focus/{focusVisiblePolyfill.js → focusVisiblePolyfill.cjs} +1 -1
  57. package/lib-commonjs/focus/{focusWithinPolyfill.js → focusWithinPolyfill.cjs} +1 -1
  58. package/lib-commonjs/focus/{index.js → index.cjs} +4 -4
  59. package/lib-commonjs/hooks/{index.js → index.cjs} +19 -19
  60. package/lib-commonjs/hooks/{useActivateModal.js → useActivateModal.cjs} +1 -1
  61. package/lib-commonjs/hooks/{useArrowNavigationGroup.js → useArrowNavigationGroup.cjs} +2 -2
  62. package/lib-commonjs/hooks/{useFocusFinders.js → useFocusFinders.cjs} +1 -1
  63. package/lib-commonjs/hooks/{useFocusObserved.js → useFocusObserved.cjs} +1 -1
  64. package/lib-commonjs/hooks/{useFocusVisible.js → useFocusVisible.cjs} +1 -1
  65. package/lib-commonjs/hooks/{useFocusWithin.js → useFocusWithin.cjs} +1 -1
  66. package/lib-commonjs/hooks/{useFocusableGroup.js → useFocusableGroup.cjs} +2 -2
  67. package/lib-commonjs/hooks/{useFocusedElementChange.js → useFocusedElementChange.cjs} +1 -1
  68. package/lib-commonjs/hooks/{useIsNavigatingWithKeyboard.js → useIsNavigatingWithKeyboard.cjs} +1 -1
  69. package/lib-commonjs/hooks/{useKeyboardNavAttribute.js → useKeyboardNavAttribute.cjs} +1 -1
  70. package/lib-commonjs/hooks/{useModalAttributes.js → useModalAttributes.cjs} +3 -3
  71. package/lib-commonjs/hooks/{useObservedElement.js → useObservedElement.cjs} +2 -2
  72. package/lib-commonjs/hooks/{useOnKeyboardNavigationChange.js → useOnKeyboardNavigationChange.cjs} +1 -1
  73. package/lib-commonjs/hooks/{useRestoreFocus.js → useRestoreFocus.cjs} +1 -1
  74. package/lib-commonjs/hooks/{useSetKeyboardNavigation.js → useSetKeyboardNavigation.cjs} +1 -1
  75. package/lib-commonjs/hooks/{useTabsterAttributes.js → useTabsterAttributes.cjs} +1 -1
  76. package/lib-commonjs/hooks/{useUncontrolledFocus.js → useUncontrolledFocus.cjs} +1 -1
  77. package/lib-commonjs/{index.js → index.cjs} +3 -3
  78. package/package.json +17 -16
  79. /package/lib-commonjs/focus/{constants.js → constants.cjs} +0 -0
  80. /package/lib-commonjs/focus/{constants.js.map → constants.cjs.map} +0 -0
  81. /package/lib-commonjs/focus/{createCustomFocusIndicatorStyle.js.map → createCustomFocusIndicatorStyle.cjs.map} +0 -0
  82. /package/lib-commonjs/focus/{createFocusOutlineStyle.js.map → createFocusOutlineStyle.cjs.map} +0 -0
  83. /package/lib-commonjs/focus/{focusVisiblePolyfill.js.map → focusVisiblePolyfill.cjs.map} +0 -0
  84. /package/lib-commonjs/focus/{focusWithinPolyfill.js.map → focusWithinPolyfill.cjs.map} +0 -0
  85. /package/lib-commonjs/focus/{index.js.map → index.cjs.map} +0 -0
  86. /package/lib-commonjs/hooks/{index.js.map → index.cjs.map} +0 -0
  87. /package/lib-commonjs/hooks/{useActivateModal.js.map → useActivateModal.cjs.map} +0 -0
  88. /package/lib-commonjs/hooks/{useArrowNavigationGroup.js.map → useArrowNavigationGroup.cjs.map} +0 -0
  89. /package/lib-commonjs/hooks/{useDangerousNeverHidden.js → useDangerousNeverHidden.cjs} +0 -0
  90. /package/lib-commonjs/hooks/{useDangerousNeverHidden.js.map → useDangerousNeverHidden.cjs.map} +0 -0
  91. /package/lib-commonjs/hooks/{useFocusFinders.js.map → useFocusFinders.cjs.map} +0 -0
  92. /package/lib-commonjs/hooks/{useFocusObserved.js.map → useFocusObserved.cjs.map} +0 -0
  93. /package/lib-commonjs/hooks/{useFocusVisible.js.map → useFocusVisible.cjs.map} +0 -0
  94. /package/lib-commonjs/hooks/{useFocusWithin.js.map → useFocusWithin.cjs.map} +0 -0
  95. /package/lib-commonjs/hooks/{useFocusableGroup.js.map → useFocusableGroup.cjs.map} +0 -0
  96. /package/lib-commonjs/hooks/{useFocusedElementChange.js.map → useFocusedElementChange.cjs.map} +0 -0
  97. /package/lib-commonjs/hooks/{useIsNavigatingWithKeyboard.js.map → useIsNavigatingWithKeyboard.cjs.map} +0 -0
  98. /package/lib-commonjs/hooks/{useKeyboardNavAttribute.js.map → useKeyboardNavAttribute.cjs.map} +0 -0
  99. /package/lib-commonjs/hooks/{useKeyborgRef.js → useKeyborgRef.cjs} +0 -0
  100. /package/lib-commonjs/hooks/{useKeyborgRef.js.map → useKeyborgRef.cjs.map} +0 -0
  101. /package/lib-commonjs/hooks/{useMergeTabsterAttributes.js → useMergeTabsterAttributes.cjs} +0 -0
  102. /package/lib-commonjs/hooks/{useMergeTabsterAttributes.js.map → useMergeTabsterAttributes.cjs.map} +0 -0
  103. /package/lib-commonjs/hooks/{useModalAttributes.js.map → useModalAttributes.cjs.map} +0 -0
  104. /package/lib-commonjs/hooks/{useObservedElement.js.map → useObservedElement.cjs.map} +0 -0
  105. /package/lib-commonjs/hooks/{useOnKeyboardNavigationChange.js.map → useOnKeyboardNavigationChange.cjs.map} +0 -0
  106. /package/lib-commonjs/hooks/{useRestoreFocus.js.map → useRestoreFocus.cjs.map} +0 -0
  107. /package/lib-commonjs/hooks/{useSetKeyboardNavigation.js.map → useSetKeyboardNavigation.cjs.map} +0 -0
  108. /package/lib-commonjs/hooks/{useTabster.js → useTabster.cjs} +0 -0
  109. /package/lib-commonjs/hooks/{useTabster.js.map → useTabster.cjs.map} +0 -0
  110. /package/lib-commonjs/hooks/{useTabsterAttributes.js.map → useTabsterAttributes.cjs.map} +0 -0
  111. /package/lib-commonjs/hooks/{useUncontrolledFocus.js.map → useUncontrolledFocus.cjs.map} +0 -0
  112. /package/lib-commonjs/{index.js.map → index.cjs.map} +0 -0
  113. /package/lib-commonjs/{tabster-types-6.0.1-do-not-use.js → tabster-types-6.0.1-do-not-use.cjs} +0 -0
  114. /package/lib-commonjs/{tabster-types-6.0.1-do-not-use.js.map → tabster-types-6.0.1-do-not-use.cjs.map} +0 -0
@@ -0,0 +1,1583 @@
1
+ import { dispatchGroupperMoveFocusEvent } from 'tabster';
2
+ import { dispatchMoverMoveFocusEvent } from 'tabster';
3
+ import { EventsTypes } from 'tabster';
4
+ import type { GriffelStyle } from '@griffel/react';
5
+ import { GroupperMoveFocusActions } from 'tabster';
6
+ import { GroupperMoveFocusEvent } from 'tabster';
7
+ import { GroupperMoveFocusEventName } from 'tabster';
8
+ import { KEYBORG_FOCUSIN } from 'keyborg';
9
+ import { KeyborgFocusInEvent } from 'keyborg';
10
+ import type { makeResetStyles } from '@griffel/react';
11
+ import { MoverKeys } from 'tabster';
12
+ import { MoverMemorizedElementEvent } from 'tabster';
13
+ import { MoverMemorizedElementEventName } from 'tabster';
14
+ import { MoverMoveFocusEvent } from 'tabster';
15
+ import { MoverMoveFocusEventName } from 'tabster';
16
+ import * as React_2 from 'react';
17
+ import { TabsterMoveFocusEvent } from 'tabster';
18
+ import { TabsterMoveFocusEventName } from 'tabster';
19
+ import { Types } from 'tabster';
20
+
21
+ /**
22
+ * @internal
23
+ * @param scope - Applies the ponyfill to all DOM children
24
+ * @param targetWindow - window
25
+ */
26
+ export declare function applyFocusVisiblePolyfill(scope: HTMLElement, targetWindow: Window): () => void;
27
+
28
+ /**
29
+ * Creates a style for @see makeStyles that includes the necessary selectors for focus.
30
+ * Should be used only when @see createFocusOutlineStyle does not fit requirements
31
+ *
32
+ * If you're using `createCustomFocusIndicatorStyle` instead of `createFocusOutlineStyle`
33
+ * keep in mind that the default outline style is not going to be removed
34
+ * (as it is in `createFocusOutlineStyle`),
35
+ * and is your responsibility to manually remove it from your styles.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // Link styles
40
+ * const useStyles = makeStyles({
41
+ focusIndicator: createCustomFocusIndicatorStyle({
42
+ textDecorationColor: tokens.colorStrokeFocus2,
43
+ textDecorationLine: 'underline',
44
+ textDecorationStyle: 'double',
45
+ outlineStyle: 'none',
46
+ }),
47
+ // Common styles.
48
+ root: {
49
+ // ❗️ DO NOT FORGET TO REMOVE THE DEFAULT OUTLINE STYLE
50
+ ':focus-visible': {
51
+ outlineStyle: 'none',
52
+ },
53
+ * ```
54
+ *
55
+ * @param style - styling applied on focus, defaults to @see getDefaultFocusOutlineStyles
56
+ * @param options - Configure the style of the focus outline
57
+ */
58
+ export declare function createCustomFocusIndicatorStyle<TStyle extends GriffelStyle | GriffelResetStyle>(style: TStyle, { selector: selectorType, customizeSelector, }?: CreateCustomFocusIndicatorStyleOptions): TStyle extends GriffelStyle ? GriffelStyle : GriffelResetStyle;
59
+
60
+ export declare interface CreateCustomFocusIndicatorStyleOptions {
61
+ /**
62
+ * Control if the indicator appears when the corresponding element is focused,
63
+ * or any child is focused within the corresponding element.
64
+ * @default 'focus'
65
+ * @alias selectorType
66
+ */
67
+ selector?: 'focus' | 'focus-within';
68
+ /**
69
+ * Customizes the selector provided based on the selector type.
70
+ */
71
+ customizeSelector?: (selector: string) => string;
72
+ /**
73
+ * Enables the browser default outline style
74
+ * @deprecated The custom focus indicator no longer affects outline styles. Outline is overridden
75
+ * in the default focus indicator function, `createFocusOutlineStyle`.
76
+ */
77
+ enableOutline?: boolean;
78
+ }
79
+
80
+ /**
81
+ * NOTE: The element with the focus outline needs to have `position: relative` so that the
82
+ * pseudo element can be properly positioned.
83
+ *
84
+ * @param options - Configure the style of the focus outline
85
+ * @returns focus outline styles object for @see makeStyles
86
+ */
87
+ export declare const createFocusOutlineStyle: ({ enableOutline, selector, customizeSelector, style, }?: CreateFocusOutlineStyleOptions) => GriffelStyle;
88
+
89
+ export declare interface CreateFocusOutlineStyleOptions extends Omit<CreateCustomFocusIndicatorStyleOptions, 'enableOutline'> {
90
+ style?: Partial<FocusOutlineStyleOptions>;
91
+ /**
92
+ * Enables the browser default outline style
93
+ */
94
+ enableOutline?: boolean;
95
+ }
96
+
97
+ declare interface CrossOriginAPI {
98
+ focusedElement: CrossOriginFocusedElementState;
99
+ observedElement: CrossOriginObservedElementState;
100
+ setup(sendUp?: CrossOriginTransactionSend | null): (msg: CrossOriginMessage) => void;
101
+ isSetUp(): boolean;
102
+ dispose(): void;
103
+ }
104
+
105
+ declare interface CrossOriginElement {
106
+ readonly uid: string;
107
+ readonly ownerId: string;
108
+ readonly id?: string;
109
+ readonly rootId?: string;
110
+ readonly observedName?: string;
111
+ readonly observedDetails?: string;
112
+ focus(noFocusedProgrammaticallyFlag?: boolean, noAccessibleCheck?: boolean): Promise<boolean>;
113
+ }
114
+
115
+ declare interface CrossOriginFocusedElementState extends Subscribable<CrossOriginElement | undefined, FocusedElementDetails>, Disposable {
116
+ focus(element: CrossOriginElement, noFocusedProgrammaticallyFlag?: boolean, noAccessibleCheck?: boolean): Promise<boolean>;
117
+ focusById(elementId: string, rootId?: string, noFocusedProgrammaticallyFlag?: boolean, noAccessibleCheck?: boolean): Promise<boolean>;
118
+ focusByObservedName(observedName: string, timeout?: number, rootId?: string, noFocusedProgrammaticallyFlag?: boolean, noAccessibleCheck?: boolean): Promise<boolean>;
119
+ }
120
+
121
+ declare interface CrossOriginMessage {
122
+ data: CrossOriginTransactionData<any, any>;
123
+ send: CrossOriginTransactionSend;
124
+ }
125
+
126
+ declare interface CrossOriginObservedElementState extends Subscribable<CrossOriginElement, ObservedElementProps>, Disposable {
127
+ getElement(observedName: string, accessibility?: ObservedElementAccesibility): Promise<CrossOriginElement | null>;
128
+ waitElement(observedName: string, timeout: number, accessibility?: ObservedElementAccesibility): Promise<CrossOriginElement | null>;
129
+ requestFocus(observedName: string, timeout: number): Promise<boolean>;
130
+ }
131
+
132
+ declare interface CrossOriginSentTo {
133
+ [id: string]: true;
134
+ }
135
+
136
+ declare interface CrossOriginTransactionData<I, O> {
137
+ transaction: string;
138
+ type: CrossOriginTransactionType;
139
+ isResponse: boolean;
140
+ timestamp: number;
141
+ owner: string;
142
+ sentto: CrossOriginSentTo;
143
+ timeout?: number;
144
+ target?: string;
145
+ beginData?: I;
146
+ endData?: O;
147
+ }
148
+
149
+ declare type CrossOriginTransactionSend = (data: CrossOriginTransactionData<any, any>) => void;
150
+
151
+ declare type CrossOriginTransactionType = CrossOriginTransactionTypes[keyof CrossOriginTransactionTypes];
152
+
153
+ declare interface CrossOriginTransactionTypes {
154
+ Bootstrap: 1;
155
+ FocusElement: 2;
156
+ State: 3;
157
+ GetElement: 4;
158
+ RestoreFocusInDeloser: 5;
159
+ Ping: 6;
160
+ }
161
+
162
+ declare interface Deloser extends TabsterPart<DeloserProps> {
163
+ readonly uid: string;
164
+ dispose(): void;
165
+ isActive(): boolean;
166
+ setActive(active: boolean): void;
167
+ getActions(): DeloserElementActions;
168
+ setSnapshot(index: number): void;
169
+ focusFirst(): boolean;
170
+ unshift(element: HTMLElement): void;
171
+ focusDefault(): boolean;
172
+ resetFocus(): boolean;
173
+ findAvailable(): HTMLElement | null;
174
+ clearHistory(preserveExisting?: boolean): void;
175
+ customFocusLostHandler(element: HTMLElement): boolean;
176
+ }
177
+
178
+ declare interface DeloserAPI extends DeloserInterfaceInternal, Disposable {
179
+ getActions(element: HTMLElement): DeloserElementActions | undefined;
180
+ pause(): void;
181
+ resume(restore?: boolean): void;
182
+ }
183
+
184
+ declare type DeloserConstructor = (element: HTMLElement, props: DeloserProps) => Deloser;
185
+
186
+ declare interface DeloserElementActions {
187
+ focusDefault: () => boolean;
188
+ focusFirst: () => boolean;
189
+ resetFocus: () => boolean;
190
+ clearHistory: (preserveExisting?: boolean) => void;
191
+ setSnapshot: (index: number) => void;
192
+ isActive: () => boolean;
193
+ }
194
+
195
+ declare const DeloserEventName = "tabster:deloser";
196
+
197
+ declare interface DeloserInterfaceInternal {
198
+ /** @internal */
199
+ createDeloser(element: HTMLElement, props: DeloserProps): Deloser;
200
+ }
201
+
202
+ declare interface DeloserOnElement {
203
+ deloser: Deloser;
204
+ }
205
+
206
+ declare interface DeloserProps {
207
+ restoreFocusOrder?: RestoreFocusOrder;
208
+ noSelectorCheck?: boolean;
209
+ }
210
+
211
+ export { dispatchGroupperMoveFocusEvent }
212
+
213
+ export { dispatchMoverMoveFocusEvent }
214
+
215
+ declare interface Disposable {
216
+ /** @internal */
217
+ dispose(): void;
218
+ }
219
+
220
+ declare type DisposeFunc = () => void;
221
+
222
+ declare interface DOMAPI {
223
+ createMutationObserver: (callback: MutationCallback) => MutationObserver;
224
+ createTreeWalker(doc: Document, root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker;
225
+ getParentNode(node: Node | null | undefined): ParentNode | null;
226
+ getParentElement(element: HTMLElement | null | undefined): HTMLElement | null;
227
+ nodeContains(parent: Node | null | undefined, child: Node | null | undefined): boolean;
228
+ getActiveElement(doc: Document): Element | null;
229
+ querySelector(element: ParentNode, selector: string): Element | null;
230
+ querySelectorAll(element: ParentNode, selector: string): Element[];
231
+ getElementById(doc: Document, id: string): HTMLElement | null;
232
+ getFirstChild(node: Node | null | undefined): ChildNode | null;
233
+ getLastChild(node: Node | null | undefined): ChildNode | null;
234
+ getNextSibling(node: Node | null | undefined): ChildNode | null;
235
+ getPreviousSibling(node: Node | null | undefined): ChildNode | null;
236
+ getFirstElementChild(element: Element | null | undefined): Element | null;
237
+ getLastElementChild(element: Element | null | undefined): Element | null;
238
+ getNextElementSibling(element: Element | null | undefined): Element | null;
239
+ getPreviousElementSibling(element: Element | null | undefined): Element | null;
240
+ appendChild(parent: Node, child: Node): Node;
241
+ insertBefore(parent: Node, child: Node, referenceChild: Node | null): Node;
242
+ getSelection(ref: Node): Selection | null;
243
+ }
244
+
245
+ declare interface DummyInputManager {
246
+ moveOut: (backwards: boolean) => void;
247
+ moveOutWithDefaultAction: (backwards: boolean, relatedEvent: KeyboardEvent) => void;
248
+ }
249
+
250
+ declare interface DummyInputObserver {
251
+ add(dummy: HTMLElement, callback: () => void): void;
252
+ remove(dummy: HTMLElement): void;
253
+ dispose(): void;
254
+ domChanged?(parent: HTMLElement): void;
255
+ updatePositions(compute: (scrollTopLeftCache: Map<HTMLElement, {
256
+ scrollTop: number;
257
+ scrollLeft: number;
258
+ } | null>) => () => void): void;
259
+ }
260
+
261
+ declare type FindAllProps = Pick<FindFocusableProps, 'container' | 'modalizerId' | 'currentElement' | 'isBackward' | 'includeProgrammaticallyFocusable' | 'useActiveModalizer' | 'acceptCondition' | 'ignoreAccessibility' | 'onElement'>;
262
+
263
+ declare type FindDefaultProps = Pick<FindFocusableProps, 'container' | 'modalizerId' | 'includeProgrammaticallyFocusable' | 'useActiveModalizer' | 'ignoreAccessibility'>;
264
+
265
+ /**
266
+ * A callback that is called for every found element during search. Returning false stops search.
267
+ */
268
+ declare type FindElementCallback = (element: HTMLElement) => boolean;
269
+
270
+ declare type FindFirstProps = Pick<FindFocusableProps, 'container' | 'modalizerId' | 'includeProgrammaticallyFocusable' | 'useActiveModalizer' | 'ignoreAccessibility'>;
271
+
272
+ declare interface FindFocusableOutputProps {
273
+ /**
274
+ * An output parameter. Will be true after the findNext/findPrev() call if some focusable
275
+ * elements were skipped during the search and the result element not immediately next
276
+ * focusable after the currentElement.
277
+ */
278
+ outOfDOMOrder?: boolean;
279
+ /**
280
+ * An output parameter. Will be true if the found element is uncontrolled.
281
+ */
282
+ uncontrolled?: HTMLElement | null;
283
+ }
284
+
285
+ declare interface FindFocusableProps {
286
+ /**
287
+ * The container used for the search.
288
+ */
289
+ container: HTMLElement;
290
+ /**
291
+ * The elemet to start from.
292
+ */
293
+ currentElement?: HTMLElement;
294
+ /**
295
+ * See `referenceElement` of GetTabsterContextOptions for description.
296
+ */
297
+ referenceElement?: HTMLElement;
298
+ /**
299
+ * Includes elements that can be focused programmatically.
300
+ */
301
+ includeProgrammaticallyFocusable?: boolean;
302
+ /**
303
+ * Ignore accessibility check.
304
+ */
305
+ ignoreAccessibility?: boolean;
306
+ /**
307
+ * Take active modalizer into account when searching for elements
308
+ * (the elements out of active modalizer will not be returned).
309
+ */
310
+ useActiveModalizer?: boolean;
311
+ /**
312
+ * Search withing the specified modality, null for everything outside of modalizers, string within
313
+ * a specific id, undefined for search within the current application state.
314
+ */
315
+ modalizerId?: string | null;
316
+ /**
317
+ * If true, find previous element instead of the next one.
318
+ */
319
+ isBackward?: boolean;
320
+ /**
321
+ * @param el - element visited.
322
+ * @returns if an element should be accepted.
323
+ */
324
+ acceptCondition?(el: HTMLElement): boolean;
325
+ /**
326
+ * A callback that will be called for every focusable element found during findAll().
327
+ * If false is returned from this callback, the search will stop.
328
+ */
329
+ onElement?: FindElementCallback;
330
+ }
331
+
332
+ declare type FindNextProps = Pick<FindFocusableProps, 'currentElement' | 'referenceElement' | 'container' | 'modalizerId' | 'includeProgrammaticallyFocusable' | 'useActiveModalizer' | 'ignoreAccessibility'>;
333
+
334
+ declare interface FocusableAcceptElementState {
335
+ container: HTMLElement;
336
+ modalizerUserId?: string;
337
+ currentCtx?: TabsterContext;
338
+ from: HTMLElement;
339
+ fromCtx?: TabsterContext;
340
+ isBackward?: boolean;
341
+ found?: boolean;
342
+ foundElement?: HTMLElement;
343
+ foundBackward?: HTMLElement;
344
+ rejectElementsFrom?: HTMLElement;
345
+ uncontrolled?: HTMLElement;
346
+ acceptCondition: (el: HTMLElement) => boolean;
347
+ hasCustomCondition?: boolean;
348
+ includeProgrammaticallyFocusable?: boolean;
349
+ ignoreAccessibility?: boolean;
350
+ cachedGrouppers: {
351
+ [id: string]: {
352
+ isActive: boolean | undefined;
353
+ first?: HTMLElement | null;
354
+ };
355
+ };
356
+ isFindAll?: boolean;
357
+ /**
358
+ * A flag that indicates that some focusable elements were skipped
359
+ * during the search and the found element is not the one the browser
360
+ * would normally focus if the user pressed Tab.
361
+ */
362
+ skippedFocusable?: boolean;
363
+ }
364
+
365
+ declare interface FocusableAPI extends Disposable {
366
+ getProps(element: HTMLElement): FocusableProps;
367
+ isFocusable(element: HTMLElement, includeProgrammaticallyFocusable?: boolean, noVisibleCheck?: boolean, noAccessibleCheck?: boolean): boolean;
368
+ isVisible(element: HTMLElement): boolean;
369
+ isAccessible(element: HTMLElement): boolean;
370
+ findFirst(options: FindFirstProps, out?: FindFocusableOutputProps): HTMLElement | null | undefined;
371
+ findLast(options: FindFirstProps, out?: FindFocusableOutputProps): HTMLElement | null | undefined;
372
+ findNext(options: FindNextProps, out?: FindFocusableOutputProps): HTMLElement | null | undefined;
373
+ findPrev(options: FindNextProps, out?: FindFocusableOutputProps): HTMLElement | null | undefined;
374
+ findDefault(options: FindDefaultProps, out?: FindFocusableOutputProps): HTMLElement | null;
375
+ /**
376
+ * @returns All focusables in a given context that satisfy an given condition
377
+ */
378
+ findAll(options: FindAllProps): HTMLElement[];
379
+ findElement(options: FindFocusableProps, out?: FindFocusableOutputProps): HTMLElement | null | undefined;
380
+ }
381
+
382
+ declare interface FocusableOnElement {
383
+ focusable: FocusableProps;
384
+ }
385
+
386
+ declare interface FocusableProps {
387
+ isDefault?: boolean;
388
+ isIgnored?: boolean;
389
+ /**
390
+ * Do not determine an element's focusability based on aria-disabled.
391
+ */
392
+ ignoreAriaDisabled?: boolean;
393
+ /**
394
+ * Exclude element (and all subelements) from Mover navigation.
395
+ */
396
+ excludeFromMover?: boolean;
397
+ /**
398
+ * Prevents tabster from handling the keydown event
399
+ */
400
+ ignoreKeydown?: {
401
+ Tab?: boolean;
402
+ Escape?: boolean;
403
+ Enter?: boolean;
404
+ ArrowUp?: boolean;
405
+ ArrowDown?: boolean;
406
+ ArrowLeft?: boolean;
407
+ ArrowRight?: boolean;
408
+ PageUp?: boolean;
409
+ PageDown?: boolean;
410
+ Home?: boolean;
411
+ End?: boolean;
412
+ };
413
+ }
414
+
415
+ declare const FocusableSelector: string;
416
+
417
+ declare interface FocusedElementDetails {
418
+ relatedTarget?: HTMLElement;
419
+ isFocusedProgrammatically?: boolean;
420
+ modalizerId?: string;
421
+ }
422
+
423
+ declare interface FocusedElementState extends Subscribable<HTMLElement | undefined, FocusedElementDetails>, Disposable {
424
+ getFocusedElement(): HTMLElement | undefined;
425
+ getLastFocusedElement(): HTMLElement | undefined;
426
+ focus(element: HTMLElement, noFocusedProgrammaticallyFlag?: boolean, noAccessibleCheck?: boolean): boolean;
427
+ focusDefault(container: HTMLElement): boolean;
428
+ /** @internal */
429
+ getFirstOrLastTabbable(isFirst: boolean, props: Pick<FindFocusableProps, 'container' | 'ignoreAccessibility'>): HTMLElement | undefined;
430
+ focusFirst(props: FindFirstProps): boolean;
431
+ focusLast(props: FindFirstProps): boolean;
432
+ resetFocus(container: HTMLElement): boolean;
433
+ }
434
+
435
+ declare const FocusInEventName = "tabster:focusin";
436
+
437
+ declare const FocusOutEventName = "tabster:focusout";
438
+
439
+ export declare type FocusOutlineOffset = Record<'top' | 'bottom' | 'left' | 'right', string>;
440
+
441
+ export declare type FocusOutlineStyleOptions = {
442
+ /**
443
+ * Only property not supported by the native CSS `outline`, if this is no longer needed
444
+ * we can just go native instead
445
+ */
446
+ outlineRadius: string;
447
+ outlineColor: string;
448
+ outlineWidth: string;
449
+ outlineOffset?: string | FocusOutlineOffset;
450
+ };
451
+
452
+ declare type GetTabster = () => TabsterCore;
453
+
454
+ declare interface GetTabsterContextOptions {
455
+ /**
456
+ * Should visit **all** element ancestors to verify if `dir='rtl'` is set
457
+ */
458
+ checkRtl?: boolean;
459
+ /**
460
+ * The element to start computing the context from. Useful when dealing
461
+ * with nested structures. For example, if we have an element inside a groupper
462
+ * inside another groupper, the `groupper` prop in this element's contexts will
463
+ * be the inner groupper, but when we pass the inner groupper's parent element
464
+ * as `referenceElement`, the context groupper will be the outer one. Having
465
+ * this option simplifies searching for the next tabbable element in the
466
+ * environment of nested movers and grouppers.
467
+ */
468
+ referenceElement?: HTMLElement;
469
+ }
470
+
471
+ declare type GetWindow = () => Window;
472
+
473
+ declare type GriffelResetStyle = Parameters<typeof makeResetStyles>[0];
474
+
475
+ declare interface Groupper extends TabsterPart<GroupperProps>, TabsterPartWithFindNextTabbable, TabsterPartWithAcceptElement {
476
+ readonly id: string;
477
+ readonly dummyManager: DummyInputManager | undefined;
478
+ dispose(): void;
479
+ makeTabbable(isUnlimited: boolean): void;
480
+ isActive(noIfFirstIsFocused?: boolean): boolean | undefined;
481
+ setFirst(element: HTMLElement | undefined): void;
482
+ getFirst(orContainer: boolean): HTMLElement | undefined;
483
+ }
484
+
485
+ declare interface GroupperAPI extends GroupperAPIInternal, Disposable {
486
+ /**
487
+ * (will likely be exposed once the API is fully stable)
488
+ *
489
+ * @internal
490
+ */
491
+ moveFocus(element: HTMLElement, action: GroupperMoveFocusAction): HTMLElement | null;
492
+ }
493
+
494
+ declare interface GroupperAPIInternal {
495
+ /** @internal */
496
+ createGroupper(element: HTMLElement, props: GroupperProps, sys: SysProps | undefined): Groupper;
497
+ /** @internal */
498
+ handleKeyPress(element: HTMLElement, event: KeyboardEvent, fromModalizer?: boolean): void;
499
+ }
500
+
501
+ declare interface GroupperAPIInternal {
502
+ forgetCurrentGrouppers(): void;
503
+ }
504
+
505
+ declare type GroupperConstructor = (tabster: TabsterCore, element: HTMLElement, props: GroupperProps) => Groupper;
506
+
507
+ declare type GroupperMoveFocusAction = GroupperMoveFocusActions_2[keyof GroupperMoveFocusActions_2];
508
+
509
+ export { GroupperMoveFocusActions }
510
+
511
+ declare interface GroupperMoveFocusActions_2 {
512
+ Enter: 1;
513
+ Escape: 2;
514
+ }
515
+
516
+ declare const GroupperMoveFocusActions_2: GroupperMoveFocusActions_2;
517
+
518
+ export { GroupperMoveFocusEvent }
519
+
520
+ declare type GroupperMoveFocusEvent_2 = CustomEvent<{
521
+ action: GroupperMoveFocusAction;
522
+ } | undefined>;
523
+
524
+ export declare type GroupperMoveFocusEventDetail = EventsTypes.GroupperMoveFocusEventDetail;
525
+
526
+ export { GroupperMoveFocusEventName }
527
+
528
+ declare const GroupperMoveFocusEventName_2 = "tabster:groupper:movefocus";
529
+
530
+ declare interface GroupperOnElement {
531
+ groupper: Groupper;
532
+ }
533
+
534
+ declare interface GroupperProps {
535
+ tabbability?: GroupperTabbability;
536
+ delegated?: boolean;
537
+ }
538
+
539
+ declare interface GroupperTabbabilities {
540
+ Unlimited: 0;
541
+ Limited: 1;
542
+ LimitedTrapFocus: 2;
543
+ }
544
+
545
+ declare const GroupperTabbabilities: GroupperTabbabilities;
546
+
547
+ declare type GroupperTabbability = GroupperTabbabilities[keyof GroupperTabbabilities];
548
+
549
+ declare interface InternalAPI {
550
+ stopObserver(): void;
551
+ resumeObserver(syncState: boolean): void;
552
+ }
553
+
554
+ declare interface KeyboardNavigationState extends Subscribable<boolean>, Disposable {
555
+ isNavigatingWithKeyboard(): boolean;
556
+ setNavigatingWithKeyboard(isNavigatingWithKeyboard: boolean): void;
557
+ }
558
+
559
+ export { KEYBORG_FOCUSIN }
560
+
561
+ export { KeyborgFocusInEvent }
562
+
563
+ declare interface Modalizer extends TabsterPart<ModalizerProps>, TabsterPartWithFindNextTabbable {
564
+ readonly userId: string;
565
+ readonly dummyManager: DummyInputManager | undefined;
566
+ /**
567
+ * @returns - Whether the element is inside the modalizer
568
+ */
569
+ contains(element: HTMLElement): boolean;
570
+ dispose(): void;
571
+ isActive(): boolean;
572
+ makeActive(isActive: boolean): void;
573
+ focused(noIncrement?: boolean): number;
574
+ triggerFocusEvent(eventName: ModalizerEventName, allElements: boolean): boolean;
575
+ }
576
+
577
+ declare const ModalizerActiveEventName = "tabster:modalizer:active";
578
+
579
+ declare interface ModalizerAPI extends ModalizerAPIInternal, Disposable {
580
+ /**
581
+ * Activates a Modalizer and focuses the first or default element within
582
+ *
583
+ * @param elementFromModalizer - An element that belongs to a Modalizer
584
+ * @param noFocusFirst - Do not focus on the first element in the Modalizer
585
+ * @param noFocusDefault - Do not focus the default element in the Modalizre
586
+ */
587
+ focus(elementFromModalizer: HTMLElement, noFocusFirst?: boolean, noFocusDefault?: boolean): boolean;
588
+ }
589
+
590
+ declare interface ModalizerAPIInternal extends TabsterPartWithAcceptElement {
591
+ /** @internal */
592
+ activeId: string | undefined;
593
+ /** @internal */
594
+ currentIsOthersAccessible: boolean | undefined;
595
+ /** @internal */
596
+ activeElements: WeakHTMLElement<HTMLElement>[];
597
+ /** @internal */
598
+ createModalizer(element: HTMLElement, props: ModalizerProps, sys: SysProps | undefined): Modalizer;
599
+ /**
600
+ * Sets active modalizers.
601
+ * When active, everything outside of the modalizers with the specific user
602
+ * defined id gets `aria-hidden`.
603
+ *
604
+ * @param userId - user defined identifier or undefined (if nothing is modal).
605
+ */
606
+ /** @internal */
607
+ setActive(modalizer: Modalizer | undefined): void;
608
+ /** @internal */
609
+ hiddenUpdate(): void;
610
+ /** @internal */
611
+ isAugmented(element: HTMLElement): boolean;
612
+ }
613
+
614
+ declare const ModalizerBeforeFocusOutEventName = "tabster:modalizer:beforefocusout";
615
+
616
+ declare type ModalizerConstructor = (tabster: TabsterCore, element: HTMLElement, props: ModalizerProps) => Modalizer;
617
+
618
+ /**
619
+ * A signature for the accessibleCheck callback from getModalizer().
620
+ * It is called when active Modalizer sets aria-hidden on elements outsidef of it.
621
+ *
622
+ * @param element - The element that is about to receive aria-hidden.
623
+ * @param activeModalizerElements - The container elements of the active modalizer.
624
+ * @returns true if the element should remain accessible and should not receive
625
+ * aria-hidden.
626
+ */
627
+ declare type ModalizerElementAccessibleCheck = (element: HTMLElement, activeModalizerElements?: HTMLElement[]) => boolean;
628
+
629
+ declare type ModalizerEvent = TabsterEventWithDetails<ModalizerEventDetails>;
630
+
631
+ declare type ModalizerEventDetails = {
632
+ id: string;
633
+ element: HTMLElement;
634
+ eventName: ModalizerEventName;
635
+ };
636
+
637
+ declare type ModalizerEventName = typeof ModalizerActiveEventName | typeof ModalizerInactiveEventName | typeof ModalizerBeforeFocusOutEventName | typeof ModalizerFocusInEventName | typeof ModalizerFocusOutEventName;
638
+
639
+ declare const ModalizerFocusInEventName = "tabster:modalizer:focusin";
640
+
641
+ declare const ModalizerFocusOutEventName = "tabster:modalizer:focusout";
642
+
643
+ declare const ModalizerInactiveEventName = "tabster:modalizer:inactive";
644
+
645
+ declare interface ModalizerOnElement {
646
+ modalizer: Modalizer;
647
+ }
648
+
649
+ declare interface ModalizerProps {
650
+ id: string;
651
+ isOthersAccessible?: boolean;
652
+ isAlwaysAccessible?: boolean;
653
+ isNoFocusFirst?: boolean;
654
+ isNoFocusDefault?: boolean;
655
+ /** A focus trap variant, keeps focus inside the modal when tabbing */
656
+ isTrapped?: boolean;
657
+ }
658
+
659
+ declare const MoveFocusEventName = "tabster:movefocus";
660
+
661
+ declare interface Mover extends TabsterPart<MoverProps>, TabsterPartWithFindNextTabbable, TabsterPartWithAcceptElement {
662
+ readonly id: string;
663
+ readonly dummyManager: DummyInputManager | undefined;
664
+ readonly visibilityTolerance: NonNullable<MoverProps['visibilityTolerance']>;
665
+ dispose(): void;
666
+ setCurrent(element: HTMLElement | undefined): void;
667
+ getCurrent(): HTMLElement | null;
668
+ getState(element: HTMLElement): MoverElementState | undefined;
669
+ }
670
+
671
+ declare interface MoverAPI extends MoverAPIInternal, Disposable {
672
+ /**
673
+ * (will likely be exposed once the API is fully stable)
674
+ *
675
+ * @internal
676
+ */
677
+ moveFocus(fromElement: HTMLElement, key: MoverKey): HTMLElement | null;
678
+ }
679
+
680
+ declare interface MoverAPIInternal {
681
+ /** @internal */
682
+ createMover(element: HTMLElement, props: MoverProps, sys: SysProps | undefined): Mover;
683
+ }
684
+
685
+ declare type MoverConstructor = (tabster: TabsterCore, element: HTMLElement, props: MoverProps) => Mover;
686
+
687
+ declare type MoverDirection = MoverDirections[keyof MoverDirections];
688
+
689
+ declare interface MoverDirections {
690
+ Both: 0;
691
+ Vertical: 1;
692
+ Horizontal: 2;
693
+ Grid: 3;
694
+ GridLinear: 4;
695
+ }
696
+
697
+ declare const MoverDirections: MoverDirections;
698
+
699
+ declare interface MoverElementState {
700
+ isCurrent: boolean | undefined;
701
+ visibility: Visibility;
702
+ }
703
+
704
+ declare type MoverEvent = TabsterEventWithDetails<MoverElementState>;
705
+
706
+ declare const MoverEventName = "tabster:mover";
707
+
708
+ declare type MoverKey = MoverKeys_2[keyof MoverKeys_2];
709
+
710
+ export { MoverKeys }
711
+
712
+ declare interface MoverKeys_2 {
713
+ ArrowUp: 1;
714
+ ArrowDown: 2;
715
+ ArrowLeft: 3;
716
+ ArrowRight: 4;
717
+ PageUp: 5;
718
+ PageDown: 6;
719
+ Home: 7;
720
+ End: 8;
721
+ }
722
+
723
+ declare const MoverKeys_2: MoverKeys_2;
724
+
725
+ export { MoverMemorizedElementEvent }
726
+
727
+ export declare type MoverMemorizedElementEventDetail = EventsTypes.MoverMemorizedElementEventDetail;
728
+
729
+ export { MoverMemorizedElementEventName }
730
+
731
+ export { MoverMoveFocusEvent }
732
+
733
+ declare type MoverMoveFocusEvent_2 = CustomEvent<{
734
+ key: MoverKey;
735
+ } | undefined>;
736
+
737
+ export declare type MoverMoveFocusEventDetail = EventsTypes.MoverMoveFocusEventDetail;
738
+
739
+ export { MoverMoveFocusEventName }
740
+
741
+ declare const MoverMoveFocusEventName_2 = "tabster:mover:movefocus";
742
+
743
+ declare interface MoverOnElement {
744
+ mover: Mover;
745
+ }
746
+
747
+ declare interface MoverProps {
748
+ direction?: MoverDirection;
749
+ memorizeCurrent?: boolean;
750
+ tabbable?: boolean;
751
+ /**
752
+ * Whether to allow cyclic navigation in the mover
753
+ * Can only be applied if navigationType is MoverKeys.Arrows
754
+ *
755
+ * @defaultValue false
756
+ */
757
+ cyclic?: boolean;
758
+ /**
759
+ * In case we need a rich state of the elements inside a Mover,
760
+ * we can track it. It takes extra resourses and might affect
761
+ * performance when a Mover has many elements inside, so make sure
762
+ * you use this prop when it is really needed.
763
+ */
764
+ trackState?: boolean;
765
+ /**
766
+ * When set to Visibility.Visible or Visibility.PartiallyVisible,
767
+ * uses the visibility part of the trackState prop to be able to
768
+ * go to first/last visible element (instead of first/last focusable
769
+ * element in DOM) when tabbing from outside of the mover.
770
+ */
771
+ visibilityAware?: Visibility;
772
+ /**
773
+ * When true, Mover will try to locate a focusable with Focusable.isDefault
774
+ * property as a prioritized element to focus. True by default.
775
+ */
776
+ hasDefault?: boolean;
777
+ /**
778
+ * A value between 0 and 1 that specifies the tolerance allowed
779
+ * when testing for visibility.
780
+ *
781
+ * @example
782
+ * an element of height 100px has 10px that are above the viewport
783
+ * hidden by scroll. This element is a valid visible element to focus.
784
+ *
785
+ * @default 0.8
786
+ */
787
+ visibilityTolerance?: number;
788
+ }
789
+
790
+ declare type NextTabbable = {
791
+ element: HTMLElement | null | undefined;
792
+ uncontrolled?: HTMLElement | null;
793
+ outOfDOMOrder?: boolean;
794
+ };
795
+
796
+ declare interface ObservedElementAccesibilities {
797
+ Any: 0;
798
+ Accessible: 1;
799
+ Focusable: 2;
800
+ }
801
+
802
+ declare const ObservedElementAccesibilities: ObservedElementAccesibilities;
803
+
804
+ declare type ObservedElementAccesibility = ObservedElementAccesibilities[keyof ObservedElementAccesibilities];
805
+
806
+ declare interface ObservedElementAPI extends Subscribable<HTMLElement, ObservedElementDetails>, Disposable, ObservedElementAPIInternal {
807
+ getElement(observedName: string, accessibility?: ObservedElementAccesibility): HTMLElement | null;
808
+ waitElement(observedName: string, timeout: number, accessibility?: ObservedElementAccesibility): ObservedElementAsyncRequest<HTMLElement | null>;
809
+ requestFocus(observedName: string, timeout: number): ObservedElementAsyncRequest<boolean>;
810
+ }
811
+
812
+ declare interface ObservedElementAPIInternal {
813
+ /** @internal */
814
+ onObservedElementUpdate(element: HTMLElement): void;
815
+ }
816
+
817
+ declare interface ObservedElementAsyncRequest<T> {
818
+ result: Promise<T>;
819
+ cancel(): void;
820
+ }
821
+
822
+ declare interface ObservedElementDetails extends ObservedElementProps {
823
+ accessibility?: ObservedElementAccesibility;
824
+ }
825
+
826
+ declare interface ObservedElementProps {
827
+ names: string[];
828
+ details?: any;
829
+ }
830
+
831
+ declare interface ObservedOnElement {
832
+ observed: ObservedElementProps;
833
+ }
834
+
835
+ declare interface OutlineAPI extends Disposable {
836
+ setup(props?: Partial<OutlineProps>): void;
837
+ }
838
+
839
+ declare interface OutlinedElementProps {
840
+ isIgnored?: boolean;
841
+ }
842
+
843
+ declare interface OutlineElements {
844
+ container: HTMLDivElement;
845
+ left: HTMLDivElement;
846
+ top: HTMLDivElement;
847
+ right: HTMLDivElement;
848
+ bottom: HTMLDivElement;
849
+ }
850
+
851
+ declare interface OutlineOnElement {
852
+ outline: OutlinedElementProps;
853
+ }
854
+
855
+ declare interface OutlineProps {
856
+ areaClass: string;
857
+ outlineClass: string;
858
+ outlineColor: string;
859
+ outlineWidth: number;
860
+ zIndex: number;
861
+ }
862
+
863
+ declare type RestoreFocusOrder = RestoreFocusOrders[keyof RestoreFocusOrders];
864
+
865
+ declare interface RestoreFocusOrders {
866
+ History: 0;
867
+ DeloserDefault: 1;
868
+ RootDefault: 2;
869
+ DeloserFirst: 3;
870
+ RootFirst: 4;
871
+ }
872
+
873
+ declare const RestoreFocusOrders: RestoreFocusOrders;
874
+
875
+ declare interface Restorer extends Disposable, TabsterPart<RestorerProps> {
876
+ }
877
+
878
+ declare interface RestorerAPI extends RestorerAPIInternal, Disposable {
879
+ }
880
+
881
+ declare interface RestorerAPIInternal {
882
+ /** @internal */
883
+ createRestorer(element: HTMLElement, props: RestorerProps): Restorer;
884
+ }
885
+
886
+ declare interface RestorerOnElement {
887
+ restorer: Restorer;
888
+ }
889
+
890
+ declare interface RestorerProps {
891
+ type: RestorerType;
892
+ }
893
+
894
+ declare type RestorerType = (typeof RestorerTypes)[keyof typeof RestorerTypes];
895
+
896
+ declare const RestorerTypes: {
897
+ readonly Source: 0;
898
+ readonly Target: 1;
899
+ };
900
+
901
+ declare interface Root extends TabsterPart<RootProps> {
902
+ /**@internal*/
903
+ addDummyInputs(): void;
904
+ readonly uid: string;
905
+ dispose(): void;
906
+ moveOutWithDefaultAction(backwards: boolean, relatedEvent: KeyboardEvent): void;
907
+ }
908
+
909
+ declare interface RootAPI extends Disposable, RootAPIInternal {
910
+ eventTarget: EventTarget;
911
+ }
912
+
913
+ declare interface RootAPIInternal {
914
+ /**@internal*/
915
+ createRoot(element: HTMLElement, props: RootProps, sys: SysProps | undefined): Root;
916
+ /**@internal*/
917
+ onRoot(root: Root, removed?: boolean): void;
918
+ /**@internal*/
919
+ addDummyInputs(): void;
920
+ }
921
+
922
+ declare type RootConstructor = (tabster: TabsterCore, element: HTMLElement, props: RootProps) => Root;
923
+
924
+ declare interface RootFocusEventDetails {
925
+ element: HTMLElement;
926
+ }
927
+
928
+ declare interface RootOnElement {
929
+ root: Root;
930
+ }
931
+
932
+ declare interface RootProps {
933
+ restoreFocusOrder?: RestoreFocusOrder;
934
+ }
935
+
936
+ declare interface Subscribable<A, B = undefined> {
937
+ subscribe(callback: SubscribableCallback<A, B>): void;
938
+ /** @internal */
939
+ subscribeFirst(callback: SubscribableCallback<A, B>): void;
940
+ unsubscribe(callback: SubscribableCallback<A, B>): void;
941
+ }
942
+
943
+ declare type SubscribableCallback<A, B = undefined> = (val: A, details: B) => void;
944
+
945
+ declare type SysDummyInputsPosition = SysDummyInputsPositions[keyof SysDummyInputsPositions];
946
+
947
+ declare interface SysDummyInputsPositions {
948
+ Auto: 0;
949
+ Inside: 1;
950
+ Outside: 2;
951
+ }
952
+
953
+ declare const SysDummyInputsPositions: SysDummyInputsPositions;
954
+
955
+ declare interface SysOnElement {
956
+ sys: SysProps;
957
+ }
958
+
959
+ /**
960
+ * Ability to fine-tune Tabster internal behaviour in rare cases of need.
961
+ * Normally, should not be used. A deep understanding of the intention and the effect
962
+ * is required.
963
+ */
964
+ declare interface SysProps {
965
+ /**
966
+ * Force dummy input position outside or inside of the element.
967
+ * By default (when undefined), the position is determined dynamically
968
+ * (for example inside for <li> elements and outside for <table> elements,
969
+ * plus a default Groupper/Mover/Modalizer implementation position).
970
+ * Setting to true will force the dummy inputs to be always outside of the element,
971
+ * setting to false will force the dummy inputs to be always inside.
972
+ */
973
+ dummyInputsPosition?: SysDummyInputsPosition;
974
+ }
975
+
976
+ declare interface Tabster {
977
+ keyboardNavigation: KeyboardNavigationState;
978
+ focusedElement: FocusedElementState;
979
+ focusable: FocusableAPI;
980
+ root: RootAPI;
981
+ uncontrolled: UncontrolledAPI;
982
+ /** @internal */
983
+ core: TabsterCore;
984
+ }
985
+
986
+ /**
987
+ * WARNING! ATTENTION! WARNING! ATTENTION! WARNING! ATTENTION!
988
+ * WARNING! ATTENTION! WARNING! ATTENTION! WARNING! ATTENTION!
989
+ *
990
+ * Do not use anything from this file. It is a snapshot of the older Tabster typings exposed by a mistake.
991
+ * The exposed typings should have been removed, but we don't do it in minor versions to avoid breaking changes.
992
+ * Everything reexported from this file as react-tabster/TabsterTypes is marked as deprecated and shouldn't
993
+ * be used anywhre.
994
+ *
995
+ * WARNING! ATTENTION! WARNING! ATTENTION! WARNING! ATTENTION!
996
+ * WARNING! ATTENTION! WARNING! ATTENTION! WARNING! ATTENTION!
997
+ */
998
+ declare const TabsterAttributeName = "data-tabster";
999
+
1000
+ declare interface TabsterAttributeOnElement {
1001
+ string: string;
1002
+ object: TabsterAttributeProps;
1003
+ }
1004
+
1005
+ declare type TabsterAttributeProps = Partial<{
1006
+ deloser: DeloserProps;
1007
+ root: RootProps;
1008
+ uncontrolled: UncontrolledProps;
1009
+ modalizer: ModalizerProps;
1010
+ focusable: FocusableProps;
1011
+ groupper: GroupperProps;
1012
+ mover: MoverProps;
1013
+ observed: ObservedElementProps;
1014
+ outline: OutlinedElementProps;
1015
+ sys: SysProps;
1016
+ restorer: RestorerProps;
1017
+ }>;
1018
+
1019
+ declare interface TabsterAugmentedAttributes {
1020
+ [name: string]: string | null;
1021
+ }
1022
+
1023
+ declare interface TabsterCompat {
1024
+ attributeTransform?: <P>(old: P) => TabsterAttributeProps;
1025
+ }
1026
+
1027
+ declare interface TabsterContext {
1028
+ root: Root;
1029
+ modalizer?: Modalizer;
1030
+ groupper?: Groupper;
1031
+ mover?: Mover;
1032
+ groupperBeforeMover?: boolean;
1033
+ modalizerInGroupper?: Groupper;
1034
+ /**
1035
+ * Whether `dir='rtl'` is set on an ancestor
1036
+ */
1037
+ rtl?: boolean;
1038
+ excludedFromMover?: boolean;
1039
+ uncontrolled?: HTMLElement | null;
1040
+ ignoreKeydown: (e: KeyboardEvent) => boolean;
1041
+ }
1042
+
1043
+ declare type TabsterContextMoverGroupper = {
1044
+ isMover: true;
1045
+ mover: Mover;
1046
+ } | {
1047
+ isMover: false;
1048
+ groupper: Groupper;
1049
+ };
1050
+
1051
+ declare interface TabsterCore extends Pick<TabsterCoreProps, 'controlTab' | 'rootDummyInputs'>, Disposable, TabsterCoreInternal, Omit<Tabster, 'core'> {
1052
+ }
1053
+
1054
+ declare interface TabsterCoreInternal {
1055
+ /** @internal */
1056
+ groupper?: GroupperAPI;
1057
+ /** @internal */
1058
+ mover?: MoverAPI;
1059
+ /** @internal */
1060
+ outline?: OutlineAPI;
1061
+ /** @internal */
1062
+ deloser?: DeloserAPI;
1063
+ /** @internal */
1064
+ modalizer?: ModalizerAPI;
1065
+ /** @internal */
1066
+ observedElement?: ObservedElementAPI;
1067
+ /** @internal */
1068
+ crossOrigin?: CrossOriginAPI;
1069
+ /** @internal */
1070
+ internal: InternalAPI;
1071
+ /** @internal */
1072
+ restorer?: RestorerAPI;
1073
+ /** @internal */
1074
+ _dummyObserver: DummyInputObserver;
1075
+ /** @internal */
1076
+ _version: string;
1077
+ /** @internal */
1078
+ _noop: boolean;
1079
+ /** @internal */
1080
+ storageEntry(element: HTMLElement, addremove?: boolean): TabsterElementStorageEntry | undefined;
1081
+ /** @internal */
1082
+ getWindow: GetWindow;
1083
+ /** @internal */
1084
+ createTabster(noRefCount?: boolean, props?: TabsterCoreProps): Tabster;
1085
+ /** @internal */
1086
+ disposeTabster(wrapper: Tabster, allInstances?: boolean): void;
1087
+ /** @internal */
1088
+ forceCleanup(): void;
1089
+ /** @internal */
1090
+ queueInit(callback: () => void): void;
1091
+ /** @internal */
1092
+ drainInitQueue(): void;
1093
+ /** @internal */
1094
+ getParent: (el: Node) => Node | null;
1095
+ }
1096
+
1097
+ declare interface TabsterCoreProps {
1098
+ autoRoot?: RootProps;
1099
+ /**
1100
+ * Allows all tab key presses under the tabster root to be controlled by tabster
1101
+ * @default true
1102
+ */
1103
+ controlTab?: boolean;
1104
+ /**
1105
+ * When controlTab is false, Root doesn't have dummy inputs by default.
1106
+ * This option allows to enable dummy inputs on Root.
1107
+ */
1108
+ rootDummyInputs?: boolean;
1109
+ /**
1110
+ * A callback that will be called for the uncontrolled areas when Tabster wants
1111
+ * to know is the uncontrolled element wants complete control (for example it
1112
+ * is trapping focus) and Tabster should not interfere with handling Tab.
1113
+ * If the callback returns undefined, then the default behaviour is to return
1114
+ * the uncontrolled.completely value from the element. If the callback returns
1115
+ * non-undefined value, the callback's value will dominate the element's
1116
+ * uncontrolled.completely value.
1117
+ */
1118
+ checkUncontrolledCompletely?: (element: HTMLElement, completely: boolean) => boolean | undefined;
1119
+ /**
1120
+ * @deprecated use checkUncontrolledCompletely.
1121
+ */
1122
+ checkUncontrolledTrappingFocus?: (element: HTMLElement) => boolean;
1123
+ /**
1124
+ * Custom getter for parent elements. Defaults to the default .parentElement call
1125
+ * Currently only used to detect tabster contexts
1126
+ */
1127
+ getParent?(el: Node): Node | null;
1128
+ /**
1129
+ * Ability to redefine all DOM API calls used by Tabster. For example, for
1130
+ * ShadowDOM support.
1131
+ */
1132
+ DOMAPI?: Partial<DOMAPI>;
1133
+ }
1134
+
1135
+ export declare type TabsterDOMAttribute = Types.TabsterDOMAttribute;
1136
+
1137
+ declare interface TabsterDOMAttribute_2 {
1138
+ [TabsterAttributeName]: string | undefined;
1139
+ }
1140
+
1141
+ declare const TabsterDummyInputAttributeName = "data-tabster-dummy";
1142
+
1143
+ declare interface TabsterElementStorage {
1144
+ [uid: string]: TabsterElementStorageEntry;
1145
+ }
1146
+
1147
+ declare interface TabsterElementStorageEntry {
1148
+ tabster?: TabsterOnElement;
1149
+ attr?: TabsterAttributeOnElement;
1150
+ aug?: TabsterAugmentedAttributes;
1151
+ }
1152
+
1153
+ declare type TabsterEventWithDetails<D> = CustomEvent<D | undefined>;
1154
+
1155
+ export { TabsterMoveFocusEvent }
1156
+
1157
+ declare type TabsterMoveFocusEvent_2 = TabsterEventWithDetails<TabsterMoveFocusEventDetails>;
1158
+
1159
+ export declare type TabsterMoveFocusEventDetail = EventsTypes.TabsterMoveFocusEventDetail;
1160
+
1161
+ declare interface TabsterMoveFocusEventDetails {
1162
+ by: 'mover' | 'groupper' | 'modalizer' | 'root';
1163
+ owner: HTMLElement;
1164
+ next: HTMLElement | null;
1165
+ relatedEvent?: KeyboardEvent;
1166
+ }
1167
+
1168
+ export { TabsterMoveFocusEventName }
1169
+
1170
+ declare type TabsterOnElement = Partial<RootOnElement & DeloserOnElement & ModalizerOnElement & FocusableOnElement & MoverOnElement & GroupperOnElement & ObservedOnElement & OutlineOnElement & UncontrolledOnElement & SysOnElement & RestorerOnElement>;
1171
+
1172
+ declare interface TabsterPart<P> {
1173
+ readonly id: string;
1174
+ getElement(): HTMLElement | undefined;
1175
+ getProps(): P;
1176
+ setProps(props: P): void;
1177
+ }
1178
+
1179
+ declare interface TabsterPartWithAcceptElement {
1180
+ acceptElement(element: HTMLElement, state: FocusableAcceptElementState): number | undefined;
1181
+ }
1182
+
1183
+ declare interface TabsterPartWithFindNextTabbable {
1184
+ findNextTabbable(current?: HTMLElement, reference?: HTMLElement, isBackward?: boolean, ignoreAccessibility?: boolean): NextTabbable | null;
1185
+ }
1186
+
1187
+ declare namespace TabsterTypes {
1188
+ export {
1189
+ TabsterAttributeName,
1190
+ TabsterDummyInputAttributeName,
1191
+ DeloserEventName,
1192
+ ModalizerActiveEventName,
1193
+ ModalizerInactiveEventName,
1194
+ ModalizerFocusInEventName,
1195
+ ModalizerFocusOutEventName,
1196
+ ModalizerBeforeFocusOutEventName,
1197
+ MoverEventName,
1198
+ FocusInEventName,
1199
+ FocusOutEventName,
1200
+ MoveFocusEventName,
1201
+ MoverMoveFocusEventName_2 as MoverMoveFocusEventName,
1202
+ GroupperMoveFocusEventName_2 as GroupperMoveFocusEventName,
1203
+ FocusableSelector,
1204
+ MoverMoveFocusEvent_2 as MoverMoveFocusEvent,
1205
+ GroupperMoveFocusActions_2 as GroupperMoveFocusActions,
1206
+ GroupperMoveFocusAction,
1207
+ GroupperMoveFocusEvent_2 as GroupperMoveFocusEvent,
1208
+ TabsterEventWithDetails,
1209
+ TabsterMoveFocusEventDetails,
1210
+ TabsterMoveFocusEvent_2 as TabsterMoveFocusEvent,
1211
+ TabsterDOMAttribute_2 as TabsterDOMAttribute,
1212
+ TabsterCoreProps,
1213
+ DOMAPI,
1214
+ GetTabster,
1215
+ GetWindow,
1216
+ SubscribableCallback,
1217
+ Disposable,
1218
+ Subscribable,
1219
+ KeyboardNavigationState,
1220
+ FocusedElementDetails,
1221
+ FocusedElementState,
1222
+ WeakHTMLElement,
1223
+ TabsterPart,
1224
+ TabsterPartWithFindNextTabbable,
1225
+ TabsterPartWithAcceptElement,
1226
+ ObservedElementProps,
1227
+ ObservedElementDetails,
1228
+ ObservedElementAccesibilities,
1229
+ ObservedElementAccesibility,
1230
+ ObservedElementAsyncRequest,
1231
+ ObservedElementAPI,
1232
+ CrossOriginElement,
1233
+ CrossOriginSentTo,
1234
+ CrossOriginTransactionTypes,
1235
+ CrossOriginTransactionType,
1236
+ CrossOriginTransactionData,
1237
+ CrossOriginTransactionSend,
1238
+ CrossOriginMessage,
1239
+ CrossOriginFocusedElementState,
1240
+ CrossOriginObservedElementState,
1241
+ CrossOriginAPI,
1242
+ OutlineProps,
1243
+ OutlinedElementProps,
1244
+ OutlineAPI,
1245
+ DeloserElementActions,
1246
+ RestoreFocusOrders,
1247
+ RestoreFocusOrder,
1248
+ DeloserProps,
1249
+ Deloser,
1250
+ DeloserConstructor,
1251
+ DeloserAPI,
1252
+ FocusableProps,
1253
+ FocusableAcceptElementState,
1254
+ FindFocusableProps,
1255
+ FindFocusableOutputProps,
1256
+ FindFirstProps,
1257
+ FindNextProps,
1258
+ FindDefaultProps,
1259
+ FindAllProps,
1260
+ FindElementCallback,
1261
+ FocusableAPI,
1262
+ DummyInputManager,
1263
+ Visibilities,
1264
+ Visibility,
1265
+ MoverElementState,
1266
+ MoverDirections,
1267
+ RestorerTypes,
1268
+ RestorerType,
1269
+ MoverDirection,
1270
+ NextTabbable,
1271
+ MoverProps,
1272
+ MoverEvent,
1273
+ Mover,
1274
+ MoverConstructor,
1275
+ MoverKeys_2 as MoverKeys,
1276
+ MoverKey,
1277
+ MoverAPI,
1278
+ GroupperTabbabilities,
1279
+ GroupperTabbability,
1280
+ GroupperProps,
1281
+ Groupper,
1282
+ GroupperConstructor,
1283
+ GroupperAPIInternal,
1284
+ GroupperAPI,
1285
+ ModalizerProps,
1286
+ ModalizerEventName,
1287
+ ModalizerEventDetails,
1288
+ ModalizerEvent,
1289
+ Modalizer,
1290
+ ModalizerConstructor,
1291
+ RootProps,
1292
+ Root,
1293
+ RootConstructor,
1294
+ SysDummyInputsPositions,
1295
+ SysDummyInputsPosition,
1296
+ SysProps,
1297
+ GetTabsterContextOptions,
1298
+ TabsterContextMoverGroupper,
1299
+ TabsterContext,
1300
+ RootFocusEventDetails,
1301
+ RootAPI,
1302
+ UncontrolledAPI,
1303
+ ModalizerAPI,
1304
+ RestorerAPI,
1305
+ Restorer,
1306
+ ModalizerElementAccessibleCheck,
1307
+ UncontrolledProps,
1308
+ DeloserOnElement,
1309
+ RootOnElement,
1310
+ ModalizerOnElement,
1311
+ RestorerOnElement,
1312
+ FocusableOnElement,
1313
+ MoverOnElement,
1314
+ GroupperOnElement,
1315
+ UncontrolledOnElement,
1316
+ ObservedOnElement,
1317
+ OutlineOnElement,
1318
+ SysOnElement,
1319
+ RestorerProps,
1320
+ TabsterAttributeProps,
1321
+ TabsterAttributeOnElement,
1322
+ TabsterAugmentedAttributes,
1323
+ TabsterOnElement,
1324
+ OutlineElements,
1325
+ TabsterElementStorageEntry,
1326
+ TabsterElementStorage,
1327
+ DisposeFunc,
1328
+ InternalAPI,
1329
+ DummyInputObserver,
1330
+ Tabster,
1331
+ TabsterCore,
1332
+ TabsterCompat
1333
+ }
1334
+ }
1335
+ export { TabsterTypes }
1336
+
1337
+ declare interface UncontrolledAPI {
1338
+ isUncontrolledCompletely(element: HTMLElement, completely: boolean): boolean;
1339
+ }
1340
+
1341
+ declare interface UncontrolledOnElement {
1342
+ uncontrolled: UncontrolledProps;
1343
+ }
1344
+
1345
+ declare interface UncontrolledProps {
1346
+ completely?: boolean;
1347
+ }
1348
+
1349
+ /**
1350
+ * Returns a function that activates a modal by element from the modal or modal container.
1351
+ */
1352
+ export declare function useActivateModal(): (elementFromModal: HTMLElement | undefined) => void;
1353
+
1354
+ /**
1355
+ * A hook that returns the necessary tabster attributes to support arrow key navigation
1356
+ * @param options - Options to configure keyboard navigation
1357
+ */
1358
+ export declare const useArrowNavigationGroup: (options?: UseArrowNavigationGroupOptions) => Types.TabsterDOMAttribute;
1359
+
1360
+ export declare interface UseArrowNavigationGroupOptions {
1361
+ /**
1362
+ * Focus will navigate vertically, horizontally or in both directions (grid), defaults to horizontally
1363
+ * @defaultValue vertical
1364
+ */
1365
+ axis?: 'vertical' | 'horizontal' | 'grid' | 'grid-linear' | 'both';
1366
+ /**
1367
+ * Focus will cycle to the first/last elements of the group without stopping
1368
+ */
1369
+ circular?: boolean;
1370
+ /**
1371
+ * Last focused element in the group will be remembered and focused (if still
1372
+ * available) when tabbing from outside of the group
1373
+ * @default true
1374
+ */
1375
+ memorizeCurrent?: boolean;
1376
+ /**
1377
+ * Allow tabbing within the arrow navigation group items.
1378
+ */
1379
+ tabbable?: boolean;
1380
+ /**
1381
+ * Tabster should ignore default handling of keydown events
1382
+ */
1383
+ ignoreDefaultKeydown?: Types.FocusableProps['ignoreKeydown'];
1384
+ /**
1385
+ * The default focusable item in the group will be an element with Focusable.isDefault property.
1386
+ * Note that there is no way in \@fluentui/react-tabster to set default focusable element,
1387
+ * and this option is currently for internal testing purposes only.
1388
+ */
1389
+ unstable_hasDefault?: boolean;
1390
+ }
1391
+
1392
+ /**
1393
+ * !!DANGEROUS!! Designates an element that will not be hidden even when outside an open modal.
1394
+ * Only works for top-level elements; should be used with extreme care.
1395
+ *
1396
+ * @returns Attribute to apply to the target element that should never receive aria-hidden
1397
+ */
1398
+ export declare function useDangerousNeverHidden_unstable(): {
1399
+ [key: string]: string;
1400
+ };
1401
+
1402
+ /**
1403
+ * A hook that returns the necessary tabster attributes to support groupping.
1404
+ * @param options - Options to configure keyboard navigation
1405
+ */
1406
+ export declare const useFocusableGroup: (options?: UseFocusableGroupOptions) => Types.TabsterDOMAttribute;
1407
+
1408
+ export declare interface UseFocusableGroupOptions {
1409
+ /**
1410
+ * Behavior for the Tab key.
1411
+ */
1412
+ tabBehavior?: 'unlimited' | 'limited' | 'limited-trap-focus';
1413
+ /**
1414
+ * Tabster can ignore default handling of keydown events
1415
+ */
1416
+ ignoreDefaultKeydown?: Types.FocusableProps['ignoreKeydown'];
1417
+ }
1418
+
1419
+ /**
1420
+ * Subscribes to the tabster focused element. Calls the callback when the focused element changes.
1421
+ * @param callback - Callback to subscribe to the focused element.
1422
+ */
1423
+ export declare function useFocusedElementChange(callback: Types.SubscribableCallback<HTMLElement | undefined, Types.FocusedElementDetail>): void;
1424
+
1425
+ /**
1426
+ * Returns a set of helper functions that will traverse focusable elements in the context of a root DOM element
1427
+ */
1428
+ export declare const useFocusFinders: () => {
1429
+ findAllFocusable: (container: HTMLElement | null, acceptCondition?: (el: HTMLElement) => boolean) => HTMLElement[];
1430
+ findFirstFocusable: (container: HTMLElement | null) => HTMLElement | null | undefined;
1431
+ findLastFocusable: (container: HTMLElement | null) => HTMLElement | null | undefined;
1432
+ findNextFocusable: (currentElement: HTMLElement | null, options?: {
1433
+ container?: HTMLElement;
1434
+ }) => HTMLElement | null | undefined;
1435
+ findPrevFocusable: (currentElement: HTMLElement | null, options?: {
1436
+ container?: HTMLElement;
1437
+ }) => HTMLElement | null | undefined;
1438
+ };
1439
+
1440
+ /**
1441
+ * @param name - The observed element to focus
1442
+ * @param options - Options for the focus observed
1443
+ *
1444
+ * @returns Function that will focus an element
1445
+ */
1446
+ export declare function useFocusObserved(name: string, options?: UseFocusObservedOptions): () => Types.ObservedElementAsyncRequest<boolean>;
1447
+
1448
+ declare interface UseFocusObservedOptions {
1449
+ /**
1450
+ * After timeout the focus attempt fails
1451
+ */
1452
+ timeout?: number;
1453
+ }
1454
+
1455
+ export declare function useFocusVisible<TElement extends HTMLElement = HTMLElement>(options?: UseFocusVisibleOptions): React_2.RefObject<TElement | null>;
1456
+
1457
+ declare type UseFocusVisibleOptions = {
1458
+ targetDocument?: Document;
1459
+ };
1460
+
1461
+ /**
1462
+ * A ponyfill that allows `:focus-within` to support visibility based on keyboard/mouse navigation
1463
+ * like `:focus-visible` https://github.com/WICG/focus-visible/issues/151
1464
+ * @returns ref to the element that uses `:focus-within` styles
1465
+ */
1466
+ export declare function useFocusWithin<TElement extends HTMLElement = HTMLElement>(): React_2.RefObject<TElement | null>;
1467
+
1468
+ /**
1469
+ * Instantiates [keyborg](https://github.com/microsoft/keyborg) and checks if the user is navigating with the keyboard.
1470
+ * @returns
1471
+ */
1472
+ export declare function useIsNavigatingWithKeyboard(): () => boolean;
1473
+
1474
+ /**
1475
+ * Instantiates [keyborg](https://github.com/microsoft/keyborg) and adds `data-keyboard-nav`
1476
+ * attribute to a referenced element to ensure keyboard navigation awareness
1477
+ * synced to keyborg logic without having to cause a re-render on react tree.
1478
+ */
1479
+ export declare function useKeyboardNavAttribute<E extends HTMLElement>(): React_2.RefObject<E | null>;
1480
+
1481
+ /**
1482
+ * Merges a collection of tabster attributes.
1483
+ *
1484
+ * The result is memoized and only recomputed when the contributing attributes
1485
+ * actually change, so both the values and the number of attributes may change
1486
+ * at runtime.
1487
+ * @internal
1488
+ * @param attributes - collection of tabster attributes from other react-tabster hooks
1489
+ * @returns single merged tabster attribute
1490
+ */
1491
+ export declare const useMergedTabsterAttributes_unstable: (...attributes: (Partial<Types.TabsterDOMAttribute> | null | undefined)[]) => Types.TabsterDOMAttribute;
1492
+
1493
+ /**
1494
+ * Applies modal dialog behaviour through DOM attributes
1495
+ * Modal element will focus trap and hide other content on the page
1496
+ * The trigger element will be focused if focus is lost after the modal element is removed
1497
+ *
1498
+ * @returns DOM attributes to apply to the modal element and its trigger
1499
+ */
1500
+ export declare const useModalAttributes: (options?: UseModalAttributesOptions) => {
1501
+ modalAttributes: Types.TabsterDOMAttribute;
1502
+ triggerAttributes: Types.TabsterDOMAttribute;
1503
+ };
1504
+
1505
+ export declare interface UseModalAttributesOptions {
1506
+ /**
1507
+ * Traps focus inside the elements the attributes are applied.
1508
+ * it forbids users to tab out of the focus trap into the actual browser.
1509
+ */
1510
+ trapFocus?: boolean;
1511
+ /**
1512
+ * Traps focus inside the elements the attributes are applied.
1513
+ * This prop enables traditional force-focus behavior to match previous versions of Fluent.
1514
+ * Without this, users can tab out of the focus trap and into the browser chrome.
1515
+ * This matches the behavior of the native <dialog> element and inert.
1516
+ * We recommend setting this to true based on user feedback and consistency.
1517
+ */
1518
+ legacyTrapFocus?: boolean;
1519
+ /**
1520
+ * Always reachabled in Tab order
1521
+ */
1522
+ alwaysFocusable?: boolean;
1523
+ /**
1524
+ * Id to use for the modalizer. An id will be generated if not provided.
1525
+ */
1526
+ id?: string;
1527
+ }
1528
+
1529
+ export declare function useObservedElement(name: string | string[]): Types.TabsterDOMAttribute;
1530
+
1531
+ /**
1532
+ * Instantiates [keyborg](https://github.com/microsoft/keyborg) and subscribes to changes
1533
+ * in the keyboard navigation mode.
1534
+ *
1535
+ * @param callback - called every time the keyboard navigation state changes
1536
+ */
1537
+ export declare function useOnKeyboardNavigationChange(callback: (isNavigatingWithKeyboard: boolean) => void): void;
1538
+
1539
+ /**
1540
+ * Focus will be restored to the most recent target element when it is lost from a source
1541
+ * @returns Attribute to apply to the element that might lose focus
1542
+ */
1543
+ export declare function useRestoreFocusSource(): Types.TabsterDOMAttribute;
1544
+
1545
+ /**
1546
+ * Focus will be restored to the most recent target element when it is lost from a source
1547
+ * @returns Attribute to apply to the target element where focus is restored
1548
+ */
1549
+ export declare function useRestoreFocusTarget(): Types.TabsterDOMAttribute;
1550
+
1551
+ /**
1552
+ */
1553
+ export declare function useSetKeyboardNavigation(): (isNavigatingWithKeyboard: boolean) => void;
1554
+
1555
+ /**
1556
+ * Hook that returns tabster attributes while ensuring tabster exists
1557
+ *
1558
+ * @internal
1559
+ */
1560
+ export declare const useTabsterAttributes: (props: Types.TabsterAttributeProps) => Types.TabsterDOMAttribute;
1561
+
1562
+ /**
1563
+ * Designates an area where tabster does not control focus
1564
+ * @returns Attribute to apply to the target element that should be uncontrolled by tabster
1565
+ */
1566
+ export declare function useUncontrolledFocus(): Types.TabsterDOMAttribute;
1567
+
1568
+ declare interface Visibilities {
1569
+ Invisible: 0;
1570
+ PartiallyVisible: 1;
1571
+ Visible: 2;
1572
+ }
1573
+
1574
+ declare const Visibilities: Visibilities;
1575
+
1576
+ declare type Visibility = Visibilities[keyof Visibilities];
1577
+
1578
+ declare interface WeakHTMLElement<D = undefined> {
1579
+ get(): HTMLElement | undefined;
1580
+ getData(): D | undefined;
1581
+ }
1582
+
1583
+ export { }