mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 03:02:04 +08:00
Initial typings for react-infinite-calendar
This commit is contained in:
66
types/react-infinite-calendar/index.d.ts
vendored
Normal file
66
types/react-infinite-calendar/index.d.ts
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
// Type definitions for react-infinite-calendar 2.3
|
||||
// Project: https://github.com/clauderic/react-infinite-calendar
|
||||
// Definitions by: Christian Chown <https://github.com/christianchown>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export interface ReactInfiniteCalendarProps {
|
||||
selected?: Date | boolean;
|
||||
width?: number;
|
||||
height?: number;
|
||||
min?: Date;
|
||||
max?: Date;
|
||||
minDate?: Date;
|
||||
maxDate?: Date;
|
||||
disabledDays?: Array<0 | 1 | 2 | 3 | 4 | 5 | 6>;
|
||||
disabledDates?: Date[];
|
||||
display?: 'days' | 'years';
|
||||
displayOptions?: {
|
||||
hideYearsOnSelect?: boolean;
|
||||
layout?: 'portrait' | 'landscape';
|
||||
overscanMonthCount?: number;
|
||||
shouldHeaderAnimate?: boolean;
|
||||
showHeader?: boolean;
|
||||
showMonthsForYears?: boolean;
|
||||
showOverlay?: boolean;
|
||||
showTodayHelper?: boolean;
|
||||
showWeekdays?: boolean;
|
||||
todayHelperRowOffset?: number;
|
||||
};
|
||||
locale?: {
|
||||
blank?: string;
|
||||
headerFormat?: string;
|
||||
todayLabel?: {
|
||||
long: string;
|
||||
};
|
||||
weekdays?: string[];
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
||||
};
|
||||
theme?: {
|
||||
accentColor?: string;
|
||||
floatingNav: {
|
||||
background?: string;
|
||||
chevron?: string;
|
||||
color?: string;
|
||||
};
|
||||
headerColor?: string;
|
||||
selectionColor?: string;
|
||||
textColor?: {
|
||||
active?: string;
|
||||
default?: string;
|
||||
};
|
||||
todayColor?: string;
|
||||
weekdayColor?: string;
|
||||
};
|
||||
className?: string;
|
||||
onSelect?: () => void;
|
||||
onScroll?: (scrollTop: number) => void;
|
||||
onScrollEnd?: (scrollTop: number) => void;
|
||||
rowHeight?: number;
|
||||
autoFocus?: boolean;
|
||||
tabIndex?: number;
|
||||
}
|
||||
|
||||
export default class ReactInfiniteCalendar extends React.Component<ReactInfiniteCalendarProps> {}
|
||||
@@ -0,0 +1,61 @@
|
||||
import * as React from 'react';
|
||||
import ReactInfiniteCalendar from 'react-infinite-calendar';
|
||||
|
||||
const test: React.SFC = () => (
|
||||
<ReactInfiniteCalendar
|
||||
selected={new Date()}
|
||||
width={500}
|
||||
height={500}
|
||||
min={new Date()}
|
||||
max={new Date()}
|
||||
minDate={new Date()}
|
||||
maxDate={new Date()}
|
||||
disabledDays={[0, 6]}
|
||||
disabledDates={[new Date()]}
|
||||
display="years"
|
||||
displayOptions={{
|
||||
hideYearsOnSelect: true,
|
||||
layout: 'portrait',
|
||||
overscanMonthCount: 2,
|
||||
shouldHeaderAnimate: true,
|
||||
showHeader: true,
|
||||
showMonthsForYears: true,
|
||||
showOverlay: true,
|
||||
showTodayHelper: true,
|
||||
showWeekdays: true,
|
||||
todayHelperRowOffset: 4,
|
||||
}}
|
||||
locale={{
|
||||
blank: 'Select a date...',
|
||||
headerFormat: 'ddd, MMM Do',
|
||||
todayLabel: {
|
||||
long: 'Today',
|
||||
},
|
||||
weekdays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||||
weekStartsOn: 0,
|
||||
}}
|
||||
theme={{
|
||||
accentColor: '#448AFF',
|
||||
floatingNav: {
|
||||
background: 'rgba(56, 87, 138, 0.94)',
|
||||
chevron: '#FFA726',
|
||||
color: '#FFF',
|
||||
},
|
||||
headerColor: '#448AFF',
|
||||
selectionColor: '#559FFF',
|
||||
textColor: {
|
||||
active: '#FFF',
|
||||
default: '#333',
|
||||
},
|
||||
todayColor: '#FFA726',
|
||||
weekdayColor: '#559FFF',
|
||||
}}
|
||||
className="className"
|
||||
onSelect={() => {}}
|
||||
onScroll={(scrollTop: number) => { console.log(scrollTop); }}
|
||||
onScrollEnd={(scrollTop: number) => { console.log(scrollTop); }}
|
||||
rowHeight={40}
|
||||
autoFocus={false}
|
||||
tabIndex={1}
|
||||
/>
|
||||
);
|
||||
25
types/react-infinite-calendar/tsconfig.json
Normal file
25
types/react-infinite-calendar/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-infinite-calendar-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-infinite-calendar/tslint.json
Normal file
1
types/react-infinite-calendar/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user