diff --git a/CHANGELOG.md b/CHANGELOG.md index 321db57d9ae..c163e593fd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [`master`](https://github.com/elastic/eui/tree/master) -No public interface changes since `4.8.0`. +**Bug fixes** +- Added TypeScript definitions for tab components ([#1288](https://github.com/elastic/eui/pull/1288)) ## [`4.8.0`](https://github.com/elastic/eui/tree/v4.8.0) diff --git a/src/components/tabs/index.d.ts b/src/components/tabs/index.d.ts new file mode 100644 index 00000000000..f259d2b8c96 --- /dev/null +++ b/src/components/tabs/index.d.ts @@ -0,0 +1,37 @@ +/// + +declare module '@elastic/eui' { + import { MouseEventHandler, ReactNode, SFC, HTMLAttributes } from 'react'; + + type TAB_SIZES = 's' | 'm'; + + type EuiTabProps = { + onClick: MouseEventHandler; + isSelected?: boolean; + disabled?: boolean; + }; + + type EuiTabsProps = { + size?: TAB_SIZES; + expand?: boolean; + }; + + export interface EuiTabbedContentTab { + id: string; + name: string; + content: ReactNode; + } + + type EuiTabbedContentProps = { + tabs: EuiTabbedContentTab[]; + onTabClick?: (tab: EuiTabbedContentTab) => void; + selectedTab?: EuiTabbedContentTab; + initialSelectedTab?: EuiTabbedContentTab; + size?: TAB_SIZES; + expand?: boolean; + } + + export const EuiTab: SFC>; + export const EuiTabs: SFC>; + export const EuiTabbedContent: SFC>; +} diff --git a/src/components/text/index.d.ts b/src/components/text/index.d.ts index 990c4b8a79a..79056140eb6 100644 --- a/src/components/text/index.d.ts +++ b/src/components/text/index.d.ts @@ -9,7 +9,7 @@ declare module '@elastic/eui' { * @see './text.js' * @see './text_color.js' */ - type SIZES = 's' | 'xs'; + type TEXT_SIZES = 's' | 'xs'; type COLORS = | 'default' @@ -22,7 +22,7 @@ declare module '@elastic/eui' { type EuiTextProps = CommonProps & HTMLAttributes & { - size?: SIZES; + size?: TEXT_SIZES; color?: COLORS; grow?: boolean; };