rc-calendar-picker
Version:
<div align="center"> <a href="https://github.com/noxxxxxxxx/calendar" target="_blank"> <img alt="Calendar Logo" width="150" src="https://github.com/noxxxxxxxx/calendar/blob/main/assets/calendar.svg"/> </a> </div>
95 lines (86 loc) • 2.8 kB
TypeScript
import { Dayjs } from 'dayjs';
import { FC } from 'react';
import { ReactNode } from 'react';
declare const Calendar: FC<Props>;
export default Calendar;
export declare type onChangeFn = Props['onChange'];
declare interface Props {
value?: Dayjs;
initialValue?: Dayjs;
initialViewMode?: ViewMode;
showInput?: boolean;
open?: boolean;
timezoneOffset?: number;
closeOnSelect?: boolean;
className?: string | string[];
inputProps?: {
[key: string]: unknown;
onFocus?: (...args: unknown[]) => boolean | void;
onClick?: (...args: unknown[]) => boolean | void;
onChange?: (...args: unknown[]) => void;
onKeyDown?: (...args: unknown[]) => boolean | void;
};
dateFormat?: string | boolean;
timeFormat?: string | boolean;
viewMode?: ViewMode;
closeOnClickOutside?: boolean;
timeLimit?: string;
showTime?: boolean;
isEndDate?: boolean;
siblingDate?: Dayjs;
isValidDate?: (currentDate: Dayjs, selectedDate?: Dayjs) => boolean;
timeConstraints?: TimeConstraintsType;
onOpen?: () => void;
onChange?: (selectedDate: Dayjs | string) => void;
onClose?: (date: Dayjs | undefined) => void;
renderYear?: (props: props, year: number | undefined, selectedDate: Dayjs | undefined) => ReactNode;
renderMonth?: (props: props & {
key: number | string;
}, month: number, year: number | undefined, selectedDate: Dayjs | undefined) => ReactNode;
renderDay?: (props: Props & {
key: number | string;
}, day: number, selectedDate: Dayjs | undefined) => ReactNode;
onBeforeNavigate?: (nextView: ViewMode, currentView: ViewMode, viewDate: Dayjs) => ViewMode;
onNavigate?: (currentView: ViewMode) => void;
onNavigateForward?: (amount: number, ViewMode: ViewMode) => void;
onNavigateBack?: (amount: number, ViewMode: ViewMode) => void;
}
declare interface props {
[key: string]: unknown;
}
export declare enum TimeConstraintsKeys {
Hour = "hour",
Minute = "minute",
Second = "second",
Millisecond = "millisecond",
Ampm = "ampm"
}
export declare type TimeConstraintsType = {
[TimeConstraintsKeys.Hour]: {
min: number;
max: number;
step: number;
};
[TimeConstraintsKeys.Minute]: {
min: number;
max: number;
step: number;
};
[TimeConstraintsKeys.Second]: {
min: number;
max: number;
step: number;
};
[TimeConstraintsKeys.Millisecond]: {
min: number;
max: number;
step: number;
};
};
export declare enum ViewMode {
Year = "year",
Month = "month",
Day = "day",
Time = "time"
}
export { }