-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rough TS types and some doc updates for the Date Picker components #1574
Changes from 3 commits
c53c078
54759c1
f98466f
9a2d9bb
ebe7fde
743138c
29f6410
7689f3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React from 'react'; | ||
import { CommonProps } from '../common'; | ||
import { Moment } from 'moment'; | ||
import { IconType } from '../icon'; | ||
|
||
declare module '@elastic/eui' { | ||
interface OnTimeChangeProps { | ||
start: string; | ||
end: string; | ||
isInvalid: boolean; | ||
isQuickSelection: boolean; | ||
} | ||
|
||
interface OnRefreshChangeProps { | ||
isPaused: boolean; | ||
refreshInterval: number; | ||
} | ||
|
||
export type EuiDatePickerProps = CommonProps & { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comparing the DefinitelyTyped defs and our component's propTypes, all of these should be optional except for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha, yeah I just forgot to keep adding those |
||
calendarClassName?: string; | ||
customInput?: React.ReactNode; | ||
dateFormat?: string; | ||
// not sure if this is correct | ||
dayClassName?: (date: Moment) => string | undefined; | ||
// not sure if this is correct | ||
filterDates?: Moment[]; | ||
fullWidth?: boolean; | ||
// not sure if this is correct | ||
injectTimes?: Moment[]; | ||
// not sure what this generic value should be? | ||
inputRef: React.Ref<HTMLInputElement>; | ||
isInvalid: boolean; | ||
isLoading: boolean; | ||
locale: string; | ||
maxDate: Moment; | ||
maxTime: Moment; | ||
minDate: Moment; | ||
minTime: Moment; | ||
// pulled from react-datepickeer definitely typed | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-datepicker/index.d.ts#L68 | ||
onChange( | ||
date: Date | null, | ||
event: React.SyntheticEvent<any> | undefined | ||
): void; | ||
openToDate: Moment; | ||
placeholder: string; | ||
popperClassName: string; | ||
selected: Moment; | ||
shadow: boolean; | ||
shouldCloseOnSelect: boolean; | ||
showIcon: boolean; | ||
showTimeSelect: boolean; | ||
showTimeSelectOnly: boolean; | ||
timeFormat: string; | ||
}; | ||
|
||
export const EuiDatePicker: React.SFC<EuiDatePickerProps>; | ||
|
||
export type EuiDatePickerRangeProps = CommonProps & { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
startDateControl: typeof EuiDatePicker; | ||
endDateControl: typeof EuiDatePicker; | ||
iconType: boolean | IconType; | ||
fullWidth: boolean; | ||
isCustom: boolean; | ||
}; | ||
|
||
export const EuiDatePickerRange: React.SFC<EuiDatePickerRangeProps>; | ||
|
||
export interface EuiSuperDatePickerCommonRange { | ||
start: string; | ||
end: string; | ||
label: string; | ||
} | ||
|
||
export interface EuiSuperDatePickerRecentRange { | ||
start: string; | ||
end: string; | ||
} | ||
|
||
export interface EuiSuperDatePickerQuickSelectPanel { | ||
title: string; | ||
content: React.ReactNode; | ||
} | ||
|
||
export type EuiSuperDatePickerProps = CommonProps & { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only |
||
start?: string; | ||
end?: string; | ||
isPaused?: boolean; | ||
refreshInterval?: number; | ||
onTimeChange: (props: OnTimeChangeProps) => void; | ||
onRefreshChange?: (props: OnRefreshChangeProps) => void; | ||
commonlyUsedRanges?: EuiSuperDatePickerCommonRange[]; | ||
dateFormat?: string; | ||
recentlyUsedRanges?: EuiSuperDatePickerRecentRange[]; | ||
showUpdateButton: boolean; | ||
isAutoRefreshOnly: boolean; | ||
customQuickSelectPanels: EuiSuperDatePickerQuickSelectPanel[]; | ||
}; | ||
|
||
export const EuiSuperDatePicker: React.SFC<EuiSuperDatePickerProps>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these!