import { default as React } from 'react'; import { ValuePair } from '../../../utilities/valuePair.js'; import { YearsToShow } from '../types.js'; export declare function composeEventHandlers(...fns: Array): (event: React.MouseEvent) => boolean; /** * Takes a calendars array and figures out the number of months to subtract * based on the current offset and the minDate allowed. * @param {Object} param The param object * @param {Array} param.calendars The calendars array created by the getCalendars function * @param {Number} param.offset The num of months to be subtracted * @param {Date} param.minDate The earliest date we are allow to subtract back to * @returns {Number} The number of months to subtract */ export declare function subtractMonth({ calendars, offset, minDate, }: { calendars: CalendarMonth[]; offset: number; minDate?: Date; }): number; export declare const DEFAULT_YEARS_TO_SHOW = 3; /** * Generates an array of year strings for a year selector component, with min and max dates taken into account. * * @param {number} currentYear - The current year to center the list around * @param {Date | undefined} [minDate] - The minimum date to include in the list of years * @param {Date | undefined} [maxDate] - The maximum date to include in the list of years * * @returns {string[]} - An array of year strings, starting from the earliest year specified by minDate or currentYear - 3, and ending at the latest year specified by maxDate or currentYear + 3 */ export declare function getYearSelectOptions(currentYear: number, minDate: Date | undefined, maxDate: Date | undefined, yearsToShow: YearsToShow): string[]; /** * Returns an array of months that are allowed for selection in the current year based on the minimum and maximum dates. * @param {number} currentYear The current year * @param {string[]} monthNames An array of strings representing the month names * @param {Date | undefined} minDate The minimum date that is allowed for selection * @param {Date | undefined} maxDate The maximum date that is allowed for selection * @returns {ValuePair[]} An array of ValuePairs representing the months that are allowed for selection in the current year */ export declare function getMonthSelectOptions(currentYear: number, monthNames: string[], minDate: Date | undefined, maxDate: Date | undefined): ValuePair[]; /**s * Takes a calendars array and figures out the number of months to add * based on the current offset and the maxDate allowed. * @param {Object} param The param object * @param {Array} param.calendars The calendars array created by the getCalendars function * @param {Number} param.offset The num of months to be added * @param {Date} param.maxDate The furthest date we are allow to add forward to * @returns {Number} The number of months to add */ export declare function addMonth({ calendars, offset, maxDate, }: { calendars: CalendarMonth[]; offset: number; maxDate?: Date; }): number; /** * Takes a calendars array and figures out if the back button should be * disabled based on the minDate allowed. * @param {Object} param The param object * @param {Array} param.calendars The calendars array created by the getCalendars function * @param {Date} param.minDate The earliest date available * @returns {Boolean} Whether the back button should be disabled. */ export declare function isBackDisabled({ calendars, minDate, }: { calendars: CalendarMonth[]; minDate?: Date; }): boolean; /** * Takes a calendars array and figures out if the forward button should be * disabled based on the maxDate allowed. * @param {Object} param The param object * @param {Array} param.calendars The calendars array created by the getCalendars function * @param {Date} param.maxDate The furthest date available * @returns {Boolean} Whether the forward button should be disabled. */ export declare function isForwardDisabled({ calendars, maxDate, }: { calendars: CalendarMonth[]; maxDate?: Date; }): boolean; type GetCalendarProps = { /** The date to start the calendar at */ date: Date; /** Date or dates currently selected. */ selected?: Date | Date[]; /** The earliest date available */ minDate?: Date; /** The earliest date available */ maxDate?: Date; /** The number of months to return in the calendar view */ monthsToDisplay: number; /** The number of months to offset based off the param.date given */ offset: number; /** First day of week, 0-6 (Sunday to Saturday) */ firstDayOfWeek: number; /** Flag to fill front and back weeks with dates from adjacent months */ showOutsideDays: boolean; }; /** * Figures out the months data needed based off the number of monthsToDisplay * and other options provided. * @param {Object} param The param object * @param {Date} param.date The date to start the calendar at * @param {Array.} param.selected An array of dates currently selected * @param {Number} param.monthsToDisplay The number of months to return in the calendar view * @param {Number} param.offset The number of months to offset based off the param.date given * @param {Date} param.minDate The earliest date available * @param {Date} param.maxDate The furthest date available * @param {Number} param.firstDayOfWeek First day of week, 0-6 (Sunday to Saturday) * @param {Bool} param.showOutsideDays Flag to fill front and back weeks with dates from adjacent months * @returns {Array.} An array of objects with month data */ export declare function getCalendars({ date, selected, monthsToDisplay, offset, minDate, maxDate, firstDayOfWeek, showOutsideDays, }: GetCalendarProps): CalendarMonth[]; export type CalendarMonth = { firstDayOfMonth: Date; lastDayOfMonth: Date; month: number; year: number; weeks: CalendarWeek[]; }; export type CalendarWeek = CalendarDay[]; export type CalendarDay = DateInfo | string; export type DateInfo = { date: Date; selected: boolean; selectable: boolean; today: boolean; prevMonth: boolean; nextMonth: boolean; }; /** * Check if two Date objects represent the same day * * @param date1 first Date to compare * @param date2 second Date to compare */ export declare function isSameDay(date1: Date, date2: Date): boolean; /** * Check if the date has changed from the previous date * * @param date First date to compare * @param newDate Second date to compare */ export declare function dateHasChanged(date: Date | undefined, newDate: Date): boolean; /** * Check if a given date is outside a given range * * @param date Input date * @param rangeStart Dates before this date should be disabled * @param rangeEnd Dates after this date should be disabled */ export declare function dateIsOutsideRange(date: Date, rangeStart: Date | undefined, rangeEnd: Date | undefined): boolean; /** * Get the correct initial date for initiating the datepicker reducer store * * @param value Value from props * @param initialDate Initial date from porps * @param disableDate Function for checking whether the date should be disabled */ export declare function getInitialDate(value: string | undefined, defaultValue: string | undefined, minDate: Date | undefined, maxDate: Date | undefined): Date | null; /** * Get the initial date to show in the calendar * * @param date The date set in the DatePicker (from props) * @param defaultSelected The defaultSelected prop from DatePicker * @param minDate The earliest selectable date, from props * @param maxDate The latest selectable date, from props * @returns The date to show in the calendar */ export declare function getInitialDateShown(date: Date | null, defaultSelected: Date | undefined, minDate: Date | undefined, maxDate: Date | undefined): Date; export {};