react-day-picker merge types into namespace for export = syntax

This commit is contained in:
cwmoo740
2017-03-08 00:35:03 -05:00
parent 60a8ba65e0
commit 7d55759e19
+135 -135
View File
@@ -6,139 +6,143 @@
import * as React from 'react';
interface LocaleUtils {
formatDay(day: Date, locale: string): string;
formatMonthTitle(month: Date, locale: string): string;
formatWeekdayLong(weekday: number, locale: string): string;
formatWeekdayShort(weekday: number, locale: string): string;
getFirstDayOfWeek(locale: string): number;
getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string];
declare namespace DayPicker {
export interface LocaleUtils {
formatDay(day: Date, locale: string): string;
formatMonthTitle(month: Date, locale: string): string;
formatWeekdayLong(weekday: number, locale: string): string;
formatWeekdayShort(weekday: number, locale: string): string;
getFirstDayOfWeek(locale: string): number;
getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string];
}
export interface DateUtils {
addMonths(d: Date, n: number): Date;
clone(d: Date): Date;
isSameDay(d1: Date, d2: Date): Date;
isPastDay(d: Date): boolean;
isFutureDay(d: Date): boolean;
isDayBetween(day: Date, begin: Date, end: Date): boolean;
addDayToRange(day: Date, range: RangeModifier): RangeModifier;
isDayInRange(day: Date, range: RangeModifier): boolean;
}
export interface CaptionElementProps {
date?: Date;
localeUtils?: LocaleUtils;
locale?: string;
onClick?(month: Date, e: React.MouseEvent<HTMLDivElement>): void;
}
export interface NavbarElementProps {
className?: string;
previousMonth?: Date;
nextMonth?: Date;
showPreviousButton?: boolean;
showNextButton?: boolean;
onPreviousClick?(): void;
onNextClick?(): void;
dir?: string;
localeUtils?: LocaleUtils;
locale?: string;
}
export interface WeekdayElementProps {
weekday?: number;
className?: string;
localeUtils?: LocaleUtils;
locale?: string;
}
export interface ClassNames {
container: string;
interactionDisabled: string;
navBar: string;
navButtonPrev: string;
navButtonNext: string;
month: string;
caption: string;
weekdays: string;
weekdaysRow: string;
weekday: string;
body: string;
week: string;
day: string;
today: string;
selected: string;
disabled: string;
outside: string;
}
export interface RangeModifier {
from: Date;
to: Date;
}
export interface BeforeModifier {
before: Date;
}
export interface AfterModifier {
after: Date;
}
export interface FunctionModifier {
(date: Date): boolean;
}
export type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier;
export interface Modifiers {
today: Modifier | Modifier[];
outside: Modifier | Modifier[];
[other: string]: Modifier | Modifier[] | undefined;
}
export interface Props {
canChangeMonth?: boolean;
captionElement?: React.ReactElement<CaptionElementProps>;
className?: string;
classNames?: ClassNames;
containerProps?: React.HTMLAttributes<HTMLDivElement>;
disabledDays?: Modifier | Modifier[];
enableOutsideDays?: boolean;
firstDayOfWeek?: number;
fixedWeeks?: boolean;
fromMonth?: Date;
initialMonth?: Date;
labels?: { previousMonth: string; nextMonth: string; };
locale?: string;
localeUtils?: LocaleUtils;
modifiers?: Partial<Modifiers>;
month?: Date;
months?: [string, string, string, string, string, string, string, string, string, string, string, string];
navbarElement?: React.ReactElement<NavbarElementProps>;
numberOfMonths?: number;
onBlur?(e: React.FocusEvent<HTMLDivElement>): void;
onCaptionClick?(month: Date, e: React.MouseEvent<HTMLDivElement>): void;
onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent<HTMLDivElement>): void;
onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent<HTMLDivElement>): void;
onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent<HTMLDivElement>): void;
onFocus?(e: React.FocusEvent<HTMLDivElement>): void;
onKeyDown?(e: React.KeyboardEvent<HTMLDivElement>): void;
onMonthChange?(month: Date): void;
pagedNavigation?: boolean;
renderDay?(date: Date, modifiers: Modifiers): React.ReactNode;
reverseMonths?: boolean;
selectedDays?: Modifier | Modifier[];
toMonth?: Date;
weekdayElement?: React.ReactElement<WeekdayElementProps>;
weekdaysLong?: [string, string, string, string, string, string, string];
weekdaysShort?: [string, string, string, string, string, string, string];
}
const VERSION: string;
const LocaleUtils: DayPicker.LocaleUtils;
const DateUtils: DayPicker.DateUtils;
}
interface DateUtils {
addMonths(d: Date, n: number): Date;
clone(d: Date): Date;
isSameDay(d1: Date, d2: Date): Date;
isPastDay(d: Date): boolean;
isFutureDay(d: Date): boolean;
isDayBetween(day: Date, begin: Date, end: Date): boolean;
addDayToRange(day: Date, range: RangeModifier): RangeModifier;
isDayInRange(day: Date, range: RangeModifier): boolean;
}
interface CaptionElementProps {
date: Date;
localeUtils: LocaleUtils;
locale: string;
onClick: typeof Props.onCaptionClick;
}
interface NavbarElementProps {
className: string;
previousMonth: Date;
nextMonth: Date;
showPreviousButton: boolean;
showNextButton: boolean;
onPreviousClick(): void;
onNextClick(): void;
dir: string;
localeUtils: LocaleUtils;
locale: string;
}
interface WeekdayElementProps {
weekday: number;
className: string;
localeUtils: LocaleUtils;
locale: string;
}
interface ClassNames {
container: string;
interactionDisabled: string;
navBar: string;
navButtonPrev: string;
navButtonNext: string;
month: string;
caption: string;
weekdays: string;
weekdaysRow: string;
weekday: string;
body: string;
week: string;
day: string;
today: string;
selected: string;
disabled: string;
outside: string;
}
interface RangeModifier {
from: Date;
to: Date;
}
interface BeforeModifier {
before: Date;
}
interface AfterModifier {
after: Date;
}
interface FunctionModifier {
(date: Date): boolean;
}
type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier;
interface Modifiers {
today: Modifier | Modifier[];
outside: Modifier | Modifier[];
[other: string]: Modifier | Modifier[] | undefined;
}
interface Props {
canChangeMonth?: boolean;
captionElement?: React.SFC<CaptionElementProps>;
className?: string;
classNames?: ClassNames;
containerProps?: React.HTMLAttributes<HTMLDivElement>;
disabledDays?: Modifier | Modifier[];
enableOutsideDays?: boolean;
firstDayOfWeek?: number;
fixedWeeks?: boolean;
fromMonth?: Date;
initialMonth?: Date;
labels?: { previousMonth: string; nextMonth: string; };
locale?: string;
localeUtils?: LocaleUtils;
modifiers?: Modifiers;
month?: Date;
months?: [string, string, string, string, string, string, string, string, string, string, string, string];
navbarElement?: React.SFC<NavbarElementProps> | React.ComponentClass<NavbarElementProps>;
numberOfMonths?: number;
onBlur?(e: React.FocusEvent<HTMLDivElement>): void;
onCaptionClick?(month: Date, e: React.MouseEvent<HTMLDivElement>): void;
onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent<HTMLDivElement>): void;
onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent<HTMLDivElement>): void;
onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent<HTMLDivElement>): void;
onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent<HTMLDivElement>): void;
onFocus?(e: React.FocusEvent<HTMLDivElement>): void;
onKeyDown?(e: React.KeyboardEvent<HTMLDivElement>): void;
onMonthChange?(month: Date): void;
pagedNavigation?: boolean;
renderDay?(date: Date, modifiers: Modifiers): React.ReactNode;
reverseMonths?: boolean;
selectedDays?: Modifier | Modifier[];
toMonth?: Date;
weekdayElement?: React.SFC<WeekdayElementProps> | React.ComponentClass<WeekdayElementProps>;
weekdaysLong?: [string, string, string, string, string, string, string];
weekdaysShort?: [string, string, string, string, string, string, string];
}
class DayPicker extends React.Component<Props, {}> {
declare class DayPicker extends React.Component<DayPicker.Props, never> {
showMonth(month: Date): void;
showPreviousMonth(): void;
@@ -148,10 +152,6 @@ class DayPicker extends React.Component<Props, {}> {
showPreviousYear(): void;
showNextYear(): void;
static readonly VERSION: string;
static readonly LocaleUtils: LocaleUtils;
static readonly DateUtils: DateUtils;
}
export = DayPicker;