import { ICalendarOptions } from '../interfaces/calendar.interface'; import CalendarConnector from './connector'; /** * DateDreamer Calendar Component * * A customizable calendar component built with Web Components that provides * date selection functionality with various themes and customization options. * * @example * ```javascript * const calendar = new DateDreamerCalendar({ * element: '#my-calendar', * selectedDate: new Date(), * theme: 'lite-purple', * darkMode: true * }); * ``` */ declare class DateDreamerCalendar extends HTMLElement implements ICalendarOptions { element: Element | string; calendarElement: HTMLElement | null | undefined; headerElement: HTMLElement | null | undefined; inputsElement: HTMLElement | null | undefined; errorsElement: HTMLElement | null | undefined; format: string | undefined; iconNext: string | undefined; iconPrev: string | undefined; hidePrevNav?: boolean | undefined; hideNextNav?: boolean | undefined; inputLabel: string; inputPlaceholder: string; hideInputs: boolean; darkMode: boolean | undefined; darkModeAuto: boolean | undefined; hideOtherMonthDays: boolean | undefined; rangeMode: boolean | undefined; connector: CalendarConnector | undefined; onChange: ((event: CustomEvent) => void) | undefined; onRender: ((event: CustomEvent) => void) | undefined; onNextNav: ((event: CustomEvent) => void) | undefined; onPrevNav: ((event: CustomEvent) => void) | undefined; errors: Array<{ type: string; message: string; }>; daysElement: HTMLElement | null | undefined; selectedDate: Date; displayedMonthDate: Date; theme: 'unstyled' | 'lite-purple'; styles: string; /** * Creates a new DateDreamer Calendar instance * * @param options - Configuration options for the calendar * @param options.element - The DOM element or selector where the calendar will be rendered * @param options.selectedDate - Initial selected date (Date object, string, or null for today) * @param options.theme - Visual theme for the calendar ('unstyled' or 'lite-purple') * @param options.styles - Custom CSS styles to apply * @param options.format - Date format for parsing and displaying dates * @param options.iconNext - Custom icon for next month navigation * @param options.iconPrev - Custom icon for previous month navigation * @param options.hidePrevNav - Whether to hide the previous month button * @param options.hideNextNav - Whether to hide the next month button * @param options.inputLabel - Label for the date input field * @param options.inputPlaceholder - Placeholder text for the date input field * @param options.hideInputs - Whether to hide the input field and today button * @param options.darkMode - Whether to enable dark mode styling * @param options.darkModeAuto - Whether to automatically detect user's system preference for dark mode * @param options.hideOtherMonthDays - Whether to hide days from other months * @param options.rangeMode - Whether to enable range selection mode * @param options.connector - Calendar connector for linking multiple calendars * @param options.onChange - Callback function triggered when date changes * @param options.onRender - Callback function triggered when calendar renders * @param options.onNextNav - Callback function triggered when navigating to next month * @param options.onPrevNav - Callback function triggered when navigating to previous month */ constructor(options: ICalendarOptions); private init; /** * Determines whether dark mode should be enabled based on user preferences * @returns boolean indicating if dark mode should be active */ private getDarkModeSetting; /** * Sets up a listener for system preference changes when darkModeAuto is enabled */ private setupDarkModeListener; /** * Updates the dark mode styling based on current preferences */ private updateDarkMode; /** * Inserts calendar HTML into the element via query selector. * @param calendar Calendar HTML */ private insertCalendarIntoSelector; /** * Navigates to the previous month */ goToPrevMonth: () => void; /** * Navigates to the next month */ goToNextMonth: () => void; /** * Handles keyboard navigation within calendar days */ handleDayKeyDown: (event: KeyboardEvent) => void; /** * Triggers the onRender callback that was passed into the calendar options. */ private onRenderCallback; setDisplayedMonthDate(date: Date): void; rebuildCalendar(rebuildInput?: boolean, focusFirstorLastDay?: false | 'first' | 'last'): void; /** * Sets the selected day of the viewable month. * @param day The day of the month in number format. */ setSelectedDay: (day: number) => void; /** * Sets the given date as selected in the calendar. * * @param date - The new date to select in the calendar. Can be a Date object or date string. * @example * ```javascript * calendar.setDate(new Date('2024-01-15')); * calendar.setDate('2024-01-15'); * ``` */ setDate(date: string | Date): void; /** * Sets the selected and viewable month to today. * * @example * ```javascript * calendar.setDateToToday(); * ``` */ setDateToToday: () => void; /** * Handles the KeyUp event in the date textbox. * @param e KeyUp event */ dateInputChanged: (e: Event | KeyboardEvent) => void; /** * Triggers the onChange callback that was passed into the calendar options. * @param date The new date that has been selected in the calendar. */ private dateChangedCallback; } export { DateDreamerCalendar as calendar };