Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/components/avatar/index.d.ts
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
>;
}
1 change: 1 addition & 0 deletions src/components/form/field_search/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ declare module '@elastic/eui' {
isInvalid?: boolean;
fullWidth?: boolean;
isLoading?: boolean;
incremental?: boolean;
}

export const EuiFieldSearch: SFC<
Expand Down
1 change: 1 addition & 0 deletions src/components/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference path="./common.d.ts" />
/// <reference path="./avatar/index.d.ts" />
/// <reference path="./button/index.d.ts" />
/// <reference path="./context_menu/index.d.ts" />
/// <reference path="./flex/index.d.ts" />
Expand Down
16 changes: 16 additions & 0 deletions src/services/color/index.d.ts
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 rbgToHex: (rbg: string) => string;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(rbg: rgbDef) => string; ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the function correctly (https://github.com/legrego/eui/blob/typedef-updates/src/services/color/rgb_to_hex.js#L2), rbgToHex accepts a string, rather than an array of numbers.

I did transpose rgb into rbg by mistake, so I'll fix that now.


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;
}
1 change: 1 addition & 0 deletions src/services/index.d.ts
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" />