import { CaptionElementProps } from 'react-day-picker'; import { SupportedWixLocales } from 'wix-design-systems-locale-utils'; export interface BaseCalendarProps { /** Applies as data-hook HTML attribute that can be used in the tests */ dataHook?: string; /** Focus selected day automatically when component mounts or updates */ autoFocus?: boolean; /** Allows to display multiple months at once. Currently it shows 1 or 2 months only. */ numOfMonths?: 1 | 2; /** First day of the week, allowing only from 0 to 6 (Sunday to Saturday). The default value is 1 which means Monday. */ firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6; /** A single CSS class name to be appended to the root element. */ className?: string; /** Provides a callback function when day in selected in the calendar */ onChange: (date: { from: Date; to: Date } | Date, modifiers: any) => void; /** Defines a callback function that is called whenever a user presses escape, clicks outside of the element or a date is selected and `shouldCloseOnSelect` is set. Receives an event as a first argument. */ onClose?: (event?: any) => void; /** Provides a callback function when any key is clicked in the calendar */ onKeyDown?: (event: React.KeyboardEvent) => void; /** Specify whether past dates should be selectable or not */ excludePastDates?: boolean; /** * ##### Specify selectable dates: * * `param` {Date} `date` - a date to check * * `return` {boolean} - true if `date` should be selectable, false otherwise */ filterDate?: (date: Date) => boolean; /** Defines the selected date */ value?: Date | { from: Date; to: Date }; /** Whether the user should be able to select a date range, or just a single day */ selectionMode?: 'day' | 'range'; /** Specify whether the calendar closes on day selection */ shouldCloseOnSelect?: boolean; /** Specify date picker instance locale */ locale?: SupportedWixLocales; /** Specify whether RTL mode is enabled or not. When true, the keyboard navigation will be changed means pressing on the right arrow will navigate to the previous day, and pressing on the left arrow will navigate to the next day. */ rtl?: boolean; /** ##### Add an indication under a specific date. Function returns the indication node of a specific date or null if this day doesn't have an indication. * - `param` {date: Date, isSelected: boolean } * - `date` - a date * - `isSelected` - whether this date is the selected date * - `return` {React.node} - the indication node of a specific date or null if this day doesn't have an indication. */ dateIndication?: (param: { date: Date; isSelected: boolean }) => void; /** Sets today's date. The today indication is added automatically according to the user timezone but in some cases, we need the ability to add the today indication based on the business timezone. */ today?: Date; /** The current displayed month */ displayedMonth: Date; /** * ##### A callback function that would be invoked every time that the displayed month / week would be changed. * ##### This would be passed as a prop (onMonthChange) for the ReactDayPicker component. * - `month` - The current displayed month * `return` void */ onDisplayedViewChange?: (month: Date) => void; /** The Calendar head components which includes the navigation arrows, and the captions elements. */ captionElement: | React.ReactElement> | React.ComponentClass | React.FC; /** Responsible for adding a new modifier for the day elements. For example: `hidden` for dates that shouldn’t be displayed. It should be passed as an object according to `ReactDayPicker` API. https://react-day-picker.js.org/docs/matching-days/ */ modifiers?: Record; /** Allow selecting dates that are outside of the current displayed month. */ allowSelectingOutsideDays?: boolean; /** Use the fixedWeeks prop to display 6 weeks per month. */ fixedWeeks?: boolean; } export default class BaseCalendar extends React.PureComponent {}