-
Notifications
You must be signed in to change notification settings - Fork 841
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] Updated existing and added additional TypeScript definitions #666
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference path="../../common.d.ts" /> | ||
|
||
import { SFC, InputHTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
|
||
/** | ||
* text field type defs | ||
* | ||
* @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; | ||
fullWidth?: boolean; | ||
isLoading?: boolean; | ||
} | ||
|
||
export const EuiFieldText: SFC< | ||
CommonProps & InputHTMLAttributes<HTMLInputElement> & EuiFieldTextProps | ||
>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
/// <reference path="./checkbox/index.d.ts" /> | ||
/// <reference path="./field_text/index.d.ts" /> | ||
/// <reference path="./field_search/index.d.ts" /> | ||
/// <reference path="./form_row/index.d.ts" /> | ||
/// <reference path="./radio/index.d.ts" /> | ||
/// <reference path="./switch/index.d.ts" /> | ||
/// <reference path="./text_area/index.d.ts" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path="../../common.d.ts" /> | ||
|
||
import { SFC, TextareaHTMLAttributes } from 'react'; | ||
|
||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The properties |
||
inputRef?: (input: any) => void; | ||
} | ||
|
||
export const EuiTextArea: SFC< | ||
CommonProps & TextareaHTMLAttributes & EuiTextAreaProps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that |
||
>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
|
||
/** | ||
* EuiHorizontalRule type defs | ||
* | ||
* @see './horizontal_rule.js' | ||
*/ | ||
|
||
export type EuiHorizontalRuleSize = 'full' | 'half' | 'quarter'; | ||
|
||
export type EuiHorizontalRuleMargin = 'none' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'; | ||
|
||
export interface EuiHorizontalRuleProps { | ||
children?: ReactNode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
size?: EuiHorizontalRuleSize; | ||
margin?: EuiHorizontalRuleMargin; | ||
} | ||
|
||
export const EuiHorizontalRule: SFC< | ||
CommonProps & HTMLAttributes<HTMLHRElement> & EuiHorizontalRuleProps | ||
>; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
|
||
import { HTMLAttributes } from 'react'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imports in module augmentations are not allowed. `HTMLAttributes' is already being imported in line 3. |
||
|
||
/** | ||
* Modal type defs | ||
* | ||
* @see './modal.js' | ||
*/ | ||
export interface EuiModalProps { | ||
className?: string; | ||
children?: ReactNode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The properties |
||
onClose: () => void; | ||
} | ||
|
||
export const EuiModal: SFC< | ||
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalProps | ||
>; | ||
|
||
|
||
/** | ||
* @see './modal_body.js' | ||
*/ | ||
export interface EuiModalBodyProps { | ||
className?: string; | ||
children?: ReactNode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These properties are already defined in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall I still keep the empty |
||
} | ||
|
||
export const EuiModalBody: SFC< | ||
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalBodyProps | ||
>; | ||
|
||
|
||
/** | ||
* @see './modal_footer.js' | ||
*/ | ||
export interface EuiModalFooterProps { | ||
className?: string; | ||
children?: ReactNode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These properties are already defined in |
||
} | ||
|
||
export const EuiModalFooter: SFC< | ||
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalFooterProps | ||
>; | ||
|
||
|
||
/** | ||
* @see './modal_header.js' | ||
*/ | ||
export interface EuiModalHeaderProps { | ||
className?: string; | ||
children?: ReactNode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These properties are already defined in |
||
} | ||
|
||
export const EuiModalHeader: SFC< | ||
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalHeaderProps | ||
>; | ||
|
||
|
||
/** | ||
* @see './modal_header_title.js' | ||
*/ | ||
export interface EuiModalHeaderTitleProps { | ||
className?: string; | ||
children?: ReactNode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These properties are already defined in |
||
} | ||
|
||
export const EuiModalHeaderTitle: SFC< | ||
CommonProps & HTMLAttributes<HTMLDivElement> & EuiModalHeaderTitleProps | ||
>; | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
|
||
/** | ||
* EuiOverlayMask type defs | ||
* | ||
* @see './overlay_mask.js' | ||
*/ | ||
export interface EuiOverlayMaskProps { | ||
className?: string, | ||
children?: ReactNode, | ||
onClick?: () => void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These properties are already defined in |
||
} | ||
|
||
export const EuiOverlayMask: SFC< | ||
CommonProps & HTMLAttributes<HTMLDivElement> & EuiOverlayMaskProps | ||
>; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The props
name
,id
,placeholder
,value
anddefaultValue
are already part ofReact.InputHTMLAttributes<HTMLInputElement>
.