"use client"; import cx from "classnames"; import React from "react"; import { useStatic } from "../../utils/hooks"; import { buildCountdownConfig, defaultCountdownLabels, getAriaLive, getLabelText, normalizeUnits, } from "./Countdown.react"; import type { CountdownConfig, CountdownLabels, CountdownUnit, } from "./Countdown.static"; import CountdownStatic, { countdownUnits } from "./Countdown.static"; import { ATTR_COUNTDOWN, ATTR_COUNTDOWN_CONFIG, ATTR_COUNTDOWN_UNIT, CLASS_ANNOUNCEMENT, CLASS_BOTTOM, CLASS_CARD, CLASS_LABEL, CLASS_LEAF_BACK, CLASS_LEAF_FRONT, CLASS_ROOT, CLASS_TOP, CLASS_UNIT, CLASS_VALUE, } from "./constants"; export interface CountdownProps extends Omit, "children"> { labels?: CountdownLabels; targetDate: string; units?: CountdownUnit[]; } const Countdown: React.FC = ({ className, labels, targetDate, units = [...countdownUnits], ...other }) => { const normalizedUnits = normalizeUnits(units); const config: CountdownConfig = buildCountdownConfig( targetDate, normalizedUnits, labels, ); const [elementRef] = useStatic(CountdownStatic, config); return (
{normalizedUnits.map((unit) => ( ))}
); }; Countdown.displayName = "Countdown"; export type { CountdownLabels, CountdownUnit }; export { Countdown, countdownUnits };