-
Notifications
You must be signed in to change notification settings - Fork 843
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
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.
Choose a reason for hiding this comment
The 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 onChange
(In fact, we should switch the onChange
propType to be .isRequired
)
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startDateControl
and endDateControl
are required, but the rest are optional
content: React.ReactNode; | ||
} | ||
|
||
export type EuiSuperDatePickerProps = CommonProps & { |
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.
Only onTimeChange
is required (the last 3 should be optional)
@@ -64,7 +64,7 @@ const superDatePickerSource = require('!!raw-loader!./super_date_picker'); | |||
const superDatePickerHtml = renderToHtml(SuperDatePicker); | |||
|
|||
export const DatePickerExample = { | |||
title: 'DatePicker', | |||
title: 'Date Picker', |
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!
@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