1 | import { ResizeObserverEntry } from "@juggle/resize-observer";
|
2 | import * as React from "react";
|
3 | import { AbstractPureComponent2 } from "../../common";
|
4 | export declare type ResizeSensorProps = IResizeSensorProps;
|
5 | /** @deprecated use ResizeSensorProps */
|
6 | export interface IResizeSensorProps {
|
7 | /** Contents to observe for size changes. */
|
8 | children: React.ReactNode;
|
9 | /**
|
10 | * Callback invoked when the wrapped element resizes.
|
11 | *
|
12 | * The `entries` array contains an entry for each observed element. In the
|
13 | * default case (no `observeParents`), the array will contain only one
|
14 | * element: the single child of the `ResizeSensor`.
|
15 | *
|
16 | * Note that this method is called _asynchronously_ after a resize is
|
17 | * detected and typically it will be called no more than once per frame.
|
18 | */
|
19 | onResize: (entries: ResizeObserverEntry[]) => void;
|
20 | /**
|
21 | * If `true`, all parent DOM elements of the container will also be
|
22 | * observed for size changes. The array of entries passed to `onResize`
|
23 | * will now contain an entry for each parent element up to the root of the
|
24 | * document.
|
25 | *
|
26 | * Only enable this prop if a parent element resizes in a way that does
|
27 | * not also cause the child element to resize.
|
28 | *
|
29 | * @default false
|
30 | */
|
31 | observeParents?: boolean;
|
32 | }
|
33 | /**
|
34 | * Resize sensor component.
|
35 | *
|
36 | * It requires a single DOM element child and will error otherwise.
|
37 | *
|
38 | * @see https://blueprintjs.com/docs/#core/components/resize-sensor
|
39 | **/
|
40 | export declare class ResizeSensor extends AbstractPureComponent2<ResizeSensorProps> {
|
41 | static displayName: string;
|
42 | private element;
|
43 | private observer;
|
44 | render(): React.ReactNode;
|
45 | componentDidMount(): void;
|
46 | componentDidUpdate(prevProps: ResizeSensorProps): void;
|
47 | componentWillUnmount(): void;
|
48 | /**
|
49 | * Observe the DOM element, if defined and different from the currently
|
50 | * observed element. Pass `force` argument to skip element checks and always
|
51 | * re-observe.
|
52 | */
|
53 | private observeElement;
|
54 | private getElement;
|
55 | }
|