import type { ReactNode } from "react"; import type { Tone } from "../../Theme/tokens/builders/tone"; /** Which span the grid shows: a month of weeks, one week, or a single day. */ export type CalendarGridView = "month" | "week" | "day"; /** A date-granularity event; time of day is ignored. */ export type CalendarEvent = { /** Unique key; also the last tie-break when ordering events that start together. */ id: string; /** First day covered; only the date part is read. */ start: Date; /** Last day covered, inclusive. Omit for a single-day event; a value before `start` is swapped. */ end?: Date; /** Chip text; also breaks ties when ordering events that start on the same day. */ label: string; /** Status tint of the chip, same tones as Tag. Defaults to "neutral". */ tone?: Tone; /** Renders the chip as a link; without it the chip is a button that fires `onEventClick`. */ href?: string; }; /** Visible text and accessible names; every key falls back to English. */ export type CalendarGridLabels = { /** Toolbar button that moves the anchor to the current day. */ today: string; /** Accessible name of the previous-period button. */ previous: string; /** Accessible name of the next-period button. */ next: string; /** View switcher entry for the month view. */ month: string; /** View switcher entry for the week view. */ week: string; /** View switcher entry for the day view. */ day: string; /** Receives the number of hidden events, e.g. "+3 more". */ more: (count: number) => string; /** Accessible name of the "more" button, e.g. "3 more events on Tuesday, 14 October 2026". */ moreLabel: (count: number, date: string) => string; /** Follows the date in a day cell's accessible name, e.g. "3 events"; the cell's own content comes after it. */ eventCount: (count: number) => string; }; /** Props for the month/week/day event grid; fully controlled through `view` and `date`. */ export interface CalendarGridProps { /** Span shown: a month of weeks, one week or one day. */ view: CalendarGridView; /** Anchor date: any day inside the month, week or day being shown. */ date: Date; /** Events to place; multi-day events span cells and long days collapse into "+N more". */ events: CalendarEvent[]; /** Called by the toolbar's view switcher and by a cell's "+N more" button (with "day"). */ onViewChange?: (view: CalendarGridView) => void; /** Called when the anchor should move: toolbar, arrow keys leaving the visible range, Enter on a cell, "+N more". */ onDateChange?: (date: Date) => void; /** Called when an event chip is activated; link chips still navigate to `href`. */ onEventClick?: (event: CalendarEvent) => void; /** Replaces a cell's event chips (and the multi-day spanning) with your own content, under the day number. */ renderDayCell?: (date: Date, events: CalendarEvent[]) => ReactNode; /** First column of the week; defaults to 0 (Sunday). */ weekStartsOn?: 0 | 1; /** BCP 47 tag for month, weekday and date names via Intl; defaults to the runtime locale. */ locale?: string; /** Keeps the grid's shape and swaps the events for skeleton bars; sets aria-busy. */ isLoading?: boolean; /** Overrides the default English strings; unset keys keep their default. */ labels?: Partial; }