Add TypeScript definitions for EuiRange and EuiRadio#1253
Conversation
Also correct the definitions for EuiRadioGroup.
|
|
||
| export type EuiRadioGroupProps = CommonProps & | ||
| Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> & { | ||
| disabled?: boolean; |
There was a problem hiding this comment.
Please add disabled and name to the radio group's proptypes as well, so they're included in the documentation & runtime checks.
| } | ||
|
|
||
| export const EuiRadio: SFC< | ||
| CommonProps & InputHTMLAttributes<HTMLInputElement> & EuiRadioProps |
There was a problem hiding this comment.
EuiRadio applies its extra props to a div, not any kind of input. The props here need to reflect that with HTMLAttributes<HTMLDivElement>. This also means the input-related props (checked, value, disabled, autoFocus) on EuiRadio need to be added to EuiRadioProps. The onChange definition is correct as-is (other than not being an override after the other changes), because it is forwarded to the underlying input.
| showTicks?: boolean; | ||
| showValue?: boolean; | ||
| tickInterval?: number; | ||
| } |
There was a problem hiding this comment.
min and max are required in EuiRange but are optional in InputHTMLAttributes, so they must be overridden here. Also, our definition & usage of step requires it to be a number, whereas InputHTMLAttributes allows number or string values, so step requires an override too.
|
@chandlerprall I believe I've addressed all your comments. Please take another look. |
Add TypeScript definitions for
EuiRangeandEuiRadio, and correct the definitions forEuiRadioGroup.