fix: improve types

This commit is contained in:
Chi Vinh Le
2018-10-17 15:48:06 +02:00
parent 847d5d0ea9
commit 6f51f68776
2 changed files with 24 additions and 15 deletions
@@ -1,5 +1,11 @@
import cn from "classnames";
import React, { EventHandler, FocusEvent, MouseEvent, Ref } from "react";
import React, {
EventHandler,
FocusEvent,
MouseEvent,
Ref,
TouchEvent,
} from "react";
import { ButtonHTMLAttributes, StatelessComponent } from "react";
import {
@@ -24,20 +30,22 @@ interface InnerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
*/
classes: typeof styles;
/** This is passed by the `withKeyboardFocus` HOC */
keyboardFocus: boolean;
/** This is passed by the `withMouseHover` HOC */
mouseHover?: boolean;
/** Internal: Forwarded Ref */
forwardRef?: Ref<HTMLButtonElement>;
type?: "submit" | "reset" | "button";
// These handlers are passed down by the `withMouseHover` HOC.
mouseHover: boolean;
onMouseOver: React.EventHandler<MouseEvent<HTMLElement>>;
onMouseOut: React.EventHandler<MouseEvent<HTMLElement>>;
onTouchEnd: React.EventHandler<TouchEvent<HTMLElement>>;
// These handlers are passed down by the `withKeyboardFocus` HOC.
onFocus: EventHandler<FocusEvent<HTMLElement>>;
onBlur: EventHandler<FocusEvent<HTMLElement>>;
onMouseDown: EventHandler<MouseEvent<HTMLElement>>;
keyboardFocus: boolean;
}
/**
@@ -13,35 +13,36 @@ import Icon from "../Icon";
import * as styles from "./SelectField.css";
export interface SelectFieldProps {
id?: string;
autofocus?: boolean;
/**
* Name
*/
name?: string;
/**
* Value that has been selected.
*/
value?: string;
/**
* Convenient prop to override the root styling.
*/
className?: string;
/**
* Override or extend the styles applied to the component.
*/
classes: typeof styles;
/*
* If set renders a full width button
*/
fullWidth?: boolean;
id?: string;
autofocus?: boolean;
name?: string;
onChange?: EventHandler<ChangeEvent<HTMLSelectElement>>;
disabled?: boolean;
// These handlers are passed down by the `withKeyboardFocus` HOC.
onFocus: EventHandler<FocusEvent<HTMLSelectElement>>;
onBlur: EventHandler<FocusEvent<HTMLSelectElement>>;
onMouseDown: EventHandler<MouseEvent<HTMLSelectElement>>;
disabled?: boolean;
keyboardFocus: boolean;
}