-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add typedefs for EuiAvatar component and color service (#1120)
This PR adds typedefs for the following: - `EuiAvatar` component - `color` service
- Loading branch information
Showing
5 changed files
with
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { HTMLAttributes, SFC } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
|
||
export type AvatarSize = 's' | 'm' | 'l' | 'xl'; | ||
|
||
export type AvatarType = 'user' | 'space'; | ||
|
||
export interface EuiAvatarProps { | ||
name: string; | ||
color?: string; | ||
initials?: string; | ||
initialsLength?: number; | ||
className?: string; | ||
imageUrl?: string; | ||
size?: AvatarSize; | ||
type?: AvatarType; | ||
} | ||
|
||
export const EuiAvatar: SFC< | ||
CommonProps & HTMLAttributes<HTMLDivElement> & EuiAvatarProps | ||
>; | ||
} |
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,16 @@ | ||
|
||
declare module '@elastic/eui' { | ||
export const VISUALIZATION_COLORS: string[]; | ||
|
||
export const DEFAULT_VISUALIZATION_COLOR: string; | ||
|
||
type rgbDef = [number, number, number]; | ||
|
||
export const hexToRbg: (hex: string) => rgbDef; | ||
export const rgbToHex: (rgb: string) => string; | ||
|
||
export const isColorDark: (red: number, green: number, blue: number) => boolean; | ||
|
||
export const calculateLuminance: (red: number, green: number, blue: number) => number; | ||
export const calculateContrast: (rgb1: rgbDef, rgb2: rgbDef) => number; | ||
} |
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,3 +1,4 @@ | ||
/// <reference path="./alignment.d.ts" /> | ||
/// <reference path="./key_codes.d.ts" /> | ||
/// <reference path="./color/index.d.ts" /> | ||
/// <reference path="./popover/index.d.ts" /> |