From 45763d3bda1b496a361f2546c30f337d89e3811c Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Sun, 5 Aug 2018 13:06:48 -0400 Subject: [PATCH 1/4] Add typings to EuiToolTip and EuiIconTip, and fix docs typo. --- 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 b2bc4f10e4d..51689310bc8 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` ([PR NUM](PR URL)) - 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)) 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..8582e994430 --- /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 PositionsToClassNameMap = + | 'top' + | 'right' + | 'bottom' + | 'left'; + + export interface EuiToolTipProps { + children: ReactElement; + className?: string; + content: ReactNode; + title?: ReactNode; + id?: string; + position?: PositionsToClassNameMap; + } + export const EuiToolTip: SFC; + + export interface EuiIconTipProps { + color?: string; + type?: string; + size?: string; + 'aria-label'?: string; + } + export const EuiIconTip: SFC; +} From 0cc78ee33724296996a610416c482a77503ed768 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Sun, 5 Aug 2018 13:16:30 -0400 Subject: [PATCH 2/4] Add PR info to changelog. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51689310bc8..fd6efd8c825 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## [`master`](https://github.com/elastic/eui/tree/master) -- Added typings for `EuiToolTip` and `EuiIconTip` ([PR NUM](PR URL)) +- 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)) From b8f6924143ccd62438d4e43d861887adc851cbb1 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 6 Aug 2018 13:06:09 -0400 Subject: [PATCH 3/4] Rename type for PropTypes. --- src/components/tool_tip/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/tool_tip/index.d.ts b/src/components/tool_tip/index.d.ts index 8582e994430..0d10a8929c4 100644 --- a/src/components/tool_tip/index.d.ts +++ b/src/components/tool_tip/index.d.ts @@ -1,7 +1,7 @@ import { ReactElement, ReactNode, SFC } from 'react'; declare module '@elastic/eui' { - export type PositionsToClassNameMap = + export type TooltipPositions = | 'top' | 'right' | 'bottom' @@ -13,7 +13,7 @@ declare module '@elastic/eui' { content: ReactNode; title?: ReactNode; id?: string; - position?: PositionsToClassNameMap; + position?: TooltipPositions; } export const EuiToolTip: SFC; From 54f899ba9fa0c3722195e6e630a86747cfef73ac Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Mon, 6 Aug 2018 13:09:00 -0400 Subject: [PATCH 4/4] Update type name to correspond with associated types. --- src/components/tool_tip/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/tool_tip/index.d.ts b/src/components/tool_tip/index.d.ts index 0d10a8929c4..0ae40a15bfa 100644 --- a/src/components/tool_tip/index.d.ts +++ b/src/components/tool_tip/index.d.ts @@ -1,7 +1,7 @@ import { ReactElement, ReactNode, SFC } from 'react'; declare module '@elastic/eui' { - export type TooltipPositions = + export type ToolTipPositions = | 'top' | 'right' | 'bottom' @@ -13,7 +13,7 @@ declare module '@elastic/eui' { content: ReactNode; title?: ReactNode; id?: string; - position?: TooltipPositions; + position?: ToolTipPositions; } export const EuiToolTip: SFC;