-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add types for EuiEmptyPrompt, EuiCode(Block), EuiCallOut (#1010)
This PR adds type definitions for the `<EuiEmptyPrompt>`, `<EuiCode>`, `<EuiCodeBlock>`, and `<EuiCallOut>`. All components are pretty straight forward.
- Loading branch information
Spencer
authored
Jul 13, 2018
1 parent
7aa94ce
commit cde4c1b
Showing
5 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path="../common.d.ts" /> | ||
/// <reference path="../icon/index.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* EuiCallOut type defs | ||
* | ||
* @see './code.js' | ||
*/ | ||
|
||
type Color = 'primary' | 'success' | 'warning' | 'danger'; | ||
type Size = 's' | 'm'; | ||
|
||
export interface EuiCallOutProps { | ||
title?: ReactNode, | ||
iconType?: IconType, | ||
color?: Color, | ||
size?: Size, | ||
} | ||
|
||
export const EuiCallOut: SFC< | ||
CommonProps & EuiCallOutProps & Omit<HTMLAttributes<HTMLDivElement>, 'title'> | ||
>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { SFC, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
type FontSize = 's' | 'm' | 'l'; | ||
type PaddingSize = 'none' | 's' | 'm' | 'l'; | ||
|
||
// there isn't a specific type for the <code> element, and MDN | ||
// says that it only supports the HTMLElement interface | ||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code | ||
type HTMLCodeElement = HTMLElement | ||
|
||
interface EuiCodeSharedProps { | ||
paddingSize?: PaddingSize; | ||
|
||
/** | ||
* Sets the syntax highlighting for a specific language | ||
* See http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#language-names-and-aliases | ||
* for options | ||
*/ | ||
language?: string; | ||
|
||
overflowHeight?: number; | ||
fontSize?: FontSize; | ||
transparentBackground?: boolean; | ||
} | ||
|
||
|
||
/** | ||
* EuiCode type defs | ||
* | ||
* @see './code.js' | ||
*/ | ||
|
||
export interface EuiCodeProps extends EuiCodeSharedProps { | ||
inline?: true | ||
} | ||
|
||
export const EuiCode: SFC< | ||
CommonProps & EuiCodeProps & HTMLAttributes<HTMLCodeElement> | ||
>; | ||
|
||
/** | ||
* EuiCodeBlock type defs | ||
* | ||
* @see './code_block.js' | ||
*/ | ||
|
||
export interface EuiCodeBlockProps extends EuiCodeSharedProps { | ||
inline?: false | ||
} | ||
|
||
export const EuiCodeBlock: SFC< | ||
CommonProps & EuiCodeBlockProps & HTMLAttributes<HTMLCodeElement> | ||
>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference path="../common.d.ts" /> | ||
/// <reference path="../icon/index.d.ts" /> | ||
/// <reference path="../title/index.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* EuiEmptyPrompt type defs | ||
* | ||
* @see './empty_prompt.js' | ||
*/ | ||
|
||
export interface EuiEmptyPromptProps { | ||
iconType?: IconType; | ||
iconColor?: IconColor; | ||
title?: ReactNode; | ||
titleSize?: EuiTitleSize; | ||
body?: ReactNode; | ||
actions?: ReactNode; | ||
} | ||
|
||
export const EuiEmptyPrompt: SFC< | ||
CommonProps & EuiEmptyPromptProps & Omit<HTMLAttributes<HTMLDivElement>, 'title'> | ||
>; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters