import * as React from "react";
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "~/components/ui/icons/vendor";
import { DayButton, getDefaultClassNames } from "react-day-picker";
import { useTranslation } from "react-i18next";
import { cn } from "~/lib/utils";
import { Button, buttonVariants } from "~/components/ui/button";
import { getDateFnsLocale } from "~/locale/date-fns";
import { Calendar as SubframeCalendar } from "~/ui/components/Calendar";
import { APP_TIME_ZONE } from "~/locale/format";
// Subframe migration (strangler shim):
// This file keeps the original shadcn `Calendar` API but renders the Subframe design-system
// Calendar as the underlying view. Subframe's Calendar is a thin wrapper over the SAME
// `react-day-picker` `DayPicker` (identical `DayPickerProps`), so all functionality the
// call-sites rely on — `mode` single/range, controlled `selected`/`onSelect`,
// `month`/`onMonthChange`, `fromYear`/`toYear`, `captionLayout="dropdown"`, `required`,
// `disabled` — is preserved by passing the same props through.
//
// The shadcn-specific behavior NOT provided by Subframe is retained here:
// - i18n locale default (via `useTranslation` + `getDateFnsLocale`) — call-sites don't
// pass `locale`; they rely on it,
// - localized month-dropdown formatter,
// - the full `classNames` styling and `components` (incl. the `CalendarDayButton`),
// - the `buttonVariant` prop and the `buttonVariants` consumer contract.
//
// Subframe's Calendar injects its own `Chevron` component and a wrapping `