diff --git a/CHANGELOG.md b/CHANGELOG.md index d83dc30eaaa..d3f78cb3269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Added beta version of `EuiXYChart` and associated components ([#309](https://github.com/elastic/eui/pull/309)) - Added `size` prop to `EuiIconTip` ([987](https://github.com/elastic/eui/pull/987)) - Added `database`, `filter`, `globe`, and `save` icons ([990](https://github.com/elastic/eui/pull/990)) +- Updated typings for `EuiButton`, `EuiButtonEmpty`, and `EuiButtonIcon` to include `` tag attributes like `href` ([#992](https://github.com/elastic/eui/pull/992)) **Bug fixes** diff --git a/src/components/button/index.d.ts b/src/components/button/index.d.ts index 74785e7ca88..a67acfe3b1b 100644 --- a/src/components/button/index.d.ts +++ b/src/components/button/index.d.ts @@ -1,9 +1,15 @@ /// /// -import { SFC, ButtonHTMLAttributes, MouseEventHandler } from 'react'; +import { SFC, ButtonHTMLAttributes, AnchorHTMLAttributes, MouseEventHandler } from 'react'; declare module '@elastic/eui' { + type EuiButtonPropsForButtonOrLink = ( + (Props & { onClick: MouseEventHandler } & ButtonHTMLAttributes) | + (Props & { href: string; onClick: MouseEventHandler } & AnchorHTMLAttributes) | + (Props & AnchorHTMLAttributes & ButtonHTMLAttributes) + ) + /** * Normal button type defs * @@ -20,17 +26,16 @@ declare module '@elastic/eui' { export type ButtonSize = 's' | 'l'; export interface EuiButtonProps { - onClick: MouseEventHandler; //overriding DOMAttributes to make this required iconType?: IconType; iconSide?: ButtonIconSide; fill?: boolean; color?: ButtonColor; size?: ButtonSize; + isLoading?: boolean; isDisabled?: boolean; } - export const EuiButton: SFC< - CommonProps & ButtonHTMLAttributes & EuiButtonProps + EuiButtonPropsForButtonOrLink >; /** @@ -47,15 +52,14 @@ declare module '@elastic/eui' { | 'text'; export interface EuiButtonIconProps { - onClick: MouseEventHandler; //overriding DOMAttributes to make this required iconType?: IconType; color?: ButtonIconColor; - isDisabled?: boolean; 'aria-label'?: string; 'aria-labelledby'?: string; + isDisabled?: boolean; } export const EuiButtonIcon: SFC< - CommonProps & ButtonHTMLAttributes & EuiButtonIconProps + EuiButtonPropsForButtonOrLink >; /** @@ -80,10 +84,11 @@ declare module '@elastic/eui' { color?: EmptyButtonColor; size?: EmptyButtonSizes; flush?: EmptyButtonFlush; + isLoading?: boolean; isDisabled?: boolean; } export const EuiButtonEmpty: SFC< - CommonProps & ButtonHTMLAttributes & EuiButtonEmptyProps + EuiButtonPropsForButtonOrLink >; }