import type dayjs from "dayjs"; import type { Dayjs } from "dayjs"; export interface DatePickerOptions { /** * Base CSS Class used in datepicker elements. Default: 'bc-datepicker' */ baseClass: string; /** * Format for Day Header Text rendering. Can be 'initial', 'abbr', 'full', or an array of custom strings for each day of the week (starting with Sunday). Default: 'abbr' */ dayHeaderFormat: "initial" | "abbr" | "full" | string[]; /** * Format for Date Number Text rendering. Can be 'normal' (1, 2, 3) or 'leading-zero' (01, 02, 03). Default: 'normal' */ dateNumberFormat: "normal" | "leading-zero"; /** * Format for accessible label on date button. Use Dayjs formatting tokens. Default: 'D, dddd MMMM YYYY' */ dateLabelFormat: string; /** * Format for Month Text rendering. Can be 'num' (1, 2, 3), 'abbr' (Jan, Feb, Mar), or 'full' (January, February, March). Default: 'abbr' */ monthFormat: "num" | "abbr" | "full"; /** * The current date to display in the calendar. Default is today's date. */ currentDate: Dayjs; /** * The selected date in the calendar. Defaults to null. */ selectedDate: Dayjs | null; /** * Use button for month navigation instead of text. Default: false */ useMonthButton: boolean; /** * Content for Month Button. Used in `innerHTML`. Default: 'View Month' */ monthButtonContent: string; /** * Label for Month Button (aria-label). Default: 'View Month' */ monthButtonLabel: string; /** * Use select dropdowns for month, and year navigation. Default: false */ useSelects: boolean; /** * Content for Previous Month Button. Used in `innerHTML`. Default: '←' */ previousButtonContent: string; /** * Label for Previous Month Button (aria-label). Default: 'Previous Month' */ previousLabel: string; /** * Content for Next Month Button. Used in `innerHTML`. Default: '→' */ nextButtonContent: string; /** * Label for Next Month Button (aria-label). Default: 'Next Month' */ nextLabel: string; /** * Content for Help Button. Used in `innerHTML`. Default: 'Keyboard Shortcuts' */ helpButtonContent: string; /** * Label for Help Button (aria-label) Default: 'Keyboard Shortcuts' */ helpButtonLabel: string; /** * Content for Help Panel. Used in `innerHTML`. */ helpPanelContent: string; /** * Text for Dialog Close Button. Used in `innerHTML`. Default: 'Close' */ helpPanelCloseButtonContent: string; /** * Label for Dialog Close Button (aria-label). Default: 'Close' */ helpPanelCloseButtonLabel: string; /** * Title for Navigation Region. Default: 'Select a date' */ navTitle: string; /** * Instructions to announce before the date picker. Set to false to disable. Default: false */ instructionsBefore: string | false; /** * Instructions to announce after the date picker. Set to false to disable. Default: false */ instructionsAfter: string | false; /** * Endpoint URL to fetch event dates from. Set to false to disable. Default: false */ fetchEndpoint: string | false; /** * When a DatePicker event dispatches, these date formats will be returned. * Format as key-value pairs, where key is a Dayjs format string, and value is a valid version of the format for testing in dayjs. See https://day.js.org/docs/en/parse/string-format * Example: { 'YYYY-MM-DD': '2025-12-05', 'MM/DD/YYYY': '12/05/2025' } */ methodFormats: { [key: string]: string; }; } type SelectOption = { value: number; label: string; selected: boolean; }; type DatePickerSelectState = { monthOptions: SelectOption[] | null; yearOptions: SelectOption[] | null; oldestYear: number; newestYear: number; monthLabels: string[] | number[] | null; yearLabels: number[] | null; }; export type DatePickerState = { initialized: boolean; datePickerWrapper: HTMLElement; datePickerID: string; calendar: HTMLElement | null; fetchResults: EventDatesAPIResponse | false; fetchResultsRefined: any[] | false; selectedDate: Dayjs | null; currentDate: Dayjs; calendarStartDate: Dayjs; currentMonth: number | null; currentYear: number | null; currentDay: number | null; selectValues: DatePickerSelectState | null; methodFormats: { [key: string]: string; }; }; export type EventDatesAPIResponse = { [year: string]: { [month: string]: string[]; }; }; export type DatePickerElements = { wrapper: HTMLElement; calendar: HTMLElement; helpButton: HTMLButtonElement; helpPanel: HTMLDialogElement; helpCloseButton: HTMLButtonElement; nav: HTMLElement; navHeader: HTMLDivElement; grid: HTMLDivElement; daysHeader: HTMLDivElement; datesGrid: HTMLDivElement; monthTitle: HTMLDivElement; monthTitleText: HTMLSpanElement; monthButton: HTMLButtonElement; previousButton: HTMLButtonElement; nextButton: HTMLButtonElement; selects: { month: HTMLSelectElement; year: HTMLSelectElement; }; announcer: HTMLSpanElement; }; export type DatePickerClasses = { state: DatePickerStateClasses; dates: DatePickerDateClasses; }; export type DatePickerStateClasses = { loading: string; rendering: string; }; export type DatePickerDateClasses = { date: string; selected: string; today: string; hasEvents: string; empty: string; otherMonth: string; past: string; }; export type DatePickerDateTemplateData = { day: dayjs.Dayjs; today: dayjs.Dayjs; selectedDate: dayjs.Dayjs | null; classes: DatePickerDateClasses; }; export {};