import { type ChangeEvent, type RefObject } from 'react'; import type { Mask, MaskChangeMeta } from '@/types'; export interface UseMaskOptions { /** The mask to apply. When undefined the hook is inert. */ mask?: Mask | undefined; /** Controlled display value. */ value?: string | undefined; /** Uncontrolled initial value. */ defaultValue?: string | undefined; /** Fires with the masked value plus `raw` / `completed` / `iso` metadata. */ onValueChange?: ((value: string, meta: MaskChangeMeta) => void) | undefined; /** Ref to the element being masked. */ elementRef: RefObject; } export interface UseMaskReturn { /** Whether a mask is active. When false, nothing below should be applied. */ active: boolean; /** * Whether the element's `value` must come from this hook. * * Stays true after a mask is removed. React treats a field that stops being * given a `value` as newly uncontrolled — it warns, and leaves the last masked * text frozen on screen — so once the hook has taken the element over it keeps * it, and goes on tracking edits with the mask switched off. */ controlled: boolean; /** The masked value to render. */ value: string; /** Whether the masked value fills every block. */ completed: boolean; /** Change handler for the element. */ onChange: (event: ChangeEvent) => void; } export declare const useMask: ({ mask, value, defaultValue, onValueChange, elementRef, }: UseMaskOptions) => UseMaskReturn;