import type { DependencyList, RefObject } from 'react'; import type { ElementTarget } from "../use-target-element/index.js"; export interface UseAdaptiveTextareaOptions { /** * a list of dependencies to trigger the resize * * @defaultValue [] */ watch?: DependencyList; /** * a list of events to trigger the resize * * @defaultValue ['input'] */ events?: (keyof HTMLElementEventMap)[]; /** * whether to automatically adjust the height of the `textarea` element * * @defaultValue true */ autoHeight?: boolean; /** * a target element to apply the height style * * @defaultValue undefined */ styleTarget?: ElementTarget; /** * a style property to apply the height value * * @defaultValue 'height' */ styleProp?: 'height' | 'minHeight'; /** * a callback function to be called when the height of the `textarea` element changes * * @defaultValue undefined */ onResize?: (height: number, prevHeight: number) => void; } export interface UseAdaptiveTextareaReturns { /** * a React ref that should be passed to the `textarea` element */ ref: RefObject; /** * the current height of the `textarea` element */ height: number; /** * a function to manually resize the `textarea` element * * @returns {void} `void` */ resize(): void; } /** * A React Hook that helps to create **adaptive** textarea that automatically adjust height based on its content. * * @param {UseAdaptiveTextareaOptions} options - `UseAdaptiveTextareaOptions`, see {@link UseAdaptiveTextareaOptions} * @returns {UseAdaptiveTextareaReturns} `UseAdaptiveTextareaReturns`, see {@link UseAdaptiveTextareaReturns} */ export declare function useAdaptiveTextarea(options?: UseAdaptiveTextareaOptions): UseAdaptiveTextareaReturns;