Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Fixed and cleaned up TypeScript definitions #675

Merged
merged 1 commit into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 0 additions & 5 deletions src/components/form/field_text/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ declare module '@elastic/eui' {
* @see './field_text.js'
*/
export interface EuiFieldTextProps {
name?: string;
id?: string;
placeholder?: string;
value?: string;
defaultValue?: string;
icon?: string;
isInvalid?: boolean;
inputRef?: (ref: HTMLInputElement) => void;
Expand Down
8 changes: 1 addition & 7 deletions src/components/form/text_area/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@ declare module '@elastic/eui' {
* @see './text_area.js'
*/
export interface EuiTextAreaProps {
id?: string;
name?: string;
placeholder?: string;
rows?: number;
isInvalid?: boolean;
fullWidth?: boolean;
onChange?: (event: any) => void;
value?: string;
defaultValue?: string;
inputRef?: (input: any) => void;
}

export const EuiTextArea: SFC<
CommonProps & TextareaHTMLAttributes & EuiTextAreaProps
CommonProps & TextareaHTMLAttributes<HTMLTextAreaElement> & EuiTextAreaProps
>;
}
3 changes: 1 addition & 2 deletions src/components/horizontal_rule/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="../common.d.ts" />

import { SFC, ReactNode, HTMLAttributes } from 'react';
import { SFC, HTMLAttributes } from 'react';

declare module '@elastic/eui' {

Expand All @@ -15,7 +15,6 @@ declare module '@elastic/eui' {
export type EuiHorizontalRuleMargin = 'none' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';

export interface EuiHorizontalRuleProps {
children?: ReactNode;
size?: EuiHorizontalRuleSize;
margin?: EuiHorizontalRuleMargin;
}
Expand Down
34 changes: 5 additions & 29 deletions src/components/modal/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
/// <reference path="../common.d.ts" />

import { SFC, ReactNode, HTMLAttributes } from 'react';
import { SFC, HTMLAttributes } from 'react';

declare module '@elastic/eui' {

import { HTMLAttributes } from 'react';

/**
* Modal type defs
*
* @see './modal.js'
*/
export interface EuiModalProps {
className?: string;
children?: ReactNode;
onClose: () => void;
}

Expand All @@ -25,52 +21,32 @@ declare module '@elastic/eui' {
/**
* @see './modal_body.js'
*/
export interface EuiModalBodyProps {
className?: string;
children?: ReactNode;
}

export const EuiModalBody: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalBodyProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see './modal_footer.js'
*/
export interface EuiModalFooterProps {
className?: string;
children?: ReactNode;
}

export const EuiModalFooter: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalFooterProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see './modal_header.js'
*/
export interface EuiModalHeaderProps {
className?: string;
children?: ReactNode;
}

export const EuiModalHeader: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalHeaderProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see './modal_header_title.js'
*/
export interface EuiModalHeaderTitleProps {
className?: string;
children?: ReactNode;
}

export const EuiModalHeaderTitle: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalHeaderTitleProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


Expand Down
4 changes: 1 addition & 3 deletions src/components/overlay_mask/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="../common.d.ts" />

import { SFC, ReactNode, HTMLAttributes } from 'react';
import { SFC, HTMLAttributes } from 'react';

declare module '@elastic/eui' {

Expand All @@ -10,8 +10,6 @@ declare module '@elastic/eui' {
* @see './overlay_mask.js'
*/
export interface EuiOverlayMaskProps {
className?: string,
children?: ReactNode,
onClick?: () => void;
}

Expand Down
61 changes: 10 additions & 51 deletions src/components/page/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,39 @@
/// <reference path="../common.d.ts" />
/// <reference path="../panel/index.d.ts" />

import { SFC, ReactNode, HTMLAttributes } from 'react';
import { SFC, HTMLAttributes } from 'react';

declare module '@elastic/eui' {

/**
* @see './page.js'
*/

export interface EuiPageProps {
children?: ReactNode;
}

export const EuiPage: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see ./page_header/page_header.js
*/

export interface EuiPageHeaderProps {
children?: ReactNode;
}

export const EuiPageHeader: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageHeaderProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see ./page_header/page_header_section.js
*/

export interface EuiPageHeaderSectionProps {
children?: ReactNode;
}

export const EuiPageHeaderSection: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageHeaderSectionProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see ./page_body/page_body.js
*/

export namespace EuiPageBody {
export interface Props {
children?: ReactNode;
}
}
export const EuiPageBody: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageBody.Props
CommonProps & HTMLAttributes<HTMLDivElement>
>;


Expand All @@ -66,7 +46,6 @@ declare module '@elastic/eui' {
export type EuiPageContentHorizontalPosition = 'center';

export interface EuiPageContentProps {
children?: ReactNode;
panelPaddingSize?: EuiPageContentPaddingSize;
verticalPosition?: EuiPageContentVerticalPosition;
horizontalPosition?: EuiPageContentHorizontalPosition;
Expand All @@ -80,51 +59,31 @@ declare module '@elastic/eui' {
/**
* @see ./page_content/page_content_body.js
*/

export interface EuiPageContentBodyProps {
children?: ReactNode;
}

export const EuiPageContentBody: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageContentBodyProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see ./page_content/page_content_header.js
*/

export interface EuiPageContentHeaderProps {
children?: ReactNode;
}

export const EuiPageContentHeader: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageContentHeaderProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;


/**
* @see ./page_content/page_content_header_section.js
*/

export interface EuiPageContentHeaderSectionProps {
children?: ReactNode;
}

export const EuiPageContentHeaderSection: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageContentHeaderSectionProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;

/**
* @see ./page_side_bar/page_side_bar.js
*/

export interface EuiPageSideBarProps {
children?: ReactNode;
}

export const EuiPageSideBar: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiPageSideBarProps
CommonProps & HTMLAttributes<HTMLDivElement>
>;

}