Add rough TS types and some doc updates for the Date Picker components#1574
Conversation
|
Now that I just saw #1557 ... I can probably pretty easily take a stab at doing the real TS conversions for those 4 lower level components in this directory next week. |
| refreshInterval: number; | ||
| } | ||
|
|
||
| export type EuiDatePickerProps = CommonProps & { |
There was a problem hiding this comment.
Comparing the DefinitelyTyped defs and our component's propTypes, all of these should be optional except for onChange (In fact, we should switch the onChange propType to be .isRequired)
There was a problem hiding this comment.
Ha, yeah I just forgot to keep adding those ?, good call
|
|
||
| export const EuiDatePicker: React.SFC<EuiDatePickerProps>; | ||
|
|
||
| export type EuiDatePickerRangeProps = CommonProps & { |
There was a problem hiding this comment.
startDateControl and endDateControl are required, but the rest are optional
| content: React.ReactNode; | ||
| } | ||
|
|
||
| export type EuiSuperDatePickerProps = CommonProps & { |
There was a problem hiding this comment.
Only onTimeChange is required (the last 3 should be optional)
|
|
||
| export const DatePickerExample = { | ||
| title: 'DatePicker', | ||
| title: 'Date Picker', |
|
@thompsongl these should all be optional now, do you think the ones that I commented on as not being sure are correct look ok based on DT? |
|
@jasonrhodes Thanks! |
|
|
|
Talked to @chandlerprall a bit in Slack and realized we are spreading |
|
@jasonrhodes Don't forget a changelog entry |
elastic#1574) * Updates docs so datepicker becomes date picker * Adds type file for date picker components * Revert aggressive auto-formatting changes from previous commit * Makes props optional in new types * Improves types for eui date picker * Locks react date picker types to the correct version * Adds entry to changelog and reference path to components index
Summary
Hey, I noticed there were no type defs for any of the date picker components. I'm only familiar with the Super Date Picker but I tried to do types for all three of the main components I saw in this directory. Feel free to fix/suggest changes/etc because with some of these things:
I also tried to make the wording consistent in the docs for "date picker", re: what I saw from Gail in Slack, it should always be "date picker" and not "Datepicker" etc.
Checklist
[ ] This was checked in mobile[ ] This was checked in IE11[ ] This was checked in dark mode[ ] Any props added have proper autodocs[ ] This was checked for breaking changes and labeled appropriately[ ] Jest tests were updated or added to match the most common scenarios[ ] This was checked against keyboard-only and screenreader scenarios[ ] This required updates to Framer X components