UNPKG

@wix/design-system

Version:

@wix/design-system

56 lines 2.87 kB
import React, { MouseEvent, KeyboardEvent } from 'react'; import DayPicker, { DayModifiers, DayPickerProps, Modifier } from 'react-day-picker'; import localeUtilsFactory, { WeekdayNumber } from '../../common/LocaleUtils/LocaleUtils'; import { WixStyleReactEnvironmentContext } from '../../WixStyleReactEnvironmentProvider/context'; import { BaseCalendarProps } from './BaseCalendar.types'; type DefaultedProps<Base, DefaultPropsKeys extends keyof Base> = Omit<Base, DefaultPropsKeys> & Required<Pick<Base, DefaultPropsKeys>>; type DefaultPropKeys = 'className' | 'filterDate' | 'dateIndication' | 'shouldCloseOnSelect' | 'onClose' | 'autoFocus' | 'excludePastDates' | 'selectionMode' | 'numOfMonths' | 'size' | 'allowSelectingOutsideDays'; type DefaultedBaseCalendarProps = DefaultedProps<BaseCalendarProps, DefaultPropKeys>; export default class BaseCalendar extends React.PureComponent<DefaultedBaseCalendarProps> { static displayName: string; static defaultProps: { className: string; filterDate: () => boolean; dateIndication: () => null; shouldCloseOnSelect: boolean; onClose: () => void; autoFocus: boolean; excludePastDates: boolean; selectionMode: string; numOfMonths: number; size: string; allowSelectingOutsideDays: boolean; }; /** Return a value in which all string-dates are parsed into Date objects */ static parseValue: (value: BaseCalendarProps["value"]) => Date | { from?: Date; to?: Date; }; static nextDay: (date: Date | number | string) => Date; static prevDay: (date: Date | number | string) => Date; context: React.ContextType<typeof WixStyleReactEnvironmentContext>; dayPickerRef?: DayPicker | null; _renderDay: (day: Date, modifiers: any) => React.JSX.Element; _handleDayClick: (value: Date, modifiers?: DayModifiers | {}, event?: MouseEvent | null) => void; _getSelectedDays(value?: Date | { from?: Date; to?: Date; }): Modifier; _preventActionEventDefault: (event?: KeyboardEvent | MouseEvent | null) => void; _createWeekdayElement: (localeUtils: ReturnType<typeof localeUtilsFactory>) => ({ className, weekday, }: { className: string; weekday: WeekdayNumber; }) => React.JSX.Element; _createDayPickerProps: () => DayPickerProps; _getDayPicker(): DayPicker; _handleKeyDown: (event: KeyboardEvent) => void; _toggleFirstDayTabIndex: (tabIndex: number) => void; _focusSelectedDay: () => void; _handleDayKeyDown: (_value: Date, _modifiers: DayModifiers, event?: KeyboardEvent<HTMLDivElement> | null) => void; _getLocale(): string; componentDidMount(): void; componentDidUpdate(prevProps: DefaultedBaseCalendarProps): void; render(): React.JSX.Element; } export {}; //# sourceMappingURL=BaseCalendar.d.ts.map