mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Created definitions for "react-flatpickr" v3.2. (#15933)
This commit is contained in:
parent
925b70ecb7
commit
c71a29462a
17
types/react-flatpickr/index.d.ts
vendored
Normal file
17
types/react-flatpickr/index.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for react-flatpickr 3.2
|
||||
// Project: https://github.com/coderhaoxin/react-flatpickr
|
||||
// Definitions by: begincalendar <https://github.com/begincalendar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Component } from 'react';
|
||||
import { EventCallback, Options } from 'flatpickr';
|
||||
|
||||
export interface DateTimePickerProps {
|
||||
defaultValue?: string;
|
||||
options?: Options;
|
||||
onChange?: EventCallback;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
export default class DatePicker extends Component<DateTimePickerProps, void> {}
|
||||
20
types/react-flatpickr/react-flatpickr-tests.tsx
Normal file
20
types/react-flatpickr/react-flatpickr-tests.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import * as Flatpickr from 'flatpickr';
|
||||
import * as React from 'react';
|
||||
import DatePicker from 'react-flatpickr';
|
||||
|
||||
const noParamsElement = <DatePicker/>;
|
||||
|
||||
const defaultValueElement = <DatePicker defaultValue={ 'Default value' }/>;
|
||||
|
||||
const options = {
|
||||
dateFormat: 'YYYY-MM-DD'
|
||||
};
|
||||
const optionsElement = <DatePicker options={ options }/>;
|
||||
|
||||
const onChange = (
|
||||
selectedDates: Date[], dateStr: string, instance: Flatpickr,
|
||||
elem: HTMLElement
|
||||
) => null;
|
||||
const onChangeElement = <DatePicker onChange={ onChange }/>;
|
||||
|
||||
const valueElement = <DatePicker value={ 'Value' }/>;
|
||||
24
types/react-flatpickr/tsconfig.json
Normal file
24
types/react-flatpickr/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"jsx": "react",
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-flatpickr-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-flatpickr/tslint.json
Normal file
1
types/react-flatpickr/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user