export interface UseCountUpOptions { /** Target value the animation lands on. */ to: number; /** Starting value. Defaults to 0. */ from?: number; /** Duration in milliseconds. Defaults to 1600. */ durationMs?: number; /** * Attach an `IntersectionObserver` to the ref and only start the * animation when the element first crosses the visibility threshold. * Defaults to `true`. Set to `false` to start immediately on mount. */ startOnVisible?: boolean; /** * When `true`, every out-of-view → in-view transition resets to * `from` and re-plays the animation. Defaults to `false` — the * default is "animate once per element per session", matching the * booking-website hero use-case. */ retriggerOnReEntry?: boolean; /** BCP 47 locale. Falls back to `navigator.language` then `'en'`. */ locale?: string; /** * Override the locale's default thousand / decimal glyphs. When set, * the hook builds a custom formatter on top of `Intl.NumberFormat` * via `formatToParts`. Pass partial overrides — `decimal` alone is * valid; the unspecified separator stays at the locale default. */ separators?: { thousand?: string; decimal?: string; }; /** * Full override — when provided, the hook bypasses * `Intl.NumberFormat` and runs every frame's numeric value through * this function instead. Highest precedence; `locale` and * `separators` are ignored for the duration of the animation. The * sign is part of the number passed in. */ formatter?: (n: number) => string; /** * Forces the reduced-motion branch on. Defaults to reading * `prefers-reduced-motion: reduce` via `window.matchMedia`. Useful * for unit tests and for callers that already track motion * preferences upstream. */ reduceMotion?: boolean; } export interface UseCountUpReturn { /** * Ref callback. Attach to the element that should trigger the * animation on viewport entry. Passing `null` (unmounting) cleans * up the IntersectionObserver. */ ref: (el: HTMLElement | null) => void; /** Formatted current frame value. */ value: string; /** `true` after the animation lands on `to`. */ done: boolean; /** * Manually start the animation. Useful when `startOnVisible` is * `false` or when re-playing is gated on a non-viewport event. */ start: () => void; /** Reset to `from`; the next `start` (or visibility entry) re-plays. */ reset: () => void; } /** * Animate a number from `from` to `to` over `durationMs`, optionally * gated on viewport entry. Uses raw `requestAnimationFrame` + an * `IntersectionObserver`, no third-party dependency. * * SSR-safe — the first render (server + client first-paint) returns the * final formatted value. The IntersectionObserver and the rAF loop are * attached inside `useEffect` so SSR markup matches client first-paint * and hydration never observes the `from` value. * * Reduced motion — when `prefers-reduced-motion: reduce` is active (or * `reduceMotion: true` is passed) the hook short-circuits to the final * value on first paint and never attaches the observer. Honoured even * when `retriggerOnReEntry` is set. * * Direction & negatives — the hook animates from `from` to `to` * whichever direction that is. `to` can be negative; the sign is part * of the formatted output every frame. */ export declare function useCountUp(options: UseCountUpOptions): UseCountUpReturn; //# sourceMappingURL=use-count-up.d.ts.map