Skip to content
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

[types/EuiButtonEmpty] add missing isLoading and href props #992

Merged
merged 5 commits into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<a>` tag attributes like `href` ([#992](https://github.com/elastic/eui/pull/992))

**Bug fixes**

Expand Down
21 changes: 13 additions & 8 deletions src/components/button/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/// <reference path="../common.d.ts" />
/// <reference path="../icon/index.d.ts" />

import { SFC, ButtonHTMLAttributes, MouseEventHandler } from 'react';
import { SFC, ButtonHTMLAttributes, AnchorHTMLAttributes, MouseEventHandler } from 'react';

declare module '@elastic/eui' {
type EuiButtonPropsForButtonOrLink<Props> = (
(Props & { onClick: MouseEventHandler<HTMLButtonElement> } & ButtonHTMLAttributes<HTMLButtonElement>) |
(Props & { href: string; onClick: MouseEventHandler<HTMLAnchorElement> } & AnchorHTMLAttributes<HTMLAnchorElement>) |
(Props & AnchorHTMLAttributes<HTMLAnchorElement> & ButtonHTMLAttributes<HTMLButtonElement>)
)

/**
* Normal button type defs
*
Expand All @@ -20,17 +26,16 @@ declare module '@elastic/eui' {
export type ButtonSize = 's' | 'l';

export interface EuiButtonProps {
onClick: MouseEventHandler<HTMLButtonElement>; //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<HTMLButtonElement> & EuiButtonProps
EuiButtonPropsForButtonOrLink<CommonProps & EuiButtonProps>
>;

/**
Expand All @@ -47,15 +52,14 @@ declare module '@elastic/eui' {
| 'text';

export interface EuiButtonIconProps {
onClick: MouseEventHandler<HTMLButtonElement>; //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<HTMLButtonElement> & EuiButtonIconProps
EuiButtonPropsForButtonOrLink<CommonProps & EuiButtonIconProps>
>;

/**
Expand All @@ -80,10 +84,11 @@ declare module '@elastic/eui' {
color?: EmptyButtonColor;
size?: EmptyButtonSizes;
flush?: EmptyButtonFlush;
isLoading?: boolean;
isDisabled?: boolean;
}

export const EuiButtonEmpty: SFC<
CommonProps & ButtonHTMLAttributes<HTMLButtonElement> & EuiButtonEmptyProps
EuiButtonPropsForButtonOrLink<CommonProps & EuiButtonEmptyProps>
>;
}