DefinitelyTyped/types/react-flatpickr/index.d.ts
doniyor2109 dce45b7f52 React flatpickr/add render prop (#36215)
* Add render prop to DateTimePickerProps

This prop was added in v3.8.0 version of react-flatpickr https://github.com/haoxins/react-flatpickr/releases/tag/v3.8.0.
Render prop was added in this PR https://github.com/haoxins/react-flatpickr/pull/90

* Add contributor name

* Fix lint errors

* Bump version to 3.8
2019-06-18 10:05:17 -07:00

32 lines
1.4 KiB
TypeScript

// Type definitions for react-flatpickr 3.8
// Project: https://github.com/coderhaoxin/react-flatpickr
// Definitions by: begincalendar <https://github.com/begincalendar>
// snaveevans <https://github.com/snaveevans>
// rigothedev <https://github.com/rigothedev>
// doniyor2109 <https://github.com/doniyor2109>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { Component, ReactElement } from "react";
import flatpickr from "flatpickr";
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export interface DateTimePickerProps extends Omit<Partial<HTMLInputElement>, 'value'> {
defaultValue?: string;
options?: flatpickr.Options.Options;
onChange?: flatpickr.Options.Hook;
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>;
className?: string;
render?: (props: Omit<DateTimePickerProps, 'options' | 'render'>, ref: (node: HTMLInputElement) => void) => ReactElement;
}
export default class DatePicker extends Component<DateTimePickerProps> {}