var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import { format } from "date-fns";
import React, { useEffect, useRef } from "react";
import { cl } from "../../../utils/helpers/index.js";
const DatePickerDayButton = (_a) => {
    var { day, modifiers, locale, children } = _a, rest = __rest(_a, ["day", "modifiers", "locale", "children"]);
    const ref = useRef(null);
    useEffect(() => {
        var _a;
        if (modifiers.focused) {
            (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
        }
    }, [modifiers.focused]);
    if (modifiers.hidden) {
        return null;
    }
    return (React.createElement("button", Object.assign({}, rest, { ref: ref, "aria-hidden": day.outside, "aria-pressed": !!modifiers.selected, "aria-label": format(day.date, "cccc d", {
            locale,
        }), "data-pressed": modifiers.selected, "data-today": modifiers.today || undefined, className: cl(rest.className, {
            "rdp-day_disabled": modifiers.disabled,
            "rdp-day_selected": modifiers.selected,
            "rdp-day_range_start": modifiers.range_start,
            "rdp-day_range_middle": modifiers.range_middle,
            "rdp-day_range_end": modifiers.range_end,
            "rdp-day__range-hover-middle": modifiers.hoverRange,
            "rdp-day_today": modifiers.today,
            "rdp-day_outside": modifiers.outside,
            "rdp-day__weekend": modifiers.weekend,
        }) }),
        React.createElement("div", { className: "rdp-day__inner" }, children)));
};
export { DatePickerDayButton };
//# sourceMappingURL=DatePicker.DayButton.js.map