mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
Merge pull request #30924 from snaveevans/master
update react-flatpickr definitions to 3.6
This commit is contained in:
Vendored
+12
-5
@@ -1,18 +1,25 @@
|
||||
// Type definitions for react-flatpickr 3.2
|
||||
// Type definitions for react-flatpickr 3.6
|
||||
// Project: https://github.com/coderhaoxin/react-flatpickr
|
||||
// Definitions by: begincalendar <https://github.com/begincalendar>
|
||||
// snaveevans <https://github.com/snaveevans>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Component } from 'react';
|
||||
import flatpickr from 'flatpickr';
|
||||
import { Component } from "react";
|
||||
import flatpickr from "flatpickr";
|
||||
|
||||
export interface DateTimePickerProps {
|
||||
defaultValue?: string;
|
||||
options?: flatpickr.Options.Options;
|
||||
onChange?: flatpickr.Options.Hook;
|
||||
value?: string;
|
||||
className?: string;
|
||||
onOpen?: flatpickr.Options.Hook;
|
||||
onClose?: flatpickr.Options.Hook;
|
||||
onMonthChange?: flatpickr.Options.Hook;
|
||||
onYearChange?: flatpickr.Options.Hook;
|
||||
onReady?: flatpickr.Options.Hook;
|
||||
onValueUpdate?: flatpickr.Options.Hook;
|
||||
onDayCreate?: flatpickr.Options.Hook;
|
||||
value?: string | Date | number | ReadonlyArray<string | Date | number>;
|
||||
}
|
||||
|
||||
export default class DatePicker extends Component<DateTimePickerProps> {}
|
||||
|
||||
@@ -1,22 +1,42 @@
|
||||
import flatpickr from 'flatpickr';
|
||||
import * as React from 'react';
|
||||
import DatePicker from 'react-flatpickr';
|
||||
import flatpickr from "flatpickr";
|
||||
import * as React from "react";
|
||||
import DatePicker from "react-flatpickr";
|
||||
|
||||
const noParamsElement = <DatePicker/>;
|
||||
const noParamsElement = <DatePicker />;
|
||||
|
||||
const defaultValueElement = <DatePicker defaultValue={ 'Default value' }/>;
|
||||
const defaultValueElement = <DatePicker defaultValue={"Default value"} />;
|
||||
|
||||
const options = {
|
||||
dateFormat: 'YYYY-MM-DD'
|
||||
dateFormat: "YYYY-MM-DD"
|
||||
};
|
||||
const optionsElement = <DatePicker options={ options }/>;
|
||||
const optionsElement = <DatePicker options={options} />;
|
||||
|
||||
const onChange = (
|
||||
selectedDates: Date[], dateStr: string, instance: flatpickr.Instance,
|
||||
const hook = (
|
||||
selectedDates: Date[],
|
||||
dateStr: string,
|
||||
instance: flatpickr.Instance,
|
||||
elem: HTMLElement
|
||||
) => null;
|
||||
const onChangeElement = <DatePicker onChange={ onChange }/>;
|
||||
const onChangeElement = <DatePicker onChange={hook} />;
|
||||
const onOpenElement = <DatePicker onOpen={hook} />;
|
||||
const onCloseElement = <DatePicker onClose={hook} />;
|
||||
const onMonthChangeElement = <DatePicker onMonthChange={hook} />;
|
||||
const onYearChangeElement = <DatePicker onYearChange={hook} />;
|
||||
const onReadyElement = <DatePicker onReady={hook} />;
|
||||
const onValueUpdateElement = <DatePicker onValueUpdate={hook} />;
|
||||
const onDayCreateElement = <DatePicker onDayCreate={hook} />;
|
||||
|
||||
const valueElement = <DatePicker value={ 'Value' }/>;
|
||||
|
||||
const classNameElement = <DatePicker className={ 'Class name' }/>;
|
||||
const valueStringElement = <DatePicker value={"2018-11-29T18:35:50.115Z"} />;
|
||||
const valueDateElement = <DatePicker value={new Date()} />;
|
||||
const valueNumberElement = <DatePicker value={1543516477474} />;
|
||||
const valueStringArrayElement = (
|
||||
<DatePicker
|
||||
value={["2018-11-29T18:35:50.115Z", "2018-11-29T19:35:50.115Z"]}
|
||||
/>
|
||||
);
|
||||
const valueDateArrayElement = (
|
||||
<DatePicker value={[new Date(), new Date(1543516477474)]} />
|
||||
);
|
||||
const valueNumberArrayElement = (
|
||||
<DatePicker value={[1543516477474, 1544549477474]} />
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user