import type { DateLike } from "../use-date-format/index.js"; import type { UseIntervalFnInterval } from "../use-interval-fn/index.js"; import type { Pausable } from "../use-pausable/index.js"; import type { Gettable } from "../utils/basic.js"; export interface UseCountdownDateItem { d: number; h: number; m: number; s: number; ms: number; } export interface UseCountdownOptions { /** * whether to start the countdown immediately * * @defaultValue true */ immediate?: boolean; /** * whether to expose the controls * * @defaultValue false */ controls?: Controls; /** * the interval to update the countdown * * @defaultValue 'requestAnimationFrame' */ interval?: UseIntervalFnInterval; /** * a callback function to be called when the countdown is updated */ onUpdate?: (ms: number, seconds: number) => void; /** * a callback function to be called when the countdown is stopped */ onStop?(): void; } export type UseCountdownReturns = Controls extends true ? { ms: number; isStop: boolean; } & Pausable : number; /** * A React Hook that provides a countdown timer. */ export declare function useCountdown(date: Gettable): UseCountdownReturns; export declare function useCountdown(date: Gettable, options: UseCountdownOptions): UseCountdownReturns; export declare function useCountdown(date: Gettable, options: UseCountdownOptions): UseCountdownReturns;