import { type RefObject } from 'react'; /** * Minimum difference between the layout and the visual viewport that is treated as an opened * on-screen keyboard. Small differences come from browser UI (URL bar, toolbars) and must not * shrink the container. */ export declare const KEYBOARD_MIN_INSET = 80; export interface KeyboardViewportMetrics { /** `visualViewport.height` - height of the area not covered by the keyboard. */ viewportHeight: number; /** `visualViewport.offsetTop` - offset of the visual viewport inside the layout viewport. */ viewportOffsetTop: number; /** `visualViewport.scale` - pinch-zoom factor, `1` when the page is not zoomed. */ scale: number; /** `window.innerHeight` - layout viewport height, unaffected by the keyboard on iOS Safari. */ layoutHeight: number; /** Top of the container in layout viewport coordinates (`getBoundingClientRect().top`). */ containerTop: number; } export interface KeyboardViewportFit { /** Whether the on-screen keyboard currently covers part of the layout viewport. */ isKeyboardOpen: boolean; /** * Height limit that keeps the bottom of the container right above the keyboard. * `undefined` while the keyboard is closed - the container keeps its natural height. */ maxHeight?: number; } /** * Height limit for a container whose bottom would otherwise end up under the on-screen keyboard. * * Browsers keep the layout viewport at full height while the keyboard is open (iOS Safari always, * Chrome and Firefox since the `interactive-widget=resizes-visual` default), so `100vh` / `100dvh` / * `height: 100%` keep the original height and the bottom of the chat (prompt input, disclaimer) * stays hidden. The visible area is reported by `visualViewport` instead, and the limit is its * bottom edge measured from the top of the container. */ export declare function resolveKeyboardViewportFit(metrics: KeyboardViewportMetrics, minInset?: number): KeyboardViewportFit; /** * Tracks the on-screen keyboard through `visualViewport` and returns the height limit that keeps * the referenced container inside the visible area. * * @param containerRef - element to fit into the visual viewport * @param enabled - disables tracking (e.g. outside mobile mode) */ export declare function useKeyboardViewportFit(containerRef: RefObject, enabled?: boolean): KeyboardViewportFit;