1 | /// <reference types="react" />
|
2 | export declare function elementIsOrContains(element: HTMLElement, testElement: HTMLElement): boolean;
|
3 | /**
|
4 | * Checks whether the given element is inside something that looks like a text input.
|
5 | * This is particularly useful to determine if a keyboard event inside this element should take priority over hotkey
|
6 | * bindings / keyboard shortcut handlers.
|
7 | *
|
8 | * @returns true if the element is inside a text input
|
9 | */
|
10 | export declare function elementIsTextInput(elem: HTMLElement): boolean;
|
11 | /**
|
12 | * Gets the active element in the document or shadow root (if an element is provided, and it's in the shadow DOM).
|
13 | */
|
14 | export declare function getActiveElement(element?: HTMLElement | null, options?: GetRootNodeOptions): Element | null;
|
15 | /**
|
16 | * Throttle an event on an EventTarget by wrapping it in a
|
17 | * `requestAnimationFrame` call. Returns the event handler that was bound to
|
18 | * given eventName so you can clean up after yourself.
|
19 | *
|
20 | * @see https://developer.mozilla.org/en-US/docs/Web/Events/scroll
|
21 | */
|
22 | export declare function throttleEvent(target: EventTarget, eventName: string, newEventName: string): (event: Event) => void;
|
23 | export interface ThrottledReactEventOptions {
|
24 | preventDefault?: boolean;
|
25 | }
|
26 | /**
|
27 | * Throttle a callback by wrapping it in a `requestAnimationFrame` call. Returns
|
28 | * the throttled function.
|
29 | *
|
30 | * @see https://www.html5rocks.com/en/tutorials/speed/animations/
|
31 | */
|
32 | export declare function throttleReactEventCallback<E extends React.SyntheticEvent = React.SyntheticEvent>(callback: (event: E, ...otherArgs: any[]) => any, options?: ThrottledReactEventOptions): (event2: E) => void;
|
33 | /**
|
34 | * Throttle a method by wrapping it in a `requestAnimationFrame` call. Returns
|
35 | * the throttled function.
|
36 | */
|
37 | export declare function throttle<T extends Function>(method: T): T;
|
38 | export declare function clickElementOnKeyPress(keys: string[]): (e: React.KeyboardEvent) => boolean;
|