From bf0a6cea9226050c30310a47fd84b6d90aee914e Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 6 Aug 2018 23:51:55 -0400 Subject: [PATCH] Add typings for EuiToolTip and EuiIconTip (#1087) * Add typings to EuiToolTip and EuiIconTip, and fix docs typo. * Add PR info to changelog. * Rename type for PropTypes. * Update type name to correspond with associated types. --- CHANGELOG.md | 1 + .../src/views/tool_tip/tool_tip_example.js | 2 +- src/components/index.d.ts | 1 + src/components/tool_tip/index.d.ts | 27 +++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/components/tool_tip/index.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ff8150556d..e04188b8b50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## [`master`](https://github.com/elastic/eui/tree/master) +- Added typings for `EuiToolTip` and `EuiIconTip` ([#1087](https://github.com/elastic/eui/pull/1087)) - Added `spacesApp` logo to `EuiIcon` set ([#1065](https://github.com/elastic/eui/pull/1065)) - Added `!default` to border SASS props ([#1079](https://github.com/elastic/eui/pull/1079)) - Added `repositionOnScroll` prop to `EuiPopover` which enables repositioning the popover when the window is scrolled. ([#1064](https://github.com/elastic/eui/pull/1064)) diff --git a/src-docs/src/views/tool_tip/tool_tip_example.js b/src-docs/src/views/tool_tip/tool_tip_example.js index 78f6090e8d3..afc54fc5bd1 100644 --- a/src-docs/src/views/tool_tip/tool_tip_example.js +++ b/src-docs/src/views/tool_tip/tool_tip_example.js @@ -44,7 +44,7 @@ export const ToolTipExample = { The position prop will take a suggested position, but will change it if the tool tip gets too close to the edge of the screen. You can use the clickOnly prop to tell the too tip to only appear on click - wrather than on hover. + rather than on hover. diff --git a/src/components/index.d.ts b/src/components/index.d.ts index e5ab5750f6f..9fc64226f94 100644 --- a/src/components/index.d.ts +++ b/src/components/index.d.ts @@ -26,3 +26,4 @@ /// /// /// +/// diff --git a/src/components/tool_tip/index.d.ts b/src/components/tool_tip/index.d.ts new file mode 100644 index 00000000000..0ae40a15bfa --- /dev/null +++ b/src/components/tool_tip/index.d.ts @@ -0,0 +1,27 @@ +import { ReactElement, ReactNode, SFC } from 'react'; + +declare module '@elastic/eui' { + export type ToolTipPositions = + | 'top' + | 'right' + | 'bottom' + | 'left'; + + export interface EuiToolTipProps { + children: ReactElement; + className?: string; + content: ReactNode; + title?: ReactNode; + id?: string; + position?: ToolTipPositions; + } + export const EuiToolTip: SFC; + + export interface EuiIconTipProps { + color?: string; + type?: string; + size?: string; + 'aria-label'?: string; + } + export const EuiIconTip: SFC; +}