import { MutableRefObject } from "react"; /** * A function that will return the resize observer target element. This should * return an HTMLElement or null. */ declare type GetTarget = () => E | null; declare type RefTarget = MutableRefObject; /** * The target element for the resize obsever. This can be one of: * * - null * - HTMLElement * - a document.querySelector string * - a ref with { current: null | HTMLElement } * - a function that returns * - null * - HTMLElement * * Whenever the target is resolved as `null`, the observer will be disabled. */ export declare type ResizeObserverTarget = null | HTMLElement | string | RefTarget | GetTarget; /** * A utility function to get the current resize observer element. * * @private */ export declare function getResizeObserverTarget(target: ResizeObserverTarget): HTMLElement | null; /** * * @private */ export declare function isHeightChange(prevSize: ElementSize | undefined, nextSize: ElementSize): boolean; /** * * @private */ export declare function isWidthChange(prevSize: ElementSize | undefined, nextSize: ElementSize): boolean; interface ElementSize { /** * The height for the element that was changed. */ height: number; /** * The width for the element that was changed. */ width: number; /** * The scroll height for the element that was changed. */ scrollHeight: number; /** * The scroll height for the element that was changed. */ scrollWidth: number; } /** * The data that is provided whenever an observed element changes size. */ export interface ObservedResizeData extends ElementSize { /** * The element that was changed due to an observered resize event. */ element: HTMLElement; } /** * A type that can be used to strongly type a callback function for a resize * observe onResize function. It's really just a wrapper for the main * `ObserverableResizeEvent` */ export declare type ObservedResizeEventHandler = (event: ObservedResizeData) => void; export interface ResizeObserverOptions { target: ResizeObserverTarget; onResize: ObservedResizeEventHandler; disableHeight?: boolean; disableWidth?: boolean; } /** * A hook that is used to trigger esize events when a target element is resized * via CSS or other changes. * * @param options The resize observer options. */ export default function useResizeObserver({ disableHeight, disableWidth, onResize, target, }: ResizeObserverOptions): void; export {};