/** * Copyright 2024, SumUp Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Temporal } from 'temporal-polyfill'; import type { Locale } from '../../util/i18n.js'; import { type DaysInWeek, type FirstDayOfWeek, type PlainDateRange } from '../../util/date.js'; type CalendarState = { today: Temporal.PlainDate; months: Temporal.PlainYearMonth[]; focusedDate: Temporal.PlainDate; hoveredDate: Temporal.PlainDate | null; }; export declare enum CalendarActionType { PREV_MONTH = 0, NEXT_MONTH = 1, NUMBER_OF_MONTHS = 2, FOCUS_DATE = 3, MOUSE_ENTER_DATE = 4, MOUSE_LEAVE_DATE = 5 } type CalendarAction = { type: CalendarActionType.PREV_MONTH; } | { type: CalendarActionType.NEXT_MONTH; } | { type: CalendarActionType.NUMBER_OF_MONTHS; numberOfMonths: number; } | { type: CalendarActionType.FOCUS_DATE; date: Temporal.PlainDate; } | { type: CalendarActionType.MOUSE_ENTER_DATE; date: Temporal.PlainDate; } | { type: CalendarActionType.MOUSE_LEAVE_DATE; }; export declare function initCalendar({ selection, minDate, maxDate, numberOfMonths, }: { selection?: Temporal.PlainDate | PlainDateRange | null; minDate?: Temporal.PlainDate | null; maxDate?: Temporal.PlainDate | null; numberOfMonths: number; }): CalendarState; export declare function calendarReducer(state: CalendarState, action: CalendarAction): CalendarState; export declare function getMonths(focusedDate: Temporal.PlainDate, prevMonths: Temporal.PlainYearMonth[]): Temporal.PlainYearMonth[]; type Weekday = { narrow: string; long: string; }; type Weekdays = [Weekday, Weekday, Weekday, Weekday, Weekday, Weekday, Weekday]; export declare function getWeekdays(firstDayOfWeek?: FirstDayOfWeek, daysInWeek?: DaysInWeek, locale?: Locale): Weekdays; export declare function getMonthHeadline(yearMonth: Temporal.PlainYearMonth, locale?: Locale): string; export declare function getDatesInRange(startDate: Temporal.PlainDate, endDate: Temporal.PlainDate): Temporal.PlainDate[]; export declare function getViewOfMonth(yearMonth: Temporal.PlainYearMonth, firstDayOfWeek?: FirstDayOfWeek, daysInWeek?: DaysInWeek): Temporal.PlainDate[][]; export declare function isDateActive(date: Temporal.PlainDate, selection?: Temporal.PlainDate | PlainDateRange): boolean; export declare function getSelectionType(date: Temporal.PlainDate, hoveredDate: Temporal.PlainDate | null, selection?: Temporal.PlainDate | PlainDateRange): 'selected' | 'range-start' | 'range-middle' | 'range-end' | null; export declare function isDateInMonthRange(date: Temporal.PlainDate, minDate?: Temporal.PlainDate | null, maxDate?: Temporal.PlainDate | null): boolean; export {};