"use client" import * as React from "react" import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from "lucide-react" import { DayPicker } from "react-day-picker" import { cn } from "../utils/cn" import { buttonVariants } from "./ui/button" export type CalendarProps = React.ComponentProps /** * ODS-styled DayPicker wrapper. * * IMPORTANT: the installed react-day-picker is **v9** — the classNames keys * below are the v9 vocabulary (`weekdays`/`weekday`/`week`/`day`/`day_button`/ * `selected`/`disabled`/…). The previous v8 shadcn map (`head_row`, `cell`, * `day_selected`, …) was silently IGNORED by v9, which shipped default * browser-table chrome: misaligned weekday headers, no disabled styling, * wrapping rows on mobile. Do not reintroduce v8 keys. * * Day-cell display stays `table-cell` (only the inner `day_button` is * flex) — converting ``s to inline-flex is what made rows wrap. */ function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) { return ( button]:bg-ods-accent [&>button]:text-ods-text-on-accent [&>button]:hover:bg-ods-accent", today: "[&>button]:text-ods-accent [&[aria-selected]>button]:text-ods-text-on-accent", outside: "[&>button]:text-ods-text-muted [&>button]:opacity-50", // `cursor-not-allowed` on the CELL, not the button: the day button is a // core `Button`, whose disabled state carries `pointer-events-none`, so // a cursor set on it never applies — the pointer is over the cell. disabled: "cursor-not-allowed [&>button]:text-ods-text-muted [&>button]:opacity-40 [&>button]:hover:bg-transparent", hidden: "invisible", ...classNames, }} components={{ // v9 passes 'up'/'down' for dropdown captions too — branch all four. Chevron: ({ orientation, className: chevronClassName }) => { const cls = cn("h-4 w-4", chevronClassName) if (orientation === "right") return if (orientation === "up") return if (orientation === "down") return return }, }} {...props} /> ) } Calendar.displayName = "Calendar" export { Calendar }