From f3a5ec5f4a0718450630275cbd79e69a5df4892e Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 20 Jul 2018 12:22:33 -0400 Subject: [PATCH] Add typings for EuiBadge (#1034) * Add typings for EuiBadge. * Add PR info to CHANGELOG.md * Fix typo in changelog. * Update EuiBadge SFC annotation based on PR feedback. --- CHANGELOG.md | 2 +- src/components/badge/index.d.ts | 23 +++++++++++++++++++++++ src/components/index.d.ts | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/components/badge/index.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 078bc8ff231..f818fcde842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## [`master`](https://github.com/elastic/eui/tree/master) +- Added typings for 'EuiBadge' ([#1034](https://github.com/elastic/eui/pull/1034)) - Added a visual pattern for Kibana's Global Date Picker ([#1026](https://github.com/elastic/eui/pull/1026)) - Added `responsive` prop to `EuiFlexGrid` ([#1026](https://github.com/elastic/eui/pull/1026)) - Added `expand` prop to `EuiTabs` and `EuiTabbedContent` ([#1026](https://github.com/elastic/eui/pull/1026)) @@ -13,7 +14,6 @@ - To make it more accessible, added a random id to `EuiSwitch`'s id prop if none is passed. ([#779](https://github.com/elastic/eui/pull/779)) - ## [`3.1.0`](https://github.com/elastic/eui/tree/v3.1.0) - Added `EuiMutationObserver` to expose Mutation Observer API to React components ([#966](https://github.com/elastic/eui/pull/966)) diff --git a/src/components/badge/index.d.ts b/src/components/badge/index.d.ts new file mode 100644 index 00000000000..a4feee62569 --- /dev/null +++ b/src/components/badge/index.d.ts @@ -0,0 +1,23 @@ +/// + +import { HTMLAttributes, MouseEventHandler } from 'react'; + +declare module '@elastic/eui' { + + type IconSide = 'left'; + + export interface EuiBadgeProps { + iconType?: IconType; + iconSide?: IconSide; + iconOnClick?: MouseEventHandler; + iconOnClickAriaLabel?: string; + onClick?: MouseEventHandler; + onClickAriaLabel?: string; + color?: string; + closeButtonProps?: Object; + } + + export const EuiBadge: SFC< + CommonProps & HTMLAttributes & HTMLAttributes & EuiBadgeProps + >; +} diff --git a/src/components/index.d.ts b/src/components/index.d.ts index b34302413fa..6a985d717d8 100644 --- a/src/components/index.d.ts +++ b/src/components/index.d.ts @@ -24,3 +24,4 @@ /// /// /// +///