mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 00:18:20 +08:00
Remove react-day-picker typings
This commit is contained in:
@@ -402,6 +402,12 @@
|
||||
"sourceRepoURL": "https://github.com/getsentry/raven-js",
|
||||
"asOfVersion": "3.10.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-day-picker",
|
||||
"typingsPackageName": "react-day-picker",
|
||||
"sourceRepoURL": "https://github.com/gpbl/react-day-picker",
|
||||
"asOfVersion": "5.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Redux",
|
||||
"typingsPackageName": "redux",
|
||||
|
||||
165
types/react-day-picker/index.d.ts
vendored
165
types/react-day-picker/index.d.ts
vendored
@@ -1,165 +0,0 @@
|
||||
// Type definitions for react-day-picker 5.2
|
||||
// Project: https://github.com/gpbl/react-day-picker
|
||||
// Definitions by: Giampaolo Bellavite <https://github.com/gpbl>, Jason Killian <https://github.com/jkillian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
declare namespace DayPicker {
|
||||
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];
|
||||
}
|
||||
|
||||
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;
|
||||
classNames: ClassNames;
|
||||
localeUtils: LocaleUtils;
|
||||
locale: string;
|
||||
months: undefined;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
}
|
||||
|
||||
interface NavbarElementProps {
|
||||
className: string;
|
||||
classNames: ClassNames;
|
||||
previousMonth: Date;
|
||||
nextMonth: Date;
|
||||
showPreviousButton: boolean;
|
||||
showNextButton: boolean;
|
||||
onPreviousClick(callback?: () => void): void;
|
||||
onNextClick(callback?: () => void): void;
|
||||
dir?: string;
|
||||
labels: { previousMonth: string; nextMonth: 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;
|
||||
}
|
||||
type FunctionModifier = (date: Date) => boolean;
|
||||
type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier;
|
||||
|
||||
interface Modifiers {
|
||||
today: Modifier | Modifier[];
|
||||
outside: Modifier | Modifier[];
|
||||
[other: string]: Modifier | Modifier[] | undefined;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
canChangeMonth?: boolean;
|
||||
captionElement?: React.ReactElement<Partial<CaptionElementProps>> |
|
||||
React.ComponentClass<CaptionElementProps> |
|
||||
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?: Partial<Modifiers>;
|
||||
month?: Date;
|
||||
months?: [string, string, string, string, string, string, string, string, string, string, string, string];
|
||||
navbarElement?: React.ReactElement<Partial<NavbarElementProps>> |
|
||||
React.ComponentClass<NavbarElementProps> |
|
||||
React.SFC<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<Partial<WeekdayElementProps>> |
|
||||
React.ComponentClass<WeekdayElementProps> |
|
||||
React.SFC<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;
|
||||
}
|
||||
|
||||
declare class DayPicker extends React.Component<DayPicker.Props, never> {
|
||||
showMonth(month: Date): void;
|
||||
|
||||
showPreviousMonth(): void;
|
||||
|
||||
showNextMonth(): void;
|
||||
|
||||
showPreviousYear(): void;
|
||||
|
||||
showNextYear(): void;
|
||||
}
|
||||
|
||||
export = DayPicker;
|
||||
@@ -1,52 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import DayPicker = require('react-day-picker');
|
||||
|
||||
function isSunday(day: Date) {
|
||||
return day.getDay() === 0;
|
||||
}
|
||||
|
||||
function MyComponent() {
|
||||
return (
|
||||
<DayPicker
|
||||
initialMonth={ new Date(2016, 1) } localeUtils={DayPicker.LocaleUtils} modifiers={{ isSunday }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
DayPicker.DateUtils.clone(new Date());
|
||||
DayPicker.DateUtils.isDayInRange(new Date(), { from: new Date(), to: new Date(2050) });
|
||||
|
||||
interface MyCaptionProps extends DayPicker.CaptionElementProps {
|
||||
myProp: number;
|
||||
}
|
||||
class Caption extends React.Component<MyCaptionProps, {}> {
|
||||
render() {
|
||||
const { date, locale, localeUtils, onClick } = this.props;
|
||||
|
||||
if (!date || !localeUtils || !onClick || typeof locale === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="DayPicker-Caption" onClick={ onClick }>
|
||||
{ localeUtils.formatMonthTitle(date, locale) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
<DayPicker captionElement={ Caption }/>;
|
||||
|
||||
type CaptionElementProps = Partial<DayPicker.CaptionElementProps>;
|
||||
class CaptionElement extends React.Component<CaptionElementProps, {}> {
|
||||
render() {
|
||||
const { date, locale, localeUtils, onClick } = this.props;
|
||||
if (!date || !locale || !localeUtils || !onClick) {
|
||||
return <div/>;
|
||||
}
|
||||
return (
|
||||
<div onClick={ onClick }>
|
||||
{ localeUtils.formatMonthTitle(date, locale) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
<DayPicker captionElement={ <CaptionElement /> }/>;
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-day-picker-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user