-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TypeScript types for portal, text, title components, popover serv…
…ice (#638)
- Loading branch information
1 parent
8a675fc
commit 69f7c07
Showing
7 changed files
with
100 additions
and
0 deletions.
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
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,14 @@ | ||
declare module '@elastic/eui' { | ||
import { SFC } from 'react'; | ||
|
||
/** | ||
* portal type defs | ||
* | ||
* @see './portal.js' | ||
*/ | ||
type EuiPortalProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const EuiPortal: SFC<EuiPortalProps>; | ||
} |
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,30 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
declare module '@elastic/eui' { | ||
import { SFC, HTMLAttributes } from 'react'; | ||
|
||
/** | ||
* text type defs | ||
* | ||
* @see './text.js' | ||
* @see './text_color.js' | ||
*/ | ||
type EuiTextSize = 's' | 'xs'; | ||
|
||
type EuiTextColor = | ||
| 'default' | ||
| 'subdued' | ||
| 'secondary' | ||
| 'accent' | ||
| 'danger' | ||
| 'warning' | ||
| 'ghost'; | ||
|
||
type EuiTextProps = CommonProps & | ||
HTMLAttributes<HTMLDivElement> & { | ||
size?: EuiTextSize; | ||
color?: EuiTextColor; | ||
}; | ||
|
||
export const EuiText: SFC<EuiTextProps>; | ||
} |
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,22 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
declare module '@elastic/eui' { | ||
import { SFC } from 'react'; | ||
|
||
/** | ||
* title type defs | ||
* | ||
* @see './title.js' | ||
*/ | ||
|
||
type EuiTitleSize = 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l'; | ||
|
||
type EuiTitleTextTransform = 'uppercase'; | ||
|
||
type EuiTitleProps = CommonProps & { | ||
size?: EuiTitleSize; | ||
textTransform?: EuiTitleTextTransform; | ||
}; | ||
|
||
export const EuiTitle: SFC<EuiTitleProps>; | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
/// <reference path="./alignment.d.ts" /> | ||
/// <reference path="./popover/index.d.ts" /> |
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,29 @@ | ||
declare module '@elastic/eui' { | ||
type EuiToolTipPosition = 'top' | 'right' | 'bottom' | 'left'; | ||
|
||
type EuiPopoverAnchorRect = { | ||
top: number; | ||
left: number; | ||
width: number; | ||
height: number; | ||
}; | ||
|
||
type EuiPopoverDimensions = { | ||
width: number; | ||
height: number; | ||
}; | ||
|
||
export const calculatePopoverPosition: ( | ||
anchorBounds: EuiPopoverAnchorRect, | ||
popoverBounds: EuiPopoverDimensions, | ||
requestedPosition: EuiToolTipPosition, | ||
buffer?: number, | ||
positions?: EuiToolTipPosition[] | ||
) => { | ||
top: number; | ||
left: number; | ||
width: number; | ||
height: number; | ||
position: EuiToolTipPosition; | ||
}; | ||
} |